Denys Vlasenko wrote:
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
I implemented the change and looked at the output it never made it into
the loop. (First Attached dump)
if (state == REQUESTING)
{bb_error_msg("discover/select loop detected, goto leasefail");
goto leasefail;
}
I had a chance to look at the actual patch this time, and I noticed that
you set state to INIT_SELECTING right before you check if it is == to
REQUESTING
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;
}
So I moved the state = INIT_SELECTING; to after the if statement and
recompiled.
change_listen_mode(LISTEN_RAW);
/* "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;
}
state = INIT_SELECTING;
It now fails as was expected and makes it into the background. See
second attached myeditsdump.
Don't know if this has any other ramifications elsewhere in the code.
Just thought I would try it and see how it worked.
--
Michael Davis
Software Engineer
DTL Controls, LLC
udhcpc: state:0
Sending discover...
udhcpc: state:1
udhcpc: state:1 packet_num:0 discover_retries:3
Sending select for 192.168.1.183...
udhcpc: state:1
udhcpc: state:1 packet_num:1 discover_retries:3
Sending select for 192.168.1.183...
udhcpc: state:1
udhcpc: state:1 packet_num:2 discover_retries:3
Sending select for 192.168.1.183...
udhcpc: state:1
udhcpc: state:1 packet_num:3 discover_retries:3
udhcpc: timed out waiting for responce
udhcpc: state:0
Sending discover...
udhcpc: state:1
udhcpc: state:1 packet_num:0 discover_retries:3
Sending select for 192.168.1.183...
udhcpc: state:1
udhcpc: state:1 packet_num:1 discover_retries:3
Sending select for 192.168.1.183...
udhcpc: state:1
udhcpc: state:1 packet_num:2 discover_retries:3
Sending select for 192.168.1.183...
udhcpc: state:1
udhcpc: state:1 packet_num:3 discover_retries:3
udhcpc: timed out waiting for responce
udhcpc: state:0
Sending discover...
udhcpc (v1.11.2) started
udhcpc: state:0
Sending discover...
udhcpc: state:1
udhcpc: state:1 packet_num:0 discover_retries:3
Sending select for 192.168.1.185...
udhcpc: state:1
udhcpc: state:1 packet_num:1 discover_retries:3
Sending select for 192.168.1.185...
udhcpc: state:1
udhcpc: state:1 packet_num:2 discover_retries:3
Sending select for 192.168.1.185...
udhcpc: state:1
udhcpc: state:1 packet_num:3 discover_retries:3
udhcpc: timed out waiting for responce
udhcpc: discover/select loop detected, goto leasefail
No lease, forking to background
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox