From c0d5e9ab91e9724f9952b36dbe414e32804953cc Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 28 Oct 2025 21:57:02 +0100 Subject: [PATCH] bpf: clat: change the signature of update_icmp_checksum() - rename argument 'add' to 'v4to6' - make argument 'ip6h' const since it's not modified by the function --- src/core/bpf/clat.bpf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/bpf/clat.bpf.c b/src/core/bpf/clat.bpf.c index 1bef70421a..de90874c70 100644 --- a/src/core/bpf/clat.bpf.c +++ b/src/core/bpf/clat.bpf.c @@ -111,11 +111,11 @@ update_l4_checksum(struct __sk_buff *skb, } static void -update_icmp_checksum(struct __sk_buff *skb, - struct ipv6hdr *ip6h, - void *icmp_before, - void *icmp_after, - bool add) +update_icmp_checksum(struct __sk_buff *skb, + const struct ipv6hdr *ip6h, + void *icmp_before, + void *icmp_after, + bool v4to6) { struct icmpv6_pseudo ph = {.nh = IPPROTO_ICMPV6, .len = ip6h->payload_len}; __u16 h_before, h_after; @@ -136,12 +136,12 @@ update_icmp_checksum(struct __sk_buff *skb, * itself. */ csum = bpf_csum_diff((__be32 *) &ph, - add ? 0 : sizeof(ph), + v4to6 ? 0 : sizeof(ph), (__be32 *) &ph, - add ? sizeof(ph) : 0, + v4to6 ? sizeof(ph) : 0, 0); - offset = sizeof(struct ethhdr) + (add ? sizeof(struct iphdr) : sizeof(struct ipv6hdr)) + 2; + offset = sizeof(struct ethhdr) + (v4to6 ? sizeof(struct iphdr) : sizeof(struct ipv6hdr)) + 2; /* first two bytes of ICMP header, type and code */ h_before = *(__u16 *) icmp_before;