.. | .. |
---|
33 | 33 | /* Used to memset ipv4 address padding. */ |
---|
34 | 34 | #define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst) |
---|
35 | 35 | #define IP_TUNNEL_KEY_IPV4_PAD_LEN \ |
---|
36 | | - (FIELD_SIZEOF(struct ip_tunnel_key, u) - \ |
---|
37 | | - FIELD_SIZEOF(struct ip_tunnel_key, u.ipv4)) |
---|
| 36 | + (sizeof_field(struct ip_tunnel_key, u) - \ |
---|
| 37 | + sizeof_field(struct ip_tunnel_key, u.ipv4)) |
---|
38 | 38 | |
---|
39 | 39 | struct ip_tunnel_key { |
---|
40 | 40 | __be64 tun_id; |
---|
.. | .. |
---|
63 | 63 | |
---|
64 | 64 | /* Maximum tunnel options length. */ |
---|
65 | 65 | #define IP_TUNNEL_OPTS_MAX \ |
---|
66 | | - GENMASK((FIELD_SIZEOF(struct ip_tunnel_info, \ |
---|
| 66 | + GENMASK((sizeof_field(struct ip_tunnel_info, \ |
---|
67 | 67 | options_len) * BITS_PER_BYTE) - 1, 0) |
---|
68 | 68 | |
---|
69 | 69 | struct ip_tunnel_info { |
---|
.. | .. |
---|
113 | 113 | |
---|
114 | 114 | /* These four fields used only by GRE */ |
---|
115 | 115 | u32 i_seqno; /* The last seen seqno */ |
---|
116 | | - u32 o_seqno; /* The last output seqno */ |
---|
| 116 | + atomic_t o_seqno; /* The last output seqno */ |
---|
117 | 117 | int tun_hlen; /* Precalculated header length */ |
---|
118 | 118 | |
---|
119 | 119 | /* These four fields used only by ERSPAN */ |
---|
.. | .. |
---|
143 | 143 | bool collect_md; |
---|
144 | 144 | bool ignore_df; |
---|
145 | 145 | }; |
---|
146 | | - |
---|
147 | | -#define TUNNEL_CSUM __cpu_to_be16(0x01) |
---|
148 | | -#define TUNNEL_ROUTING __cpu_to_be16(0x02) |
---|
149 | | -#define TUNNEL_KEY __cpu_to_be16(0x04) |
---|
150 | | -#define TUNNEL_SEQ __cpu_to_be16(0x08) |
---|
151 | | -#define TUNNEL_STRICT __cpu_to_be16(0x10) |
---|
152 | | -#define TUNNEL_REC __cpu_to_be16(0x20) |
---|
153 | | -#define TUNNEL_VERSION __cpu_to_be16(0x40) |
---|
154 | | -#define TUNNEL_NO_KEY __cpu_to_be16(0x80) |
---|
155 | | -#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) |
---|
156 | | -#define TUNNEL_OAM __cpu_to_be16(0x0200) |
---|
157 | | -#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) |
---|
158 | | -#define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800) |
---|
159 | | -#define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000) |
---|
160 | | -#define TUNNEL_NOCACHE __cpu_to_be16(0x2000) |
---|
161 | | -#define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000) |
---|
162 | | - |
---|
163 | | -#define TUNNEL_OPTIONS_PRESENT \ |
---|
164 | | - (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT) |
---|
165 | 146 | |
---|
166 | 147 | struct tnl_ptk_info { |
---|
167 | 148 | __be16 flags; |
---|
.. | .. |
---|
260 | 241 | int proto, |
---|
261 | 242 | __be32 daddr, __be32 saddr, |
---|
262 | 243 | __be32 key, __u8 tos, int oif, |
---|
263 | | - __u32 mark) |
---|
| 244 | + __u32 mark, __u32 tun_inner_hash) |
---|
264 | 245 | { |
---|
265 | 246 | memset(fl4, 0, sizeof(*fl4)); |
---|
266 | 247 | fl4->flowi4_oif = oif; |
---|
.. | .. |
---|
270 | 251 | fl4->flowi4_proto = proto; |
---|
271 | 252 | fl4->fl4_gre_key = key; |
---|
272 | 253 | fl4->flowi4_mark = mark; |
---|
| 254 | + fl4->flowi4_multipath_hash = tun_inner_hash; |
---|
273 | 255 | } |
---|
274 | 256 | |
---|
275 | 257 | int ip_tunnel_init(struct net_device *dev); |
---|
.. | .. |
---|
286 | 268 | void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
---|
287 | 269 | const struct iphdr *tnl_params, const u8 protocol); |
---|
288 | 270 | void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, |
---|
289 | | - const u8 proto); |
---|
290 | | -int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); |
---|
| 271 | + const u8 proto, int tunnel_hlen); |
---|
| 272 | +int ip_tunnel_ctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); |
---|
| 273 | +int ip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
---|
291 | 274 | int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict); |
---|
292 | 275 | int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); |
---|
293 | 276 | |
---|
.. | .. |
---|
307 | 290 | struct ip_tunnel_parm *p, __u32 fwmark); |
---|
308 | 291 | void ip_tunnel_setup(struct net_device *dev, unsigned int net_id); |
---|
309 | 292 | |
---|
| 293 | +extern const struct header_ops ip_tunnel_header_ops; |
---|
310 | 294 | __be16 ip_tunnel_parse_protocol(const struct sk_buff *skb); |
---|
311 | 295 | |
---|
312 | 296 | struct ip_tunnel_encap_ops { |
---|
313 | 297 | size_t (*encap_hlen)(struct ip_tunnel_encap *e); |
---|
314 | 298 | int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e, |
---|
315 | 299 | u8 *protocol, struct flowi4 *fl4); |
---|
| 300 | + int (*err_handler)(struct sk_buff *skb, u32 info); |
---|
316 | 301 | }; |
---|
317 | 302 | |
---|
318 | 303 | #define MAX_IPTUN_ENCAP_OPS 8 |
---|
.. | .. |
---|
393 | 378 | static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, |
---|
394 | 379 | const struct sk_buff *skb) |
---|
395 | 380 | { |
---|
396 | | - if (skb->protocol == htons(ETH_P_IP)) |
---|
| 381 | + __be16 payload_protocol = skb_protocol(skb, true); |
---|
| 382 | + |
---|
| 383 | + if (payload_protocol == htons(ETH_P_IP)) |
---|
397 | 384 | return iph->tos; |
---|
398 | | - else if (skb->protocol == htons(ETH_P_IPV6)) |
---|
| 385 | + else if (payload_protocol == htons(ETH_P_IPV6)) |
---|
399 | 386 | return ipv6_get_dsfield((const struct ipv6hdr *)iph); |
---|
400 | 387 | else |
---|
401 | 388 | return 0; |
---|
.. | .. |
---|
404 | 391 | static inline u8 ip_tunnel_get_ttl(const struct iphdr *iph, |
---|
405 | 392 | const struct sk_buff *skb) |
---|
406 | 393 | { |
---|
407 | | - if (skb->protocol == htons(ETH_P_IP)) |
---|
| 394 | + __be16 payload_protocol = skb_protocol(skb, true); |
---|
| 395 | + |
---|
| 396 | + if (payload_protocol == htons(ETH_P_IP)) |
---|
408 | 397 | return iph->ttl; |
---|
409 | | - else if (skb->protocol == htons(ETH_P_IPV6)) |
---|
| 398 | + else if (payload_protocol == htons(ETH_P_IPV6)) |
---|
410 | 399 | return ((const struct ipv6hdr *)iph)->hop_limit; |
---|
411 | 400 | else |
---|
412 | 401 | return 0; |
---|
.. | .. |
---|
435 | 424 | u8 tos, u8 ttl, __be16 df, bool xnet); |
---|
436 | 425 | struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md, |
---|
437 | 426 | gfp_t flags); |
---|
| 427 | +int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst, |
---|
| 428 | + int headroom, bool reply); |
---|
438 | 429 | |
---|
439 | 430 | int iptunnel_handle_offloads(struct sk_buff *skb, int gso_type_mask); |
---|
440 | 431 | |
---|