summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2018-10-03 14:37:15 +0200
committerDimitri Staessens <dimitri.staessens@ugent.be>2018-10-03 15:18:58 +0200
commitc9a54ee6b45c8566cf2d24f9763907451b50f7c1 (patch)
tree0ef8390a9221d7c01963f809a4bf28c83761cb4d /src/ipcpd
parent4b88be0201a947491130f174552a86a50c233dc2 (diff)
downloadouroboros-c9a54ee6b45c8566cf2d24f9763907451b50f7c1.tar.gz
ouroboros-c9a54ee6b45c8566cf2d24f9763907451b50f7c1.zip
build: Prioritize raw socket API in build
This will change the build to exclusively select one raw socket API in case multiple are present in the sytem, which will simplify the code. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/eth/CMakeLists.txt33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/ipcpd/eth/CMakeLists.txt b/src/ipcpd/eth/CMakeLists.txt
index 624b8266..6672f93c 100644
--- a/src/ipcpd/eth/CMakeLists.txt
+++ b/src/ipcpd/eth/CMakeLists.txt
@@ -14,31 +14,31 @@ include_directories(${CMAKE_BINARY_DIR}/include)
find_path(NETMAP_C_INCLUDE_DIR
net/netmap_user.h
- HINTS /usr/include /usr/local/include
-)
+ HINTS /usr/include /usr/local/include)
mark_as_advanced(NETMAP_C_INCLUDE_DIR)
-unset(HAVE_ETH)
-
+# Check for raw sockets
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(DISABLE_RAW_SOCKETS FALSE CACHE BOOL
"Disable raw socket support for Ethernet IPCPs")
if (NOT DISABLE_RAW_SOCKETS)
message(STATUS "Raw socket support for Ethernet IPCPs enabled")
set(HAVE_RAW_SOCKETS TRUE PARENT_SCOPE)
+ set(HAVE_RAW_SOCKETS TRUE)
set(HAVE_ETH TRUE)
else ()
message(STATUS "Raw socket support for Ethernet IPCPs disabled by user")
+ unset(HAVE_RAW_SOCKETS PARENT_SCOPE)
unset(HAVE_RAW_SOCKETS)
endif ()
endif ()
+# Check for BPF
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_path(BPF_C_INCLUDE_DIR
- net/bpf.h
- HINTS /usr/include /usr/local/include
- )
+ net/bpf.h
+ HINTS /usr/include /usr/local/include)
mark_as_advanced(BPF_C_INCLUDE_DIR)
@@ -47,28 +47,31 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
"Disable Berkeley Packet Filter support for Ethernet IPCPs")
if (NOT DISABLE_BPF)
message(STATUS "Berkeley Packet Filter support "
- "for Ethernet IPCPs enabled")
+ "for Ethernet IPCPs enabled")
set(HAVE_BPF TRUE PARENT_SCOPE)
+ set(HAVE_BPF TRUE)
set(HAVE_ETH TRUE)
else ()
message(STATUS "Berkeley Packet Filter support "
- "for Ethernet IPCPs disabled by user")
+ "for Ethernet IPCPs disabled by user")
+ unset(HAVE_BPF PARENT_SCOPE)
unset(HAVE_BPF)
endif ()
endif ()
endif ()
-if (NETMAP_C_INCLUDE_DIR)
+# Check for netmap exclusively
+if (NOT HAVE_RAW_SOCKETS AND NOT HAVE_BPF AND NETMAP_C_INCLUDE_DIR)
set(DISABLE_NETMAP FALSE CACHE BOOL
- "Disable netmap support for ETH IPCPs")
+ "Disable netmap support for ETH IPCPs")
if (NOT DISABLE_NETMAP)
message(STATUS "Netmap support for Ethernet IPCPs enabled")
- set(HAVE_NETMAP TRUE PARENT_SCOPE)
test_and_set_c_compiler_flag_global(-std=c99)
+ set(HAVE_NETMAP TRUE PARENT_SCOPE)
set(HAVE_ETH TRUE)
else ()
message(STATUS "Netmap support for Ethernet IPCPs disabled by user")
- unset(HAVE_NETMAP)
+ unset(HAVE_NETMAP PARENT_SCOPE)
endif ()
endif ()
@@ -83,12 +86,12 @@ if (HAVE_ETH)
set(ETH_LLC_SOURCES
# Add source files here
${CMAKE_CURRENT_SOURCE_DIR}/llc.c
- )
+ )
set(ETH_DIX_SOURCES
# Add source files here
${CMAKE_CURRENT_SOURCE_DIR}/dix.c
- )
+ )
set(IPCP_ETH_LLC_TARGET ipcpd-eth-llc CACHE INTERNAL "")
set(IPCP_ETH_DIX_TARGET ipcpd-eth-dix CACHE INTERNAL "")