From 1c6b8e5aef05f5dfadf1a8cad1e7d6e149dc343b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Lled=C3=B3?= Date: Mon, 22 Jun 2026 18:59:26 +0200 Subject: [PATCH 1/3] Add -lpthread flag for the Hurd --- configure | 1 + 1 file changed, 1 insertion(+) 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 From 6245760d695534e06ba3bd64553c7acc09c1adbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Lled=C3=B3?= Date: Wed, 24 Jun 2026 12:12:12 +0200 Subject: [PATCH 2/3] Add new env var `$if_persistent` --- hooks/dhcpcd-run-hooks.8.in | 7 +++++++ src/script.c | 3 +++ 2 files changed, 10 insertions(+) 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" : From cff82db667ce5c2096121e46a338574a217258c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Lled=C3=B3?= Date: Mon, 22 Jun 2026 19:00:21 +0200 Subject: [PATCH 3/3] Hurd: pfinet hook supports lwip and active translators It also clears the interface configuration when `persistent` is false --- hooks/10-pfinet | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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