From: Justin Pettit Date: Tue, 15 Nov 2011 09:33:08 +0000 (-0800) Subject: ofproto: Disable STP when unregistering a port. X-Git-Tag: v1.3.0~23 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=26fe44c92f472fcccffd0a65d9fa8fdfa165a717;hp=7651845860d8a386ee5f446961e02fc362a99eef;p=sliver-openvswitch.git ofproto: Disable STP when unregistering a port. 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. --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 7d0768e87..7af9ee2e4 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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); } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 9a302d54f..bfdcf3e04 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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); }