- dpid = bridge_pick_datapath_id(br, ea, devname);
- ofproto_set_datapath_id(br->ofproto, dpid);
-
- /* Set NetFlow configuration on this bridge. */
- memset(&nf_options, 0, sizeof nf_options);
- nf_options.engine_type = br->dpif.minor;
- nf_options.engine_id = br->dpif.minor;
- nf_options.active_timeout = -1;
-
- if (cfg_has("netflow.%s.engine-type", br->name)) {
- nf_options.engine_type = cfg_get_int(0, "netflow.%s.engine-type",
- br->name);
- }
- if (cfg_has("netflow.%s.engine-id", br->name)) {
- nf_options.engine_id = cfg_get_int(0, "netflow.%s.engine-id",
- br->name);
- }
- if (cfg_has("netflow.%s.active-timeout", br->name)) {
- nf_options.active_timeout = cfg_get_int(0,
- "netflow.%s.active-timeout",
- br->name);
- }
- if (cfg_has("netflow.%s.add-id-to-iface", br->name)) {
- nf_options.add_id_to_iface = cfg_get_bool(0,
- "netflow.%s.add-id-to-iface",
- br->name);
- }
- if (nf_options.add_id_to_iface && nf_options.engine_id > 0x7f) {
- VLOG_WARN("bridge %s: netflow port mangling may conflict with "
- "another vswitch, choose an engine id less than 128",
- br->name);
- }
- if (nf_options.add_id_to_iface && br->n_ports > 508) {
- VLOG_WARN("bridge %s: netflow port mangling will conflict with "
- "another port when more than 508 ports are used",
- br->name);
- }
- svec_init(&nf_options.collectors);
- cfg_get_all_keys(&nf_options.collectors, "netflow.%s.host", br->name);
- if (ofproto_set_netflow(br->ofproto, &nf_options)) {
- VLOG_ERR("bridge %s: problem setting netflow collectors",
- br->name);
- }
- svec_destroy(&nf_options.collectors);
-
- /* Update the controller and related settings. It would be more
- * straightforward to call this from bridge_reconfigure_one(), but we
- * can't do it there for two reasons. First, and most importantly, at
- * that point we don't know the dp_ifidx of any interfaces that have
- * been added to the bridge (because we haven't actually added them to
- * the datapath). Second, at that point we haven't set the datapath ID
- * yet; when a controller is configured, resetting the datapath ID will
- * immediately disconnect from the controller, so it's better to set
- * the datapath ID before the controller. */
- bridge_reconfigure_controller(br);
- }
- LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
- for (i = 0; i < br->n_ports; i++) {
- struct port *port = br->ports[i];
-
- port_update_vlan_compat(port);
-
- for (j = 0; j < port->n_ifaces; j++) {
- struct iface *iface = port->ifaces[j];
- if (iface->dp_ifidx != ODPP_LOCAL
- && iface_is_internal(br, iface->name)) {
- iface_set_mac(iface);
- }
+/* Iterate over all ofprotos and delete any of them that do not have a
+ * configured bridge or that are the wrong type. */
+static void
+bridge_del_ofprotos(void)
+{
+ struct sset names;
+ struct sset types;
+ const char *type;
+
+ sset_init(&names);
+ sset_init(&types);
+ ofproto_enumerate_types(&types);
+ SSET_FOR_EACH (type, &types) {
+ const char *name;
+
+ ofproto_enumerate_names(type, &names);
+ SSET_FOR_EACH (name, &names) {
+ struct bridge *br = bridge_lookup(name);
+ if (!br || strcmp(type, br->type)) {
+ ofproto_delete(name, type);