Commit 1c51dc9a authored by Li RongQing's avatar Li RongQing Committed by David S. Miller

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: default avatarLi RongQing <lirongqing@baidu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0db55093
...@@ -433,7 +433,6 @@ static bool ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *ad ...@@ -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, bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
const struct in6_addr *addr) const struct in6_addr *addr)
{ {
unsigned int hash = inet6_acaddr_hash(net, addr);
struct net_device *nh_dev; struct net_device *nh_dev;
struct ifacaddr6 *aca; struct ifacaddr6 *aca;
bool found = false; bool found = false;
...@@ -441,7 +440,9 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, ...@@ -441,7 +440,9 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
rcu_read_lock(); rcu_read_lock();
if (dev) if (dev)
found = ipv6_chk_acast_dev(dev, addr); 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], hlist_for_each_entry_rcu(aca, &inet6_acaddr_lst[hash],
aca_addr_lst) { aca_addr_lst) {
nh_dev = fib6_info_nh_dev(aca->aca_rt); 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, ...@@ -452,6 +453,7 @@ bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
break; break;
} }
} }
}
rcu_read_unlock(); rcu_read_unlock();
return found; return found;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment