From ac8805b6f96acd23557433ecefefed302cbd35b8 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 1 Jul 2020 11:46:01 +0100 Subject: [PATCH] BSD: Setup sysctls before redirecting stderr Need to do this as early as. --- src/dhcpcd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 891f62f2..2bed8e04 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -2262,6 +2262,12 @@ printpidfile: } #endif +#if defined(BSD) && defined(INET6) + /* Disable the kernel RTADV sysctl as early as possible. */ + if (ctx.options & DHCPCD_IPV6 && ctx.options & DHCPCD_IPV6RS) + if_disable_rtadv(); +#endif + if (isatty(STDOUT_FILENO) && freopen(_PATH_DEVNULL, "r", stdout) == NULL) logerr("%s: freopen stdout", __func__); @@ -2278,12 +2284,6 @@ printpidfile: } } -#if defined(BSD) && defined(INET6) - /* Disable the kernel RTADV sysctl as early as possible. */ - if (ctx.options & DHCPCD_IPV6 && ctx.options & DHCPCD_IPV6RS) - if_disable_rtadv(); -#endif - /* If we're not running in privsep, we need to create the DB * directory here. */ if (!(ctx.options & DHCPCD_PRIVSEP)) { -- 2.47.2