xref: /linux/include/net/ip_tunnels.h (revision 7f290c94352e59b1d720055fce760a69a63bd0a1)
1c5441932SPravin B Shelar #ifndef __NET_IP_TUNNELS_H
2c5441932SPravin B Shelar #define __NET_IP_TUNNELS_H 1
3c5441932SPravin B Shelar 
4c5441932SPravin B Shelar #include <linux/if_tunnel.h>
5c5441932SPravin B Shelar #include <linux/netdevice.h>
6c5441932SPravin B Shelar #include <linux/skbuff.h>
77f9562a1SJiri Benc #include <linux/socket.h>
8c5441932SPravin B Shelar #include <linux/types.h>
9c5441932SPravin B Shelar #include <linux/u64_stats_sync.h>
10c5441932SPravin B Shelar #include <net/dsfield.h>
11c5441932SPravin B Shelar #include <net/gro_cells.h>
12c5441932SPravin B Shelar #include <net/inet_ecn.h>
1356328486STom Herbert #include <net/netns/generic.h>
14c5441932SPravin B Shelar #include <net/rtnetlink.h>
153093fbe7SThomas Graf #include <net/lwtunnel.h>
16e09acddfSPaolo Abeni #include <net/dst_cache.h>
17c5441932SPravin B Shelar 
18c5441932SPravin B Shelar #if IS_ENABLED(CONFIG_IPV6)
19c5441932SPravin B Shelar #include <net/ipv6.h>
20c5441932SPravin B Shelar #include <net/ip6_fib.h>
21c5441932SPravin B Shelar #include <net/ip6_route.h>
22c5441932SPravin B Shelar #endif
23c5441932SPravin B Shelar 
24c5441932SPravin B Shelar /* Keep error state on tunnel for 30 sec */
25c5441932SPravin B Shelar #define IPTUNNEL_ERR_TIMEO	(30*HZ)
26c5441932SPravin B Shelar 
271d8fff90SThomas Graf /* Used to memset ip_tunnel padding. */
28376534a3SJiri Benc #define IP_TUNNEL_KEY_SIZE	offsetofend(struct ip_tunnel_key, tp_dst)
291d8fff90SThomas Graf 
30c1ea5d67SJiri Benc /* Used to memset ipv4 address padding. */
31c1ea5d67SJiri Benc #define IP_TUNNEL_KEY_IPV4_PAD	offsetofend(struct ip_tunnel_key, u.ipv4.dst)
32c1ea5d67SJiri Benc #define IP_TUNNEL_KEY_IPV4_PAD_LEN				\
33c1ea5d67SJiri Benc 	(FIELD_SIZEOF(struct ip_tunnel_key, u) -		\
34c1ea5d67SJiri Benc 	 FIELD_SIZEOF(struct ip_tunnel_key, u.ipv4))
35c1ea5d67SJiri Benc 
361d8fff90SThomas Graf struct ip_tunnel_key {
371d8fff90SThomas Graf 	__be64			tun_id;
38c1ea5d67SJiri Benc 	union {
39c1ea5d67SJiri Benc 		struct {
40c1ea5d67SJiri Benc 			__be32	src;
41c1ea5d67SJiri Benc 			__be32	dst;
42c1ea5d67SJiri Benc 		} ipv4;
43c1ea5d67SJiri Benc 		struct {
44c1ea5d67SJiri Benc 			struct in6_addr src;
45c1ea5d67SJiri Benc 			struct in6_addr dst;
46c1ea5d67SJiri Benc 		} ipv6;
47c1ea5d67SJiri Benc 	} u;
481d8fff90SThomas Graf 	__be16			tun_flags;
497c383fb2SJiri Benc 	u8			tos;		/* TOS for IPv4, TC for IPv6 */
507c383fb2SJiri Benc 	u8			ttl;		/* TTL for IPv4, HL for IPv6 */
511d8fff90SThomas Graf 	__be16			tp_src;
521d8fff90SThomas Graf 	__be16			tp_dst;
53ac1cf399SJiri Benc };
541d8fff90SThomas Graf 
5546fa062aSJiri Benc /* Flags for ip_tunnel_info mode. */
5646fa062aSJiri Benc #define IP_TUNNEL_INFO_TX	0x01	/* represents tx tunnel parameters */
577f9562a1SJiri Benc #define IP_TUNNEL_INFO_IPV6	0x02	/* key contains IPv6 addresses */
58ee122c79SThomas Graf 
591d8fff90SThomas Graf struct ip_tunnel_info {
601d8fff90SThomas Graf 	struct ip_tunnel_key	key;
61d71785ffSPaolo Abeni #ifdef CONFIG_DST_CACHE
62d71785ffSPaolo Abeni 	struct dst_cache	dst_cache;
63d71785ffSPaolo Abeni #endif
641d8fff90SThomas Graf 	u8			options_len;
65ee122c79SThomas Graf 	u8			mode;
661d8fff90SThomas Graf };
671d8fff90SThomas Graf 
68c5441932SPravin B Shelar /* 6rd prefix/relay information */
69c5441932SPravin B Shelar #ifdef CONFIG_IPV6_SIT_6RD
70c5441932SPravin B Shelar struct ip_tunnel_6rd_parm {
71c5441932SPravin B Shelar 	struct in6_addr		prefix;
72c5441932SPravin B Shelar 	__be32			relay_prefix;
73c5441932SPravin B Shelar 	u16			prefixlen;
74c5441932SPravin B Shelar 	u16			relay_prefixlen;
75c5441932SPravin B Shelar };
76c5441932SPravin B Shelar #endif
77c5441932SPravin B Shelar 
7856328486STom Herbert struct ip_tunnel_encap {
796b8847c5SJiri Benc 	u16			type;
806b8847c5SJiri Benc 	u16			flags;
8156328486STom Herbert 	__be16			sport;
8256328486STom Herbert 	__be16			dport;
8356328486STom Herbert };
8456328486STom Herbert 
85c5441932SPravin B Shelar struct ip_tunnel_prl_entry {
86c5441932SPravin B Shelar 	struct ip_tunnel_prl_entry __rcu *next;
87c5441932SPravin B Shelar 	__be32				addr;
88c5441932SPravin B Shelar 	u16				flags;
89c5441932SPravin B Shelar 	struct rcu_head			rcu_head;
90c5441932SPravin B Shelar };
91c5441932SPravin B Shelar 
922e15ea39SPravin B Shelar struct metadata_dst;
932e15ea39SPravin B Shelar 
94c5441932SPravin B Shelar struct ip_tunnel {
95c5441932SPravin B Shelar 	struct ip_tunnel __rcu	*next;
96c5441932SPravin B Shelar 	struct hlist_node hash_node;
97c5441932SPravin B Shelar 	struct net_device	*dev;
985e6700b3SNicolas Dichtel 	struct net		*net;	/* netns for packet i/o */
99c5441932SPravin B Shelar 
100c5441932SPravin B Shelar 	int		err_count;	/* Number of arrived ICMP errors */
101c5441932SPravin B Shelar 	unsigned long	err_time;	/* Time when the last ICMP error
102c5441932SPravin B Shelar 					 * arrived */
103c5441932SPravin B Shelar 
104c5441932SPravin B Shelar 	/* These four fields used only by GRE */
1056b8847c5SJiri Benc 	u32		i_seqno;	/* The last seen seqno	*/
1066b8847c5SJiri Benc 	u32		o_seqno;	/* The last output seqno */
10756328486STom Herbert 	int		tun_hlen;	/* Precalculated header length */
108c5441932SPravin B Shelar 	int		mlink;
109c5441932SPravin B Shelar 
110e09acddfSPaolo Abeni 	struct dst_cache dst_cache;
1117d442fabSTom Herbert 
112c5441932SPravin B Shelar 	struct ip_tunnel_parm parms;
113c5441932SPravin B Shelar 
11456328486STom Herbert 	int		encap_hlen;	/* Encap header length (FOU,GUE) */
11556328486STom Herbert 	struct ip_tunnel_encap encap;
11656328486STom Herbert 
11756328486STom Herbert 	int		hlen;		/* tun_hlen + encap_hlen */
11856328486STom Herbert 
119c5441932SPravin B Shelar 	/* for SIT */
120c5441932SPravin B Shelar #ifdef CONFIG_IPV6_SIT_6RD
121c5441932SPravin B Shelar 	struct ip_tunnel_6rd_parm ip6rd;
122c5441932SPravin B Shelar #endif
123c5441932SPravin B Shelar 	struct ip_tunnel_prl_entry __rcu *prl;	/* potential router list */
124c5441932SPravin B Shelar 	unsigned int		prl_count;	/* # of entries in PRL */
125c5441932SPravin B Shelar 	int			ip_tnl_net_id;
126c5441932SPravin B Shelar 	struct gro_cells	gro_cells;
1272e15ea39SPravin B Shelar 	bool			collect_md;
128c5441932SPravin B Shelar };
129c5441932SPravin B Shelar 
130c5441932SPravin B Shelar #define TUNNEL_CSUM		__cpu_to_be16(0x01)
131c5441932SPravin B Shelar #define TUNNEL_ROUTING		__cpu_to_be16(0x02)
132c5441932SPravin B Shelar #define TUNNEL_KEY		__cpu_to_be16(0x04)
133c5441932SPravin B Shelar #define TUNNEL_SEQ		__cpu_to_be16(0x08)
134c5441932SPravin B Shelar #define TUNNEL_STRICT		__cpu_to_be16(0x10)
135c5441932SPravin B Shelar #define TUNNEL_REC		__cpu_to_be16(0x20)
136c5441932SPravin B Shelar #define TUNNEL_VERSION		__cpu_to_be16(0x40)
137c5441932SPravin B Shelar #define TUNNEL_NO_KEY		__cpu_to_be16(0x80)
1389a628224SPravin B Shelar #define TUNNEL_DONT_FRAGMENT    __cpu_to_be16(0x0100)
1390b5e8b8eSAndy Zhou #define TUNNEL_OAM		__cpu_to_be16(0x0200)
1400b5e8b8eSAndy Zhou #define TUNNEL_CRIT_OPT		__cpu_to_be16(0x0400)
1411dd144cfSThomas Graf #define TUNNEL_GENEVE_OPT	__cpu_to_be16(0x0800)
1421dd144cfSThomas Graf #define TUNNEL_VXLAN_OPT	__cpu_to_be16(0x1000)
1431dd144cfSThomas Graf 
1441dd144cfSThomas Graf #define TUNNEL_OPTIONS_PRESENT	(TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT)
145c5441932SPravin B Shelar 
146c5441932SPravin B Shelar struct tnl_ptk_info {
147c5441932SPravin B Shelar 	__be16 flags;
148c5441932SPravin B Shelar 	__be16 proto;
149c5441932SPravin B Shelar 	__be32 key;
150c5441932SPravin B Shelar 	__be32 seq;
151c5441932SPravin B Shelar };
152c5441932SPravin B Shelar 
153c5441932SPravin B Shelar #define PACKET_RCVD	0
154c5441932SPravin B Shelar #define PACKET_REJECT	1
155c5441932SPravin B Shelar 
1566261d983Sstephen hemminger #define IP_TNL_HASH_BITS   7
157c5441932SPravin B Shelar #define IP_TNL_HASH_SIZE   (1 << IP_TNL_HASH_BITS)
158c5441932SPravin B Shelar 
159c5441932SPravin B Shelar struct ip_tunnel_net {
160c5441932SPravin B Shelar 	struct net_device *fb_tunnel_dev;
1616261d983Sstephen hemminger 	struct hlist_head tunnels[IP_TNL_HASH_SIZE];
1622e15ea39SPravin B Shelar 	struct ip_tunnel __rcu *collect_md_tun;
163c5441932SPravin B Shelar };
164c5441932SPravin B Shelar 
165a8c5f90fSTom Herbert struct ip_tunnel_encap_ops {
166a8c5f90fSTom Herbert 	size_t (*encap_hlen)(struct ip_tunnel_encap *e);
167a8c5f90fSTom Herbert 	int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
168a8c5f90fSTom Herbert 			    u8 *protocol, struct flowi4 *fl4);
169a8c5f90fSTom Herbert };
170a8c5f90fSTom Herbert 
171a8c5f90fSTom Herbert #define MAX_IPTUN_ENCAP_OPS 8
172a8c5f90fSTom Herbert 
173a8c5f90fSTom Herbert extern const struct ip_tunnel_encap_ops __rcu *
174a8c5f90fSTom Herbert 		iptun_encaps[MAX_IPTUN_ENCAP_OPS];
175a8c5f90fSTom Herbert 
176a8c5f90fSTom Herbert int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *op,
177a8c5f90fSTom Herbert 			    unsigned int num);
178a8c5f90fSTom Herbert int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *op,
179a8c5f90fSTom Herbert 			    unsigned int num);
180a8c5f90fSTom Herbert 
1814c222798SPravin B Shelar static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
1821d8fff90SThomas Graf 				      __be32 saddr, __be32 daddr,
1831d8fff90SThomas Graf 				      u8 tos, u8 ttl,
1841d8fff90SThomas Graf 				      __be16 tp_src, __be16 tp_dst,
1854c222798SPravin B Shelar 				      __be64 tun_id, __be16 tun_flags)
1861d8fff90SThomas Graf {
1874c222798SPravin B Shelar 	key->tun_id = tun_id;
1884c222798SPravin B Shelar 	key->u.ipv4.src = saddr;
1894c222798SPravin B Shelar 	key->u.ipv4.dst = daddr;
1904c222798SPravin B Shelar 	memset((unsigned char *)key + IP_TUNNEL_KEY_IPV4_PAD,
191c1ea5d67SJiri Benc 	       0, IP_TUNNEL_KEY_IPV4_PAD_LEN);
1924c222798SPravin B Shelar 	key->tos = tos;
1934c222798SPravin B Shelar 	key->ttl = ttl;
1944c222798SPravin B Shelar 	key->tun_flags = tun_flags;
1951d8fff90SThomas Graf 
1961d8fff90SThomas Graf 	/* For the tunnel types on the top of IPsec, the tp_src and tp_dst of
1971d8fff90SThomas Graf 	 * the upper tunnel are used.
1981d8fff90SThomas Graf 	 * E.g: GRE over IPSEC, the tp_src and tp_port are zero.
1991d8fff90SThomas Graf 	 */
2004c222798SPravin B Shelar 	key->tp_src = tp_src;
2014c222798SPravin B Shelar 	key->tp_dst = tp_dst;
2021d8fff90SThomas Graf 
2031d8fff90SThomas Graf 	/* Clear struct padding. */
2044c222798SPravin B Shelar 	if (sizeof(*key) != IP_TUNNEL_KEY_SIZE)
2054c222798SPravin B Shelar 		memset((unsigned char *)key + IP_TUNNEL_KEY_SIZE,
2064c222798SPravin B Shelar 		       0, sizeof(*key) - IP_TUNNEL_KEY_SIZE);
2071d8fff90SThomas Graf }
2081d8fff90SThomas Graf 
2097f9562a1SJiri Benc static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info
2107f9562a1SJiri Benc 					       *tun_info)
2117f9562a1SJiri Benc {
2127f9562a1SJiri Benc 	return tun_info->mode & IP_TUNNEL_INFO_IPV6 ? AF_INET6 : AF_INET;
2137f9562a1SJiri Benc }
2147f9562a1SJiri Benc 
2155243b6acSJesse Gross #ifdef CONFIG_INET
2165243b6acSJesse Gross 
217c5441932SPravin B Shelar int ip_tunnel_init(struct net_device *dev);
218c5441932SPravin B Shelar void ip_tunnel_uninit(struct net_device *dev);
219c5441932SPravin B Shelar void  ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
2201728d4faSNicolas Dichtel struct net *ip_tunnel_get_link_net(const struct net_device *dev);
2211e99584bSNicolas Dichtel int ip_tunnel_get_iflink(const struct net_device *dev);
222d3b6f614SEric Dumazet int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
223c5441932SPravin B Shelar 		       struct rtnl_link_ops *ops, char *devname);
224c5441932SPravin B Shelar 
2256c742e71SNicolas Dichtel void ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops);
226c5441932SPravin B Shelar 
227c5441932SPravin B Shelar void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
228bf3d6a8fSNicolas Dichtel 		    const struct iphdr *tnl_params, const u8 protocol);
229c5441932SPravin B Shelar int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd);
23056328486STom Herbert int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
23156328486STom Herbert 		    u8 *protocol, struct flowi4 *fl4);
232c5441932SPravin B Shelar int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
233c5441932SPravin B Shelar 
234c5441932SPravin B Shelar struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
235c5441932SPravin B Shelar 						struct rtnl_link_stats64 *tot);
236c5441932SPravin B Shelar struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
237c5441932SPravin B Shelar 				   int link, __be16 flags,
238c5441932SPravin B Shelar 				   __be32 remote, __be32 local,
239c5441932SPravin B Shelar 				   __be32 key);
240c5441932SPravin B Shelar 
241c5441932SPravin B Shelar int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
2422e15ea39SPravin B Shelar 		  const struct tnl_ptk_info *tpi, struct metadata_dst *tun_dst,
2432e15ea39SPravin B Shelar 		  bool log_ecn_error);
244c5441932SPravin B Shelar int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
245c5441932SPravin B Shelar 			 struct ip_tunnel_parm *p);
246c5441932SPravin B Shelar int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
247c5441932SPravin B Shelar 		      struct ip_tunnel_parm *p);
248c5441932SPravin B Shelar void ip_tunnel_setup(struct net_device *dev, int net_id);
24956328486STom Herbert int ip_tunnel_encap_setup(struct ip_tunnel *t,
25056328486STom Herbert 			  struct ip_tunnel_encap *ipencap);
251c5441932SPravin B Shelar 
252c5441932SPravin B Shelar /* Extract dsfield from inner protocol */
253c5441932SPravin B Shelar static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph,
254c5441932SPravin B Shelar 				       const struct sk_buff *skb)
255c5441932SPravin B Shelar {
256c5441932SPravin B Shelar 	if (skb->protocol == htons(ETH_P_IP))
257c5441932SPravin B Shelar 		return iph->tos;
258c5441932SPravin B Shelar 	else if (skb->protocol == htons(ETH_P_IPV6))
259c5441932SPravin B Shelar 		return ipv6_get_dsfield((const struct ipv6hdr *)iph);
260c5441932SPravin B Shelar 	else
261c5441932SPravin B Shelar 		return 0;
262c5441932SPravin B Shelar }
263c5441932SPravin B Shelar 
264c5441932SPravin B Shelar /* Propogate ECN bits out */
265c5441932SPravin B Shelar static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
266c5441932SPravin B Shelar 				     const struct sk_buff *skb)
267c5441932SPravin B Shelar {
268c5441932SPravin B Shelar 	u8 inner = ip_tunnel_get_dsfield(iph, skb);
269c5441932SPravin B Shelar 
270c5441932SPravin B Shelar 	return INET_ECN_encapsulate(tos, inner);
271c5441932SPravin B Shelar }
272c5441932SPravin B Shelar 
273*7f290c94SJiri Benc int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto,
274*7f290c94SJiri Benc 			 bool xnet);
275039f5062SPravin B Shelar void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
2766b8847c5SJiri Benc 		   __be32 src, __be32 dst, u8 proto,
2776b8847c5SJiri Benc 		   u8 tos, u8 ttl, __be16 df, bool xnet);
27863d008a4SJiri Benc struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
27963d008a4SJiri Benc 					     gfp_t flags);
2800e6fbc5bSPravin B Shelar 
2816fa79666SEdward Cree struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, int gso_type_mask);
2822d26f0a3SEric Dumazet 
283039f5062SPravin B Shelar static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len)
284c5441932SPravin B Shelar {
285039f5062SPravin B Shelar 	if (pkt_len > 0) {
286039f5062SPravin B Shelar 		struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
287c5441932SPravin B Shelar 
288c5441932SPravin B Shelar 		u64_stats_update_begin(&tstats->syncp);
289039f5062SPravin B Shelar 		tstats->tx_bytes += pkt_len;
290c5441932SPravin B Shelar 		tstats->tx_packets++;
291c5441932SPravin B Shelar 		u64_stats_update_end(&tstats->syncp);
292b4fe85f9SJason A. Donenfeld 		put_cpu_ptr(tstats);
293039f5062SPravin B Shelar 	} else {
294039f5062SPravin B Shelar 		struct net_device_stats *err_stats = &dev->stats;
295039f5062SPravin B Shelar 
296039f5062SPravin B Shelar 		if (pkt_len < 0) {
2970e6fbc5bSPravin B Shelar 			err_stats->tx_errors++;
2980e6fbc5bSPravin B Shelar 			err_stats->tx_aborted_errors++;
299c5441932SPravin B Shelar 		} else {
3000e6fbc5bSPravin B Shelar 			err_stats->tx_dropped++;
301c5441932SPravin B Shelar 		}
302c5441932SPravin B Shelar 	}
303039f5062SPravin B Shelar }
3045243b6acSJesse Gross 
3054c222798SPravin B Shelar static inline void *ip_tunnel_info_opts(struct ip_tunnel_info *info)
306ee122c79SThomas Graf {
307ee122c79SThomas Graf 	return info + 1;
308ee122c79SThomas Graf }
309ee122c79SThomas Graf 
3104c222798SPravin B Shelar static inline void ip_tunnel_info_opts_get(void *to,
3114c222798SPravin B Shelar 					   const struct ip_tunnel_info *info)
3124c222798SPravin B Shelar {
3134c222798SPravin B Shelar 	memcpy(to, info + 1, info->options_len);
3144c222798SPravin B Shelar }
3154c222798SPravin B Shelar 
3164c222798SPravin B Shelar static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
3174c222798SPravin B Shelar 					   const void *from, int len)
3184c222798SPravin B Shelar {
3194c222798SPravin B Shelar 	memcpy(ip_tunnel_info_opts(info), from, len);
3204c222798SPravin B Shelar 	info->options_len = len;
3214c222798SPravin B Shelar }
3224c222798SPravin B Shelar 
3233093fbe7SThomas Graf static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstate)
3243093fbe7SThomas Graf {
3253093fbe7SThomas Graf 	return (struct ip_tunnel_info *)lwtstate->data;
3263093fbe7SThomas Graf }
3273093fbe7SThomas Graf 
328e7030878SThomas Graf extern struct static_key ip_tunnel_metadata_cnt;
329e7030878SThomas Graf 
330e7030878SThomas Graf /* Returns > 0 if metadata should be collected */
331e7030878SThomas Graf static inline int ip_tunnel_collect_metadata(void)
332e7030878SThomas Graf {
333e7030878SThomas Graf 	return static_key_false(&ip_tunnel_metadata_cnt);
334e7030878SThomas Graf }
335e7030878SThomas Graf 
336045a0fa0SThomas Graf void __init ip_tunnel_core_init(void);
337045a0fa0SThomas Graf 
338e7030878SThomas Graf void ip_tunnel_need_metadata(void);
339e7030878SThomas Graf void ip_tunnel_unneed_metadata(void);
340e7030878SThomas Graf 
34105283187SThomas Graf #else /* CONFIG_INET */
34205283187SThomas Graf 
34305283187SThomas Graf static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstate)
34405283187SThomas Graf {
34505283187SThomas Graf 	return NULL;
34605283187SThomas Graf }
34705283187SThomas Graf 
34805283187SThomas Graf static inline void ip_tunnel_need_metadata(void)
34905283187SThomas Graf {
35005283187SThomas Graf }
35105283187SThomas Graf 
35205283187SThomas Graf static inline void ip_tunnel_unneed_metadata(void)
35305283187SThomas Graf {
35405283187SThomas Graf }
35505283187SThomas Graf 
3565243b6acSJesse Gross #endif /* CONFIG_INET */
3575243b6acSJesse Gross 
358c5441932SPravin B Shelar #endif /* __NET_IP_TUNNELS_H */
359