changeset 1397:e5ef001c8cc2 draft

Don't pass "dhcpcd $iface" to discover_interfaces so our denyinterfaces config option works for hotplugged interfaces.
author Roy Marples <roy@marples.name>
date Mon, 31 Aug 2009 21:51:17 +0000
parents 4b64d3df234b
children 51f62c97d6f3
files dhcpcd.c
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Wed Aug 12 08:38:41 2009 +0000
+++ b/dhcpcd.c	Mon Aug 31 21:51:17 2009 +0000
@@ -1188,7 +1188,6 @@
 handle_interface(int action, const char *ifname)
 {
 	struct interface *ifs, *ifp, *ifn, *ifl = NULL;
-	const char * const argv[] = { "dhcpcd", ifname };
 	int i;
 
 	if (action == -1) {
@@ -1210,23 +1209,24 @@
 			return;
 	}
 
-	if ((ifs = discover_interfaces(2, UNCONST(argv)))) {
-		for (ifp = ifs; ifp; ifp = ifp->next) {
-			/* Check if we already have the interface */
-			for (ifn = ifaces; ifn; ifn = ifn->next) {
-				if (strcmp(ifn->name, ifp->name) == 0)
-					break;
-				ifl = ifn;
-			}
-			if (ifn)
-				continue;
-			init_state(ifp, 2, UNCONST(argv));
-			if (ifl)
-				ifl->next = ifp;
-			else
-				ifaces = ifp;
-			start_interface(ifp);
+	ifs = discover_interfaces(0, NULL);
+	for (ifp = ifs; ifp; ifp = ifp->next) {
+		if (strcmp(ifp->name, ifname) != 0)
+			continue;
+		/* Check if we already have the interface */
+		for (ifn = ifaces; ifn; ifn = ifn->next) {
+			if (strcmp(ifn->name, ifp->name) == 0)
+				break;
+			ifl = ifn;
 		}
+		if (ifn)
+			continue;
+		init_state(ifp, 0, NULL);
+		if (ifl)
+			ifl->next = ifp;
+		else
+			ifaces = ifp;
+		start_interface(ifp);
 	}
 }