This might not be the fix we want in the long run, but it surely
prevents frustration when making a typo in the interface name.

As reported by Sebastien Marie and claudio@.

OK?

diff --git sys/net/pf_ioctl.c sys/net/pf_ioctl.c
index 43cccdb2efa..c563a439c45 100644
--- sys/net/pf_ioctl.c
+++ sys/net/pf_ioctl.c
@@ -582,11 +582,11 @@ pf_ifp2q(struct pf_queue_if *list, struct ifnet *ifp)
 int
 pf_create_queues(void)
 {
        struct pf_queuespec     *q;
        struct ifnet            *ifp;
-       struct pf_queue_if              *list = NULL, *qif;
+       struct pf_queue_if      *list = NULL, *qif;
        int                      error;
 
        /*
         * Find root queues and allocate traffic conditioner
         * private data for these interfaces
@@ -1128,20 +1128,19 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, 
struct proc *p)
                bcopy(&q->queue, qs, sizeof(*qs));
                qs->qid = pf_qname2qid(qs->qname, 1);
                if (qs->parent[0] && (qs->parent_qid =
                    pf_qname2qid(qs->parent, 0)) == 0) {
                        pool_put(&pf_queue_pl, qs);
-                       error = ESRCH;
+                       error = EINVAL;
                        break;
                }
                qs->kif = pfi_kif_get(qs->ifname);
-               if (qs->kif == NULL) {
+               if (qs->kif == NULL || qs->kif->pfik_ifp == NULL) {
                        pool_put(&pf_queue_pl, qs);
-                       error = ESRCH;
+                       error = EINVAL;
                        break;
                }
-               /* XXX resolve bw percentage specs */
                pfi_kif_ref(qs->kif, PFI_KIF_REF_RULE);
 
                TAILQ_INSERT_TAIL(pf_queues_inactive, qs, entries);
 
                break;

Reply via email to