From 39b01bf7fe4d2c97d305bb16d955ebfa9ca2de53 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 7 Apr 2009 11:10:56 -0700 Subject: [PATCH] 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. --- vswitchd/brcompatd.c | 57 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) 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