diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-10-03 10:59:00 +0200 |
---|---|---|
committer | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-10-03 11:00:56 +0200 |
commit | a789531e1dab39fcddc6d57af2312ead3b1fa4cc (patch) | |
tree | 71a8b793052044d4069b3c37ab63c876b6cc09f9 /src/ipcpd | |
parent | 0698f576d98ed1c4131d419c40019090f3ae06d1 (diff) | |
download | ouroboros-a789531e1dab39fcddc6d57af2312ead3b1fa4cc.tar.gz ouroboros-a789531e1dab39fcddc6d57af2312ead3b1fa4cc.zip |
ipcpd: Fix build for netmap enabled Ethernet IPCP
There were some compilation issues introduced by adding the interface
monitor to the Ethernet IPCP. Furthermore it was not possible to
select between raw sockets or netmap if both were available.
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.txt | 6 | ||||
-rw-r--r-- | src/ipcpd/eth/eth.c | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/ipcpd/eth/CMakeLists.txt b/src/ipcpd/eth/CMakeLists.txt index 7bad6ac0..624b8266 100644 --- a/src/ipcpd/eth/CMakeLists.txt +++ b/src/ipcpd/eth/CMakeLists.txt @@ -19,6 +19,8 @@ find_path(NETMAP_C_INCLUDE_DIR mark_as_advanced(NETMAP_C_INCLUDE_DIR) +unset(HAVE_ETH) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(DISABLE_RAW_SOCKETS FALSE CACHE BOOL "Disable raw socket support for Ethernet IPCPs") @@ -29,7 +31,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux") else () message(STATUS "Raw socket support for Ethernet IPCPs disabled by user") unset(HAVE_RAW_SOCKETS) - unset(HAVE_ETH) endif () endif () @@ -53,7 +54,6 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") message(STATUS "Berkeley Packet Filter support " "for Ethernet IPCPs disabled by user") unset(HAVE_BPF) - unset(HAVE_ETH) endif () endif () endif () @@ -69,8 +69,6 @@ if (NETMAP_C_INCLUDE_DIR) else () message(STATUS "Netmap support for Ethernet IPCPs disabled by user") unset(HAVE_NETMAP) - unset(HAVE_ETH) - unset(IPCP_ETH_TARGET CACHE) endif () endif () diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index 9456f4cb..8175d803 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -194,6 +194,7 @@ struct { struct shim_data * shim_data; #ifdef __linux__ int mtu; + int if_idx; #endif #if defined(HAVE_NETMAP) struct nm_desc * nmd; @@ -884,7 +885,9 @@ static void * eth_ipcp_sdu_reader(void * o) if (deid == MGMT_EID) { #elif defined (BUILD_ETH_LLC) if (length > 0x05FF) {/* DIX */ +#ifndef HAVE_NETMAP ipcp_sdb_release(sdb); +#endif continue; } @@ -1137,7 +1140,7 @@ static void * eth_ipcp_if_monitor(void * o) ifi = NLMSG_DATA(h); /* Not our interface */ - if (ifi->ifi_index != eth_data.device.sll_ifindex) + if (ifi->ifi_index != eth_data.if_idx) continue; if (ifi->ifi_flags & IFF_UP) { @@ -1284,6 +1287,7 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) log_err("Failed to retrieve interface index."); return -1; } + eth_data.if_idx = idx; #endif /* __FreeBSD__ */ #if defined(HAVE_NETMAP) @@ -1370,7 +1374,7 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) #endif /* HAVE_NETMAP */ ipcp_set_state(IPCP_OPERATIONAL); -#ifdef __linux__ +#if defined(__linux__) if (pthread_create(ð_data.if_monitor, NULL, eth_ipcp_if_monitor, @@ -1436,7 +1440,7 @@ static int eth_ipcp_bootstrap(const struct ipcp_config * conf) pthread_cancel(eth_data.if_monitor); pthread_join(eth_data.if_monitor, NULL); #endif -#if !defined(HAVE_NETMAP) +#if defined(__linux__) || !defined(HAVE_NETMAP) fail_device: #endif #if defined(HAVE_NETMAP) |