diff options
author | Max Laier <mlaier@FreeBSD.org> | 2008-03-29 00:24:36 +0000 |
---|---|---|
committer | Max Laier <mlaier@FreeBSD.org> | 2008-03-29 00:24:36 +0000 |
commit | 4239d24b98a8a28300e57c230ae1bd8fce23eb4a (patch) | |
tree | b0363f790c9c62f1567a85647536e62fccc84fb5 /contrib/pf/pfctl/pfctl_qstats.c | |
parent | 9e74206fe02a7e0a964e21871e2d953408b8705f (diff) | |
download | src-4239d24b98a8a28300e57c230ae1bd8fce23eb4a.tar.gz src-4239d24b98a8a28300e57c230ae1bd8fce23eb4a.zip |
Make ALTQ cope with disappearing interfaces (particularly common with mpd
and netgraph in gernal). This also allows to add queues for an interface
that is not yet existing (you have to provide the bandwidth for the
interface, however).
PR: kern/106400, kern/117827
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=177700
Diffstat (limited to 'contrib/pf/pfctl/pfctl_qstats.c')
-rw-r--r-- | contrib/pf/pfctl/pfctl_qstats.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/pf/pfctl/pfctl_qstats.c b/contrib/pf/pfctl/pfctl_qstats.c index 28535c2410fb..d4089d6fbc83 100644 --- a/contrib/pf/pfctl/pfctl_qstats.c +++ b/contrib/pf/pfctl/pfctl_qstats.c @@ -118,6 +118,10 @@ pfctl_show_altq(int dev, const char *iface, int opts, int verbose2) for (node = root; node != NULL; node = node->next) { if (iface != NULL && strcmp(node->altq.ifname, iface)) continue; +#ifdef __FreeBSD__ + if (node->altq.local_flags & PFALTQ_FLAG_IF_REMOVED) + continue; +#endif pfctl_print_altq_node(dev, node, 0, opts); } } @@ -157,7 +161,12 @@ pfctl_update_qstats(int dev, struct pf_altq_node **root) warn("DIOCGETALTQ"); return (-1); } +#ifdef __FreeBSD__ + if (pa.altq.qid > 0 && + !(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) { +#else if (pa.altq.qid > 0) { +#endif pq.nr = nr; pq.ticket = pa.ticket; pq.buf = &qstats.data; @@ -175,6 +184,19 @@ pfctl_update_qstats(int dev, struct pf_altq_node **root) pfctl_insert_altq_node(root, pa.altq, qstats); } } +#ifdef __FreeBSD__ + else if (pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED) { + memset(&qstats.data, 0, sizeof(qstats.data)); + if ((node = pfctl_find_altq_node(*root, pa.altq.qname, + pa.altq.ifname)) != NULL) { + memcpy(&node->qstats.data, &qstats.data, + sizeof(qstats.data)); + update_avg(node); + } else { + pfctl_insert_altq_node(root, pa.altq, qstats); + } + } +#endif } return (mnr); } @@ -280,6 +302,10 @@ pfctl_print_altq_nodestat(int dev, const struct pf_altq_node *a) { if (a->altq.qid == 0) return; +#ifdef __FreeBSD__ + if (a->altq.local_flags & PFALTQ_FLAG_IF_REMOVED) + return; +#endif switch (a->altq.scheduler) { case ALTQT_CBQ: |