Add PCICAP_{ID,NEXTPTR} to avoid using magic number
[dragonfly.git] / etc / rc.d / ipnat
blob4a9d45583e001c2001380b96a10608be2c8c512f
1 #!/bin/sh
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.3 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: ipnat
9 # REQUIRE: ipfilter
10 # BEFORE: DAEMON netif
12 . /etc/rc.subr
14 name="ipnat"
15 rcvar=`set_rcvar`
16 load_rc_config $name
19 start_precmd="ipnat_precmd"
20 start_cmd="ipnat_start"
21 stop_cmd="${ipnat_program} -F -C"
22 reload_cmd="${ipnat_program} -F -C -f ${ipnat_rules}"
23 extra_commands="reload"
25 ipnat_precmd()
28 # Make sure ipfilter is loaded before continuing
29 if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1; then
30 if kldload ipl; then
31 info 'IP-filter module loaded.'
32 else
33 err 1 'IP-filter module failed to load.'
36 return 0
39 ipnat_start()
41 if [ ! -f ${ipnat_rules} ]; then
42 warn 'NO IPNAT RULES'
43 return 0
45 echo -n "Installing NAT rules."
46 ${ipnat_program} -CF -f ${ipnat_rules} ${ipnat_flags}
49 run_rc_command "$1"