Switch to OpenNTPD by default. For the moment, the documentation is
[dragonfly.git] / etc / rc.d / ipnat
1 #!/bin/sh
2 #
3 # $NetBSD: ipnat,v 1.6 2000/09/19 13:04:38 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/ipnat,v 1.8 2003/04/30 02:54:17 mtm Exp $
5 # $DragonFly: src/etc/rc.d/ipnat,v 1.2 2004/01/26 17:21:15 rob Exp $
6 #
7
8 # PROVIDE: ipnat
9 # REQUIRE: ipfilter
10 # BEFORE:  DAEMON netif
11 # KEYWORD: DragonFly 
12
13 . /etc/rc.subr
14
15 name="ipnat"
16 rcvar=`set_rcvar`
17 load_rc_config $name
18
19
20 start_precmd="ipnat_precmd"
21 start_cmd="ipnat_start"
22 stop_cmd="${ipnat_program} -F -C"
23 reload_cmd="${ipnat_program} -F -C -f ${ipnat_rules}"
24 extra_commands="reload"
25
26 ipnat_precmd()
27 {
28
29         # Make sure ipfilter is loaded before continuing
30         if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1; then
31                 if kldload ipl; then
32                         info 'IP-filter module loaded.'
33                 else
34                         err 1 'IP-filter module failed to load.'
35                 fi
36         fi
37         return 0
38 }
39
40 ipnat_start()
41 {
42         if [ ! -f ${ipnat_rules} ]; then
43                 warn 'NO IPNAT RULES'
44                 return 0
45         fi
46         echo -n "Installing NAT rules."
47         ${ipnat_program} -CF -f ${ipnat_rules} ${ipnat_flags}
48 }
49
50 run_rc_command "$1"