diff options
author | Kenjiro Cho <kjc@cvs.openbsd.org> | 2003-07-31 09:46:09 +0000 |
---|---|---|
committer | Kenjiro Cho <kjc@cvs.openbsd.org> | 2003-07-31 09:46:09 +0000 |
commit | 3ce23d26f22be24cf8adda63ab5793d52b21b0a5 (patch) | |
tree | a53a3dd1441ed19a38f6937bd7bacc2ea2bcc1e3 | |
parent | 53cf0add15f57ea8a3fb082687b333e745c835ce (diff) |
remove the old tree when we find a new ticket.
this fixes printing obsolete (non-existent) queues.
ok henning@
-rw-r--r-- | sbin/pfctl/pfctl_qstats.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sbin/pfctl/pfctl_qstats.c b/sbin/pfctl/pfctl_qstats.c index d0d485e1d38..23c431ea1fd 100644 --- a/sbin/pfctl/pfctl_qstats.c +++ b/sbin/pfctl/pfctl_qstats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_qstats.c,v 1.23 2003/06/21 20:57:45 dhartmei Exp $ */ +/* $OpenBSD: pfctl_qstats.c,v 1.24 2003/07/31 09:46:08 kjc Exp $ */ /* * Copyright (c) Henning Brauer <henning@openbsd.org> @@ -112,6 +112,7 @@ pfctl_update_qstats(int dev, struct pf_altq_node **root) struct pfioc_qstats pq; u_int32_t mnr, nr; struct queue_stats qstats; + static u_int32_t last_ticket; memset(&pa, 0, sizeof(pa)); memset(&pq, 0, sizeof(pq)); @@ -120,6 +121,14 @@ pfctl_update_qstats(int dev, struct pf_altq_node **root) warn("DIOCGETALTQS"); return (-1); } + + /* if a new set is found, start over */ + if (pa.ticket != last_ticket && *root != NULL) { + pfctl_free_altq_node(*root); + *root = NULL; + } + last_ticket = pa.ticket; + mnr = pa.nr; for (nr = 0; nr < mnr; ++nr) { pa.nr = nr; |