Skip to content

Commit

Permalink
Zero checksum handling for UDP4->UDP6
Browse files Browse the repository at this point in the history
MAP should be transparent to the UDP csum zero in both directions.
  • Loading branch information
angus19 authored and ayourtch committed Oct 23, 2024
1 parent b42c37d commit 1c0066a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nat46/modules/nat46-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,11 @@ void ip6_update_csum(struct sk_buff * skb, struct ipv6hdr * ip6hdr, int do_atomi
struct udphdr *udp = udp_hdr(skb);
unsigned udplen = ntohs(ip6hdr->payload_len) - (do_atomic_frag?8:0); /* UDP hdr + payload */

if ((udp->check == 0) && zero_csum_pass) {
/* zero checksum and the config to pass it is set - do nothing with it */
break;
}

oldsum = udp->check;
udp->check = 0;

Expand Down

1 comment on commit 1c0066a

@angus19
Copy link
Contributor Author

@angus19 angus19 commented on 1c0066a Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If zero_csum_pass = 0:

  • Whole packets with zero csum will have a correct csum calculated
  • Initial fragment with zero csum will still be passed but its csum is incorrect
    • This is treated as a corner case not handled for now

If zero_csum_pass = 1:

  • Whole packets with zero csum will have a zero csum passed
  • Initial fragment with zero csum will be passed

Please sign in to comment.