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