diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-08-27 17:59:52 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-08-27 17:59:52 +0000 |
commit | 35b3954eb0b9db47da342cfcfe229c5d880158dc (patch) | |
tree | c7a4bea98c4344de270656e2822713bfe8006bdb /usr.sbin/dhcp | |
parent | bedf96e763621a9b6fb71822bd95c454b95d9486 (diff) |
fix
Diffstat (limited to 'usr.sbin/dhcp')
-rw-r--r-- | usr.sbin/dhcp/client/scripts/Makefile | 8 | ||||
-rw-r--r-- | usr.sbin/dhcp/client/scripts/dhclient-script (renamed from usr.sbin/dhcp/client/scripts/bsdos) | 1 | ||||
-rw-r--r-- | usr.sbin/dhcp/client/scripts/freebsd | 174 | ||||
-rw-r--r-- | usr.sbin/dhcp/client/scripts/linux | 146 | ||||
-rw-r--r-- | usr.sbin/dhcp/client/scripts/netbsd | 174 | ||||
-rw-r--r-- | usr.sbin/dhcp/client/scripts/nextstep | 37 | ||||
-rw-r--r-- | usr.sbin/dhcp/client/scripts/solaris | 148 |
7 files changed, 6 insertions, 682 deletions
diff --git a/usr.sbin/dhcp/client/scripts/Makefile b/usr.sbin/dhcp/client/scripts/Makefile index c19aa9b3ea3..ee77ab88415 100644 --- a/usr.sbin/dhcp/client/scripts/Makefile +++ b/usr.sbin/dhcp/client/scripts/Makefile @@ -30,8 +30,10 @@ # OF THE POSSIBILITY OF SUCH DAMAGE. # -SCRIPTS=netbsd -SCRIPTSNAME_netbsd=dhclient-script -SCRIPTSDIR=/etc +NOMAN= + +beforeinstall: + ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${.CURDIR}/dhclient-script ${DESTDIR}/usr/bin/dhclient-script .include <bsd.prog.mk> diff --git a/usr.sbin/dhcp/client/scripts/bsdos b/usr.sbin/dhcp/client/scripts/dhclient-script index 7236a67a9a9..77fdc5c9f26 100644 --- a/usr.sbin/dhcp/client/scripts/bsdos +++ b/usr.sbin/dhcp/client/scripts/dhclient-script @@ -155,6 +155,7 @@ if [ x$reason = xTIMEOUT ]; then mv /etc/resolv.conf.std /etc/resolv.conf exit 0 fi + fi ifconfig $interface inet -alias $new_ip_address $medium for router in $old_routers; do route delete default $router >/dev/null 2>&1 diff --git a/usr.sbin/dhcp/client/scripts/freebsd b/usr.sbin/dhcp/client/scripts/freebsd deleted file mode 100644 index 7236a67a9a9..00000000000 --- a/usr.sbin/dhcp/client/scripts/freebsd +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh - -if [ x$new_network_number != x ]; then - echo New Network Number: $new_network_number -fi - -if [ x$new_broadcast_address != x ]; then - echo New Broadcast Address: $new_broadcast_address - new_broadcast_arg="broadcast $new_broadcast_address" -fi -if [ x$old_broadcast_address != x ]; then - old_broadcast_arg="broadcast $old_broadcast_address" -fi -if [ x$new_subnet_mask != x ]; then - new_netmask_arg="netmask $new_subnet_mask" -fi -if [ x$old_subnet_mask != x ]; then - old_netmask_arg="netmask $old_subnet_mask" -fi -if [ x$alias_subnet_mask != x ]; then - alias_subnet_arg="netmask $alias_subnet_mask" -fi - -if [ x$reason = xMEDIUM ]; then - ifconfig $interface $medium - ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1 - sleep 1 - exit 0 -fi - -if [ x$reason = xPREINIT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ - broadcast 255.255.255.255 up - exit 0 -fi - -if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then - exit 0; -fi - -if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ - [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ - [ x$alias_ip_address != x$old_ip_address ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then - ifconfig $interface inet -alias $old_ip_address $medium - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for router in $old_routers; do - route delete default $router >/dev/null 2>&1 - done - if [ "$old_static_routes" != "" ]; then - set $old_static_routes - while [ $# -gt 1 ]; do - route delete $1 $2 - shift; shift - done - fi - 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 ] || \ - [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then - ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium - route add $new_ip_address 127.1 >/dev/null 2>&1 - for router in $new_routers; do - route add default $router >/dev/null 2>&1 - done - if [ "$new_static_routes" != "" ]; then - set $new_static_routes - while [ $# -gt 1 ]; do - route add $1 $2 - shift; shift - done - fi - fi - if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; - then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - exit 0 -fi - -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ x$old_ip_address != x ]; then - ifconfig $interface inet -alias $old_ip_address $medium - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for router in $old_routers; do - route delete default $router >/dev/null 2>&1 - done - if [ "$old_static_routes" != "" ]; then - set $old_static_routes - while [ $# -gt 1 ]; do - route delete $1 $2 - shift; shift - done - fi - arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ - |sh >/dev/null 2>&1 - fi - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - exit 0 -fi - -if [ x$reason = xTIMEOUT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium - sleep 1 - if [ "$new_routers" != "" ]; then - set $new_routers - if ping -q -c 1 -w 1 $1; then - if [ x$new_ip_address != x$alias_ip_address ] && \ - [ x$alias_ip_address != x ]; then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - route add $new_ip_address 127.1 >/dev/null 2>&1 - 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 - 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 - if [ "$old_static_routes" != "" ]; then - set $old_static_routes - while [ $# -gt 1 ]; do - route delete $1 $2 - shift; shift - done - fi - arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ - |sh >/dev/null 2>&1 - exit 1 -fi - -exit 0 diff --git a/usr.sbin/dhcp/client/scripts/linux b/usr.sbin/dhcp/client/scripts/linux deleted file mode 100644 index f97539dd23f..00000000000 --- a/usr.sbin/dhcp/client/scripts/linux +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh -# dhclient-script for Linux. Dan Halbert, March, 1997. -# No guarantees about this. I'm a novice at the details of Linux -# networking. - -# Notes: - -# 0. This script is based on the netbsd script supplied with dhcp-970306. - -# 1. ifconfig down apparently deletes all relevant routes and flushes -# the arp cache, so this doesn't need to be done explicitly. - -# 2. The alias address handling here has not been tested AT ALL. -# I'm just going by the doc of modern Linux ip aliasing, which uses -# notations like eth0:0, eth0:1, for each alias. - -# 3. I have to calculate the network address, and calculate the broadcast -# address if it is not supplied. This might be much more easily done -# by the dhclient C code, and passed on. - -# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious -# of the $1 in its args. - -if [ x$new_broadcast_address != x ]; then - new_broadcast_arg="broadcast $new_broadcast_address" -fi -if [ x$old_broadcast_address != x ]; then - old_broadcast_arg="broadcast $old_broadcast_address" -fi -if [ x$new_subnet_mask != x ]; then - new_subnet_arg="netmask $new_subnet_mask" -fi -if [ x$old_subnet_mask != x ]; then - old_subnet_arg="netmask $old_subnet_mask" -fi -if [ x$alias_subnet_mask != x ]; then - alias_subnet_arg="netmask $alias_subnet_mask" -fi - -if [ x$reason = xMEDIUM ]; then - # Linux doesn't do mediums (ok, ok, media). - exit 0 -fi - -if [ x$reason = xPREINIT ]; then - if [ x$alias_ip_address != x ]; then - # Bring down alias interface. Its routes will disappear too. - ifconfig $interface:0- inet 0 - fi - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ - broadcast 255.255.255.255 up - # Add route to make broadcast work. Do not omit netmask. - route add default dev $interface netmask 0.0.0.0 - exit 0 -fi - -if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then - exit 0; -fi - -if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ - [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ - [ x$alias_ip_address != x$old_ip_address ]; then - # Possible new alias. Remove old alias. - ifconfig $interface:0- inet 0 - fi - if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then - # IP address changed. Bringing down the interface will delete all routes, - # and clear the ARP cache. - ifconfig $interface inet down - - fi - if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ - [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then - - ifconfig $interface inet $new_ip_address $new_subnet_arg \ - $new_broadcast_arg - # Add a network route to the computed network address. - route add -net $new_network_number $new_subnet_arg dev $interface - for router in $new_routers; do - route add default gw $router - done - fi - if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; - then - ifconfig $interface:0- inet 0 - ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg - route add -host $alias_ip_address $interface:0 - fi - echo domain $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - exit 0 -fi - -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then - if [ x$alias_ip_address != x ]; then - # Turn off alias interface. - ifconfig $interface:0- inet 0 - fi - if [ x$old_ip_address != x ]; then - # Shut down interface, which will delete routes and clear arp cache. - ifconfig $interface inet down - fi - if [ x$alias_ip_address != x ]; then - ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg - route add -host $alias_ip_address $interface:0 - fi - exit 0 -fi - -if [ x$reason = xTIMEOUT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface:0- inet 0 - fi - ifconfig $interface inet $new_ip_address $new_subnet_arg \ - $new_broadcast_arg - set $new_routers - ############## what is -w in ping? - if ping -q -c 1 -w 1 $1; then - if [ x$new_ip_address != x$alias_ip_address ] && \ - [ x$alias_ip_address != x ]; then - ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg - route add -host $alias_ip_address dev $interface:0 - fi - route add -net $new_network_number - for router in $new_routers; do - route add default gw $router - done - echo domain $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 - exit 0 - fi - ifconfig $interface inet down - exit 1 -fi - -exit 0 diff --git a/usr.sbin/dhcp/client/scripts/netbsd b/usr.sbin/dhcp/client/scripts/netbsd deleted file mode 100644 index 7236a67a9a9..00000000000 --- a/usr.sbin/dhcp/client/scripts/netbsd +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/sh - -if [ x$new_network_number != x ]; then - echo New Network Number: $new_network_number -fi - -if [ x$new_broadcast_address != x ]; then - echo New Broadcast Address: $new_broadcast_address - new_broadcast_arg="broadcast $new_broadcast_address" -fi -if [ x$old_broadcast_address != x ]; then - old_broadcast_arg="broadcast $old_broadcast_address" -fi -if [ x$new_subnet_mask != x ]; then - new_netmask_arg="netmask $new_subnet_mask" -fi -if [ x$old_subnet_mask != x ]; then - old_netmask_arg="netmask $old_subnet_mask" -fi -if [ x$alias_subnet_mask != x ]; then - alias_subnet_arg="netmask $alias_subnet_mask" -fi - -if [ x$reason = xMEDIUM ]; then - ifconfig $interface $medium - ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1 - sleep 1 - exit 0 -fi - -if [ x$reason = xPREINIT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ - broadcast 255.255.255.255 up - exit 0 -fi - -if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then - exit 0; -fi - -if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ - [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ - [ x$alias_ip_address != x$old_ip_address ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then - ifconfig $interface inet -alias $old_ip_address $medium - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for router in $old_routers; do - route delete default $router >/dev/null 2>&1 - done - if [ "$old_static_routes" != "" ]; then - set $old_static_routes - while [ $# -gt 1 ]; do - route delete $1 $2 - shift; shift - done - fi - 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 ] || \ - [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then - ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium - route add $new_ip_address 127.1 >/dev/null 2>&1 - for router in $new_routers; do - route add default $router >/dev/null 2>&1 - done - if [ "$new_static_routes" != "" ]; then - set $new_static_routes - while [ $# -gt 1 ]; do - route add $1 $2 - shift; shift - done - fi - fi - if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; - then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - exit 0 -fi - -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ x$old_ip_address != x ]; then - ifconfig $interface inet -alias $old_ip_address $medium - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for router in $old_routers; do - route delete default $router >/dev/null 2>&1 - done - if [ "$old_static_routes" != "" ]; then - set $old_static_routes - while [ $# -gt 1 ]; do - route delete $1 $2 - shift; shift - done - fi - arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ - |sh >/dev/null 2>&1 - fi - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - exit 0 -fi - -if [ x$reason = xTIMEOUT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium - sleep 1 - if [ "$new_routers" != "" ]; then - set $new_routers - if ping -q -c 1 -w 1 $1; then - if [ x$new_ip_address != x$alias_ip_address ] && \ - [ x$alias_ip_address != x ]; then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - route add $new_ip_address 127.1 >/dev/null 2>&1 - 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 - 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 - if [ "$old_static_routes" != "" ]; then - set $old_static_routes - while [ $# -gt 1 ]; do - route delete $1 $2 - shift; shift - done - fi - arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ - |sh >/dev/null 2>&1 - exit 1 -fi - -exit 0 diff --git a/usr.sbin/dhcp/client/scripts/nextstep b/usr.sbin/dhcp/client/scripts/nextstep deleted file mode 100644 index 15623a38e9a..00000000000 --- a/usr.sbin/dhcp/client/scripts/nextstep +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# simplified dhclient-script for NeXTSTEP/OPENSTEP -# -# removed a lot of the cruft from the netbsd version since NeXTSTEP doesn't -# support aliases and lots of things were breaking for no good reason -# -# 14 Sep 1997, David W. Young -# -if [ x$reason = xPREINIT ]; then - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 up >/dev/null 2>&1 - exit 0 -fi -if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ - [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then - ifconfig $interface $new_ip_address netmask $new_subnet_mask >/dev/null 2>&1 - route add $new_ip_address 127.1 0 >/dev/null 2>&1 - for router in $new_routers ; do - route add default $router 1 >/dev/null 2>&1 - done - fi - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - exit 0 -fi -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then - if [ x$old_ip_address != x ]; then - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for $router in $old_routers ; do - route delete default $router >/dev/null 2>&1 - done - fi - exit 0 -fi diff --git a/usr.sbin/dhcp/client/scripts/solaris b/usr.sbin/dhcp/client/scripts/solaris deleted file mode 100644 index 4f60ebaa7e1..00000000000 --- a/usr.sbin/dhcp/client/scripts/solaris +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh - -if [ x$new_broadcast_address != x ]; then - new_broadcast_arg="broadcast $new_broadcast_address" -fi -if [ x$old_broadcast_address != x ]; then - old_broadcast_arg="broadcast $old_broadcast_address" -fi -if [ x$new_subnet_mask != x ]; then - new_netmask_arg="netmask $new_subnet_mask" -fi -if [ x$old_subnet_mask != x ]; then - old_netmask_arg="netmask $old_subnet_mask" -fi -if [ x$alias_subnet_mask != x ]; then - alias_subnet_arg="netmask $alias_subnet_mask" -fi - -# For Solaris, ifconfig lives in /sbin -OS=`uname -r` -if [ $OS = "5.5.1" ]; then - PATH=/sbin:$PATH -fi - -if [ x$reason = xMEDIUM ]; then - ifconfig $interface $medium - ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1 - ifconfig $interface - sleep 1 - exit 0 -fi - -if [ x$reason = xPREINIT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ $OS = "5.5.1" ]; then - # Turn the interface on - ifconfig $interface plumb - ifconfig $interface inet 10.0.0.1 up - else - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ - broadcast 255.255.255.255 up - fi - exit 0 -fi - -if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then - exit 0; -fi - -if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ - [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then - if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ - [ x$alias_ip_address != x$old_ip_address ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then - ifconfig $interface inet -alias $old_ip_address $medium - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for router in $old_routers; do - route delete default $router >/dev/null 2>&1 - 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 ] || \ - [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then - ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium - route add $new_ip_address 127.1 >/dev/null 2>&1 - for router in $new_routers; do - route add default $router >/dev/null 2>&1 - done - fi - if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; - then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done - exit 0 -fi - -if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - if [ x$old_ip_address != x ]; then - ifconfig $interface inet -alias $old_ip_address $medium - route delete $old_ip_address 127.1 >/dev/null 2>&1 - for router in $old_routers; do - route delete default $router >/dev/null 2>&1 - done - arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p'i \ - |sh >/dev/null 2>&1 - fi - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - exit 0 -fi - -if [ x$reason = xTIMEOUT ]; then - if [ x$alias_ip_address != x ]; then - ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1 - route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 - fi - ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium - sleep 1 - set $new_routers - if ping -c 1 -w 1 $1; then - if [ x$new_ip_address != x$alias_ip_address ] && \ - [ x$alias_ip_address != x ]; then - ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg - route add $alias_ip_address 127.0.0.1 - fi - route add $new_ip_address 127.1 >/dev/null 2>&1 - for router in $new_routers; do - route add default $router >/dev/null 2>&1 - 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 - 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 - arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \ - |sh >/dev/null 2>&1 - exit 1 -fi - -exit 0 |