pf: Friendly error message for status if pf.ko is not loaded

Check if pf.ko is loaded (i.e. /dev/pf exists) before trying to use it. This
means that '/etc/rc.d/pf status' will no longer return 'pfctl: /dev/pf: No such
file or directory' but 'pf.ko is not loaded'.

PR:		205671
Submitted by:	Johannes Jost Meixner <xmj@FreeBSD.org>
This commit is contained in:
kp 2016-03-27 17:22:27 +00:00
parent 7ff965d828
commit 81a16edc2f

View File

@ -66,7 +66,11 @@ pf_resync()
pf_status()
{
$pf_program -s info
if ! [ -c /dev/pf ] ; then
echo "pf.ko is not loaded"
else
$pf_program -s info
fi
}
run_rc_command "$1"