diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-04-14 14:50:47 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-04-14 14:50:47 +0000 |
commit | 6025c5c0ce44ad4000d159741e7c03539edcb7d5 (patch) | |
tree | 23f0b0574230aa835dbdd76d6b8e7868ab75769e /sbin/pfctl | |
parent | cac1b26a388dde755ee9b8f72a7f16ba49407e19 (diff) |
let print_altq and print_queue take a struct node_queue_bw parameter instead
of dintinct bw_percent
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/parse.y | 7 | ||||
-rw-r--r-- | sbin/pfctl/pfctl.h | 5 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_altq.c | 21 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.h | 6 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_qstats.c | 4 |
5 files changed, 22 insertions, 21 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 5b1d3c24f0b..9fa4a700fe3 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.365 2003/04/13 23:51:51 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.366 2003/04/14 14:50:46 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -3157,7 +3157,7 @@ expand_altq(struct pf_altq *a, struct node_if *interfaces, if (pf->opts & PF_OPT_VERBOSE) { print_altq(&pf->paltq->altq, 0, - bwspec.bw_percent); + &bwspec); if (nqueues && nqueues->tail) { printf("queue { "); LOOP_THROUGH(struct node_queue, queue, @@ -3336,8 +3336,7 @@ expand_queue(struct pf_altq *a, struct node_if *interfaces, (found == 1 && interface->ifname[0] == 0) || (found > 0 && interface->ifname[0] != 0))) { print_queue(&pf->paltq->altq, 0, - bwspec.bw_percent, - interface->ifname[0] != 0); + &bwspec, interface->ifname[0] != 0); if (nqueues && nqueues->tail) { printf("{ "); LOOP_THROUGH(struct node_queue, diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index cdcaeba8bba..873aee6a4c9 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.h,v 1.16 2003/04/11 15:18:33 henning Exp $ */ +/* $OpenBSD: pfctl.h,v 1.17 2003/04/14 14:50:46 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -82,9 +82,6 @@ void pfaltq_free(struct pf_altq *); struct pf_altq *pfaltq_lookup(const char *); char *rate2str(double); -void print_altq(const struct pf_altq *, unsigned, u_int16_t); -void print_queue(const struct pf_altq *, unsigned, u_int16_t, int); - void print_addr(struct pf_addr_wrap *, sa_family_t, int); void print_host(struct pf_state_host *, sa_family_t, int); void print_seq(struct pf_state_peer *); diff --git a/sbin/pfctl/pfctl_altq.c b/sbin/pfctl/pfctl_altq.c index f85ca257855..db0b0c7cb14 100644 --- a/sbin/pfctl/pfctl_altq.c +++ b/sbin/pfctl/pfctl_altq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_altq.c,v 1.64 2003/04/13 23:22:05 henning Exp $ */ +/* $OpenBSD: pfctl_altq.c,v 1.65 2003/04/14 14:50:46 henning Exp $ */ /* * Copyright (C) 2002 @@ -161,10 +161,10 @@ qname_to_qid(const char *qname) } void -print_altq(const struct pf_altq *a, unsigned level, u_int16_t bwpercent) +print_altq(const struct pf_altq *a, unsigned level, struct node_queue_bw *bw) { if (a->qname[0] != NULL) { - print_queue(a, level, bwpercent, 0); + print_queue(a, level, bw, 0); return; } @@ -185,18 +185,19 @@ print_altq(const struct pf_altq *a, unsigned level, u_int16_t bwpercent) break; } - if (bwpercent > 0) { - if (bwpercent < 100) - printf("bandwidth %u%% ", bwpercent); + if (bw != NULL && bw->bw_percent > 0) { + if (bw->bw_percent < 100) + printf("bandwidth %u%% ", bw->bw_percent); } 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, u_int16_t bwpercent, +print_queue(const struct pf_altq *a, unsigned level, struct node_queue_bw *bw, int print_interface) { unsigned i; @@ -208,9 +209,9 @@ print_queue(const struct pf_altq *a, unsigned level, u_int16_t bwpercent, if (print_interface) printf("on %s ", a->ifname); if (a->scheduler == ALTQT_CBQ || a->scheduler == ALTQT_HFSC) { - if (bwpercent > 0) { - if (bwpercent < 100) - printf("bandwidth %u%% ", bwpercent); + if (bw != NULL && bw->bw_percent > 0) { + if (bw->bw_percent < 100) + printf("bandwidth %u%% ", bw->bw_percent); } else printf("bandwidth %s ", rate2str((double)a->bandwidth)); } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 7af5b2c7862..fa78f1007a7 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.h,v 1.56 2003/04/13 20:41:37 henning Exp $ */ +/* $OpenBSD: pfctl_parser.h,v 1.57 2003/04/14 14:50:46 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -143,6 +143,10 @@ int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, int eval_pfqueue(struct pfctl *, struct pf_altq *, struct node_queue_bw *, struct node_queue_opt *); +void print_altq(const struct pf_altq *, unsigned, struct node_queue_bw *); +void print_queue(const struct pf_altq *, unsigned, struct node_queue_bw *, + int); + void pfctl_begin_table(void); void pfctl_append_addr(char *, int, int); void pfctl_append_file(char *); diff --git a/sbin/pfctl/pfctl_qstats.c b/sbin/pfctl/pfctl_qstats.c index c6d3957b4bc..b038d084b18 100644 --- a/sbin/pfctl/pfctl_qstats.c +++ b/sbin/pfctl/pfctl_qstats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_qstats.c,v 1.15 2003/03/11 11:53:28 henning Exp $ */ +/* $OpenBSD: pfctl_qstats.c,v 1.16 2003/04/14 14:50:46 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -229,7 +229,7 @@ pfctl_print_altq_node(int dev, const struct pf_altq_node *node, unsigned level, if (node == NULL) return; - print_altq(&node->altq, level, 0); + print_altq(&node->altq, level, NULL); if (node->children != NULL) { printf("{"); |