diff options
author | fjoe <fjoe@FreeBSD.org> | 2004-04-05 16:29:45 +0000 |
---|---|---|
committer | fjoe <fjoe@FreeBSD.org> | 2004-04-05 16:29:45 +0000 |
commit | ea768cc3c26894afa3749739a91476398c797f60 (patch) | |
tree | e6884197eaa06686dd80bf09d55281260a168c94 /etc/rc.d/natd | |
parent | 5fd7f55e2fbbe15c6218a0d91683a5a33e4fc445 (diff) | |
download | FreeBSD-src-ea768cc3c26894afa3749739a91476398c797f60.zip FreeBSD-src-ea768cc3c26894afa3749739a91476398c797f60.tar.gz |
Add separate script for natd. This fixes race condition with "ipfw restart"
(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.
Diffstat (limited to 'etc/rc.d/natd')
-rw-r--r-- | etc/rc.d/natd | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/etc/rc.d/natd b/etc/rc.d/natd new file mode 100644 index 0000000..53a370d --- /dev/null +++ b/etc/rc.d/natd @@ -0,0 +1,42 @@ +#!/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" |