aboutsummaryrefslogtreecommitdiff
path: root/lib/dpif-netdev.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2013-01-08 14:37:23 -0800
committerEthan Jackson <ethan@nicira.com>2013-01-28 19:09:58 -0800
commitadd90f6f205a65c2569bb240683c0a70cc249c6b (patch)
tree70c4a42ffb914fa0cb63c0285e1cd32923af5290 /lib/dpif-netdev.c
parent8f73d5377d24ebc89540065a94a2e3117f114a4c (diff)
dpif-netdev: Allow stub interfaces on the dummy datapath.
Future patches will need to add netdevs to the dummy datapath which can't actually send or receive packets. Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/dpif-netdev.c')
-rw-r--r--lib/dpif-netdev.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 1d924c40..2cf22656 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -180,11 +180,17 @@ dpif_netdev_enumerate(struct sset *all_dps)
return 0;
}
+static bool
+dpif_netdev_class_is_dummy(const struct dpif_class *class)
+{
+ return class != &dpif_netdev_class;
+}
+
static const char *
dpif_netdev_port_open_type(const struct dpif_class *class, const char *type)
{
return strcmp(type, "internal") ? type
- : class != &dpif_netdev_class ? "dummy"
+ : dpif_netdev_class_is_dummy(class) ? "dummy"
: "tap";
}
@@ -385,7 +391,8 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
/* XXX reject non-Ethernet devices */
error = netdev_listen(netdev);
- if (error) {
+ if (error
+ && !(error == EOPNOTSUPP && dpif_netdev_class_is_dummy(dp->class))) {
VLOG_ERR("%s: cannot receive packets on this network device (%s)",
devname, strerror(errno));
netdev_close(netdev);