stp: Turn off STP on ports that are disabled or have no link.
authorBen Pfaff <blp@nicira.com>
Tue, 23 Sep 2008 18:24:30 +0000 (11:24 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 23 Sep 2008 18:24:53 +0000 (11:24 -0700)
Fixes a problem that a port that is disabled via "ifconfig down" does
not come back up properly when it is brought back up again with "ifconfig
up", if STP is enabled.

secchan/secchan.c

index 1451cd879aa4c7b7e20686bc520d8732b0a14fba..2a200254cc1bd65e84f16dbff4cac34a56d60119 100644 (file)
@@ -1155,7 +1155,8 @@ stp_port_changed_cb(uint16_t port_no,
 
     p = stp_get_port(stp->stp, port_no);
     if (new->port_no == htons(OFPP_NONE)
-        || new->config & htonl(OFPPC_NO_STP)) {
+        || new->config & htonl(OFPPC_NO_STP | OFPPC_PORT_DOWN)
+        || new->state & htonl(OFPPS_LINK_DOWN)) {
         stp_port_disable(p);
     } else {
         int speed = 0;