datapath: Provide compatibility for kernels up to 3.17
[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 LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
6 #include_next <net/ip_tunnels.h>
7
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
9 static inline int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt,
10                                     struct sk_buff *skb, __be32 src,
11                                     __be32 dst, __u8 proto, __u8 tos,
12                                     __u8 ttl, __be16 df, bool xnet)
13 {
14         return iptunnel_xmit(rt, skb, src, dst, proto, tos, ttl, df, xnet);
15 }
16 #define iptunnel_xmit rpl_iptunnel_xmit
17 #endif
18
19 #else
20
21 #include <linux/if_tunnel.h>
22 #include <linux/netdevice.h>
23 #include <linux/skbuff.h>
24 #include <linux/types.h>
25 #include <net/dsfield.h>
26 #include <net/flow.h>
27 #include <net/inet_ecn.h>
28 #include <net/ip.h>
29 #include <net/rtnetlink.h>
30
31 #define TUNNEL_CSUM     __cpu_to_be16(0x01)
32 #define TUNNEL_ROUTING  __cpu_to_be16(0x02)
33 #define TUNNEL_KEY      __cpu_to_be16(0x04)
34 #define TUNNEL_SEQ      __cpu_to_be16(0x08)
35 #define TUNNEL_STRICT   __cpu_to_be16(0x10)
36 #define TUNNEL_REC      __cpu_to_be16(0x20)
37 #define TUNNEL_VERSION  __cpu_to_be16(0x40)
38 #define TUNNEL_NO_KEY   __cpu_to_be16(0x80)
39 #define TUNNEL_DONT_FRAGMENT    __cpu_to_be16(0x0100)
40
41 struct tnl_ptk_info {
42         __be16 flags;
43         __be16 proto;
44         __be32 key;
45         __be32 seq;
46 };
47
48 #define PACKET_RCVD     0
49 #define PACKET_REJECT   1
50
51 int iptunnel_xmit(struct sock *sk, struct rtable *rt,
52                   struct sk_buff *skb,
53                   __be32 src, __be32 dst, __u8 proto,
54                   __u8 tos, __u8 ttl, __be16 df, bool xnet);
55
56 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
57
58 #endif
59
60 /* Not yet upstream */
61 #define TUNNEL_OAM      __cpu_to_be16(0x0200)
62 #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
63 #define TUNNEL_OPTIONS_PRESENT  __cpu_to_be16(0x0800)
64
65 #endif /* __NET_IP_TUNNELS_H */