]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Add support for static routes
authorTed Lemon <source@isc.org>
Mon, 20 Oct 1997 21:34:47 +0000 (21:34 +0000)
committerTed Lemon <source@isc.org>
Mon, 20 Oct 1997 21:34:47 +0000 (21:34 +0000)
client/scripts/freebsd
client/scripts/netbsd

index 819bfd2415353a6c9ddacf640a772afe88248f25..bb55953c4feb88b46636cee0f4f4038912ed727d 100755 (executable)
@@ -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
index e5d3df2cbb40afb29b0518cfb23e4ebedda24463..bb55953c4feb88b46636cee0f4f4038912ed727d 100755 (executable)
@@ -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