- 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;
-
- if (iface->netdev) {
- VLOG_ERR("bridge %s: missing %s interface, dropping",
- br->name, iface->name);
- } else {
- /* We already reported a related error, don't bother
- * duplicating it. */
- }
- if (!ofproto_port_query_by_name(br->ofproto, port->name,
- &ofproto_port)) {
- VLOG_INFO("bridge %s: removed interface %s (%d)",
- br->name, port->name, ofproto_port.ofp_port);
- bridge_ofproto_port_del(br, ofproto_port);
- ofproto_port_destroy(&ofproto_port);
- }
- iface_clear_db_record(iface->cfg);
- iface_destroy(iface);
- }
-
- if (!ok) {
- if (list_is_empty(&port->ifaces)) {
- port_destroy(port);
- }
- return false;
- }