Mercurial > hg > dhcpcd
changeset 5458:dd8347a0ea1c draft
Adjust prior so that message is logged before starting dev
Also add os_init incase other os need similar in the future.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Sat, 19 Sep 2020 15:05:51 +0100 |
| parents | 7fb0274b9127 |
| children | 4ac77faa4990 |
| files | src/dhcpcd.c src/dhcpcd.h src/if-bsd.c src/if-linux.c src/if-sun.c src/if.h |
| diffstat | 6 files changed, 27 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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
--- 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 */
--- 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; }
--- 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) {
--- 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 *);
