Skip to content

Conversation

@danlionis
Copy link
Contributor

Fixes a critical bug in apply_tcp_coalesce_accounting and apply_udp_coalesce_accounting where the buffer offset was added twice when calculating the source and destination address positions.

The packet buffer slice (pkt) was already offset by offset (i.e. VIRTIO_NET_HDR_LEN), but the code added offset again to addr_offset. This caused the pseudo-header checksum to be calculated using garbage data (often bytes from the Transport header) instead of the correct Source and Destination IP addresses.

This resulted in invalid TCP/UDP checksum seeds, causing dropped packets.

Fixes a critical bug in `apply_tcp_coalesce_accounting` and
`apply_udp_coalesce_accounting` where the buffer offset was added twice
when calculating the source and destination address positions.

The packet buffer slice (`pkt`) was already offset by `offset` (i.e.
VIRTIO_NET_HDR_LEN), but the code added `offset` again to `addr_offset`.
This caused the pseudo-header checksum to be calculated using garbage
data (often bytes from the Transport header) instead of the correct
Source and Destination IP addresses.

This resulted in invalid TCP/UDP checksum seeds, causing dropped
packets.
@danlionis
Copy link
Contributor Author

Any advice on how to deal with the failing checks? They don't seem to be related to my changes

@vnt-dev
Copy link
Collaborator

vnt-dev commented Dec 20, 2025

Any advice on how to deal with the failing checks? They don't seem to be related to my changes

Let's ignore this problem, I'll handle it.

@vnt-dev
Copy link
Collaborator

vnt-dev commented Dec 22, 2025

This issue is caused by an update in libc. You can refer to nix-rust/nix#2709
for details.
I will temporarily resolve it by pinning libc to version 0.2.177.

@vnt-dev vnt-dev merged commit 2f6f703 into tun-rs:main Dec 22, 2025
14 of 16 checks passed
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.

2 participants