Add reading of the pid from the kext
This commit is contained in:
@@ -33,7 +33,7 @@ const (
|
|||||||
// VerdictRequest is the request structure from the Kext.
|
// VerdictRequest is the request structure from the Kext.
|
||||||
type VerdictRequest struct {
|
type VerdictRequest struct {
|
||||||
id uint32 // ID from RegisterPacket
|
id uint32 // ID from RegisterPacket
|
||||||
_ uint64 // Process ID - does not yet work
|
pid uint64 // Process ID - info only packets
|
||||||
direction uint8
|
direction uint8
|
||||||
ipV6 uint8 // True: IPv6, False: IPv4
|
ipV6 uint8 // True: IPv6, False: IPv4
|
||||||
protocol uint8 // Protocol
|
protocol uint8 // Protocol
|
||||||
@@ -108,6 +108,7 @@ func Handler(packets chan packet.Packet) {
|
|||||||
info.Inbound = packetInfo.direction > 0
|
info.Inbound = packetInfo.direction > 0
|
||||||
info.InTunnel = false
|
info.InTunnel = false
|
||||||
info.Protocol = packet.IPProtocol(packetInfo.protocol)
|
info.Protocol = packet.IPProtocol(packetInfo.protocol)
|
||||||
|
info.PID = packetInfo.pid
|
||||||
|
|
||||||
// IP version
|
// IP version
|
||||||
if packetInfo.ipV6 == 1 {
|
if packetInfo.ipV6 == 1 {
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ func RecvVerdictRequest() (*VerdictRequest, error) {
|
|||||||
|
|
||||||
// SetVerdict sets the verdict for a packet and/or connection.
|
// SetVerdict sets the verdict for a packet and/or connection.
|
||||||
func SetVerdict(pkt *Packet, verdict network.Verdict) error {
|
func SetVerdict(pkt *Packet, verdict network.Verdict) error {
|
||||||
|
if pkt.verdictRequest.pid != 0 {
|
||||||
|
return nil // Ignore info only packets
|
||||||
|
}
|
||||||
if pkt.verdictRequest.id == 0 {
|
if pkt.verdictRequest.id == 0 {
|
||||||
log.Tracer(pkt.Ctx()).Errorf("kext: failed to set verdict %s: no packet ID", verdict)
|
log.Tracer(pkt.Ctx()).Errorf("kext: failed to set verdict %s: no packet ID", verdict)
|
||||||
return ErrNoPacketID
|
return ErrNoPacketID
|
||||||
|
|||||||
Reference in New Issue
Block a user