Mercurial > hg > dhcpcd
changeset 5262:f168a25dd330 draft
privsep: Fix compile for prior without dev plugins
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Sun, 24 May 2020 11:49:58 +0100 |
| parents | 33324d44a2e8 |
| children | 1e7ce40ed871 |
| files | src/dev.h src/dhcpcd.c src/privsep-root.c src/privsep.c |
| diffstat | 4 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dev.h Sun May 24 10:36:14 2020 +0000 +++ b/src/dev.h Sun May 24 11:49:58 2020 +0100 @@ -51,11 +51,6 @@ 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
--- a/src/dhcpcd.c Sun May 24 10:36:14 2020 +0000 +++ b/src/dhcpcd.c Sun May 24 11:49:58 2020 +0100 @@ -2256,12 +2256,14 @@ 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 @@ #ifdef INET6 ipv6_ctxfree(&ctx); #endif +#ifdef PLUGIN_DEV dev_stop(&ctx); +#endif #ifdef PRIVSEP eloop_free(ctx.ps_eloop); #endif
--- a/src/privsep-root.c Sun May 24 10:36:14 2020 +0000 +++ b/src/privsep-root.c Sun May 24 11:49:58 2020 +0100 @@ -556,6 +556,7 @@ logerr(__func__); } +#ifdef PLUGIN_DEV static int ps_root_handleinterface(void *arg, int action, const char *ifname) { @@ -576,6 +577,7 @@ 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 @@ 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; }
--- a/src/privsep.c Sun May 24 10:36:14 2020 +0000 +++ b/src/privsep.c Sun May 24 11:49:58 2020 +0100 @@ -697,7 +697,9 @@ 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; }
