Do not calculate IP, TCP, UDP checksums on loopback interface.
authorbluhm <bluhm@openbsd.org>
Mon, 5 Jun 2023 11:35:46 +0000 (11:35 +0000)
committerbluhm <bluhm@openbsd.org>
Mon, 5 Jun 2023 11:35:46 +0000 (11:35 +0000)
commitc778c0d73570b51def4f061069af442165eb791e
tree272b1fd8852566afd56b8f587f6f7805d751b35e
parent51d2b5388cc4454e954ac6bf26c358ddc84105a1
Do not calculate IP, TCP, UDP checksums on loopback interface.

Packets sent over loopback got their checksums calculated twice.
In the output path they were filled in and during TCP/IP input all
checksums were calculated again to be compared with the previous
result.

Avoid this by claiming that lo(4) supports hardware checksum
offloading.  For each packet convert the flag that the checksum
should be calculated to the flag that it has been checked successfully.
Keep the flag that it should be calculated for the case that it may
be bridged or forwarded later.

A drawback is that "tcpdump -ni lo0 -v" reports invalid checksum.
But that is the same with physical interfaces and hardware offloading.

OK dlg@
sys/net/if.c
sys/net/if_loop.c