diff mbox

netns: fix proxy ARP entries listing on a netns

Message ID 1321904774-3030-1-git-send-email-jorge@dti2.net
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Jorge Boncompte [DTI2] Nov. 21, 2011, 7:46 p.m. UTC
From: "Jorge Boncompte [DTI2]" <jorge@dti2.net>

Skip entries from foreign network namespaces.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
---
 net/core/neighbour.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

David Miller Nov. 23, 2011, 10:36 p.m. UTC | #1
From: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
Date: Mon, 21 Nov 2011 20:46:14 +0100

> @@ -2397,6 +2397,7 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
>  	struct net *net = seq_file_net(seq);
>  	struct neigh_table *tbl = state->tbl;
>  
> +restart:
>  	pn = pn->next;
>  	while (!pn) {

We don't need to use goto to fix this bug, instead change this assignment
to something like:

	do {
		pn = pn->next;
	} while (pn && !net_eq(pneigh_net(pn), net));

and this way it will mirror the while loop inside of the "while (!pn)"
code block.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 039d51e..2adcbeb 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2397,6 +2397,7 @@  static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
 	struct net *net = seq_file_net(seq);
 	struct neigh_table *tbl = state->tbl;
 
+restart:
 	pn = pn->next;
 	while (!pn) {
 		if (++state->bucket > PNEIGH_HASHMASK)
@@ -2408,6 +2409,9 @@  static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
 			break;
 	}
 
+	if (pn && !net_eq(pneigh_net(pn), net))
+		goto restart;
+
 	if (pn && pos)
 		--(*pos);