summaryrefslogtreecommitdiffstats
path: root/src/socket.c
diff options
context:
space:
mode:
authorGravatar Cameron Katri2021-11-24 11:50:51 -0500
committerGravatar Cameron Katri2021-11-24 11:59:39 -0500
commit106cea58ae2d92fc755705a79e1753b3750edd15 (patch)
tree28a10350eeb60d82544ce54927feeaf3c4c87b5d /src/socket.c
parent7c37434360f1c49975c286566efc3f0c935a84ef (diff)
downloadlibimobiledevice-glue-106cea58ae2d92fc755705a79e1753b3750edd15.tar.gz
libimobiledevice-glue-106cea58ae2d92fc755705a79e1753b3750edd15.tar.bz2
socket: Add FreeBSD supprt to get_primary_mac_address
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c
index 2ffab4a..ad6135f 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>
-#ifdef __APPLE__
+#if defined (__APPLE__) || defined (__FreeBSD__)
#include <net/if_dl.h>
#endif
#ifdef __linux__
@@ -714,11 +714,15 @@ LIBIMOBILEDEVICE_GLUE_API int get_primary_mac_address(unsigned char mac_addr_buf
if (ifa->ifa_flags & IFF_LOOPBACK) {
continue;
}
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined (__FreeBSD__)
if (ifa->ifa_addr->sa_family != AF_LINK) {
continue;
}
+#if defined (__APPLE__)
if (!strcmp(ifa->ifa_name, "en0")) {
+#elif defined (__FreeBSD__)
+ {
+#endif
memcpy(mac_addr_buf, (unsigned char *)LLADDR((struct sockaddr_dl *)(ifa)->ifa_addr), 6);
result = 0;
break;