Expand PMF_FN_* macros.
[netbsd-mini2440.git] / etc / rc.d / ipnat
blob82e32c14e856d72e318931803894965004dd7ad3
1 #!/bin/sh
3 # $NetBSD: ipnat,v 1.12 2004/10/11 15:00:51 christos Exp $
6 # PROVIDE: ipnat
7 # REQUIRE: ipfilter mountcritremote
8 # BEFORE: SERVERS
10 $_rc_subr_loaded . /etc/rc.subr
12 name="ipnat"
13 rcvar=$name
14 config="/etc/ipnat.conf"
15 start_cmd="ipnat_start"
16 stop_cmd="/usr/sbin/ipnat -F -C"
17 reload_cmd="/usr/sbin/ipnat -C -f ${config}"
18 restart_cmd="/usr/sbin/ipnat -F -C -f ${config}"
19 extra_commands="reload"
21 ipnat_start()
23 if [ ! -f ${config} ]; then
24 return 0
26 if [ "$(/sbin/sysctl -n net.inet.ip.forwarding)" = "0" ]; then
27 logger -s -p daemon.warning -t ipnat \
28 "WARNING: net.inet.ip.forwarding is 0"
30 if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then
31 echo "Enabling ipfilter for NAT."
32 /sbin/ipf -E -Fa
34 echo -n "Installing NAT rules ... "
35 /usr/sbin/ipnat -F -f ${config}
38 load_rc_config $name
39 load_rc_config_var ipfilter ipfilter
40 run_rc_command "$1"