aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorOctavian Purdila <opurdila@ixiacom.com>2009-11-25 18:14:13 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-25 18:14:13 -0500
commit09ad9bc752519cc167d0a573e1acf69b5c707c67 (patch)
tree0e190a9ffb90d7e0534136c3e9f31dce02f423c3 /net/ipv4
parent4ba3eb034fb6fd1990ccc5a6d71d5abcda37b905 (diff)
net: use net_eq to compare nets
Generated with the following semantic patch @@ struct net *n1; struct net *n2; @@ - n1 == n2 + net_eq(n1, n2) @@ struct net *n1; struct net *n2; @@ - n1 != n2 + !net_eq(n1, n2) applied over {include,net,drivers/net}. Signed-off-by: Octavian Purdila <opurdila@ixiacom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/inet_hashtables.c3
-rw-r--r--net/ipv4/ip_fragment.c4
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c2
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/sysctl_net_ipv4.c4
9 files changed, 15 insertions, 14 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7620382058a0..c100709d6ddf 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1605,7 +1605,7 @@ static __net_init int devinet_init_net(struct net *net)
1605 all = &ipv4_devconf; 1605 all = &ipv4_devconf;
1606 dflt = &ipv4_devconf_dflt; 1606 dflt = &ipv4_devconf_dflt;
1607 1607
1608 if (net != &init_net) { 1608 if (!net_eq(net, &init_net)) {
1609 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL); 1609 all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
1610 if (all == NULL) 1610 if (all == NULL)
1611 goto err_alloc_all; 1611 goto err_alloc_all;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 9b096d6ff3f2..ed19aa6919c2 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -228,7 +228,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
228 head = &fib_info_hash[hash]; 228 head = &fib_info_hash[hash];
229 229
230 hlist_for_each_entry(fi, node, head, fib_hash) { 230 hlist_for_each_entry(fi, node, head, fib_hash) {
231 if (fi->fib_net != nfi->fib_net) 231 if (!net_eq(fi->fib_net, nfi->fib_net))
232 continue; 232 continue;
233 if (fi->fib_nhs != nfi->fib_nhs) 233 if (fi->fib_nhs != nfi->fib_nhs)
234 continue; 234 continue;
@@ -1047,7 +1047,7 @@ int fib_sync_down_addr(struct net *net, __be32 local)
1047 return 0; 1047 return 0;
1048 1048
1049 hlist_for_each_entry(fi, node, head, fib_lhash) { 1049 hlist_for_each_entry(fi, node, head, fib_lhash) {
1050 if (fi->fib_net != net) 1050 if (!net_eq(fi->fib_net, net))
1051 continue; 1051 continue;
1052 if (fi->fib_prefsrc == local) { 1052 if (fi->fib_prefsrc == local) {
1053 fi->fib_flags |= RTNH_F_DEAD; 1053 fi->fib_flags |= RTNH_F_DEAD;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 26fb50e91311..9b35c56d1023 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -112,7 +112,7 @@ again:
112 hashinfo->bhash_size)]; 112 hashinfo->bhash_size)];
113 spin_lock(&head->lock); 113 spin_lock(&head->lock);
114 inet_bind_bucket_for_each(tb, node, &head->chain) 114 inet_bind_bucket_for_each(tb, node, &head->chain)
115 if (ib_net(tb) == net && tb->port == rover) { 115 if (net_eq(ib_net(tb), net) && tb->port == rover) {
116 if (tb->fastreuse > 0 && 116 if (tb->fastreuse > 0 &&
117 sk->sk_reuse && 117 sk->sk_reuse &&
118 sk->sk_state != TCP_LISTEN && 118 sk->sk_state != TCP_LISTEN &&
@@ -158,7 +158,7 @@ have_snum:
158 hashinfo->bhash_size)]; 158 hashinfo->bhash_size)];
159 spin_lock(&head->lock); 159 spin_lock(&head->lock);
160 inet_bind_bucket_for_each(tb, node, &head->chain) 160 inet_bind_bucket_for_each(tb, node, &head->chain)
161 if (ib_net(tb) == net && tb->port == snum) 161 if (net_eq(ib_net(tb), net) && tb->port == snum)
162 goto tb_found; 162 goto tb_found;
163 } 163 }
164 tb = NULL; 164 tb = NULL;
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 47ad7aab51e3..94ef51aa5bc9 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -454,7 +454,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
454 * unique enough. 454 * unique enough.
455 */ 455 */
456 inet_bind_bucket_for_each(tb, node, &head->chain) { 456 inet_bind_bucket_for_each(tb, node, &head->chain) {
457 if (ib_net(tb) == net && tb->port == port) { 457 if (net_eq(ib_net(tb), net) &&
458 tb->port == port) {
458 if (tb->fastreuse >= 0) 459 if (tb->fastreuse >= 0)
459 goto next_port; 460 goto next_port;
460 WARN_ON(hlist_empty(&tb->owners)); 461 WARN_ON(hlist_empty(&tb->owners));
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b007f8af6e1f..1472d8e3c191 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -658,7 +658,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
658 struct ctl_table_header *hdr; 658 struct ctl_table_header *hdr;
659 659
660 table = ip4_frags_ns_ctl_table; 660 table = ip4_frags_ns_ctl_table;
661 if (net != &init_net) { 661 if (!net_eq(net, &init_net)) {
662 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL); 662 table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
663 if (table == NULL) 663 if (table == NULL)
664 goto err_alloc; 664 goto err_alloc;
@@ -676,7 +676,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
676 return 0; 676 return 0;
677 677
678err_reg: 678err_reg:
679 if (net != &init_net) 679 if (!net_eq(net, &init_net))
680 kfree(table); 680 kfree(table);
681err_alloc: 681err_alloc:
682 return -ENOMEM; 682 return -ENOMEM;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index fdf51badc8e5..c29de9879fda 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -164,7 +164,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
164 if (sk && inet_sk(sk)->inet_num == protocol && 164 if (sk && inet_sk(sk)->inet_num == protocol &&
165 (!sk->sk_bound_dev_if || 165 (!sk->sk_bound_dev_if ||
166 sk->sk_bound_dev_if == dev->ifindex) && 166 sk->sk_bound_dev_if == dev->ifindex) &&
167 sock_net(sk) == dev_net(dev)) { 167 net_eq(sock_net(sk), dev_net(dev))) {
168 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { 168 if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
169 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) { 169 if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
170 read_unlock(&ip_ra_lock); 170 read_unlock(&ip_ra_lock);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index c156db215987..884f0859cb3b 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -500,7 +500,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
500 if (event == NETLINK_URELEASE && 500 if (event == NETLINK_URELEASE &&
501 n->protocol == NETLINK_FIREWALL && n->pid) { 501 n->protocol == NETLINK_FIREWALL && n->pid) {
502 write_lock_bh(&queue_lock); 502 write_lock_bh(&queue_lock);
503 if ((n->net == &init_net) && (n->pid == peer_pid)) 503 if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
504 __ipq_reset(); 504 __ipq_reset();
505 write_unlock_bh(&queue_lock); 505 write_unlock_bh(&queue_lock);
506 } 506 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7547944ea9bf..aea7bb369cfa 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -703,7 +703,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
703 703
704static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) 704static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
705{ 705{
706 return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev); 706 return net_eq(dev_net(rt1->u.dst.dev), dev_net(rt2->u.dst.dev));
707} 707}
708 708
709static inline int rt_is_expired(struct rtable *rth) 709static inline int rt_is_expired(struct rtable *rth)
@@ -3310,7 +3310,7 @@ static __net_init int sysctl_route_net_init(struct net *net)
3310 struct ctl_table *tbl; 3310 struct ctl_table *tbl;
3311 3311
3312 tbl = ipv4_route_flush_table; 3312 tbl = ipv4_route_flush_table;
3313 if (net != &init_net) { 3313 if (!net_eq(net, &init_net)) {
3314 tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); 3314 tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL);
3315 if (tbl == NULL) 3315 if (tbl == NULL)
3316 goto err_dup; 3316 goto err_dup;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 2dcf04d9b005..c00323bae044 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -818,7 +818,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
818 struct ctl_table *table; 818 struct ctl_table *table;
819 819
820 table = ipv4_net_table; 820 table = ipv4_net_table;
821 if (net != &init_net) { 821 if (!net_eq(net, &init_net)) {
822 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); 822 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
823 if (table == NULL) 823 if (table == NULL)
824 goto err_alloc; 824 goto err_alloc;
@@ -849,7 +849,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
849 return 0; 849 return 0;
850 850
851err_reg: 851err_reg:
852 if (net != &init_net) 852 if (!net_eq(net, &init_net))
853 kfree(table); 853 kfree(table);
854err_alloc: 854err_alloc:
855 return -ENOMEM; 855 return -ENOMEM;