diff mbox

[ovs-dev,v3,4/5] rstp: Increment the rstp port num counter.

Message ID 1495178443-102536-4-git-send-email-nic@opencloud.tech
State Accepted
Headers show

Commit Message

nickcooper-zhangtonghao May 19, 2017, 7:20 a.m. UTC
OvS only supports RSTP_MAX_PORTS rstp ports while max port
num of stp is STP_MAX_PORTS. This patch increments the rstp
port num counter, otherwise the counter is 0 and the checking
above will always fail.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
---
 vswitchd/bridge.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ben Pfaff May 31, 2017, 10:28 p.m. UTC | #1
On Fri, May 19, 2017 at 12:20:42AM -0700, nickcooper-zhangtonghao wrote:
> OvS only supports RSTP_MAX_PORTS rstp ports while max port
> num of stp is STP_MAX_PORTS. This patch increments the rstp
> port num counter, otherwise the counter is 0 and the checking
> above will always fail.
> 
> Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>

Thanks, I applied this to master and backported as far as OVS 2.4.
diff mbox

Patch

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 972146e..5a08219 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1485,6 +1485,10 @@  port_configure_rstp(const struct ofproto *ofproto, struct port *port,
         port_s->port_num = 0;
     }
 
+    /* Increment the port num counter, because we only support
+     * RSTP_MAX_PORTS rstp ports. */
+    (*port_num_counter) ++;
+
     config_str = smap_get(&port->cfg->other_config, "rstp-path-cost");
     if (config_str) {
         port_s->path_cost = strtoul(config_str, NULL, 10);