904beb9e16
in keeping the scripts under rc.d in sync with us. So, remove NetBSD specific stuff (which made our scripts more complicated than necessary). The NetBSD ident string will be left intact, both for history and also incase we wish to pull in future versions.
47 lines
850 B
Bash
Executable File
47 lines
850 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $NetBSD: ipnat,v 1.6 2000/09/19 13:04:38 lukem Exp $
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: ipnat
|
|
# REQUIRE: ipfilter
|
|
# BEFORE: DAEMON netif
|
|
# KEYWORD: FreeBSD
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="ipnat"
|
|
rcvar=`set_rcvar`
|
|
load_rc_config $name
|
|
start_precmd="ipnat_precmd"
|
|
start_cmd="ipnat_start"
|
|
stop_cmd="${ipnat_program} -F -C"
|
|
reload_cmd="${ipnat_program} -F -C -f ${ipnat_rules}"
|
|
extra_commands="reload"
|
|
|
|
ipnat_precmd()
|
|
{
|
|
# Make sure ipfilter is loaded before continuing
|
|
if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1; then
|
|
if kldload ipl; then
|
|
info 'IP-filter module loaded.'
|
|
else
|
|
err 1 'IP-filter module failed to load.'
|
|
fi
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
ipnat_start()
|
|
{
|
|
if [ ! -f ${ipnat_rules} ]; then
|
|
warn 'NO IPNAT RULES'
|
|
return 0
|
|
fi
|
|
echo "Installing NAT rules."
|
|
${ipnat_program} -CF -f ${ipnat_rules} ${ipnat_flags}
|
|
}
|
|
|
|
run_rc_command "$1"
|