ad17c9d9ab57b1fccbf9d46bc716232227b8f521
[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/if_tunnel.h>
5 #include <linux/netdevice.h>
6 #include <linux/skbuff.h>
7 #include <linux/types.h>
8 #include <net/dsfield.h>
9 #include <net/flow.h>
10 #include <net/inet_ecn.h>
11 #include <net/ip.h>
12 #include <net/rtnetlink.h>
13
14 #define TUNNEL_CSUM     __cpu_to_be16(0x01)
15 #define TUNNEL_ROUTING  __cpu_to_be16(0x02)
16 #define TUNNEL_KEY      __cpu_to_be16(0x04)
17 #define TUNNEL_SEQ      __cpu_to_be16(0x08)
18 #define TUNNEL_STRICT   __cpu_to_be16(0x10)
19 #define TUNNEL_REC      __cpu_to_be16(0x20)
20 #define TUNNEL_VERSION  __cpu_to_be16(0x40)
21 #define TUNNEL_NO_KEY   __cpu_to_be16(0x80)
22 #define TUNNEL_DONT_FRAGMENT    __cpu_to_be16(0x0100)
23
24 struct tnl_ptk_info {
25         __be16 flags;
26         __be16 proto;
27         __be32 key;
28         __be32 seq;
29 };
30
31 #define PACKET_RCVD     0
32 #define PACKET_REJECT   1
33
34 static inline void tunnel_ip_select_ident(struct sk_buff *skb,
35                                           const struct iphdr  *old_iph,
36                                           struct dst_entry *dst)
37 {
38         struct iphdr *iph = ip_hdr(skb);
39
40         /* Use inner packet iph-id if possible. */
41         if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
42                 iph->id = old_iph->id;
43         else
44                 __ip_select_ident(iph, dst,
45                                 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
46 }
47
48 int iptunnel_xmit(struct net *net, struct rtable *rt,
49                   struct sk_buff *skb,
50                   __be32 src, __be32 dst, __u8 proto,
51                   __u8 tos, __u8 ttl, __be16 df);
52
53 int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
54 #endif /* __NET_IP_TUNNELS_H */