On Wednesday 24 September 2008 00:19, Michael Davis wrote:
> I started messing around with the rc.sysinit file thinking that maybe 
> something had changed between the different versions.
> I found the problem was with this section
> 
> if [ "x`grep ip= /proc/cmdline`" = "x" ]
> then
> udhcpc -i eth0 -b -p /var/run/udhcpc.eth0.pid >/dev/null 2>&1
> fi
> 
> So I tested the udhcpc with the above command in a normal terminal and 
> it doesn't go to the background.
> I then tested it without sending the output to /dev/null.  I get this 
> output.
> udhcpc (v1.11.2) started
> Sending discover...
> Sending select for 192.168.1.169...
> Sending select for 192.168.1.169...
> Sending select for 192.168.1.169...
> Sending discover...
> Sending select for 192.168.1.169...
> Sending select for 192.168.1.169...
> Sending select for 192.168.1.169...

This is interesting. Your DHCP server _does_ offer you an IP,
but then it doesn't ACK it. udhcpc does not expect such a loop,
and never invokes
"-b,--background Background if lease is not immediately obtained"
code.

Can you capture "tcpdump -nlieth0 -s0 port 67 or port 68" output
while it runs?

Please try attached patch, does it make udhcpc background?

On a side note, the way you do network config is fragile.
Don't you see that hardcoding eth0 interface name is asking
for trouble in multihomed case? What will happen if
/proc/cmdline would accidentally contain e.g. "turnip=big"
substring?
--
vda
diff -d -urpN busybox.6/networking/udhcp/dhcpc.c busybox.7/networking/udhcp/dhcpc.c
--- busybox.6/networking/udhcp/dhcpc.c	2008-09-19 01:42:31.000000000 +0200
+++ busybox.7/networking/udhcp/dhcpc.c	2008-09-25 23:21:19.000000000 +0200
@@ -363,6 +363,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
 					packet_num++;
 					continue;
 				}
+ leasefail:
 				udhcp_run_script(NULL, "leasefail");
 #if BB_MMU /* -b is not supported on NOMMU */
 				if (opt & OPT_b) { /* background if no lease */
@@ -399,6 +400,11 @@ int udhcpc_main(int argc UNUSED_PARAM, c
 					udhcp_run_script(NULL, "deconfig");
 				change_listen_mode(LISTEN_RAW);
 				state = INIT_SELECTING;
+				/* "discover...select...discover..." loops
+				 * were seen in the wild. Treat then similarly
+				 * to "no response to discover" case */
+				if (state == REQUESTING)
+					goto leasefail;
 				timeout = 0;
 				packet_num = 0;
 				continue;
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to