Bring RCNG in from 5.x and adjust config files and scripts accordingly.
[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.1 2003/07/24 06:35:37 dillon Exp $
6 #
7
8 # PROVIDE: ipmon
9 # REQUIRE: mountcritlocal hostname sysctl cleanvar
10 # BEFORE:  SERVERS
11 # KEYWORD: DragonFly FreeBSD NetBSD
12
13 . /etc/rc.subr
14
15 name="ipmon"
16 rcvar=`set_rcvar`
17
18 case ${OSTYPE} in
19 DragonFly)
20         command="/sbin/ipmon"
21         start_precmd="ipmon_precmd"
22         ;;
23 FreeBSD)
24         command="/sbin/ipmon"
25         start_precmd="ipmon_precmd"
26         ;;
27 NetBSD)
28         command="/usr/sbin/${name}"
29         command_args="-D"
30 esac
31
32 ipmon_precmd()
33 {
34         # Continue only if ipfilter or ipnat is enabled and the
35         # ipfilter module is loaded.
36         #
37         if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
38                 err 1  "${name} requires either ipfilter or ipnat enabled"
39         fi
40         if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
41                 err 1 "ipfilter module is not loaded"
42         fi
43         return 0
44 }
45
46 load_rc_config $name
47 run_rc_command "$1"