Subject: | DHCP4.1.0a1 - bad parameter to execute ping |
Date: | Sun, 25 May 2008 16:33:26 -0700 |
To: | <dhcp-bugs@isc.org> |
From: | "Yeung, Pauline" <yeungp@cisco.com> |
The same condition that led us to discover the “double deference” in ISC-Bugs #18097, also led us to find the “bad parameter to execute ping”. We are still not able to find the cause of why our box gets into this condition and causes dhclient to get into the TIMEOUT state. If you can provide any thoughts or suggestions, it would be helpful.
When this condition occurs, dhclient gets a valid offer from the server in DHCPOFFER and DHCPACK, but gets into the TIMEOUT state. Because $1 is not initialized in the script below, “ping” in line 209 cannot execute, and exits with error. The script then goes to line 229 and exits with error code 1. This causes dhclient to execute line 959 in dhclient.c and send a DHCPDECLINE.
We have about one in a hundred boxes that occasionally get into this condition, and stays in this condition at least for a few minutes. When performing lease renewal in this condition, dhclient declines an offer executing the code path described above, so the server offers the next IP address. The dhclient declines this next IP address executing the same code path, so the server again offers the next IP address, until the server runs out of IP address in its address pool.
I do not know if the intent of “ping” in line 209 is to find out if another device is already using $new_ip_address. If so, the “ping” should be executed before “ifconfig”. But it does not hurt to “ping –q –c 1 $new_ip_address”, as the IP address is already configured in $interface and is always pingable. This is our short term work around.
From the file client/scripts/linux
202 if [ x$reason = xTIMEOUT ]; then
203 if [ x$alias_ip_address != x ]; then
204 ifconfig $interface:0- inet 0
205 fi
206 ifconfig $interface inet $new_ip_address $new_subnet_arg \
207 $new_broadcast_arg
208 set $new_routers
209 if ping -q -c 1 $1; then
210 if [ x$new_ip_address != x$alias_ip_address ] && \
211 [ x$alias_ip_address != x ]; then
212 ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
213 route add -host $alias_ip_address dev $interface:0
214 fi
215 if [ $relmajor -lt 2 ] || \
216 ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
217 route add -net $new_network_number
218 fi
219 for router in $new_routers; do
220 if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
221 route add -host $router dev $interface
222 fi
223 route add default gw $router
224 done
225 make_resolv_conf
226 exit_with_hooks 0
227 fi
228 ifconfig $interface inet 0 down
229 exit_with_hooks 1
230 fi
From file client/dhclient.c
955 /* If the BOUND/RENEW code detects another machine using the
956 offered address, it exits nonzero. We need to send a
957 DHCPDECLINE and toss the lease. */
958 if (script_go (client)) {
959 make_decline (client, client -> new);
960 send_decline (client);
961 destroy_client_lease (client -> new);
962 client -> new = (struct client_lease *)0;
963 state_init (client);
964 return;
965 }
Pauline Yeung
Cisco Systems, Inc.
- - - - - Cisco - - - - -
This e-mail and any attachments may contain information which is confidential,
proprietary, privileged or otherwise protected by law. The information is solely
intended for the named addressee (or a person responsible for delivering it to
the addressee). If you are not the intended recipient of this message, you are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.