aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/arp.c14
-rw-r--r--net/ipv4/devinet.c10
-rw-r--r--net/ipv4/fib_frontend.c12
-rw-r--r--net/ipv4/icmp.c8
-rw-r--r--net/ipv4/igmp.c16
-rw-r--r--net/ipv4/ip_fragment.c2
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ip_input.c6
-rw-r--r--net/ipv4/ip_options.c2
-rw-r--r--net/ipv4/ipconfig.c4
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c2
-rw-r--r--net/ipv4/netfilter/ipt_MASQUERADE.c2
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/route.c28
-rw-r--r--net/ipv4/tcp_ipv4.c6
-rw-r--r--net/ipv4/udp.c4
-rw-r--r--net/ipv4/xfrm4_policy.c2
18 files changed, 63 insertions, 63 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 832473e30b36..3ce2e137e7bc 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -242,7 +242,7 @@ static int arp_constructor(struct neighbour *neigh)
242 return -EINVAL; 242 return -EINVAL;
243 } 243 }
244 244
245 neigh->type = inet_addr_type(dev->nd_net, addr); 245 neigh->type = inet_addr_type(dev_net(dev), addr);
246 246
247 parms = in_dev->arp_parms; 247 parms = in_dev->arp_parms;
248 __neigh_parms_put(neigh->parms); 248 __neigh_parms_put(neigh->parms);
@@ -341,14 +341,14 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
341 switch (IN_DEV_ARP_ANNOUNCE(in_dev)) { 341 switch (IN_DEV_ARP_ANNOUNCE(in_dev)) {
342 default: 342 default:
343 case 0: /* By default announce any local IP */ 343 case 0: /* By default announce any local IP */
344 if (skb && inet_addr_type(dev->nd_net, ip_hdr(skb)->saddr) == RTN_LOCAL) 344 if (skb && inet_addr_type(dev_net(dev), ip_hdr(skb)->saddr) == RTN_LOCAL)
345 saddr = ip_hdr(skb)->saddr; 345 saddr = ip_hdr(skb)->saddr;
346 break; 346 break;
347 case 1: /* Restrict announcements of saddr in same subnet */ 347 case 1: /* Restrict announcements of saddr in same subnet */
348 if (!skb) 348 if (!skb)
349 break; 349 break;
350 saddr = ip_hdr(skb)->saddr; 350 saddr = ip_hdr(skb)->saddr;
351 if (inet_addr_type(dev->nd_net, saddr) == RTN_LOCAL) { 351 if (inet_addr_type(dev_net(dev), saddr) == RTN_LOCAL) {
352 /* saddr should be known to target */ 352 /* saddr should be known to target */
353 if (inet_addr_onlink(in_dev, target, saddr)) 353 if (inet_addr_onlink(in_dev, target, saddr))
354 break; 354 break;
@@ -424,7 +424,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
424 int flag = 0; 424 int flag = 0;
425 /*unsigned long now; */ 425 /*unsigned long now; */
426 426
427 if (ip_route_output_key(dev->nd_net, &rt, &fl) < 0) 427 if (ip_route_output_key(dev_net(dev), &rt, &fl) < 0)
428 return 1; 428 return 1;
429 if (rt->u.dst.dev != dev) { 429 if (rt->u.dst.dev != dev) {
430 NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); 430 NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
@@ -477,7 +477,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
477 477
478 paddr = skb->rtable->rt_gateway; 478 paddr = skb->rtable->rt_gateway;
479 479
480 if (arp_set_predefined(inet_addr_type(dev->nd_net, paddr), haddr, paddr, dev)) 480 if (arp_set_predefined(inet_addr_type(dev_net(dev), paddr), haddr, paddr, dev))
481 return 0; 481 return 0;
482 482
483 n = __neigh_lookup(&arp_tbl, &paddr, dev, 1); 483 n = __neigh_lookup(&arp_tbl, &paddr, dev, 1);
@@ -709,7 +709,7 @@ static int arp_process(struct sk_buff *skb)
709 u16 dev_type = dev->type; 709 u16 dev_type = dev->type;
710 int addr_type; 710 int addr_type;
711 struct neighbour *n; 711 struct neighbour *n;
712 struct net *net = dev->nd_net; 712 struct net *net = dev_net(dev);
713 713
714 /* arp_rcv below verifies the ARP header and verifies the device 714 /* arp_rcv below verifies the ARP header and verifies the device
715 * is ARP'able. 715 * is ARP'able.
@@ -858,7 +858,7 @@ static int arp_process(struct sk_buff *skb)
858 858
859 n = __neigh_lookup(&arp_tbl, &sip, dev, 0); 859 n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
860 860
861 if (IPV4_DEVCONF_ALL(dev->nd_net, ARP_ACCEPT)) { 861 if (IPV4_DEVCONF_ALL(dev_net(dev), ARP_ACCEPT)) {
862 /* Unsolicited ARP is not accepted by default. 862 /* Unsolicited ARP is not accepted by default.
863 It is possible, that this option should be enabled for some 863 It is possible, that this option should be enabled for some
864 devices (strip is candidate) 864 devices (strip is candidate)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 4a10dbbbe0a1..823c724a8593 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -165,7 +165,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
165 if (!in_dev) 165 if (!in_dev)
166 goto out; 166 goto out;
167 INIT_RCU_HEAD(&in_dev->rcu_head); 167 INIT_RCU_HEAD(&in_dev->rcu_head);
168 memcpy(&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt, 168 memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt,
169 sizeof(in_dev->cnf)); 169 sizeof(in_dev->cnf));
170 in_dev->cnf.sysctl = NULL; 170 in_dev->cnf.sysctl = NULL;
171 in_dev->dev = dev; 171 in_dev->dev = dev;
@@ -872,7 +872,7 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)
872{ 872{
873 __be32 addr = 0; 873 __be32 addr = 0;
874 struct in_device *in_dev; 874 struct in_device *in_dev;
875 struct net *net = dev->nd_net; 875 struct net *net = dev_net(dev);
876 876
877 rcu_read_lock(); 877 rcu_read_lock();
878 in_dev = __in_dev_get_rcu(dev); 878 in_dev = __in_dev_get_rcu(dev);
@@ -974,7 +974,7 @@ __be32 inet_confirm_addr(struct in_device *in_dev,
974 if (scope != RT_SCOPE_LINK) 974 if (scope != RT_SCOPE_LINK)
975 return confirm_addr_indev(in_dev, dst, local, scope); 975 return confirm_addr_indev(in_dev, dst, local, scope);
976 976
977 net = in_dev->dev->nd_net; 977 net = dev_net(in_dev->dev);
978 read_lock(&dev_base_lock); 978 read_lock(&dev_base_lock);
979 rcu_read_lock(); 979 rcu_read_lock();
980 for_each_netdev(net, dev) { 980 for_each_netdev(net, dev) {
@@ -1203,7 +1203,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh,
1203 int err = -ENOBUFS; 1203 int err = -ENOBUFS;
1204 struct net *net; 1204 struct net *net;
1205 1205
1206 net = ifa->ifa_dev->dev->nd_net; 1206 net = dev_net(ifa->ifa_dev->dev);
1207 skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); 1207 skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL);
1208 if (skb == NULL) 1208 if (skb == NULL)
1209 goto errout; 1209 goto errout;
@@ -1517,7 +1517,7 @@ static void devinet_sysctl_register(struct in_device *idev)
1517{ 1517{
1518 neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4, 1518 neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4,
1519 NET_IPV4_NEIGH, "ipv4", NULL, NULL); 1519 NET_IPV4_NEIGH, "ipv4", NULL, NULL);
1520 __devinet_sysctl_register(idev->dev->nd_net, idev->dev->name, 1520 __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name,
1521 idev->dev->ifindex, &idev->cnf); 1521 idev->dev->ifindex, &idev->cnf);
1522} 1522}
1523 1523
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 86ff2711fc95..0e4b34b07cb5 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -257,7 +257,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
257 if (in_dev == NULL) 257 if (in_dev == NULL)
258 goto e_inval; 258 goto e_inval;
259 259
260 net = dev->nd_net; 260 net = dev_net(dev);
261 if (fib_lookup(net, &fl, &res)) 261 if (fib_lookup(net, &fl, &res))
262 goto last_resort; 262 goto last_resort;
263 if (res.type != RTN_UNICAST) 263 if (res.type != RTN_UNICAST)
@@ -674,7 +674,7 @@ out:
674 674
675static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) 675static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa)
676{ 676{
677 struct net *net = ifa->ifa_dev->dev->nd_net; 677 struct net *net = dev_net(ifa->ifa_dev->dev);
678 struct fib_table *tb; 678 struct fib_table *tb;
679 struct fib_config cfg = { 679 struct fib_config cfg = {
680 .fc_protocol = RTPROT_KERNEL, 680 .fc_protocol = RTPROT_KERNEL,
@@ -801,15 +801,15 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
801 fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim); 801 fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim);
802 802
803 /* Check, that this local address finally disappeared. */ 803 /* Check, that this local address finally disappeared. */
804 if (inet_addr_type(dev->nd_net, ifa->ifa_local) != RTN_LOCAL) { 804 if (inet_addr_type(dev_net(dev), ifa->ifa_local) != RTN_LOCAL) {
805 /* And the last, but not the least thing. 805 /* And the last, but not the least thing.
806 We must flush stray FIB entries. 806 We must flush stray FIB entries.
807 807
808 First of all, we scan fib_info list searching 808 First of all, we scan fib_info list searching
809 for stray nexthop entries, then ignite fib_flush. 809 for stray nexthop entries, then ignite fib_flush.
810 */ 810 */
811 if (fib_sync_down_addr(dev->nd_net, ifa->ifa_local)) 811 if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local))
812 fib_flush(dev->nd_net); 812 fib_flush(dev_net(dev));
813 } 813 }
814 } 814 }
815#undef LOCAL_OK 815#undef LOCAL_OK
@@ -899,7 +899,7 @@ static void nl_fib_lookup_exit(struct net *net)
899static void fib_disable_ip(struct net_device *dev, int force) 899static void fib_disable_ip(struct net_device *dev, int force)
900{ 900{
901 if (fib_sync_down_dev(dev, force)) 901 if (fib_sync_down_dev(dev, force))
902 fib_flush(dev->nd_net); 902 fib_flush(dev_net(dev));
903 rt_cache_flush(0); 903 rt_cache_flush(0);
904 arp_ifdown(dev); 904 arp_ifdown(dev);
905} 905}
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index ff9a8e643fcc..f38f093ef751 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -351,7 +351,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
351 struct sock *sk; 351 struct sock *sk;
352 struct sk_buff *skb; 352 struct sk_buff *skb;
353 353
354 sk = icmp_sk(rt->u.dst.dev->nd_net); 354 sk = icmp_sk(dev_net(rt->u.dst.dev));
355 if (ip_append_data(sk, icmp_glue_bits, icmp_param, 355 if (ip_append_data(sk, icmp_glue_bits, icmp_param,
356 icmp_param->data_len+icmp_param->head_len, 356 icmp_param->data_len+icmp_param->head_len,
357 icmp_param->head_len, 357 icmp_param->head_len,
@@ -382,7 +382,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
382{ 382{
383 struct ipcm_cookie ipc; 383 struct ipcm_cookie ipc;
384 struct rtable *rt = skb->rtable; 384 struct rtable *rt = skb->rtable;
385 struct net *net = rt->u.dst.dev->nd_net; 385 struct net *net = dev_net(rt->u.dst.dev);
386 struct sock *sk = icmp_sk(net); 386 struct sock *sk = icmp_sk(net);
387 struct inet_sock *inet = inet_sk(sk); 387 struct inet_sock *inet = inet_sk(sk);
388 __be32 daddr; 388 __be32 daddr;
@@ -447,7 +447,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
447 447
448 if (!rt) 448 if (!rt)
449 goto out; 449 goto out;
450 net = rt->u.dst.dev->nd_net; 450 net = dev_net(rt->u.dst.dev);
451 sk = icmp_sk(net); 451 sk = icmp_sk(net);
452 452
453 /* 453 /*
@@ -677,7 +677,7 @@ static void icmp_unreach(struct sk_buff *skb)
677 u32 info = 0; 677 u32 info = 0;
678 struct net *net; 678 struct net *net;
679 679
680 net = skb->dst->dev->nd_net; 680 net = dev_net(skb->dst->dev);
681 681
682 /* 682 /*
683 * Incomplete header ? 683 * Incomplete header ?
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 6a4ee8da6994..682f632bfb77 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -130,12 +130,12 @@
130 */ 130 */
131 131
132#define IGMP_V1_SEEN(in_dev) \ 132#define IGMP_V1_SEEN(in_dev) \
133 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 1 || \ 133 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), FORCE_IGMP_VERSION) == 1 || \
134 IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \ 134 IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \
135 ((in_dev)->mr_v1_seen && \ 135 ((in_dev)->mr_v1_seen && \
136 time_before(jiffies, (in_dev)->mr_v1_seen))) 136 time_before(jiffies, (in_dev)->mr_v1_seen)))
137#define IGMP_V2_SEEN(in_dev) \ 137#define IGMP_V2_SEEN(in_dev) \
138 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 2 || \ 138 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), FORCE_IGMP_VERSION) == 2 || \
139 IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \ 139 IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \
140 ((in_dev)->mr_v2_seen && \ 140 ((in_dev)->mr_v2_seen && \
141 time_before(jiffies, (in_dev)->mr_v2_seen))) 141 time_before(jiffies, (in_dev)->mr_v2_seen)))
@@ -1198,7 +1198,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1198 1198
1199 ASSERT_RTNL(); 1199 ASSERT_RTNL();
1200 1200
1201 if (in_dev->dev->nd_net != &init_net) 1201 if (dev_net(in_dev->dev) != &init_net)
1202 return; 1202 return;
1203 1203
1204 for (im=in_dev->mc_list; im; im=im->next) { 1204 for (im=in_dev->mc_list; im; im=im->next) {
@@ -1280,7 +1280,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
1280 1280
1281 ASSERT_RTNL(); 1281 ASSERT_RTNL();
1282 1282
1283 if (in_dev->dev->nd_net != &init_net) 1283 if (dev_net(in_dev->dev) != &init_net)
1284 return; 1284 return;
1285 1285
1286 for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { 1286 for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
@@ -1310,7 +1310,7 @@ void ip_mc_down(struct in_device *in_dev)
1310 1310
1311 ASSERT_RTNL(); 1311 ASSERT_RTNL();
1312 1312
1313 if (in_dev->dev->nd_net != &init_net) 1313 if (dev_net(in_dev->dev) != &init_net)
1314 return; 1314 return;
1315 1315
1316 for (i=in_dev->mc_list; i; i=i->next) 1316 for (i=in_dev->mc_list; i; i=i->next)
@@ -1333,7 +1333,7 @@ void ip_mc_init_dev(struct in_device *in_dev)
1333{ 1333{
1334 ASSERT_RTNL(); 1334 ASSERT_RTNL();
1335 1335
1336 if (in_dev->dev->nd_net != &init_net) 1336 if (dev_net(in_dev->dev) != &init_net)
1337 return; 1337 return;
1338 1338
1339 in_dev->mc_tomb = NULL; 1339 in_dev->mc_tomb = NULL;
@@ -1359,7 +1359,7 @@ void ip_mc_up(struct in_device *in_dev)
1359 1359
1360 ASSERT_RTNL(); 1360 ASSERT_RTNL();
1361 1361
1362 if (in_dev->dev->nd_net != &init_net) 1362 if (dev_net(in_dev->dev) != &init_net)
1363 return; 1363 return;
1364 1364
1365 ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS); 1365 ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
@@ -1378,7 +1378,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
1378 1378
1379 ASSERT_RTNL(); 1379 ASSERT_RTNL();
1380 1380
1381 if (in_dev->dev->nd_net != &init_net) 1381 if (dev_net(in_dev->dev) != &init_net)
1382 return; 1382 return;
1383 1383
1384 /* Deactivate timers */ 1384 /* Deactivate timers */
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 8b448c4b9080..fcb60e76b234 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -571,7 +571,7 @@ int ip_defrag(struct sk_buff *skb, u32 user)
571 571
572 IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS); 572 IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
573 573
574 net = skb->dev ? skb->dev->nd_net : skb->dst->dev->nd_net; 574 net = skb->dev ? dev_net(skb->dev) : dev_net(skb->dst->dev);
575 /* Start by cleaning up the memory. */ 575 /* Start by cleaning up the memory. */
576 if (atomic_read(&net->ipv4.frags.mem) > net->ipv4.frags.high_thresh) 576 if (atomic_read(&net->ipv4.frags.mem) > net->ipv4.frags.high_thresh)
577 ip_evictor(net); 577 ip_evictor(net);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index f9ee84420cb3..50972b397a9a 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1190,7 +1190,7 @@ static int ipgre_close(struct net_device *dev)
1190 struct ip_tunnel *t = netdev_priv(dev); 1190 struct ip_tunnel *t = netdev_priv(dev);
1191 if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) { 1191 if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) {
1192 struct in_device *in_dev; 1192 struct in_device *in_dev;
1193 in_dev = inetdev_by_index(dev->nd_net, t->mlink); 1193 in_dev = inetdev_by_index(dev_net(dev), t->mlink);
1194 if (in_dev) { 1194 if (in_dev) {
1195 ip_mc_dec_group(in_dev, t->parms.iph.daddr); 1195 ip_mc_dec_group(in_dev, t->parms.iph.daddr);
1196 in_dev_put(in_dev); 1196 in_dev_put(in_dev);
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 2aeea5d15425..26685c83a146 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -172,7 +172,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
172 if (sk && inet_sk(sk)->num == protocol && 172 if (sk && inet_sk(sk)->num == protocol &&
173 (!sk->sk_bound_dev_if || 173 (!sk->sk_bound_dev_if ||
174 sk->sk_bound_dev_if == dev->ifindex) && 174 sk->sk_bound_dev_if == dev->ifindex) &&
175 sk->sk_net == dev->nd_net) { 175 sk->sk_net == dev_net(dev)) {
176 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { 176 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
177 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) { 177 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
178 read_unlock(&ip_ra_lock); 178 read_unlock(&ip_ra_lock);
@@ -199,7 +199,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
199 199
200static int ip_local_deliver_finish(struct sk_buff *skb) 200static int ip_local_deliver_finish(struct sk_buff *skb)
201{ 201{
202 struct net *net = skb->dev->nd_net; 202 struct net *net = dev_net(skb->dev);
203 203
204 __skb_pull(skb, ip_hdrlen(skb)); 204 __skb_pull(skb, ip_hdrlen(skb));
205 205
@@ -291,7 +291,7 @@ static inline int ip_rcv_options(struct sk_buff *skb)
291 opt = &(IPCB(skb)->opt); 291 opt = &(IPCB(skb)->opt);
292 opt->optlen = iph->ihl*4 - sizeof(struct iphdr); 292 opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
293 293
294 if (ip_options_compile(dev->nd_net, opt, skb)) { 294 if (ip_options_compile(dev_net(dev), opt, skb)) {
295 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); 295 IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
296 goto drop; 296 goto drop;
297 } 297 }
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 87cc1222c600..d107543d3f81 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -145,7 +145,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
145 __be32 addr; 145 __be32 addr;
146 146
147 memcpy(&addr, sptr+soffset-1, 4); 147 memcpy(&addr, sptr+soffset-1, 4);
148 if (inet_addr_type(skb->dst->dev->nd_net, addr) != RTN_LOCAL) { 148 if (inet_addr_type(dev_net(skb->dst->dev), addr) != RTN_LOCAL) {
149 dopt->ts_needtime = 1; 149 dopt->ts_needtime = 1;
150 soffset += 8; 150 soffset += 8;
151 } 151 }
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 96138b128de8..08e8fb60d315 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -434,7 +434,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
434 unsigned char *sha, *tha; /* s for "source", t for "target" */ 434 unsigned char *sha, *tha; /* s for "source", t for "target" */
435 struct ic_device *d; 435 struct ic_device *d;
436 436
437 if (dev->nd_net != &init_net) 437 if (dev_net(dev) != &init_net)
438 goto drop; 438 goto drop;
439 439
440 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 440 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -854,7 +854,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
854 struct ic_device *d; 854 struct ic_device *d;
855 int len, ext_len; 855 int len, ext_len;
856 856
857 if (dev->nd_net != &init_net) 857 if (dev_net(dev) != &init_net)
858 goto drop; 858 goto drop;
859 859
860 /* Perform verifications before taking the lock. */ 860 /* Perform verifications before taking the lock. */
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 7d63d74ef62a..e54bc1364473 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1089,7 +1089,7 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v
1089 struct vif_device *v; 1089 struct vif_device *v;
1090 int ct; 1090 int ct;
1091 1091
1092 if (dev->nd_net != &init_net) 1092 if (dev_net(dev) != &init_net)
1093 return NOTIFY_DONE; 1093 return NOTIFY_DONE;
1094 1094
1095 if (event != NETDEV_UNREGISTER) 1095 if (event != NETDEV_UNREGISTER)
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index fe05da41d6ba..500998a2dec1 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -481,7 +481,7 @@ ipq_rcv_dev_event(struct notifier_block *this,
481{ 481{
482 struct net_device *dev = ptr; 482 struct net_device *dev = ptr;
483 483
484 if (dev->nd_net != &init_net) 484 if (dev_net(dev) != &init_net)
485 return NOTIFY_DONE; 485 return NOTIFY_DONE;
486 486
487 /* Drop any packets associated with the downed device */ 487 /* Drop any packets associated with the downed device */
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c
index c6817b18366a..84c26dd27d81 100644
--- a/net/ipv4/netfilter/ipt_MASQUERADE.c
+++ b/net/ipv4/netfilter/ipt_MASQUERADE.c
@@ -120,7 +120,7 @@ static int masq_device_event(struct notifier_block *this,
120{ 120{
121 const struct net_device *dev = ptr; 121 const struct net_device *dev = ptr;
122 122
123 if (dev->nd_net != &init_net) 123 if (dev_net(dev) != &init_net)
124 return NOTIFY_DONE; 124 return NOTIFY_DONE;
125 125
126 if (event == NETDEV_DOWN) { 126 if (event == NETDEV_DOWN) {
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 3f68a937b602..8756d502a47f 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -168,7 +168,7 @@ static int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash)
168 if (hlist_empty(head)) 168 if (hlist_empty(head))
169 goto out; 169 goto out;
170 170
171 net = skb->dev->nd_net; 171 net = dev_net(skb->dev);
172 sk = __raw_v4_lookup(net, __sk_head(head), iph->protocol, 172 sk = __raw_v4_lookup(net, __sk_head(head), iph->protocol,
173 iph->saddr, iph->daddr, 173 iph->saddr, iph->daddr,
174 skb->dev->ifindex); 174 skb->dev->ifindex);
@@ -276,7 +276,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
276 raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]); 276 raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]);
277 if (raw_sk != NULL) { 277 if (raw_sk != NULL) {
278 iph = (struct iphdr *)skb->data; 278 iph = (struct iphdr *)skb->data;
279 net = skb->dev->nd_net; 279 net = dev_net(skb->dev);
280 280
281 while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol, 281 while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol,
282 iph->daddr, iph->saddr, 282 iph->daddr, iph->saddr,
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 2941ef21f203..7768d718e199 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -284,7 +284,7 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st)
284 rcu_read_lock_bh(); 284 rcu_read_lock_bh();
285 r = rcu_dereference(rt_hash_table[st->bucket].chain); 285 r = rcu_dereference(rt_hash_table[st->bucket].chain);
286 while (r) { 286 while (r) {
287 if (r->u.dst.dev->nd_net == st->p.net && 287 if (dev_net(r->u.dst.dev) == st->p.net &&
288 r->rt_genid == st->genid) 288 r->rt_genid == st->genid)
289 return r; 289 return r;
290 r = rcu_dereference(r->u.dst.rt_next); 290 r = rcu_dereference(r->u.dst.rt_next);
@@ -312,7 +312,7 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st,
312 struct rtable *r) 312 struct rtable *r)
313{ 313{
314 while ((r = __rt_cache_get_next(st, r)) != NULL) { 314 while ((r = __rt_cache_get_next(st, r)) != NULL) {
315 if (r->u.dst.dev->nd_net != st->p.net) 315 if (dev_net(r->u.dst.dev) != st->p.net)
316 continue; 316 continue;
317 if (r->rt_genid == st->genid) 317 if (r->rt_genid == st->genid)
318 break; 318 break;
@@ -680,7 +680,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
680 680
681static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) 681static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
682{ 682{
683 return rt1->u.dst.dev->nd_net == rt2->u.dst.dev->nd_net; 683 return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev);
684} 684}
685 685
686/* 686/*
@@ -1164,7 +1164,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1164 if (!in_dev) 1164 if (!in_dev)
1165 return; 1165 return;
1166 1166
1167 net = dev->nd_net; 1167 net = dev_net(dev);
1168 if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) 1168 if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev)
1169 || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) 1169 || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw)
1170 || ipv4_is_zeronet(new_gw)) 1170 || ipv4_is_zeronet(new_gw))
@@ -1195,7 +1195,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1195 rth->fl.oif != ikeys[k] || 1195 rth->fl.oif != ikeys[k] ||
1196 rth->fl.iif != 0 || 1196 rth->fl.iif != 0 ||
1197 rth->rt_genid != atomic_read(&rt_genid) || 1197 rth->rt_genid != atomic_read(&rt_genid) ||
1198 rth->u.dst.dev->nd_net != net) { 1198 dev_net(rth->u.dst.dev) != net) {
1199 rthp = &rth->u.dst.rt_next; 1199 rthp = &rth->u.dst.rt_next;
1200 continue; 1200 continue;
1201 } 1201 }
@@ -1454,7 +1454,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
1454 rth->rt_src == iph->saddr && 1454 rth->rt_src == iph->saddr &&
1455 rth->fl.iif == 0 && 1455 rth->fl.iif == 0 &&
1456 !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && 1456 !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) &&
1457 rth->u.dst.dev->nd_net == net && 1457 dev_net(rth->u.dst.dev) == net &&
1458 rth->rt_genid == atomic_read(&rt_genid)) { 1458 rth->rt_genid == atomic_read(&rt_genid)) {
1459 unsigned short mtu = new_mtu; 1459 unsigned short mtu = new_mtu;
1460 1460
@@ -1530,9 +1530,9 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
1530{ 1530{
1531 struct rtable *rt = (struct rtable *) dst; 1531 struct rtable *rt = (struct rtable *) dst;
1532 struct in_device *idev = rt->idev; 1532 struct in_device *idev = rt->idev;
1533 if (dev != dev->nd_net->loopback_dev && idev && idev->dev == dev) { 1533 if (dev != dev_net(dev)->loopback_dev && idev && idev->dev == dev) {
1534 struct in_device *loopback_idev = 1534 struct in_device *loopback_idev =
1535 in_dev_get(dev->nd_net->loopback_dev); 1535 in_dev_get(dev_net(dev)->loopback_dev);
1536 if (loopback_idev) { 1536 if (loopback_idev) {
1537 rt->idev = loopback_idev; 1537 rt->idev = loopback_idev;
1538 in_dev_put(idev); 1538 in_dev_put(idev);
@@ -1576,7 +1576,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt)
1576 1576
1577 if (rt->fl.iif == 0) 1577 if (rt->fl.iif == 0)
1578 src = rt->rt_src; 1578 src = rt->rt_src;
1579 else if (fib_lookup(rt->u.dst.dev->nd_net, &rt->fl, &res) == 0) { 1579 else if (fib_lookup(dev_net(rt->u.dst.dev), &rt->fl, &res) == 0) {
1580 src = FIB_RES_PREFSRC(res); 1580 src = FIB_RES_PREFSRC(res);
1581 fib_res_put(&res); 1581 fib_res_put(&res);
1582 } else 1582 } else
@@ -1900,7 +1900,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1900 __be32 spec_dst; 1900 __be32 spec_dst;
1901 int err = -EINVAL; 1901 int err = -EINVAL;
1902 int free_res = 0; 1902 int free_res = 0;
1903 struct net * net = dev->nd_net; 1903 struct net * net = dev_net(dev);
1904 1904
1905 /* IP on this device is disabled. */ 1905 /* IP on this device is disabled. */
1906 1906
@@ -2071,7 +2071,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2071 int iif = dev->ifindex; 2071 int iif = dev->ifindex;
2072 struct net *net; 2072 struct net *net;
2073 2073
2074 net = dev->nd_net; 2074 net = dev_net(dev);
2075 tos &= IPTOS_RT_MASK; 2075 tos &= IPTOS_RT_MASK;
2076 hash = rt_hash(daddr, saddr, iif); 2076 hash = rt_hash(daddr, saddr, iif);
2077 2077
@@ -2084,7 +2084,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2084 rth->fl.oif == 0 && 2084 rth->fl.oif == 0 &&
2085 rth->fl.mark == skb->mark && 2085 rth->fl.mark == skb->mark &&
2086 rth->fl.fl4_tos == tos && 2086 rth->fl.fl4_tos == tos &&
2087 rth->u.dst.dev->nd_net == net && 2087 dev_net(rth->u.dst.dev) == net &&
2088 rth->rt_genid == atomic_read(&rt_genid)) { 2088 rth->rt_genid == atomic_read(&rt_genid)) {
2089 dst_use(&rth->u.dst, jiffies); 2089 dst_use(&rth->u.dst, jiffies);
2090 RT_CACHE_STAT_INC(in_hit); 2090 RT_CACHE_STAT_INC(in_hit);
@@ -2486,7 +2486,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
2486 rth->fl.mark == flp->mark && 2486 rth->fl.mark == flp->mark &&
2487 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2487 !((rth->fl.fl4_tos ^ flp->fl4_tos) &
2488 (IPTOS_RT_MASK | RTO_ONLINK)) && 2488 (IPTOS_RT_MASK | RTO_ONLINK)) &&
2489 rth->u.dst.dev->nd_net == net && 2489 dev_net(rth->u.dst.dev) == net &&
2490 rth->rt_genid == atomic_read(&rt_genid)) { 2490 rth->rt_genid == atomic_read(&rt_genid)) {
2491 dst_use(&rth->u.dst, jiffies); 2491 dst_use(&rth->u.dst, jiffies);
2492 RT_CACHE_STAT_INC(out_hit); 2492 RT_CACHE_STAT_INC(out_hit);
@@ -2795,7 +2795,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2795 rcu_read_lock_bh(); 2795 rcu_read_lock_bh();
2796 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; 2796 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
2797 rt = rcu_dereference(rt->u.dst.rt_next), idx++) { 2797 rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
2798 if (rt->u.dst.dev->nd_net != net || idx < s_idx) 2798 if (dev_net(rt->u.dst.dev) != net || idx < s_idx)
2799 continue; 2799 continue;
2800 if (rt->rt_genid != atomic_read(&rt_genid)) 2800 if (rt->rt_genid != atomic_read(&rt_genid))
2801 continue; 2801 continue;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 649d00a50cb1..28bece6f281b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -353,7 +353,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
353 return; 353 return;
354 } 354 }
355 355
356 sk = inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->daddr, th->dest, 356 sk = inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->daddr, th->dest,
357 iph->saddr, th->source, inet_iif(skb)); 357 iph->saddr, th->source, inet_iif(skb));
358 if (!sk) { 358 if (!sk) {
359 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); 359 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
@@ -1644,7 +1644,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
1644 TCP_SKB_CB(skb)->flags = iph->tos; 1644 TCP_SKB_CB(skb)->flags = iph->tos;
1645 TCP_SKB_CB(skb)->sacked = 0; 1645 TCP_SKB_CB(skb)->sacked = 0;
1646 1646
1647 sk = __inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->saddr, 1647 sk = __inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->saddr,
1648 th->source, iph->daddr, th->dest, inet_iif(skb)); 1648 th->source, iph->daddr, th->dest, inet_iif(skb));
1649 if (!sk) 1649 if (!sk)
1650 goto no_tcp_socket; 1650 goto no_tcp_socket;
@@ -1718,7 +1718,7 @@ do_time_wait:
1718 } 1718 }
1719 switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) { 1719 switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
1720 case TCP_TW_SYN: { 1720 case TCP_TW_SYN: {
1721 struct sock *sk2 = inet_lookup_listener(skb->dev->nd_net, 1721 struct sock *sk2 = inet_lookup_listener(dev_net(skb->dev),
1722 &tcp_hashinfo, 1722 &tcp_hashinfo,
1723 iph->daddr, th->dest, 1723 iph->daddr, th->dest,
1724 inet_iif(skb)); 1724 inet_iif(skb));
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b37581dfd029..e2cd93481359 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -357,7 +357,7 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[])
357 int harderr; 357 int harderr;
358 int err; 358 int err;
359 359
360 sk = __udp4_lib_lookup(skb->dev->nd_net, iph->daddr, uh->dest, 360 sk = __udp4_lib_lookup(dev_net(skb->dev), iph->daddr, uh->dest,
361 iph->saddr, uh->source, skb->dev->ifindex, udptable); 361 iph->saddr, uh->source, skb->dev->ifindex, udptable);
362 if (sk == NULL) { 362 if (sk == NULL) {
363 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); 363 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
@@ -1181,7 +1181,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1181 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) 1181 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
1182 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); 1182 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
1183 1183
1184 sk = __udp4_lib_lookup(skb->dev->nd_net, saddr, uh->source, daddr, 1184 sk = __udp4_lib_lookup(dev_net(skb->dev), saddr, uh->source, daddr,
1185 uh->dest, inet_iif(skb), udptable); 1185 uh->dest, inet_iif(skb), udptable);
1186 1186
1187 if (sk != NULL) { 1187 if (sk != NULL) {
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 10ed70491434..c63de0a72aba 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -221,7 +221,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
221 xdst = (struct xfrm_dst *)dst; 221 xdst = (struct xfrm_dst *)dst;
222 if (xdst->u.rt.idev->dev == dev) { 222 if (xdst->u.rt.idev->dev == dev) {
223 struct in_device *loopback_idev = 223 struct in_device *loopback_idev =
224 in_dev_get(dev->nd_net->loopback_dev); 224 in_dev_get(dev_net(dev)->loopback_dev);
225 BUG_ON(!loopback_idev); 225 BUG_ON(!loopback_idev);
226 226
227 do { 227 do {