feat: add anti_gro setting to defeat TCP-GRO coalescing#45
feat: add anti_gro setting to defeat TCP-GRO coalescing#45tracyhatemice wants to merge 1 commit into
Conversation
Linux 6.18's PPPoE GRO offload (and any TCP-aware GRO path) coalesces a stream of mimic-produced fake-TCP packets into a single superframe, since mimic emits a constant wire ack_seq across a data burst. The receiver's XDP ingress then demangles the superframe as one packet, producing garbage that WireGuard drops -- collapsing ingress throughput. New per-filter setting anti_gro (default off) makes egress add a per-packet random jitter to the wire ack_seq, which trips the flush check at net/ipv4/tcp_offload.c:337 (flush |= th->ack_seq ^ th2->ack_seq) and prevents coalescing in both the normal merge and fraglist paths. The padding entropy in conn_padding is adjusted to drop ack_seq when anti_gro is on, keeping receiver-side padding computation symmetric. Both peers must enable the setting; default off preserves bit-for-bit wire compatibility with prior mimic versions.
|
Thanks for the PR. But I have some questions:
|
That's a big concern, that some firewalls (one use case) will be even more confused by these large nonlinear jumps. Also, would doing this increase the overhead a lot? I can also report that this change breaks the BPF verifier on kernel |
Middlebox conntrack is something I had not considered. My mimic runs on the edge router, and my ISP seems fine with the out of window tcp sequence and ack 😅, so the conntrack issue did not surface. Need to reconsider whether this feature is necessary and, if so, how should it be implemented. I also tried the existing conntrack test. The current random jitter breaks conntrack, while a small downward jitter does not. I am still testing that approach. Disabling GRO on the interface does address the issue, although it may also remove the benefits of GRO for non WireGuard traffic on that interface (a throughput vs latency trade).
|
Linux 6.18's PPPoE GRO offload (and any TCP-aware GRO path) coalesces a stream of mimic-produced fake-TCP packets into a single superframe, since mimic emits a constant wire ack_seq across a data burst. The receiver's XDP ingress then demangles the superframe as one packet, producing garbage that WireGuard drops -- collapsing ingress throughput.
New per-filter setting
anti_gro(default off) makes egress add a per-packet random jitter to the wire ack_seq, which trips the flush check at net/ipv4/tcp_offload.c:337 (flush |= th->ack_seq ^ th2->ack_seq) and prevents coalescing in both the normal merge and fraglist paths. The padding entropy in conn_padding is adjusted to drop ack_seq when anti_gro is on, keeping receiver-side padding computation symmetric.Both peers must enable the setting; default off preserves compatibility with prior mimic versions.