diff options
| author | Roy Marples <roy@marples.name> | 2016-02-04 21:42:14 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2016-02-04 21:42:14 +0000 |
| commit | 598e6cc727c427221a5041f5dcaa7e196b3ac4ce (patch) | |
| tree | ed01a38c80e0d22f6443951fe58a93c6d82b30b0 /dhcpcd.c | |
| parent | b699cc3d5ccaf0615bb1d1fe7f569e55196f234a (diff) | |
| download | dhcpcd-598e6cc727c427221a5041f5dcaa7e196b3ac4ce.tar.xz | |
When activating an interface, bring up a basic config that does nothing.
Then apply enough of the config for the base protocol, passed via an
argument, to work.
This means that when a prefix is delegated to an inactive interface, it
won't magically start configuring IPv4 on it.
Diffstat (limited to 'dhcpcd.c')
| -rw-r--r-- | dhcpcd.c | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -671,13 +671,21 @@ dhcpcd_pollup(void *arg) } static void -dhcpcd_initstate1(struct interface *ifp, int argc, char **argv, - unsigned long long options) +dhcpcd_initstate2(struct interface *ifp, unsigned long long options) { struct if_options *ifo; - configure_interface(ifp, argc, argv, options); - ifo = ifp->options; + if (options) { + if ((ifo = default_config(ifp->ctx)) == NULL) { + logger(ifp->ctx, LOG_ERR, "%s: %s: %m", + ifp->name, __func__); + return; + } + ifo->options |= options; + free(ifp->options); + ifp->options = ifo; + } else + ifo = ifp->options; if (ifo->options & DHCPCD_IPV4 && ipv4_init(ifp->ctx) == -1) { logger(ifp->ctx, LOG_ERR, "ipv4_init: %m"); @@ -699,6 +707,15 @@ dhcpcd_initstate1(struct interface *ifp, int argc, char **argv, } static void +dhcpcd_initstate1(struct interface *ifp, int argc, char **argv, + unsigned long long options) +{ + + configure_interface(ifp, argc, argv, options); + dhcpcd_initstate2(ifp, 0); +} + +static void dhcpcd_initstate(struct interface *ifp, unsigned long long options) { @@ -999,12 +1016,13 @@ run_preinit(struct interface *ifp) } void -dhcpcd_activateinterface(struct interface *ifp) +dhcpcd_activateinterface(struct interface *ifp, unsigned long long options) { if (!ifp->active) { ifp->active = IF_ACTIVE; - dhcpcd_initstate(ifp, 0); + dhcpcd_initstate2(ifp, options); + configure_interface1(ifp); run_preinit(ifp); dhcpcd_prestartinterface(ifp); } |
