X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vswitchd%2Fbridge.c;h=94668a733f9a316912bbf70205f3fa49fae06399;hb=18812dff32ce650440b9f1eac1bb00afe08c621a;hp=9b70e63cb1346e690753bf19936cacdace4c7f1e;hpb=7b6b0ef47e398a2fbda48fd385f9781b2df8bebb;p=sliver-openvswitch.git diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 9b70e63cb..94668a733 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -846,28 +846,36 @@ bridge_add_ofproto_ports(struct bridge *br) struct ofproto_port ofproto_port; LIST_FOR_EACH_SAFE (iface, next_iface, port_elem, &port->ifaces) { - struct shash args; int error; - /* Open the netdev or reconfigure it. */ - shash_init(&args); - shash_from_ovs_idl_map(iface->cfg->key_options, - iface->cfg->value_options, - iface->cfg->n_options, &args); + /* Open the netdev. */ if (!iface->netdev) { - struct netdev_options options; - options.name = iface->name; - options.type = iface->type; - options.args = &args; - error = netdev_open(&options, &iface->netdev); + error = netdev_open(iface->name, iface->type, &iface->netdev); + if (error) { + VLOG_WARN("could not open network device %s (%s)", + iface->name, strerror(error)); + } } else { - error = netdev_set_config(iface->netdev, &args); + error = 0; } - shash_destroy(&args); - if (error) { - VLOG_WARN("could not %s network device %s (%s)", - iface->netdev ? "reconfigure" : "open", - iface->name, strerror(error)); + + /* Configure the netdev. */ + if (iface->netdev) { + struct shash args; + + shash_init(&args); + shash_from_ovs_idl_map(iface->cfg->key_options, + iface->cfg->value_options, + iface->cfg->n_options, &args); + error = netdev_set_config(iface->netdev, &args); + shash_destroy(&args); + + if (error) { + VLOG_WARN("could not configure network device %s (%s)", + iface->name, strerror(error)); + netdev_close(iface->netdev); + iface->netdev = NULL; + } } /* Add the port, if necessary. */ @@ -891,7 +899,7 @@ bridge_add_ofproto_ports(struct bridge *br) iface_refresh_status(iface); } - /* Delete the iface if */ + /* Delete the iface if we failed. */ if (iface->netdev && iface->ofp_port >= 0) { VLOG_DBG("bridge %s: interface %s is on port %d", br->name, iface->name, iface->ofp_port); @@ -917,14 +925,10 @@ bridge_add_ofproto_ports(struct bridge *br) if (port_is_bond_fake_iface(port)) { if (ofproto_port_query_by_name(br->ofproto, port->name, &ofproto_port)) { - struct netdev_options options; struct netdev *netdev; int error; - options.name = port->name; - options.type = "internal"; - options.args = NULL; - error = netdev_open(&options, &netdev); + error = netdev_open(port->name, "internal", &netdev); if (!error) { ofproto_port_add(br->ofproto, netdev, NULL); netdev_close(netdev);