aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3452433cbc96..d02685c6bc69 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -449,7 +449,7 @@ static void addrconf_forward_change(void)
449 struct inet6_dev *idev; 449 struct inet6_dev *idev;
450 450
451 read_lock(&dev_base_lock); 451 read_lock(&dev_base_lock);
452 for (dev=dev_base; dev; dev=dev->next) { 452 for_each_netdev(dev) {
453 rcu_read_lock(); 453 rcu_read_lock();
454 idev = __in6_dev_get(dev); 454 idev = __in6_dev_get(dev);
455 if (idev) { 455 if (idev) {
@@ -911,7 +911,7 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
911 read_lock(&dev_base_lock); 911 read_lock(&dev_base_lock);
912 rcu_read_lock(); 912 rcu_read_lock();
913 913
914 for (dev = dev_base; dev; dev=dev->next) { 914 for_each_netdev(dev) {
915 struct inet6_dev *idev; 915 struct inet6_dev *idev;
916 struct inet6_ifaddr *ifa; 916 struct inet6_ifaddr *ifa;
917 917
@@ -2064,7 +2064,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
2064 return; 2064 return;
2065 } 2065 }
2066 2066
2067 for (dev = dev_base; dev != NULL; dev = dev->next) { 2067 for_each_netdev(dev) {
2068 struct in_device * in_dev = __in_dev_get_rtnl(dev); 2068 struct in_device * in_dev = __in_dev_get_rtnl(dev);
2069 if (in_dev && (dev->flags & IFF_UP)) { 2069 if (in_dev && (dev->flags & IFF_UP)) {
2070 struct in_ifaddr * ifa; 2070 struct in_ifaddr * ifa;
@@ -2225,7 +2225,7 @@ static void ip6_tnl_add_linklocal(struct inet6_dev *idev)
2225 return; 2225 return;
2226 } 2226 }
2227 /* then try to inherit it from any device */ 2227 /* then try to inherit it from any device */
2228 for (link_dev = dev_base; link_dev; link_dev = link_dev->next) { 2228 for_each_netdev(link_dev) {
2229 if (!ipv6_inherit_linklocal(idev, link_dev)) 2229 if (!ipv6_inherit_linklocal(idev, link_dev))
2230 return; 2230 return;
2231 } 2231 }
@@ -3257,14 +3257,15 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3257 s_idx = cb->args[0]; 3257 s_idx = cb->args[0];
3258 s_ip_idx = ip_idx = cb->args[1]; 3258 s_ip_idx = ip_idx = cb->args[1];
3259 3259
3260 for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { 3260 idx = 0;
3261 for_each_netdev(dev) {
3261 if (idx < s_idx) 3262 if (idx < s_idx)
3262 continue; 3263 goto cont;
3263 if (idx > s_idx) 3264 if (idx > s_idx)
3264 s_ip_idx = 0; 3265 s_ip_idx = 0;
3265 ip_idx = 0; 3266 ip_idx = 0;
3266 if ((idev = in6_dev_get(dev)) == NULL) 3267 if ((idev = in6_dev_get(dev)) == NULL)
3267 continue; 3268 goto cont;
3268 read_lock_bh(&idev->lock); 3269 read_lock_bh(&idev->lock);
3269 switch (type) { 3270 switch (type) {
3270 case UNICAST_ADDR: 3271 case UNICAST_ADDR:
@@ -3311,6 +3312,8 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3311 } 3312 }
3312 read_unlock_bh(&idev->lock); 3313 read_unlock_bh(&idev->lock);
3313 in6_dev_put(idev); 3314 in6_dev_put(idev);
3315cont:
3316 idx++;
3314 } 3317 }
3315done: 3318done:
3316 if (err <= 0) { 3319 if (err <= 0) {
@@ -3575,16 +3578,19 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
3575 struct inet6_dev *idev; 3578 struct inet6_dev *idev;
3576 3579
3577 read_lock(&dev_base_lock); 3580 read_lock(&dev_base_lock);
3578 for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) { 3581 idx = 0;
3582 for_each_netdev(dev) {
3579 if (idx < s_idx) 3583 if (idx < s_idx)
3580 continue; 3584 goto cont;
3581 if ((idev = in6_dev_get(dev)) == NULL) 3585 if ((idev = in6_dev_get(dev)) == NULL)
3582 continue; 3586 goto cont;
3583 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid, 3587 err = inet6_fill_ifinfo(skb, idev, NETLINK_CB(cb->skb).pid,
3584 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI); 3588 cb->nlh->nlmsg_seq, RTM_NEWLINK, NLM_F_MULTI);
3585 in6_dev_put(idev); 3589 in6_dev_put(idev);
3586 if (err <= 0) 3590 if (err <= 0)
3587 break; 3591 break;
3592cont:
3593 idx++;
3588 } 3594 }
3589 read_unlock(&dev_base_lock); 3595 read_unlock(&dev_base_lock);
3590 cb->args[0] = idx; 3596 cb->args[0] = idx;
@@ -4247,7 +4253,7 @@ void __exit addrconf_cleanup(void)
4247 * clean dev list. 4253 * clean dev list.
4248 */ 4254 */
4249 4255
4250 for (dev=dev_base; dev; dev=dev->next) { 4256 for_each_netdev(dev) {
4251 if ((idev = __in6_dev_get(dev)) == NULL) 4257 if ((idev = __in6_dev_get(dev)) == NULL)
4252 continue; 4258 continue;
4253 addrconf_ifdown(dev, 1); 4259 addrconf_ifdown(dev, 1);