From a4768995b90989104ec7e5c4c692221ec64b03ef Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 14 May 2009 15:31:15 -0700 Subject: [PATCH] brcompatd: Don't remove nonexistent ports if vswitchd will create them. There is a race between brcompatd and vswitchd for internal ports, e.g. in this scenario: 1. cfg-mod adds "bridge.xenbr0.port=xenbr0". 2. vswitchd creates xenbr0. we can have brcompatd slip in between them: 2.5. brcompatd notices that there is no network device xenbr0 and deletes the new line from the config file. For the local port and other internal ports we don't want brcompatd interfering, so this commit makes it ignore them. Bug #1314. --- vswitchd/brcompatd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vswitchd/brcompatd.c b/vswitchd/brcompatd.c index b72e095a..d456b895 100644 --- a/vswitchd/brcompatd.c +++ b/vswitchd/brcompatd.c @@ -242,6 +242,15 @@ prune_ports(void) const char *iface_name = ifaces.names[j]; enum netdev_flags flags; + /* The local port and internal ports are created and destroyed by + * vswitchd itself, so don't bother checking for them at all. In + * practice, they might not exist if vswitchd hasn't finished + * reloading since the configuration file was updated. */ + if (!strcmp(iface_name, br_name) + || cfg_get_bool(0, "iface.%s.internal", if_name)) { + continue; + } + error = netdev_nodev_get_flags(iface_name, &flags); if (error == ENODEV) { VLOG_DBG_RL(&rl, "removing dead interface %s from %s", -- 2.30.2