From gpr@nvnpp.vrn.ru  Thu Mar  7 01:57:32 2002
Return-Path: <gpr@nvnpp.vrn.ru>
Received: from ic.vrn.ru (ic.vrn.ru [195.98.64.65])
	by hub.freebsd.org (Postfix) with ESMTP id EE7D437B402
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  7 Mar 2002 01:57:29 -0800 (PST)
Received: from relay.nvnpp.vrn.ru ([195.98.93.102])
	by ic.vrn.ru (8.11.6/8.11.1) with ESMTP id g279vOH69292
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 7 Mar 2002 12:57:25 +0300 (MSK)
	(envelope-from gpr@nvnpp.vrn.ru)
Received: from nvnpp.vrn.ru by relay.nvnpp.vrn.ru
	with SMTP (MDaemon.v3.1.0.R)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 07 Mar 2002 12:57:01 +0300
Received: from fbsd.nvnpp.vrn.ru by nvnpp.vrn.ru
	with SMTP (MDaemon.PRO.v5.0.4.R)
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 07 Mar 2002 12:56:46 +0300
Received: from gpr by fbsd.nvnpp.vrn.ru with local (Exim 3.33 #1)
	id 16iudh-0003FR-00; Thu, 07 Mar 2002 12:56:45 +0300
Message-Id: <E16iudh-0003FR-00@fbsd.nvnpp.vrn.ru>
Date: Thu, 07 Mar 2002 12:56:45 +0300
From: Gennady Proskurin <gpr@nvnpp.vrn.ru>
Sender: Gennady Proskurin <gpr@fbsd.nvnpp.vrn.ru>
Reply-To: Gennady Proskurin <gpr@nvnpp.vrn.ru>
To: FreeBSD-gnats-submit@freebsd.org
Subject: ifpw(8) doesn't set RED parameters for dummynet queue
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35628
>Category:       bin
>Synopsis:       ifpw(8) doesn't set RED parameters for dummynet queue
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    luigi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 07 02:00:01 PST 2002
>Closed-Date:    Sun May 05 14:46:24 PDT 2002
>Last-Modified:  Sun May 05 14:46:24 PDT 2002
>Originator:     Gennady Proskurin
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD gpr.nvnpp.lan 5.0-CURRENT FreeBSD 5.0-CURRENT #17: Wed Mar 6 08:18:48 MSK 2002 gpr@gpr.nvnpp.lan:/usr/obj/usr/src/sys/gpr i386

	
>Description:
ipfw(8) doesn't set RED parameters for dummynet queue with RED queue
management because they set only if bandwidth limit exists, but bw limit
cannot be in queue config.
>How-To-Repeat:
1) Configure dummynet queue with RED, for example:
	ipfw pipe 1 config bw 3000byte/s queue 5
	ipfw queue 2 config pipe 1 queue 50 red 0.008/10/40/0.9

2) Do some traffic via queue 2 to fill its queue
	ipfw add 1 queue 2 ip from any to any

3) See kernel panic caused by using uninitialized RED parameters

	
>Fix:

for ipfw.c rev 1.120

--- ipfw.c.orig	Thu Mar  7 08:32:43 2002
+++ ipfw.c	Thu Mar  7 12:24:14 2002
@@ -1648,7 +1648,11 @@
 			    pipe.fs.min_th, pipe.fs.max_th);
 		if (pipe.fs.max_th == 0)
 			errx(EX_DATAERR, "max_th must be > 0");
-		if (pipe.bandwidth) {
+		/*
+		 * We need set RED parameters anyway,
+		 * even if no bandwidth limit
+		 */
+		{
 			size_t len;
 			int lookup_depth, avg_pkt_size;
 			double s, idle, weight, w_q;
@@ -1682,7 +1686,10 @@
 				    "kern.clockrate");
 
 			/* ticks needed for sending a medium-sized packet */
-			s = clock.hz * avg_pkt_size * 8 / pipe.bandwidth;
+			if (pipe.bandwidth==0)
+				s = 0; 
+			else
+				s = clock.hz * avg_pkt_size * 8 / pipe.bandwidth;
 
 			/*
 			 * max idle time (in ticks) before avg queue size

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->luigi 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Thu Mar 7 03:35:45 PST 2002 
Responsible-Changed-Why:  
Luigi - this one looks relatively straight forward and contains a patch. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35628 
State-Changed-From-To: open->closed 
State-Changed-By: luigi 
State-Changed-When: Sun May 5 14:44:21 PDT 2002 
State-Changed-Why:  
committed a fix to -current, to be MFC as soon as re@ approve. 

thanks 


http://www.freebsd.org/cgi/query-pr.cgi?pr=35628 
>Unformatted:
