summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-11-18 23:20:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-11-18 23:20:44 +0000
commit59facf573b9c1eb2700a2497279ecc74d794b65b (patch)
tree3214b3915bb4a11380635a35648baf2f7cd0a3f7
parentf1febdc20fe5fc7b7e503966efb5394de13d6a69 (diff)
support Gb in print; henning ok
-rw-r--r--sbin/pfctl/pfctl_altq.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c
index 7b7f30fb642..c11130fa95c 100644
--- a/sbin/pfctl/pfctl_altq.c
+++ b/sbin/pfctl/pfctl_altq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_altq.c,v 1.3 2002/11/18 23:13:32 deraadt Exp $ */
+/* $OpenBSD: pfctl_altq.c,v 1.4 2002/11/18 23:20:43 deraadt Exp $ */
/*
* Copyright (C) 2002
* Sony Computer Science Laboratories Inc. All rights reserved.
@@ -244,7 +244,8 @@ eval_pfqueue(struct pfctl *pf, struct pf_altq *pa, u_int32_t bw_absolute,
else if (bw_percent > 0 && parent != NULL)
pa->bandwidth = parent->bandwidth / 100 * bw_percent;
else
- errx(1, "bandwidth for %s invalid (%d / %d)", pa->qname, bw_absolute, bw_percent);
+ errx(1, "bandwidth for %s invalid (%d / %d)", pa->qname,
+ bw_absolute, bw_percent);
/*
* admission control: bandwidth should be smaller than the
@@ -583,6 +584,9 @@ rate2str(double rate)
if (rate == 0.0)
snprintf(buf, RATESTR_MAX, "0");
+ else if (rate >= 1024 * 1024 * 1024)
+ snprintf(buf, RATESTR_MAX, "%.2fGb",
+ rate / (1024.0 * 1024.0 * 1024.0));
else if (rate >= 1024 * 1024)
snprintf(buf, RATESTR_MAX, "%.2fMb", rate / (1024.0 * 1024.0));
else if (rate >= 1024)