Files
fips/src/transport
Johnathan Corgan 0ed841b4a5 Test the Ethernet receive loop's own data-frame parse
The data frame carries a two-byte length field so the receiver can trim
Ethernet minimum-frame padding, which would otherwise reach AEAD as
ciphertext. The unit test for that trim rebuilt the parse inline instead of
calling the receive loop, so a regression in the loop's slice could not fail
it: changing the loop to slice buf[3..len] left every Ethernet test green.

The parse is now one function, data_payload, which the receive loop calls
for every data frame and the tests drive directly; the loop keeps no other
slice of the buffer for data frames. The padding test now runs against it,
and new tests cover an unpadded frame, a zero-length padded frame, a frame
shorter than the header and a length field larger than the received bytes.
Dropping the length trim now fails the padding and zero-length tests, and
dropping the bounds check fails the over-long length test. Behaviour is
unchanged: the loop forwards the same bytes and drops the same frames with
the same trace messages.

The trim is covered by a unit test with a synthetic padded frame because no
traffic reaches it on the veth links the chaos harness uses. Measured on a
live ethernet-mesh run: an empty ICMPv6 echo is a 226-byte frame and a
1200-byte echo a 1342-byte frame; the smallest data frame seen was a
54-byte control frame, and short frames (54-byte data, 48-byte beacons)
arrived unpadded; none of 250 received data frames carried bytes beyond
its length field.
2026-09-19 17:21:45 +00:00
..