aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 088888db8b3d..7f95e6e9beeb 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -910,7 +910,7 @@ no_in_dev:
910 */ 910 */
911 read_lock(&dev_base_lock); 911 read_lock(&dev_base_lock);
912 rcu_read_lock(); 912 rcu_read_lock();
913 for (dev = dev_base; dev; dev = dev->next) { 913 for_each_netdev(dev) {
914 if ((in_dev = __in_dev_get_rcu(dev)) == NULL) 914 if ((in_dev = __in_dev_get_rcu(dev)) == NULL)
915 continue; 915 continue;
916 916
@@ -989,7 +989,7 @@ __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local,
989 989
990 read_lock(&dev_base_lock); 990 read_lock(&dev_base_lock);
991 rcu_read_lock(); 991 rcu_read_lock();
992 for (dev = dev_base; dev; dev = dev->next) { 992 for_each_netdev(dev) {
993 if ((in_dev = __in_dev_get_rcu(dev))) { 993 if ((in_dev = __in_dev_get_rcu(dev))) {
994 addr = confirm_addr_indev(in_dev, dst, local, scope); 994 addr = confirm_addr_indev(in_dev, dst, local, scope);
995 if (addr) 995 if (addr)
@@ -1182,23 +1182,26 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
1182 int s_ip_idx, s_idx = cb->args[0]; 1182 int s_ip_idx, s_idx = cb->args[0];
1183 1183
1184 s_ip_idx = ip_idx = cb->args[1]; 1184 s_ip_idx = ip_idx = cb->args[1];
1185 for (dev = dev_base, idx = 0; dev; dev = dev->next, idx++) { 1185 idx = 0;
1186 for_each_netdev(dev) {
1186 if (idx < s_idx) 1187 if (idx < s_idx)
1187 continue; 1188 goto cont;
1188 if (idx > s_idx) 1189 if (idx > s_idx)
1189 s_ip_idx = 0; 1190 s_ip_idx = 0;
1190 if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) 1191 if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
1191 continue; 1192 goto cont;
1192 1193
1193 for (ifa = in_dev->ifa_list, ip_idx = 0; ifa; 1194 for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
1194 ifa = ifa->ifa_next, ip_idx++) { 1195 ifa = ifa->ifa_next, ip_idx++) {
1195 if (ip_idx < s_ip_idx) 1196 if (ip_idx < s_ip_idx)
1196 continue; 1197 goto cont;
1197 if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid, 1198 if (inet_fill_ifaddr(skb, ifa, NETLINK_CB(cb->skb).pid,
1198 cb->nlh->nlmsg_seq, 1199 cb->nlh->nlmsg_seq,
1199 RTM_NEWADDR, NLM_F_MULTI) <= 0) 1200 RTM_NEWADDR, NLM_F_MULTI) <= 0)
1200 goto done; 1201 goto done;
1201 } 1202 }
1203cont:
1204 idx++;
1202 } 1205 }
1203 1206
1204done: 1207done:
@@ -1243,7 +1246,7 @@ void inet_forward_change(void)
1243 ipv4_devconf_dflt.forwarding = on; 1246 ipv4_devconf_dflt.forwarding = on;
1244 1247
1245 read_lock(&dev_base_lock); 1248 read_lock(&dev_base_lock);
1246 for (dev = dev_base; dev; dev = dev->next) { 1249 for_each_netdev(dev) {
1247 struct in_device *in_dev; 1250 struct in_device *in_dev;
1248 rcu_read_lock(); 1251 rcu_read_lock();
1249 in_dev = __in_dev_get_rcu(dev); 1252 in_dev = __in_dev_get_rcu(dev);