diff options
author | Glen Barber <gjb@FreeBSD.org> | 2016-04-16 02:32:12 +0000 |
---|---|---|
committer | Glen Barber <gjb@FreeBSD.org> | 2016-04-16 02:32:12 +0000 |
commit | 0edd2576c0e07f525c80e4aa5ff24350b55f18b7 (patch) | |
tree | a8871301d693c6d33d43cd3171b1ee4783fec0e4 /sbin/pfctl | |
parent | 010855174aaafbf3c0fee918f12e843089b58b6f (diff) | |
parent | d1ad1a7394330d70efc2f2c58862a02dd8900acf (diff) | |
download | src-0edd2576c0e07f525c80e4aa5ff24350b55f18b7.tar.gz src-0edd2576c0e07f525c80e4aa5ff24350b55f18b7.zip |
MFH
Sponsored by: The FreeBSD Foundation
Notes
Notes:
svn path=/projects/release-pkg/; revision=298092
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/parse.y | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9b22a6b032cc..a03ddbcfa3be 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) { |