diff options
| author | Roy Marples <roy@marples.name> | 2014-11-18 04:23:40 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2014-11-18 04:23:40 +0000 |
| commit | 5d1238a7aad9b84f90a9e987a59d9eabc53745f4 (patch) | |
| tree | b73ffd31b95adff146bb10251b7d2724b8ecc2b9 /dhcpcd.c | |
| parent | f31ff290b5d39a5d1c522d0270ac2f2b0c35ca5b (diff) | |
| download | dhcpcd-5d1238a7aad9b84f90a9e987a59d9eabc53745f4.tar.xz | |
Reload global config when running per interface commands.
This matches the signal behaviour.
Diffstat (limited to 'dhcpcd.c')
| -rw-r--r-- | dhcpcd.c | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -938,6 +938,23 @@ if_reboot(struct interface *ifp, int argc, char **argv) } static void +reload_config(struct dhcpcd_ctx *ctx) +{ + struct if_options *ifo; + + free_globals(ctx); + ifo = read_config(ctx, NULL, NULL, NULL); + add_options(ctx, NULL, ifo, ctx->argc, ctx->argv); + /* We need to preserve these two options. */ + if (ctx->options & DHCPCD_MASTER) + ifo->options |= DHCPCD_MASTER; + if (ctx->options & DHCPCD_DAEMONISED) + ifo->options |= DHCPCD_DAEMONISED; + ctx->options = ifo->options; + free_options(ifo); +} + +static void reconf_reboot(struct dhcpcd_ctx *ctx, int action, int argc, char **argv, int oi) { struct if_head *ifs; @@ -1005,7 +1022,6 @@ handle_signal1(void *arg) struct dhcpcd_ctx *ctx; struct dhcpcd_siginfo *si; struct interface *ifp; - struct if_options *ifo; int do_release; ctx = dhcpcd_ctx; @@ -1024,16 +1040,7 @@ handle_signal1(void *arg) break; case SIGHUP: syslog(LOG_INFO, sigmsg, "HUP", (int)si->pid, "rebinding"); - free_globals(ctx); - ifo = read_config(ctx, NULL, NULL, NULL); - add_options(ctx, NULL, ifo, ctx->argc, ctx->argv); - /* We need to preserve these two options. */ - if (ctx->options & DHCPCD_MASTER) - ifo->options |= DHCPCD_MASTER; - if (ctx->options & DHCPCD_DAEMONISED) - ifo->options |= DHCPCD_DAEMONISED; - ctx->options = ifo->options; - free_options(ifo); + reload_config(ctx); /* Preserve any options passed on the commandline * when we were started. */ reconf_reboot(ctx, 1, ctx->argc, ctx->argv, @@ -1216,6 +1223,7 @@ dhcpcd_handleargs(struct dhcpcd_ctx *ctx, struct fd_list *fd, return 0; } + reload_config(ctx); /* XXX: Respect initial commandline options? */ reconf_reboot(ctx, do_reboot, argc, argv, optind); return 0; |
