#include "dirs.h"
#include "dpif.h"
#include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
#include "hmapx.h"
#include "if-notifier.h"
#include "jsonrpc.h"
#include "seq.h"
#include "sflow_api.h"
#include "sha1.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
#include "smap.h"
#include "socket-util.h"
#include "stream.h"
/* These members are valid only within bridge_reconfigure(). */
const char *type; /* Usually same as cfg->type. */
+ const char *netdev_type; /* type that should be used for netdev_open. */
const struct ovsrec_interface *cfg;
};
goto delete;
}
- if (strcmp(ofproto_port.type, iface->type)
+ if (strcmp(ofproto_port.type, iface->netdev_type)
|| netdev_set_config(iface->netdev, &iface->cfg->options, NULL)) {
/* The interface is the wrong type or can't be configured.
* Delete it. */
{
struct netdev *netdev = NULL;
int error;
+ const char *type;
if (netdev_is_reserved_name(iface_cfg->name)) {
VLOG_WARN("could not create interface %s, name is reserved",
goto error;
}
- error = netdev_open(iface_cfg->name,
- iface_get_type(iface_cfg, br->cfg), &netdev);
+ type = ofproto_port_open_type(br->cfg->datapath_type,
+ iface_get_type(iface_cfg, br->cfg));
+ error = netdev_open(iface_cfg->name, type, &netdev);
if (error) {
VLOG_WARN_BUF(errp, "could not open network device %s (%s)",
iface_cfg->name, ovs_strerror(error));
iface->ofp_port = ofp_port;
iface->netdev = netdev;
iface->type = iface_get_type(iface_cfg, br->cfg);
+ iface->netdev_type = ofproto_port_open_type(br->cfg->datapath_type,
+ iface->type);
iface->cfg = iface_cfg;
hmap_insert(&br->ifaces, &iface->ofp_port_node,
hash_ofp_port(ofp_port));
}
}
+ /* A port always has at least one interface. */
+ ovs_assert(iface != NULL);
+
/* The local port doesn't count (since we're trying to choose its
* MAC address anyway). */
if (iface->ofp_port == OFPP_LOCAL) {
const struct ovsrec_interface *cfg = port->interfaces[i];
struct iface *iface = iface_lookup(br, cfg->name);
const char *type = iface_get_type(cfg, br->cfg);
+ const char *dp_type = br->cfg->datapath_type;
+ const char *netdev_type = ofproto_port_open_type(dp_type, type);
if (iface) {
iface->cfg = cfg;
iface->type = type;
+ iface->netdev_type = netdev_type;
} else if (!strcmp(type, "null")) {
VLOG_WARN_ONCE("%s: The null interface type is deprecated and"
" may be removed in February 2013. Please email"
type = iface->type[0] ? iface->type : "system";
}
- return ofproto_port_open_type(br->datapath_type, type);
+ return type;
}
static void