summaryrefslogtreecommitdiffstats
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-04-16 02:32:12 +0000
committergjb <gjb@FreeBSD.org>2016-04-16 02:32:12 +0000
commit6549ef7d128d37c0dfff87f6c1c189b42ed3e1ef (patch)
treea8871301d693c6d33d43cd3171b1ee4783fec0e4 /sbin/pfctl
parentae096a53a90aee9859587d48d5a0279567abb413 (diff)
parent35691f7a6f04cec368d8636543bca596e870faf3 (diff)
downloadFreeBSD-src-6549ef7d128d37c0dfff87f6c1c189b42ed3e1ef.zip
FreeBSD-src-6549ef7d128d37c0dfff87f6c1c189b42ed3e1ef.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sbin/pfctl')
-rw-r--r--sbin/pfctl/parse.y15
1 files changed, 12 insertions, 3 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 9b22a6b..a03ddbc 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1605,13 +1605,22 @@ bandwidth : STRING {
bps = strtod($1, &cp);
if (cp != NULL) {
+ if (strlen(cp) > 1) {
+ char *cu = cp + 1;
+ if (!strcmp(cu, "Bit") ||
+ !strcmp(cu, "B") ||
+ !strcmp(cu, "bit") ||
+ !strcmp(cu, "b")) {
+ *cu = 0;
+ }
+ }
if (!strcmp(cp, "b"))
; /* nothing */
- else if (!strcmp(cp, "Kb"))
+ else if (!strcmp(cp, "K"))
bps *= 1000;
- else if (!strcmp(cp, "Mb"))
+ else if (!strcmp(cp, "M"))
bps *= 1000 * 1000;
- else if (!strcmp(cp, "Gb"))
+ else if (!strcmp(cp, "G"))
bps *= 1000 * 1000 * 1000;
else if (!strcmp(cp, "%")) {
if (bps < 0 || bps > 100) {
OpenPOWER on IntegriCloud