Merge branch 'mainstream'
[sliver-openvswitch.git] / lib / netdev.c
index 8c8bacb..3c528a8 100644 (file)
@@ -17,7 +17,6 @@
 #include <config.h>
 #include "netdev.h"
 
-#include <assert.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <netinet/in.h>
@@ -85,6 +84,8 @@ netdev_initialize(void)
         netdev_register_provider(&netdev_tap_class);
         netdev_register_provider(&netdev_bsd_class);
 #endif
+       netdev_register_provider(&netdev_tunnel_class);
+       netdev_register_provider(&netdev_pltap_class);
     }
 }
 
@@ -228,7 +229,7 @@ netdev_open(const char *name, const char *type, struct netdev **netdevp)
         if (error) {
             return error;
         }
-        assert(netdev_dev->netdev_class == class);
+        ovs_assert(netdev_dev->netdev_class == class);
 
     }
 
@@ -290,6 +291,18 @@ netdev_get_config(const struct netdev *netdev, struct smap *args)
     return error;
 }
 
+const struct netdev_tunnel_config *
+netdev_get_tunnel_config(const struct netdev *netdev)
+{
+    struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
+
+    if (netdev_dev->netdev_class->get_tunnel_config) {
+        return netdev_dev->netdev_class->get_tunnel_config(netdev_dev);
+    } else {
+        return NULL;
+    }
+}
+
 /* Closes and destroys 'netdev'. */
 void
 netdev_close(struct netdev *netdev)
@@ -297,7 +310,7 @@ netdev_close(struct netdev *netdev)
     if (netdev) {
         struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
 
-        assert(netdev_dev->ref_cnt);
+        ovs_assert(netdev_dev->ref_cnt);
         netdev_dev->ref_cnt--;
         netdev_uninit(netdev, true);
 
@@ -392,8 +405,8 @@ netdev_recv(struct netdev *netdev, struct ofpbuf *buffer)
     int (*recv)(struct netdev *, void *, size_t);
     int retval;
 
-    assert(buffer->size == 0);
-    assert(ofpbuf_tailroom(buffer) >= ETH_TOTAL_MIN);
+    ovs_assert(buffer->size == 0);
+    ovs_assert(ofpbuf_tailroom(buffer) >= ETH_TOTAL_MIN);
 
     recv = netdev_get_dev(netdev)->netdev_class->recv;
     retval = (recv
@@ -1304,7 +1317,7 @@ void
 netdev_dev_init(struct netdev_dev *netdev_dev, const char *name,
                 const struct netdev_class *netdev_class)
 {
-    assert(!shash_find(&netdev_dev_shash, name));
+    ovs_assert(!shash_find(&netdev_dev_shash, name));
 
     memset(netdev_dev, 0, sizeof *netdev_dev);
     netdev_dev->netdev_class = netdev_class;
@@ -1324,7 +1337,7 @@ netdev_dev_uninit(struct netdev_dev *netdev_dev, bool destroy)
 {
     char *name = netdev_dev->name;
 
-    assert(!netdev_dev->ref_cnt);
+    ovs_assert(!netdev_dev->ref_cnt);
 
     shash_delete(&netdev_dev_shash, netdev_dev->node);