X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev.c;h=3c528a8d6a515232e41b3dc386801c678fddea6b;hb=d1673b006d53fdea72c0744e835362ed1917f879;hp=8c8bacbd8a6ea9d4c4c5f73c751076933cb3e3fc;hpb=275707c33f8f5463154bc3e2f561181a2060ab57;p=sliver-openvswitch.git diff --git a/lib/netdev.c b/lib/netdev.c index 8c8bacbd8..3c528a8d6 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -17,7 +17,6 @@ #include #include "netdev.h" -#include #include #include #include @@ -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);