Date: Mon, 18 Oct 2010 06:50:13 +0800 From: Sergey Lobanov <wmn@siberianet.ru> To: freebsd-ipfw@freebsd.org, Luigi Rizzo <luigi@freebsd.org> Subject: [PATCH] ipfw: workaround handling of floating-point bw value Message-ID: <201010180650.14003.wmn@siberianet.ru>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010180650.14003.wmn>