dhclient-script (149480) | dhclient-script (149519) |
---|---|
1#!/bin/sh 2# 3# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ | 1#!/bin/sh 2# 3# $OpenBSD: dhclient-script,v 1.6 2004/05/06 18:22:41 claudio Exp $ |
4# $FreeBSD: head/sbin/dhclient/dhclient-script 149480 2005-08-26 01:07:51Z brooks $ | 4# $FreeBSD: head/sbin/dhclient/dhclient-script 149519 2005-08-26 20:31:04Z brooks $ |
5# 6# Copyright (c) 2003 Kenneth R Westerback <krw@openbsd.org> 7# 8# Permission to use, copy, modify, and distribute this software for any 9# purpose with or without fee is hereby granted, provided that the above 10# copyright notice and this permission notice appear in all copies. 11# 12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 36 unchanged lines hidden (view full) --- 49 50arp_flush() { 51 arp -an -i $interface | \ 52 sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ 53 sh >/dev/null 2>&1 54} 55 56delete_old_address() { | 5# 6# Copyright (c) 2003 Kenneth R Westerback <krw@openbsd.org> 7# 8# Permission to use, copy, modify, and distribute this software for any 9# purpose with or without fee is hereby granted, provided that the above 10# copyright notice and this permission notice appear in all copies. 11# 12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 36 unchanged lines hidden (view full) --- 49 50arp_flush() { 51 arp -an -i $interface | \ 52 sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' | \ 53 sh >/dev/null 2>&1 54} 55 56delete_old_address() { |
57 ifconfig $interface inet -alias $old_ip_address $medium | 57 eval "ifconfig $interface inet -alias $old_ip_address $medium" |
58} 59 60add_new_address() { | 58} 59 60add_new_address() { |
61 ifconfig $interface \ | 61 eval "ifconfig $interface \ |
62 inet $new_ip_address \ 63 netmask $new_subnet_mask \ 64 broadcast $new_broadcast_address \ | 62 inet $new_ip_address \ 63 netmask $new_subnet_mask \ 64 broadcast $new_broadcast_address \ |
65 $medium | 65 $medium" |
66 67 $LOGGER "New IP Address ($interface): $new_ip_address" 68 $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" 69 $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" 70 $LOGGER "New Routers ($interface): $new_routers" 71} 72 73delete_old_alias() { --- 125 unchanged lines hidden (view full) --- 199if [ -x $NETSTAT ]; then 200 if_defaultroute=`$NETSTAT -rnf inet | $AWK '{if ($1=="default") printf $6}'` 201else 202 if_defaultroute="x" 203fi 204 205case $reason in 206MEDIUM) | 66 67 $LOGGER "New IP Address ($interface): $new_ip_address" 68 $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" 69 $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" 70 $LOGGER "New Routers ($interface): $new_routers" 71} 72 73delete_old_alias() { --- 125 unchanged lines hidden (view full) --- 199if [ -x $NETSTAT ]; then 200 if_defaultroute=`$NETSTAT -rnf inet | $AWK '{if ($1=="default") printf $6}'` 201else 202 if_defaultroute="x" 203fi 204 205case $reason in 206MEDIUM) |
207 ifconfig $interface $medium 208 ifconfig $interface inet -alias 0.0.0.0 $medium >/dev/null 2>&1 | 207 eval "ifconfig $interface $medium" 208 eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev/null 2>&1 |
209 sleep 1 210 ;; 211 212PREINIT) 213 delete_old_alias 214 ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up 215 ;; 216 --- 49 unchanged lines hidden (view full) --- 266 add_new_alias 267 fi 268 add_new_routes 269 if add_new_resolv_conf; then 270 exit_with_hooks 0 271 fi 272 fi 273 fi | 209 sleep 1 210 ;; 211 212PREINIT) 213 delete_old_alias 214 ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up 215 ;; 216 --- 49 unchanged lines hidden (view full) --- 266 add_new_alias 267 fi 268 add_new_routes 269 if add_new_resolv_conf; then 270 exit_with_hooks 0 271 fi 272 fi 273 fi |
274 ifconfig $interface inet -alias $new_ip_address $medium | 274 eval "ifconfig $interface inet -alias $new_ip_address $medium" |
275 delete_old_routes 276 exit_with_hooks 1 277 ;; 278esac 279 280exit_with_hooks 0 | 275 delete_old_routes 276 exit_with_hooks 1 277 ;; 278esac 279 280exit_with_hooks 0 |