ipv6nd_runignoredra(ifp);
ipv6_addaddrs(&state->addrs);
- dhcp6_delegate_prefix(ifp);
if (state->state == DH6S_INFORMED)
logger(ifp->ctx, has_new ? LOG_INFO : LOG_DEBUG,
if_initrt6(ifp);
ipv6_buildroutes(ifp->ctx);
dhcp6_writelease(ifp);
+ dhcp6_delegate_prefix(ifp);
dhcp6_script_try_run(ifp, 0);
}
logger(ifp->ctx, LOG_INFO,
"%s: activating for delegation",
sla->ifname);
- dhcpcd_activateinterface(ifd);
+ dhcpcd_activateinterface(ifd,
+ DHCPCD_IPV6 | DHCPCD_DHCP6);
}
}
}
}
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");
}
}
+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)
{
}
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);
}
int dhcpcd_selectprofile(struct interface *, const char *);
void dhcpcd_startinterface(void *);
-void dhcpcd_activateinterface(struct interface *);
+void dhcpcd_activateinterface(struct interface *, unsigned long long);
#endif
return p;
}
+struct if_options *
+default_config(struct dhcpcd_ctx *ctx)
+{
+ struct if_options *ifo;
+
+ /* Seed our default options */
+ if ((ifo = calloc(1, sizeof(*ifo))) == NULL) {
+ logger(ctx, LOG_ERR, "%s: %m", __func__);
+ return NULL;
+ }
+ ifo->options |= DHCPCD_IF_UP | DHCPCD_LINK | DHCPCD_INITIAL_DELAY;
+ ifo->timeout = DEFAULT_TIMEOUT;
+ ifo->reboot = DEFAULT_REBOOT;
+ ifo->metric = -1;
+ ifo->auth.options |= DHCPCD_AUTH_REQUIRE;
+ TAILQ_INIT(&ifo->auth.tokens);
+
+ /* Inherit some global defaults */
+ if (ctx->options & DHCPCD_PERSISTENT)
+ ifo->options |= DHCPCD_PERSISTENT;
+ if (ctx->options & DHCPCD_SLAACPRIVATE)
+ ifo->options |= DHCPCD_SLAACPRIVATE;
+
+ return ifo;
+}
+
struct if_options *
read_config(struct dhcpcd_ctx *ctx,
const char *ifname, const char *ssid, const char *profile)
struct dhcp_opt *ldop, *edop;
/* Seed our default options */
- ifo = calloc(1, sizeof(*ifo));
- if (ifo == NULL) {
- logger(ctx, LOG_ERR, "%s: %m", __func__);
+ if ((ifo = default_config(ctx)) == NULL)
return NULL;
- }
- ifo->options |= DHCPCD_DAEMONISE | DHCPCD_LINK | DHCPCD_INITIAL_DELAY;
- ifo->options |= DHCPCD_IF_UP;
+ ifo->options |= DHCPCD_DAEMONISE;
#ifdef PLUGIN_DEV
ifo->options |= DHCPCD_DEV;
#endif
ifo->options |= DHCPCD_IPV6RA_AUTOCONF | DHCPCD_IPV6RA_REQRDNSS;
ifo->options |= DHCPCD_DHCP6;
#endif
- ifo->timeout = DEFAULT_TIMEOUT;
- ifo->reboot = DEFAULT_REBOOT;
- ifo->metric = -1;
- ifo->auth.options |= DHCPCD_AUTH_REQUIRE;
- TAILQ_INIT(&ifo->auth.tokens);
vlen = dhcp_vendor((char *)ifo->vendorclassid + 1,
sizeof(ifo->vendorclassid) - 1);
struct auth auth;
};
+struct if_options *default_config(struct dhcpcd_ctx *);
struct if_options *read_config(struct dhcpcd_ctx *,
const char *, const char *, const char *);
int add_options(struct dhcpcd_ctx *, const char *,