X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=vswitchd%2Fbridge.c;h=d505b533c9ecc8e774962740454fa61c7758dfcc;hb=bc22fc3e661915586e96efdb2241101d97b7946a;hp=1328c2dbe58d6e4153d00e176f96d315ec441380;hpb=0c62a7ad88bb1f2eacfa225b9812dc10ba7b6eb2;p=openvswitch diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 1328c2db..d505b533 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -173,7 +173,6 @@ struct port { bool is_mirror_output_port; /* Does port mirroring send frames here? */ }; -#define DP_MAX_PORTS 255 struct bridge { struct list node; /* Node in global list of bridges. */ char *name; /* User-specified arbitrary name. */ @@ -318,6 +317,17 @@ bridge_init(const char *remote) bond_init(); } +void +bridge_exit(void) +{ + struct bridge *br, *next_br; + + LIST_FOR_EACH_SAFE (br, next_br, node, &all_bridges) { + bridge_destroy(br); + } + ovsdb_idl_destroy(idl); +} + /* Performs configuration that is only necessary once at ovs-vswitchd startup, * but for which the ovs-vswitchd configuration 'cfg' is required. */ static void @@ -385,30 +395,6 @@ bridge_configure_once(const struct ovsrec_open_vswitch *cfg) svec_destroy(&dpif_types); } -/* Initializes 'options' and fills it with the options for 'if_cfg'. Merges - * keys from "options" and "other_config", preferring "options" keys over - * "other_config" keys. */ -static void -iface_get_options(const struct ovsrec_interface *if_cfg, struct shash *options) -{ - size_t i; - - shash_from_ovs_idl_map(if_cfg->key_options, if_cfg->value_options, - if_cfg->n_options, options); - - for (i = 0; i < if_cfg->n_other_config; i++) { - char *key = if_cfg->key_other_config[i]; - char *value = if_cfg->value_other_config[i]; - - if (!shash_find_data(options, key)) { - shash_add(options, key, value); - } else { - VLOG_WARN("%s: ignoring \"other_config\" key %s that conflicts " - "with \"options\" key %s", if_cfg->name, key, key); - } - } -} - /* Callback for iterate_and_prune_ifaces(). */ static bool check_iface(struct bridge *br, struct iface *iface, void *aux OVS_UNUSED) @@ -685,7 +671,9 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) shash_init(&args); if (iface) { - iface_get_options(iface->cfg, &args); + shash_from_ovs_idl_map(iface->cfg->key_options, + iface->cfg->value_options, + iface->cfg->n_options, &args); } error = netdev_open(&options, &netdev); shash_destroy(&args); @@ -723,7 +711,9 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg) struct shash args; shash_init(&args); - iface_get_options(iface->cfg, &args); + shash_from_ovs_idl_map(iface->cfg->key_options, + iface->cfg->value_options, + iface->cfg->n_options, &args); netdev_reconfigure(iface->netdev, &args); shash_destroy(&args); } @@ -1111,6 +1101,14 @@ dpid_from_hash(const void *data, size_t n) return eth_addr_to_uint64(hash); } +static void +iface_refresh_tunnel_egress(struct iface *iface) +{ + const char *name = netdev_get_tnl_iface(iface->netdev); + + ovsrec_interface_set_tunnel_egress_iface(iface->cfg, name); +} + static void iface_refresh_cfm_stats(struct iface *iface) { @@ -1320,6 +1318,7 @@ bridge_run(void) struct iface *iface = port->ifaces[j]; iface_refresh_stats(iface); iface_refresh_cfm_stats(iface); + iface_refresh_tunnel_egress(iface); } } }