summaryrefslogtreecommitdiff
path: root/include/net/ip6_route.h
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2015-05-23 06:55:58 +0300
committerDavid S. Miller <davem@davemloft.net>2015-05-25 20:25:33 +0300
commit2647a9b07032c5a95ddee1fcb65d95bddbc6b7f9 (patch)
tree7274770a847506b7adb64501deac2f90123befa0 /include/net/ip6_route.h
parentfd0273d7939f2ce3247f6aac5f6b9a0135d4cd39 (diff)
downloadlinux-2647a9b07032c5a95ddee1fcb65d95bddbc6b7f9.tar.xz
ipv6: Remove external dependency on rt6i_gateway and RTF_ANYCAST
When creating a RTF_CACHE route, RTF_ANYCAST is set based on rt6i_dst. Also, rt6i_gateway is always set to the nexthop while the nexthop could be a gateway or the rt6i_dst.addr. After removing the rt6i_dst and rt6i_src dependency in the last patch, we also need to stop the caller from depending on rt6i_gateway and RTF_ANYCAST. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: Julian Anastasov <ja@ssi.bg> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip6_route.h')
-rw-r--r--include/net/ip6_route.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5e192068e6cb..4caf7d697dee 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -163,11 +163,14 @@ static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
return rt->rt6i_flags & RTF_LOCAL;
}
-static inline bool ipv6_anycast_destination(const struct sk_buff *skb)
+static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
+ const struct in6_addr *daddr)
{
- struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
+ struct rt6_info *rt = (struct rt6_info *)dst;
- return rt->rt6i_flags & RTF_ANYCAST;
+ return rt->rt6i_flags & RTF_ANYCAST ||
+ (rt->rt6i_dst.plen != 128 &&
+ ipv6_addr_equal(&rt->rt6i_dst.addr, daddr));
}
int ip6_fragment(struct sock *sk, struct sk_buff *skb,
@@ -194,9 +197,15 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk)
inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
}
-static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt)
+static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
+ struct in6_addr *daddr)
{
- return &rt->rt6i_gateway;
+ if (rt->rt6i_flags & RTF_GATEWAY)
+ return &rt->rt6i_gateway;
+ else if (rt->rt6i_flags & RTF_CACHE)
+ return &rt->rt6i_dst.addr;
+ else
+ return daddr;
}
#endif