diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-02 23:37:25 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-03-02 23:37:25 +0000 |
commit | ad32c5e5312d7849dc07ea3addb6c72893026a6c (patch) | |
tree | 79bd1d8ece0b4e95acd82546efa93ad8eae51d14 /sbin/pfctl/pfctl_altq.c | |
parent | 11a37d155b51dea710d060d2eb85c083de9208bf (diff) |
when printing queues at load time that have bandwidth specified in percent,
print the bandwidth in percent instead of the calculated absolute value.
if a queue belongs to more than one interface and they have different
bandwidth the calculated absolute is of course different per interface.
previously the first calculated absolute value was shown; what of course is
incorrect on the second interface. note that only the print was wrong, the
correct values were passed to the kernel.
ok theo daniel
Diffstat (limited to 'sbin/pfctl/pfctl_altq.c')
-rw-r--r-- | sbin/pfctl/pfctl_altq.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c index bb9034020bd..16ea795fbf7 100644 --- a/sbin/pfctl/pfctl_altq.c +++ b/sbin/pfctl/pfctl_altq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_altq.c,v 1.39 2003/03/02 12:37:49 henning Exp $ */ +/* $OpenBSD: pfctl_altq.c,v 1.40 2003/03/02 23:37:24 henning Exp $ */ /* * Copyright (C) 2002 @@ -161,10 +161,10 @@ qid_to_qname(u_int32_t qid, const char *ifname) } void -print_altq(const struct pf_altq *a, unsigned level) +print_altq(const struct pf_altq *a, unsigned level, u_int16_t bwpercent) { if (a->qname[0] != NULL) { - print_queue(a, level); + print_queue(a, level, bwpercent); return; } @@ -188,14 +188,18 @@ print_altq(const struct pf_altq *a, unsigned level) break; } - printf("bandwidth %s ", rate2str((double)a->ifbandwidth)); + if (bwpercent > 0) { + if (bwpercent < 100) + printf("bandwidth %u%% ", bwpercent); + } else + printf("bandwidth %s ", rate2str((double)a->ifbandwidth)); if (a->qlimit != DEFAULT_QLIMIT) printf("qlimit %u ", a->qlimit); printf("tbrsize %u ", a->tbrsize); } void -print_queue(const struct pf_altq *a, unsigned level) +print_queue(const struct pf_altq *a, unsigned level, u_int16_t bwpercent) { unsigned i; @@ -203,8 +207,13 @@ print_queue(const struct pf_altq *a, unsigned level) for (i = 0; i < level; ++i) printf(" "); printf("%s ", a->qname); - if (a->scheduler == ALTQT_CBQ || a->scheduler == ALTQT_HFSC) - printf("bandwidth %s ", rate2str((double)a->bandwidth)); + if (a->scheduler == ALTQT_CBQ || a->scheduler == ALTQT_HFSC) { + if (bwpercent > 0) { + if (bwpercent < 100) + printf("bandwidth %u%% ", bwpercent); + } else + printf("bandwidth %s ", rate2str((double)a->bandwidth)); + } if (a->priority != DEFAULT_PRIORITY) printf("priority %u ", a->priority); if (a->qlimit != DEFAULT_QLIMIT) |