From 1a637cffabfa6b66bb0052075697e0f45443cb16 Mon Sep 17 00:00:00 2001 From: Christian Deacon Date: Tue, 25 Mar 2025 11:47:41 -0400 Subject: [PATCH] Improve protocol check. --- src/xdp/prog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xdp/prog.c b/src/xdp/prog.c index 86b05d4..6b6c854 100644 --- a/src/xdp/prog.c +++ b/src/xdp/prog.c @@ -90,8 +90,8 @@ int xdp_prog_main(struct xdp_md *ctx) } #endif - // We only want to process TCP, UDP, and ICMP packets. - if ((iph6 && iph6->nexthdr != IPPROTO_UDP && iph6->nexthdr != IPPROTO_TCP && iph6->nexthdr != IPPROTO_ICMP) && (iph && iph->protocol != IPPROTO_UDP && iph->protocol != IPPROTO_TCP && iph->protocol != IPPROTO_ICMP)) + // We only want to process TCP, UDP, and ICMP protocols. + if ((iph && iph->protocol != IPPROTO_UDP && iph->protocol != IPPROTO_TCP && iph->protocol != IPPROTO_ICMP) || (iph6 && iph6->nexthdr != IPPROTO_UDP && iph6->nexthdr != IPPROTO_TCP && iph6->nexthdr != IPPROTO_ICMP)) { inc_pkt_stats(stats, STATS_TYPE_PASSED); @@ -162,6 +162,7 @@ int xdp_prog_main(struct xdp_md *ctx) struct tcphdr *tcph = NULL; struct udphdr *udph = NULL; struct icmphdr *icmph = NULL; + struct icmp6hdr *icmp6h = NULL; u16 src_port = 0;