130c2d6c696f1d61620963a981bcb95b8f76bebf
[cascardo/ovs.git] / datapath / linux / compat / include / net / ip_tunnels.h
1 #ifndef __NET_IP_TUNNELS_WRAPPER_H
2 #define __NET_IP_TUNNELS_WRAPPER_H 1
3
4 #include <linux/version.h>
5 #if defined(HAVE_GRE_HANDLE_OFFLOADS) && \
6      LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
7 /* RHEL6 and RHEL7 both has backported tunnel API but RHEL6 has
8  * older version, so avoid using RHEL6 backports.
9  */
10 #define GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
11 #endif
12
13 #ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
14 #include_next <net/ip_tunnels.h>
15 #else
16
17 #include <linux/if_tunnel.h>
18 #include <linux/netdevice.h>
19 #include <linux/skbuff.h>
20 #include <linux/types.h>
21 #include <net/dsfield.h>
22 #include <net/flow.h>
23 #include <net/inet_ecn.h>
24 #include <net/ip.h>
25 #include <net/rtnetlink.h>
26
27 #define TUNNEL_CSUM     __cpu_to_be16(0x01)
28 #define TUNNEL_ROUTING  __cpu_to_be16(0x02)
29 #define TUNNEL_KEY      __cpu_to_be16(0x04)
30 #define TUNNEL_SEQ      __cpu_to_be16(0x08)
31 #define TUNNEL_STRICT   __cpu_to_be16(0x10)
32 #define TUNNEL_REC      __cpu_to_be16(0x20)
33 #define TUNNEL_VERSION  __cpu_to_be16(0x40)
34 #define TUNNEL_NO_KEY   __cpu_to_be16(0x80)
35 #define TUNNEL_DONT_FRAGMENT    __cpu_to_be16(0x0100)
36
37 struct tnl_ptk_info {
38         __be16 flags;
39         __be16 proto;
40         __be32 key;
41         __be32 seq;
42 };
43
44 #define PACKET_RCVD     0
45 #define PACKET_REJECT   1
46
47 int iptunnel_xmit(struct rtable *rt,
48                   struct sk_buff *skb,
49                   __be32 src, __be32 dst, __u8 proto,
50                   __u8 tos, __u8 ttl, __be16 df, bool xnet);
51
52 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
53
54 #endif
55 #endif /* __NET_IP_TUNNELS_H */