aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-07-20 01:34:43 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-20 01:34:43 -0400
commit721499e8931c5732202481ae24f2dfbf9910f129 (patch)
treec94d8d681966109bb41f712f21f3a9825ae2172d /net
parent407d819cf0fd54c6fc1138a509225696aecafd15 (diff)
netns: Use net_eq() to compare net-namespaces for optimization.
Without CONFIG_NET_NS, namespace is always &init_net. Compiler will be able to omit namespace comparisons with this patch. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/appletalk/aarp.c4
-rw-r--r--net/appletalk/ddp.c6
-rw-r--r--net/atm/clip.c2
-rw-r--r--net/atm/mpc.c2
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/ax25/ax25_in.c2
-rw-r--r--net/bridge/br_notify.c2
-rw-r--r--net/bridge/br_stp_bpdu.c2
-rw-r--r--net/can/af_can.c4
-rw-r--r--net/can/bcm.c2
-rw-r--r--net/can/raw.c2
-rw-r--r--net/core/pktgen.c2
-rw-r--r--net/decnet/af_decnet.c2
-rw-r--r--net/decnet/dn_route.c2
-rw-r--r--net/econet/af_econet.c4
-rw-r--r--net/ipv4/igmp.c26
-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/ipv6/ip6mr.c2
-rw-r--r--net/ipv6/netfilter/ip6_queue.c2
-rw-r--r--net/ipv6/proc.c2
-rw-r--r--net/ipx/af_ipx.c4
-rw-r--r--net/irda/irlap_frame.c2
-rw-r--r--net/llc/llc_input.c2
-rw-r--r--net/netfilter/nf_sockopt.c2
-rw-r--r--net/netfilter/nfnetlink_queue.c2
-rw-r--r--net/netlabel/netlabel_unlabeled.c2
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/tipc/eth_media.c4
-rw-r--r--net/wireless/wext.c2
-rw-r--r--net/x25/af_x25.c2
-rw-r--r--net/x25/x25_dev.c2
-rw-r--r--net/xfrm/xfrm_policy.c2
38 files changed, 58 insertions, 58 deletions
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index 25aa37ce943..b25c1e909d1 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -333,7 +333,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event,
333 struct net_device *dev = ptr; 333 struct net_device *dev = ptr;
334 int ct; 334 int ct;
335 335
336 if (dev_net(dev) != &init_net) 336 if (!net_eq(dev_net(dev), &init_net))
337 return NOTIFY_DONE; 337 return NOTIFY_DONE;
338 338
339 if (event == NETDEV_DOWN) { 339 if (event == NETDEV_DOWN) {
@@ -716,7 +716,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
716 struct atalk_addr sa, *ma, da; 716 struct atalk_addr sa, *ma, da;
717 struct atalk_iface *ifa; 717 struct atalk_iface *ifa;
718 718
719 if (dev_net(dev) != &init_net) 719 if (!net_eq(dev_net(dev), &init_net))
720 goto out0; 720 goto out0;
721 721
722 /* We only do Ethernet SNAP AARP. */ 722 /* We only do Ethernet SNAP AARP. */
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 44cd42f7786..07b5b82c5ea 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -648,7 +648,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event,
648{ 648{
649 struct net_device *dev = ptr; 649 struct net_device *dev = ptr;
650 650
651 if (dev_net(dev) != &init_net) 651 if (!net_eq(dev_net(dev), &init_net))
652 return NOTIFY_DONE; 652 return NOTIFY_DONE;
653 653
654 if (event == NETDEV_DOWN) 654 if (event == NETDEV_DOWN)
@@ -1405,7 +1405,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1405 int origlen; 1405 int origlen;
1406 __u16 len_hops; 1406 __u16 len_hops;
1407 1407
1408 if (dev_net(dev) != &init_net) 1408 if (!net_eq(dev_net(dev), &init_net))
1409 goto freeit; 1409 goto freeit;
1410 1410
1411 /* Don't mangle buffer if shared */ 1411 /* Don't mangle buffer if shared */
@@ -1493,7 +1493,7 @@ freeit:
1493static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, 1493static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
1494 struct packet_type *pt, struct net_device *orig_dev) 1494 struct packet_type *pt, struct net_device *orig_dev)
1495{ 1495{
1496 if (dev_net(dev) != &init_net) 1496 if (!net_eq(dev_net(dev), &init_net))
1497 goto freeit; 1497 goto freeit;
1498 1498
1499 /* Expand any short form frames */ 1499 /* Expand any short form frames */
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 6f8223ebf55..5b5b96344ce 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -612,7 +612,7 @@ static int clip_device_event(struct notifier_block *this, unsigned long event,
612{ 612{
613 struct net_device *dev = arg; 613 struct net_device *dev = arg;
614 614
615 if (dev_net(dev) != &init_net) 615 if (!net_eq(dev_net(dev), &init_net))
616 return NOTIFY_DONE; 616 return NOTIFY_DONE;
617 617
618 if (event == NETDEV_UNREGISTER) { 618 if (event == NETDEV_UNREGISTER) {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 9db332e7a6c..4fccaa1e07b 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -964,7 +964,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo
964 964
965 dev = (struct net_device *)dev_ptr; 965 dev = (struct net_device *)dev_ptr;
966 966
967 if (dev_net(dev) != &init_net) 967 if (!net_eq(dev_net(dev), &init_net))
968 return NOTIFY_DONE; 968 return NOTIFY_DONE;
969 969
970 if (dev->name == NULL || strncmp(dev->name, "lec", 3)) 970 if (dev->name == NULL || strncmp(dev->name, "lec", 3))
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 97eaa23ad9e..01c83e2a4c1 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -116,7 +116,7 @@ static int ax25_device_event(struct notifier_block *this, unsigned long event,
116{ 116{
117 struct net_device *dev = (struct net_device *)ptr; 117 struct net_device *dev = (struct net_device *)ptr;
118 118
119 if (dev_net(dev) != &init_net) 119 if (!net_eq(dev_net(dev), &init_net))
120 return NOTIFY_DONE; 120 return NOTIFY_DONE;
121 121
122 /* Reject non AX.25 devices */ 122 /* Reject non AX.25 devices */
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 33790a8efbc..4a5ba978a80 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -451,7 +451,7 @@ int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
451 skb->sk = NULL; /* Initially we don't know who it's for */ 451 skb->sk = NULL; /* Initially we don't know who it's for */
452 skb->destructor = NULL; /* Who initializes this, dammit?! */ 452 skb->destructor = NULL; /* Who initializes this, dammit?! */
453 453
454 if (dev_net(dev) != &init_net) { 454 if (!net_eq(dev_net(dev), &init_net)) {
455 kfree_skb(skb); 455 kfree_skb(skb);
456 return 0; 456 return 0;
457 } 457 }
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index 88d8ec7b314..76340bdd052 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -35,7 +35,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
35 struct net_bridge_port *p = dev->br_port; 35 struct net_bridge_port *p = dev->br_port;
36 struct net_bridge *br; 36 struct net_bridge *br;
37 37
38 if (dev_net(dev) != &init_net) 38 if (!net_eq(dev_net(dev), &init_net))
39 return NOTIFY_DONE; 39 return NOTIFY_DONE;
40 40
41 /* not a port of a bridge */ 41 /* not a port of a bridge */
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 99647617451..8b200f96f72 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -140,7 +140,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
140 struct net_bridge *br; 140 struct net_bridge *br;
141 const unsigned char *buf; 141 const unsigned char *buf;
142 142
143 if (dev_net(dev) != &init_net) 143 if (!net_eq(dev_net(dev), &init_net))
144 goto err; 144 goto err;
145 145
146 if (!p) 146 if (!p)
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 484bbf6dd03..8035fbf526a 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -615,7 +615,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
615 struct can_frame *cf = (struct can_frame *)skb->data; 615 struct can_frame *cf = (struct can_frame *)skb->data;
616 int matches; 616 int matches;
617 617
618 if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) { 618 if (dev->type != ARPHRD_CAN || !net_eq(dev_net(dev), &init_net)) {
619 kfree_skb(skb); 619 kfree_skb(skb);
620 return 0; 620 return 0;
621 } 621 }
@@ -728,7 +728,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
728 struct net_device *dev = (struct net_device *)data; 728 struct net_device *dev = (struct net_device *)data;
729 struct dev_rcv_lists *d; 729 struct dev_rcv_lists *d;
730 730
731 if (dev_net(dev) != &init_net) 731 if (!net_eq(dev_net(dev), &init_net))
732 return NOTIFY_DONE; 732 return NOTIFY_DONE;
733 733
734 if (dev->type != ARPHRD_CAN) 734 if (dev->type != ARPHRD_CAN)
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 72c2ce904f8..d0dd382001e 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1303,7 +1303,7 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
1303 struct bcm_op *op; 1303 struct bcm_op *op;
1304 int notify_enodev = 0; 1304 int notify_enodev = 0;
1305 1305
1306 if (dev_net(dev) != &init_net) 1306 if (!net_eq(dev_net(dev), &init_net))
1307 return NOTIFY_DONE; 1307 return NOTIFY_DONE;
1308 1308
1309 if (dev->type != ARPHRD_CAN) 1309 if (dev->type != ARPHRD_CAN)
diff --git a/net/can/raw.c b/net/can/raw.c
index 3e46ee36a1a..6e0663faaf9 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -210,7 +210,7 @@ static int raw_notifier(struct notifier_block *nb,
210 struct raw_sock *ro = container_of(nb, struct raw_sock, notifier); 210 struct raw_sock *ro = container_of(nb, struct raw_sock, notifier);
211 struct sock *sk = &ro->sk; 211 struct sock *sk = &ro->sk;
212 212
213 if (dev_net(dev) != &init_net) 213 if (!net_eq(dev_net(dev), &init_net))
214 return NOTIFY_DONE; 214 return NOTIFY_DONE;
215 215
216 if (dev->type != ARPHRD_CAN) 216 if (dev->type != ARPHRD_CAN)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 906802db4ed..c7d484f7e1c 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1875,7 +1875,7 @@ static int pktgen_device_event(struct notifier_block *unused,
1875{ 1875{
1876 struct net_device *dev = ptr; 1876 struct net_device *dev = ptr;
1877 1877
1878 if (dev_net(dev) != &init_net) 1878 if (!net_eq(dev_net(dev), &init_net))
1879 return NOTIFY_DONE; 1879 return NOTIFY_DONE;
1880 1880
1881 /* It is OK that we do not hold the group lock right now, 1881 /* It is OK that we do not hold the group lock right now,
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 61b7df577dd..3c23ab33dbc 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -2089,7 +2089,7 @@ static int dn_device_event(struct notifier_block *this, unsigned long event,
2089{ 2089{
2090 struct net_device *dev = (struct net_device *)ptr; 2090 struct net_device *dev = (struct net_device *)ptr;
2091 2091
2092 if (dev_net(dev) != &init_net) 2092 if (!net_eq(dev_net(dev), &init_net))
2093 return NOTIFY_DONE; 2093 return NOTIFY_DONE;
2094 2094
2095 switch(event) { 2095 switch(event) {
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index f50e88bf266..821bd1cdec0 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -580,7 +580,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
580 struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; 580 struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr;
581 unsigned char padlen = 0; 581 unsigned char padlen = 0;
582 582
583 if (dev_net(dev) != &init_net) 583 if (!net_eq(dev_net(dev), &init_net))
584 goto dump_it; 584 goto dump_it;
585 585
586 if (dn == NULL) 586 if (dn == NULL)
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index d35127bb84e..8789d2bb1b0 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -1062,7 +1062,7 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
1062 struct sock *sk; 1062 struct sock *sk;
1063 struct ec_device *edev = dev->ec_ptr; 1063 struct ec_device *edev = dev->ec_ptr;
1064 1064
1065 if (dev_net(dev) != &init_net) 1065 if (!net_eq(dev_net(dev), &init_net))
1066 goto drop; 1066 goto drop;
1067 1067
1068 if (skb->pkt_type == PACKET_OTHERHOST) 1068 if (skb->pkt_type == PACKET_OTHERHOST)
@@ -1119,7 +1119,7 @@ static int econet_notifier(struct notifier_block *this, unsigned long msg, void
1119 struct net_device *dev = (struct net_device *)data; 1119 struct net_device *dev = (struct net_device *)data;
1120 struct ec_device *edev; 1120 struct ec_device *edev;
1121 1121
1122 if (dev_net(dev) != &init_net) 1122 if (!net_eq(dev_net(dev), &init_net))
1123 return NOTIFY_DONE; 1123 return NOTIFY_DONE;
1124 1124
1125 switch (msg) { 1125 switch (msg) {
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 68e84a933e9..6203ece5360 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1196,7 +1196,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1196 1196
1197 ASSERT_RTNL(); 1197 ASSERT_RTNL();
1198 1198
1199 if (dev_net(in_dev->dev) != &init_net) 1199 if (!net_eq(dev_net(in_dev->dev), &init_net))
1200 return; 1200 return;
1201 1201
1202 for (im=in_dev->mc_list; im; im=im->next) { 1202 for (im=in_dev->mc_list; im; im=im->next) {
@@ -1278,7 +1278,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
1278 1278
1279 ASSERT_RTNL(); 1279 ASSERT_RTNL();
1280 1280
1281 if (dev_net(in_dev->dev) != &init_net) 1281 if (!net_eq(dev_net(in_dev->dev), &init_net))
1282 return; 1282 return;
1283 1283
1284 for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { 1284 for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
@@ -1308,7 +1308,7 @@ void ip_mc_down(struct in_device *in_dev)
1308 1308
1309 ASSERT_RTNL(); 1309 ASSERT_RTNL();
1310 1310
1311 if (dev_net(in_dev->dev) != &init_net) 1311 if (!net_eq(dev_net(in_dev->dev), &init_net))
1312 return; 1312 return;
1313 1313
1314 for (i=in_dev->mc_list; i; i=i->next) 1314 for (i=in_dev->mc_list; i; i=i->next)
@@ -1331,7 +1331,7 @@ void ip_mc_init_dev(struct in_device *in_dev)
1331{ 1331{
1332 ASSERT_RTNL(); 1332 ASSERT_RTNL();
1333 1333
1334 if (dev_net(in_dev->dev) != &init_net) 1334 if (!net_eq(dev_net(in_dev->dev), &init_net))
1335 return; 1335 return;
1336 1336
1337 in_dev->mc_tomb = NULL; 1337 in_dev->mc_tomb = NULL;
@@ -1357,7 +1357,7 @@ void ip_mc_up(struct in_device *in_dev)
1357 1357
1358 ASSERT_RTNL(); 1358 ASSERT_RTNL();
1359 1359
1360 if (dev_net(in_dev->dev) != &init_net) 1360 if (!net_eq(dev_net(in_dev->dev), &init_net))
1361 return; 1361 return;
1362 1362
1363 ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS); 1363 ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
@@ -1376,7 +1376,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
1376 1376
1377 ASSERT_RTNL(); 1377 ASSERT_RTNL();
1378 1378
1379 if (dev_net(in_dev->dev) != &init_net) 1379 if (!net_eq(dev_net(in_dev->dev), &init_net))
1380 return; 1380 return;
1381 1381
1382 /* Deactivate timers */ 1382 /* Deactivate timers */
@@ -1760,7 +1760,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
1760 if (!ipv4_is_multicast(addr)) 1760 if (!ipv4_is_multicast(addr))
1761 return -EINVAL; 1761 return -EINVAL;
1762 1762
1763 if (sock_net(sk) != &init_net) 1763 if (!net_eq(sock_net(sk), &init_net))
1764 return -EPROTONOSUPPORT; 1764 return -EPROTONOSUPPORT;
1765 1765
1766 rtnl_lock(); 1766 rtnl_lock();
@@ -1831,7 +1831,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
1831 u32 ifindex; 1831 u32 ifindex;
1832 int ret = -EADDRNOTAVAIL; 1832 int ret = -EADDRNOTAVAIL;
1833 1833
1834 if (sock_net(sk) != &init_net) 1834 if (!net_eq(sock_net(sk), &init_net))
1835 return -EPROTONOSUPPORT; 1835 return -EPROTONOSUPPORT;
1836 1836
1837 rtnl_lock(); 1837 rtnl_lock();
@@ -1879,7 +1879,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
1879 if (!ipv4_is_multicast(addr)) 1879 if (!ipv4_is_multicast(addr))
1880 return -EINVAL; 1880 return -EINVAL;
1881 1881
1882 if (sock_net(sk) != &init_net) 1882 if (!net_eq(sock_net(sk), &init_net))
1883 return -EPROTONOSUPPORT; 1883 return -EPROTONOSUPPORT;
1884 1884
1885 rtnl_lock(); 1885 rtnl_lock();
@@ -2015,7 +2015,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
2015 msf->imsf_fmode != MCAST_EXCLUDE) 2015 msf->imsf_fmode != MCAST_EXCLUDE)
2016 return -EINVAL; 2016 return -EINVAL;
2017 2017
2018 if (sock_net(sk) != &init_net) 2018 if (!net_eq(sock_net(sk), &init_net))
2019 return -EPROTONOSUPPORT; 2019 return -EPROTONOSUPPORT;
2020 2020
2021 rtnl_lock(); 2021 rtnl_lock();
@@ -2098,7 +2098,7 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
2098 if (!ipv4_is_multicast(addr)) 2098 if (!ipv4_is_multicast(addr))
2099 return -EINVAL; 2099 return -EINVAL;
2100 2100
2101 if (sock_net(sk) != &init_net) 2101 if (!net_eq(sock_net(sk), &init_net))
2102 return -EPROTONOSUPPORT; 2102 return -EPROTONOSUPPORT;
2103 2103
2104 rtnl_lock(); 2104 rtnl_lock();
@@ -2163,7 +2163,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
2163 if (!ipv4_is_multicast(addr)) 2163 if (!ipv4_is_multicast(addr))
2164 return -EINVAL; 2164 return -EINVAL;
2165 2165
2166 if (sock_net(sk) != &init_net) 2166 if (!net_eq(sock_net(sk), &init_net))
2167 return -EPROTONOSUPPORT; 2167 return -EPROTONOSUPPORT;
2168 2168
2169 rtnl_lock(); 2169 rtnl_lock();
@@ -2250,7 +2250,7 @@ void ip_mc_drop_socket(struct sock *sk)
2250 if (inet->mc_list == NULL) 2250 if (inet->mc_list == NULL)
2251 return; 2251 return;
2252 2252
2253 if (sock_net(sk) != &init_net) 2253 if (!net_eq(sock_net(sk), &init_net))
2254 return; 2254 return;
2255 2255
2256 rtnl_lock(); 2256 rtnl_lock();
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index b88aa9afa42..42065fff46c 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -432,7 +432,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
432 unsigned char *sha, *tha; /* s for "source", t for "target" */ 432 unsigned char *sha, *tha; /* s for "source", t for "target" */
433 struct ic_device *d; 433 struct ic_device *d;
434 434
435 if (dev_net(dev) != &init_net) 435 if (!net_eq(dev_net(dev), &init_net))
436 goto drop; 436 goto drop;
437 437
438 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 438 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -852,7 +852,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
852 struct ic_device *d; 852 struct ic_device *d;
853 int len, ext_len; 853 int len, ext_len;
854 854
855 if (dev_net(dev) != &init_net) 855 if (!net_eq(dev_net(dev), &init_net))
856 goto drop; 856 goto drop;
857 857
858 /* Perform verifications before taking the lock. */ 858 /* Perform verifications before taking the lock. */
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 033c712c3a5..c519b8d30ee 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1124,7 +1124,7 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v
1124 struct vif_device *v; 1124 struct vif_device *v;
1125 int ct; 1125 int ct;
1126 1126
1127 if (dev_net(dev) != &init_net) 1127 if (!net_eq(dev_net(dev), &init_net))
1128 return NOTIFY_DONE; 1128 return NOTIFY_DONE;
1129 1129
1130 if (event != NETDEV_UNREGISTER) 1130 if (event != NETDEV_UNREGISTER)
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index aa33a4a7a71..432ce9d1c11 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -477,7 +477,7 @@ ipq_rcv_dev_event(struct notifier_block *this,
477{ 477{
478 struct net_device *dev = ptr; 478 struct net_device *dev = ptr;
479 479
480 if (dev_net(dev) != &init_net) 480 if (!net_eq(dev_net(dev), &init_net))
481 return NOTIFY_DONE; 481 return NOTIFY_DONE;
482 482
483 /* Drop any packets associated with the downed device */ 483 /* 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 84c26dd27d8..0841aefaa50 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_net(dev) != &init_net) 123 if (!net_eq(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/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0b41aa2675f..095bc453ff4 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -935,7 +935,7 @@ static int ip6mr_device_event(struct notifier_block *this,
935 struct mif_device *v; 935 struct mif_device *v;
936 int ct; 936 int ct;
937 937
938 if (dev_net(dev) != &init_net) 938 if (!net_eq(dev_net(dev), &init_net))
939 return NOTIFY_DONE; 939 return NOTIFY_DONE;
940 940
941 if (event != NETDEV_UNREGISTER) 941 if (event != NETDEV_UNREGISTER)
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 1b8815f6153..5859c046cbc 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -480,7 +480,7 @@ ipq_rcv_dev_event(struct notifier_block *this,
480{ 480{
481 struct net_device *dev = ptr; 481 struct net_device *dev = ptr;
482 482
483 if (dev_net(dev) != &init_net) 483 if (!net_eq(dev_net(dev), &init_net))
484 return NOTIFY_DONE; 484 return NOTIFY_DONE;
485 485
486 /* Drop any packets associated with the downed device */ 486 /* Drop any packets associated with the downed device */
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 70940b3654a..f82f6074cf8 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -214,7 +214,7 @@ int snmp6_register_dev(struct inet6_dev *idev)
214 if (!idev || !idev->dev) 214 if (!idev || !idev->dev)
215 return -EINVAL; 215 return -EINVAL;
216 216
217 if (dev_net(idev->dev) != &init_net) 217 if (!net_eq(dev_net(idev->dev), &init_net))
218 return 0; 218 return 0;
219 219
220 if (!proc_net_devsnmp6) 220 if (!proc_net_devsnmp6)
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 81ae8735f5e..b6e70f92e7f 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -335,7 +335,7 @@ static int ipxitf_device_event(struct notifier_block *notifier,
335 struct net_device *dev = ptr; 335 struct net_device *dev = ptr;
336 struct ipx_interface *i, *tmp; 336 struct ipx_interface *i, *tmp;
337 337
338 if (dev_net(dev) != &init_net) 338 if (!net_eq(dev_net(dev), &init_net))
339 return NOTIFY_DONE; 339 return NOTIFY_DONE;
340 340
341 if (event != NETDEV_DOWN && event != NETDEV_UP) 341 if (event != NETDEV_DOWN && event != NETDEV_UP)
@@ -1636,7 +1636,7 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
1636 u16 ipx_pktsize; 1636 u16 ipx_pktsize;
1637 int rc = 0; 1637 int rc = 0;
1638 1638
1639 if (dev_net(dev) != &init_net) 1639 if (!net_eq(dev_net(dev), &init_net))
1640 goto drop; 1640 goto drop;
1641 1641
1642 /* Not ours */ 1642 /* Not ours */
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 90894534f3c..f17b65af9c9 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -1326,7 +1326,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
1326 int command; 1326 int command;
1327 __u8 control; 1327 __u8 control;
1328 1328
1329 if (dev_net(dev) != &init_net) 1329 if (!net_eq(dev_net(dev), &init_net))
1330 goto out; 1330 goto out;
1331 1331
1332 /* FIXME: should we get our own field? */ 1332 /* FIXME: should we get our own field? */
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 1c45f172991..57ad974e4d9 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -150,7 +150,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
150 int (*rcv)(struct sk_buff *, struct net_device *, 150 int (*rcv)(struct sk_buff *, struct net_device *,
151 struct packet_type *, struct net_device *); 151 struct packet_type *, struct net_device *);
152 152
153 if (dev_net(dev) != &init_net) 153 if (!net_eq(dev_net(dev), &init_net))
154 goto drop; 154 goto drop;
155 155
156 /* 156 /*
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c
index 69d699f95f4..01489681fa9 100644
--- a/net/netfilter/nf_sockopt.c
+++ b/net/netfilter/nf_sockopt.c
@@ -65,7 +65,7 @@ static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, int pf,
65{ 65{
66 struct nf_sockopt_ops *ops; 66 struct nf_sockopt_ops *ops;
67 67
68 if (sock_net(sk) != &init_net) 68 if (!net_eq(sock_net(sk), &init_net))
69 return ERR_PTR(-ENOPROTOOPT); 69 return ERR_PTR(-ENOPROTOOPT);
70 70
71 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 71 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 04e9c965f8c..8c860112ce0 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -555,7 +555,7 @@ nfqnl_rcv_dev_event(struct notifier_block *this,
555{ 555{
556 struct net_device *dev = ptr; 556 struct net_device *dev = ptr;
557 557
558 if (dev_net(dev) != &init_net) 558 if (!net_eq(dev_net(dev), &init_net))
559 return NOTIFY_DONE; 559 return NOTIFY_DONE;
560 560
561 /* Drop any packets associated with the downed device */ 561 /* Drop any packets associated with the downed device */
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 56f80872924..921c118ead8 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -954,7 +954,7 @@ static int netlbl_unlhsh_netdev_handler(struct notifier_block *this,
954 struct net_device *dev = ptr; 954 struct net_device *dev = ptr;
955 struct netlbl_unlhsh_iface *iface = NULL; 955 struct netlbl_unlhsh_iface *iface = NULL;
956 956
957 if (dev_net(dev) != &init_net) 957 if (!net_eq(dev_net(dev), &init_net))
958 return NOTIFY_DONE; 958 return NOTIFY_DONE;
959 959
960 /* XXX - should this be a check for NETDEV_DOWN or _UNREGISTER? */ 960 /* XXX - should this be a check for NETDEV_DOWN or _UNREGISTER? */
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index d41be0d66eb..fccc250f95f 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -118,7 +118,7 @@ static int nr_device_event(struct notifier_block *this, unsigned long event, voi
118{ 118{
119 struct net_device *dev = (struct net_device *)ptr; 119 struct net_device *dev = (struct net_device *)ptr;
120 120
121 if (dev_net(dev) != &init_net) 121 if (!net_eq(dev_net(dev), &init_net))
122 return NOTIFY_DONE; 122 return NOTIFY_DONE;
123 123
124 if (event != NETDEV_DOWN) 124 if (event != NETDEV_DOWN)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index de73bcb5235..d56cae112dc 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1677,7 +1677,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
1677 case SIOCGIFDSTADDR: 1677 case SIOCGIFDSTADDR:
1678 case SIOCSIFDSTADDR: 1678 case SIOCSIFDSTADDR:
1679 case SIOCSIFFLAGS: 1679 case SIOCSIFFLAGS:
1680 if (sock_net(sk) != &init_net) 1680 if (!net_eq(sock_net(sk), &init_net))
1681 return -ENOIOCTLCMD; 1681 return -ENOIOCTLCMD;
1682 return inet_dgram_ops.ioctl(sock, cmd, arg); 1682 return inet_dgram_ops.ioctl(sock, cmd, arg);
1683#endif 1683#endif
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index f3a691f3490..dbc963b4f5f 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -209,7 +209,7 @@ static int rose_device_event(struct notifier_block *this, unsigned long event,
209{ 209{
210 struct net_device *dev = (struct net_device *)ptr; 210 struct net_device *dev = (struct net_device *)ptr;
211 211
212 if (dev_net(dev) != &init_net) 212 if (!net_eq(dev_net(dev), &init_net))
213 return NOTIFY_DONE; 213 return NOTIFY_DONE;
214 214
215 if (event != NETDEV_DOWN) 215 if (event != NETDEV_DOWN)
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index ed9acffe810..a6e0818bcff 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -668,7 +668,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
668 struct sctp_sockaddr_entry *temp; 668 struct sctp_sockaddr_entry *temp;
669 int found = 0; 669 int found = 0;
670 670
671 if (dev_net(ifa->ifa_dev->dev) != &init_net) 671 if (!net_eq(dev_net(ifa->ifa_dev->dev), &init_net))
672 return NOTIFY_DONE; 672 return NOTIFY_DONE;
673 673
674 switch (ev) { 674 switch (ev) {
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index bc72fbc4f8b..fe43ef7dd7e 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -101,7 +101,7 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
101 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; 101 struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv;
102 u32 size; 102 u32 size;
103 103
104 if (dev_net(dev) != &init_net) { 104 if (!net_eq(dev_net(dev), &init_net)) {
105 kfree_skb(buf); 105 kfree_skb(buf);
106 return 0; 106 return 0;
107 } 107 }
@@ -198,7 +198,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
198 struct eth_bearer *eb_ptr = &eth_bearers[0]; 198 struct eth_bearer *eb_ptr = &eth_bearers[0];
199 struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS]; 199 struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS];
200 200
201 if (dev_net(dev) != &init_net) 201 if (!net_eq(dev_net(dev), &init_net))
202 return NOTIFY_DONE; 202 return NOTIFY_DONE;
203 203
204 while ((eb_ptr->dev != dev)) { 204 while ((eb_ptr->dev != dev)) {
diff --git a/net/wireless/wext.c b/net/wireless/wext.c
index 273a8435999..df5b3886c36 100644
--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -1299,7 +1299,7 @@ static void rtmsg_iwinfo(struct net_device *dev, char *event, int event_len)
1299 struct sk_buff *skb; 1299 struct sk_buff *skb;
1300 int err; 1300 int err;
1301 1301
1302 if (dev_net(dev) != &init_net) 1302 if (!net_eq(dev_net(dev), &init_net))
1303 return; 1303 return;
1304 1304
1305 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); 1305 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 7b1c6ef0455..9fc5b023d11 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -191,7 +191,7 @@ static int x25_device_event(struct notifier_block *this, unsigned long event,
191 struct net_device *dev = ptr; 191 struct net_device *dev = ptr;
192 struct x25_neigh *nb; 192 struct x25_neigh *nb;
193 193
194 if (dev_net(dev) != &init_net) 194 if (!net_eq(dev_net(dev), &init_net))
195 return NOTIFY_DONE; 195 return NOTIFY_DONE;
196 196
197 if (dev->type == ARPHRD_X25 197 if (dev->type == ARPHRD_X25
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 3ff206c0ae9..3e1efe53464 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -95,7 +95,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
95 struct sk_buff *nskb; 95 struct sk_buff *nskb;
96 struct x25_neigh *nb; 96 struct x25_neigh *nb;
97 97
98 if (dev_net(dev) != &init_net) 98 if (!net_eq(dev_net(dev), &init_net))
99 goto drop; 99 goto drop;
100 100
101 nskb = skb_copy(skb, GFP_ATOMIC); 101 nskb = skb_copy(skb, GFP_ATOMIC);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index cae9fd81554..841b32a2e68 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2360,7 +2360,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void
2360{ 2360{
2361 struct net_device *dev = ptr; 2361 struct net_device *dev = ptr;
2362 2362
2363 if (dev_net(dev) != &init_net) 2363 if (!net_eq(dev_net(dev), &init_net))
2364 return NOTIFY_DONE; 2364 return NOTIFY_DONE;
2365 2365
2366 switch (event) { 2366 switch (event) {