bridge: Introduce iface_is_internal() function.
[openvswitch] / vswitchd / bridge.c
index 8f544a99079f21cedcced0732897c24d887a5185..aebb2c36b3b364f070ec76e9ee96726efe2a9574 100644 (file)
@@ -227,6 +227,8 @@ static void mirror_refresh_stats(struct mirror *);
 
 static void iface_configure_lacp(struct iface *, struct lacp_slave_settings *);
 static bool iface_create(struct bridge *, struct if_cfg *, int ofp_port);
+static bool iface_is_internal(const struct ovsrec_interface *iface,
+                              const struct ovsrec_bridge *br);
 static const char *iface_get_type(const struct ovsrec_interface *,
                                   const struct ovsrec_bridge *);
 static void iface_destroy(struct iface *);
@@ -2797,7 +2799,7 @@ bridge_configure_remotes(struct bridge *br,
         n_ocs++;
     }
 
-    ofproto_set_controllers(br->ofproto, ocs, n_ocs);
+    ofproto_set_controllers(br->ofproto, ocs, n_ocs, 0);
     free(ocs[0].target); /* From bridge_ofproto_controller_for_mgmt(). */
     free(ocs);
 
@@ -3135,20 +3137,32 @@ port_is_synthetic(const struct port *port)
 \f
 /* Interface functions. */
 
+static bool
+iface_is_internal(const struct ovsrec_interface *iface,
+                  const struct ovsrec_bridge *br)
+{
+    /* The local port and "internal" ports are always "internal". */
+    return !strcmp(iface->type, "internal") || !strcmp(iface->name, br->name);
+}
+
 /* Returns the correct network device type for interface 'iface' in bridge
  * 'br'. */
 static const char *
 iface_get_type(const struct ovsrec_interface *iface,
                const struct ovsrec_bridge *br)
 {
-    /* The local port always has type "internal" unless the bridge is of
-     * type "dummy".  Other ports take their type from the database and
-     * default to "system" if none is specified. */
-    if (!strcmp(iface->name, br->name)) {
-        return !strcmp(br->datapath_type, "dummy") ? "dummy" : "internal";
+    const char *type;
+
+    /* The local port always has type "internal".  Other ports take
+     * their type from the database and default to "system" if none is
+     * specified. */
+    if (iface_is_internal(iface, br)) {
+        type = "internal";
     } else {
-        return iface->type[0] ? iface->type : "system";
+        type = iface->type[0] ? iface->type : "system";
     }
+
+    return ofproto_port_open_type(br->datapath_type, type);
 }
 
 static void