ofproto: Disable STP when unregistering a port.
authorJustin Pettit <jpettit@nicira.com>
Tue, 15 Nov 2011 09:33:08 +0000 (01:33 -0800)
committerJustin Pettit <jpettit@nicira.com>
Tue, 15 Nov 2011 18:16:01 +0000 (10:16 -0800)
If a port is removed when spanning tree was configured on it, then the
system may crash, since the STP library will try to send packets out a
now non-existent port.  This commit disables STP on ports when they are
destroyed.

ofproto/ofproto-dpif.c
ofproto/ofproto.c

index 4cc720667d143dff167fd4ae42bdcb8c95fbe46b..e89ae893fee1f319e677656851a06fd40219972f 100644 (file)
@@ -1035,7 +1035,7 @@ update_stp_port_state(struct ofport_dpif *ofport)
         ofport->stp_state = state;
         ofport->stp_state_entered = time_msec();
 
-        if (fwd_change) {
+        if (fwd_change && ofport->bundle) {
             bundle_update(ofport->bundle);
         }
 
index b7b31b0228bffd0757d382609df7638a8097b8ee..60cf5245ff25f9967514357229a2b5ffb0727d0f 100644 (file)
@@ -1367,6 +1367,9 @@ ofproto_port_unregister(struct ofproto *ofproto, uint16_t ofp_port)
 {
     struct ofport *port = ofproto_get_port(ofproto, ofp_port);
     if (port) {
+        if (port->ofproto->ofproto_class->set_stp_port) {
+            port->ofproto->ofproto_class->set_stp_port(port, NULL);
+        }
         if (port->ofproto->ofproto_class->set_cfm) {
             port->ofproto->ofproto_class->set_cfm(port, NULL);
         }