opnsense-src/sbin/dhclient
Michael Tuexen 878daff4e5 dhclient: improve UDP checksum handling
When sending UDP packets:
* compute the checksum in the correct order. This only has an impact
  if the length of the payload is odd.
* don't send packet with a checksum of zero, use 0xffff instead as
  required.
When receiving UDP packets:
* don't do any computations when the checksum is zero.
* compute the checksum in the correct order. This only has an impact
  if the length of the payload is odd.
* when computing the checksum, store the pseudo header checksum
* if the checksum is computed as zero, use 0xffff instead.
* also accept packets, when the checksum in the packet is the pseudo
  header checksum.
The last point fixes a problem when the DHCP client runs in a VM,
the DHCP server runs on the host serving the VM and the network
interface supports transmit checksum offloading. Since dhclient
doesn't use UDP sockets but bpf devices to read the packets, the
checksum will be incorrect and only contain the checksum of the
pseudo header.

PR:			263229
Reviewed by:		markj, Timo Völker
Tested by:		danilo
Differential Revision:	https://reviews.freebsd.org/D52394

(cherry picked from commit 187ee62c71f2be62870f26ae98de865e330121be)
2025-10-23 08:11:21 +02:00
..
tests Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
alloc.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
bpf.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
clparse.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
conflex.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
convert.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
dhclient-script Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
dhclient-script.8 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
dhclient.8 dhclient: Update dhclient man page for n flag 2024-08-19 21:57:09 -07:00
dhclient.c dhclient: Keep two clocks 2025-04-22 21:50:31 -07:00
dhclient.conf Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
dhclient.conf.5 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
dhclient.leases.5 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
dhcp-options.5 Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
dhcp.h dhclient: Ignore vendor-identifying DHCP options defined in RFC 3925 2024-10-12 14:11:04 +02:00
dhcpd.h dhclient: Keep two clocks 2025-04-22 21:50:31 -07:00
dhctoken.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
dispatch.c dhclient: Keep two clocks 2025-04-22 21:50:31 -07:00
errwarn.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
hash.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
inet.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
options.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
packet.c dhclient: improve UDP checksum handling 2025-10-23 08:11:21 +02:00
parse.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
privsep.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
privsep.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
tables.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
tree.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
tree.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00