dhcpv4: don't copy reqopts around
authorDavid Härdeman <[email protected]>
Mon, 6 Oct 2025 07:48:43 +0000 (09:48 +0200)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 21 Oct 2025 17:04:42 +0000 (19:04 +0200)
commit1f803caf9a1f9afd566b34fc29f1757f7291f772
tree3b0edf933fb61128f9003b10fd870cc35ad0ec39
parentb1be3984ebf87cdc7a489623b299e574923e3475
dhcpv4: don't copy reqopts around

Ok, this is a bit weird, dhcpv4_handle_msg() passes reqopts to dhcpv4_lease(),
which stashes a copy of the reqopts in the struct dhcp_assignment, and then
dhcpv4_handle_msg() uses the stashed copy instead.

The only reason a copy is made seems to be so that the requested options can
later be reported via ubus (in "ubus call dhcp ipv4leases"), but it is hard to
see a use-case for that (the DHCP server has already replied to the client by
the time the lease is available over ubus) and we don't do anything similar for
DHCPv6, so remove the extra copying.

Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/278
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv4.c
src/odhcpd.h
src/ubus.c