[Bug 228632] /etc/rc.d/pf returns incorrect exit status.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu May 31 11:27:26 UTC 2018


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

            Bug ID: 228632
           Summary: /etc/rc.d/pf returns incorrect exit status.
           Product: Base System
           Version: 11.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: standards at FreeBSD.org
          Reporter: jimmypw at gmail.com

Overview:

In the pf rc.d script the output of `/etc/rc.d/pf status` or `/etc/rc.d/pf
onestatus` always provides an exit status of 0. This makes it fiddly to
programmatically determine if pf is running or not. 

To Reproduce:

Run `/etc/rc.d/pf onestatus` at any point before pf has been started for the
first time or after the service has been stopped.

Actual Results:

Case 1) (When module not loaded)
# service pf onestatus
pf.ko is not loaded
# echo $?
0

Case 2) (When module is loaded but the status is disabled)
# service pf onestatus
Status: Disabled for 0 days 00:01:48          Debug: Urgent

State Table                          Total             Rate
  current entries                        0               
...snip...
# echo $?
0


Expected results:

`service pf onestatus; echo $?` should return a non-zero exit status when the
service is not running.


Additional information:

While returning a non-zero exit status in the instance where the pf module has
not been loaded is a trivial modification to the init script. From what I can
tell from pfctl(8) there is no functionality to provide an exit status
reflecting the running state of pf.

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


More information about the freebsd-standards mailing list