mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
net: add confirm_neigh method to dst_ops
Add confirm_neigh method to dst_ops and use it from IPv4 and IPv6 to lookup and confirm the neighbour. Its usage via the new helper dst_confirm_neigh() should be restricted to MSG_PROBE users for performance reasons. For XFRM prefer the last tunnel address, if present. With help from Steffen Klassert. Signed-off-by: Julian Anastasov <ja@ssi.bg> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c3a2e83705
commit
63fca65d08
7 changed files with 96 additions and 0 deletions
|
@ -223,6 +223,21 @@ static struct neighbour *ip6_neigh_lookup(const struct dst_entry *dst,
|
|||
return neigh_create(&nd_tbl, daddr, dst->dev);
|
||||
}
|
||||
|
||||
static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr)
|
||||
{
|
||||
struct net_device *dev = dst->dev;
|
||||
struct rt6_info *rt = (struct rt6_info *)dst;
|
||||
|
||||
daddr = choose_neigh_daddr(rt, NULL, daddr);
|
||||
if (!daddr)
|
||||
return;
|
||||
if (dev->flags & (IFF_NOARP | IFF_LOOPBACK))
|
||||
return;
|
||||
if (ipv6_addr_is_multicast((const struct in6_addr *)daddr))
|
||||
return;
|
||||
__ipv6_confirm_neigh(dev, daddr);
|
||||
}
|
||||
|
||||
static struct dst_ops ip6_dst_ops_template = {
|
||||
.family = AF_INET6,
|
||||
.gc = ip6_dst_gc,
|
||||
|
@ -239,6 +254,7 @@ static struct dst_ops ip6_dst_ops_template = {
|
|||
.redirect = rt6_do_redirect,
|
||||
.local_out = __ip6_local_out,
|
||||
.neigh_lookup = ip6_neigh_lookup,
|
||||
.confirm_neigh = ip6_confirm_neigh,
|
||||
};
|
||||
|
||||
static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue