stp: port_no counter is off by one
authorAnsis Atteka <aatteka@nicira.com>
Tue, 21 Aug 2012 23:48:36 +0000 (16:48 -0700)
committerAnsis Atteka <aatteka@nicira.com>
Wed, 22 Aug 2012 00:08:05 +0000 (17:08 -0700)
This counter was off by one, because port_num
should be less than STP_MAX_PORTS.

This caused an assert hit later in stp_get_port().

Issue: 13059
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
Reported-by: Ram Jothikumar <rjothikumar@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
vswitchd/bridge.c

index bd8e772afe14fd85e097dd13184146440829fd54..1fbbe32ac3b3f463ef823c0ac9276aee82bff059 100644 (file)
@@ -937,7 +937,7 @@ port_configure_stp(const struct ofproto *ofproto, struct port *port,
         bitmap_set1(port_num_bitmap, port_idx);
         port_s->port_num = port_idx;
     } else {
-        if (*port_num_counter > STP_MAX_PORTS) {
+        if (*port_num_counter >= STP_MAX_PORTS) {
             VLOG_ERR("port %s: too many STP ports, disabling", port->name);
             port_s->enable = false;
             return;