From: Roy Marples Date: Mon, 3 Oct 2016 20:07:52 +0000 (+0000) Subject: Guard against the possibility of no config..... may fix [c9d04817fa]. X-Git-Tag: v6.11.4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d77196c1ef97c0fe30ef192f4355b336f6971550;p=thirdparty%2Fdhcpcd.git Guard against the possibility of no config..... may fix [c9d04817fa]. --- diff --git a/dhcpcd.c b/dhcpcd.c index 8f1862b2..7e58c7e7 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -596,8 +596,11 @@ configure_interface(struct interface *ifp, int argc, char **argv, old = ifp->options ? ifp->options->mtime : 0; dhcpcd_selectprofile(ifp, NULL); - if (ifp->options == NULL) + if (ifp->options == NULL) { + /* dhcpcd cannot continue with this interface. */ + ifp->active = IF_INACTIVE; return; + } add_options(ifp->ctx, ifp->name, ifp->options, argc, argv); ifp->options->options |= options; configure_interface1(ifp); @@ -671,7 +674,8 @@ dhcpcd_initstate1(struct interface *ifp, int argc, char **argv, { configure_interface(ifp, argc, argv, options); - dhcpcd_initstate2(ifp, 0); + if (ifp->active) + dhcpcd_initstate2(ifp, 0); } static void @@ -983,9 +987,13 @@ dhcpcd_activateinterface(struct interface *ifp, unsigned long long options) if (!ifp->active) { ifp->active = IF_ACTIVE; dhcpcd_initstate2(ifp, options); - configure_interface1(ifp); - run_preinit(ifp); - dhcpcd_prestartinterface(ifp); + /* It's possible we might not have been able to load + * a config. */ + if (ifp->active) { + configure_interface1(ifp); + run_preinit(ifp); + dhcpcd_prestartinterface(ifp); + } } }