vswitchd: Fix SIGHUP behavior for bonded ports.
authorBen Pfaff <blp@nicira.com>
Tue, 30 Dec 2008 00:17:09 +0000 (16:17 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 30 Dec 2008 00:17:09 +0000 (16:17 -0800)
vswitchd/bridge.c

index 139d7f97839df3ed3cd42b9297465b91868abff9..f2138324d6c01b8f950390e03885a942b95a8104 100644 (file)
@@ -1985,6 +1985,7 @@ port_create(struct bridge *br, const char *name)
     port->port_idx = br->n_ports;
     port->vlan = 0;
     port->name = xstrdup(name);
+    port->active_iface = -1;
 
     if (br->n_ports >= br->allocated_ports) {
         br->ports = x2nrealloc(br->ports, &br->allocated_ports,
@@ -2119,8 +2120,8 @@ port_update_bonding(struct port *port)
                 e->iface_idx = -1;
                 e->tx_bytes = 0;
             }
-            bond_choose_active_iface(port);
             port->no_ifaces_tag = tag_create_random();
+            bond_choose_active_iface(port);
         }
     }
 }
@@ -2156,6 +2157,7 @@ iface_destroy(struct iface *iface)
 {
     if (iface) {
         struct port *port = iface->port;
+        bool del_active = port->active_iface == iface->port_ifidx;
         struct iface *del;
 
         del = port->ifaces[iface->port_ifidx] = port->ifaces[--port->n_ifaces];
@@ -2164,6 +2166,11 @@ iface_destroy(struct iface *iface)
         free(iface->name);
         free(iface);
 
+        if (del_active) {
+            tag_set_add(&port->bridge->revalidate_set, port->active_iface_tag);
+            bond_choose_active_iface(port);
+        }
+
         port_update_bonding(port);
         bridge_flush(port->bridge);
     }