From 06b5b4ac25ce5324d401215b501846f842ee2edc Mon Sep 17 00:00:00 2001 From: Alireza Karami Date: Wed, 15 Nov 2023 06:15:59 -0800 Subject: [PATCH] fix handling large packets and sending icmp-too-big fragmentation bug (#206) Summary: bpf(icmp-too-big): This commit fixes a bug that katran cannot deal with large packets. Katran should generate `ICMP_TOO_BIG` packet ('destination unreachable') for this situation but randomly packets dropped from processing in NIC due to checksum issue. So, we need to generate an IP header with `frag_off = 0` option to fix bytes replacements and fragmentation affects. Pull Request resolved: https://github.com/facebookincubator/katran/pull/206 Reviewed By: avasylev Differential Revision: D51274722 Pulled By: frankfeir fbshipit-source-id: 5b7d469866a4c2ee67f1ab0fb21e8238d22f5475 --- katran/lib/bpf/handle_icmp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/katran/lib/bpf/handle_icmp.h b/katran/lib/bpf/handle_icmp.h index 41d191c76..c2ef80713 100644 --- a/katran/lib/bpf/handle_icmp.h +++ b/katran/lib/bpf/handle_icmp.h @@ -151,6 +151,7 @@ __attribute__((__always_inline__)) static inline int send_icmp4_too_big( iph->ttl = DEFAULT_TTL; iph->daddr = orig_iph->saddr; iph->saddr = orig_iph->daddr; + iph->frag_off = 0; iph->version = 4; iph->ihl = 5; iph->protocol = IPPROTO_ICMP;