diff options
-rw-r--r-- | src/frontend/qt_sdl/LAN_PCap.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/frontend/qt_sdl/LAN_PCap.cpp b/src/frontend/qt_sdl/LAN_PCap.cpp index 8138699..3381e80 100644 --- a/src/frontend/qt_sdl/LAN_PCap.cpp +++ b/src/frontend/qt_sdl/LAN_PCap.cpp @@ -33,10 +33,10 @@ #include <sys/types.h> #include <ifaddrs.h> #include <netinet/in.h> - #ifdef __APPLE__ - #include <net/if_dl.h> + #ifdef __linux__ + #include <linux/if_packet.h> #else - #include <linux/if_packet.h> + #include <net/if_dl.h> #endif #endif @@ -283,16 +283,7 @@ bool Init(bool open_adapter) struct sockaddr_in* sa = (sockaddr_in*)curaddr->ifa_addr; memcpy(adata->IP_v4, &sa->sin_addr, 4); } - #ifdef __APPLE__ - else if (af == AF_LINK) - { - struct sockaddr_dl* sa = (sockaddr_dl*)curaddr->ifa_addr; - if (sa->sdl_alen != 6) - printf("weird MAC length %d for %s\n", sa->sdl_alen, curaddr->ifa_name); - else - memcpy(adata->MAC, LLADDR(sa), 6); - } - #else + #ifdef __linux__ else if (af == AF_PACKET) { struct sockaddr_ll* sa = (sockaddr_ll*)curaddr->ifa_addr; @@ -301,6 +292,15 @@ bool Init(bool open_adapter) else memcpy(adata->MAC, sa->sll_addr, 6); } + #else + else if (af == AF_LINK) + { + struct sockaddr_dl* sa = (sockaddr_dl*)curaddr->ifa_addr; + if (sa->sdl_alen != 6) + printf("weird MAC length %d for %s\n", sa->sdl_alen, curaddr->ifa_name); + else + memcpy(adata->MAC, LLADDR(sa), 6); + } #endif curaddr = curaddr->ifa_next; } |