diff options
author | Julian Anastasov <ja@ssi.bg> | 2017-02-07 00:14:15 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-07 21:07:46 +0300 |
commit | 63fca65d08632fbec9d9b655f671cf08aa1aeeb8 (patch) | |
tree | 103ac18cddcdf911a8589f52fbcefb7140411a51 /include/net/arp.h | |
parent | c3a2e8370534f810cac6050169db0ed3e0f94f0b (diff) | |
download | linux-63fca65d08632fbec9d9b655f671cf08aa1aeeb8.tar.xz |
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>
Diffstat (limited to 'include/net/arp.h')
-rw-r--r-- | include/net/arp.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/net/arp.h b/include/net/arp.h index 5e0f891d476c..65619a2de6f4 100644 --- a/include/net/arp.h +++ b/include/net/arp.h @@ -35,6 +35,22 @@ static inline struct neighbour *__ipv4_neigh_lookup(struct net_device *dev, u32 return n; } +static inline void __ipv4_confirm_neigh(struct net_device *dev, u32 key) +{ + struct neighbour *n; + + rcu_read_lock_bh(); + n = __ipv4_neigh_lookup_noref(dev, key); + if (n) { + unsigned long now = jiffies; + + /* avoid dirtying neighbour */ + if (n->confirmed != now) + n->confirmed = now; + } + rcu_read_unlock_bh(); +} + void arp_init(void); int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); void arp_send(int type, int ptype, __be32 dest_ip, |