summaryrefslogtreecommitdiff
path: root/wsutil/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'wsutil/interface.c')
-rw-r--r--wsutil/interface.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/wsutil/interface.c b/wsutil/interface.c
index 73e6a01ebf..4cd8b5954c 100644
--- a/wsutil/interface.c
+++ b/wsutil/interface.c
@@ -30,77 +30,77 @@
#include <wsutil/inet_addr.h>
#ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
+ #include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
- #include <sys/socket.h>
+ #include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
- #include <netinet/in.h>
+ #include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
- #include <arpa/inet.h>
+ #include <arpa/inet.h>
#endif
#ifdef HAVE_IFADDRS_H
- #include <ifaddrs.h>
+ #include <ifaddrs.h>
#endif
GSList *local_interfaces_to_list(void)
{
- GSList *interfaces = NULL;
+ GSList *interfaces = NULL;
#ifdef HAVE_GETIFADDRS
- struct ifaddrs *ifap;
- struct ifaddrs *ifa;
- int family;
- char ip[INET6_ADDRSTRLEN];
+ struct ifaddrs *ifap;
+ struct ifaddrs *ifa;
+ int family;
+ char ip[INET6_ADDRSTRLEN];
- if (getifaddrs(&ifap)) {
- goto end;
- }
+ if (getifaddrs(&ifap)) {
+ goto end;
+ }
- for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
- if (ifa->ifa_addr == NULL)
- continue;
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
+ if (ifa->ifa_addr == NULL)
+ continue;
- family = ifa->ifa_addr->sa_family;
+ family = ifa->ifa_addr->sa_family;
- memset(ip, 0x0, INET6_ADDRSTRLEN);
+ memset(ip, 0x0, INET6_ADDRSTRLEN);
- switch (family) {
- case AF_INET:
- {
- struct sockaddr_in *addr4 = (struct sockaddr_in *)ifa->ifa_addr;
- ws_inet_ntop4(&addr4->sin_addr, ip, sizeof(ip));
- break;
- }
+ switch (family) {
+ case AF_INET:
+ {
+ struct sockaddr_in *addr4 = (struct sockaddr_in *)ifa->ifa_addr;
+ ws_inet_ntop4(&addr4->sin_addr, ip, sizeof(ip));
+ break;
+ }
- case AF_INET6:
- {
- struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)ifa->ifa_addr;
- ws_inet_ntop6(&addr6->sin6_addr, ip, sizeof(ip));
- break;
- }
+ case AF_INET6:
+ {
+ struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)ifa->ifa_addr;
+ ws_inet_ntop6(&addr6->sin6_addr, ip, sizeof(ip));
+ break;
+ }
- default:
- break;
- }
+ default:
+ break;
+ }
- /* skip loopback addresses */
- if (!g_strcmp0(ip, "127.0.0.1") || !g_strcmp0(ip, "::1"))
- continue;
+ /* skip loopback addresses */
+ if (!g_strcmp0(ip, "127.0.0.1") || !g_strcmp0(ip, "::1"))
+ continue;
- if (*ip) {
- interfaces = g_slist_prepend(interfaces, g_strdup(ip));
+ if (*ip) {
+ interfaces = g_slist_prepend(interfaces, g_strdup(ip));
+ }
}
- }
- freeifaddrs(ifap);
+ freeifaddrs(ifap);
end:
#endif /* HAVE_GETIFADDRS */
- return interfaces;
+ return interfaces;
}
/*