LibtraceTeam / libtrace

C Library for working with network packet traces
GNU Lesser General Public License v3.0
158 stars 50 forks source link

Fix: writing packets via ring: to veth interfaces #181

Closed rsanger closed 3 years ago

rsanger commented 3 years ago

Fixes ring: hang @salcock found in veths. ring: would only send 256 packets and then hang; it was never able to reuse any frame in the ring.

This is a kernel bug, we do not request timestamps yet they were returned, so I will look to get a upstream fix.

See commit message for more details.

rsanger commented 3 years ago

For future reference, I was mistaken about the trigger, this is unrelated to the patch that added veth timestamp support in Linux 4.20. This bug is present in 4.19, and likely earlier.

Still, unknown as to the first version of Linux with the problem, it could have been present since tx timestamps were added to packetmmap (i.e. Linux 3.10). More investigation still required.

rsanger commented 3 years ago

This was likely an issue since 3.10.

Veth was adding timestamps in the RX path. Because the buffer is shared between TX and RX, the path TX was reading the RX timestamp.

This will be fixed in Linux v5.14