netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raivis Bucis <raivis@mt.lv>
To: netdev@oss.sgi.com
Subject: [PATCH 2.4] Bugfix in neigh_create
Date: Fri, 7 Jan 2005 14:52:28 +0200	[thread overview]
Message-ID: <200501071452.29006.raivis@mt.lv> (raw)

Hello,

I believe that there is a bug in neigh_create in linux-2.4.28 introduced by 
neighbor cache backport from v2.6.9.

New neigh entry hash_val was calculated before possible hash growth. So it got 
inserted in wrong place, making ARP entry (that was inserted immediately after 
hash growth) 
unresolvable until entry timeout.

It looked like this. The host did not answer to pings from some random host, 
but it could ping it after that with no problems. And vice versa.

Raivis Bucis

diff -uNr linux-2.4.28.org/net/core/neighbour.c 
linux-2.4.28/net/core/neighbour.c
--- linux-2.4.28.org/net/core/neighbour.c 2004-11-17 13:54:22.000000000 +0200
+++ linux-2.4.28/net/core/neighbour.c 2005-01-07 14:11:57.000000000 +0200
@@ -427,11 +427,12 @@
 
  n->confirmed = jiffies - (n->parms->base_reachable_time<<1);
 
- hash_val = tbl->hash(pkey, dev) & tbl->hash_mask;
-
  write_lock_bh(&tbl->lock);
  if (atomic_read(&tbl->entries) > (tbl->hash_mask + 1))
   neigh_hash_grow(tbl, (tbl->hash_mask + 1) << 1);
+
+ hash_val = tbl->hash(pkey, dev) & tbl->hash_mask;
+
  for (n1 = tbl->hash_buckets[hash_val]; n1; n1 = n1->next) {
   if (dev == n1->dev &&
       memcmp(n1->primary_key, pkey, key_len) == 0) {

             reply	other threads:[~2005-01-07 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07 12:52 Raivis Bucis [this message]
2005-01-08 10:36 ` [PATCH 2.4] Bugfix in neigh_create Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200501071452.29006.raivis@mt.lv \
    --to=raivis@mt.lv \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).