diff options
| author | Roy Marples <roy@marples.name> | 2020-09-19 15:05:51 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-09-19 15:05:51 +0100 |
| commit | 8f78bde8042dace0e0330a58d430a0c7c8a32199 (patch) | |
| tree | e6aaab73d9b37eabfe63c5544e9d9aa9180e9a75 | |
| parent | 1efd31813fde826b000fbc40234ea89979ef73a8 (diff) | |
| download | dhcpcd-8f78bde8042dace0e0330a58d430a0c7c8a32199.tar.xz | |
Adjust prior so that message is logged before starting dev
Also add os_init incase other os need similar in the future.
| -rw-r--r-- | src/dhcpcd.c | 2 | ||||
| -rw-r--r-- | src/dhcpcd.h | 4 | ||||
| -rw-r--r-- | src/if-bsd.c | 6 | ||||
| -rw-r--r-- | src/if-linux.c | 16 | ||||
| -rw-r--r-- | src/if-sun.c | 6 | ||||
| -rw-r--r-- | src/if.h | 1 |
6 files changed, 27 insertions, 8 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 1c863b5e..8fbb6212 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -2367,6 +2367,8 @@ printpidfile: } #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 --git a/src/dhcpcd.h b/src/dhcpcd.h index 0cf774ce..03449e58 100644 --- a/src/dhcpcd.h +++ b/src/dhcpcd.h @@ -254,10 +254,6 @@ struct dhcpcd_ctx { struct dev *dev; void *dev_handle; #endif - -#ifdef __linux__ - char netns[PATH_MAX]; -#endif }; #ifdef USE_SIGNALS diff --git a/src/if-bsd.c b/src/if-bsd.c index 5e748a4e..98bcda63 100644 --- a/src/if-bsd.c +++ b/src/if-bsd.c @@ -122,6 +122,12 @@ struct rtm }; int +os_init(void) +{ + return 0; +} + +int if_init(__unused struct interface *iface) { /* BSD promotes secondary address by default */ diff --git a/src/if-linux.c b/src/if-linux.c index 759b878e..94622d7d 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -145,7 +145,6 @@ struct priv { 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 @@ if_getnetworknamespace(char *buf, size_t len) } 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_opensockets_os(struct dhcpcd_ctx *ctx) 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 --git a/src/if-sun.c b/src/if-sun.c index 4f5c1647..be12385a 100644 --- a/src/if-sun.c +++ b/src/if-sun.c @@ -109,6 +109,12 @@ struct rtm static int if_plumb(int, const struct dhcpcd_ctx *, int, const char *); int +os_init(void) +{ + return 0; +} + +int if_init(struct interface *ifp) { @@ -184,6 +184,7 @@ struct if_spec { 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 *); |
