mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
a3e34d6908
(when new natd is started before old natd died) and allows to manage natd without touching ipfw. natd should probably be killed with SIGKILL when stopping natd.
43 lines
727 B
Bash
43 lines
727 B
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: natd
|
|
# KEYWORD: FreeBSD nostart nojail
|
|
|
|
. /etc/rc.subr
|
|
. /etc/network.subr
|
|
|
|
name="natd"
|
|
rcvar=`set_rcvar`
|
|
command="/sbin/${name}"
|
|
start_cmd="natd_start"
|
|
|
|
natd_start()
|
|
{
|
|
dhcp_list="`list_net_interfaces dhcp`"
|
|
for ifn in ${dhcp_list}; do
|
|
case ${natd_interface} in
|
|
${ifn})
|
|
natd_flags="$natd_flags -dynamic"
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
done
|
|
if [ -n "${natd_interface}" ]; then
|
|
if echo ${natd_interface} | \
|
|
grep -q -E '^[0-9]+(\.[0-9]+){0,3}$'; then
|
|
natd_flags="$natd_flags -a ${natd_interface}"
|
|
else
|
|
natd_flags="$natd_flags -n ${natd_interface}"
|
|
fi
|
|
fi
|
|
echo -n ' natd'
|
|
${natd_program:-/sbin/natd} ${natd_flags} ${natd_ifarg}
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|