Skip to content

pkt-gen: fix UDP checksum when IPv6 address ranges are used - #990

Open
ocochard wants to merge 1 commit into
luigirizzo:masterfrom
ocochard:fix-ipv6-udp-checksum-ranges
Open

ocochard wants to merge 1 commit into
luigirizzo:masterfrom
ocochard:fix-ipv6-udp-checksum-ranges

Conversation

@ocochard

Copy link
Copy Markdown
Contributor

update_ip6() left the UDP checksum stale for most packets. Unlike update_ip(), it computed the incremental checksum delta only after the source-address wrap, so every earlier "break" (port increment, address increment, and both random paths) returned with udp_sum still 0 and no correction applied. The trailing delta block also re-read oaddr/naddr after they had been reassigned, so the source and destination deltas could not both be accounted for.

Fold each delta in with new_udp_sum() before the corresponding break, mirroring the structure update_ip() already uses, and drop the stale trailing block. IPv4 was not affected.

Verified by driving update_addresses() directly and recomputing every checksum from scratch over the real pseudo-header: 128 packets across six range configurations, 12 mismatches before, 0 after. IPv4 passes both before and after.

update_ip6() left the UDP checksum stale for most packets. Unlike
update_ip(), it computed the incremental checksum delta only after the
source-address wrap, so every earlier "break" (port increment, address
increment, and both random paths) returned with udp_sum still 0 and no
correction applied. The trailing delta block also re-read oaddr/naddr
after they had been reassigned, so the source and destination deltas
could not both be accounted for.

Fold each delta in with new_udp_sum() before the corresponding break,
mirroring the structure update_ip() already uses, and drop the stale
trailing block. IPv4 was not affected.

Verified by driving update_addresses() directly and recomputing every
checksum from scratch over the real pseudo-header: 128 packets across
six range configurations, 12 mismatches before, 0 after. IPv4 passes
both before and after.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant