]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Fix compile for prior without dev plugins
authorRoy Marples <roy@marples.name>
Sun, 24 May 2020 10:49:58 +0000 (11:49 +0100)
committerRoy Marples <roy@marples.name>
Sun, 24 May 2020 10:49:58 +0000 (11:49 +0100)
src/dev.h
src/dhcpcd.c
src/privsep-root.c
src/privsep.c

index 8ce4eb71039c0432d553392bc5bf7dfc5954d8c1..d51cbbec8a062eef057736d1afd81186d9310925 100644 (file)
--- a/src/dev.h
+++ b/src/dev.h
@@ -51,11 +51,6 @@ int dev_initialized(struct dhcpcd_ctx *, const char *);
 int dev_listening(struct dhcpcd_ctx *);
 int dev_start(struct dhcpcd_ctx *, int (*)(void *, int, const char *));
 void dev_stop(struct dhcpcd_ctx *);
-#else
-#define dev_initialized(a, b) (1)
-#define dev_listening(a) (0)
-#define dev_start(a) {}
-#define dev_stop(a) {}
 #endif
 
 #endif
index 0c32098cf9724f15386b876cdcac202b40677e2d..c81637f1500f44f291a3aef09e527a5178d312d5 100644 (file)
@@ -2256,12 +2256,14 @@ printpidfile:
                goto exit_failure;
        }
 
+#ifdef PLUGIN_DEV
        /* Start any dev listening plugin which may want to
         * change the interface name provided by the kernel */
        if (!IN_PRIVSEP(&ctx) &&
            (ctx.options & (DHCPCD_MASTER | DHCPCD_DEV)) ==
            (DHCPCD_MASTER | DHCPCD_DEV))
                dev_start(&ctx, dhcpcd_handleinterface);
+#endif
 
        setproctitle("%s%s%s",
            ctx.options & DHCPCD_MASTER ? "[master]" : argv[optind],
@@ -2454,7 +2456,9 @@ exit1:
 #ifdef INET6
        ipv6_ctxfree(&ctx);
 #endif
+#ifdef PLUGIN_DEV
        dev_stop(&ctx);
+#endif
 #ifdef PRIVSEP
        eloop_free(ctx.ps_eloop);
 #endif
index 6a82fb6b60f17d8ba21d1e2f5e7aa22f80c61133..198f224ce2df37daa158dae58b7852958987688e 100644 (file)
@@ -556,6 +556,7 @@ ps_root_recvmsg(void *arg)
                logerr(__func__);
 }
 
+#ifdef PLUGIN_DEV
 static int
 ps_root_handleinterface(void *arg, int action, const char *ifname)
 {
@@ -576,6 +577,7 @@ ps_root_handleinterface(void *arg, int action, const char *ifname)
        return (int)ps_sendcmd(ctx, ctx->ps_data_fd, PS_DEV_IFCMD, flag,
            ifname, strlen(ifname) + 1);
 }
+#endif
 
 static int
 ps_root_startcb(void *arg)
@@ -612,11 +614,13 @@ ps_root_startcb(void *arg)
                return -1;
 #endif
 
+#ifdef PLUGIN_DEV
        /* Start any dev listening plugin which may want to
         * change the interface name provided by the kernel */
        if ((ctx->options & (DHCPCD_MASTER | DHCPCD_DEV)) ==
            (DHCPCD_MASTER | DHCPCD_DEV))
                dev_start(ctx, ps_root_handleinterface);
+#endif
 
        return 0;
 }
index 3ee508bec8418aa47981aa85b9007723895897ba..6f042815743e60aa495d5f14796446536f90df51 100644 (file)
@@ -697,7 +697,9 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd,
                logdebugx("process %d stopping", getpid());
 #endif
                ps_free(ctx);
+#ifdef PLUGIN_DEV
                dev_stop(ctx);
+#endif
                eloop_exit(ctx->eloop, len != -1 ? EXIT_SUCCESS : EXIT_FAILURE);
                return len;
        }