[ovs-dev] [RFC flow tunnels 2/8] dpif-netdev: Allow stub interfaces on the dummy datapath.

Ethan Jackson ethan at nicira.com
Wed Jan 9 23:43:42 UTC 2013


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 at nicira.com>
---
 lib/dpif-netdev.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 682dfc9..d042ef9 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -181,11 +181,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";
 }
 
@@ -386,7 +392,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
+        && (!dpif_netdev_class_is_dummy(dp->class) || error != EOPNOTSUPP)) {
         VLOG_ERR("%s: cannot receive packets on this network device (%s)",
                  devname, strerror(errno));
         netdev_close(netdev);
-- 
1.7.9.5




More information about the dev mailing list