Hello.

If we recompile kernel without ALTQ support, during loading system
the message
" No ALTQ support in the kernel
  ALTQ related functions disabled "
will be printed twice since from /etc/rc there are two calls pfctl.
It, you see, irritates a little... Also this message is constantly
deduced at enable/disable packet filter...
One of numerous variants of the decision of this "issue" is below
enclosed. Just simply print this message when the -q or -v mode is
required.

Tested on OpenBSD 3.2-current/i386

-- 
 Andrushock

Index: src/sbin/pfctl/pfctl.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl.c,v
retrieving revision 1.117
diff -u -r1.117 pfctl.c
--- src/sbin/pfctl/pfctl.c      2003/01/01 17:20:14     1.117
+++ src/sbin/pfctl/pfctl.c      2003/01/03 20:23:58
@@ -77,7 +77,7 @@
 int     pfctl_debug(int, u_int32_t, int);
 int     pfctl_clear_rule_counters(int, int);
 int     pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t);
-int     pfctl_test_altqsupport(int);
+int     pfctl_test_altqsupport(int, int);
 int     pfctl_show_anchors(int, int);
 
 char   *clearopt;
@@ -1167,14 +1167,17 @@
 }
 
 int
-pfctl_test_altqsupport(int dev)
+pfctl_test_altqsupport(int dev, int opts)
 {
        struct pfioc_altq pa;
 
        if (ioctl(dev, DIOCGETALTQS, &pa)) {
                if (errno == ENODEV) {
-                       fprintf(stderr, "No ALTQ support in the kernel\n");
-                       fprintf(stderr, "ALTQ related functions disabled\n");
+                       if ((opts & PF_OPT_QUIET) != 0 ||
+                           (opts & PF_OPT_VERBOSE) != 0) {
+                                fprintf(stderr, "No ALTQ support in the kernel\n");
+                                fprintf(stderr, "ALTQ related functions disabled\n");
+                       }
                        return (0);
                } else
                        err(1, "DIOCGETALTQS");
@@ -1366,7 +1369,7 @@
                dev = open("/dev/pf", mode);
                if (dev == -1)
                        err(1, "open(\"/dev/pf\")");
-               altqsupport = pfctl_test_altqsupport(dev);
+               altqsupport = pfctl_test_altqsupport(dev, opts);
        } else {
                /* turn off options */
                opts &= ~ (PF_OPT_DISABLE | PF_OPT_ENABLE); 

Reply via email to