blob: 625a38ccb5d9458f89c7cec3a698775ce864d6cb [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _NET_IP6_ROUTE_H
3#define _NET_IP6_ROUTE_H
4
YOSHIFUJI Hideaki70ceb4f2006-03-20 17:06:24 -08005struct route_info {
6 __u8 type;
7 __u8 length;
8 __u8 prefix_len;
9#if defined(__BIG_ENDIAN_BITFIELD)
10 __u8 reserved_h:3,
11 route_pref:2,
12 reserved_l:3;
13#elif defined(__LITTLE_ENDIAN_BITFIELD)
14 __u8 reserved_l:3,
15 route_pref:2,
16 reserved_h:3;
17#endif
Al Viroe69a4ad2006-11-14 20:56:00 -080018 __be32 lifetime;
Gustavo A. R. Silva207644f2020-02-28 18:44:10 -060019 __u8 prefix[]; /* 0,8 or 16 */
YOSHIFUJI Hideaki70ceb4f2006-03-20 17:06:24 -080020};
21
David Aherna2e2ff52016-06-16 16:24:24 -070022#include <net/addrconf.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <net/flow.h>
24#include <net/ip6_fib.h>
25#include <net/sock.h>
David Ahernf06b7542017-07-05 14:41:46 -060026#include <net/lwtunnel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <linux/ip.h>
28#include <linux/ipv6.h>
YOSHIFUJI Hideaki / 吉藤英明9bb5a142013-01-17 12:53:48 +000029#include <linux/route.h>
David Ahernf88d8ea2019-06-03 20:19:52 -070030#include <net/nexthop.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
YOSHIFUJI Hideaki7cbca672008-03-25 09:37:42 +090032#define RT6_LOOKUP_F_IFACE 0x00000001
33#define RT6_LOOKUP_F_REACHABLE 0x00000002
34#define RT6_LOOKUP_F_HAS_SADDR 0x00000004
35#define RT6_LOOKUP_F_SRCPREF_TMP 0x00000008
36#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
37#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
David Ahernd5d32e42016-10-24 12:27:23 -070038#define RT6_LOOKUP_F_IGNORE_LINKSTATE 0x00000040
Wei Wang0e09edc2019-06-20 17:36:37 -070039#define RT6_LOOKUP_F_DST_NOREF 0x00000080
YOSHIFUJI Hideaki77d16f42006-08-23 17:25:05 -070040
Eric Dumazet30f78d82014-04-10 21:23:36 -070041/* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
42 * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
43 */
44#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
45
YOSHIFUJI Hideaki / 吉藤英明0c9a2ac2010-03-07 00:14:44 +000046/*
47 * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
48 * between IPV6_ADDR_PREFERENCES socket option values
49 * IPV6_PREFER_SRC_TMP = 0x1
50 * IPV6_PREFER_SRC_PUBLIC = 0x2
51 * IPV6_PREFER_SRC_COA = 0x4
52 * and above RT6_LOOKUP_F_SRCPREF_xxx flags.
53 */
54static inline int rt6_srcprefs2flags(unsigned int srcprefs)
55{
56 /* No need to bitmask because srcprefs have only 3 bits. */
57 return srcprefs << 3;
58}
59
60static inline unsigned int rt6_flags2srcprefs(int flags)
61{
62 return (flags >> 3) & 7;
63}
Linus Torvalds1da177e2005-04-16 15:20:36 -070064
Wang Yufen60ea37f2014-03-29 09:27:30 +080065static inline bool rt6_need_strict(const struct in6_addr *daddr)
66{
67 return ipv6_addr_type(daddr) &
68 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
69}
David S. Millerfbfe95a2012-06-08 23:24:18 -070070
David Ahernf88d8ea2019-06-03 20:19:52 -070071/* fib entries using a nexthop object can not be coalesced into
72 * a multipath route
73 */
David Ahern33bd5ac2018-07-03 14:36:21 -070074static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i)
75{
David Ahernbe659b82019-04-21 17:39:18 -070076 /* the RTF_ADDRCONF flag filters out RA's */
David Ahernf88d8ea2019-06-03 20:19:52 -070077 return !(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh &&
David Ahern1cf844c2019-05-22 20:27:59 -070078 f6i->fib6_nh->fib_nh_gw_family;
David Ahern33bd5ac2018-07-03 14:36:21 -070079}
80
Joe Perches5c3a0fd2013-09-21 10:22:42 -070081void ip6_route_input(struct sk_buff *skb);
Mahesh Bandeward409b842016-09-16 12:59:08 -070082struct dst_entry *ip6_route_input_lookup(struct net *net,
83 struct net_device *dev,
David Ahernb75cc8f2018-03-02 08:32:17 -080084 struct flowi6 *fl6,
85 const struct sk_buff *skb, int flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
Wei Wang7d9e5f42019-06-20 17:36:41 -070087struct dst_entry *ip6_route_output_flags_noref(struct net *net,
88 const struct sock *sk,
89 struct flowi6 *fl6, int flags);
90
Paolo Abeni6f21c962016-01-29 12:30:19 +010091struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk,
92 struct flowi6 *fl6, int flags);
93
94static inline struct dst_entry *ip6_route_output(struct net *net,
95 const struct sock *sk,
96 struct flowi6 *fl6)
97{
98 return ip6_route_output_flags(net, sk, fl6, 0);
99}
100
Wei Wangd64a1f52019-06-20 17:36:39 -0700101/* Only conditionally release dst if flags indicates
102 * !RT6_LOOKUP_F_DST_NOREF or dst is in uncached_list.
103 */
104static inline void ip6_rt_put_flags(struct rt6_info *rt, int flags)
105{
106 if (!(flags & RT6_LOOKUP_F_DST_NOREF) ||
107 !list_empty(&rt->rt6i_uncached))
108 ip6_rt_put(rt);
109}
110
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700111struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
David Ahernb75cc8f2018-03-02 08:32:17 -0800112 const struct sk_buff *skb, int flags);
David Ahern9ff74382016-06-13 13:44:19 -0700113struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
David Ahernb75cc8f2018-03-02 08:32:17 -0800114 int ifindex, struct flowi6 *fl6,
115 const struct sk_buff *skb, int flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
WANG Cong2f460932017-05-03 22:07:31 -0700117void ip6_route_init_special_entries(void);
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700118int ip6_route_init(void);
119void ip6_route_cleanup(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120
Christoph Hellwig7c1552da2020-05-18 08:28:05 +0200121int ipv6_route_ioctl(struct net *net, unsigned int cmd,
122 struct in6_rtmsg *rtmsg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123
David Ahernacb54e32018-04-17 17:33:22 -0700124int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
125 struct netlink_ext_ack *extack);
David Ahern93c2fb22018-04-18 15:38:59 -0700126int ip6_ins_rt(struct net *net, struct fib6_info *f6i);
Roopa Prabhu11dd74b2020-04-27 13:56:45 -0700127int ip6_del_rt(struct net *net, struct fib6_info *f6i, bool skip_notify);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128
David Ahern93c2fb22018-04-18 15:38:59 -0700129void rt6_flush_exceptions(struct fib6_info *f6i);
130void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
Wei Wangc757faa2017-10-06 12:06:01 -0700131 unsigned long now);
Wei Wang35732d02017-10-06 12:05:57 -0700132
David Ahern93c2fb22018-04-18 15:38:59 -0700133static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
David Aherna2e2ff52016-06-16 16:24:24 -0700134 const struct in6_addr *daddr,
135 unsigned int prefs,
136 struct in6_addr *saddr)
137{
David Aherna2e2ff52016-06-16 16:24:24 -0700138 int err = 0;
139
David Ahern6fe74942018-04-18 15:39:03 -0700140 if (f6i && f6i->fib6_prefsrc.plen) {
David Ahern93c2fb22018-04-18 15:38:59 -0700141 *saddr = f6i->fib6_prefsrc.addr;
David Ahern6fe74942018-04-18 15:39:03 -0700142 } else {
143 struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
144
145 err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr);
146 }
David Aherna2e2ff52016-06-16 16:24:24 -0700147
148 return err;
149}
Daniel Walterc3968a82011-04-13 21:10:57 +0000150
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700151struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
David Ahernb75cc8f2018-03-02 08:32:17 -0800152 const struct in6_addr *saddr, int oif,
153 const struct sk_buff *skb, int flags);
David Ahernb4bac172018-03-02 08:32:18 -0800154u32 rt6_multipath_hash(const struct net *net, const struct flowi6 *fl6,
155 const struct sk_buff *skb, struct flow_keys *hkeys);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700157struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
YOSHIFUJI Hideaki3b009442007-12-06 16:11:48 -0800158
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700159void fib6_force_start_gc(struct net *net);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
David Ahern360a9882018-04-18 15:39:00 -0700161struct fib6_info *addrconf_f6i_alloc(struct net *net, struct inet6_dev *idev,
David Ahern8d1c8022018-04-17 17:33:26 -0700162 const struct in6_addr *addr, bool anycast,
163 gfp_t gfp_flags);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
David Ahern9ab179d2016-04-07 11:10:06 -0700165struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,
166 int flags);
167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168/*
169 * support functions for ND
170 *
171 */
David Ahern8d1c8022018-04-17 17:33:26 -0700172struct fib6_info *rt6_get_dflt_router(struct net *net,
David Ahernafb1d4b52018-04-17 17:33:11 -0700173 const struct in6_addr *addr,
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700174 struct net_device *dev);
David Ahern8d1c8022018-04-17 17:33:26 -0700175struct fib6_info *rt6_add_dflt_router(struct net *net,
David Ahernafb1d4b52018-04-17 17:33:11 -0700176 const struct in6_addr *gwaddr,
Praveen Chaudhary6b2e04b2021-01-25 13:44:30 -0800177 struct net_device *dev, unsigned int pref,
178 u32 defrtr_usr_metric);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700180void rt6_purge_dflt_routers(struct net *net);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700182int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
183 const struct in6_addr *gwaddr);
YOSHIFUJI Hideaki70ceb4f2006-03-20 17:06:24 -0800184
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700185void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, int oif,
Lorenzo Colittie2d118a2016-11-04 02:23:43 +0900186 u32 mark, kuid_t uid);
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700187void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu);
Lorenzo Colittie2d118a2016-11-04 02:23:43 +0900188void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark,
189 kuid_t uid);
Maciej Żenczykowskid4563362018-09-29 23:44:50 -0700190void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif);
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700191void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193struct netlink_callback;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
Eric Dumazetfd2c3ef2009-11-03 03:26:03 +0000195struct rt6_rtnl_dump_arg {
Patrick McHardy1b43af52006-08-10 23:11:17 -0700196 struct sk_buff *skb;
197 struct netlink_callback *cb;
Brian Haley191cd582008-08-14 15:33:21 -0700198 struct net *net;
David Ahern47246762018-10-15 18:56:42 -0700199 struct fib_dump_filter filter;
Patrick McHardy1b43af52006-08-10 23:11:17 -0700200};
201
Stefano Brivio1e47b482019-06-21 17:45:27 +0200202int rt6_dump_route(struct fib6_info *f6i, void *p_arg, unsigned int skip);
Joe Perches5c3a0fd2013-09-21 10:22:42 -0700203void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
204void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
Duan Jiongbe7a0102014-05-15 15:56:14 +0800205void rt6_clean_tohost(struct net *net, struct in6_addr *gateway);
David Ahernecc56632019-04-23 08:48:09 -0700206void rt6_sync_up(struct net_device *dev, unsigned char nh_flags);
Ido Schimmel4c981e22018-01-07 12:45:04 +0200207void rt6_disable_ip(struct net_device *dev, unsigned long event);
Ido Schimmel27c6fa72018-01-07 12:45:05 +0200208void rt6_sync_down_dev(struct net_device *dev, unsigned long event);
David Ahern93c2fb22018-04-18 15:38:59 -0700209void rt6_multipath_rebalance(struct fib6_info *f6i);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210
Xin Long510c3212018-02-14 19:06:02 +0800211void rt6_uncached_list_add(struct rt6_info *rt);
212void rt6_uncached_list_del(struct rt6_info *rt);
213
David Ahern1b70d7922017-08-28 13:53:34 -0700214static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb)
215{
216 const struct dst_entry *dst = skb_dst(skb);
217 const struct rt6_info *rt6 = NULL;
218
219 if (dst)
220 rt6 = container_of(dst, struct rt6_info, dst);
221
222 return rt6;
223}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
225/*
226 * Store a destination cache entry in a socket
227 */
Eric Dumazet6bd4f352015-12-02 21:53:57 -0800228static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
229 const struct in6_addr *daddr,
230 const struct in6_addr *saddr)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231{
232 struct ipv6_pinfo *np = inet6_sk(sk);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
Eric Dumazet6bd4f352015-12-02 21:53:57 -0800234 np->dst_cookie = rt6_get_cookie((struct rt6_info *)dst);
Herbert Xuf83ef8c2006-06-30 13:37:03 -0700235 sk_setup_caps(sk, dst);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 np->daddr_cache = daddr;
YOSHIFUJI Hideaki8e1ef0a2006-08-29 17:15:09 -0700237#ifdef CONFIG_IPV6_SUBTREES
238 np->saddr_cache = saddr;
239#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240}
241
Alexey Kodanev7d6850f2018-04-03 15:00:07 +0300242void ip6_sk_dst_store_flow(struct sock *sk, struct dst_entry *dst,
243 const struct flowi6 *fl6);
244
Eric Dumazeta50feda2012-05-18 18:57:34 +0000245static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246{
Eric Dumazetadf30902009-06-02 05:19:30 +0000247 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248
249 return rt->rt6i_flags & RTF_LOCAL;
250}
251
Martin KaFai Lau2647a9b2015-05-22 20:55:58 -0700252static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
253 const struct in6_addr *daddr)
FX Le Bail509aba32014-01-07 14:57:27 +0100254{
Martin KaFai Lau2647a9b2015-05-22 20:55:58 -0700255 struct rt6_info *rt = (struct rt6_info *)dst;
FX Le Bail509aba32014-01-07 14:57:27 +0100256
Martin KaFai Lau2647a9b2015-05-22 20:55:58 -0700257 return rt->rt6i_flags & RTF_ANYCAST ||
Vincent Bernatccdb2d12017-07-15 19:40:20 +0200258 (rt->rt6i_dst.plen < 127 &&
Tim Stallard03e2a982020-04-03 21:26:21 +0100259 !(rt->rt6i_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) &&
Martin KaFai Lau2647a9b2015-05-22 20:55:58 -0700260 ipv6_addr_equal(&rt->rt6i_dst.addr, daddr));
FX Le Bail509aba32014-01-07 14:57:27 +0100261}
262
Eric W. Biederman7d8c6e32015-06-12 22:12:04 -0500263int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
264 int (*output)(struct net *, struct sock *, struct sk_buff *));
David Stevensad0081e2010-12-17 11:42:42 +0000265
Vadim Fedorenko40fc3052021-07-02 02:47:00 +0300266static inline unsigned int ip6_skb_dst_mtu(struct sk_buff *skb)
David Stevensad0081e2010-12-17 11:42:42 +0000267{
Vadim Fedorenkofade5642021-06-25 19:21:39 +0300268 int mtu;
269
hannes@stressinduktion.orgf60e5992015-04-01 17:07:44 +0200270 struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
271 inet6_sk(skb->sk) : NULL;
David Stevensad0081e2010-12-17 11:42:42 +0000272
Vadim Fedorenkofade5642021-06-25 19:21:39 +0300273 if (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) {
274 mtu = READ_ONCE(skb_dst(skb)->dev->mtu);
275 mtu -= lwtunnel_headroom(skb_dst(skb)->lwtstate, mtu);
276 } else
277 mtu = dst_mtu(skb_dst(skb));
278
279 return mtu;
David Stevensad0081e2010-12-17 11:42:42 +0000280}
281
Hannes Frederic Sowa93b36cf2013-12-15 03:41:14 +0100282static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
283{
Hannes Frederic Sowa0b952272014-02-26 01:20:43 +0100284 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE &&
285 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
286}
287
WANG Cong60ff7462014-05-04 16:39:18 -0700288static inline bool ip6_sk_ignore_df(const struct sock *sk)
Hannes Frederic Sowa0b952272014-02-26 01:20:43 +0100289{
290 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
291 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
Hannes Frederic Sowa93b36cf2013-12-15 03:41:14 +0100292}
293
Nicolas Dichtel9b1c1ef2019-06-24 16:01:08 +0200294static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
295 const struct in6_addr *daddr)
YOSHIFUJI Hideaki / 吉藤英明9bb5a142013-01-17 12:53:48 +0000296{
Martin KaFai Lau2647a9b2015-05-22 20:55:58 -0700297 if (rt->rt6i_flags & RTF_GATEWAY)
298 return &rt->rt6i_gateway;
Martin KaFai Lau45e4fd22015-05-22 20:56:00 -0700299 else if (unlikely(rt->rt6i_flags & RTF_CACHE))
Martin KaFai Lau2647a9b2015-05-22 20:55:58 -0700300 return &rt->rt6i_dst.addr;
301 else
302 return daddr;
YOSHIFUJI Hideaki / 吉藤英明9bb5a142013-01-17 12:53:48 +0000303}
304
David Ahern8d1c8022018-04-17 17:33:26 -0700305static inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *b)
David Ahernf06b7542017-07-05 14:41:46 -0600306{
David Ahernf88d8ea2019-06-03 20:19:52 -0700307 struct fib6_nh *nha, *nhb;
David Ahernad1601a2019-03-27 20:53:56 -0700308
David Ahernf88d8ea2019-06-03 20:19:52 -0700309 if (a->nh || b->nh)
310 return nexthop_cmp(a->nh, b->nh);
311
312 nha = a->fib6_nh;
313 nhb = b->fib6_nh;
David Ahernad1601a2019-03-27 20:53:56 -0700314 return nha->fib_nh_dev == nhb->fib_nh_dev &&
315 ipv6_addr_equal(&nha->fib_nh_gw6, &nhb->fib_nh_gw6) &&
316 !lwtunnel_cmp_encap(nha->fib_nh_lws, nhb->fib_nh_lws);
David Ahernf06b7542017-07-05 14:41:46 -0600317}
Roopa Prabhu5e5d6fe2018-02-28 22:43:22 -0500318
Felix Fietkau07cb9622018-02-26 10:15:10 +0100319static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
320{
321 struct inet6_dev *idev;
322 unsigned int mtu;
323
324 if (dst_metric_locked(dst, RTAX_MTU)) {
325 mtu = dst_metric_raw(dst, RTAX_MTU);
326 if (mtu)
Vadim Fedorenkofade5642021-06-25 19:21:39 +0300327 goto out;
Felix Fietkau07cb9622018-02-26 10:15:10 +0100328 }
329
330 mtu = IPV6_MIN_MTU;
331 rcu_read_lock();
332 idev = __in6_dev_get(dst->dev);
333 if (idev)
334 mtu = idev->cnf.mtu6;
335 rcu_read_unlock();
336
Vadim Fedorenkofade5642021-06-25 19:21:39 +0300337out:
338 return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
Felix Fietkau07cb9622018-02-26 10:15:10 +0100339}
340
David Ahernb748f262019-04-16 14:36:06 -0700341u32 ip6_mtu_from_fib6(const struct fib6_result *res,
342 const struct in6_addr *daddr,
343 const struct in6_addr *saddr);
David Ahern901731b2018-05-21 09:08:14 -0700344
David Ahernf8a1b432018-04-17 17:33:21 -0700345struct neighbour *ip6_neigh_lookup(const struct in6_addr *gw,
346 struct net_device *dev, struct sk_buff *skb,
347 const void *daddr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348#endif