* [PATCH] netns: fix proxy ARP entries listing on a netns
@ 2011-11-21 19:46 Jorge Boncompte [DTI2]
2011-11-23 22:36 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Jorge Boncompte [DTI2] @ 2011-11-21 19:46 UTC (permalink / raw)
To: netdev; +Cc: Jorge Boncompte [DTI2]
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(-)
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);
--
1.7.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netns: fix proxy ARP entries listing on a netns
2011-11-21 19:46 [PATCH] netns: fix proxy ARP entries listing on a netns Jorge Boncompte [DTI2]
@ 2011-11-23 22:36 ` David Miller
2011-11-25 14:41 ` [PATCH v2] " Jorge Boncompte [DTI2]
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-11-23 22:36 UTC (permalink / raw)
To: jorge; +Cc: netdev
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] netns: fix proxy ARP entries listing on a netns
2011-11-23 22:36 ` David Miller
@ 2011-11-25 14:41 ` Jorge Boncompte [DTI2]
2011-11-25 18:24 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Jorge Boncompte [DTI2] @ 2011-11-25 14:41 UTC (permalink / raw)
To: netdev; +Cc: Jorge Boncompte [DTI2]
From: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
Skip entries from foreign network namespaces.
V2:
Fixed as suggested by David Miller to avoid a goto.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
---
net/core/neighbour.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 2684794..27d3fef 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2414,7 +2414,10 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
struct net *net = seq_file_net(seq);
struct neigh_table *tbl = state->tbl;
- pn = pn->next;
+ do {
+ pn = pn->next;
+ } while (pn && !net_eq(pneigh_net(pn), net));
+
while (!pn) {
if (++state->bucket > PNEIGH_HASHMASK)
break;
--
1.7.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] netns: fix proxy ARP entries listing on a netns
2011-11-25 14:41 ` [PATCH v2] " Jorge Boncompte [DTI2]
@ 2011-11-25 18:24 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-11-25 18:24 UTC (permalink / raw)
To: jorge; +Cc: netdev
From: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
Date: Fri, 25 Nov 2011 15:41:29 +0100
> From: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
>
> Skip entries from foreign network namespaces.
>
> V2:
> Fixed as suggested by David Miller to avoid a goto.
>
> Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-25 18:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 19:46 [PATCH] netns: fix proxy ARP entries listing on a netns Jorge Boncompte [DTI2]
2011-11-23 22:36 ` David Miller
2011-11-25 14:41 ` [PATCH v2] " Jorge Boncompte [DTI2]
2011-11-25 18:24 ` David Miller
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).