mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
uip: verify TCP and UDP checksums using the RX descriptor flag
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.
This commit is contained in:
1 parent
7d47edb649
commit
9984649177
3 files changed
+53
-9
No files matched your search
@@ -144,6 +144,9 @@
|
||||
#define RTL837X_REG_CPU_TAG_AWARE_PMASK 0x603C
|
||||
#define RTL837X_REG_MAC_FORCE_MODE 0x6344
|
||||
|
||||
/* Flags in byte 1 of the RX frame descriptor */
|
||||
#define RX_TAG_L4_CSUM_BAD 0x04
|
||||
|
||||
/*
|
||||
* Statistics related registers
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user