- iface->netdev = NULL;
- iface->cfg = if_cfg->cfg;
- hmap_insert(&br->iface_by_name, &iface->name_node,
- hash_string(iface->name, 0));
- list_push_back(&port->ifaces, &iface->port_elem);
- iface->type = iface_get_type(iface->cfg, br->cfg);
- if (ofp_port >= 0) {
- iface_set_ofp_port(iface, ofp_port);
- }
-
- hmap_remove(&br->if_cfg_todo, &if_cfg->hmap_node);
- free(if_cfg);
- if_cfg = NULL;
-
- error = netdev_open(iface->name, iface->type, &iface->netdev);
- if (error) {
- VLOG_WARN("could not open network device %s (%s)", iface->name,
- strerror(error));
- }
-
- if (iface->netdev
- && port->cfg->vlan_mode
- && !strcmp(port->cfg->vlan_mode, "splinter")) {
- netdev_turn_flags_on(iface->netdev, NETDEV_UP, true);
- }
-
- /* Configure the netdev. */
- if (iface->netdev) {
- int error = iface_set_netdev_config(iface->cfg, iface->netdev);
- if (error) {
- netdev_close(iface->netdev);
- iface->netdev = NULL;
- }
- }
-
- /* Add the port, if necessary. */
- if (iface->netdev && iface->ofp_port < 0) {
- uint16_t new_ofp_port;
- int error;
-
- error = ofproto_port_add(br->ofproto, iface->netdev, &new_ofp_port);
- if (!error) {
- VLOG_INFO("bridge %s: added interface %s (%d)", br->name,
- iface->name, new_ofp_port);
- iface_set_ofp_port(iface, new_ofp_port);
- } else {
- netdev_close(iface->netdev);
- iface->netdev = NULL;
- }
- }
-
- /* Initially populate stats columns. */
- if (iface->netdev) {
- iface_refresh_stats(iface);
- iface_refresh_status(iface);
- }
-
- /* Delete the iface if we failed. */
- ok = iface->netdev && iface->ofp_port >= 0;
- if (ok) {
- VLOG_DBG("bridge %s: interface %s is on port %d",
- br->name, iface->name, iface->ofp_port);
- } else {
- struct ofproto_port ofproto_port;