Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Aug 2002 10:00:09 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        Valentine Zaretsky <valik@apex.dp.ua>
Cc:        ipfw@FreeBSD.ORG
Subject:   Re: ipfw2 & dummynet
Message-ID:  <20020803100008.A98813@iguana.icir.org>
In-Reply-To: <007601c23b07$8c667550$226e03d4@zhome>; from valik@apex.dp.ua on Sat, Aug 03, 2002 at 07:05:08PM %2B0300
References:  <007601c23b07$8c667550$226e03d4@zhome>

next in thread | previous in thread | raw e-mail | index | archive | help
good catch :)

The problem was in fact a missing #include "opt_ipdn.h" to let us know
whether we are being compiled for the old ipfw or for IPFW2.

Without that, compilation defaulted to ipfw, resulting in
a number of erroneous manipulations of data.

Just committed a fix, thanks

	luigi

On Sat, Aug 03, 2002 at 07:05:08PM +0300, Valentine Zaretsky wrote:
> Hi,
> 
> Playing with ipfw2 in -stable (last time cvsup'ed yesterday), I found a bug when using dummynet pipes and queues
> 
> Here is the simplest example to repeat it:
> 
> ipfw pipe 1 config bw 20KBytes/s
> ipfw add 400 pipe 1 ip from any to me
> 
> The first packet matching rule 400 leads to kernel panic caused by "division by zero"
> 
> Analyzing crashdump with gdb, I found that it happens in the following code in /usr/src/sys/netinet/ip_dummynet.c:
> (lines 1198-1205)
> ==============================
>         if (DN_KEY_GT(q->S, q->F)) { /* means timestamps are invalid */
>             q->S = pipe->V ;
>             pipe->sum += fs->weight ; /* add weight of new queue */
>         } else {
>             heap_extract(&(pipe->idle_heap), q);
>             q->S = MAX64(q->F, pipe->V ) ;
>         }
>         q->F = q->S + ( len<<MY_M )/(u_int64_t) fs->weight;      
> ==============================
> 
> So the weight is 0 when it should be 1. 
> And it's not quite understood why should this code execute at all? There is no queues (only simple pipe, so "is_pipe" should be 1)
> 
> Adding dumb "if(fs->weight==0) fs->weight=1;" before the code above, fixes this kernel panic.
> 
> I think it could/should be fixed a little smarter ;)
> 
> --
> With best regards, Valentine Zaretsky
> 
> 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ipfw" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020803100008.A98813>