Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

when the number of the packets queued in a NDP cache exceed the limit,

discard the oldest packet, as specified in RFC2461 7.2.2.
  • Loading branch information...
commit ba1cf723097a7bff8a1617368b076270b4c3a3a6 1 parent b0e3bef
suz authored

Showing 2 changed files with 22 additions and 11 deletions. Show diff stats Hide diff stats

  1. +7 2 CHANGELOG
  2. +15 9 kame/sys/netinet6/nd6.c
9 CHANGELOG
... ... @@ -1,10 +1,15 @@
1 1 CHANGELOG for KAME kit
2   -$KAME: CHANGELOG,v 1.2741 2005/04/01 07:31:00 suz Exp $
  2 +$KAME: CHANGELOG,v 1.2742 2005/04/04 09:14:57 suz Exp $
3 3
4 4 <200504>
  5 +2005-04-04 SUZUKI, Shinsuke <suz@kame.net>
  6 + * kame/sys/netinet6/nd6.c: when the number of the packets queued in
  7 + a NDP cache exceed the limit, discard the oldest packet,
  8 + as specified in RFC2461 7.2.2.
  9 +
5 10 2005-04-01 SUZUKI, Shinsuke <suz@kame.net>
6 11 * kame/sys/netinet/icmp6.h, kame/sys/netinet6/icmp6.c, nd6.c: limits
7   - the number of fragmented packets stored in a NDP cache.
  12 + the number of unresolved packets stored in a NDP cache.
8 13 (To prevent a DoS attack using 2005-01-21's change)
9 14
10 15 2005-04-01 SUZUKI, Shinsuke <suz@kame.net>
24 kame/sys/netinet6/nd6.c
... ... @@ -1,4 +1,4 @@
1   -/* $KAME: nd6.c,v 1.374 2005/04/01 09:25:02 suz Exp $ */
  1 +/* $KAME: nd6.c,v 1.375 2005/04/04 09:14:58 suz Exp $ */
2 2
3 3 /*
4 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -2546,22 +2546,28 @@ nd6_output(ifp, origifp, m0, dst, rt0)
2546 2546 * There is a neighbor cache entry, but no ethernet address
2547 2547 * response yet. Append this latest packet to the end of the
2548 2548 * packet queue in the mbuf, unless the number of the packet
2549   - * does not exceed nd6_maxqueuelen.
  2549 + * does not exceed nd6_maxqueuelen. When it exceeds nd6_maxqueuelen,
  2550 + * the oldest packet in the queue will be removed.
2550 2551 */
2551 2552 if (ln->ln_state == ND6_LLINFO_NOSTATE)
2552 2553 ln->ln_state = ND6_LLINFO_INCOMPLETE;
2553 2554 if (ln->ln_hold) {
2554   - struct mbuf *m_hold, *m_hold_last;
  2555 + struct mbuf *m_hold;
2555 2556 int i;
2556 2557
2557   - m_hold = m_hold_last = ln->ln_hold;
2558   - for (i = 0; i < nd6_maxqueuelen; i++) {
2559   - if (m_hold == NULL) {
2560   - m_hold_last->m_nextpkt = m;
  2558 + i = 0;
  2559 + for (m_hold = ln->ln_hold; m_hold; m_hold = m_hold->m_nextpkt) {
  2560 + i++;
  2561 + if (m_hold->m_nextpkt == NULL) {
  2562 + m_hold->m_nextpkt = m;
2561 2563 break;
2562 2564 }
2563   - m_hold_last = m_hold;
2564   - m_hold = m_hold->m_nextpkt;
  2565 + }
  2566 + while (i >= nd6_maxqueuelen) {
  2567 + m_hold = ln->ln_hold;
  2568 + ln->ln_hold = ln->ln_hold->m_nextpkt;
  2569 + m_free(m_hold);
  2570 + i--;
2565 2571 }
2566 2572 } else {
2567 2573 ln->ln_hold = m;

0 comments on commit ba1cf72

Please sign in to comment.
Something went wrong with that request. Please try again.