summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--config.h.in3
-rw-r--r--src/compat.h13
3 files changed, 24 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf0f5f7..942f5ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,14 @@ else()
set(LINUX FALSE)
endif()
+
+set(CMAKE_EXTRA_INCLUDE_FILES "netinet/if_ether.h")
+include(CheckTypeSize)
+
+check_type_size("struct ethhdr" SIZEOF_ETHHDR)
+string(COMPARE NOTEQUAL "${SIZEOF_ETHHDR}" "" HAVE_ETHHDR)
+
+
set(WITH_CAPABILITIES ${LINUX} CACHE BOOL "Include support for POSIX capabilities")
if(WITH_CAPABILITIES)
diff --git a/config.h.in b/config.h.in
index 0ad647c..1e094da 100644
--- a/config.h.in
+++ b/config.h.in
@@ -27,6 +27,9 @@
#ifndef _FASTD_CONFIG_H_
#define _FASTD_CONFIG_H_
+#cmakedefine HAVE_ETHHDR
+
+
#cmakedefine WITH_CAPABILITIES
#cmakedefine USE_CRYPTO_AES128CTR
diff --git a/src/compat.h b/src/compat.h
index e127dba..6afcbad 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -27,6 +27,11 @@
#ifndef _FASTD_COMPAT_H_
#define _FASTD_COMPAT_H_
+#include <config.h>
+
+#include <stdint.h>
+
+
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
@@ -35,4 +40,12 @@
#define ETH_HLEN 14
#endif
+#ifndef HAVE_ETHHDR
+struct ethhdr {
+ uint8_t h_dest[ETH_ALEN];
+ uint8_t h_source[ETH_ALEN];
+ uint16_t h_proto;
+} __attribute__((packed));
+#endif
+
#endif /* _FASTD_COMPAT_H_ */