From: Justin Pettit Date: Tue, 15 Nov 2011 09:33:08 +0000 (-0800) Subject: ofproto: Disable STP when unregistering a port. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b308140aa09d330a56c6cd971327a2d283db8a77;p=openvswitch 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 4cc72066..e89ae893 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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); } diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b7b31b02..60cf5245 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); }