]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
ebpf: remove BPF_LL_OFF in nhoff offset
authorEric Leblond <eric@regit.org>
Thu, 14 Feb 2019 11:54:32 +0000 (12:54 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 18 Jun 2019 05:07:02 +0000 (07:07 +0200)
It fixes invalid parsing in with recent kernels and does
not affect older kernels.

ebpf/bypass_filter.c
ebpf/filter.c

index 6d5206ecd558bc113ddd27abbe18dd7c8a56db74..0e858eed2f78270c6907e72f99f2d379cd4d1d7d 100644 (file)
@@ -207,7 +207,7 @@ static __always_inline int ipv6_filter(struct __sk_buff *skb)
  * \return 0 to drop packet out and -1 to accept it
  */
 int SEC("filter") hashfilter(struct __sk_buff *skb) {
-    __u32 nhoff = BPF_LL_OFF + ETH_HLEN;
+    __u32 nhoff = ETH_HLEN;
 
     skb->cb[0] = nhoff;
     switch (skb->protocol) {
index fcd29e5b3d22cac8fe80e6b6edce72c2feaf8f13..32a44314315ba75f6b4570f3a939ff195c9ab61d 100644 (file)
@@ -39,7 +39,7 @@ struct bpf_map_def SEC("maps") ipv4_drop = {
 };
 
 int SEC("filter") hashfilter(struct __sk_buff *skb) {
-    __u32 nhoff = BPF_LL_OFF + ETH_HLEN;
+    __u32 nhoff = ETH_HLEN;
     __u32 ip = 0;
     __u32 *value;