aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/addr.c4
-rw-r--r--drivers/infiniband/core/cma.c2
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--net/ipv4/fib_frontend.c4
-rw-r--r--net/ipv4/igmp.c2
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/route.c6
8 files changed, 12 insertions, 12 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 0802b79c552d..963177e1c9de 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -110,7 +110,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
110 __be32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr; 110 __be32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
111 int ret; 111 int ret;
112 112
113 dev = ip_dev_find(ip); 113 dev = ip_dev_find(&init_net, ip);
114 if (!dev) 114 if (!dev)
115 return -EADDRNOTAVAIL; 115 return -EADDRNOTAVAIL;
116 116
@@ -261,7 +261,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in,
261 __be32 dst_ip = dst_in->sin_addr.s_addr; 261 __be32 dst_ip = dst_in->sin_addr.s_addr;
262 int ret; 262 int ret;
263 263
264 dev = ip_dev_find(dst_ip); 264 dev = ip_dev_find(&init_net, dst_ip);
265 if (!dev) 265 if (!dev)
266 return -EADDRNOTAVAIL; 266 return -EADDRNOTAVAIL;
267 267
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 15b7e9fb615a..1eff1b2c0e08 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1289,7 +1289,7 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
1289 atomic_inc(&conn_id->dev_remove); 1289 atomic_inc(&conn_id->dev_remove);
1290 conn_id->state = CMA_CONNECT; 1290 conn_id->state = CMA_CONNECT;
1291 1291
1292 dev = ip_dev_find(iw_event->local_addr.sin_addr.s_addr); 1292 dev = ip_dev_find(&init_net, iw_event->local_addr.sin_addr.s_addr);
1293 if (!dev) { 1293 if (!dev) {
1294 ret = -EADDRNOTAVAIL; 1294 ret = -EADDRNOTAVAIL;
1295 cma_enable_remove(conn_id); 1295 cma_enable_remove(conn_id);
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index e74a2ee8ee2a..8d9eaaebded7 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -129,7 +129,7 @@ struct in_ifaddr
129extern int register_inetaddr_notifier(struct notifier_block *nb); 129extern int register_inetaddr_notifier(struct notifier_block *nb);
130extern int unregister_inetaddr_notifier(struct notifier_block *nb); 130extern int unregister_inetaddr_notifier(struct notifier_block *nb);
131 131
132extern struct net_device *ip_dev_find(__be32 addr); 132extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
133extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 133extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
134extern int devinet_ioctl(unsigned int cmd, void __user *); 134extern int devinet_ioctl(unsigned int cmd, void __user *);
135extern void devinet_init(void); 135extern void devinet_init(void);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 7e3e7329dacf..d28261826bc2 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -153,7 +153,7 @@ static void fib_flush(struct net *net)
153 * Find the first device with a given source address. 153 * Find the first device with a given source address.
154 */ 154 */
155 155
156struct net_device * ip_dev_find(__be32 addr) 156struct net_device * ip_dev_find(struct net *net, __be32 addr)
157{ 157{
158 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 158 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
159 struct fib_result res; 159 struct fib_result res;
@@ -164,7 +164,7 @@ struct net_device * ip_dev_find(__be32 addr)
164 res.r = NULL; 164 res.r = NULL;
165#endif 165#endif
166 166
167 local_table = fib_get_table(&init_net, RT_TABLE_LOCAL); 167 local_table = fib_get_table(net, RT_TABLE_LOCAL);
168 if (!local_table || local_table->tb_lookup(local_table, &fl, &res)) 168 if (!local_table || local_table->tb_lookup(local_table, &fl, &res))
169 return NULL; 169 return NULL;
170 if (res.type != RTN_LOCAL) 170 if (res.type != RTN_LOCAL)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 928bc3284554..1f5314ca109c 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1395,7 +1395,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr)
1395 return idev; 1395 return idev;
1396 } 1396 }
1397 if (imr->imr_address.s_addr) { 1397 if (imr->imr_address.s_addr) {
1398 dev = ip_dev_find(imr->imr_address.s_addr); 1398 dev = ip_dev_find(&init_net, imr->imr_address.s_addr);
1399 if (!dev) 1399 if (!dev)
1400 return NULL; 1400 return NULL;
1401 dev_put(dev); 1401 dev_put(dev);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 82817e554363..754b0a5bbfe9 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -594,7 +594,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
594 err = 0; 594 err = 0;
595 break; 595 break;
596 } 596 }
597 dev = ip_dev_find(mreq.imr_address.s_addr); 597 dev = ip_dev_find(&init_net, mreq.imr_address.s_addr);
598 if (dev) { 598 if (dev) {
599 mreq.imr_ifindex = dev->ifindex; 599 mreq.imr_ifindex = dev->ifindex;
600 dev_put(dev); 600 dev_put(dev);
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 4198615ca678..221271758b93 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -423,7 +423,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
423 return -ENOBUFS; 423 return -ENOBUFS;
424 break; 424 break;
425 case 0: 425 case 0:
426 dev = ip_dev_find(vifc->vifc_lcl_addr.s_addr); 426 dev = ip_dev_find(&init_net, vifc->vifc_lcl_addr.s_addr);
427 if (!dev) 427 if (!dev)
428 return -EADDRNOTAVAIL; 428 return -EADDRNOTAVAIL;
429 dev_put(dev); 429 dev_put(dev);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4313255e5a14..674575b622ad 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2282,14 +2282,14 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
2282 goto out; 2282 goto out;
2283 2283
2284 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */ 2284 /* It is equivalent to inet_addr_type(saddr) == RTN_LOCAL */
2285 dev_out = ip_dev_find(oldflp->fl4_src); 2285 dev_out = ip_dev_find(&init_net, oldflp->fl4_src);
2286 if (dev_out == NULL) 2286 if (dev_out == NULL)
2287 goto out; 2287 goto out;
2288 2288
2289 /* I removed check for oif == dev_out->oif here. 2289 /* I removed check for oif == dev_out->oif here.
2290 It was wrong for two reasons: 2290 It was wrong for two reasons:
2291 1. ip_dev_find(saddr) can return wrong iface, if saddr is 2291 1. ip_dev_find(net, saddr) can return wrong iface, if saddr
2292 assigned to multiple interfaces. 2292 is assigned to multiple interfaces.
2293 2. Moreover, we are allowed to send packets with saddr 2293 2. Moreover, we are allowed to send packets with saddr
2294 of another iface. --ANK 2294 of another iface. --ANK
2295 */ 2295 */