Simplify the code by making use of 'kldstat -q -m <mod>'.

No objections from:	mlaier
This commit is contained in:
pjd 2005-09-24 15:57:17 +00:00
parent 479d185b1e
commit 264e350e93
2 changed files with 4 additions and 7 deletions

View File

@ -30,8 +30,8 @@ extra_commands="check reload resync status"
pf_prestart()
{
# load pf kernel module if needed
if ! kldstat -v | grep -q pf\$; then
if kldload pf; then
if ! kldstat -q -m pf ; then
if kldload pf ; then
info 'pf module loaded.'
else
err 1 'pf module failed to load.'
@ -84,10 +84,7 @@ pf_reload()
pf_resync()
{
# Don't resync if pf is not loaded
if ! kldstat -v | grep -q pf\$ ; then
return
fi
${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
kldstat -q -m pf && ${pf_program:-/sbin/pfctl} -f "${pf_rules}" ${pf_flags}
}
pf_status()

View File

@ -26,7 +26,7 @@ extra_commands="resync status"
pflog_prestart()
{
# load pflog kernel module if needed
if ! kldstat -v | grep -q pflog\$; then
if ! kldstat -q -m pflog; then
if kldload pf; then
info 'pflog module loaded.'
else