summaryrefslogtreecommitdiffstats
path: root/utils/iftest.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/iftest.c')
-rw-r--r--utils/iftest.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/utils/iftest.c b/utils/iftest.c
new file mode 100644
index 0000000..61d066a
--- /dev/null
+++ b/utils/iftest.c
@@ -0,0 +1,31 @@
+/* simple test for index to interface name API */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include <libnfnetlink/libnfnetlink.h>
+
+int main()
+{
+ int i;
+ struct nlif_handle *h;
+
+ h = nlif_open();
+ if (h == NULL) {
+ perror("nlif_open");
+ exit(EXIT_FAILURE);
+ }
+
+ nlif_query(h);
+
+ for (i=0; i<64; i++) {
+ char name[IFNAMSIZ];
+
+ if (nlif_index2name(h, i, name) == -1)
+ continue;
+ printf("index (%d) is %s\n", i, name);
+ }
+
+ nlif_close(h);
+}