summaryrefslogtreecommitdiff
path: root/ucspi-tcp-0.88/socket_getifname.c
diff options
context:
space:
mode:
Diffstat (limited to 'ucspi-tcp-0.88/socket_getifname.c')
-rw-r--r--ucspi-tcp-0.88/socket_getifname.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ucspi-tcp-0.88/socket_getifname.c b/ucspi-tcp-0.88/socket_getifname.c
new file mode 100644
index 0000000..77edff9
--- /dev/null
+++ b/ucspi-tcp-0.88/socket_getifname.c
@@ -0,0 +1,14 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include "socket.h"
+
+static char ifname[IFNAMSIZ];
+
+const char* socket_getifname(uint32 interface) {
+ char *tmp=if_indextoname(interface,ifname);
+ if (tmp)
+ return tmp;
+ else
+ return "[unknown]";
+}