]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - client/scripts/freebsd
3 if [ -x /usr
/bin
/logger
]; then
4 LOGGER
="/usr/bin/logger -s -p user.notice -t dhclient"
10 if [ "x$new_domain_name" != x
] && [ x
"$new_domain_name_servers" != x
]; then
11 echo search
$new_domain_name >/etc
/resolv.conf
12 for nameserver
in $new_domain_name_servers; do
13 echo nameserver
$nameserver >>/etc
/resolv.conf
18 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
21 if [ -f /etc
/dhclient-exit-hooks
]; then
22 .
/etc
/dhclient-exit-hooks
24 # probably should do something with exit status of the local script
28 # Invoke the local dhcp client enter hooks, if they exist.
29 if [ -f /etc
/dhclient-enter-hooks
]; then
31 .
/etc
/dhclient-enter-hooks
32 # allow the local script to abort processing of this state
33 # local script must set exit_status variable to nonzero.
34 if [ $exit_status -ne 0 ]; then
39 if [ x
$new_network_number != x
]; then
40 $LOGGER New Network Number
: $new_network_number
43 if [ x
$new_broadcast_address != x
]; then
44 $LOGGER New Broadcast Address
: $new_broadcast_address
45 new_broadcast_arg
="broadcast $new_broadcast_address"
47 if [ x
$old_broadcast_address != x
]; then
48 old_broadcast_arg
="broadcast $old_broadcast_address"
50 if [ x
$new_subnet_mask != x
]; then
51 new_netmask_arg
="netmask $new_subnet_mask"
53 if [ x
$old_subnet_mask != x
]; then
54 old_netmask_arg
="netmask $old_subnet_mask"
56 if [ x
$alias_subnet_mask != x
]; then
57 alias_subnet_arg
="netmask $alias_subnet_mask"
60 if [ x
$reason = xMEDIUM
]; then
61 eval "ifconfig $interface $medium"
62 eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev
/null
2>&1
67 if [ x
$reason = xPREINIT
]; then
68 if [ x
$alias_ip_address != x
]; then
69 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
70 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
72 ifconfig
$interface inet
0.0.0.0 netmask
0.0.0.0 \
73 broadcast
255.255.255.255 up
77 if [ x
$reason = xARPCHECK
] ||
[ x
$reason = xARPSEND
]; then
81 if [ x
$reason = xBOUND
] ||
[ x
$reason = xRENEW
] || \
82 [ x
$reason = xREBIND
] ||
[ x
$reason = xREBOOT
]; then
83 current_hostname
=`hostname`
84 if [ x
$current_hostname = x
] || \
85 [ x
$current_hostname = x
$old_host_name ]; then
86 if [ x
$current_hostname = x
] || \
87 [ x
$new_host_name != x
$old_host_name ]; then
88 $LOGGER "New Hostname: $new_host_name"
89 hostname
$new_host_name
92 if [ x
$old_ip_address != x
] && [ x
$alias_ip_address != x
] && \
93 [ x
$alias_ip_address != x
$old_ip_address ]; then
94 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
95 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
97 if [ x
$old_ip_address != x
] && [ x
$old_ip_address != x
$new_ip_address ]
99 eval "ifconfig $interface inet -alias $old_ip_address $medium"
100 route delete
$old_ip_address 127.1 >/dev
/null
2>&1
101 for router
in $old_routers; do
102 route delete default
$router >/dev
/null
2>&1
104 if [ "$old_static_routes" != "" ]; then
105 set -- $old_static_routes
106 while [ $# -gt 1 ]; do
111 arp
-n -a |
sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' |sh
113 if [ x
$old_ip_address = x
] ||
[ x
$old_ip_address != x
$new_ip_address ] || \
114 [ x
$reason = xBOUND
] ||
[ x
$reason = xREBOOT
]; then
115 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
116 $new_broadcast_arg $medium"
117 $LOGGER "New IP Address($interface): $new_ip_address"
118 $LOGGER "New Subnet Mask($interface): $new_subnet_mask"
119 $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
120 if [ "$new_routers" != "" ]; then
121 $LOGGER "New Routers: $new_routers"
123 route add
$new_ip_address 127.1 >/dev
/null
2>&1
124 for router
in $new_routers; do
125 route add default
$router >/dev
/null
2>&1
127 if [ "$new_static_routes" != "" ]; then
128 $LOGGER "New Static Routes: $new_static_routes"
129 set -- $new_static_routes
130 while [ $# -gt 1 ]; do
136 if [ x
$new_ip_address != x
$alias_ip_address ] && [ x
$alias_ip_address != x
];
138 ifconfig
$interface inet
alias $alias_ip_address $alias_subnet_arg
139 route add
$alias_ip_address 127.0.0.1
145 if [ x
$reason = xEXPIRE
] ||
[ x
$reason = xFAIL
] ||
[ x
$reason = xRELEASE
] \
146 ||
[ x
$reason = xSTOP
]; then
147 if [ x
$alias_ip_address != x
]; then
148 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
149 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
151 if [ x
$old_ip_address != x
]; then
152 eval "ifconfig $interface inet -alias $old_ip_address $medium"
153 route delete
$old_ip_address 127.1 >/dev
/null
2>&1
154 for router
in $old_routers; do
155 route delete default
$router >/dev
/null
2>&1
157 if [ "$old_static_routes" != "" ]; then
158 set -- $old_static_routes
159 while [ $# -gt 1 ]; do
164 arp
-n -a |
sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
167 if [ x
$alias_ip_address != x
]; then
168 ifconfig
$interface inet
alias $alias_ip_address $alias_subnet_arg
169 route add
$alias_ip_address 127.0.0.1
174 if [ x
$reason = xTIMEOUT
]; then
175 if [ x
$alias_ip_address != x
]; then
176 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
177 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
179 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
180 $new_broadcast_arg $medium"
181 $LOGGER "New IP Address($interface): $new_ip_address"
182 $LOGGER "New Subnet Mask($interface): $new_subnet_mask"
183 $LOGGER "New Broadcast Address($interface): $new_broadcast_address"
185 if [ "$new_routers" != "" ]; then
186 $LOGGER "New Routers: $new_routers"
188 if ping -q -c 1 $1; then
189 if [ x
$new_ip_address != x
$alias_ip_address ] && \
190 [ x
$alias_ip_address != x
]; then
191 ifconfig
$interface inet
alias $alias_ip_address $alias_subnet_arg
192 route add
$alias_ip_address 127.0.0.1
194 route add
$new_ip_address 127.1 >/dev
/null
2>&1
195 for router
in $new_routers; do
196 route add default
$router >/dev
/null
2>&1
198 set -- $new_static_routes
199 while [ $# -gt 1 ]; do
207 eval "ifconfig $interface inet -alias $new_ip_address $medium"
208 for router
in $old_routers; do
209 route delete default
$router >/dev
/null
2>&1
211 if [ "$old_static_routes" != "" ]; then
212 set -- $old_static_routes
213 while [ $# -gt 1 ]; do
218 arp
-n -a |
sed -n -e 's/^.*(\(.*\)) at .*$/arp -d \1/p' \