From: Ben Pfaff Date: Tue, 7 Apr 2009 18:10:56 +0000 (-0700) Subject: brcompat: Add support for bonded interfaces; avoid multiple cfg_read() call.s X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39b01bf7fe4d2c97d305bb16d955ebfa9ca2de53;p=openvswitch brcompat: Add support for bonded interfaces; avoid multiple cfg_read() call.s Bonded interfaces have to be looked up under the bonding.* hierarchy, but the code here didn't know about that. Also, this was calling cfg_read() and cfg_write() for every interface to be deleted, which means that our set of bridges and interfaces could change while we were iterating. In theory, they shouldn't have, since the file was locked, but that assumption still made me nervous so I eliminated it. --- diff --git a/vswitchd/brcompatd.c b/vswitchd/brcompatd.c index 6e8b18c1..8050b0e4 100644 --- a/vswitchd/brcompatd.c +++ b/vswitchd/brcompatd.c @@ -203,8 +203,7 @@ prune_ports(void) { int i, j; int error; - struct svec bridges; - bool pruned = false; + struct svec bridges, delete; if (cfg_lock(NULL, 0)) { /* Couldn't lock config file. */ @@ -212,37 +211,69 @@ prune_ports(void) } svec_init(&bridges); + svec_init(&delete); cfg_get_subsections(&bridges, "bridge"); - for (i=0; i