blob: 61d066ae378d44c6a66222db4c43025f8257479d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
}
|