* [PATCH 2.4] Bugfix in neigh_create
@ 2005-01-07 12:52 Raivis Bucis
2005-01-08 10:36 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Raivis Bucis @ 2005-01-07 12:52 UTC (permalink / raw)
To: netdev
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) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.4] Bugfix in neigh_create
2005-01-07 12:52 [PATCH 2.4] Bugfix in neigh_create Raivis Bucis
@ 2005-01-08 10:36 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2005-01-08 10:36 UTC (permalink / raw)
To: Raivis Bucis; +Cc: netdev, davem
Raivis Bucis <raivis@mt.lv> wrote:
>
> I believe that there is a bug in neigh_create in linux-2.4.28 introduced by
> neighbor cache backport from v2.6.9.
Yes you're right. Unfortunately your patch's been broken by your
mailer. Can you please resend it to davem as an attachment?
Thanks,
> 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) {
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-08 10:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-07 12:52 [PATCH 2.4] Bugfix in neigh_create Raivis Bucis
2005-01-08 10:36 ` Herbert Xu
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).