X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=vswitchd%2Fbridge.c;h=dbce59a32d50177a6cc6f58d8b2fdc96ea498351;hb=b4f4b737f901a43eba962bec2280b52b95ad10d5;hp=9fcc97098129b026a7a9f240c3872c490b69127f;hpb=d02a5f8ea4e1da19ccc4f903026b77649472b236;p=openvswitch diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 9fcc9709..dbce59a3 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -276,25 +276,27 @@ bridge_init_ofproto(const struct ovsrec_open_vswitch *cfg) shash_init(&iface_hints); - for (i = 0; i < cfg->n_bridges; i++) { - const struct ovsrec_bridge *br_cfg = cfg->bridges[i]; - int j; - - for (j = 0; j < br_cfg->n_ports; j++) { - struct ovsrec_port *port_cfg = br_cfg->ports[j]; - int k; - - for (k = 0; k < port_cfg->n_interfaces; k++) { - struct ovsrec_interface *if_cfg = port_cfg->interfaces[k]; - struct iface_hint *iface_hint; - - iface_hint = xmalloc(sizeof *iface_hint); - iface_hint->br_name = br_cfg->name; - iface_hint->br_type = br_cfg->datapath_type; - iface_hint->ofp_port = if_cfg->n_ofport_request ? - *if_cfg->ofport_request : OFPP_NONE; - - shash_add(&iface_hints, if_cfg->name, iface_hint); + if (cfg) { + for (i = 0; i < cfg->n_bridges; i++) { + const struct ovsrec_bridge *br_cfg = cfg->bridges[i]; + int j; + + for (j = 0; j < br_cfg->n_ports; j++) { + struct ovsrec_port *port_cfg = br_cfg->ports[j]; + int k; + + for (k = 0; k < port_cfg->n_interfaces; k++) { + struct ovsrec_interface *if_cfg = port_cfg->interfaces[k]; + struct iface_hint *iface_hint; + + iface_hint = xmalloc(sizeof *iface_hint); + iface_hint->br_name = br_cfg->name; + iface_hint->br_type = br_cfg->datapath_type; + iface_hint->ofp_port = if_cfg->n_ofport_request ? + *if_cfg->ofport_request : OFPP_NONE; + + shash_add(&iface_hints, if_cfg->name, iface_hint); + } } } } @@ -2795,7 +2797,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); @@ -3139,14 +3141,18 @@ 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. */ + 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 (!strcmp(iface->name, br->name)) { - return !strcmp(br->datapath_type, "dummy") ? "dummy" : "internal"; + 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