From: Denis V. Lunev Date: Mon, 24 Mar 2008 22:32:09 +0000 (-0700) Subject: [NETNS]: Process netfilter hooks in initial namespace only. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0be43f82c4f4c4a999b53cf794513f7f1a4ed7f3;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [NETNS]: Process netfilter hooks in initial namespace only. There were no packets in the namespace other than initial previously. This will be changed in the neareast future. Netfilters are not namespace aware and should be processed in the initial namespace only for now. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- diff --git a/net/netfilter/core.c b/net/netfilter/core.c index c4065b8f9a95..ec05684c56d7 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -165,6 +165,14 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, unsigned int verdict; int ret = 0; +#ifdef CONFIG_NET_NS + struct net *net; + + net = indev == NULL ? outdev->nd_net : indev->nd_net; + if (net != &init_net) + return 1; +#endif + /* We may already have this, but read-locks nest anyway */ rcu_read_lock();