diff options
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 4dc0d44a5d31..f2c7e615f902 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1419,11 +1419,10 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, | |||
1419 | struct net_device *dev, int strict) | 1419 | struct net_device *dev, int strict) |
1420 | { | 1420 | { |
1421 | struct inet6_ifaddr *ifp; | 1421 | struct inet6_ifaddr *ifp; |
1422 | struct hlist_node *node; | ||
1423 | unsigned int hash = inet6_addr_hash(addr); | 1422 | unsigned int hash = inet6_addr_hash(addr); |
1424 | 1423 | ||
1425 | rcu_read_lock_bh(); | 1424 | rcu_read_lock_bh(); |
1426 | hlist_for_each_entry_rcu(ifp, node, &inet6_addr_lst[hash], addr_lst) { | 1425 | hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) { |
1427 | if (!net_eq(dev_net(ifp->idev->dev), net)) | 1426 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1428 | continue; | 1427 | continue; |
1429 | if (ipv6_addr_equal(&ifp->addr, addr) && | 1428 | if (ipv6_addr_equal(&ifp->addr, addr) && |
@@ -1445,9 +1444,8 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, | |||
1445 | { | 1444 | { |
1446 | unsigned int hash = inet6_addr_hash(addr); | 1445 | unsigned int hash = inet6_addr_hash(addr); |
1447 | struct inet6_ifaddr *ifp; | 1446 | struct inet6_ifaddr *ifp; |
1448 | struct hlist_node *node; | ||
1449 | 1447 | ||
1450 | hlist_for_each_entry(ifp, node, &inet6_addr_lst[hash], addr_lst) { | 1448 | hlist_for_each_entry(ifp, &inet6_addr_lst[hash], addr_lst) { |
1451 | if (!net_eq(dev_net(ifp->idev->dev), net)) | 1449 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1452 | continue; | 1450 | continue; |
1453 | if (ipv6_addr_equal(&ifp->addr, addr)) { | 1451 | if (ipv6_addr_equal(&ifp->addr, addr)) { |
@@ -1487,10 +1485,9 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, const struct in6_addr *add | |||
1487 | { | 1485 | { |
1488 | struct inet6_ifaddr *ifp, *result = NULL; | 1486 | struct inet6_ifaddr *ifp, *result = NULL; |
1489 | unsigned int hash = inet6_addr_hash(addr); | 1487 | unsigned int hash = inet6_addr_hash(addr); |
1490 | struct hlist_node *node; | ||
1491 | 1488 | ||
1492 | rcu_read_lock_bh(); | 1489 | rcu_read_lock_bh(); |
1493 | hlist_for_each_entry_rcu_bh(ifp, node, &inet6_addr_lst[hash], addr_lst) { | 1490 | hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) { |
1494 | if (!net_eq(dev_net(ifp->idev->dev), net)) | 1491 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1495 | continue; | 1492 | continue; |
1496 | if (ipv6_addr_equal(&ifp->addr, addr)) { | 1493 | if (ipv6_addr_equal(&ifp->addr, addr)) { |
@@ -2907,11 +2904,10 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
2907 | /* Step 2: clear hash table */ | 2904 | /* Step 2: clear hash table */ |
2908 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { | 2905 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { |
2909 | struct hlist_head *h = &inet6_addr_lst[i]; | 2906 | struct hlist_head *h = &inet6_addr_lst[i]; |
2910 | struct hlist_node *n; | ||
2911 | 2907 | ||
2912 | spin_lock_bh(&addrconf_hash_lock); | 2908 | spin_lock_bh(&addrconf_hash_lock); |
2913 | restart: | 2909 | restart: |
2914 | hlist_for_each_entry_rcu(ifa, n, h, addr_lst) { | 2910 | hlist_for_each_entry_rcu(ifa, h, addr_lst) { |
2915 | if (ifa->idev == idev) { | 2911 | if (ifa->idev == idev) { |
2916 | hlist_del_init_rcu(&ifa->addr_lst); | 2912 | hlist_del_init_rcu(&ifa->addr_lst); |
2917 | addrconf_del_timer(ifa); | 2913 | addrconf_del_timer(ifa); |
@@ -3218,8 +3214,7 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq, loff_t pos) | |||
3218 | } | 3214 | } |
3219 | 3215 | ||
3220 | for (; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { | 3216 | for (; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { |
3221 | struct hlist_node *n; | 3217 | hlist_for_each_entry_rcu_bh(ifa, &inet6_addr_lst[state->bucket], |
3222 | hlist_for_each_entry_rcu_bh(ifa, n, &inet6_addr_lst[state->bucket], | ||
3223 | addr_lst) { | 3218 | addr_lst) { |
3224 | if (!net_eq(dev_net(ifa->idev->dev), net)) | 3219 | if (!net_eq(dev_net(ifa->idev->dev), net)) |
3225 | continue; | 3220 | continue; |
@@ -3244,9 +3239,8 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, | |||
3244 | { | 3239 | { |
3245 | struct if6_iter_state *state = seq->private; | 3240 | struct if6_iter_state *state = seq->private; |
3246 | struct net *net = seq_file_net(seq); | 3241 | struct net *net = seq_file_net(seq); |
3247 | struct hlist_node *n = &ifa->addr_lst; | ||
3248 | 3242 | ||
3249 | hlist_for_each_entry_continue_rcu_bh(ifa, n, addr_lst) { | 3243 | hlist_for_each_entry_continue_rcu_bh(ifa, addr_lst) { |
3250 | if (!net_eq(dev_net(ifa->idev->dev), net)) | 3244 | if (!net_eq(dev_net(ifa->idev->dev), net)) |
3251 | continue; | 3245 | continue; |
3252 | state->offset++; | 3246 | state->offset++; |
@@ -3255,7 +3249,7 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, | |||
3255 | 3249 | ||
3256 | while (++state->bucket < IN6_ADDR_HSIZE) { | 3250 | while (++state->bucket < IN6_ADDR_HSIZE) { |
3257 | state->offset = 0; | 3251 | state->offset = 0; |
3258 | hlist_for_each_entry_rcu_bh(ifa, n, | 3252 | hlist_for_each_entry_rcu_bh(ifa, |
3259 | &inet6_addr_lst[state->bucket], addr_lst) { | 3253 | &inet6_addr_lst[state->bucket], addr_lst) { |
3260 | if (!net_eq(dev_net(ifa->idev->dev), net)) | 3254 | if (!net_eq(dev_net(ifa->idev->dev), net)) |
3261 | continue; | 3255 | continue; |
@@ -3357,11 +3351,10 @@ int ipv6_chk_home_addr(struct net *net, const struct in6_addr *addr) | |||
3357 | { | 3351 | { |
3358 | int ret = 0; | 3352 | int ret = 0; |
3359 | struct inet6_ifaddr *ifp = NULL; | 3353 | struct inet6_ifaddr *ifp = NULL; |
3360 | struct hlist_node *n; | ||
3361 | unsigned int hash = inet6_addr_hash(addr); | 3354 | unsigned int hash = inet6_addr_hash(addr); |
3362 | 3355 | ||
3363 | rcu_read_lock_bh(); | 3356 | rcu_read_lock_bh(); |
3364 | hlist_for_each_entry_rcu_bh(ifp, n, &inet6_addr_lst[hash], addr_lst) { | 3357 | hlist_for_each_entry_rcu_bh(ifp, &inet6_addr_lst[hash], addr_lst) { |
3365 | if (!net_eq(dev_net(ifp->idev->dev), net)) | 3358 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
3366 | continue; | 3359 | continue; |
3367 | if (ipv6_addr_equal(&ifp->addr, addr) && | 3360 | if (ipv6_addr_equal(&ifp->addr, addr) && |
@@ -3383,7 +3376,6 @@ static void addrconf_verify(unsigned long foo) | |||
3383 | { | 3376 | { |
3384 | unsigned long now, next, next_sec, next_sched; | 3377 | unsigned long now, next, next_sec, next_sched; |
3385 | struct inet6_ifaddr *ifp; | 3378 | struct inet6_ifaddr *ifp; |
3386 | struct hlist_node *node; | ||
3387 | int i; | 3379 | int i; |
3388 | 3380 | ||
3389 | rcu_read_lock_bh(); | 3381 | rcu_read_lock_bh(); |
@@ -3395,7 +3387,7 @@ static void addrconf_verify(unsigned long foo) | |||
3395 | 3387 | ||
3396 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { | 3388 | for (i = 0; i < IN6_ADDR_HSIZE; i++) { |
3397 | restart: | 3389 | restart: |
3398 | hlist_for_each_entry_rcu_bh(ifp, node, | 3390 | hlist_for_each_entry_rcu_bh(ifp, |
3399 | &inet6_addr_lst[i], addr_lst) { | 3391 | &inet6_addr_lst[i], addr_lst) { |
3400 | unsigned long age; | 3392 | unsigned long age; |
3401 | 3393 | ||
@@ -3866,7 +3858,6 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
3866 | struct net_device *dev; | 3858 | struct net_device *dev; |
3867 | struct inet6_dev *idev; | 3859 | struct inet6_dev *idev; |
3868 | struct hlist_head *head; | 3860 | struct hlist_head *head; |
3869 | struct hlist_node *node; | ||
3870 | 3861 | ||
3871 | s_h = cb->args[0]; | 3862 | s_h = cb->args[0]; |
3872 | s_idx = idx = cb->args[1]; | 3863 | s_idx = idx = cb->args[1]; |
@@ -3876,7 +3867,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
3876 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { | 3867 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { |
3877 | idx = 0; | 3868 | idx = 0; |
3878 | head = &net->dev_index_head[h]; | 3869 | head = &net->dev_index_head[h]; |
3879 | hlist_for_each_entry_rcu(dev, node, head, index_hlist) { | 3870 | hlist_for_each_entry_rcu(dev, head, index_hlist) { |
3880 | if (idx < s_idx) | 3871 | if (idx < s_idx) |
3881 | goto cont; | 3872 | goto cont; |
3882 | if (h > s_h || idx > s_idx) | 3873 | if (h > s_h || idx > s_idx) |
@@ -4222,7 +4213,6 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
4222 | struct net_device *dev; | 4213 | struct net_device *dev; |
4223 | struct inet6_dev *idev; | 4214 | struct inet6_dev *idev; |
4224 | struct hlist_head *head; | 4215 | struct hlist_head *head; |
4225 | struct hlist_node *node; | ||
4226 | 4216 | ||
4227 | s_h = cb->args[0]; | 4217 | s_h = cb->args[0]; |
4228 | s_idx = cb->args[1]; | 4218 | s_idx = cb->args[1]; |
@@ -4231,7 +4221,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
4231 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { | 4221 | for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { |
4232 | idx = 0; | 4222 | idx = 0; |
4233 | head = &net->dev_index_head[h]; | 4223 | head = &net->dev_index_head[h]; |
4234 | hlist_for_each_entry_rcu(dev, node, head, index_hlist) { | 4224 | hlist_for_each_entry_rcu(dev, head, index_hlist) { |
4235 | if (idx < s_idx) | 4225 | if (idx < s_idx) |
4236 | goto cont; | 4226 | goto cont; |
4237 | idev = __in6_dev_get(dev); | 4227 | idev = __in6_dev_get(dev); |