From c8078e3eb124a61ff8936a73516cef163bbcb332 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Wed, 12 May 2021 16:46:52 +0200 Subject: [PATCH] - fixed problem in BSD ethernet layer (#328) - fixed bug in cmake file for BSD --- hal/CMakeLists.txt | 2 +- hal/ethernet/bsd/ethernet_bsd.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 2ca0ea94..6bf01739 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -65,7 +65,7 @@ endif(WITH_WPCAP) set (libhal_bsd_SRCS ${CMAKE_CURRENT_LIST_DIR}/socket/bsd/socket_bsd.c ${CMAKE_CURRENT_LIST_DIR}/ethernet/bsd/ethernet_bsd.c - ${CMAKE_CURRENT_LIST_DIR}/thread/bsd/thread_macos.c + ${CMAKE_CURRENT_LIST_DIR}/thread/bsd/thread_bsd.c ${CMAKE_CURRENT_LIST_DIR}/filesystem/linux/file_provider_linux.c ${CMAKE_CURRENT_LIST_DIR}/time/unix/time.c ${CMAKE_CURRENT_LIST_DIR}/memory/lib_memory.c diff --git a/hal/ethernet/bsd/ethernet_bsd.c b/hal/ethernet/bsd/ethernet_bsd.c index 6b51ea44..536de0fb 100644 --- a/hal/ethernet/bsd/ethernet_bsd.c +++ b/hal/ethernet/bsd/ethernet_bsd.c @@ -176,7 +176,7 @@ Ethernet_getInterfaceMACAddress(const char* interfaceId, uint8_t* addr) /* Get info about all local network interfaces. */ if (getifaddrs(&ifap)) { - printf("Error getting network interfaces list!"); + printf("Error getting network interfaces list!\n"); return; } @@ -197,7 +197,7 @@ Ethernet_getInterfaceMACAddress(const char* interfaceId, uint8_t* addr) memcpy(addr, LLADDR(link), link->sdl_alen); } else - printf("Could not find the network interface %s!", interfaceId); + printf("Could not find the network interface %s!\n", interfaceId); /* Free network interface info structure. */ freeifaddrs(ifap); @@ -313,7 +313,8 @@ Ethernet_createSocket(const char* interfaceId, uint8_t* destAddress) } /* Activate immediate mode. */ - if (ioctl(self->bpf, BIOCIMMEDIATE, &self->bpfBufferSize) == -1) + optval = 1; + if (ioctl(self->bpf, BIOCIMMEDIATE, &optval) == -1) { printf("Unable to activate immediate mode!\n"); GLOBAL_FREEMEM(self->bpfProgram.bf_insns);