From d209e01442717bf56ae4b0a2669a13de140c0091 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 2 Jan 2026 16:41:50 +0100 Subject: [PATCH] bpf: clat: fix translation of ICMPv6 Parameter Problem According to RFC 6145 5.2, the pointer should be set for code 0, not 1. --- src/core/bpf/clat.bpf.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/bpf/clat.bpf.c b/src/core/bpf/clat.bpf.c index e4dd169364..e65edd0fbe 100644 --- a/src/core/bpf/clat.bpf.c +++ b/src/core/bpf/clat.bpf.c @@ -468,14 +468,11 @@ rewrite_icmpv6(struct ipv6hdr *ip6h, case 0: icmp.type = ICMP_PARAMETERPROB; icmp.code = 0; - break; - case 1: - icmp.type = ICMP_DEST_UNREACH; - icmp.code = ICMP_PROT_UNREACH; - ptr = bpf_ntohl(icmp6->icmp6_pointer); + /* Figure 6 in RFC6145 - using if statements b/c of * range at the bottom */ + ptr = bpf_ntohl(icmp6->icmp6_pointer); if (ptr == 0 || ptr == 1) icmp.un.reserved[0] = ptr; else if (ptr == 4 || ptr == 5) @@ -491,6 +488,10 @@ rewrite_icmpv6(struct ipv6hdr *ip6h, else return -1; break; + case 1: + icmp.type = ICMP_DEST_UNREACH; + icmp.code = ICMP_PROT_UNREACH; + break; default: return -1; }