* [PATCH nf] netfilter: conntrack: do not dump other netns's conntrack entries via proc
@ 2016-08-15 13:50 Liping Zhang
2016-08-15 14:02 ` Florian Westphal
2016-08-17 15:43 ` Pablo Neira Ayuso
0 siblings, 2 replies; 3+ messages in thread
From: Liping Zhang @ 2016-08-15 13:50 UTC (permalink / raw)
To: pablo; +Cc: fw, netfilter-devel, Liping Zhang
From: Liping Zhang <liping.zhang@spreadtrum.com>
We should skip the conntracks that belong to a different namespace,
otherwise other unrelated netns's conntrack entries will be dumped via
/proc/net/nf_conntrack.
Fixes: 56d52d4892d0 ("netfilter: conntrack: use a single hashtable for all namespaces")
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
---
net/netfilter/nf_conntrack_standalone.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 958a145..9f267c3 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -205,6 +205,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
const struct nf_conntrack_l3proto *l3proto;
const struct nf_conntrack_l4proto *l4proto;
+ struct net *net = seq_file_net(s);
int ret = 0;
NF_CT_ASSERT(ct);
@@ -215,6 +216,9 @@ static int ct_seq_show(struct seq_file *s, void *v)
if (NF_CT_DIRECTION(hash))
goto release;
+ if (!net_eq(nf_ct_net(ct), net))
+ goto release;
+
l3proto = __nf_ct_l3proto_find(nf_ct_l3num(ct));
NF_CT_ASSERT(l3proto);
l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct));
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nf] netfilter: conntrack: do not dump other netns's conntrack entries via proc
2016-08-15 13:50 [PATCH nf] netfilter: conntrack: do not dump other netns's conntrack entries via proc Liping Zhang
@ 2016-08-15 14:02 ` Florian Westphal
2016-08-17 15:43 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2016-08-15 14:02 UTC (permalink / raw)
To: Liping Zhang; +Cc: pablo, fw, netfilter-devel, Liping Zhang
Liping Zhang <zlpnobody@163.com> wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
>
> We should skip the conntracks that belong to a different namespace,
> otherwise other unrelated netns's conntrack entries will be dumped via
> /proc/net/nf_conntrack.
>
> Fixes: 56d52d4892d0 ("netfilter: conntrack: use a single hashtable for all namespaces")
> Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Thanks for the fix.
Reviewed-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH nf] netfilter: conntrack: do not dump other netns's conntrack entries via proc
2016-08-15 13:50 [PATCH nf] netfilter: conntrack: do not dump other netns's conntrack entries via proc Liping Zhang
2016-08-15 14:02 ` Florian Westphal
@ 2016-08-17 15:43 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2016-08-17 15:43 UTC (permalink / raw)
To: Liping Zhang; +Cc: fw, netfilter-devel, Liping Zhang
On Mon, Aug 15, 2016 at 09:50:35PM +0800, Liping Zhang wrote:
> From: Liping Zhang <liping.zhang@spreadtrum.com>
>
> We should skip the conntracks that belong to a different namespace,
> otherwise other unrelated netns's conntrack entries will be dumped via
> /proc/net/nf_conntrack.
Applied to nf, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-17 15:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-15 13:50 [PATCH nf] netfilter: conntrack: do not dump other netns's conntrack entries via proc Liping Zhang
2016-08-15 14:02 ` Florian Westphal
2016-08-17 15:43 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).