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/netfilter | |
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/netfilter')
-rw-r--r-- | net/netfilter/nf_sockopt.c | 2 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index 69d699f95f4c..01489681fa96 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 04e9c965f8ca..8c860112ce05 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 */ |