# HG changeset patch # User Roy Marples # Date 1600524351 -3600 # Node ID dd8347a0ea1c45b8ddcdfcc98a74209ba4dbbcac # Parent 7fb0274b91273701d56cca32c21201f9a1f1387d Adjust prior so that message is logged before starting dev Also add os_init incase other os need similar in the future. diff -r 7fb0274b9127 -r dd8347a0ea1c src/dhcpcd.c --- a/src/dhcpcd.c Sat Sep 19 14:40:50 2020 +0100 +++ b/src/dhcpcd.c Sat Sep 19 15:05:51 2020 +0100 @@ -2367,6 +2367,8 @@ } #endif + os_init(); + #if defined(BSD) && defined(INET6) /* Disable the kernel RTADV sysctl as early as possible. */ if (ctx.options & DHCPCD_IPV6 && ctx.options & DHCPCD_IPV6RS) diff -r 7fb0274b9127 -r dd8347a0ea1c src/dhcpcd.h --- a/src/dhcpcd.h Sat Sep 19 14:40:50 2020 +0100 +++ b/src/dhcpcd.h Sat Sep 19 15:05:51 2020 +0100 @@ -254,10 +254,6 @@ struct dev *dev; void *dev_handle; #endif - -#ifdef __linux__ - char netns[PATH_MAX]; -#endif }; #ifdef USE_SIGNALS diff -r 7fb0274b9127 -r dd8347a0ea1c src/if-bsd.c --- a/src/if-bsd.c Sat Sep 19 14:40:50 2020 +0100 +++ b/src/if-bsd.c Sat Sep 19 15:05:51 2020 +0100 @@ -122,6 +122,12 @@ }; int +os_init(void) +{ + return 0; +} + +int if_init(__unused struct interface *iface) { /* BSD promotes secondary address by default */ diff -r 7fb0274b9127 -r dd8347a0ea1c src/if-linux.c --- a/src/if-linux.c Sat Sep 19 14:40:50 2020 +0100 +++ b/src/if-linux.c Sat Sep 19 15:05:51 2020 +0100 @@ -145,7 +145,6 @@ int route_fd; int generic_fd; uint32_t route_pid; - char netns[PATH_MAX]; }; /* We need this to send a broadcast for InfiniBand. @@ -416,6 +415,18 @@ } int +os_init(void) +{ + char netns[PATH_MAX], *p; + + p = if_getnetworknamespace(netns, sizeof(netns)); + if (p != NULL) + loginfox("network namespace: %s", p); + + return 0; +} + +int if_opensockets_os(struct dhcpcd_ctx *ctx) { struct priv *priv; @@ -465,9 +476,6 @@ if (priv->generic_fd == -1) return -1; - if (if_getnetworknamespace(ctx->netns, sizeof(ctx->netns)) != NULL) - logdebugx("network namespace: %s", ctx->netns); - return 0; } diff -r 7fb0274b9127 -r dd8347a0ea1c src/if-sun.c --- a/src/if-sun.c Sat Sep 19 14:40:50 2020 +0100 +++ b/src/if-sun.c Sat Sep 19 15:05:51 2020 +0100 @@ -109,6 +109,12 @@ static int if_plumb(int, const struct dhcpcd_ctx *, int, const char *); int +os_init(void) +{ + return 0; +} + +int if_init(struct interface *ifp) { diff -r 7fb0274b9127 -r dd8347a0ea1c src/if.h --- a/src/if.h Sat Sep 19 14:40:50 2020 +0100 +++ b/src/if.h Sat Sep 19 15:05:51 2020 +0100 @@ -184,6 +184,7 @@ int if_nametospec(const char *, struct if_spec *); /* The below functions are provided by if-KERNEL.c */ +int os_init(void); int if_conf(struct interface *); int if_init(struct interface *); int if_getssid(struct interface *);