From: Ted Lemon Date: Mon, 20 Oct 1997 21:34:47 +0000 (+0000) Subject: Add support for static routes X-Git-Tag: NetBSD_1_3_Alpha~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40f04e6f62fc578c36e1d0a645a613376845acc4;p=thirdparty%2Fdhcp.git Add support for static routes --- diff --git a/client/scripts/freebsd b/client/scripts/freebsd index 819bfd241..bb55953c4 100755 --- a/client/scripts/freebsd +++ b/client/scripts/freebsd @@ -51,6 +51,11 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ for router in $old_routers; do route delete default $router >/dev/null 2>&1 done + set $old_static_routes + while [ $# -gt 1 ]; do + route delete $1 $2 + shift; shift + done arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh fi if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ @@ -61,6 +66,11 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ for router in $new_routers; do route add default $router >/dev/null 2>&1 done + set $new_static_routes + while [ $# -gt 1 ]; do + route add $1 $2 + shift; shift + done fi if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; then @@ -85,6 +95,11 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then for router in $old_routers; do route delete default $router >/dev/null 2>&1 done + set $old_static_routes + while [ $# -gt 1 ]; do + route delete $1 $2 + shift; shift + done arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ |sh >/dev/null 2>&1 fi @@ -114,20 +129,30 @@ if [ x$reason = xTIMEOUT ]; then for router in $new_routers; do route add default $router >/dev/null 2>&1 done + set $new_static_routes + while [ $# -gt 1 ]; do + route add $0 $1 + shift; shift + done echo search $new_domain_name >/etc/resolv.conf.std for nameserver in $new_domain_name_servers; do echo nameserver $nameserver >>/etc/resolv.conf.std done if [ -f /etc/resolv.conf ]; then rm -f /etc/resolv.conf - ln /etc/resolv.conf.std /etc/resolv.conf fi + mv /etc/resolv.conf.std /etc/resolv.conf exit 0 fi ifconfig $interface inet -alias $new_ip_address $medium for router in $old_routers; do route delete default $router >/dev/null 2>&1 done + set $old_static_routes + while [ $# -gt 1 ]; do + route delete $1 $2 + shift; shift + done arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ |sh >/dev/null 2>&1 exit 1 diff --git a/client/scripts/netbsd b/client/scripts/netbsd index e5d3df2cb..bb55953c4 100755 --- a/client/scripts/netbsd +++ b/client/scripts/netbsd @@ -51,6 +51,11 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ for router in $old_routers; do route delete default $router >/dev/null 2>&1 done + set $old_static_routes + while [ $# -gt 1 ]; do + route delete $1 $2 + shift; shift + done arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh fi if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ @@ -61,6 +66,11 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ for router in $new_routers; do route add default $router >/dev/null 2>&1 done + set $new_static_routes + while [ $# -gt 1 ]; do + route add $1 $2 + shift; shift + done fi if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; then @@ -68,7 +78,6 @@ if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ route add $alias_ip_address 127.0.0.1 fi echo search $new_domain_name >/etc/resolv.conf - chmod 644 /etc/resolv.conf for nameserver in $new_domain_name_servers; do echo nameserver $nameserver >>/etc/resolv.conf done @@ -86,6 +95,11 @@ if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then for router in $old_routers; do route delete default $router >/dev/null 2>&1 done + set $old_static_routes + while [ $# -gt 1 ]; do + route delete $1 $2 + shift; shift + done arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ |sh >/dev/null 2>&1 fi @@ -115,21 +129,30 @@ if [ x$reason = xTIMEOUT ]; then for router in $new_routers; do route add default $router >/dev/null 2>&1 done + set $new_static_routes + while [ $# -gt 1 ]; do + route add $0 $1 + shift; shift + done echo search $new_domain_name >/etc/resolv.conf.std - chmod 644 /etc/resolv.conf.std for nameserver in $new_domain_name_servers; do echo nameserver $nameserver >>/etc/resolv.conf.std done if [ -f /etc/resolv.conf ]; then rm -f /etc/resolv.conf - ln /etc/resolv.conf.std /etc/resolv.conf fi + mv /etc/resolv.conf.std /etc/resolv.conf exit 0 fi ifconfig $interface inet -alias $new_ip_address $medium for router in $old_routers; do route delete default $router >/dev/null 2>&1 done + set $old_static_routes + while [ $# -gt 1 ]; do + route delete $1 $2 + shift; shift + done arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ |sh >/dev/null 2>&1 exit 1