summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2002-11-25 16:30:23 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2002-11-25 16:30:23 +0000
commit6b0e2443f3fc4f56d9ae666c996b3e91051c2304 (patch)
tree4e9d0a62f4f35b20b0a9d04c16586240c990bc73 /sbin
parente8fe94d8cdfd94b41e06b96953a8a007945e47f4 (diff)
1Kb = 1000b, not 1024; as discussed with kjc@ and theo
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pfctl/parse.y8
-rw-r--r--sbin/pfctl/pfctl_altq.c16
2 files changed, 12 insertions, 12 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 4f3d061a50f..edf9681bd6f 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.212 2002/11/25 15:50:58 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.213 2002/11/25 16:30:22 henning Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -638,11 +638,11 @@ bandwidth : /* empty */ {
if (!strcmp(cp, "b"))
;
else if (!strcmp(cp, "Kb"))
- bps *= 1024;
+ bps *= 1000;
else if (!strcmp(cp, "Mb"))
- bps *= 1024 * 1024;
+ bps *= 1000 * 1000;
else if (!strcmp(cp, "Gb"))
- bps *= 1024 * 1024 * 1024;
+ bps *= 1000 * 1000 * 1000;
else if (!strcmp(cp, "%")) {
if (bps < 0 || bps > 100) {
yyerror("bandwidth spec "
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index 717d807860d..378ba32159e 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_altq.c,v 1.8 2002/11/22 11:46:02 henning Exp $ */
+/* $OpenBSD: pfctl_altq.c,v 1.9 2002/11/25 16:30:22 henning Exp $ */
/*
* Copyright (C) 2002
* Sony Computer Science Laboratories Inc. All rights reserved.
@@ -172,11 +172,11 @@ eval_pfaltq(struct pfctl *pf, struct pf_altq *pa)
/* if tbrsize is not specified, use heuristics */
if (pa->tbrsize == 0) {
rate = pa->ifbandwidth;
- if (rate <= 1 * 1024 * 1024)
+ if (rate <= 1 * 1000 * 1000)
size = 1;
- else if (rate <= 10 * 1024 * 1024)
+ else if (rate <= 10 * 1000 * 1000)
size = 4;
- else if (rate <= 200 * 1024 * 1024)
+ else if (rate <= 200 * 1000 * 1000)
size = 8;
else
size = 24;
@@ -574,13 +574,13 @@ rate2str(double rate)
if (rate == 0.0)
snprintf(buf, RATESTR_MAX, "0");
- else if (rate >= 1024 * 1024 * 1024)
+ else if (rate >= 1000 * 1000 * 1000)
snprintf(buf, RATESTR_MAX, "%.2fGb",
- rate / (1024.0 * 1024.0 * 1024.0));
+ rate / (1000.0 * 1000.0 * 1000.0));
else if (rate >= 1024 * 1024)
- snprintf(buf, RATESTR_MAX, "%.2fMb", rate / (1024.0 * 1024.0));
+ snprintf(buf, RATESTR_MAX, "%.2fMb", rate / (1000.0 * 1000.0));
else if (rate >= 1024)
- snprintf(buf, RATESTR_MAX, "%.2fKb", rate / 1024.0);
+ snprintf(buf, RATESTR_MAX, "%.2fKb", rate / 1000.0);
else
snprintf(buf, RATESTR_MAX, "%db", (int)rate);
return (buf);