diff --git a/Dockerfile b/Dockerfile index 56334ebd..d51e635f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update && apt-get install -y \ # add all buildroot files there WORKDIR /home/odysseus/build -RUN git clone https://gitlab.com/buildroot.org/buildroot.git && cd ./buildroot && git checkout 2024.02 +RUN git clone https://gitlab.com/buildroot.org/buildroot.git && cd ./buildroot && git checkout 2024.05 WORKDIR /home/odysseus/outputs/ diff --git a/odysseus_tree/patches/dhcpcd/github.com_NetworkConfiguration_dhcpcd_compare_v10.0.5...v10.0.6.patch b/odysseus_tree/patches/dhcpcd/github.com_NetworkConfiguration_dhcpcd_compare_v10.0.5...v10.0.6.patch deleted file mode 100644 index c9c22fe4..00000000 --- a/odysseus_tree/patches/dhcpcd/github.com_NetworkConfiguration_dhcpcd_compare_v10.0.5...v10.0.6.patch +++ /dev/null @@ -1,897 +0,0 @@ -From 584b52db330a96471ff9301b85ce47ebb065a8a4 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Sun, 12 Nov 2023 11:30:01 +0000 -Subject: [PATCH 01/12] control: Fix hangup for non privsep builds - -Fix related to #262. ---- - src/control.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/control.c b/src/control.c -index 5325ac35..93041f82 100644 ---- a/src/control.c -+++ b/src/control.c -@@ -113,8 +113,9 @@ control_handle_read(struct fd_list *fd) - ssize_t bytes; - - bytes = read(fd->fd, buffer, sizeof(buffer) - 1); -- if (bytes == -1) { -+ if (bytes == -1) - logerr(__func__); -+ if (bytes == -1 || bytes == 0) { - control_hangup(fd); - return; - } - -From 21d020b00e60e71b1300d89815f914145d7372f6 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Sun, 12 Nov 2023 12:16:53 +0000 -Subject: [PATCH 02/12] dhcpcd: Detach from launcher before stopping root - process - -This fixes non privsep builds where the launcher reports dhcpcd -hungup. Unsure why this happens, but it should not be a problem. - -While here, shutdown has no effect on non STREAM sockets and -remove the silly error logging in fork_cb that we read an -error. We already printed the error so this makes no sense. - -Hopefully fixes #262. ---- - src/dhcpcd.c | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) - -diff --git a/src/dhcpcd.c b/src/dhcpcd.c -index 46c64b42..25ce57c1 100644 ---- a/src/dhcpcd.c -+++ b/src/dhcpcd.c -@@ -395,7 +395,6 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) - logerr("write"); - ctx->options |= DHCPCD_DAEMONISED; - // dhcpcd_fork_cb will close the socket -- shutdown(ctx->fork_fd, SHUT_RDWR); - #endif - } - -@@ -1877,8 +1876,6 @@ dhcpcd_fork_cb(void *arg, unsigned short events) - if (ctx->options & DHCPCD_FORKED) { - if (exit_code == EXIT_SUCCESS) - logdebugx("forked to background"); -- else -- logerrx("exited with code %d", exit_code); - eloop_exit(ctx->eloop, exit_code); - } else - dhcpcd_signal_cb(exit_code, ctx); -@@ -2738,8 +2735,19 @@ main(int argc, char **argv, char **envp) - if (ps_stopwait(&ctx) != EXIT_SUCCESS) - i = EXIT_FAILURE; - #endif -- if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED)) -+ if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED)) { - loginfox(PACKAGE " exited"); -+#ifdef USE_SIGNALS -+ /* Detach from the launch process. -+ * This *should* happen after we stop the root process, -+ * but for some reason non privsep builds get a zero length -+ * read in dhcpcd_fork_cb(). */ -+ if (ctx.fork_fd != -1) { -+ if (write(ctx.fork_fd, &i, sizeof(i)) == -1) -+ logerr("%s: write", __func__); -+ } -+#endif -+ } - #ifdef PRIVSEP - if (ps_root_stop(&ctx) == -1) - i = EXIT_FAILURE; -@@ -2753,12 +2761,6 @@ main(int argc, char **argv, char **envp) - setproctitle_fini(); - #endif - #ifdef USE_SIGNALS -- if (ctx.options & DHCPCD_STARTED) { -- /* Try to detach from the launch process. */ -- if (ctx.fork_fd != -1 && -- write(ctx.fork_fd, &i, sizeof(i)) == -1) -- logerr("%s: write", __func__); -- } - if (ctx.options & (DHCPCD_FORKED | DHCPCD_PRIVSEP)) - _exit(i); /* so atexit won't remove our pidfile */ - #endif - -From 3b4c71859c45b9405f96a5ee8fce04bd3014b2d0 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 13 Nov 2023 10:24:15 +0000 -Subject: [PATCH 03/12] control: Abort control recv path on hangup - -This fixes a crash when we try and re-use it in another function. ---- - src/control.c | 30 ++++++++++++++++++------------ - 1 file changed, 18 insertions(+), 12 deletions(-) - -diff --git a/src/control.c b/src/control.c -index 93041f82..17fd13aa 100644 ---- a/src/control.c -+++ b/src/control.c -@@ -106,7 +106,7 @@ control_hangup(struct fd_list *fd) - control_free(fd); - } - --static void -+static int - control_handle_read(struct fd_list *fd) - { - char buffer[1024]; -@@ -117,7 +117,7 @@ control_handle_read(struct fd_list *fd) - logerr(__func__); - if (bytes == -1 || bytes == 0) { - control_hangup(fd); -- return; -+ return -1; - } - - #ifdef PRIVSEP -@@ -129,21 +129,23 @@ control_handle_read(struct fd_list *fd) - fd->flags &= ~FD_SENDLEN; - if (err == -1) { - logerr(__func__); -- return; -+ return 0; - } - if (err == 1 && - ps_ctl_sendargs(fd, buffer, (size_t)bytes) == -1) { - logerr(__func__); - control_free(fd); -+ return -1; - } -- return; -+ return 0; - } - #endif - - control_recvdata(fd, buffer, (size_t)bytes); -+ return 0; - } - --static void -+static int - control_handle_write(struct fd_list *fd) - { - struct iovec iov[2]; -@@ -170,7 +172,7 @@ control_handle_write(struct fd_list *fd) - logerr("%s: write", __func__); - } - control_hangup(fd); -- return; -+ return -1; - } - - TAILQ_REMOVE(&fd->queue, data, next); -@@ -183,7 +185,7 @@ control_handle_write(struct fd_list *fd) - #endif - - if (TAILQ_FIRST(&fd->queue) != NULL) -- return; -+ return 0; - - #ifdef PRIVSEP - if (IN_PRIVSEP_SE(fd->ctx) && !(fd->flags & FD_LISTEN)) { -@@ -196,9 +198,9 @@ control_handle_write(struct fd_list *fd) - if (eloop_event_add(fd->ctx->eloop, fd->fd, ELE_READ, - control_handle_data, fd) == -1) - logerr("%s: eloop_event_add", __func__); -+ return 0; - } - -- - static void - control_handle_data(void *arg, unsigned short events) - { -@@ -207,10 +209,14 @@ control_handle_data(void *arg, unsigned short events) - if (!(events & (ELE_READ | ELE_WRITE | ELE_HANGUP))) - logerrx("%s: unexpected event 0x%04x", __func__, events); - -- if (events & ELE_WRITE && !(events & ELE_HANGUP)) -- control_handle_write(fd); -- if (events & ELE_READ) -- control_handle_read(fd); -+ if (events & ELE_WRITE && !(events & ELE_HANGUP)) { -+ if (control_handle_write(fd) == -1) -+ return; -+ } -+ if (events & ELE_READ) { -+ if (control_handle_read(fd) == -1) -+ return; -+ } - if (events & ELE_HANGUP) - control_hangup(fd); - } - -From ea53344a2430736124bf9fa62acb0d3107acd58f Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 13 Nov 2023 10:29:58 +0000 -Subject: [PATCH 04/12] dhcpcd: Remove stdio callback and detach on daemonise - -For some reason, the stdio callback is extremely flaky on -*some* Linux based distributions making it very hard to debug some -things. -Removing it is fine because we now enforce that we have file descriptors -for stdin, stdout and stdrr on launch and dup them to /dev/null on daemonise. - -It's also interesting to see behavioural differences between -some socketpair implementations that emit a HANGUP and some don't. - -As such, we now close the fork socket on daemonise once more AND -in the fork_cb depending on if we hangup or read zero first. - -Fixes #262 ---- - src/dhcpcd.c | 125 +++++++++++++------------------------------------- - src/dhcpcd.h | 4 -- - src/privsep.c | 12 ++--- - 3 files changed, 37 insertions(+), 104 deletions(-) - -diff --git a/src/dhcpcd.c b/src/dhcpcd.c -index 25ce57c1..17af1a05 100644 ---- a/src/dhcpcd.c -+++ b/src/dhcpcd.c -@@ -364,7 +364,7 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) - errno = ENOSYS; - return; - #else -- int i; -+ int exit_code; - - if (ctx->options & DHCPCD_DAEMONISE && - !(ctx->options & (DHCPCD_DAEMONISED | DHCPCD_NOWAITIP))) -@@ -385,16 +385,19 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) - return; - - #ifdef PRIVSEP -- ps_daemonised(ctx); -+ if (IN_PRIVSEP(ctx)) -+ ps_daemonised(ctx); -+ else - #else -- dhcpcd_daemonised(ctx); -+ dhcpcd_daemonised(ctx); - #endif - -- i = EXIT_SUCCESS; -- if (write(ctx->fork_fd, &i, sizeof(i)) == -1) -- logerr("write"); -- ctx->options |= DHCPCD_DAEMONISED; -- // dhcpcd_fork_cb will close the socket -+ eloop_event_delete(ctx->eloop, ctx->fork_fd); -+ exit_code = EXIT_SUCCESS; -+ if (write(ctx->fork_fd, &exit_code, sizeof(exit_code)) == -1) -+ logerr(__func__); -+ close(ctx->fork_fd); -+ ctx->fork_fd = -1; - #endif - } - -@@ -1814,30 +1817,6 @@ dhcpcd_readdump(struct dhcpcd_ctx *ctx) - dhcpcd_readdump0, ctx); - } - --static void --dhcpcd_stderr_cb(void *arg, unsigned short events) --{ -- struct dhcpcd_ctx *ctx = arg; -- char log[BUFSIZ]; -- ssize_t len; -- -- if (events & ELE_HANGUP) -- eloop_exit(ctx->eloop, EXIT_SUCCESS); -- -- if (!(events & ELE_READ)) -- return; -- -- len = read(ctx->stderr_fd, log, sizeof(log) - 1); -- if (len == -1) { -- if (errno != ECONNRESET) -- logerr(__func__); -- return; -- } -- -- log[len] = '\0'; -- fprintf(stderr, "%s", log); --} -- - static void - dhcpcd_fork_cb(void *arg, unsigned short events) - { -@@ -1928,7 +1907,7 @@ main(int argc, char **argv, char **envp) - ssize_t len; - #if defined(USE_SIGNALS) || !defined(THERE_IS_NO_FORK) - pid_t pid; -- int fork_fd[2], stderr_fd[2]; -+ int fork_fd[2]; - #endif - #ifdef USE_SIGNALS - int sig = 0; -@@ -2013,22 +1992,17 @@ main(int argc, char **argv, char **envp) - TAILQ_INIT(&ctx.ps_processes); - #endif - -- /* Check our streams for validity */ -- ctx.stdin_valid = fcntl(STDIN_FILENO, F_GETFD) != -1; -- ctx.stdout_valid = fcntl(STDOUT_FILENO, F_GETFD) != -1; -- ctx.stderr_valid = fcntl(STDERR_FILENO, F_GETFD) != -1; -+ logopts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID; - -- /* Even we if we don't have input/outputs, we need to -- * ensure they are setup for shells. */ -- if (!ctx.stdin_valid) -+ /* Ensure we have stdin, stdout and stderr file descriptors. -+ * This is important as we do run scripts which expect these. */ -+ if (fcntl(STDIN_FILENO, F_GETFD) == -1) - dup_null(STDIN_FILENO); -- if (!ctx.stdout_valid) -+ if (fcntl(STDOUT_FILENO, F_GETFD) == -1) - dup_null(STDOUT_FILENO); -- if (!ctx.stderr_valid) -+ if (fcntl(STDERR_FILENO, F_GETFD) == -1) - dup_null(STDERR_FILENO); -- -- logopts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID; -- if (ctx.stderr_valid) -+ else - logopts |= LOGERR_ERR; - - i = 0; -@@ -2398,17 +2372,13 @@ main(int argc, char **argv, char **envp) - loginfox(PACKAGE "-" VERSION " starting"); - - // We don't need stdin past this point -- if (ctx.stdin_valid) -- dup_null(STDIN_FILENO); -+ dup_null(STDIN_FILENO); - - #if defined(USE_SIGNALS) && !defined(THERE_IS_NO_FORK) - if (!(ctx.options & DHCPCD_DAEMONISE)) - goto start_manager; - -- if (xsocketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CXNB, 0, fork_fd) == -1 || -- (ctx.stderr_valid && -- xsocketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CXNB, 0, stderr_fd) == -1)) -- { -+ if (xsocketpair(AF_UNIX, SOCK_SEQPACKET|SOCK_CXNB, 0, fork_fd) == -1) { - logerr("socketpair"); - goto exit_failure; - } -@@ -2429,22 +2399,6 @@ main(int argc, char **argv, char **envp) - dhcpcd_fork_cb, &ctx) == -1) - logerr("%s: eloop_event_add", __func__); - -- /* -- * Redirect stderr to the stderr socketpair. -- * Redirect stdout as well. -- * dhcpcd doesn't output via stdout, but something in -- * a called script might. -- */ -- if (ctx.stderr_valid) { -- if (dup2(stderr_fd[1], STDERR_FILENO) == -1 || -- (ctx.stdout_valid && -- dup2(stderr_fd[1], STDOUT_FILENO) == -1)) -- logerr("dup2"); -- close(stderr_fd[0]); -- close(stderr_fd[1]); -- } else if (ctx.stdout_valid) -- dup_null(STDOUT_FILENO); -- - if (setsid() == -1) { - logerr("%s: setsid", __func__); - goto exit_failure; -@@ -2478,19 +2432,6 @@ main(int argc, char **argv, char **envp) - dhcpcd_fork_cb, &ctx) == -1) - logerr("%s: eloop_event_add", __func__); - -- if (ctx.stderr_valid) { -- ctx.stderr_fd = stderr_fd[0]; -- close(stderr_fd[1]); --#ifdef PRIVSEP_RIGHTS -- if (ps_rights_limit_fd(ctx.stderr_fd) == 1) { -- logerr("ps_rights_limit_fd"); -- goto exit_failure; -- } --#endif -- if (eloop_event_add(ctx.eloop, ctx.stderr_fd, ELE_READ, -- dhcpcd_stderr_cb, &ctx) == -1) -- logerr("%s: eloop_event_add", __func__); -- } - #ifdef PRIVSEP - if (IN_PRIVSEP(&ctx) && ps_managersandbox(&ctx, NULL) == -1) - goto exit_failure; -@@ -2602,6 +2543,7 @@ main(int argc, char **argv, char **envp) - if (ifp->active == IF_ACTIVE_USER) - break; - } -+ - if (ifp == NULL) { - if (ctx.ifc == 0) { - int loglevel; -@@ -2735,24 +2677,22 @@ main(int argc, char **argv, char **envp) - if (ps_stopwait(&ctx) != EXIT_SUCCESS) - i = EXIT_FAILURE; - #endif -- if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED)) { -+ if (ctx.options & DHCPCD_STARTED && !(ctx.options & DHCPCD_FORKED)) - loginfox(PACKAGE " exited"); --#ifdef USE_SIGNALS -- /* Detach from the launch process. -- * This *should* happen after we stop the root process, -- * but for some reason non privsep builds get a zero length -- * read in dhcpcd_fork_cb(). */ -- if (ctx.fork_fd != -1) { -- if (write(ctx.fork_fd, &i, sizeof(i)) == -1) -- logerr("%s: write", __func__); -- } --#endif -- } - #ifdef PRIVSEP - if (ps_root_stop(&ctx) == -1) - i = EXIT_FAILURE; - eloop_free(ctx.ps_eloop); - #endif -+ -+#ifdef USE_SIGNALS -+ /* If still attached, detach from the launcher */ -+ if (ctx.options & DHCPCD_STARTED && ctx.fork_fd != -1) { -+ if (write(ctx.fork_fd, &i, sizeof(i)) == -1) -+ logerr("%s: write", __func__); -+ } -+#endif -+ - eloop_free(ctx.eloop); - logclose(); - free(ctx.logfile); -@@ -2760,6 +2700,7 @@ main(int argc, char **argv, char **envp) - #ifdef SETPROCTITLE_H - setproctitle_fini(); - #endif -+ - #ifdef USE_SIGNALS - if (ctx.options & (DHCPCD_FORKED | DHCPCD_PRIVSEP)) - _exit(i); /* so atexit won't remove our pidfile */ -diff --git a/src/dhcpcd.h b/src/dhcpcd.h -index 918dc687..7fee0604 100644 ---- a/src/dhcpcd.h -+++ b/src/dhcpcd.h -@@ -116,10 +116,6 @@ struct passwd; - struct dhcpcd_ctx { - char pidfile[sizeof(PIDFILE) + IF_NAMESIZE + 1]; - char vendor[256]; -- bool stdin_valid; /* It's possible stdin, stdout and stderr */ -- bool stdout_valid; /* could be closed when dhcpcd starts. */ -- bool stderr_valid; -- int stderr_fd; /* FD for logging to stderr */ - int fork_fd; /* FD for the fork init signal pipe */ - const char *cffile; - unsigned long long options; -diff --git a/src/privsep.c b/src/privsep.c -index c3aeab8d..2decb8b8 100644 ---- a/src/privsep.c -+++ b/src/privsep.c -@@ -172,8 +172,7 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) - * Obviously this won't work if we are using a logfile - * or redirecting stderr to a file. */ - if ((ctx->options & DHC_NOCHKIO) == DHC_NOCHKIO || -- (ctx->logfile == NULL && -- (!ctx->stderr_valid || isatty(STDERR_FILENO) == 1))) -+ (ctx->logfile == NULL && isatty(STDERR_FILENO) == 1)) - { - if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) - logerr("setrlimit RLIMIT_FSIZE"); -@@ -305,14 +304,11 @@ ps_rights_limit_stdio(struct dhcpcd_ctx *ctx) - const int iebadf = CAPH_IGNORE_EBADF; - int error = 0; - -- if (ctx->stdin_valid && -- caph_limit_stream(STDIN_FILENO, CAPH_READ | iebadf) == -1) -+ if (caph_limit_stream(STDIN_FILENO, CAPH_READ | iebadf) == -1) - error = -1; -- if (ctx->stdout_valid && -- caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | iebadf) == -1) -+ if (caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | iebadf) == -1) - error = -1; -- if (ctx->stderr_valid && -- caph_limit_stream(STDERR_FILENO, CAPH_WRITE | iebadf) == -1) -+ if (caph_limit_stream(STDERR_FILENO, CAPH_WRITE | iebadf) == -1) - error = -1; - - return error; - -From 8d12632c670f02d8a685e80c8abad7049d3dd18f Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 13 Nov 2023 15:54:50 +0000 -Subject: [PATCH 05/12] Fix privsep builds for prior. - ---- - src/dhcpcd.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/dhcpcd.c b/src/dhcpcd.c -index 17af1a05..5f8fc02b 100644 ---- a/src/dhcpcd.c -+++ b/src/dhcpcd.c -@@ -388,9 +388,8 @@ dhcpcd_daemonise(struct dhcpcd_ctx *ctx) - if (IN_PRIVSEP(ctx)) - ps_daemonised(ctx); - else --#else -- dhcpcd_daemonised(ctx); - #endif -+ dhcpcd_daemonised(ctx); - - eloop_event_delete(ctx->eloop, ctx->fork_fd); - exit_code = EXIT_SUCCESS; - -From 6788608eb0fcd32fd23974100cdd42d3174cb8d1 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 13 Nov 2023 16:05:04 +0000 -Subject: [PATCH 06/12] Fix an unused var warning for capsicum for prior - ---- - src/privsep.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/privsep.c b/src/privsep.c -index 2decb8b8..4cca12ee 100644 ---- a/src/privsep.c -+++ b/src/privsep.c -@@ -299,7 +299,7 @@ ps_rights_limit_fdpair(int fd[]) - } - - static int --ps_rights_limit_stdio(struct dhcpcd_ctx *ctx) -+ps_rights_limit_stdio() - { - const int iebadf = CAPH_IGNORE_EBADF; - int error = 0; -@@ -452,7 +452,7 @@ ps_startprocess(struct ps_process *psp, - ctx->ps_log_root_fd = -1; - } - #ifdef PRIVSEP_RIGHTS -- if (ps_rights_limit_stdio(ctx) == -1) { -+ if (ps_rights_limit_stdio() == -1) { - logerr("ps_rights_limit_stdio"); - goto errexit; - } -@@ -666,7 +666,7 @@ ps_managersandbox(struct dhcpcd_ctx *ctx, const char *_pledge) - #ifdef PRIVSEP_RIGHTS - if ((ctx->pf_inet_fd != -1 && - ps_rights_limit_ioctl(ctx->pf_inet_fd) == -1) || -- ps_rights_limit_stdio(ctx) == -1) -+ ps_rights_limit_stdio() == -1) - { - logerr("%s: cap_rights_limit", __func__); - return -1; - -From e337bd7ce4a8a53d0ee6bf8cc0f4fd2b135943a4 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Sun, 10 Dec 2023 08:27:30 +0000 -Subject: [PATCH 07/12] Document that limiting address protocol can affect - signalling dhcpcd - -Fixes #264 ---- - src/dhcpcd.8.in | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/dhcpcd.8.in b/src/dhcpcd.8.in -index 4cd092e5..f4508761 100644 ---- a/src/dhcpcd.8.in -+++ b/src/dhcpcd.8.in -@@ -24,7 +24,7 @@ - .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - .\" SUCH DAMAGE. - .\" --.Dd August 31, 2022 -+.Dd December 10, 2022 - .Dt DHCPCD 8 - .Os - .Sh NAME -@@ -186,13 +186,16 @@ The - .Fl w , Fl Fl waitip - option is enabled in this instance to maintain compatibility with older - versions. --Using a single interface also affects the -+Using a single interface, -+optionally further limited to an address protocol, -+also affects the - .Fl k , - .Fl N , - .Fl n - and - .Fl x --options, where the same interface will need to be specified, as a lack of an -+options, where the same interface and any address protocol -+will need to be specified, as a lack of an - interface will imply Manager mode which this is not. - To force starting in Manager mode with only one interface, the - .Fl M , Fl Fl manager - -From 0a0bbfe74eb2dda8a4594a7a3547dd73456a0df0 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Tue, 12 Dec 2023 07:13:29 +0000 -Subject: [PATCH 08/12] Fix year - ---- - src/dhcpcd.8.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/dhcpcd.8.in b/src/dhcpcd.8.in -index f4508761..93232840 100644 ---- a/src/dhcpcd.8.in -+++ b/src/dhcpcd.8.in -@@ -24,7 +24,7 @@ - .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - .\" SUCH DAMAGE. - .\" --.Dd December 10, 2022 -+.Dd December 10, 2023 - .Dt DHCPCD 8 - .Os - .Sh NAME - -From 411e6539fd242224b320782eac4b4769f13a81fe Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Sun, 10 Dec 2023 07:34:19 +0000 -Subject: [PATCH 09/12] Fully configure an interface when being activated. - -We need the full configuration - for example dhcpcd.conf -might have environment options for the hooks for the interface -being activated. - -Because we now guard against starting protocols with IF_ACTIVE_USER -this is safe. - -Fixes #257. ---- - src/dhcpcd.c | 35 ++++++++++++----------------------- - src/if-options.c | 2 +- - src/if-options.h | 1 - - 3 files changed, 13 insertions(+), 25 deletions(-) - -diff --git a/src/dhcpcd.c b/src/dhcpcd.c -index 5f8fc02b..3571aae0 100644 ---- a/src/dhcpcd.c -+++ b/src/dhcpcd.c -@@ -657,20 +657,17 @@ configure_interface(struct interface *ifp, int argc, char **argv, - } - - static void --dhcpcd_initstate2(struct interface *ifp, unsigned long long options) -+dhcpcd_initstate1(struct interface *ifp, int argc, char **argv, -+ unsigned long long options) - { - struct if_options *ifo; - -- if (options) { -- if ((ifo = default_config(ifp->ctx)) == NULL) { -- logerr(__func__); -- return; -- } -- ifo->options |= options; -- free(ifp->options); -- ifp->options = ifo; -- } else -- ifo = ifp->options; -+ configure_interface(ifp, argc, argv, options); -+ if (!ifp->active) -+ return; -+ -+ ifo = ifp->options; -+ ifo->options |= options; - - #ifdef INET6 - if (ifo->options & DHCPCD_IPV6 && ipv6_init(ifp->ctx) == -1) { -@@ -680,16 +677,6 @@ dhcpcd_initstate2(struct interface *ifp, unsigned long long options) - #endif - } - --static void --dhcpcd_initstate1(struct interface *ifp, int argc, char **argv, -- unsigned long long options) --{ -- -- configure_interface(ifp, argc, argv, options); -- if (ifp->active) -- dhcpcd_initstate2(ifp, 0); --} -- - static void - dhcpcd_initstate(struct interface *ifp, unsigned long long options) - { -@@ -1033,15 +1020,17 @@ dhcpcd_activateinterface(struct interface *ifp, unsigned long long options) - if (ifp->active) - return; - -+ /* IF_ACTIVE_USER will start protocols when the interface is started. -+ * IF_ACTIVE will ask the protocols for setup, -+ * such as any delegated prefixes. */ - ifp->active = IF_ACTIVE; -- dhcpcd_initstate2(ifp, options); -+ dhcpcd_initstate(ifp, options); - - /* It's possible we might not have been able to load - * a config. */ - if (!ifp->active) - return; - -- configure_interface1(ifp); - run_preinit(ifp); - dhcpcd_prestartinterface(ifp); - } -diff --git a/src/if-options.c b/src/if-options.c -index 9c930f38..b28e4ee2 100644 ---- a/src/if-options.c -+++ b/src/if-options.c -@@ -2407,7 +2407,7 @@ finish_config(struct if_options *ifo) - ~(DHCPCD_IPV6RA_AUTOCONF | DHCPCD_IPV6RA_REQRDNSS); - } - --struct if_options * -+static struct if_options * - default_config(struct dhcpcd_ctx *ctx) - { - struct if_options *ifo; -diff --git a/src/if-options.h b/src/if-options.h -index b37a08d3..53914655 100644 ---- a/src/if-options.h -+++ b/src/if-options.h -@@ -285,7 +285,6 @@ struct if_options { - struct auth auth; - }; - --struct if_options *default_config(struct dhcpcd_ctx *); - struct if_options *read_config(struct dhcpcd_ctx *, - const char *, const char *, const char *); - int add_options(struct dhcpcd_ctx *, const char *, - -From c7a142affe8f4ef989e58fb8ef93a6e7a6244fca Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 18 Dec 2023 12:15:10 +0000 -Subject: [PATCH 10/12] DHCP6: Improve logging when changing IA type - -Changing from PD to IA or IA to PD can result in a diagnostic -when there is no address to confirm AND we haven't loaded -a lease. -This improves the check and no more Success errors should -be reported. ---- - src/dhcp6.c | 22 ++++++++++------------ - 1 file changed, 10 insertions(+), 12 deletions(-) - -diff --git a/src/dhcp6.c b/src/dhcp6.c -index 63fe2dc6..6703f5cf 100644 ---- a/src/dhcp6.c -+++ b/src/dhcp6.c -@@ -2589,21 +2589,17 @@ dhcp6_validatelease(struct interface *ifp, - } - state->has_no_binding = false; - nia = dhcp6_findia(ifp, m, len, sfrom, acquired); -- if (nia == 0) { -- if (state->state != DH6S_CONFIRM && ok_errno != 0) { -- logerrx("%s: no useable IA found in lease", ifp->name); -- return -1; -- } -- -- /* We are confirming and have an OK, -- * so look for ia's in our old lease. -- * IA's must have existed here otherwise we would -- * have rejected it earlier. */ -- assert(state->new != NULL && state->new_len != 0); -+ if (nia == 0 && state->state == DH6S_CONFIRM && ok_errno == 0 && -+ state->new && state->new_len) -+ { - state->has_no_binding = false; - nia = dhcp6_findia(ifp, state->new, state->new_len, - sfrom, acquired); - } -+ if (nia == 0) { -+ logerrx("%s: no useable IA found in lease", ifp->name); -+ return -1; -+ } - return nia; - } - -@@ -2657,8 +2653,10 @@ dhcp6_readlease(struct interface *ifp, int validate) - /* Check to see if the lease is still valid */ - fd = dhcp6_validatelease(ifp, &buf.dhcp6, (size_t)bytes, NULL, - &state->acquired); -- if (fd == -1) -+ if (fd == -1) { -+ bytes = 0; /* We have already reported the error */ - goto ex; -+ } - - if (state->expire != ND6_INFINITE_LIFETIME && - (time_t)state->expire < now - mtime && - -From 01de6f23d323236b44d6d952fa0dab183db1d009 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 18 Dec 2023 12:22:13 +0000 -Subject: [PATCH 11/12] DHCP6: For Prefix Delegation, the - interface means no - assignment - -- is an invalid interface name. -So we take this to mean don't assign the Delegated Prefix to -any interfaces. -The reject route for the Delegated Prefix is still installed. - -Fixes #270 ---- - src/dhcp6.c | 5 +++-- - src/dhcpcd.conf.5.in | 4 +++- - 2 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/dhcp6.c b/src/dhcp6.c -index 6703f5cf..bdc3664e 100644 ---- a/src/dhcp6.c -+++ b/src/dhcp6.c -@@ -3871,8 +3871,9 @@ dhcp6_activateinterfaces(struct interface *ifp) - sla = &ia->sla[j]; - ifd = if_find(ifp->ctx->ifaces, sla->ifname); - if (ifd == NULL) { -- logwarn("%s: cannot delegate to %s", -- ifp->name, sla->ifname); -+ if (*sla->ifname != '-') -+ logwarn("%s: cannot delegate to %s", -+ ifp->name, sla->ifname); - continue; - } - if (!ifd->active) { -diff --git a/src/dhcpcd.conf.5.in b/src/dhcpcd.conf.5.in -index 566b3727..878cdb8e 100644 ---- a/src/dhcpcd.conf.5.in -+++ b/src/dhcpcd.conf.5.in -@@ -24,7 +24,7 @@ - .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - .\" SUCH DAMAGE. - .\" --.Dd October 4, 2023 -+.Dd December 18, 2023 - .Dt DHCPCD.CONF 5 - .Os - .Sh NAME -@@ -359,6 +359,7 @@ Otherwise addresses are only assigned for each - .Ar interface - and - .Ar sla_id . -+To avoid delegating to any interface, use - as the invalid interface name. - Each assigned address will have a - .Ar suffix , - defaulting to 1. -@@ -415,6 +416,7 @@ interface eth0 - ia_na 1 # request an IPv6 address - ia_pd 2 eth1/0 # request a PD and assign it to eth1 - ia_pd 3 eth2/1 eth3/2 # req a PD and assign it to eth2 and eth3 -+ ia_pd 4 - # request a PD but don't assign it - .Ed - .It Ic ipv4only - Only configure IPv4. - -From 1c8ae59836fa87b4c63c598087f0460ec20ed862 Mon Sep 17 00:00:00 2001 -From: Roy Marples -Date: Mon, 18 Dec 2023 15:39:51 +0000 -Subject: [PATCH 12/12] Release dhcpcd-10.0.6 - ---- - src/defs.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/defs.h b/src/defs.h -index a2b1f890..c46b2e54 100644 ---- a/src/defs.h -+++ b/src/defs.h -@@ -29,7 +29,7 @@ - #define DEFS_H - - #define PACKAGE "dhcpcd" --#define VERSION "10.0.5" -+#define VERSION "10.0.6" - - #ifndef PRIVSEP_USER - # define PRIVSEP_USER "_" PACKAGE