git://git.onelab.eu
/
sliver-openvswitch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ee77481
)
New function netdev_enumerate().
author
Ben Pfaff
<blp@nicira.com>
Tue, 20 Jan 2009 21:34:13 +0000
(13:34 -0800)
committer
Ben Pfaff
<blp@nicira.com>
Wed, 21 Jan 2009 00:45:22 +0000
(16:45 -0800)
lib/netdev.c
patch
|
blob
|
history
lib/netdev.h
patch
|
blob
|
history
diff --git
a/lib/netdev.c
b/lib/netdev.c
index
e83c647
..
9a91e2f
100644
(file)
--- a/
lib/netdev.c
+++ b/
lib/netdev.c
@@
-65,6
+65,7
@@
#include "packets.h"
#include "poll-loop.h"
#include "socket-util.h"
#include "packets.h"
#include "poll-loop.h"
#include "socket-util.h"
+#include "svec.h"
#define THIS_MODULE VLM_netdev
#include "vlog.h"
#define THIS_MODULE VLM_netdev
#include "vlog.h"
@@
-948,6
+949,27
@@
netdev_arp_lookup(const struct netdev *netdev,
}
return retval;
}
}
return retval;
}
+
+/* Initializes 'svec' with a list of the names of all known network devices. */
+void
+netdev_enumerate(struct svec *svec)
+{
+ struct if_nameindex *names;
+
+ svec_init(svec);
+ names = if_nameindex();
+ if (names) {
+ size_t i;
+
+ for (i = 0; names[i].if_name != NULL; i++) {
+ svec_add(svec, names[i].if_name);
+ }
+ if_freenameindex(names);
+ } else {
+ VLOG_WARN("could not obtain list of network device names: %s",
+ strerror(errno));
+ }
+}
\f
static void restore_all_flags(void *aux);
\f
static void restore_all_flags(void *aux);
diff --git
a/lib/netdev.h
b/lib/netdev.h
index
28a96e4
..
46f0cb0
100644
(file)
--- a/
lib/netdev.h
+++ b/
lib/netdev.h
@@
-46,6
+46,7
@@
struct ofpbuf;
struct in_addr;
struct in6_addr;
struct ofpbuf;
struct in_addr;
struct in6_addr;
+struct svec;
enum netdev_feature_type {
NETDEV_FEAT_CURRENT,
enum netdev_feature_type {
NETDEV_FEAT_CURRENT,
@@
-91,4
+92,6
@@
int netdev_turn_flags_on(struct netdev *, enum netdev_flags, bool permanent);
int netdev_turn_flags_off(struct netdev *, enum netdev_flags, bool permanent);
int netdev_arp_lookup(const struct netdev *, uint32_t ip, uint8_t mac[6]);
int netdev_turn_flags_off(struct netdev *, enum netdev_flags, bool permanent);
int netdev_arp_lookup(const struct netdev *, uint32_t ip, uint8_t mac[6]);
+void netdev_enumerate(struct svec *);
+
#endif /* netdev.h */
#endif /* netdev.h */