[PATCH] ipfw: workaround handling of floating-point bw value
Sergey Lobanov
wmn at siberianet.ru
Sun Oct 17 23:13:28 UTC 2010
If bw value is given in floating-point format its unit is ignored completely,
leading to speed definition in bits per second:
root at test ~# ipfw pipe 10 config bw 1024.1Mbit/s
root at test ~# /usr/obj/usr/src/sbin/ipfw/ipfw pipe 20 config bw 1024.1Kbit/s
root at 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
More information about the freebsd-ipfw
mailing list