fix building for macos

checksum-failure-logging
Jeffrey Quesnelle 2019-08-06 17:14:12 -04:00
parent 3358241abe
commit 5112e1d2f9
2 changed files with 6 additions and 5 deletions

View File

@ -10,11 +10,6 @@ include(GNUInstallDirs)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# macOS Homebrew Boost Fix
if(NOT MSVC)
include_directories(AFTER /usr/local/include)
endif()
# Enable Warnings
if(MSVC)
# Force to always compile with W4

View File

@ -8,7 +8,9 @@
#include <cstring>
#include <sys/types.h>
#include <sys/socket.h>
#ifndef __APPLE__
#include <netpacket/packet.h>
#endif
using namespace icsneo;
@ -52,12 +54,16 @@ std::vector<PCAP::PCAPFoundDevice> PCAP::FindAll() {
pcap_addr* currentAddress = dev->addresses;
bool hasAddress = false;
while(!hasAddress && currentAddress != nullptr) {
#ifndef __APPLE__
if(currentAddress->addr && currentAddress->addr->sa_family == AF_PACKET) {
struct sockaddr_ll* s = (struct sockaddr_ll*)currentAddress->addr;
memcpy(netif.macAddress, s->sll_addr, sizeof(netif.macAddress));
hasAddress = true;
break;
}
#else
//TODO: get adapter address on macOS
#endif
currentAddress = currentAddress->next;
}