浏览代码

[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 <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Denis V. Lunev 17 年之前
父节点
当前提交
0be43f82c4
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      net/netfilter/core.c

+ 8 - 0
net/netfilter/core.c

@@ -165,6 +165,14 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
 	unsigned int verdict;
 	unsigned int verdict;
 	int ret = 0;
 	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 */
 	/* We may already have this, but read-locks nest anyway */
 	rcu_read_lock();
 	rcu_read_lock();