From: Eric W. Biederman Date: Wed, 12 Sep 2007 11:58:02 +0000 (+0200) Subject: [NET]: Disable netfilter sockopts when not in the initial network namespace X-Git-Tag: v2.6.24-rc1~1454^2~690 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c48dad7ecd84eac92afbe02bd69fca9983a65a56;p=linux-2.6-omap-h63xx.git [NET]: Disable netfilter sockopts when not in the initial network namespace Until we support multiple network namespaces with netfilter only allow netfilter configuration in the initial network namespace. Signed-off-by: Eric W. Biederman Signed-off-by: David S. Miller --- diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index e32761ce260..aa2831587b8 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c @@ -69,6 +69,9 @@ static int nf_sockopt(struct sock *sk, int pf, int val, struct nf_sockopt_ops *ops; int ret; + if (sk->sk_net != &init_net) + return -ENOPROTOOPT; + if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) return -EINTR; @@ -125,6 +128,10 @@ static int compat_nf_sockopt(struct sock *sk, int pf, int val, struct nf_sockopt_ops *ops; int ret; + if (sk->sk_net != &init_net) + return -ENOPROTOOPT; + + if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) return -EINTR;