3 if [ -x /usr/bin/logger ]; then
4 LOGGER="/usr/bin/logger -s -p user.notice -t dhclient"
10 echo search $new_domain_name >/etc/resolv.conf
11 for nameserver in $new_domain_name_servers; do
12 echo nameserver $nameserver >>/etc/resolv.conf
16 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
19 if [ -x /etc/dhclient-exit-hooks ]; then
20 . /etc/dhclient-exit-hooks
22 # probably should do something with exit status of the local script
26 # Invoke the local dhcp client enter hooks, if they exist.
27 if [ -x /etc/dhclient-enter-hooks ]; then
29 . /etc/dhclient-enter-hooks
30 # allow the local script to abort processing of this state
31 # local script must set exit_status variable to nonzero.
32 if [ $exit_status -ne 0 ]; then
37 if [ x$new_network_number != x ]; then
38 $LOGGER New Network Number: $new_network_number
41 if [ x$new_broadcast_address != x ]; then
42 $LOGGER New Broadcast Address: $new_broadcast_address
43 new_broadcast_arg="broadcast $new_broadcast_address"
45 if [ x$old_broadcast_address != x ]; then
46 old_broadcast_arg="broadcast $old_broadcast_address"
48 if [ x$new_subnet_mask != x ]; then
49 $LOGGER New Subnet Mask for $interface: $new_subnet_mask
50 new_netmask_arg="netmask $new_subnet_mask"
52 if [ x$old_subnet_mask != x ]; then
53 old_netmask_arg="netmask $old_subnet_mask"
55 if [ x$alias_subnet_mask != x ]; then
56 alias_subnet_arg="netmask $alias_subnet_mask"
59 if [ x$reason = xMEDIUM ]; then
60 ifconfig $interface $medium
61 ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1
66 if [ x$reason = xPREINIT ]; then
67 if [ x$alias_ip_address != x ]; then
68 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
69 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
71 ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
72 broadcast 255.255.255.255 up
76 if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
80 if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
81 [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
82 current_hostname=`/bin/hostname`
83 if [ x$current_hostname = x ] || \
84 [ x$current_hostname = x$old_host_name ]; then
85 if [ x$new_host_name != x$old_host_name ]; then
86 $LOGGER New Hostname: $new_host_name
87 hostname $new_host_name
90 if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
91 [ x$alias_ip_address != x$old_ip_address ]; then
92 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
93 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
95 if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
96 ifconfig $interface inet -alias $old_ip_address $medium
97 route delete $old_ip_address 127.1 >/dev/null 2>&1
98 for router in $old_routers; do
99 route delete default $router >/dev/null 2>&1
101 if [ "$old_static_routes" != "" ]; then
102 set $old_static_routes
103 while [ $# -gt 1 ]; do
108 arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
110 if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
111 [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
112 ifconfig $interface inet $new_ip_address $new_netmask_arg \
113 $new_broadcast_arg $medium
114 route add $new_ip_address 127.1 >/dev/null 2>&1
115 for router in $new_routers; do
116 route add default $router >/dev/null 2>&1
118 if [ "$new_static_routes" != "" ]; then
119 $LOGGER New Static Routes: $new_static_routes
120 set $new_static_routes
121 while [ $# -gt 1 ]; do
127 if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
129 ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
130 route add $alias_ip_address 127.0.0.1
132 echo search $new_domain_name >/etc/resolv.conf
133 for nameserver in $new_domain_name_servers; do
134 echo nameserver $nameserver >>/etc/resolv.conf
139 if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
140 if [ x$alias_ip_address != x ]; then
141 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
142 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
144 if [ x$old_ip_address != x ]; then
145 ifconfig $interface inet -alias $old_ip_address $medium
146 route delete $old_ip_address 127.1 >/dev/null 2>&1
147 for router in $old_routers; do
148 route delete default $router >/dev/null 2>&1
150 if [ "$old_static_routes" != "" ]; then
151 set $old_static_routes
152 while [ $# -gt 1 ]; do
157 arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
160 if [ x$alias_ip_address != x ]; then
161 ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
162 route add $alias_ip_address 127.0.0.1
167 if [ x$reason = xTIMEOUT ]; then
168 if [ x$alias_ip_address != x ]; then
169 ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
170 route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
172 ifconfig $interface inet $new_ip_address $new_netmask_arg \
173 $new_broadcast_arg $medium
175 if [ "$new_routers" != "" ]; then
176 $LOGGER New Routers: $new_routers
178 if ping -q -c 1 $1; then
179 if [ x$new_ip_address != x$alias_ip_address ] && \
180 [ x$alias_ip_address != x ]; then
181 ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
182 route add $alias_ip_address 127.0.0.1
184 route add $new_ip_address 127.1 >/dev/null 2>&1
185 for router in $new_routers; do
186 route add default $router >/dev/null 2>&1
188 set $new_static_routes
189 while [ $# -gt 1 ]; do
193 echo search $new_domain_name >/etc/resolv.conf.std
194 for nameserver in $new_domain_name_servers; do
195 echo nameserver $nameserver >>/etc/resolv.conf.std
197 if [ -f /etc/resolv.conf ]; then
198 rm -f /etc/resolv.conf
200 mv /etc/resolv.conf.std /etc/resolv.conf
204 ifconfig $interface inet -alias $new_ip_address $medium
205 for router in $old_routers; do
206 route delete default $router >/dev/null 2>&1
208 if [ "$old_static_routes" != "" ]; then
209 set $old_static_routes
210 while [ $# -gt 1 ]; do
215 arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \