Hello,

We distributed the pf.conf for several machines from a central
server. If we configure altq using interface names not existing on
this server, it is not possible to run pfctl -nf without an error
from the SIOCGIFMTU ioctl call in getifmtu().
This patch prevents the call to getifmtu() if pfctl is run with -n.

Greetings,
Matthias


Index: pfctl_altq.c
===================================================================
RCS file: /mount/cvsdev/cvs/openbsd/src/sbin/pfctl/pfctl_altq.c,v
retrieving revision 1.97
diff -u -p -r1.97 pfctl_altq.c
--- pfctl_altq.c        4 Jul 2011 01:07:43 -0000       1.97
+++ pfctl_altq.c        26 Apr 2012 11:40:44 -0000
@@ -244,7 +244,12 @@ eval_pfaltq(struct pfctl *pf, struct pf_
                        size = 8;
                else
                        size = 24;
-               size = size * getifmtu(pa->ifname);
+
+               if ((pf->opts & PF_OPT_NOACTION) == 0)
+                       size = size * getifmtu(pa->ifname);
+               else
+                       size = size * 1500;
+
                if (size > 0xffff)
                        size = 0xffff;
                pa->tbrsize = size;
@@ -391,7 +396,11 @@ eval_pfqueue_cbq(struct pfctl *pf, struc
                return (-1);
        }

-       ifmtu = getifmtu(pa->ifname);
+       if ((pf->opts & PF_OPT_NOACTION) == 0)
+               ifmtu = getifmtu(pa->ifname);
+       else
+               ifmtu = 1500;
+
        opts = &pa->pq_u.cbq_opts;

        if (opts->pktsize == 0) {       /* use default */

Reply via email to