diff options
author | Simon Horman <horms@verge.net.au> | 2011-09-22 21:24:14 +0900 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-09-22 09:03:03 -0700 |
commit | ee9bed06cd2794ced29190b6c6539993159d76f5 (patch) | |
tree | 6a9110087081dd13869d3e175dc56b62824ef344 /lib/netdev.c | |
parent | 00fa9d37c2b2166358d9967a5fa03dc1ae45b2ca (diff) |
Remove netdev_find_dev_by_in4
netdev_find_dev_by_in4() appears to no longer be used and thus
can be removed. This also allows netdev_enumerate(), the
enumerate member of struct netdev_class and netdev_linux_enumerate()
to be removed.
I noticed this as netdev_linux_enumerate() makes use of if_nameindex()
and if_freenameindex() which are not available when compiling using
the Android NDK r6b (Android API level 13).
Diffstat (limited to 'lib/netdev.c')
-rw-r--r-- | lib/netdev.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/netdev.c b/lib/netdev.c index 1a668c8b..70f9678b 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -332,33 +332,6 @@ netdev_is_open(const char *name) return !!shash_find_data(&netdev_dev_shash, name); } -/* Clears 'sset' and enumerates the names of all known network devices. */ -int -netdev_enumerate(struct sset *sset) -{ - struct shash_node *node; - int error = 0; - - netdev_initialize(); - sset_clear(sset); - - SHASH_FOR_EACH(node, &netdev_classes) { - const struct netdev_class *netdev_class = node->data; - if (netdev_class->enumerate) { - int retval = netdev_class->enumerate(sset); - if (retval) { - VLOG_WARN("failed to enumerate %s network devices: %s", - netdev_class->type, strerror(retval)); - if (!error) { - error = retval; - } - } - } - } - - return error; -} - /* Parses 'netdev_name_', which is of the form [type@]name into its component * pieces. 'name' and 'type' must be freed by the caller. */ void @@ -1286,33 +1259,6 @@ netdev_get_vlan_vid(const struct netdev *netdev, int *vlan_vid) } return error; } - -/* Returns a network device that has 'in4' as its IP address, if one exists, - * otherwise a null pointer. */ -struct netdev * -netdev_find_dev_by_in4(const struct in_addr *in4) -{ - struct netdev *netdev; - struct sset dev_list = SSET_INITIALIZER(&dev_list); - const char *name; - - netdev_enumerate(&dev_list); - SSET_FOR_EACH (name, &dev_list) { - struct in_addr dev_in4; - - if (!netdev_open(name, "system", &netdev) - && !netdev_get_in4(netdev, &dev_in4, NULL) - && dev_in4.s_addr == in4->s_addr) { - goto exit; - } - netdev_close(netdev); - } - netdev = NULL; - -exit: - sset_destroy(&dev_list); - return netdev; -} /* Initializes 'netdev_dev' as a netdev device named 'name' of the specified * 'netdev_class'. This function is ordinarily called from a netdev provider's |