From 8df3ed961bab5b8c6a9d508ef589bc317f5a1d84 Mon Sep 17 00:00:00 2001 From: mux Date: Sat, 24 Jan 2004 20:40:11 +0000 Subject: Move the test used to determine whether IPFilter is loaded or not into its own function to avoid a small duplication of code. --- etc/rc.d/ipfilter | 13 +++++++++++-- 1 file 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} -- cgit v1.1