]>
Commit | Line | Data |
---|---|---|
5ebaf571 PS |
1 | #ifndef __NET_IP_TUNNELS_WRAPPER_H |
2 | #define __NET_IP_TUNNELS_WRAPPER_H 1 | |
3 | ||
29c71cfa | 4 | #include <linux/version.h> |
705e9260 | 5 | |
1c95839f | 6 | #ifdef USE_UPSTREAM_TUNNEL |
7842e257 PS |
7 | /* Block all ip_tunnel functions. |
8 | * Only function that do not depend on ip_tunnel structure can | |
9 | * be used. Those needs to be explicitly defined in this header file. */ | |
29c71cfa | 10 | #include_next <net/ip_tunnels.h> |
8e53509c WT |
11 | |
12 | #ifndef TUNNEL_ERSPAN_OPT | |
13 | #define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000) | |
14 | #endif | |
15 | #define ovs_ip_tunnel_encap ip_tunnel_encap | |
3f3b76f9 GR |
16 | |
17 | #ifndef HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS | |
18 | static inline void rpl_ip_tunnel_info_opts_set(struct ip_tunnel_info *info, | |
19 | const void *from, int len, | |
20 | __be16 flags) | |
21 | { | |
22 | memcpy(ip_tunnel_info_opts(info), from, len); | |
23 | info->options_len = len; | |
24 | info->key.tun_flags |= flags; | |
25 | } | |
26 | ||
27 | #define ip_tunnel_info_opts_set rpl_ip_tunnel_info_opts_set | |
28 | #endif | |
29 | ||
30 | #else /* USE_UPSTREAM_TUNNEL */ | |
f6a0c895 | 31 | |
5ebaf571 | 32 | #include <linux/if_tunnel.h> |
5ebaf571 PS |
33 | #include <linux/types.h> |
34 | #include <net/dsfield.h> | |
f2252c61 | 35 | #include <net/dst_cache.h> |
5ebaf571 PS |
36 | #include <net/flow.h> |
37 | #include <net/inet_ecn.h> | |
38 | #include <net/ip.h> | |
39 | #include <net/rtnetlink.h> | |
8e53509c WT |
40 | #include <net/gro_cells.h> |
41 | ||
42 | #ifndef MAX_IPTUN_ENCAP_OPS | |
43 | #define MAX_IPTUN_ENCAP_OPS 8 | |
44 | #endif | |
45 | ||
46 | #ifndef HAVE_TUNNEL_ENCAP_TYPES | |
47 | enum tunnel_encap_types { | |
48 | TUNNEL_ENCAP_NONE, | |
49 | TUNNEL_ENCAP_FOU, | |
50 | TUNNEL_ENCAP_GUE, | |
51 | }; | |
52 | ||
53 | #define HAVE_TUNNEL_ENCAP_TYPES 1 | |
54 | #endif | |
5ebaf571 | 55 | |
c6e13fcc PS |
56 | #define __iptunnel_pull_header rpl___iptunnel_pull_header |
57 | int rpl___iptunnel_pull_header(struct sk_buff *skb, int hdr_len, | |
58 | __be16 inner_proto, bool raw_proto, bool xnet); | |
59 | ||
60 | #define iptunnel_pull_header rpl_iptunnel_pull_header | |
61 | static inline int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len, | |
62 | __be16 inner_proto, bool xnet) | |
63 | { | |
64 | return rpl___iptunnel_pull_header(skb, hdr_len, inner_proto, false, xnet); | |
65 | } | |
c6e13fcc | 66 | |
cf5789aa | 67 | int ovs_iptunnel_handle_offloads(struct sk_buff *skb, |
2a94b571 | 68 | int gso_type_mask, |
cf5789aa PS |
69 | void (*fix_segment)(struct sk_buff *)); |
70 | ||
bae2b2d9 | 71 | /* This is required to compile upstream gre.h. gre_handle_offloads() |
cf5789aa PS |
72 | * is defined in gre.h and needs iptunnel_handle_offloads(). This provides |
73 | * default signature for this function. | |
74 | * rpl prefix is to make OVS build happy. | |
75 | */ | |
76 | #define iptunnel_handle_offloads rpl_iptunnel_handle_offloads | |
436d36db | 77 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) |
cf5789aa | 78 | struct sk_buff *rpl_iptunnel_handle_offloads(struct sk_buff *skb, |
8e53509c WT |
79 | bool csum_help, |
80 | int gso_type_mask); | |
436d36db GR |
81 | #else |
82 | int rpl_iptunnel_handle_offloads(struct sk_buff *skb, | |
83 | bool csum_help, | |
84 | int gso_type_mask); | |
85 | #endif | |
9ffdbf41 JG |
86 | |
87 | #define iptunnel_xmit rpl_iptunnel_xmit | |
43dd2fce PS |
88 | void rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, |
89 | __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl, | |
90 | __be16 df, bool xnet); | |
8e53509c WT |
91 | #define ip_tunnel_xmit rpl_ip_tunnel_xmit |
92 | void rpl_ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, | |
93 | const struct iphdr *tnl_params, const u8 protocol); | |
94 | ||
9ffdbf41 | 95 | |
9ffdbf41 | 96 | #ifndef TUNNEL_CSUM |
5bff8644 WT |
97 | #define TUNNEL_CSUM __cpu_to_be16(0x01) |
98 | #define TUNNEL_ROUTING __cpu_to_be16(0x02) | |
99 | #define TUNNEL_KEY __cpu_to_be16(0x04) | |
100 | #define TUNNEL_SEQ __cpu_to_be16(0x08) | |
101 | #define TUNNEL_STRICT __cpu_to_be16(0x10) | |
102 | #define TUNNEL_REC __cpu_to_be16(0x20) | |
103 | #define TUNNEL_VERSION __cpu_to_be16(0x40) | |
104 | #define TUNNEL_NO_KEY __cpu_to_be16(0x80) | |
105 | #define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) | |
106 | #define TUNNEL_OAM __cpu_to_be16(0x0200) | |
107 | #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400) | |
108 | #define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800) | |
109 | #define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000) | |
110 | #define TUNNEL_NOCACHE __cpu_to_be16(0x2000) | |
111 | #define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000) | |
112 | ||
113 | #undef TUNNEL_OPTIONS_PRESENT | |
114 | #define TUNNEL_OPTIONS_PRESENT \ | |
115 | (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT) | |
5ebaf571 PS |
116 | |
117 | struct tnl_ptk_info { | |
118 | __be16 flags; | |
119 | __be16 proto; | |
120 | __be32 key; | |
121 | __be32 seq; | |
8e53509c | 122 | int hdr_len; |
5ebaf571 PS |
123 | }; |
124 | ||
125 | #define PACKET_RCVD 0 | |
126 | #define PACKET_REJECT 1 | |
8e53509c | 127 | #define PACKET_NEXT 2 |
9ffdbf41 | 128 | #endif |
5ebaf571 | 129 | |
8e53509c WT |
130 | #define IP_TNL_HASH_BITS 7 |
131 | #define IP_TNL_HASH_SIZE (1 << IP_TNL_HASH_BITS) | |
132 | ||
8e53509c WT |
133 | /* Keep error state on tunnel for 30 sec */ |
134 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | |
135 | ||
e23775f2 PS |
136 | /* Used to memset ip_tunnel padding. */ |
137 | #define IP_TUNNEL_KEY_SIZE offsetofend(struct ip_tunnel_key, tp_dst) | |
138 | ||
139 | /* Used to memset ipv4 address padding. */ | |
140 | #define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst) | |
141 | #define IP_TUNNEL_KEY_IPV4_PAD_LEN \ | |
142 | (FIELD_SIZEOF(struct ip_tunnel_key, u) - \ | |
143 | FIELD_SIZEOF(struct ip_tunnel_key, u.ipv4)) | |
144 | ||
145 | struct ip_tunnel_key { | |
146 | __be64 tun_id; | |
147 | union { | |
148 | struct { | |
149 | __be32 src; | |
150 | __be32 dst; | |
151 | } ipv4; | |
152 | struct { | |
153 | struct in6_addr src; | |
154 | struct in6_addr dst; | |
155 | } ipv6; | |
156 | } u; | |
157 | __be16 tun_flags; | |
158 | u8 tos; /* TOS for IPv4, TC for IPv6 */ | |
159 | u8 ttl; /* TTL for IPv4, HL for IPv6 */ | |
3259c4ff | 160 | __be32 label; /* Flow Label for IPv6 */ |
e23775f2 PS |
161 | __be16 tp_src; |
162 | __be16 tp_dst; | |
163 | }; | |
164 | ||
165 | /* Flags for ip_tunnel_info mode. */ | |
166 | #define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */ | |
167 | #define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */ | |
168 | ||
169 | struct ip_tunnel_info { | |
170 | struct ip_tunnel_key key; | |
f2252c61 | 171 | struct dst_cache dst_cache; |
e23775f2 PS |
172 | u8 options_len; |
173 | u8 mode; | |
174 | }; | |
175 | ||
8e53509c WT |
176 | /* 6rd prefix/relay information */ |
177 | #ifdef CONFIG_IPV6_SIT_6RD | |
178 | struct ip_tunnel_6rd_parm { | |
179 | struct in6_addr prefix; | |
180 | __be32 relay_prefix; | |
181 | u16 prefixlen; | |
182 | u16 relay_prefixlen; | |
183 | }; | |
184 | #endif | |
185 | ||
186 | struct ip_tunnel_encap { | |
187 | u16 type; | |
188 | u16 flags; | |
189 | __be16 sport; | |
190 | __be16 dport; | |
191 | }; | |
192 | ||
193 | struct ip_tunnel_prl_entry { | |
194 | struct ip_tunnel_prl_entry __rcu *next; | |
195 | __be32 addr; | |
196 | u16 flags; | |
197 | struct rcu_head rcu_head; | |
198 | }; | |
199 | ||
e23775f2 PS |
200 | static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info *tun_info) |
201 | { | |
202 | return tun_info->mode & IP_TUNNEL_INFO_IPV6 ? AF_INET6 : AF_INET; | |
203 | } | |
204 | ||
205 | static inline void *ip_tunnel_info_opts(struct ip_tunnel_info *info) | |
206 | { | |
207 | return info + 1; | |
208 | } | |
209 | ||
210 | static inline void ip_tunnel_info_opts_get(void *to, | |
211 | const struct ip_tunnel_info *info) | |
212 | { | |
213 | memcpy(to, info + 1, info->options_len); | |
214 | } | |
215 | ||
216 | static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info, | |
217 | const void *from, int len) | |
218 | { | |
219 | memcpy(ip_tunnel_info_opts(info), from, len); | |
220 | info->options_len = len; | |
221 | } | |
222 | ||
223 | static inline void ip_tunnel_key_init(struct ip_tunnel_key *key, | |
224 | __be32 saddr, __be32 daddr, | |
3259c4ff | 225 | u8 tos, u8 ttl, __be32 label, |
e23775f2 PS |
226 | __be16 tp_src, __be16 tp_dst, |
227 | __be64 tun_id, __be16 tun_flags) | |
228 | { | |
229 | key->tun_id = tun_id; | |
230 | key->u.ipv4.src = saddr; | |
231 | key->u.ipv4.dst = daddr; | |
232 | memset((unsigned char *)key + IP_TUNNEL_KEY_IPV4_PAD, | |
233 | 0, IP_TUNNEL_KEY_IPV4_PAD_LEN); | |
234 | key->tos = tos; | |
235 | key->ttl = ttl; | |
3259c4ff | 236 | key->label = label; |
e23775f2 PS |
237 | key->tun_flags = tun_flags; |
238 | ||
239 | /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of | |
240 | * the upper tunnel are used. | |
241 | * E.g: GRE over IPSEC, the tp_src and tp_port are zero. | |
242 | */ | |
243 | key->tp_src = tp_src; | |
244 | key->tp_dst = tp_dst; | |
245 | ||
246 | /* Clear struct padding. */ | |
247 | if (sizeof(*key) != IP_TUNNEL_KEY_SIZE) | |
248 | memset((unsigned char *)key + IP_TUNNEL_KEY_SIZE, | |
249 | 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE); | |
250 | } | |
251 | ||
252 | #define ip_tunnel_collect_metadata() true | |
253 | ||
5bff8644 | 254 | #undef TUNNEL_NOCACHE |
e02c0ed7 PS |
255 | #define TUNNEL_NOCACHE 0 |
256 | ||
257 | static inline bool | |
258 | ip_tunnel_dst_cache_usable(const struct sk_buff *skb, | |
259 | const struct ip_tunnel_info *info) | |
260 | { | |
261 | if (skb->mark) | |
262 | return false; | |
263 | if (!info) | |
264 | return true; | |
265 | if (info->key.tun_flags & TUNNEL_NOCACHE) | |
266 | return false; | |
267 | ||
268 | return true; | |
269 | } | |
e02c0ed7 | 270 | |
8e53509c WT |
271 | #define ip_tunnel_dst rpl_ip_tunnel_dst |
272 | struct rpl_ip_tunnel_dst { | |
273 | struct dst_entry __rcu *dst; | |
274 | __be32 saddr; | |
275 | }; | |
e23775f2 | 276 | |
8e53509c | 277 | #define ip_tunnel rpl_ip_tunnel |
e4120b10 | 278 | struct rpl_ip_tunnel { |
8e53509c WT |
279 | struct ip_tunnel __rcu *next; |
280 | struct hlist_node hash_node; | |
e23775f2 PS |
281 | struct net_device *dev; |
282 | struct net *net; /* netns for packet i/o */ | |
283 | ||
e23775f2 | 284 | unsigned long err_time; /* Time when the last ICMP error |
8e53509c WT |
285 | * arrived */ |
286 | int err_count; /* Number of arrived ICMP errors */ | |
e23775f2 PS |
287 | |
288 | /* These four fields used only by GRE */ | |
289 | u32 i_seqno; /* The last seen seqno */ | |
290 | u32 o_seqno; /* The last output seqno */ | |
291 | int tun_hlen; /* Precalculated header length */ | |
8e53509c WT |
292 | |
293 | /* These four fields used only by ERSPAN */ | |
294 | u32 index; /* ERSPAN type II index */ | |
295 | u8 erspan_ver; /* ERSPAN version */ | |
296 | u8 dir; /* ERSPAN direction */ | |
297 | u16 hwid; /* ERSPAN hardware ID */ | |
298 | ||
299 | struct dst_cache dst_cache; | |
e23775f2 PS |
300 | |
301 | struct ip_tunnel_parm parms; | |
302 | ||
8e53509c | 303 | int mlink; |
e23775f2 PS |
304 | int encap_hlen; /* Encap header length (FOU,GUE) */ |
305 | int hlen; /* tun_hlen + encap_hlen */ | |
8e53509c | 306 | struct ip_tunnel_encap encap; |
e23775f2 | 307 | |
8e53509c WT |
308 | /* for SIT */ |
309 | #ifdef CONFIG_IPV6_SIT_6RD | |
310 | struct ip_tunnel_6rd_parm ip6rd; | |
311 | #endif | |
312 | struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ | |
313 | unsigned int prl_count; /* # of entries in PRL */ | |
314 | unsigned int ip_tnl_net_id; | |
315 | struct gro_cells gro_cells; | |
316 | __u32 fwmark; | |
317 | bool collect_md; | |
318 | bool ignore_df; | |
e23775f2 PS |
319 | }; |
320 | ||
321 | #define ip_tunnel_net rpl_ip_tunnel_net | |
e4120b10 | 322 | struct rpl_ip_tunnel_net { |
8e53509c WT |
323 | struct net_device *fb_tunnel_dev; |
324 | struct hlist_head tunnels[IP_TNL_HASH_SIZE]; | |
e23775f2 | 325 | struct ip_tunnel __rcu *collect_md_tun; |
e23775f2 PS |
326 | }; |
327 | ||
328 | ||
8e53509c WT |
329 | struct ip_tunnel_encap_ops { |
330 | size_t (*encap_hlen)(struct ip_tunnel_encap *e); | |
331 | int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e, | |
332 | const u8 *protocol, struct flowi4 *fl4); | |
333 | }; | |
334 | ||
335 | extern const struct ip_tunnel_encap_ops __rcu * | |
336 | rpl_iptun_encaps[MAX_IPTUN_ENCAP_OPS]; | |
337 | ||
338 | #define ip_encap_hlen rpl_ip_encap_hlen | |
339 | static inline int rpl_ip_encap_hlen(struct ip_tunnel_encap *e) | |
340 | { | |
341 | const struct ip_tunnel_encap_ops *ops; | |
342 | int hlen = -EINVAL; | |
343 | ||
344 | if (e->type == TUNNEL_ENCAP_NONE) | |
345 | return 0; | |
346 | ||
347 | if (e->type >= MAX_IPTUN_ENCAP_OPS) | |
348 | return -EINVAL; | |
349 | ||
350 | rcu_read_lock(); | |
351 | ops = rcu_dereference(rpl_iptun_encaps[e->type]); | |
352 | if (likely(ops && ops->encap_hlen)) | |
353 | hlen = ops->encap_hlen(e); | |
354 | rcu_read_unlock(); | |
355 | ||
356 | return hlen; | |
357 | } | |
358 | ||
359 | static inline int ovs_ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t, | |
360 | const u8 *protocol, struct flowi4 *fl4) | |
361 | { | |
362 | const struct ip_tunnel_encap_ops *ops; | |
363 | int ret = -EINVAL; | |
364 | ||
365 | if (t->encap.type == TUNNEL_ENCAP_NONE) | |
366 | return 0; | |
367 | ||
368 | if (t->encap.type >= MAX_IPTUN_ENCAP_OPS) | |
369 | return -EINVAL; | |
370 | ||
371 | rcu_read_lock(); | |
372 | ops = rcu_dereference(rpl_iptun_encaps[t->encap.type]); | |
373 | if (likely(ops && ops->build_header)) | |
374 | ret = ops->build_header(skb, &t->encap, protocol, fl4); | |
375 | rcu_read_unlock(); | |
376 | ||
377 | return ret; | |
378 | } | |
379 | ||
e23775f2 | 380 | #define ip_tunnel_get_stats64 rpl_ip_tunnel_get_stats64 |
44a629b5 | 381 | #if !defined(HAVE_VOID_NDO_GET_STATS64) && !defined(HAVE_RHEL7_MAX_MTU) |
e23775f2 PS |
382 | struct rtnl_link_stats64 *rpl_ip_tunnel_get_stats64(struct net_device *dev, |
383 | struct rtnl_link_stats64 *tot); | |
436d36db GR |
384 | #else |
385 | void rpl_ip_tunnel_get_stats64(struct net_device *dev, | |
386 | struct rtnl_link_stats64 *tot); | |
387 | #endif | |
e23775f2 | 388 | #define ip_tunnel_get_dsfield rpl_ip_tunnel_get_dsfield |
e4120b10 WT |
389 | static inline u8 rpl_ip_tunnel_get_dsfield(const struct iphdr *iph, |
390 | const struct sk_buff *skb) | |
e23775f2 PS |
391 | { |
392 | if (skb->protocol == htons(ETH_P_IP)) | |
393 | return iph->tos; | |
394 | else if (skb->protocol == htons(ETH_P_IPV6)) | |
395 | return ipv6_get_dsfield((const struct ipv6hdr *)iph); | |
396 | else | |
397 | return 0; | |
398 | } | |
399 | ||
400 | #define ip_tunnel_ecn_encap rpl_ip_tunnel_ecn_encap | |
e4120b10 | 401 | static inline u8 rpl_ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, |
e23775f2 PS |
402 | const struct sk_buff *skb) |
403 | { | |
404 | u8 inner = ip_tunnel_get_dsfield(iph, skb); | |
405 | ||
406 | return INET_ECN_encapsulate(tos, inner); | |
407 | } | |
408 | ||
43dd2fce | 409 | static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len) |
e23775f2 | 410 | { |
43dd2fce PS |
411 | if (pkt_len > 0) { |
412 | struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats); | |
e23775f2 PS |
413 | |
414 | u64_stats_update_begin(&tstats->syncp); | |
43dd2fce | 415 | tstats->tx_bytes += pkt_len; |
e23775f2 PS |
416 | tstats->tx_packets++; |
417 | u64_stats_update_end(&tstats->syncp); | |
43dd2fce | 418 | put_cpu_ptr(tstats); |
e23775f2 | 419 | } else { |
43dd2fce PS |
420 | struct net_device_stats *err_stats = &dev->stats; |
421 | ||
422 | if (pkt_len < 0) { | |
423 | err_stats->tx_errors++; | |
424 | err_stats->tx_aborted_errors++; | |
425 | } else { | |
426 | err_stats->tx_dropped++; | |
427 | } | |
e23775f2 PS |
428 | } |
429 | } | |
e23775f2 | 430 | |
5bff8644 WT |
431 | static inline __be64 key32_to_tunnel_id(__be32 key) |
432 | { | |
433 | #ifdef __BIG_ENDIAN | |
434 | return (__force __be64)key; | |
435 | #else | |
436 | return (__force __be64)((__force u64)key << 32); | |
437 | #endif | |
438 | } | |
439 | ||
440 | /* Returns the least-significant 32 bits of a __be64. */ | |
441 | static inline __be32 tunnel_id_to_key32(__be64 tun_id) | |
442 | { | |
443 | #ifdef __BIG_ENDIAN | |
444 | return (__force __be32)tun_id; | |
445 | #else | |
446 | return (__force __be32)((__force u64)tun_id >> 32); | |
447 | #endif | |
448 | } | |
449 | ||
e23775f2 PS |
450 | #define ip_tunnel_init rpl_ip_tunnel_init |
451 | int rpl_ip_tunnel_init(struct net_device *dev); | |
452 | ||
453 | #define ip_tunnel_uninit rpl_ip_tunnel_uninit | |
454 | void rpl_ip_tunnel_uninit(struct net_device *dev); | |
455 | ||
456 | #define ip_tunnel_change_mtu rpl_ip_tunnel_change_mtu | |
457 | int rpl_ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); | |
458 | ||
459 | #define ip_tunnel_newlink rpl_ip_tunnel_newlink | |
460 | int rpl_ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], | |
461 | struct ip_tunnel_parm *p); | |
462 | ||
463 | #define ip_tunnel_dellink rpl_ip_tunnel_dellink | |
e23775f2 | 464 | void rpl_ip_tunnel_dellink(struct net_device *dev, struct list_head *head); |
e23775f2 PS |
465 | |
466 | #define ip_tunnel_init_net rpl_ip_tunnel_init_net | |
467 | int rpl_ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, | |
468 | struct rtnl_link_ops *ops, char *devname); | |
469 | ||
470 | #define ip_tunnel_delete_net rpl_ip_tunnel_delete_net | |
471 | void rpl_ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops); | |
472 | ||
473 | #define ip_tunnel_setup rpl_ip_tunnel_setup | |
474 | void rpl_ip_tunnel_setup(struct net_device *dev, int net_id); | |
475 | ||
00d662ba PS |
476 | #define ip_tunnel_get_iflink rpl_ip_tunnel_get_iflink |
477 | int rpl_ip_tunnel_get_iflink(const struct net_device *dev); | |
03469419 PS |
478 | |
479 | #define ip_tunnel_get_link_net rpl_ip_tunnel_get_link_net | |
480 | struct net *rpl_ip_tunnel_get_link_net(const struct net_device *dev); | |
06f1a61a | 481 | |
06f1a61a DW |
482 | #define __ip_tunnel_change_mtu rpl___ip_tunnel_change_mtu |
483 | int rpl___ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict); | |
06f1a61a | 484 | |
8e53509c WT |
485 | #define ip_tunnel_lookup rpl_ip_tunnel_lookup |
486 | struct ip_tunnel *rpl_ip_tunnel_lookup(struct ip_tunnel_net *itn, | |
487 | int link, __be16 flags, | |
488 | __be32 remote, __be32 local, | |
489 | __be32 key); | |
490 | ||
5a109898 PS |
491 | static inline int iptunnel_pull_offloads(struct sk_buff *skb) |
492 | { | |
493 | if (skb_is_gso(skb)) { | |
494 | int err; | |
495 | ||
496 | err = skb_unclone(skb, GFP_ATOMIC); | |
497 | if (unlikely(err)) | |
498 | return err; | |
499 | skb_shinfo(skb)->gso_type &= ~(NETIF_F_GSO_ENCAP_ALL >> | |
500 | NETIF_F_GSO_SHIFT); | |
501 | } | |
502 | ||
503 | skb->encapsulation = 0; | |
504 | return 0; | |
505 | } | |
e776e168 | 506 | #endif /* USE_UPSTREAM_TUNNEL */ |
06aeda48 PS |
507 | |
508 | #define skb_is_encapsulated ovs_skb_is_encapsulated | |
509 | bool ovs_skb_is_encapsulated(struct sk_buff *skb); | |
510 | ||
5ebaf571 | 511 | #endif /* __NET_IP_TUNNELS_H */ |