Simplify the code by making use of 'kldstat -q -m <mod>'.
No objections from: mlaier
This commit is contained in:
parent
16f309f0e2
commit
9d503e9def
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150516
@ -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()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user