[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with altq on -current



On Thu, Mar 06, 2003 at 02:37:48AM +0100, Henning Brauer wrote:
> I found your problem.
> 
> On Tue, Mar 04, 2003 at 11:30:14PM -0300, Andre Nathan wrote:
> > pass out inet from any to any flags S/SFRA keep state queue (q_def,
> > q_pri)
> 
> make that
> 
> pass out on $iface ....
> 
> until I found what causes this.

ok, found it.
this is the fix:

Index: parse.y
===================================================================
RCS file: /cvs/src/sbin/pfctl/parse.y,v
retrieving revision 1.335
diff -u -r1.335 parse.y
--- parse.y	2 Mar 2003 23:37:24 -0000	1.335
+++ parse.y	6 Mar 2003 10:18:28 -0000
@@ -3295,8 +3295,8 @@
 			errx(1, "expand_rule: strlcpy");
 		expand_label(r->label, r->ifname, r->af, src_host, src_port,
 		    dst_host, dst_port, proto->proto);
-		r->qid = qname_to_qid(r->qname, r->ifname);
-		if ((r->pqid = qname_to_qid(r->pqname, r->ifname)) == 0)
+		r->qid = qname_to_qid(r->qname);
+		if ((r->pqid = qname_to_qid(r->pqname)) == 0)
 			r->pqid = r->qid;
 		r->ifnot = interface->not;
 		r->proto = proto->proto;
Index: pfctl.h
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.h,v
retrieving revision 1.11
diff -u -r1.11 pfctl.h
--- pfctl.h	2 Mar 2003 23:37:24 -0000	1.11
+++ pfctl.h	6 Mar 2003 10:18:28 -0000
@@ -81,7 +81,7 @@
 void		 pfaltq_free(struct pf_altq *);
 struct pf_altq	*pfaltq_lookup(const char *);
 struct pf_altq	*qname_to_pfaltq(const char *, const char *);
-u_int32_t	 qname_to_qid(const char *, const char *);
+u_int32_t	 qname_to_qid(const char *);
 char		*qid_to_qname(u_int32_t, const char *);
 char		*rate2str(double);
 
Index: pfctl_altq.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl_altq.c,v
retrieving revision 1.41
diff -u -r1.41 pfctl_altq.c
--- pfctl_altq.c	3 Mar 2003 14:16:18 -0000	1.41
+++ pfctl_altq.c	6 Mar 2003 10:18:33 -0000
@@ -134,14 +134,18 @@
 }
 
 u_int32_t
-qname_to_qid(const char *qname, const char *ifname)
+qname_to_qid(const char *qname)
 {
 	struct pf_altq	*altq;
 
+	/*
+	 * We guarantee that same named queues on different interfaces
+	 * have the same qid, so we do NOT need to limit matching on
+	 * one interface!
+	 */
+
 	TAILQ_FOREACH(altq, &altqs, entries) {
-		if ((ifname == NULL ||
-		    strncmp(ifname, altq->ifname, IFNAMSIZ) == 0) &&
-		    strncmp(qname, altq->qname, PF_QNAME_SIZE) == 0)
+		if (strncmp(qname, altq->qname, PF_QNAME_SIZE) == 0)
 			return (altq->qid);
 	}
 	return (0);
@@ -318,7 +322,7 @@
 		errx(1, "altq not defined on %s", pa->ifname);
 	pa->scheduler = if_pa->scheduler;
 	pa->ifbandwidth = if_pa->ifbandwidth;
-	pa->qid = qname_to_qid(pa->qname, NULL);
+	pa->qid = qname_to_qid(pa->qname);
 
 	parent = NULL;
 	if (pa->parent[0] != 0) {


-- 
http://2suck.net/hhwl.html
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)