NetworkConfiguration / dhcpcd

DHCP / IPv4LL / IPv6RA / DHCPv6 client.
https://roy.marples.name/projects/dhcpcd
BSD 2-Clause "Simplified" License
337 stars 108 forks source link

DHCPv6 Information-Request response doesn't read info-refresh-time option #329

Closed jvfranklin closed 2 weeks ago

jvfranklin commented 3 months ago

I'm running a test where dhcpcd sends a DHCPv6 Information-Request message, and the server responds with a non-default Information-Refresh-Time (32) option. Dhcpcd isn't reading that option, and so the refresh time remains at the default.

I think I've tracked it down to a line in dhcp6_bind, but I'm not sure if this is fully correct. The test seems to be working with this patch, at least. I'm finding the option in state->recv, but not in state->new in this function.

diff --git a/src/dhcp6.c b/src/dhcp6.c
index 76a6719..b3246d6 100644
--- a/src/dhcp6.c
+++ b/src/dhcp6.c
@@ -3139,7 +3139,7 @@ dhcp6_bind(struct interface *ifp, const char *op, const char *sfrom)

        if (state->reason == NULL)
            state->reason = "INFORM6";
-       o = dhcp6_findmoption(state->new, state->new_len,
+       o = dhcp6_findmoption(state->recv, state->recv_len,
                      D6_OPTION_INFO_REFRESH_TIME, &ol);
        if (o == NULL || ol != sizeof(uint32_t))
            state->renew = IRT_DEFAULT;

Packet capture of the transaction is attached.

Roy, could you confirm?

info-request.zip

jvfranklin commented 3 months ago

dhcpcd debug logs, showing the refresh time remains 86400 secs:

Jan 26 05:36:09 [7337]: dhcpcd-10.0.6 starting Jan 26 05:36:09 [7339]: spawned manager process on PID 7339 Jan 26 05:36:09 [7339]: udev: starting Jan 26 05:36:09 [7339]: dev: loaded udev Jan 26 05:36:09 [7339]: DUID 00:01:00:01:25:d0:44:16:f4:02:70:a4:86:9c Jan 26 05:36:09 [7337]: forked to background Jan 26 05:36:09 [7339]: bond0: executing: /etc/sysapps_script/network/dhcpcd-script PREINIT Jan 26 05:36:09 [7339]: bond0: executing: /etc/sysapps_script/network/dhcpcd-script CARRIER Jan 26 05:36:09 [7339]: bond0: IAID 70:a4:86:9c Jan 26 05:36:09 [7339]: bond0: requesting DHCPv6 information Jan 26 05:36:09 [7339]: bond0: delaying INFORM6 (xid 0x4f4efc), next in 1.1 seconds Jan 26 05:36:10 [7339]: bond0: multicasting INFORM6 (xid 0x4f4efc), next in 1.0 seconds Jan 26 05:36:10 [7339]: bond0: REPLY6 received from fe80::200:10ff:fe10:1080 Jan 26 05:36:10 [7339]: bond0: refresh in 86400 seconds Jan 26 05:36:10 [7339]: bond0: writing lease: /var/lib/dhcpcd/bond0.lease6 Jan 26 05:36:10 [7339]: bond0: executing: /etc/sysapps_script/network/dhcpcd-script INFORM6

rsmarples commented 3 months ago

Roy, could you confirm?

@jvfranklin yup, patch looks good. Open a PR for it so you get credit and I'll merge it in!

perkelix commented 3 months ago

@jvfranklin ?

jvfranklin commented 3 months ago

I can't create any pull requests until I get approval through my company's bureaucracy, so I've been waiting on that. I have a number of other patches I'm waiting to submit, as well. I've got beta-tester access to the upcoming version of the IPv6 Ready Logo DHCPv6 conformance test software, and it's identified a few issues. Sorry for the delays, but I'll get them out as soon as I can.