From: Hans Dedecker Date: Fri, 27 Nov 2015 10:30:41 +0000 (+0100) Subject: config: Close interface when ifindex cannot be resolved X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fodhcpd.git;a=commitdiff_plain;h=32b977a5336612a5c01f7426c4d165685fa8aca0;hp=01d3f9d64486ac1daa144848944e877e7f0cb762 config: Close interface when ifindex cannot be resolved Signed-off-by: Hans Dedecker --- diff --git a/src/config.c b/src/config.c index 7d870f1..4fc8bc7 100644 --- a/src/config.c +++ b/src/config.c @@ -313,13 +313,13 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr } if (!iface->ifname[0] && !ifname) - return -1; + goto err; if (ifname) strncpy(iface->ifname, ifname, sizeof(iface->ifname) - 1); if ((iface->ifindex = if_nametoindex(iface->ifname)) <= 0) - return -1; + goto err; iface->inuse = true; diff --git a/src/router.c b/src/router.c index 9907824..9711975 100644 --- a/src/router.c +++ b/src/router.c @@ -99,6 +99,9 @@ int setup_router_interface(struct interface *iface, bool enable) uloop_timeout_cancel(&iface->timer_rs); iface->timer_rs.cb = NULL; + if (iface->ifindex <= 0) + return -1; + setsockopt(router_event.uloop.fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &all_nodes, sizeof(all_nodes)); setsockopt(router_event.uloop.fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP,