[Bug 202996] pfctl: unitialized variable level in pfctl_set_debug

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Sep 9 15:15:27 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202996

            Bug ID: 202996
           Summary: pfctl: unitialized variable level in pfctl_set_debug
           Product: Base System
           Version: 10.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: andrej.kolontai at verwaltung.uni-muenchen.de

In pfctl.c, there is a function named pfctl_set_debug. 

The variable "level" in that function is declared but not initialized and used
in 

if (ioctl(dev, DIOCSETDEBUG, &level))

This can effectively set the pf debug level to loud (in my case it always does)
causing lots of messages on the console and syslog while the ruleset is loaded. 

In my case, this seems to have a serious impact on performance. 

I've made a patch:

--- /home/kolontai/pfctl.c    2015-09-09 17:11:05.016276000 +0200
+++ pfctl.c    2015-09-09 15:37:05.849986000 +0200
@@ -1845,6 +1845,8 @@
     }

     pf->debug_set = 1;
+    level = pf->debug;
+

     if ((pf->opts & PF_OPT_NOACTION) == 0)
         if (ioctl(dev, DIOCSETDEBUG, &level))

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list