X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev.c;h=2d6360b58c6a697a5ef8892448e65e814bc8034d;hb=7fa0f73fb284b4406bcd085ee62552891b3fa6cd;hp=0a2e7c51edc9544147905c300a7182839c348086;hpb=cb22974d773942d66da42b700b8bca0db27a0920;p=sliver-openvswitch.git diff --git a/lib/netdev.c b/lib/netdev.c index 0a2e7c51e..2d6360b58 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -73,17 +73,20 @@ netdev_initialize(void) inited = true; fatal_signal_add_hook(close_all_netdevs, NULL, NULL, true); + netdev_vport_patch_register(); #ifdef LINUX_DATAPATH netdev_register_provider(&netdev_linux_class); netdev_register_provider(&netdev_internal_class); netdev_register_provider(&netdev_tap_class); - netdev_vport_register(); + netdev_vport_tunnel_register(); #endif #ifdef __FreeBSD__ 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); } } @@ -319,35 +322,6 @@ netdev_close(struct netdev *netdev) } } -/* Returns true if a network device named 'name' exists and may be opened, - * otherwise false. */ -bool -netdev_exists(const char *name) -{ - struct netdev *netdev; - int error; - - error = netdev_open(name, "system", &netdev); - if (!error) { - netdev_close(netdev); - return true; - } else { - if (error != ENODEV) { - VLOG_WARN("failed to open network device %s: %s", - name, strerror(error)); - } - return false; - } -} - -/* Returns true if a network device named 'name' is currently opened, - * otherwise false. */ -bool -netdev_is_open(const char *name) -{ - return !!shash_find_data(&netdev_dev_shash, name); -} - /* Parses 'netdev_name_', which is of the form [type@]name into its component * pieces. 'name' and 'type' must be freed by the caller. */ void @@ -1441,6 +1415,14 @@ netdev_get_type(const struct netdev *netdev) return netdev_get_dev(netdev)->netdev_class->type; } + +const char * +netdev_get_type_from_name(const char *name) +{ + const struct netdev_dev *dev = netdev_dev_from_name(name); + return dev ? netdev_dev_get_type(dev) : NULL; +} + struct netdev_dev * netdev_get_dev(const struct netdev *netdev) {