[ovs-dev] [stp-bugs 3/3] bridge: Disable STP when destroying a port.
Justin Pettit
jpettit at nicira.com
Tue Nov 15 18:10:02 UTC 2011
On Nov 15, 2011, at 9:17 AM, Ben Pfaff wrote:
> On Tue, Nov 15, 2011 at 01:48:51AM -0800, Justin Pettit wrote:
>> 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-existant port. This commit disables STP on ports when they are
>> destroyed.
>
> Wouldn't it be better to do this in ofproto-dpif? The ofproto
> external interface shouldn't have nasty pitfalls like this.
Good point. I think we can even move it up into ofproto, itself. Below, is a revised version of the patch.
--Justin
-=-=-=-=-=-=-=-=-=-=-
commit 3993d6377490014f4afefd2cdc1364d1da9ed1b4
Author: Justin Pettit <jpettit at nicira.com>
Date: Tue Nov 15 01:33:08 2011 -0800
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-existant port. This commit disables STP on ports when they are
destroyed.
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 4cc7206..e89ae89 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 b7b31b0..60cf524 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1367,6 +1367,9 @@ ofproto_port_unregister(struct ofproto *ofproto, uint16_t
{
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);
}
More information about the dev
mailing list