Index | Thread | Search

From:
Nick Owens <mischief@offblast.org>
Subject:
dhcp6leased patch to fix IA_PD t1 == 0
To:
tech <tech@openbsd.org>
Date:
Wed, 23 Apr 2025 03:14:03 -0700

Download raw body.

Thread
hi,

i moved and got a new isp (google fiber webpass). i moved my odroid-h2
gateway and plugged it in and got met with some dhcp6leased spam in the
log, where it kept sending renews. there seems to be a 'ruckus wireless'
(based on mac oui) sending back ia pd with iaid 0, t1 0, t2 0. ipv6 works
fine besides that, but dhcp6leased does not appear to follow the advice in
RFC 8415 S 21.21 that says the client needs to pick a renew time that isn't
too fast if the server gives 0.

i've arbitrarily picked 1 day here on 0, this at least shuts up dhcp6leased
from spamming renews. i'm not really an ipv6 expert, happy to have input or
adjustments before committing. maybe it needs some randomization in the
renew offset.

previous timo upon state transition to bound would be 0 and we'd fall into
iface_timeout immediately, and now we get bound with a 1 day period.

fugu$ doas ./dhcp6leased -d -v -v
changed iface: rge0[1]
open_udpsock: fe80::21e:6ff:fe45:5c6d%rge0 rdomain: 0
read_lease_file: rge0: 0 2604:5500:c29f:e300::/56
state_transition[rge0] Down -> Rebooting, timo: 1
Rebinding lease on rge0
parse_dhcp: rge0 ia_count: 1
parse_dhcp: DHCPREPLY, xid: 0x408b4a
parse_dhcp: DHO_IA_PD, len: 41
parse_dhcp: IA_PD, IAID: 00000000, T1: 0, T2: 0
parse_ia_pd_options: DHO_IA_PREFIX, len: 25
parse_ia_pd_options: pltime: 19702410, vltime: 31528410, prefix:
2604:5500:c29f:e300::/56
parse_dhcp: DHO_CLIENTID, len: 18
parse_dhcp: DHO_SERVERID, len: 14
parse_dhcp: SERVERID: 000100012a730b3b00163ec8302c
parse_dhcp: pltime: 19702410, vltime: 31528410, prefix:
2604:5500:c29f:e300::/56
prefix delegation #0 2604:5500:c29f:e300::/56 received on rge0 from server
000100012a730b3b00163ec8302c
send_reconfigure_interface: vport0 configure: 2604:5500:c29f:e300::1/56
state_transition[rge0] Rebooting -> Bound, timo: 86400
configure_address: vport0

apologies for the patch mangling, in the process of moving and writing this
on my craptop on gmail.

fugu$ cvs diff engine.c
Index: engine.c
===================================================================
RCS file: /cvs/src/sbin/dhcp6leased/engine.c,v
diff -u -p -r1.24 engine.c
--- engine.c    11 Jul 2024 10:48:51 -0000      1.24
+++ engine.c    23 Apr 2025 10:06:11 -0000
@@ -1091,7 +1091,11 @@ state_transition(struct dhcp6leased_ifac
                request_dhcp_request(iface);
                break;
        case IF_BOUND:
-               iface->timo.tv_sec = iface->t1;
+               /* RFC 8415 21.21 */
+               if(iface->t1 == 0)
+                       iface->timo.tv_sec = 60 * 60 * 24;
+               else
+                       iface->timo.tv_sec = iface->t1;
                switch (old_state) {
                case IF_REQUESTING:
                case IF_RENEWING: