Use .Xr for manpage references.
[dragonfly/vkernel-mp.git] / etc / rc.d / ipfs
blobe510440f1706c3144ae56f4f8c6719b58239acba
1 #!/bin/sh
3 # $NetBSD: ipfs,v 1.3 2002/02/11 13:55:42 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/ipfs,v 1.2 2003/04/24 08:20:47 mtm Exp $
5 # $DragonFly: src/etc/rc.d/ipfs,v 1.4 2005/11/19 22:47:32 swildner Exp $
8 # PROVIDE: ipfs
9 # REQUIRE: ipnat
10 # BEFORE: netif
11 # KEYWORD: shutdown
13 . /etc/rc.subr
15 name="ipfs"
16 rcvar=`set_rcvar`
17 start_cmd="ipfs_start"
18 stop_cmd="ipfs_stop"
19 start_precmd="ipfs_prestart"
21 ipfs_prestart()
23 # Do not continue if either ipnat or ipfilter is not enabled or
24 # if the ipfilter module is not loaded.
26 if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
27 err 1 "${name} requires either ipfilter or ipnat enabled"
29 if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
30 err 1 "ipfilter module is not loaded"
32 return 0
35 ipfs_start()
37 if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then
38 ${ipfs_program} -R ${rc_flags}
39 rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf
43 ipfs_stop()
45 if [ ! -d /var/db/ipf ]; then
46 mkdir /var/db/ipf
47 chmod 700 /var/db/ipf
48 chown root:wheel /var/db/ipf
50 ${ipfs_program} -W ${rc_flags}
53 load_rc_config $name
54 run_rc_command "$1"