Use __ANDROID__ define rather than dirty hard-code to allow android NDK cross-compila...
[tinc] / src / raw_socket_device.c
index e2692ec..1dd726f 100644 (file)
@@ -20,7 +20,9 @@
 
 #include "system.h"
 
+#ifdef HAVE_NETPACKET_PACKET_H
 #include <netpacket/packet.h>
+#endif
 
 #include "conf.h"
 #include "device.h"
@@ -30,6 +32,7 @@
 #include "route.h"
 #include "xalloc.h"
 
+#if defined(PF_PACKET) && defined(ETH_P_ALL) && defined(AF_PACKET)
 static char *device_info;
 
 static uint64_t device_total_in = 0;
@@ -135,3 +138,19 @@ const devops_t raw_socket_devops = {
        .write = write_packet,
        .dump_stats = dump_device_stats,
 };
+
+#else
+
+static bool not_supported(void) {
+       logger(LOG_ERR, "Raw socket device not supported on this platform");
+       return false;
+}
+
+const devops_t raw_socket_devops = {
+       .setup = not_supported,
+       .close = NULL,
+       .read = NULL,
+       .write = NULL,
+       .dump_stats = NULL,
+};
+#endif