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:18:11 +0000 (10:18 -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 7d0768e..7af9ee2 100644 (file)
@@ -1040,7 +1040,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 9a302d5..bfdcf3e 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);
         }