From 14551ceac68a7acf3a584fac3586dcbd9ad8745c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 15 Jul 2009 12:09:43 -0700 Subject: [PATCH] brcompatd: Factor code out of prune_ports(). An upcoming commit will also need to gather all of the interfaces on a specified bridge, so break this code into a helper function. --- vswitchd/ovs-brcompatd.c | 51 +++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index 5bb60cb8..9274da0a 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -200,6 +200,32 @@ rewrite_and_reload_config(void) return 0; } +/* Get all the interfaces for 'bridge' as 'ifaces', breaking bonded interfaces + * down into their constituent parts. */ +static void +get_bridge_ifaces(const char *bridge, struct svec *ifaces) +{ + struct svec ports; + int i; + + svec_init(&ports); + svec_init(ifaces); + cfg_get_all_keys(&ports, "bridge.%s.port", bridge); + for (i = 0; i < ports.n; i++) { + const char *port_name = ports.names[i]; + if (cfg_has_section("bonding.%s", port_name)) { + struct svec slaves; + svec_init(&slaves); + cfg_get_all_keys(&slaves, "bonding.%s.slave", port_name); + svec_append(ifaces, &slaves); + svec_destroy(&slaves); + } else { + svec_add(ifaces, port_name); + } + } + svec_destroy(&ports); +} + /* Go through the configuration file and remove any ports that no longer * exist associated with a bridge. */ static void @@ -219,29 +245,10 @@ prune_ports(void) cfg_get_subsections(&bridges, "bridge"); for (i=0; i