summaryrefslogtreecommitdiffstats
path: root/src/socket.c
diff options
context:
space:
mode:
authorGravatar Jerome Duval2024-04-11 10:08:22 +0200
committerGravatar Nikias Bassen2024-05-04 13:41:45 +0200
commit1ee8d0ac233fb510260dbf3a647fbd02f1a92825 (patch)
tree7a671e6f5fca92955fe94280529a65aeb95a8d9b /src/socket.c
parente61817ae57aac7252499268a9276692a32dc3e01 (diff)
downloadlibimobiledevice-glue-1ee8d0ac233fb510260dbf3a647fbd02f1a92825.tar.gz
libimobiledevice-glue-1ee8d0ac233fb510260dbf3a647fbd02f1a92825.tar.bz2
socket: Haiku compilation fixes
- link against libnetwork - get_primary_mac_address similar to FreeBSD
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c
index 5276b1e..d4dedd1 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -55,7 +55,7 @@ static int wsa_init = 0;
#ifdef AF_INET6
#include <net/if.h>
#include <ifaddrs.h>
-#if defined (__APPLE__) || defined (__FreeBSD__)
+#if defined (__APPLE__) || defined (__FreeBSD__) || defined (__HAIKU__)
#include <net/if_dl.h>
#endif
#ifdef __linux__
@@ -894,13 +894,13 @@ int get_primary_mac_address(unsigned char mac_addr_buf[6])
if (ifa->ifa_flags & IFF_LOOPBACK) {
continue;
}
-#if defined(__APPLE__) || defined (__FreeBSD__)
+#if defined(__APPLE__) || defined (__FreeBSD__) || defined (__HAIKU__)
if (ifa->ifa_addr->sa_family != AF_LINK) {
continue;
}
#if defined (__APPLE__)
if (!strcmp(ifa->ifa_name, "en0")) {
-#elif defined (__FreeBSD__)
+#elif defined (__FreeBSD__) || defined (__HAIKU__)
{
#endif
memcpy(mac_addr_buf, (unsigned char *)LLADDR((struct sockaddr_dl *)(ifa)->ifa_addr), 6);
@@ -973,10 +973,12 @@ static int32_t _sockaddr_in6_scope_id(struct sockaddr_in6* addr)
continue;
}
+#ifndef __HAIKU__
/* skip if not running */
if ((ifa->ifa_flags & IFF_RUNNING) == 0) {
continue;
}
+#endif
struct sockaddr_in6* addr_in = (struct sockaddr_in6*)ifa->ifa_addr;