pfctl(8) doesn't check that there is at most one root queue per interface.
For example:

  queue r0 on $if bandwidth 100M default
  queue r1 on $if bandwidth 100M default

# pfctl -f /etc/pf.conf
pfctl: DIOCXCOMMIT: Invalid argument

Below is a diff for pfctl(8) to detect and report this situation before
attempting to commit the queues.

Index: pfctl.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
retrieving revision 1.332
diff -u -p -r1.332 pfctl.c
--- pfctl.c     10 Dec 2015 17:27:00 -0000      1.332
+++ pfctl.c     11 Dec 2015 11:58:51 -0000
@@ -1120,6 +1120,16 @@ pfctl_add_queue(struct pfctl *pf, struct
                return (1);
        }
 
+       if (q->parent[0] == '\0') {
+               TAILQ_FOREACH(qi, &rootqs, entries) {
+                       if (strcmp(q->ifname, qi->qs.ifname))
+                           continue;
+                       printf("A queue is already defined on interface %s\n",
+                           qi->qs.ifname);
+                       return (1);
+               }
+       }
+
        if ((qi = calloc(1, sizeof(*qi))) == NULL)
                err(1, "calloc");
        bcopy(q, &qi->qs, sizeof(qi->qs));

Reply via email to