[ovs-dev] [PATCH] ofproto: Fix ofport allocation.

Gurucharan Shetty shettyg at nicira.com
Tue Nov 20 11:29:03 UTC 2012


From: Gurucharan Shetty <shettyg at nicira.com>

Currently running the following 3 commands results
in vswitchd running in an infinite loop.

ovs-vsctl add-port br1 port1 -- set interface port1 \
type=internal ofport_request=1
ovs-vsctl add-port br1 port2 -- set interface port2 \
type=internal ofport_request=2
ovs-vsctl add-port br1 port3 -- set interface port3 \
type=internal

This patch lets us go through all the possible ofport
values to find a free ofport.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 ofproto/ofproto.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 182da63..8bc9b59 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1666,7 +1666,8 @@ alloc_ofp_port(struct ofproto *ofproto, const char *netdev_name)
          * flows. */
         while (ofp_port >= ofproto->max_ports) {
             for (ofproto->alloc_port_no++;
-                 ofproto->alloc_port_no < ofproto->max_ports; ) {
+                 ofproto->alloc_port_no < ofproto->max_ports;
+                 ofproto->alloc_port_no++) {
                 if (!bitmap_is_set(ofproto->ofp_port_ids,
                                    ofproto->alloc_port_no)) {
                     ofp_port = ofproto->alloc_port_no;
-- 
1.7.9.5




More information about the dev mailing list