* [RESEND] [PATCH] neigh: error out pending skbs if netlink invalidates incomplete neigh
@ 2009-06-11 8:13 Timo Teras
2009-06-11 8:25 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Timo Teras @ 2009-06-11 8:13 UTC (permalink / raw)
To: davem, netdev; +Cc: Timo Teras
The state transition code from incomplete to invalid via neigh_update()
is missing the proper clean up of skb queue. Separate the clean up
code from neigh_timer_handler() to a new function and make neigh_update()
is it also.
Signed-off-by: Timo Teras <timo.teras@iki.fi>
---
net/core/neighbour.c | 46 ++++++++++++++++++++++++++++------------------
1 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index a1cbce7..a17cb9d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -771,6 +771,28 @@ static __inline__ int neigh_max_probes(struct neighbour *n)
p->ucast_probes + p->app_probes + p->mcast_probes);
}
+static void neigh_invalidate(struct neighbour *neigh)
+{
+ struct sk_buff *skb;
+
+ NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed);
+ NEIGH_PRINTK2("neigh %p is failed.\n", neigh);
+ neigh->updated = jiffies;
+
+ /* It is very thin place. report_unreachable is very complicated
+ routine. Particularly, it can hit the same neighbour entry!
+
+ So that, we try to be accurate and avoid dead loop. --ANK
+ */
+ while (neigh->nud_state == NUD_FAILED &&
+ (skb = __skb_dequeue(&neigh->arp_queue)) != NULL) {
+ write_unlock(&neigh->lock);
+ neigh->ops->error_report(neigh, skb);
+ write_lock(&neigh->lock);
+ }
+ skb_queue_purge(&neigh->arp_queue);
+}
+
/* Called when a timer expires for a neighbour entry. */
static void neigh_timer_handler(unsigned long arg)
@@ -835,26 +857,9 @@ static void neigh_timer_handler(unsigned long arg)
if ((neigh->nud_state & (NUD_INCOMPLETE | NUD_PROBE)) &&
atomic_read(&neigh->probes) >= neigh_max_probes(neigh)) {
- struct sk_buff *skb;
-
neigh->nud_state = NUD_FAILED;
- neigh->updated = jiffies;
notify = 1;
- NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed);
- NEIGH_PRINTK2("neigh %p is failed.\n", neigh);
-
- /* It is very thin place. report_unreachable is very complicated
- routine. Particularly, it can hit the same neighbour entry!
-
- So that, we try to be accurate and avoid dead loop. --ANK
- */
- while (neigh->nud_state == NUD_FAILED &&
- (skb = __skb_dequeue(&neigh->arp_queue)) != NULL) {
- write_unlock(&neigh->lock);
- neigh->ops->error_report(neigh, skb);
- write_lock(&neigh->lock);
- }
- skb_queue_purge(&neigh->arp_queue);
+ neigh_invalidate(neigh);
}
if (neigh->nud_state & NUD_IN_TIMER) {
@@ -1001,6 +1006,11 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
neigh->nud_state = new;
err = 0;
notify = old & NUD_VALID;
+ if ((old & (NUD_INCOMPLETE | NUD_PROBE)) &&
+ (new & NUD_FAILED)) {
+ neigh_invalidate(neigh);
+ notify = 1;
+ }
goto out;
}
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND] [PATCH] neigh: error out pending skbs if netlink invalidates incomplete neigh
2009-06-11 8:13 [RESEND] [PATCH] neigh: error out pending skbs if netlink invalidates incomplete neigh Timo Teras
@ 2009-06-11 8:25 ` David Miller
2009-06-11 8:35 ` Timo Teräs
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2009-06-11 8:25 UTC (permalink / raw)
To: timo.teras; +Cc: netdev
You don't need to resend, you're in the queue already:
http://patchwork.ozlabs.org/patch/28091/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND] [PATCH] neigh: error out pending skbs if netlink invalidates incomplete neigh
2009-06-11 8:25 ` David Miller
@ 2009-06-11 8:35 ` Timo Teräs
0 siblings, 0 replies; 3+ messages in thread
From: Timo Teräs @ 2009-06-11 8:35 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller wrote:
> You don't need to resend, you're in the queue already:
>
> http://patchwork.ozlabs.org/patch/28091/
I looking at the queue, but somehow missed the netdev project
even though it's right there in the main page.
Sorry.
- Timo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-11 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-11 8:13 [RESEND] [PATCH] neigh: error out pending skbs if netlink invalidates incomplete neigh Timo Teras
2009-06-11 8:25 ` David Miller
2009-06-11 8:35 ` Timo Teräs
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).