162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _NET_IP6_ROUTE_H
362306a36Sopenharmony_ci#define _NET_IP6_ROUTE_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <net/addrconf.h>
662306a36Sopenharmony_ci#include <net/flow.h>
762306a36Sopenharmony_ci#include <net/ip6_fib.h>
862306a36Sopenharmony_ci#include <net/sock.h>
962306a36Sopenharmony_ci#include <net/lwtunnel.h>
1062306a36Sopenharmony_ci#include <linux/ip.h>
1162306a36Sopenharmony_ci#include <linux/ipv6.h>
1262306a36Sopenharmony_ci#include <linux/route.h>
1362306a36Sopenharmony_ci#include <net/nexthop.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cistruct route_info {
1662306a36Sopenharmony_ci	__u8			type;
1762306a36Sopenharmony_ci	__u8			length;
1862306a36Sopenharmony_ci	__u8			prefix_len;
1962306a36Sopenharmony_ci#if defined(__BIG_ENDIAN_BITFIELD)
2062306a36Sopenharmony_ci	__u8			reserved_h:3,
2162306a36Sopenharmony_ci				route_pref:2,
2262306a36Sopenharmony_ci				reserved_l:3;
2362306a36Sopenharmony_ci#elif defined(__LITTLE_ENDIAN_BITFIELD)
2462306a36Sopenharmony_ci	__u8			reserved_l:3,
2562306a36Sopenharmony_ci				route_pref:2,
2662306a36Sopenharmony_ci				reserved_h:3;
2762306a36Sopenharmony_ci#endif
2862306a36Sopenharmony_ci	__be32			lifetime;
2962306a36Sopenharmony_ci	__u8			prefix[];	/* 0,8 or 16 */
3062306a36Sopenharmony_ci};
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define RT6_LOOKUP_F_IFACE		0x00000001
3362306a36Sopenharmony_ci#define RT6_LOOKUP_F_REACHABLE		0x00000002
3462306a36Sopenharmony_ci#define RT6_LOOKUP_F_HAS_SADDR		0x00000004
3562306a36Sopenharmony_ci#define RT6_LOOKUP_F_SRCPREF_TMP	0x00000008
3662306a36Sopenharmony_ci#define RT6_LOOKUP_F_SRCPREF_PUBLIC	0x00000010
3762306a36Sopenharmony_ci#define RT6_LOOKUP_F_SRCPREF_COA	0x00000020
3862306a36Sopenharmony_ci#define RT6_LOOKUP_F_IGNORE_LINKSTATE	0x00000040
3962306a36Sopenharmony_ci#define RT6_LOOKUP_F_DST_NOREF		0x00000080
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* We do not (yet ?) support IPv6 jumbograms (RFC 2675)
4262306a36Sopenharmony_ci * Unlike IPv4, hdr->seg_len doesn't include the IPv6 header
4362306a36Sopenharmony_ci */
4462306a36Sopenharmony_ci#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr))
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/*
4762306a36Sopenharmony_ci * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate
4862306a36Sopenharmony_ci * between IPV6_ADDR_PREFERENCES socket option values
4962306a36Sopenharmony_ci *	IPV6_PREFER_SRC_TMP    = 0x1
5062306a36Sopenharmony_ci *	IPV6_PREFER_SRC_PUBLIC = 0x2
5162306a36Sopenharmony_ci *	IPV6_PREFER_SRC_COA    = 0x4
5262306a36Sopenharmony_ci * and above RT6_LOOKUP_F_SRCPREF_xxx flags.
5362306a36Sopenharmony_ci */
5462306a36Sopenharmony_cistatic inline int rt6_srcprefs2flags(unsigned int srcprefs)
5562306a36Sopenharmony_ci{
5662306a36Sopenharmony_ci	/* No need to bitmask because srcprefs have only 3 bits. */
5762306a36Sopenharmony_ci	return srcprefs << 3;
5862306a36Sopenharmony_ci}
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_cistatic inline unsigned int rt6_flags2srcprefs(int flags)
6162306a36Sopenharmony_ci{
6262306a36Sopenharmony_ci	return (flags >> 3) & 7;
6362306a36Sopenharmony_ci}
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_cistatic inline bool rt6_need_strict(const struct in6_addr *daddr)
6662306a36Sopenharmony_ci{
6762306a36Sopenharmony_ci	return ipv6_addr_type(daddr) &
6862306a36Sopenharmony_ci		(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
6962306a36Sopenharmony_ci}
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* fib entries using a nexthop object can not be coalesced into
7262306a36Sopenharmony_ci * a multipath route
7362306a36Sopenharmony_ci */
7462306a36Sopenharmony_cistatic inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i)
7562306a36Sopenharmony_ci{
7662306a36Sopenharmony_ci	/* the RTF_ADDRCONF flag filters out RA's */
7762306a36Sopenharmony_ci	return !(f6i->fib6_flags & RTF_ADDRCONF) && !f6i->nh &&
7862306a36Sopenharmony_ci		f6i->fib6_nh->fib_nh_gw_family;
7962306a36Sopenharmony_ci}
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_civoid ip6_route_input(struct sk_buff *skb);
8262306a36Sopenharmony_cistruct dst_entry *ip6_route_input_lookup(struct net *net,
8362306a36Sopenharmony_ci					 struct net_device *dev,
8462306a36Sopenharmony_ci					 struct flowi6 *fl6,
8562306a36Sopenharmony_ci					 const struct sk_buff *skb, int flags);
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_cistruct dst_entry *ip6_route_output_flags(struct net *net, const struct sock *sk,
8862306a36Sopenharmony_ci					 struct flowi6 *fl6, int flags);
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_cistatic inline struct dst_entry *ip6_route_output(struct net *net,
9162306a36Sopenharmony_ci						 const struct sock *sk,
9262306a36Sopenharmony_ci						 struct flowi6 *fl6)
9362306a36Sopenharmony_ci{
9462306a36Sopenharmony_ci	return ip6_route_output_flags(net, sk, fl6, 0);
9562306a36Sopenharmony_ci}
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* Only conditionally release dst if flags indicates
9862306a36Sopenharmony_ci * !RT6_LOOKUP_F_DST_NOREF or dst is in uncached_list.
9962306a36Sopenharmony_ci */
10062306a36Sopenharmony_cistatic inline void ip6_rt_put_flags(struct rt6_info *rt, int flags)
10162306a36Sopenharmony_ci{
10262306a36Sopenharmony_ci	if (!(flags & RT6_LOOKUP_F_DST_NOREF) ||
10362306a36Sopenharmony_ci	    !list_empty(&rt->dst.rt_uncached))
10462306a36Sopenharmony_ci		ip6_rt_put(rt);
10562306a36Sopenharmony_ci}
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_cistruct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
10862306a36Sopenharmony_ci				   const struct sk_buff *skb, int flags);
10962306a36Sopenharmony_cistruct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
11062306a36Sopenharmony_ci			       int ifindex, struct flowi6 *fl6,
11162306a36Sopenharmony_ci			       const struct sk_buff *skb, int flags);
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_civoid ip6_route_init_special_entries(void);
11462306a36Sopenharmony_ciint ip6_route_init(void);
11562306a36Sopenharmony_civoid ip6_route_cleanup(void);
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ciint ipv6_route_ioctl(struct net *net, unsigned int cmd,
11862306a36Sopenharmony_ci		struct in6_rtmsg *rtmsg);
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ciint ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
12162306a36Sopenharmony_ci		  struct netlink_ext_ack *extack);
12262306a36Sopenharmony_ciint ip6_ins_rt(struct net *net, struct fib6_info *f6i);
12362306a36Sopenharmony_ciint ip6_del_rt(struct net *net, struct fib6_info *f6i, bool skip_notify);
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_civoid rt6_flush_exceptions(struct fib6_info *f6i);
12662306a36Sopenharmony_civoid rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
12762306a36Sopenharmony_ci			unsigned long now);
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_cistatic inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i,
13062306a36Sopenharmony_ci				      const struct in6_addr *daddr,
13162306a36Sopenharmony_ci				      unsigned int prefs,
13262306a36Sopenharmony_ci				      struct in6_addr *saddr)
13362306a36Sopenharmony_ci{
13462306a36Sopenharmony_ci	int err = 0;
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci	if (f6i && f6i->fib6_prefsrc.plen) {
13762306a36Sopenharmony_ci		*saddr = f6i->fib6_prefsrc.addr;
13862306a36Sopenharmony_ci	} else {
13962306a36Sopenharmony_ci		struct net_device *dev = f6i ? fib6_info_nh_dev(f6i) : NULL;
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci		err = ipv6_dev_get_saddr(net, dev, daddr, prefs, saddr);
14262306a36Sopenharmony_ci	}
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci	return err;
14562306a36Sopenharmony_ci}
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_cistruct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
14862306a36Sopenharmony_ci			    const struct in6_addr *saddr, int oif,
14962306a36Sopenharmony_ci			    const struct sk_buff *skb, int flags);
15062306a36Sopenharmony_ciu32 rt6_multipath_hash(const struct net *net, const struct flowi6 *fl6,
15162306a36Sopenharmony_ci		       const struct sk_buff *skb, struct flow_keys *hkeys);
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_cistruct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_civoid fib6_force_start_gc(struct net *net);
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_cistruct fib6_info *addrconf_f6i_alloc(struct net *net, struct inet6_dev *idev,
15862306a36Sopenharmony_ci				     const struct in6_addr *addr, bool anycast,
15962306a36Sopenharmony_ci				     gfp_t gfp_flags, struct netlink_ext_ack *extack);
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_cistruct rt6_info *ip6_dst_alloc(struct net *net, struct net_device *dev,
16262306a36Sopenharmony_ci			       int flags);
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci/*
16562306a36Sopenharmony_ci *	support functions for ND
16662306a36Sopenharmony_ci *
16762306a36Sopenharmony_ci */
16862306a36Sopenharmony_cistruct fib6_info *rt6_get_dflt_router(struct net *net,
16962306a36Sopenharmony_ci				     const struct in6_addr *addr,
17062306a36Sopenharmony_ci				     struct net_device *dev);
17162306a36Sopenharmony_cistruct fib6_info *rt6_add_dflt_router(struct net *net,
17262306a36Sopenharmony_ci				     const struct in6_addr *gwaddr,
17362306a36Sopenharmony_ci				     struct net_device *dev, unsigned int pref,
17462306a36Sopenharmony_ci				     u32 defrtr_usr_metric);
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_civoid rt6_purge_dflt_routers(struct net *net);
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ciint rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
17962306a36Sopenharmony_ci		  const struct in6_addr *gwaddr);
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_civoid ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, int oif,
18262306a36Sopenharmony_ci		     u32 mark, kuid_t uid);
18362306a36Sopenharmony_civoid ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu);
18462306a36Sopenharmony_civoid ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark,
18562306a36Sopenharmony_ci		  kuid_t uid);
18662306a36Sopenharmony_civoid ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif);
18762306a36Sopenharmony_civoid ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_cistruct netlink_callback;
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_cistruct rt6_rtnl_dump_arg {
19262306a36Sopenharmony_ci	struct sk_buff *skb;
19362306a36Sopenharmony_ci	struct netlink_callback *cb;
19462306a36Sopenharmony_ci	struct net *net;
19562306a36Sopenharmony_ci	struct fib_dump_filter filter;
19662306a36Sopenharmony_ci};
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ciint rt6_dump_route(struct fib6_info *f6i, void *p_arg, unsigned int skip);
19962306a36Sopenharmony_civoid rt6_mtu_change(struct net_device *dev, unsigned int mtu);
20062306a36Sopenharmony_civoid rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
20162306a36Sopenharmony_civoid rt6_clean_tohost(struct net *net, struct in6_addr *gateway);
20262306a36Sopenharmony_civoid rt6_sync_up(struct net_device *dev, unsigned char nh_flags);
20362306a36Sopenharmony_civoid rt6_disable_ip(struct net_device *dev, unsigned long event);
20462306a36Sopenharmony_civoid rt6_sync_down_dev(struct net_device *dev, unsigned long event);
20562306a36Sopenharmony_civoid rt6_multipath_rebalance(struct fib6_info *f6i);
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_civoid rt6_uncached_list_add(struct rt6_info *rt);
20862306a36Sopenharmony_civoid rt6_uncached_list_del(struct rt6_info *rt);
20962306a36Sopenharmony_ci
21062306a36Sopenharmony_cistatic inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb)
21162306a36Sopenharmony_ci{
21262306a36Sopenharmony_ci	const struct dst_entry *dst = skb_dst(skb);
21362306a36Sopenharmony_ci	const struct rt6_info *rt6 = NULL;
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci	if (dst)
21662306a36Sopenharmony_ci		rt6 = container_of(dst, struct rt6_info, dst);
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci	return rt6;
21962306a36Sopenharmony_ci}
22062306a36Sopenharmony_ci
22162306a36Sopenharmony_ci/*
22262306a36Sopenharmony_ci *	Store a destination cache entry in a socket
22362306a36Sopenharmony_ci */
22462306a36Sopenharmony_cistatic inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
22562306a36Sopenharmony_ci				 const struct in6_addr *daddr,
22662306a36Sopenharmony_ci				 const struct in6_addr *saddr)
22762306a36Sopenharmony_ci{
22862306a36Sopenharmony_ci	struct ipv6_pinfo *np = inet6_sk(sk);
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci	np->dst_cookie = rt6_get_cookie((struct rt6_info *)dst);
23162306a36Sopenharmony_ci	sk_setup_caps(sk, dst);
23262306a36Sopenharmony_ci	np->daddr_cache = daddr;
23362306a36Sopenharmony_ci#ifdef CONFIG_IPV6_SUBTREES
23462306a36Sopenharmony_ci	np->saddr_cache = saddr;
23562306a36Sopenharmony_ci#endif
23662306a36Sopenharmony_ci}
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_civoid ip6_sk_dst_store_flow(struct sock *sk, struct dst_entry *dst,
23962306a36Sopenharmony_ci			   const struct flowi6 *fl6);
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_cistatic inline bool ipv6_unicast_destination(const struct sk_buff *skb)
24262306a36Sopenharmony_ci{
24362306a36Sopenharmony_ci	struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci	return rt->rt6i_flags & RTF_LOCAL;
24662306a36Sopenharmony_ci}
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_cistatic inline bool ipv6_anycast_destination(const struct dst_entry *dst,
24962306a36Sopenharmony_ci					    const struct in6_addr *daddr)
25062306a36Sopenharmony_ci{
25162306a36Sopenharmony_ci	struct rt6_info *rt = (struct rt6_info *)dst;
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	return rt->rt6i_flags & RTF_ANYCAST ||
25462306a36Sopenharmony_ci		(rt->rt6i_dst.plen < 127 &&
25562306a36Sopenharmony_ci		 !(rt->rt6i_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) &&
25662306a36Sopenharmony_ci		 ipv6_addr_equal(&rt->rt6i_dst.addr, daddr));
25762306a36Sopenharmony_ci}
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ciint ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
26062306a36Sopenharmony_ci		 int (*output)(struct net *, struct sock *, struct sk_buff *));
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_cistatic inline unsigned int ip6_skb_dst_mtu(const struct sk_buff *skb)
26362306a36Sopenharmony_ci{
26462306a36Sopenharmony_ci	const struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
26562306a36Sopenharmony_ci				inet6_sk(skb->sk) : NULL;
26662306a36Sopenharmony_ci	const struct dst_entry *dst = skb_dst(skb);
26762306a36Sopenharmony_ci	unsigned int mtu;
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci	if (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) {
27062306a36Sopenharmony_ci		mtu = READ_ONCE(dst->dev->mtu);
27162306a36Sopenharmony_ci		mtu -= lwtunnel_headroom(dst->lwtstate, mtu);
27262306a36Sopenharmony_ci	} else {
27362306a36Sopenharmony_ci		mtu = dst_mtu(dst);
27462306a36Sopenharmony_ci	}
27562306a36Sopenharmony_ci	return mtu;
27662306a36Sopenharmony_ci}
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_cistatic inline bool ip6_sk_accept_pmtu(const struct sock *sk)
27962306a36Sopenharmony_ci{
28062306a36Sopenharmony_ci	return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE &&
28162306a36Sopenharmony_ci	       inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
28262306a36Sopenharmony_ci}
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_cistatic inline bool ip6_sk_ignore_df(const struct sock *sk)
28562306a36Sopenharmony_ci{
28662306a36Sopenharmony_ci	return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
28762306a36Sopenharmony_ci	       inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
28862306a36Sopenharmony_ci}
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_cistatic inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt,
29162306a36Sopenharmony_ci						 const struct in6_addr *daddr)
29262306a36Sopenharmony_ci{
29362306a36Sopenharmony_ci	if (rt->rt6i_flags & RTF_GATEWAY)
29462306a36Sopenharmony_ci		return &rt->rt6i_gateway;
29562306a36Sopenharmony_ci	else if (unlikely(rt->rt6i_flags & RTF_CACHE))
29662306a36Sopenharmony_ci		return &rt->rt6i_dst.addr;
29762306a36Sopenharmony_ci	else
29862306a36Sopenharmony_ci		return daddr;
29962306a36Sopenharmony_ci}
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_cistatic inline bool rt6_duplicate_nexthop(struct fib6_info *a, struct fib6_info *b)
30262306a36Sopenharmony_ci{
30362306a36Sopenharmony_ci	struct fib6_nh *nha, *nhb;
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci	if (a->nh || b->nh)
30662306a36Sopenharmony_ci		return nexthop_cmp(a->nh, b->nh);
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci	nha = a->fib6_nh;
30962306a36Sopenharmony_ci	nhb = b->fib6_nh;
31062306a36Sopenharmony_ci	return nha->fib_nh_dev == nhb->fib_nh_dev &&
31162306a36Sopenharmony_ci	       ipv6_addr_equal(&nha->fib_nh_gw6, &nhb->fib_nh_gw6) &&
31262306a36Sopenharmony_ci	       !lwtunnel_cmp_encap(nha->fib_nh_lws, nhb->fib_nh_lws);
31362306a36Sopenharmony_ci}
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_cistatic inline unsigned int ip6_dst_mtu_maybe_forward(const struct dst_entry *dst,
31662306a36Sopenharmony_ci						     bool forwarding)
31762306a36Sopenharmony_ci{
31862306a36Sopenharmony_ci	struct inet6_dev *idev;
31962306a36Sopenharmony_ci	unsigned int mtu;
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci	if (!forwarding || dst_metric_locked(dst, RTAX_MTU)) {
32262306a36Sopenharmony_ci		mtu = dst_metric_raw(dst, RTAX_MTU);
32362306a36Sopenharmony_ci		if (mtu)
32462306a36Sopenharmony_ci			goto out;
32562306a36Sopenharmony_ci	}
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci	mtu = IPV6_MIN_MTU;
32862306a36Sopenharmony_ci	rcu_read_lock();
32962306a36Sopenharmony_ci	idev = __in6_dev_get(dst->dev);
33062306a36Sopenharmony_ci	if (idev)
33162306a36Sopenharmony_ci		mtu = idev->cnf.mtu6;
33262306a36Sopenharmony_ci	rcu_read_unlock();
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ciout:
33562306a36Sopenharmony_ci	return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
33662306a36Sopenharmony_ci}
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ciu32 ip6_mtu_from_fib6(const struct fib6_result *res,
33962306a36Sopenharmony_ci		      const struct in6_addr *daddr,
34062306a36Sopenharmony_ci		      const struct in6_addr *saddr);
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_cistruct neighbour *ip6_neigh_lookup(const struct in6_addr *gw,
34362306a36Sopenharmony_ci				   struct net_device *dev, struct sk_buff *skb,
34462306a36Sopenharmony_ci				   const void *daddr);
34562306a36Sopenharmony_ci#endif
346