diff options
author | yar <yar@FreeBSD.org> | 2006-12-31 10:37:18 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-12-31 10:37:18 +0000 |
commit | dc9f8423c3772111565181a8568c60c4da0a1689 (patch) | |
tree | 7ed36d4fe8965c59b37bcccfa387cf77469cbeef /etc/rc.d/ipfilter | |
parent | 58a4c67f05bc56e76c61ca19ed42f2e412cfd55f (diff) | |
download | FreeBSD-src-dc9f8423c3772111565181a8568c60c4da0a1689.zip FreeBSD-src-dc9f8423c3772111565181a8568c60c4da0a1689.tar.gz |
Use $required_modules wherever suitable. Use load_kld() in special
cases. So we get rid of quite a few lines of duplicated code.
Diffstat (limited to 'etc/rc.d/ipfilter')
-rwxr-xr-x | etc/rc.d/ipfilter | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter index 9142ec2..ca9ddc8 100755 --- a/etc/rc.d/ipfilter +++ b/etc/rc.d/ipfilter @@ -16,7 +16,7 @@ rcvar=`set_rcvar` load_rc_config $name stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}" -start_precmd="ipfilter_prestart" +start_precmd="$stop_precmd" start_cmd="ipfilter_start" stop_cmd="ipfilter_stop" reload_precmd="$stop_precmd" @@ -26,35 +26,7 @@ resync_cmd="ipfilter_resync" status_precmd="$stop_precmd" status_cmd="ipfilter_status" extra_commands="reload resync status" - -ipfilter_loaded() -{ - if ! kldstat -v | grep "ipfilter$" > /dev/null 2>&1; then - return 1 - else - return 0 - fi -} - -ipfilter_prestart() -{ - # load ipfilter kernel module if needed - if ! ipfilter_loaded; then - if kldload ipl; then - info 'IP-filter module loaded.' - else - err 1 'IP-filter module failed to load.' - fi - fi - - # check for ipfilter rules - if [ ! -r "${ipfilter_rules}" ] && [ ! -r "${ipv6_ipfilter_rules}" ] - then - warn 'IP-filter: NO IPF RULES' - return 1 - fi - return 0 -} +required_modules="ipl:ipfilter" ipfilter_start() { @@ -111,10 +83,6 @@ ipfilter_reload() ipfilter_resync() { - # Don't resync if ipfilter is not loaded - if ! ipfilter_loaded; then - return - fi ${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags} } |