]> git.ipfire.org Git - thirdparty/dhcpcd.git/commit
DHCP: Fix checksum validation
authorRoy Marples <roy@marples.name>
Wed, 2 Oct 2024 06:49:36 +0000 (07:49 +0100)
committerRoy Marples <roy@marples.name>
Wed, 2 Oct 2024 14:46:27 +0000 (15:46 +0100)
commitdcef5d9bca3310e3f16be4d602fe7e13555b2b9c
treecbcc65c2e0be592766d93470f2276030272a149d
parent80c010a3bcd1c5a8a756253e7886478bbb6f3fce
DHCP: Fix checksum validation

in_cksum falls over with struct ip in a union of uint16_t with
some compilers.

The fix is to create a smaller pseudo header, fill in the bits
we need and then copy this to a uint8_t array which we then
send to in_cksum.

Tested on Debian-12 with clang-15 and CFLAGS=-Os

While here, just check that the UDP checksum check is zero
rather than zeroing it out and checking it matches.

Co-authored-by: Zikai Chen <chenzikai@google.com>
src/dhcp.c