From 5cf8a69c2ced2b390bac9920f58d02b2548b99b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cljm42=E2=80=9D?= <“larry_meaney@iname.com”> Date: Fri, 22 May 2026 14:32:29 -0700 Subject: [PATCH 1/2] fix: treat IPv4LL DHCP assignments as incomplete during boot When IPv4 DHCP is enabled and the interface has carrier, rc.inet1 now waits up to 60 seconds for a non-link-local IPv4 address instead of continuing as soon as dhcpcd assigns a 169.254.x.x address. If no usable IPv4 address is received within the timeout, dhcpcd continues polling in the background. --- etc/rc.d/rc.inet1 | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/etc/rc.d/rc.inet1 b/etc/rc.d/rc.inet1 index 4e1075b094..4093a3d4c7 100755 --- a/etc/rc.d/rc.inet1 +++ b/etc/rc.d/rc.inet1 @@ -184,6 +184,24 @@ carrier(){ return 1 } +# check for a non-IPv4LL address +dhcp4_addr(){ + ip -4 -o addr show dev $1 | awk '$4 !~ /^169[.]254[.]/ {found=1} END{exit !found}' +} + +# wait for DHCP; return 2 when dhcpcd is running but only IPv4LL was assigned +dhcp_wait(){ + local n start=$SECONDS + run timeout 60 dhcpcd -w $DHCP_OPTIONS $1 || return 1 + [[ $IP == ipv6 ]] && return 0 + dhcp4_addr $1 && return 0 + for ((n=SECONDS-start;n<60;n=SECONDS-start)); do + sleep 1 + dhcp4_addr $1 && return 0 + done + return 2 +} + # create bond interface bond_up(){ [[ -d /proc/net/bonding ]] || modprobe bonding mode=${BONDING_MODE[$i]} miimon=${BONDING_MIIMON[$i]} @@ -385,13 +403,20 @@ ipaddr_up(){ if carrier $IFACE; then # interface is UP log "interface $IFACE is UP, polling up to 60 sec for DHCP $IP server" - if ! run timeout 60 dhcpcd -w $DHCP_OPTIONS $IFACE; then - log "can't obtain IP address, continue polling in background on interface $IFACE" + dhcp_wait $IFACE + case $? in + 0) ;; + 2) + log "can't obtain non-link-local IP address, existing dhcpcd continues polling in background on interface $IFACE" + ;; + *) + log "can't obtain IP address, starting dhcpcd to continue polling in background on interface $IFACE" run dhcpcd -b $DHCP_OPTIONS $IFACE - fi + ;; + esac else # interface is DOWN - log "interface $IFACE is DOWN, polling DHCP $IP server in background" + log "interface $IFACE is DOWN, starting dhcpcd to poll DHCP $IP server in background" run dhcpcd -b $DHCP_OPTIONS $IFACE fi elif [[ $DHCP == no ]]; then From 5880ba1ddd10f458dd91512d475c94eec25c610e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cljm42=E2=80=9D?= <“larry_meaney@iname.com”> Date: Mon, 25 May 2026 09:28:07 -0700 Subject: [PATCH 2/2] fix: log IPv4LL DHCP wait recovery --- etc/rc.d/rc.inet1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/rc.d/rc.inet1 b/etc/rc.d/rc.inet1 index 4093a3d4c7..01e8232251 100755 --- a/etc/rc.d/rc.inet1 +++ b/etc/rc.d/rc.inet1 @@ -195,9 +195,13 @@ dhcp_wait(){ run timeout 60 dhcpcd -w $DHCP_OPTIONS $1 || return 1 [[ $IP == ipv6 ]] && return 0 dhcp4_addr $1 && return 0 + log "DHCP returned with IPv4LL only on interface $1; waiting for non-link-local IPv4 address" for ((n=SECONDS-start;n<60;n=SECONDS-start)); do sleep 1 - dhcp4_addr $1 && return 0 + if dhcp4_addr $1; then + log "non-link-local IPv4 address ready on interface $1 after $((SECONDS-start))s" + return 0 + fi done return 2 }