diff --git a/configure b/configure index 22d38605..3be31d6e 100755 --- a/configure +++ b/configure @@ -500,6 +500,7 @@ netbsd*) hurd*) echo "CPPFLAGS+= -D_GNU_SOURCE" >>$CONFIG_MK echo "DHCPCD_SRCS+= if-hurd.c" >>$CONFIG_MK + echo "LDADD+= -lpthread" >>$CONFIG_MK BPF_OS="bpf-hurd.c" # No INET6 support INET6=no diff --git a/hooks/10-pfinet b/hooks/10-pfinet index 4b6b5a64..010ca2f1 100644 --- a/hooks/10-pfinet +++ b/hooks/10-pfinet @@ -1,15 +1,18 @@ # SPDX-License-Identifier: BSD-2-Clause # Copyright (c) 2026 Roy Marples -# Configure the Hurd PFINET translator. +# Configure the Hurd network translator (pfinet or lwip). # It always on socket 2. -case "$(showtrans /servers/socket/2)" in -/hurd/pfinet" "*) pfinet=true;; -*) pfinet=false;; +trans=$(showtrans /servers/socket/2 2>/dev/null) +[ -z "$trans" ] && trans=$(fsysopts /servers/socket/2 2>/dev/null) + +case "$trans" in +*/pfinet" "*|*/lwip" "*) hurd_net=true;; +*) hurd_net=false;; esac -if $pfinet && $if_configured && [ "$ifxname" != "lo" ] ; then +if $hurd_net && $if_configured && [ "$ifxname" != "lo" ] ; then if $if_up && [ -n "$new_ip_address" ]; then flags= if [ -n "$new_subnet_mask" ]; then @@ -20,7 +23,7 @@ if $pfinet && $if_configured && [ "$ifxname" != "lo" ] ; then fi fsysopts /servers/socket/2 -i "$ifxname" \ -a "$new_ip_address" $flags - elif $if_down; then + elif $if_down || { [ "$reason" = STOPPED ] && ! $if_persistent; }; then fsysopts /servers/socket/2 -i "$ifxname" -a 0.0.0.0 fi fi diff --git a/hooks/dhcpcd-run-hooks.8.in b/hooks/dhcpcd-run-hooks.8.in index 93b0d4b9..04d2357d 100644 --- a/hooks/dhcpcd-run-hooks.8.in +++ b/hooks/dhcpcd-run-hooks.8.in @@ -194,6 +194,13 @@ if dhcpcd has configured the .Ev interface otherwise .Dv false . +.It Ev $if_persistent +.Dv true +if the +.Ev interface +is configured to be persistent when dhcpcd exits, +otherwise +.Dv false . .It Ev $if_up .Dv true if the diff --git a/src/script.c b/src/script.c index ff575bb5..0a8c91b0 100644 --- a/src/script.c +++ b/src/script.c @@ -358,6 +358,9 @@ make_env(struct dhcpcd_ctx *ctx, const struct interface *ifp, if (efprintf(fp, "if_configured=%s", ifo->options & DHCPCD_CONFIGURE ? "true" : "false") == -1) goto eexit; + if (efprintf(fp, "if_persistent=%s", + ifo->options & DHCPCD_PERSISTENT ? "true" : "false") == -1) + goto eexit; if (efprintf(fp, "ifcarrier=%s", ifp->carrier == LINK_UNKNOWN ? "unknown" : ifp->carrier == LINK_UP ? "up" :