xref: /openbmc/linux/include/net/ip6_route.h (revision f88d8ea67fbdbac7a64bfa6ed9a2ba27bb822f74)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds #ifndef _NET_IP6_ROUTE_H
31da177e4SLinus Torvalds #define _NET_IP6_ROUTE_H
41da177e4SLinus Torvalds 
570ceb4f5SYOSHIFUJI Hideaki struct route_info {
670ceb4f5SYOSHIFUJI Hideaki 	__u8			type;
770ceb4f5SYOSHIFUJI Hideaki 	__u8			length;
870ceb4f5SYOSHIFUJI Hideaki 	__u8			prefix_len;
970ceb4f5SYOSHIFUJI Hideaki #if defined(__BIG_ENDIAN_BITFIELD)
1070ceb4f5SYOSHIFUJI Hideaki 	__u8			reserved_h:3,
1170ceb4f5SYOSHIFUJI Hideaki 				route_pref:2,
1270ceb4f5SYOSHIFUJI Hideaki 				reserved_l:3;
1370ceb4f5SYOSHIFUJI Hideaki #elif defined(__LITTLE_ENDIAN_BITFIELD)
1470ceb4f5SYOSHIFUJI Hideaki 	__u8			reserved_l:3,
1570ceb4f5SYOSHIFUJI Hideaki 				route_pref:2,
1670ceb4f5SYOSHIFUJI Hideaki 				reserved_h:3;
1770ceb4f5SYOSHIFUJI Hideaki #endif
18e69a4adcSAl Viro 	__be32			lifetime;
1970ceb4f5SYOSHIFUJI Hideaki 	__u8			prefix[0];	/* 0,8 or 16 */
2070ceb4f5SYOSHIFUJI Hideaki };
2170ceb4f5SYOSHIFUJI Hideaki 
22a2e2ff56SDavid Ahern #include <net/addrconf.h>
231da177e4SLinus Torvalds #include <net/flow.h>
241da177e4SLinus Torvalds #include <net/ip6_fib.h>
251da177e4SLinus Torvalds #include <net/sock.h>
26f06b7549SDavid Ahern #include <net/lwtunnel.h>
271da177e4SLinus Torvalds #include <linux/ip.h>
281da177e4SLinus Torvalds #include <linux/ipv6.h>
299bb5a148SYOSHIFUJI Hideaki / 吉藤英明 #include <linux/route.h>
30*f88d8ea6SDavid Ahern #include <net/nexthop.h>
311da177e4SLinus Torvalds 
327cbca67cSYOSHIFUJI Hideaki #define RT6_LOOKUP_F_IFACE		0x00000001
337cbca67cSYOSHIFUJI Hideaki #define RT6_LOOKUP_F_REACHABLE		0x00000002
347cbca67cSYOSHIFUJI Hideaki #define RT6_LOOKUP_F_HAS_SADDR		0x00000004
357cbca67cSYOSHIFUJI Hideaki #define RT6_LOOKUP_F_SRCPREF_TMP	0x00000008
367cbca67cSYOSHIFUJI Hideaki #define RT6_LOOKUP_F_SRCPREF_PUBLIC	0x00000010
377cbca67cSYOSHIFUJI Hideaki #define RT6_LOOKUP_F_SRCPREF_COA	0x00000020
38d5d32e4bSDavid Ahern #define RT6_LOOKUP_F_IGNORE_LINKSTATE	0x00000040
3977d16f45SYOSHIFUJI Hideaki 
4030f78d8eSEric Dumazet /* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
4130f78d8eSEric Dumazet  * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
4230f78d8eSEric Dumazet  */
4330f78d8eSEric Dumazet #define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
4430f78d8eSEric Dumazet 
450c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 /*
460c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
470c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  * between IPV6_ADDR_PREFERENCES socket option values
480c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  *	IPV6_PREFER_SRC_TMP    = 0x1
490c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  *	IPV6_PREFER_SRC_PUBLIC = 0x2
500c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  *	IPV6_PREFER_SRC_COA    = 0x4
510c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  * and above RT6_LOOKUP_F_SRCPREF_xxx flags.
520c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明  */
530c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 static inline int rt6_srcprefs2flags(unsigned int srcprefs)
540c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 {
550c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 	/* No need to bitmask because srcprefs have only 3 bits. */
560c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 	return srcprefs << 3;
570c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 }
580c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 
590c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 static inline unsigned int rt6_flags2srcprefs(int flags)
600c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 {
610c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 	return (flags >> 3) & 7;
620c9a2ac1SYOSHIFUJI Hideaki / 吉藤英明 }
631da177e4SLinus Torvalds 
6460ea37f7SWang Yufen static inline bool rt6_need_strict(const struct in6_addr *daddr)
6560ea37f7SWang Yufen {
6660ea37f7SWang Yufen 	return ipv6_addr_type(daddr) &
6760ea37f7SWang Yufen 		(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
6860ea37f7SWang Yufen }
69fbfe95a4SDavid S. Miller 
70*f88d8ea6SDavid Ahern /* fib entries using a nexthop object can not be coalesced into
71*f88d8ea6SDavid Ahern  * a multipath route
72*f88d8ea6SDavid Ahern  */
7333bd5ac5SDavid Ahern static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i)
7433bd5ac5SDavid Ahern {
75be659b8dSDavid Ahern 	/* the RTF_ADDRCONF flag filters out RA's */
76*f88d8ea6SDavid Ahern 	return !(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh &&
771cf844c7SDavid Ahern 		f6i->fib6_nh->fib_nh_gw_family;
7833bd5ac5SDavid Ahern }
7933bd5ac5SDavid Ahern 
805c3a0fd7SJoe Perches void ip6_route_input(struct sk_buff *skb);
81d409b847SMahesh Bandewar struct dst_entry *ip6_route_input_lookup(struct net *net,
82d409b847SMahesh Bandewar 					 struct net_device *dev,
83b75cc8f9SDavid Ahern 					 struct flowi6 *fl6,
84b75cc8f9SDavid Ahern 					 const struct sk_buff *skb, int flags);
851da177e4SLinus Torvalds 
866f21c96aSPaolo Abeni struct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk,
876f21c96aSPaolo Abeni 					 struct flowi6 *fl6, int flags);
886f21c96aSPaolo Abeni 
896f21c96aSPaolo Abeni static inline struct dst_entry *ip6_route_output(struct net *net,
906f21c96aSPaolo Abeni 						 const struct sock *sk,
916f21c96aSPaolo Abeni 						 struct flowi6 *fl6)
926f21c96aSPaolo Abeni {
936f21c96aSPaolo Abeni 	return ip6_route_output_flags(net, sk, fl6, 0);
946f21c96aSPaolo Abeni }
956f21c96aSPaolo Abeni 
965c3a0fd7SJoe Perches struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
97b75cc8f9SDavid Ahern 				   const struct sk_buff *skb, int flags);
989ff74384SDavid Ahern struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
99b75cc8f9SDavid Ahern 			       int ifindex, struct flowi6 *fl6,
100b75cc8f9SDavid Ahern 			       const struct sk_buff *skb, int flags);
1011da177e4SLinus Torvalds 
1022f460933SWANG Cong void ip6_route_init_special_entries(void);
1035c3a0fd7SJoe Perches int ip6_route_init(void);
1045c3a0fd7SJoe Perches void ip6_route_cleanup(void);
1051da177e4SLinus Torvalds 
1065c3a0fd7SJoe Perches int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg);
1071da177e4SLinus Torvalds 
108acb54e3cSDavid Ahern int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
109acb54e3cSDavid Ahern 		  struct netlink_ext_ack *extack);
11093c2fb25SDavid Ahern int ip6_ins_rt(struct net *net, struct fib6_info *f6i);
11193c2fb25SDavid Ahern int ip6_del_rt(struct net *net, struct fib6_info *f6i);
1121da177e4SLinus Torvalds 
11393c2fb25SDavid Ahern void rt6_flush_exceptions(struct fib6_info *f6i);
11493c2fb25SDavid Ahern void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
115c757faa8SWei Wang 			unsigned long now);
11635732d01SWei Wang 
11793c2fb25SDavid Ahern static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
118a2e2ff56SDavid Ahern 				      const struct in6_addr *daddr,
119a2e2ff56SDavid Ahern 				      unsigned int prefs,
120a2e2ff56SDavid Ahern 				      struct in6_addr *saddr)
121a2e2ff56SDavid Ahern {
122a2e2ff56SDavid Ahern 	int err = 0;
123a2e2ff56SDavid Ahern 
1246fe74941SDavid Ahern 	if (f6i && f6i->fib6_prefsrc.plen) {
12593c2fb25SDavid Ahern 		*saddr = f6i->fib6_prefsrc.addr;
1266fe74941SDavid Ahern 	} else {
1276fe74941SDavid Ahern 		struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
1286fe74941SDavid Ahern 
1296fe74941SDavid Ahern 		err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr);
1306fe74941SDavid Ahern 	}
131a2e2ff56SDavid Ahern 
132a2e2ff56SDavid Ahern 	return err;
133a2e2ff56SDavid Ahern }
134c3968a85SDaniel Walter 
1355c3a0fd7SJoe Perches struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
136b75cc8f9SDavid Ahern 			    const struct in6_addr *saddr, int oif,
137b75cc8f9SDavid Ahern 			    const struct sk_buff *skb, int flags);
138b4bac172SDavid Ahern u32 rt6_multipath_hash(const struct net *net, const struct flowi6 *fl6,
139b4bac172SDavid Ahern 		       const struct sk_buff *skb, struct flow_keys *hkeys);
1401da177e4SLinus Torvalds 
1415c3a0fd7SJoe Perches struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
1423b00944cSYOSHIFUJI Hideaki 
1435c3a0fd7SJoe Perches void fib6_force_start_gc(struct net *net);
1441da177e4SLinus Torvalds 
145360a9887SDavid Ahern struct fib6_info *addrconf_f6i_alloc(struct net *net, struct inet6_dev *idev,
146acb54e3cSDavid Ahern 				     const struct in6_addr *addr, bool anycast,
147acb54e3cSDavid Ahern 				     gfp_t gfp_flags);
1481da177e4SLinus Torvalds 
1499ab179d8SDavid Ahern struct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,
1509ab179d8SDavid Ahern 			       int flags);
1519ab179d8SDavid Ahern 
1521da177e4SLinus Torvalds /*
1531da177e4SLinus Torvalds  *	support functions for ND
1541da177e4SLinus Torvalds  *
1551da177e4SLinus Torvalds  */
1568d1c802bSDavid Ahern struct fib6_info *rt6_get_dflt_router(struct net *net,
157afb1d4b5SDavid Ahern 				     const struct in6_addr *addr,
1581da177e4SLinus Torvalds 				     struct net_device *dev);
1598d1c802bSDavid Ahern struct fib6_info *rt6_add_dflt_router(struct net *net,
160afb1d4b5SDavid Ahern 				     const struct in6_addr *gwaddr,
1615c3a0fd7SJoe Perches 				     struct net_device *dev, unsigned int pref);
1621da177e4SLinus Torvalds 
1635c3a0fd7SJoe Perches void rt6_purge_dflt_routers(struct net *net);
1641da177e4SLinus Torvalds 
1655c3a0fd7SJoe Perches int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
166b71d1d42SEric Dumazet 		  const struct in6_addr *gwaddr);
16770ceb4f5SYOSHIFUJI Hideaki 
1685c3a0fd7SJoe Perches void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, int oif,
169e2d118a1SLorenzo Colitti 		     u32 mark, kuid_t uid);
1705c3a0fd7SJoe Perches void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu);
171e2d118a1SLorenzo Colitti void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark,
172e2d118a1SLorenzo Colitti 		  kuid_t uid);
173d456336dSMaciej Żenczykowski void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif);
1745c3a0fd7SJoe Perches void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
1751da177e4SLinus Torvalds 
1761da177e4SLinus Torvalds struct netlink_callback;
1771da177e4SLinus Torvalds 
178fd2c3ef7SEric Dumazet struct rt6_rtnl_dump_arg {
1791b43af54SPatrick McHardy 	struct sk_buff *skb;
1801b43af54SPatrick McHardy 	struct netlink_callback *cb;
181191cd582SBrian Haley 	struct net *net;
1824724676dSDavid Ahern 	struct fib_dump_filter filter;
1831b43af54SPatrick McHardy };
1841b43af54SPatrick McHardy 
18593c2fb25SDavid Ahern int rt6_dump_route(struct fib6_info *f6i, void *p_arg);
1865c3a0fd7SJoe Perches void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
1875c3a0fd7SJoe Perches void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
188be7a010dSDuan Jiong void rt6_clean_tohost(struct net *net, struct in6_addr *gateway);
189ecc5663cSDavid Ahern void rt6_sync_up(struct net_device *dev, unsigned char nh_flags);
1904c981e28SIdo Schimmel void rt6_disable_ip(struct net_device *dev, unsigned long event);
19127c6fa73SIdo Schimmel void rt6_sync_down_dev(struct net_device *dev, unsigned long event);
19293c2fb25SDavid Ahern void rt6_multipath_rebalance(struct fib6_info *f6i);
1931da177e4SLinus Torvalds 
194510c321bSXin Long void rt6_uncached_list_add(struct rt6_info *rt);
195510c321bSXin Long void rt6_uncached_list_del(struct rt6_info *rt);
196510c321bSXin Long 
1971b70d792SDavid Ahern static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb)
1981b70d792SDavid Ahern {
1991b70d792SDavid Ahern 	const struct dst_entry *dst = skb_dst(skb);
2001b70d792SDavid Ahern 	const struct rt6_info *rt6 = NULL;
2011b70d792SDavid Ahern 
2021b70d792SDavid Ahern 	if (dst)
2031b70d792SDavid Ahern 		rt6 = container_of(dst, struct rt6_info, dst);
2041b70d792SDavid Ahern 
2051b70d792SDavid Ahern 	return rt6;
2061b70d792SDavid Ahern }
2071da177e4SLinus Torvalds 
2081da177e4SLinus Torvalds /*
2091da177e4SLinus Torvalds  *	Store a destination cache entry in a socket
2101da177e4SLinus Torvalds  */
2116bd4f355SEric Dumazet static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
212d3818c92SEric Dumazet 				 const struct in6_addr *daddr,
213d3818c92SEric Dumazet 				 const struct in6_addr *saddr)
2141da177e4SLinus Torvalds {
2151da177e4SLinus Torvalds 	struct ipv6_pinfo *np = inet6_sk(sk);
2161da177e4SLinus Torvalds 
2176bd4f355SEric Dumazet 	np->dst_cookie = rt6_get_cookie((struct rt6_info *)dst);
218f83ef8c0SHerbert Xu 	sk_setup_caps(sk, dst);
2191da177e4SLinus Torvalds 	np->daddr_cache = daddr;
2208e1ef0a9SYOSHIFUJI Hideaki #ifdef CONFIG_IPV6_SUBTREES
2218e1ef0a9SYOSHIFUJI Hideaki 	np->saddr_cache = saddr;
2228e1ef0a9SYOSHIFUJI Hideaki #endif
2231da177e4SLinus Torvalds }
2241da177e4SLinus Torvalds 
2257d6850f7SAlexey Kodanev void ip6_sk_dst_store_flow(struct sock *sk, struct dst_entry *dst,
2267d6850f7SAlexey Kodanev 			   const struct flowi6 *fl6);
2277d6850f7SAlexey Kodanev 
228a50feda5SEric Dumazet static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
2291da177e4SLinus Torvalds {
230adf30907SEric Dumazet 	struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
2311da177e4SLinus Torvalds 
2321da177e4SLinus Torvalds 	return rt->rt6i_flags & RTF_LOCAL;
2331da177e4SLinus Torvalds }
2341da177e4SLinus Torvalds 
2352647a9b0SMartin KaFai Lau static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
2362647a9b0SMartin KaFai Lau 					    const struct in6_addr *daddr)
237509aba3bSFX Le Bail {
2382647a9b0SMartin KaFai Lau 	struct rt6_info *rt = (struct rt6_info *)dst;
239509aba3bSFX Le Bail 
2402647a9b0SMartin KaFai Lau 	return rt->rt6i_flags & RTF_ANYCAST ||
241ccdb2d17SVincent Bernat 		(rt->rt6i_dst.plen < 127 &&
2422647a9b0SMartin KaFai Lau 		 ipv6_addr_equal(&rt->rt6i_dst.addr, daddr));
243509aba3bSFX Le Bail }
244509aba3bSFX Le Bail 
2457d8c6e39SEric W. Biederman int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
2467d8c6e39SEric W. Biederman 		 int (*output)(struct net *, struct sock *, struct sk_buff *));
247ad0081e4SDavid Stevens 
248ad0081e4SDavid Stevens static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
249ad0081e4SDavid Stevens {
250f60e5990Shannes@stressinduktion.org 	struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
251f60e5990Shannes@stressinduktion.org 				inet6_sk(skb->sk) : NULL;
252ad0081e4SDavid Stevens 
25393b36cf3SHannes Frederic Sowa 	return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ?
254ad0081e4SDavid Stevens 	       skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
255ad0081e4SDavid Stevens }
256ad0081e4SDavid Stevens 
25793b36cf3SHannes Frederic Sowa static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
25893b36cf3SHannes Frederic Sowa {
2590b95227aSHannes Frederic Sowa 	return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE &&
2600b95227aSHannes Frederic Sowa 	       inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
2610b95227aSHannes Frederic Sowa }
2620b95227aSHannes Frederic Sowa 
26360ff7467SWANG Cong static inline bool ip6_sk_ignore_df(const struct sock *sk)
2640b95227aSHannes Frederic Sowa {
2650b95227aSHannes Frederic Sowa 	return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
2660b95227aSHannes Frederic Sowa 	       inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
26793b36cf3SHannes Frederic Sowa }
26893b36cf3SHannes Frederic Sowa 
2692647a9b0SMartin KaFai Lau static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
2702647a9b0SMartin KaFai Lau 					   struct in6_addr *daddr)
2719bb5a148SYOSHIFUJI Hideaki / 吉藤英明 {
2722647a9b0SMartin KaFai Lau 	if (rt->rt6i_flags & RTF_GATEWAY)
2739bb5a148SYOSHIFUJI Hideaki / 吉藤英明 		return &rt->rt6i_gateway;
27445e4fd26SMartin KaFai Lau 	else if (unlikely(rt->rt6i_flags & RTF_CACHE))
2752647a9b0SMartin KaFai Lau 		return &rt->rt6i_dst.addr;
2762647a9b0SMartin KaFai Lau 	else
2772647a9b0SMartin KaFai Lau 		return daddr;
2789bb5a148SYOSHIFUJI Hideaki / 吉藤英明 }
2799bb5a148SYOSHIFUJI Hideaki / 吉藤英明 
2808d1c802bSDavid Ahern static inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *b)
281f06b7549SDavid Ahern {
282*f88d8ea6SDavid Ahern 	struct fib6_nh *nha, *nhb;
283ad1601aeSDavid Ahern 
284*f88d8ea6SDavid Ahern 	if (a->nh || b->nh)
285*f88d8ea6SDavid Ahern 		return nexthop_cmp(a->nh, b->nh);
286*f88d8ea6SDavid Ahern 
287*f88d8ea6SDavid Ahern 	nha = a->fib6_nh;
288*f88d8ea6SDavid Ahern 	nhb = b->fib6_nh;
289ad1601aeSDavid Ahern 	return nha->fib_nh_dev == nhb->fib_nh_dev &&
290ad1601aeSDavid Ahern 	       ipv6_addr_equal(&nha->fib_nh_gw6, &nhb->fib_nh_gw6) &&
291ad1601aeSDavid Ahern 	       !lwtunnel_cmp_encap(nha->fib_nh_lws, nhb->fib_nh_lws);
292f06b7549SDavid Ahern }
2935e5d6fedSRoopa Prabhu 
29407cb9623SFelix Fietkau static inline unsigned int ip6_dst_mtu_forward(const struct dst_entry *dst)
29507cb9623SFelix Fietkau {
29607cb9623SFelix Fietkau 	struct inet6_dev *idev;
29707cb9623SFelix Fietkau 	unsigned int mtu;
29807cb9623SFelix Fietkau 
29907cb9623SFelix Fietkau 	if (dst_metric_locked(dst, RTAX_MTU)) {
30007cb9623SFelix Fietkau 		mtu = dst_metric_raw(dst, RTAX_MTU);
30107cb9623SFelix Fietkau 		if (mtu)
30207cb9623SFelix Fietkau 			return mtu;
30307cb9623SFelix Fietkau 	}
30407cb9623SFelix Fietkau 
30507cb9623SFelix Fietkau 	mtu = IPV6_MIN_MTU;
30607cb9623SFelix Fietkau 	rcu_read_lock();
30707cb9623SFelix Fietkau 	idev = __in6_dev_get(dst->dev);
30807cb9623SFelix Fietkau 	if (idev)
30907cb9623SFelix Fietkau 		mtu = idev->cnf.mtu6;
31007cb9623SFelix Fietkau 	rcu_read_unlock();
31107cb9623SFelix Fietkau 
31207cb9623SFelix Fietkau 	return mtu;
31307cb9623SFelix Fietkau }
31407cb9623SFelix Fietkau 
315b748f260SDavid Ahern u32 ip6_mtu_from_fib6(const struct fib6_result *res,
316b748f260SDavid Ahern 		      const struct in6_addr *daddr,
317b748f260SDavid Ahern 		      const struct in6_addr *saddr);
318901731b8SDavid Ahern 
319f8a1b43bSDavid Ahern struct neighbour *ip6_neigh_lookup(const struct in6_addr *gw,
320f8a1b43bSDavid Ahern 				   struct net_device *dev, struct sk_buff *skb,
321f8a1b43bSDavid Ahern 				   const void *daddr);
3221da177e4SLinus Torvalds #endif
323