]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - client/scripts/netbsd
4 if [ "x$new_domain_name" != x
] && [ x
"$new_domain_name_servers" != x
]; then
5 cat /dev
/null
> /etc
/resolv.conf.dhclient
6 if [ "x$new_domain_search != x ]; then
7 echo search $new_domain_search >> /etc/resolv.conf.dhclient
8 elif [ "x
$new_domain_name != x
]; then
9 # Note that the DHCP 'Domain Name Option' is really just a domain
10 # name, and that this practice of using the domain name option as
11 # a search path is both nonstandard and deprecated.
12 echo search
$new_domain_name >> /etc
/resolv.conf.dhclient
14 for nameserver
in $new_domain_name_servers; do
15 echo nameserver
$nameserver >>/etc
/resolv.conf.dhclient
18 mv /etc
/resolv.conf.dhclient
/etc
/resolv.conf
19 elif [ "x${new_dhcp6_name_servers}" != x
] ; then
20 cat /dev
/null
> /etc
/resolv.conf.dhclient6
21 chmod 644 /etc
/resolv.conf.dhclient6
23 if [ "x${new_dhcp6_domain_search}" != x
] ; then
24 echo search
${new_dhcp6_domain_search} >> /etc
/resolv.conf.dhclient6
26 for nameserver
in ${new_dhcp6_name_servers} ; do
27 echo nameserver
${nameserver} >> /etc
/resolv.conf.dhclient6
30 mv /etc
/resolv.conf.dhclient6
/etc
/resolv.conf
34 # Must be used on exit. Invokes the local dhcp client exit hooks, if any.
37 if [ -f /etc
/dhclient-exit-hooks
]; then
38 .
/etc
/dhclient-exit-hooks
40 # probably should do something with exit status of the local script
44 # Invoke the local dhcp client enter hooks, if they exist.
45 if [ -f /etc
/dhclient-enter-hooks
]; then
47 .
/etc
/dhclient-enter-hooks
48 # allow the local script to abort processing of this state
49 # local script must set exit_status variable to nonzero.
50 if [ $exit_status -ne 0 ]; then
55 if [ x
$new_network_number != x
]; then
56 echo New Network Number
: $new_network_number
59 if [ x
$new_broadcast_address != x
]; then
60 echo New Broadcast Address
: $new_broadcast_address
61 new_broadcast_arg
="broadcast $new_broadcast_address"
63 if [ x
$old_broadcast_address != x
]; then
64 old_broadcast_arg
="broadcast $old_broadcast_address"
66 if [ x
$new_subnet_mask != x
]; then
67 new_netmask_arg
="netmask $new_subnet_mask"
69 if [ x
$old_subnet_mask != x
]; then
70 old_netmask_arg
="netmask $old_subnet_mask"
72 if [ x
$alias_subnet_mask != x
]; then
73 alias_subnet_arg
="netmask $alias_subnet_mask"
76 if [ x
$reason = xMEDIUM
]; then
77 eval "ifconfig $interface $medium"
78 eval "ifconfig $interface inet -alias 0.0.0.0 $medium" >/dev
/null
2>&1
87 if [ x
$reason = xPREINIT
]; then
88 if [ x
$alias_ip_address != x
]; then
89 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
90 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
92 ifconfig
$interface inet
0.0.0.0 netmask
0.0.0.0 \
93 broadcast
255.255.255.255 up
97 if [ x
$reason = xARPCHECK
] ||
[ x
$reason = xARPSEND
]; then
101 if [ x
$reason = xBOUND
] ||
[ x
$reason = xRENEW
] || \
102 [ x
$reason = xREBIND
] ||
[ x
$reason = xREBOOT
]; then
103 current_hostname
=`hostname`
104 if [ x
$current_hostname = x
] || \
105 [ x
$current_hostname = x
$old_host_name ]; then
106 if [ x
$current_hostname = x
] || \
107 [ x
$new_host_name != x
$old_host_name ]; then
108 hostname
$new_host_name
112 if [ x
$old_ip_address != x
] && [ x
$alias_ip_address != x
] && \
113 [ x
$alias_ip_address != x
$old_ip_address ]; then
114 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
115 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
117 if [ x
$old_ip_address != x
] && [ x
$old_ip_address != x
$new_ip_address ]
119 eval "ifconfig $interface inet -alias $old_ip_address $medium"
120 route delete
$old_ip_address 127.1 >/dev
/null
2>&1
121 for router
in $old_routers; do
122 route delete default
$router >/dev
/null
2>&1
124 if [ "$old_static_routes" != "" ]; then
125 set $old_static_routes
126 while [ $# -gt 1 ]; do
131 arp
-n -a |
sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
133 if [ x
$old_ip_address = x
] ||
[ x
$old_ip_address != x
$new_ip_address ] || \
134 [ x
$reason = xBOUND
] ||
[ x
$reason = xREBOOT
]; then
135 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
136 $new_broadcast_arg $medium"
137 route add
$new_ip_address 127.1 >/dev
/null
2>&1
138 for router
in $new_routers; do
139 route add default
$router >/dev
/null
2>&1
141 if [ "$new_static_routes" != "" ]; then
142 set $new_static_routes
143 while [ $# -gt 1 ]; do
149 if [ x
$new_ip_address != x
$alias_ip_address ] && [ x
$alias_ip_address != x
];
151 ifconfig
$interface inet
alias $alias_ip_address $alias_subnet_arg
152 route add
$alias_ip_address 127.0.0.1
158 if [ x
$reason = xEXPIRE
] ||
[ x
$reason = xFAIL
] ||
[ x
$reason = xRELEASE
] \
159 ||
[ x
$reason = xSTOP
]; then
160 if [ x
$alias_ip_address != x
]; then
161 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
162 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
164 if [ x
$old_ip_address != x
]; then
165 eval "ifconfig $interface inet -alias $old_ip_address $medium"
166 route delete
$old_ip_address 127.1 >/dev
/null
2>&1
167 for router
in $old_routers; do
168 route delete default
$router >/dev
/null
2>&1
170 if [ "$old_static_routes" != "" ]; then
171 set $old_static_routes
172 while [ $# -gt 1 ]; do
177 arp
-n -a |
sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
180 if [ 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
187 if [ x
$reason = xTIMEOUT
]; then
188 if [ x
$alias_ip_address != x
]; then
189 ifconfig
$interface inet
-alias $alias_ip_address > /dev
/null
2>&1
190 route delete
$alias_ip_address 127.0.0.1 > /dev
/null
2>&1
192 eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
193 $new_broadcast_arg $medium"
195 if [ "$new_routers" != "" ]; then
197 if ping -q -c 1 -w 1 $1; then
198 if [ x
$new_ip_address != x
$alias_ip_address ] && \
199 [ x
$alias_ip_address != x
]; then
200 ifconfig
$interface inet
alias $alias_ip_address $alias_subnet_arg
201 route add
$alias_ip_address 127.0.0.1
203 route add
$new_ip_address 127.1 >/dev
/null
2>&1
204 for router
in $new_routers; do
205 route add default
$router >/dev
/null
2>&1
207 set $new_static_routes
208 while [ $# -gt 1 ]; do
216 eval "ifconfig $interface inet -alias $new_ip_address $medium"
217 for router
in $old_routers; do
218 route delete default
$router >/dev
/null
2>&1
220 if [ "$old_static_routes" != "" ]; then
221 set $old_static_routes
222 while [ $# -gt 1 ]; do
227 arp
-n -a |
sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' \
236 if [ ${reason} = PREINIT6
] ; then
237 # Ensure interface is up.
238 ifconfig
${interface} up
240 # XXX: Remove any stale addresses from aborted clients.
245 if [ ${reason} = BOUND6
] ; then
246 if [ x
${new_ip6_address} = x
] ||
[ x
${new_ip6_prefixlen} = x
] ; then
250 ifconfig
${interface} inet6 add ${new_ip6_address}/${new_ip6_prefixlen}
252 # Check for nameserver options.
258 if [ ${reason} = RENEW6
] ||
[ ${reason} = REBIND6
] ; then
259 # Make sure nothing has moved around on us.
261 # Nameservers/domains/etc.
262 if [ "x${new_dhcp6_name_servers}" != "x${old_dhcp6_name_servers}" ] ||
263 [ "x${new_dhcp6_domain_search}" != "x${old_dhcp6_domain_search}" ] ; then
270 if [ ${reason} = DEPREF6
] ; then
271 if [ x
${new_ip6_prefixlen} = x
] ; then
276 # There doesn't appear to be a way to update an addr to indicate
282 if [ ${reason} = EXPIRE6
] ; then
283 if [ x
${old_ip6_address} = x
] ||
[ x
${old_ip6_prefixlen} = x
] ; then
287 ifconfig
${interface} inet6 delete ${old_ip6_address}/${old_ip6_prefixlen}