From owner-freebsd-net@FreeBSD.ORG Mon Jun 14 22:02:04 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2627106566C; Mon, 14 Jun 2010 22:02:04 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3591B8FC17; Mon, 14 Jun 2010 22:02:03 +0000 (UTC) Received: by wyb34 with SMTP id 34so739754wyb.13 for ; Mon, 14 Jun 2010 15:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=aNcVkQCqPh1se9IKTAO2DHR9M3LFdWtoVWv/7WE9ekQ=; b=HPWSEiiv16lI5V972vNKhszLEdIELTqi6v/l2e2Ymxl77CvaqV75n4zg2xyP6VVOyu xaa6ZtL+/apfOjJuscVQITaglnY9f5f65DfjxJeJJPy4nYWa6w6hRodhGRn+IQDIGDiO pj+oI7woPeVLa165PzRDMjSxHM9OD0wGLIdcY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type; b=lV1usq6YgZMw2NgUmZGClQkIOpOWBb99klcBi9qB1BeJUrkqtPtQJmAkqiFWlJf2w4 J6MDjxTNgGGi9N3ghCtfCu6AtVCwLZO7HllG19UOJflmFp2C+BLhgsZ+YamHUZ0q+o71 LD58TmC11wAGs1vyvBDLZPHq9VriuYjD/NIM4= Received: by 10.216.85.1 with SMTP id t1mr2934590wee.3.1276552923214; Mon, 14 Jun 2010 15:02:03 -0700 (PDT) MIME-Version: 1.0 Sender: ermal.luci@gmail.com Received: by 10.216.25.4 with HTTP; Mon, 14 Jun 2010 15:01:43 -0700 (PDT) From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= Date: Mon, 14 Jun 2010 23:01:43 +0100 X-Google-Sender-Auth: fZwmYm1kcqCJxeAQxBGBHGyB5lI Message-ID: To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-net Subject: [PATCH] ipfw pipe bandwidth parameter parser. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2010 22:02:05 -0000 Hello, on FreeBSD-STABLE at least ipfw wrongly interprets dummynet configurations of the type: pipe 10 config bw 1.5Mb ^^^ as being 1bit/s configuration. Which is quite wrong in real production usage. This simple patch fixes it http://tinyurl.com/33j6odw. I am not sure if this should be included before 8.1 release or not. Here is the inline version. Index: sbin/ipfw/dummynet.c =================================================================== RCS file: /home/ncvs/src/sbin/ipfw/dummynet.c,v retrieving revision 1.9.2.4 diff -u -r1.9.2.4 dummynet.c --- sbin/ipfw/dummynet.c 23 Mar 2010 09:58:59 -0000 1.9.2.4 +++ sbin/ipfw/dummynet.c 14 Jun 2010 21:49:38 -0000 @@ -528,10 +528,10 @@ if_name[namelen] = '\0'; *bandwidth = 0; } else { /* read bandwidth value */ - int bw; + double bw; char *end = NULL; - bw = strtoul(arg, &end, 0); + bw = strtod(arg, &end); if (*end == 'K' || *end == 'k') { end++; bw *= 1000; @@ -547,7 +547,7 @@ if (bw < 0) errx(EX_DATAERR, "bandwidth too large"); - *bandwidth = bw; + *bandwidth = (int)bw; if (if_name) if_name[0] = '\0'; } Regards, -- Ermal