diff options
author | Tom Herbert <therbert@google.com> | 2014-09-17 15:25:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-19 17:15:32 -0400 |
commit | 56328486539ddd07cbaafec7a542a2c8a3043623 (patch) | |
tree | fbfbf2ae1b1aa35fe2fc537d4f8f3fdcceb1f5c8 /include/net/ip_tunnels.h | |
parent | afe93325bc02a5b2dea0cd7d78225de692265e6e (diff) |
net: Changes to ip_tunnel to support foo-over-udp encapsulation
This patch changes IP tunnel to support (secondary) encapsulation,
Foo-over-UDP. Changes include:
1) Adding tun_hlen as the tunnel header length, encap_hlen as the
encapsulation header length, and hlen becomes the grand total
of these.
2) Added common netlink define to support FOU encapsulation.
3) Routines to perform FOU encapsulation.
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip_tunnels.h')
-rw-r--r-- | include/net/ip_tunnels.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 8dd8cab88b87..7f538ba6e267 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <net/gro_cells.h> | 10 | #include <net/gro_cells.h> |
11 | #include <net/inet_ecn.h> | 11 | #include <net/inet_ecn.h> |
12 | #include <net/ip.h> | 12 | #include <net/ip.h> |
13 | #include <net/netns/generic.h> | ||
13 | #include <net/rtnetlink.h> | 14 | #include <net/rtnetlink.h> |
14 | 15 | ||
15 | #if IS_ENABLED(CONFIG_IPV6) | 16 | #if IS_ENABLED(CONFIG_IPV6) |
@@ -31,6 +32,13 @@ struct ip_tunnel_6rd_parm { | |||
31 | }; | 32 | }; |
32 | #endif | 33 | #endif |
33 | 34 | ||
35 | struct ip_tunnel_encap { | ||
36 | __u16 type; | ||
37 | __u16 flags; | ||
38 | __be16 sport; | ||
39 | __be16 dport; | ||
40 | }; | ||
41 | |||
34 | struct ip_tunnel_prl_entry { | 42 | struct ip_tunnel_prl_entry { |
35 | struct ip_tunnel_prl_entry __rcu *next; | 43 | struct ip_tunnel_prl_entry __rcu *next; |
36 | __be32 addr; | 44 | __be32 addr; |
@@ -56,13 +64,18 @@ struct ip_tunnel { | |||
56 | /* These four fields used only by GRE */ | 64 | /* These four fields used only by GRE */ |
57 | __u32 i_seqno; /* The last seen seqno */ | 65 | __u32 i_seqno; /* The last seen seqno */ |
58 | __u32 o_seqno; /* The last output seqno */ | 66 | __u32 o_seqno; /* The last output seqno */ |
59 | int hlen; /* Precalculated header length */ | 67 | int tun_hlen; /* Precalculated header length */ |
60 | int mlink; | 68 | int mlink; |
61 | 69 | ||
62 | struct ip_tunnel_dst __percpu *dst_cache; | 70 | struct ip_tunnel_dst __percpu *dst_cache; |
63 | 71 | ||
64 | struct ip_tunnel_parm parms; | 72 | struct ip_tunnel_parm parms; |
65 | 73 | ||
74 | int encap_hlen; /* Encap header length (FOU,GUE) */ | ||
75 | struct ip_tunnel_encap encap; | ||
76 | |||
77 | int hlen; /* tun_hlen + encap_hlen */ | ||
78 | |||
66 | /* for SIT */ | 79 | /* for SIT */ |
67 | #ifdef CONFIG_IPV6_SIT_6RD | 80 | #ifdef CONFIG_IPV6_SIT_6RD |
68 | struct ip_tunnel_6rd_parm ip6rd; | 81 | struct ip_tunnel_6rd_parm ip6rd; |
@@ -114,6 +127,8 @@ void ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops); | |||
114 | void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | 127 | void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
115 | const struct iphdr *tnl_params, const u8 protocol); | 128 | const struct iphdr *tnl_params, const u8 protocol); |
116 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); | 129 | int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); |
130 | int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, | ||
131 | u8 *protocol, struct flowi4 *fl4); | ||
117 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); | 132 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); |
118 | 133 | ||
119 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, | 134 | struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, |
@@ -131,6 +146,8 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], | |||
131 | struct ip_tunnel_parm *p); | 146 | struct ip_tunnel_parm *p); |
132 | void ip_tunnel_setup(struct net_device *dev, int net_id); | 147 | void ip_tunnel_setup(struct net_device *dev, int net_id); |
133 | void ip_tunnel_dst_reset_all(struct ip_tunnel *t); | 148 | void ip_tunnel_dst_reset_all(struct ip_tunnel *t); |
149 | int ip_tunnel_encap_setup(struct ip_tunnel *t, | ||
150 | struct ip_tunnel_encap *ipencap); | ||
134 | 151 | ||
135 | /* Extract dsfield from inner protocol */ | 152 | /* Extract dsfield from inner protocol */ |
136 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, | 153 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, |