Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipv6: make ipv6_anycast_destination logic usable without dst_entry

nft_fib_ipv6 uses ipv6_anycast_destination(), but upcoming patch removes
the dst_entry usage in favor of fib6_result.

Move the 'plen > 127' logic to a new helper and call it from the
existing one.

Signed-off-by: Florian Westphal <fw@strlen.de>

+11 -4
+11 -4
include/net/ip6_route.h
··· 252 252 return rt->rt6i_flags & RTF_LOCAL; 253 253 } 254 254 255 + static inline bool __ipv6_anycast_destination(const struct rt6key *rt6i_dst, 256 + u32 rt6i_flags, 257 + const struct in6_addr *daddr) 258 + { 259 + return rt6i_flags & RTF_ANYCAST || 260 + (rt6i_dst->plen < 127 && 261 + !(rt6i_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) && 262 + ipv6_addr_equal(&rt6i_dst->addr, daddr)); 263 + } 264 + 255 265 static inline bool ipv6_anycast_destination(const struct dst_entry *dst, 256 266 const struct in6_addr *daddr) 257 267 { 258 268 const struct rt6_info *rt = dst_rt6_info(dst); 259 269 260 - return rt->rt6i_flags & RTF_ANYCAST || 261 - (rt->rt6i_dst.plen < 127 && 262 - !(rt->rt6i_flags & (RTF_GATEWAY | RTF_NONEXTHOP)) && 263 - ipv6_addr_equal(&rt->rt6i_dst.addr, daddr)); 270 + return __ipv6_anycast_destination(&rt->rt6i_dst, rt->rt6i_flags, daddr); 264 271 } 265 272 266 273 int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,