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:
Kristof Provost 2016-03-27 17:22:27 +00:00
parent 938e6bb267
commit 2f396d3cc3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297315

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"