[ovs-dev] [stp-bugs 3/3] bridge: Disable STP when destroying a port.

Justin Pettit jpettit at nicira.com
Tue Nov 15 09:48:51 UTC 2011


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.
---
 vswitchd/bridge.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 6a25b95..dac1040 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2532,6 +2532,14 @@ port_destroy(struct port *port)
         struct bridge *br = port->bridge;
         struct iface *iface, *next;
 
+        /* Disable STP before unregistering the bundle, since it may
+         * update the bundle's state. */
+        if (br->cfg->stp_enable) {
+            LIST_FOR_EACH_SAFE (iface, next, port_elem, &port->ifaces) {
+                ofproto_port_set_stp(br->ofproto, iface->ofp_port, NULL);
+            }
+        }
+
         if (br->ofproto) {
             ofproto_bundle_unregister(br->ofproto, port);
         }
-- 
1.7.1




More information about the dev mailing list