summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2007-01-26 02:35:30 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org>2007-01-26 02:35:30 +0000
commita0092d15955f23b0f32506a5666db365dfa56510 (patch)
tree6aef3b7ced37a50badf93b81bde4e7f3c1669b9b /utils
parent7e1f591a4796d45f8c655110cf3924e6a4566efb (diff)
- Initial commit of index2interface API (Eric Leblond), still work to do
- added a test file to utils/iftest.c
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile.am7
-rw-r--r--utils/iftest.c31
2 files changed, 38 insertions, 0 deletions
diff --git a/utils/Makefile.am b/utils/Makefile.am
new file mode 100644
index 0000000..51ed390
--- /dev/null
+++ b/utils/Makefile.am
@@ -0,0 +1,7 @@
+include $(top_srcdir)/Make_global.am
+
+bin_PROGRAMS = iftest
+
+iftest_SOURCES = iftest.c
+iftest_LDADD = ../src/libnfnetlink.la
+iftest_LDFLAGS = -dynamic -ldl
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);
+}