If rebinding all interfaces, don't specify any.
authorRoy Marples <roy@marples.name>
Tue, 16 Sep 2014 10:27:49 +0000 (10:27 +0000)
committerRoy Marples <roy@marples.name>
Tue, 16 Sep 2014 10:27:49 +0000 (10:27 +0000)
src/dhcpcd-qt/dhcpcd-preferences.cpp

index 02974a7a912c93f9fd7bf5513561c7986bb5df52..82c6380ba95b4cee28c03c876235b0458ee644a6 100644 (file)
@@ -443,30 +443,33 @@ void DhcpcdPreferences::rebind()
 
        DHCPCD_CONNECTION *con = parent->getConnection();
        DHCPCD_IF *i;
-       bool found = false;
        bool worked;
-       if (iface && strcmp(eWhat, "interface") == 0) {
+       if (strcmp(eWhat, "interface") == 0) {
                worked = tryRebind(iface ? iface->ifname : NULL);
                goto done;
        }
        
        worked = true;
-       for (i = dhcpcd_interfaces(con); i; i = i->next) {
-               if (strcmp(i->type, "link") == 0 &&
-                   (eBlock == NULL ||
-                   (i->ssid && strcmp(i->ssid, eBlock) == 0)))
-               {
-                       found = true;
-                       if (!tryRebind(i->ifname))
-                               worked = false;
+       if (eBlock) {
+               bool found = false;
+
+               for (i = dhcpcd_interfaces(con); i; i = i->next) {
+                       if (strcmp(i->type, "link") == 0 &&
+                           (i->ssid && strcmp(i->ssid, eBlock) == 0))
+                       {
+                               found = true;
+                               if (!tryRebind(i->ifname))
+                                       worked = false;
+                       }
+               }
+               if (!found) {
+                       QMessageBox::information(this,
+                           tr("No matching interface"),
+                           tr("No interface is bound to this SSID to rebind"));
+                       return;
                }
        }
-       if (!found) {
-               QMessageBox::information(this,
-                   tr("No matching interface"),
-                   tr("No interface is bound to this SSID to rebind"));
-               return;
-       }
+       worked = tryRebind(NULL);
 
 done:          
        if (worked)