From bef2b5d3ef552f868e3d8f2e658fc49579d9d82e Mon Sep 17 00:00:00 2001 From: Kioubit Date: Fri, 24 Dec 2021 18:04:09 -0500 Subject: [PATCH] Fix BPF Filter --- pndp/rawsocket.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pndp/rawsocket.go b/pndp/rawsocket.go index 6eab4d7..b54b8f6 100644 --- a/pndp/rawsocket.go +++ b/pndp/rawsocket.go @@ -85,16 +85,16 @@ func listen(iface string, responder chan *ndpRequest, requestType ndpType, stopW //Neighbor Advertisement protocolNo = 0x88 } - - var f bpfFilter = []bpf.Instruction{ + var f bpfFilter + f = []bpf.Instruction{ // Load "EtherType" field from the ethernet header. bpf.LoadAbsolute{Off: 12, Size: 2}, // Jump to the drop packet instruction if EtherType is not IPv6. - bpf.JumpIf{Cond: bpf.JumpNotEqual, Val: 0x86dd, SkipTrue: 4}, + bpf.JumpIf{Cond: bpf.JumpNotEqual, Val: 0x86dd, SkipTrue: 5}, // Load "Next Header" field from IPV6 header. bpf.LoadAbsolute{Off: 20, Size: 1}, // Jump to the drop packet instruction if Next Header is not ICMPv6. - bpf.JumpIf{Cond: bpf.JumpNotEqual, Val: 0x3a, SkipTrue: 2}, + bpf.JumpIf{Cond: bpf.JumpNotEqual, Val: 0x3a, SkipTrue: 3}, // Load "Type" field from ICMPv6 header. bpf.LoadAbsolute{Off: 54, Size: 1}, // Jump to the drop packet instruction if Type is not Neighbor Solicitation / Advertisement.