#include "packets.h"
#include "poll-loop.h"
#include "socket-util.h"
+#include "svec.h"
#define THIS_MODULE VLM_netdev
#include "vlog.h"
}
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);
struct ofpbuf;
struct in_addr;
struct in6_addr;
+struct svec;
enum netdev_feature_type {
NETDEV_FEAT_CURRENT,
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 */