diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-07-20 01:34:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-20 01:34:43 -0400 |
commit | 721499e8931c5732202481ae24f2dfbf9910f129 (patch) | |
tree | c94d8d681966109bb41f712f21f3a9825ae2172d /net/ipv4/igmp.c | |
parent | 407d819cf0fd54c6fc1138a509225696aecafd15 (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/ipv4/igmp.c')
-rw-r--r-- | net/ipv4/igmp.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 68e84a933e90..6203ece53606 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(); |