odhcp6c: set server address from Information-request reply
authorBert Goemans <[email protected]>
Thu, 11 Jan 2024 16:17:42 +0000 (17:17 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 21 Oct 2025 16:58:17 +0000 (18:58 +0200)
Update the environment variable STATE_SERVER_ADDR with the address
of the DHCPv6 server when a reply to an Information-request message
is received. Without this, there is no way of knowing which server
replied to the Information-request.
This is also consistent with the way that replies to Request and
Rebind messages are handled.

Signed-off-by: Bert Goemans <[email protected]>
Link: https://github.com/openwrt/odhcp6c/pull/83
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv6.c

index 2075006b6cc61de772648df563d14284eb590ea5..4c1b889750d23e3d8d496d8e6429814109990d7f 100644 (file)
@@ -1353,6 +1353,9 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, _unused const int rc,
                if (!odhcp6c_is_bound())
                        dhcpv6_clear_all_server_cand();
 
+               odhcp6c_clear_state(STATE_SERVER_ADDR);
+               odhcp6c_add_state(STATE_SERVER_ADDR, &from->sin6_addr, 16);
+
                t1 = refresh;
                break;