- dpid = bridge_pick_datapath_id(br, ea, devname);
- ofproto_set_datapath_id(br->ofproto, dpid);
-
- /* Set NetFlow configuration on this bridge. */
- if (cfg_has("netflow.%s.engine-type", br->name)) {
- engine_type = cfg_get_int(0, "netflow.%s.engine-type",
- br->name);
- }
- if (cfg_has("netflow.%s.engine-id", br->name)) {
- engine_id = cfg_get_int(0, "netflow.%s.engine-id", br->name);
- }
- if (cfg_has("netflow.%s.add-id-to-iface", br->name)) {
- add_id_to_iface = cfg_get_bool(0, "netflow.%s.add-id-to-iface",
- br->name);
- }
- if (add_id_to_iface && 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 (add_id_to_iface && br->n_ports > 0x1ff) {
- VLOG_WARN("bridge %s: netflow port mangling will conflict with "
- "another port when 512 or more ports are used",
- br->name);
- }
- svec_init(&nf_hosts);
- cfg_get_all_keys(&nf_hosts, "netflow.%s.host", br->name);
- if (ofproto_set_netflow(br->ofproto, &nf_hosts, engine_type,
- engine_id, add_id_to_iface)) {
- VLOG_ERR("bridge %s: problem setting netflow collectors",
- br->name);
- }
- svec_destroy(&nf_hosts);
-
- /* 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);