summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/altq/altq_priq.c20
-rw-r--r--sys/altq/altq_priq.h3
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/altq/altq_priq.c b/sys/altq/altq_priq.c
index f359d71321f..59d212cc586 100644
--- a/sys/altq/altq_priq.c
+++ b/sys/altq/altq_priq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_priq.c,v 1.15 2003/04/02 16:17:42 henning Exp $ */
+/* $OpenBSD: altq_priq.c,v 1.16 2003/04/03 14:31:02 henning Exp $ */
/* $KAME: altq_priq.c,v 1.1 2000/10/18 09:15:23 kjc Exp $ */
/*
* Copyright (C) 2000
@@ -135,12 +135,9 @@ priq_add_queue(struct pf_altq *a)
/* check parameters */
if (a->priority >= PRIQ_MAXPRI)
return (EINVAL);
-
if (a->qid == 0)
return (EINVAL);
-
- /* qid is tied to priority with priq */
- if (a->qid != a->priority + 1)
+ if (a->qid > PRIQ_MAXQID)
return (EINVAL);
if (clh_to_clp(pif, a->qid) != NULL)
return (EBUSY);
@@ -564,12 +561,15 @@ get_class_stats(struct priq_classstats *sp, struct priq_class *cl)
static struct priq_class *
clh_to_clp(struct priq_if *pif, u_int32_t chandle)
{
- u_int idx;
+ int idx;
if (chandle == 0)
return (NULL);
- idx = chandle - 1;
- if (idx >= PRIQ_MAXPRI)
- return (NULL);
- return (pif->pif_classes[idx]);
+
+ for (idx = pif->pif_maxpri; idx >= 0; idx--)
+ if (pif->pif_classes[idx] != NULL &&
+ pif->pif_classes[idx]->cl_handle == chandle)
+ return (pif->pif_classes[idx]);
+
+ return (NULL);
}
diff --git a/sys/altq/altq_priq.h b/sys/altq/altq_priq.h
index dc6e5a4be5d..7e3628b6353 100644
--- a/sys/altq/altq_priq.h
+++ b/sys/altq/altq_priq.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: altq_priq.h,v 1.4 2002/12/16 17:27:20 henning Exp $ */
+/* $OpenBSD: altq_priq.h,v 1.5 2003/04/03 14:31:02 henning Exp $ */
/* $KAME: altq_priq.h,v 1.1 2000/10/18 09:15:23 kjc Exp $ */
/*
* Copyright (C) 2000-2002
@@ -39,6 +39,7 @@ extern "C" {
#endif
#define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */
+#define PRIQ_MAXQID 256 /* upper limit of queues */
/* priq class flags */
#define PRCF_RED 0x0001 /* use RED */