summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2004-01-24 20:40:11 +0000
committermux <mux@FreeBSD.org>2004-01-24 20:40:11 +0000
commit8df3ed961bab5b8c6a9d508ef589bc317f5a1d84 (patch)
tree80861155d127cf34d232965d7e9a75a89922bb46 /etc
parentb848950961a58769ee66023a4d754c9cb43cae21 (diff)
downloadFreeBSD-src-8df3ed961bab5b8c6a9d508ef589bc317f5a1d84.zip
FreeBSD-src-8df3ed961bab5b8c6a9d508ef589bc317f5a1d84.tar.gz
Move the test used to determine whether IPFilter is loaded or not
into its own function to avoid a small duplication of code.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/ipfilter13
1 files changed, 11 insertions, 2 deletions
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter
index a17cea6..0e63fd3 100755
--- a/etc/rc.d/ipfilter
+++ b/etc/rc.d/ipfilter
@@ -27,10 +27,19 @@ status_precmd="$stop_precmd"
status_cmd="ipfilter_status"
extra_commands="reload resync status"
+ipfilter_loaded()
+{
+ if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
+ return 1
+ else
+ return 0
+ fi
+}
+
ipfilter_prestart()
{
# load ipfilter kernel module if needed
- if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
+ if ! ipfilter_loaded; then
if kldload ipl; then
info 'IP-filter module loaded.'
else
@@ -97,7 +106,7 @@ ipfilter_reload()
ipfilter_resync()
{
# Don't resync if ipfilter is not loaded
- if ! kldstat -v | grep "IP Filter" > /dev/null 2>&1; then
+ if ! ipfilter_loaded; then
return
fi
${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags}
OpenPOWER on IntegriCloud