Merge from vendor branch LIBARCHIVE:
[dragonfly.git] / etc / rc.d / ipmon
1 #!/bin/sh
2 #
3 # $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/ipmon,v 1.6 2003/07/14 13:02:36 mtm Exp $
5 # $DragonFly: src/etc/rc.d/ipmon,v 1.4 2005/11/19 21:47:32 swildner Exp $
6 #
7
8 # PROVIDE: ipmon
9 # REQUIRE: mountcritlocal hostname sysctl cleanvar
10 # BEFORE:  SERVERS
11
12 . /etc/rc.subr
13
14 name="ipmon"
15 rcvar=`set_rcvar`
16
17         command="/sbin/ipmon"
18         start_precmd="ipmon_precmd"
19
20 ipmon_precmd()
21 {
22         # Continue only if ipfilter or ipnat is enabled and the
23         # ipfilter module is loaded.
24         #
25         if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
26                 err 1  "${name} requires either ipfilter or ipnat enabled"
27         fi
28         if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
29                 err 1 "ipfilter module is not loaded"
30         fi
31         return 0
32 }
33
34 load_rc_config $name
35 run_rc_command "$1"