vswitch: Enable bond slaves based on carrier status, not up/down.
authorBen Pfaff <blp@nicira.com>
Fri, 5 Jun 2009 21:28:39 +0000 (14:28 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 5 Jun 2009 21:28:39 +0000 (14:28 -0700)
Whether a bond slave is enabled should be based on whether the device's
PHY sees carrier, not based on whether the device is configured up or down.
(Note that a device that is configured down will always see "no carrier").
Otherwise a device that is up but has no carrier will initially be enabled,
which does not make sense.

This has no effect on interfaces that are not bond slaves, because the
"enabled" setting is used only by bond slaves.

Bug #1247.

vswitchd/bridge.c

index cfd4dcf..ff5d352 100644 (file)
@@ -2467,7 +2467,6 @@ port_update_vlan_compat(struct port *port)
 static void
 iface_create(struct port *port, const char *name)
 {
-    enum netdev_flags flags;
     struct iface *iface;
 
     iface = xcalloc(1, sizeof *iface);
@@ -2476,14 +2475,10 @@ iface_create(struct port *port, const char *name)
     iface->name = xstrdup(name);
     iface->dp_ifidx = -1;
     iface->tag = tag_create_random();
-    iface->enabled = true;
     iface->delay_expires = LLONG_MAX;
 
     netdev_nodev_get_etheraddr(name, iface->mac);
-
-    if (!netdev_nodev_get_flags(name, &flags)) {
-        iface->enabled = (flags & NETDEV_UP) != 0;
-    }
+    netdev_nodev_get_carrier(name, &iface->enabled);
 
     if (port->n_ifaces >= port->allocated_ifaces) {
         port->ifaces = x2nrealloc(port->ifaces, &port->allocated_ifaces,