Busybox Update Problem

Denys Vlasenko vda.linux at googlemail.com
Fri Sep 26 16:02:48 UTC 2008


> No change with the patch it did not go to the background.
> Output is attached.  I cut it down to 2 cycles, but goes forever as before.

Yes, output confirms what I expected. DHCP server doesn't respond
to requests "Please ACK my address".

Please look in networking/udhcp/dhcpc.c - can you add debug
printouts (shown as +bb_error_msg etc)?

		if (retval == 0) {
			/* We will restart the wait in any case */
			already_waited_sec = 0;

+bb_error_msg("state:%d", state);
			switch (state) {
			case INIT_SELECTING:
				if (packet_num < discover_retries) {
					if (packet_num == 0)
						xid = random_xid();

					send_discover(xid, requested_ip); /* broadcast */

					timeout = discover_timeout;
					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 */
					bb_info_msg("No lease, forking to background");
					client_background();
					/* do not background again! */
					opt = ((opt & ~OPT_b) | OPT_f);
				} else
#endif
				if (opt & OPT_n) { /* abort if no lease */
					bb_info_msg("No lease, failing");
					retval = 1;
					goto ret;
				}
				/* wait before trying again */
				timeout = tryagain_timeout;
				packet_num = 0;
				continue;
			case RENEW_REQUESTED:
			case REQUESTING:
+bb_error_msg("state:%d packet_num:%d discover_retries:%d", state,
packet_num, discover_retries);
				if (packet_num < discover_retries) {
					/* send request packet */
					if (state == RENEW_REQUESTED) /* unicast */
						send_renew(xid, server_addr, requested_ip);
					else /* broadcast */
						send_selecting(xid, server_addr, requested_ip);

					timeout = discover_timeout;
					packet_num++;
					continue;
				}
+bb_error_msg("timed out waiting for responce");
				/* timed out, go back to init state */
				if (state == RENEW_REQUESTED)
					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)
+{bb_error_msg("discover/select loop detected, goto leasefail");
					goto leasefail;
+}
				timeout = 0;
				packet_num = 0;
				continue;
			case BOUND:


The output ought to explain why it does not do what I expect.

--
vda



More information about the busybox mailing list