summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2017-04-05 14:15:43 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2017-04-12 16:04:22 +0200
commit54635f435a76ad0f3141b09a9c5072f6e2e8c319 (patch)
treebbeda4674ce976fe8fa106f6585f9dfe6187483c
parent711d617dc106a8af34c6c8f3500f337a792f1f3d (diff)
Include local lwtunnel.h unless found in system
-rw-r--r--configure.in1
-rw-r--r--sysdep/autoconf.h.in3
-rw-r--r--sysdep/linux/lwtunnel.h45
-rw-r--r--sysdep/linux/netlink.c4
4 files changed, 53 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index af9c452d..c37a0264 100644
--- a/configure.in
+++ b/configure.in
@@ -218,6 +218,7 @@ esac
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
+AC_CHECK_HEADER([linux/lwtunnel.h], [AC_DEFINE(HAVE_LWTUNNEL)])
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>
diff --git a/sysdep/autoconf.h.in b/sysdep/autoconf.h.in
index 4887c433..6f580846 100644
--- a/sysdep/autoconf.h.in
+++ b/sysdep/autoconf.h.in
@@ -74,4 +74,7 @@
/* We have LibSSH */
#undef HAVE_LIBSSH
+/* We have linux lwtunnel */
+#undef HAVE_LWTUNNEL
+
#define CONFIG_PATH ?
diff --git a/sysdep/linux/lwtunnel.h b/sysdep/linux/lwtunnel.h
new file mode 100644
index 00000000..7cea3cbf
--- /dev/null
+++ b/sysdep/linux/lwtunnel.h
@@ -0,0 +1,45 @@
+#ifndef _LWTUNNEL_H_
+#define _LWTUNNEL_H_
+
+#include <linux/types.h>
+
+enum lwtunnel_encap_types {
+ LWTUNNEL_ENCAP_NONE,
+ LWTUNNEL_ENCAP_MPLS,
+ LWTUNNEL_ENCAP_IP,
+ LWTUNNEL_ENCAP_ILA,
+ LWTUNNEL_ENCAP_IP6,
+ __LWTUNNEL_ENCAP_MAX,
+};
+
+#define LWTUNNEL_ENCAP_MAX (__LWTUNNEL_ENCAP_MAX - 1)
+
+enum lwtunnel_ip_t {
+ LWTUNNEL_IP_UNSPEC,
+ LWTUNNEL_IP_ID,
+ LWTUNNEL_IP_DST,
+ LWTUNNEL_IP_SRC,
+ LWTUNNEL_IP_TTL,
+ LWTUNNEL_IP_TOS,
+ LWTUNNEL_IP_FLAGS,
+ LWTUNNEL_IP_PAD,
+ __LWTUNNEL_IP_MAX,
+};
+
+#define LWTUNNEL_IP_MAX (__LWTUNNEL_IP_MAX - 1)
+
+enum lwtunnel_ip6_t {
+ LWTUNNEL_IP6_UNSPEC,
+ LWTUNNEL_IP6_ID,
+ LWTUNNEL_IP6_DST,
+ LWTUNNEL_IP6_SRC,
+ LWTUNNEL_IP6_HOPLIMIT,
+ LWTUNNEL_IP6_TC,
+ LWTUNNEL_IP6_FLAGS,
+ LWTUNNEL_IP6_PAD,
+ __LWTUNNEL_IP6_MAX,
+};
+
+#define LWTUNNEL_IP6_MAX (__LWTUNNEL_IP6_MAX - 1)
+
+#endif /* _LWTUNNEL_H_ */
diff --git a/sysdep/linux/netlink.c b/sysdep/linux/netlink.c
index e20512f5..bed97331 100644
--- a/sysdep/linux/netlink.c
+++ b/sysdep/linux/netlink.c
@@ -31,7 +31,11 @@
#include <asm/types.h>
#include <linux/if.h>
+#ifdef HAVE_LWTUNNEL
#include <linux/lwtunnel.h>
+#else
+#include "sysdep/linux/lwtunnel.h"
+#endif
#include <linux/netlink.h>
#include <linux/rtnetlink.h>