[PATCH] ipfw pipe bandwidth parameter parser.
Ermal Luçi
eri at freebsd.org
Mon Jun 14 22:02:05 UTC 2010
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
More information about the freebsd-net
mailing list