Only start new wpa events for link types and if we don't have one already open.
authorRoy Marples <roy@marples.name>
Fri, 18 Jul 2014 22:47:33 +0000 (22:47 +0000)
committerRoy Marples <roy@marples.name>
Fri, 18 Jul 2014 22:47:33 +0000 (22:47 +0000)
src/libdhcpcd/wpa.c

index 89e46c523cdfd77f572c16d7072f1bd2d70ba370..42a1f9acd4ebe00cdb852993d06e0d84b328563c 100644 (file)
@@ -623,14 +623,16 @@ dhcpcd_wpa_if_event(DHCPCD_IF *i)
 {
        DHCPCD_WPA *wpa;
 
-       if (i->wireless) {
-               if (strcmp(i->reason, "STOPPING") == 0) {
+       assert(i);
+       if (i->wireless && strcmp(i->type, "link") == 0) {
+               if (strcmp(i->reason, "STOPPED") == 0) {
                        wpa = dhcpcd_wpa_find(i->con, i->ifname);
                        if (wpa)
                                dhcpcd_wpa_close(wpa);
                } else if (i->up) {
                        wpa = dhcpcd_wpa_new(i->con, i->ifname);
-                       dhcpcd_wpa_open(wpa);
+                       if (wpa && wpa->listen_fd == -1)
+                               dhcpcd_wpa_open(wpa);
                }
        }
 }