]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Adjust prior so that message is logged before starting dev
authorRoy Marples <roy@marples.name>
Sat, 19 Sep 2020 14:05:51 +0000 (15:05 +0100)
committerRoy Marples <roy@marples.name>
Sat, 19 Sep 2020 14:05:51 +0000 (15:05 +0100)
Also add os_init incase other os need similar in the future.

src/dhcpcd.c
src/dhcpcd.h
src/if-bsd.c
src/if-linux.c
src/if-sun.c
src/if.h

index 1c863b5e58f766caacc11f31abbde2d696d37d51..8fbb6212191a4d67b8a5c2a3c3c3843bfa0a928e 100644 (file)
@@ -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)
index 0cf774ce166d4ccb46809728fec69a0d30cf29d1..03449e5846053d3255087762420ad14c2aa75d70 100644 (file)
@@ -254,10 +254,6 @@ struct dhcpcd_ctx {
        struct dev *dev;
        void *dev_handle;
 #endif
-
-#ifdef __linux__
-       char netns[PATH_MAX];
-#endif
 };
 
 #ifdef USE_SIGNALS
index 5e748a4e9dcfa8d8737def0fd25992b6849e650e..98bcda63e9a21104b946e61a0138c26eed1d2618 100644 (file)
@@ -121,6 +121,12 @@ struct rtm
        char buffer[sizeof(struct sockaddr_storage) * RTAX_MAX];
 };
 
+int
+os_init(void)
+{
+       return 0;
+}
+
 int
 if_init(__unused struct interface *iface)
 {
index 759b878e164f25350b2c840b19c4b6d9843e06fe..94622d7d1ef36143f61556b2705b7cbb2e2cd5b4 100644 (file)
@@ -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.
@@ -415,6 +414,18 @@ if_getnetworknamespace(char *buf, size_t len)
        return bufp;
 }
 
+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)
 {
@@ -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;
 }
 
index 4f5c164731a891f27876e04ddf5bac1655776a1a..be12385a3dbfbd5b6be3931875e4eed6ed3f7347 100644 (file)
@@ -108,6 +108,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)
 {
index 803f58184822f0d76b27b5670aef15ea39be9576..4e8302ba6d3c8ddcc65a226460a0f233d027b7f2 100644 (file)
--- a/src/if.h
+++ b/src/if.h
@@ -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 *);