#define __NET_IP_TUNNELS_WRAPPER_H 1
#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
+#if defined(HAVE_GRE_HANDLE_OFFLOADS) && \
+ LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+/* RHEL6 and RHEL7 both has backported tunnel API but RHEL6 has
+ * older version, so avoid using RHEL6 backports.
+ */
+#define GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
+#endif
+
+#ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
#include_next <net/ip_tunnels.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
+static inline int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt,
+ struct sk_buff *skb, __be32 src,
+ __be32 dst, __u8 proto, __u8 tos,
+ __u8 ttl, __be16 df, bool xnet)
+{
+#ifdef HAVE_IPTUNNEL_XMIT_NET
+ return iptunnel_xmit(NULL, rt, skb, src, dst, proto, tos, ttl, df);
+#else
+ return iptunnel_xmit(rt, skb, src, dst, proto, tos, ttl, df, xnet);
+#endif
+}
+#define iptunnel_xmit rpl_iptunnel_xmit
+#endif
+
#else
#include <linux/if_tunnel.h>
#define PACKET_RCVD 0
#define PACKET_REJECT 1
-int iptunnel_xmit(struct rtable *rt,
+int iptunnel_xmit(struct sock *sk, struct rtable *rt,
struct sk_buff *skb,
__be32 src, __be32 dst, __u8 proto,
__u8 tos, __u8 ttl, __be16 df, bool xnet);
/* Not yet upstream */
#define TUNNEL_OAM __cpu_to_be16(0x0200)
#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
+#define TUNNEL_OPTIONS_PRESENT __cpu_to_be16(0x0800)
#endif /* __NET_IP_TUNNELS_H */