diff options
author | mtm <mtm@FreeBSD.org> | 2003-04-24 08:20:47 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2003-04-24 08:20:47 +0000 |
commit | a6c5ee3cc4da9ead0959ff4821507c2229de063f (patch) | |
tree | c0744a674488d76a59082db26fc4805a539f9646 /etc/rc.d/ipfs | |
parent | 2b308e25a03938ef728237c7cc2d42d7bdac5f43 (diff) | |
download | FreeBSD-src-a6c5ee3cc4da9ead0959ff4821507c2229de063f.zip FreeBSD-src-a6c5ee3cc4da9ead0959ff4821507c2229de063f.tar.gz |
Make ipfilter, ipnat, ipmon, and ipfs behave more like the old rc.
o group them together so they run one right after another
o use the NetBSD supplied ipfs script instead of tacking
it on to the end of ipnat
o Load the ipl module in ipnat and ipfilter, if it's not already
loaded
o In ipmon and ipnat show a warning if neither ipfilter nor
ipnat is enabled or the ipl module is not loaded, and exit
Approved by: markm (mentor) (implicit)
Tested by: leafy <leafy@leafy.idv.tw>
Diffstat (limited to 'etc/rc.d/ipfs')
-rwxr-xr-x | etc/rc.d/ipfs | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/etc/rc.d/ipfs b/etc/rc.d/ipfs index 0abdba0..1f8f9fb 100755 --- a/etc/rc.d/ipfs +++ b/etc/rc.d/ipfs @@ -1,23 +1,47 @@ #!/bin/sh # # $NetBSD: ipfs,v 1.3 2002/02/11 13:55:42 lukem Exp $ +# $FreeBSD$ # # PROVIDE: ipfs -# REQUIRE: ipnat mountcritremote -# KEYWORD: shutdown +# REQUIRE: ipnat +# BEFORE: netif +# KEYWORD: FreeBSD NetBSD shutdown . /etc/rc.subr name="ipfs" -rcvar=$name +rcvar=`set_rcvar` start_cmd="ipfs_start" stop_cmd="ipfs_stop" +case ${OSTYPE} in +FreeBSD) + start_precmd="ipfs_prestart" + ;; +NetBSD) + ipfs_program="/usr/sbin/ipfs" + ;; +esac + +ipfs_prestart() +{ + # Do not continue if either ipnat or ipfilter is not enabled or + # if the ipfilter module is not loaded. + # + if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then + err 1 "${name} requires either ipfilter or ipnat enabled" + fi + if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then + err 1 "ipfilter module is not loaded" + fi + return 0 +} ipfs_start() { if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then - /usr/sbin/ipfs -R ${rc_flags} + ${ipfs_program} -R ${rc_flags} rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf fi } @@ -29,7 +53,7 @@ ipfs_stop() chmod 700 /var/db/ipf chown root:wheel /var/db/ipf fi - /usr/sbin/ipfs -W ${rc_flags} + ${ipfs_program} -W ${rc_flags} } load_rc_config $name |