diff options
author | Li RongQing <lirongqing@baidu.com> | 2018-11-08 14:58:07 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-08 17:04:43 -0800 |
commit | 1c51dc9ad68acf4d2cb89ba847fb48fd6e2de723 (patch) | |
tree | 27a8408a497b734addd97562eee2501e452c9bf0 /net | |
parent | 0db55093b56618088b9a1d445eb6e43b311bea33 (diff) | |
download | linux-1c51dc9ad68acf4d2cb89ba847fb48fd6e2de723.tar.gz linux-1c51dc9ad68acf4d2cb89ba847fb48fd6e2de723.tar.bz2 linux-1c51dc9ad68acf4d2cb89ba847fb48fd6e2de723.zip |
net/ipv6: compute anycast address hash only if dev is null
avoid to compute the hash value if dev is not null, since
hash value is not used
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/anycast.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 94999058e110..cca3b3603c42 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c @@ -433,7 +433,6 @@ static bool ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *ad bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, const struct in6_addr *addr) { - unsigned int hash = inet6_acaddr_hash(net, addr); struct net_device *nh_dev; struct ifacaddr6 *aca; bool found = false; @@ -441,7 +440,9 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, rcu_read_lock(); if (dev) found = ipv6_chk_acast_dev(dev, addr); - else + else { + unsigned int hash = inet6_acaddr_hash(net, addr); + hlist_for_each_entry_rcu(aca, &inet6_acaddr_lst[hash], aca_addr_lst) { nh_dev = fib6_info_nh_dev(aca->aca_rt); @@ -452,6 +453,7 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, break; } } + } rcu_read_unlock(); return found; } |