mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
The TODO next to the disabled TCP checksum code asks which bit of the RX tag carries the result. It is bit 2 of byte 1: the hardware sets it when the L4 checksum is bad. That answers the question for UDP as well, which was not being checked either because UIP_CONF_UDP_CHECKSUMS is 0. Both paths now read the flag instead of running a checksum over the payload on the 8051. A zero UDP checksum, which is optional in IPv4, is not flagged by the hardware, so DHCP keeps working and no extra condition is needed. rx_headers lives in rtlplayground.c, which the host tests do not link, so test_httpd_tx carries the storage itself the way it already carries uip_buf. A zeroed descriptor reads as a good checksum, so the existing scenarios are unaffected. A new scenario sets the flag on a request and expects it counted as a checksum error and left unanswered, then sends the same request with the flag clear and expects it served. Built against uip.c without this change, those first two checks fail and the two control checks still pass, so the scenario tells the two versions apart rather than merely exercising the code. Costs 156 bytes of code on SWTGW218AS and no extra XDATA.