From owner-freebsd-ipfw@FreeBSD.ORG Sun Oct 17 23:13:28 2010 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 536FF1065670; Sun, 17 Oct 2010 23:13:28 +0000 (UTC) (envelope-from wmn@siberianet.ru) Received: from mail.siberianet.ru (mail.siberianet.ru [89.105.136.7]) by mx1.freebsd.org (Postfix) with ESMTP id 021F88FC12; Sun, 17 Oct 2010 23:13:27 +0000 (UTC) Received: from wmn.localnet (wmn.siberianet.ru [89.105.137.12]) by mail.siberianet.ru (Postfix) with ESMTP id 442991DDEF4; Mon, 18 Oct 2010 06:50:08 +0800 (KRAST) From: Sergey Lobanov Organization: ISP "SiberiaNet" To: freebsd-ipfw@freebsd.org, Luigi Rizzo Date: Mon, 18 Oct 2010 06:50:13 +0800 User-Agent: KMail/1.13.5 (Linux/2.6.35-ARCH; KDE/4.5.2; i686; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201010180650.14003.wmn@siberianet.ru> Cc: Subject: [PATCH] ipfw: workaround handling of floating-point bw value X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2010 23:13:28 -0000 If bw value is given in floating-point format its unit is ignored completely, leading to speed definition in bits per second: root@test ~# ipfw pipe 10 config bw 1024.1Mbit/s root@test ~# /usr/obj/usr/src/sbin/ipfw/ipfw pipe 20 config bw 1024.1Kbit/s root@test ~# ipfw pipe show 00010: 1.024 Kbit/s 0 ms burst 0 q131082 50 sl. 0 flows (1 buckets) sched 65546 weight 0 lmax 0 pri 0 droptail sched 65546 type FIFO flags 0x0 0 buckets 0 active 00020: 1.024 Mbit/s 0 ms burst 0 q131092 50 sl. 0 flows (1 buckets) sched 65556 weight 0 lmax 0 pri 0 droptail sched 65556 type FIFO flags 0x0 0 buckets 0 active Workaround patch: --- sbin/ipfw/dummynet.c.orig 2010-10-18 05:57:01.000000000 +0800 +++ sbin/ipfw/dummynet.c 2010-10-18 05:57:03.000000000 +0800 @@ -532,6 +532,11 @@ char *end = NULL; bw = strtoul(arg, &end, 0); + if (*end == '.') { + end++; + while (*end >= '0' && *end <= '9') + end++; + } if (*end == 'K' || *end == 'k') { end++; bw *= 1000; -- ISP SiberiaNet System and Network Administrator