add support for -t 0 (infinite retry) in busybox udhcpc and use it in the network scripts

SVN-Revision: 5493
This commit is contained in:
Felix Fietkau 2006-11-09 23:41:50 +00:00
parent 223fdb0443
commit 57ab02b754
2 changed files with 22 additions and 1 deletions

View File

@ -143,7 +143,7 @@ setup_interface() {
# don't stay running in background if dhcp is not the main proto on the interface (e.g. when using pptp) # don't stay running in background if dhcp is not the main proto on the interface (e.g. when using pptp)
[ "$proto1" != "$proto" ] && dhcpopts="-n -q" [ "$proto1" != "$proto" ] && dhcpopts="-n -q"
$DEBUG udhcpc -i "$iface" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} -b -p "$pidfile" ${dhcpopts:- -R &} $DEBUG udhcpc -t 0 -i "$iface" ${ipaddr:+-r $ipaddr} ${hostname:+-H $hostname} -b -p "$pidfile" ${dhcpopts:- -R &}
lock -u "/var/lock/dhcp-$iface" lock -u "/var/lock/dhcp-$iface"
;; ;;
*) *)

View File

@ -0,0 +1,21 @@
diff -ur busybox.old/networking/udhcp/dhcpc.c busybox.dev/networking/udhcp/dhcpc.c
--- busybox.old/networking/udhcp/dhcpc.c 2006-11-10 00:17:26.000000000 +0100
+++ busybox.dev/networking/udhcp/dhcpc.c 2006-11-10 00:17:10.000000000 +0100
@@ -330,7 +330,7 @@
/* timeout dropped to zero */
switch (state) {
case INIT_SELECTING:
- if (packet_num < client_config.retries) {
+ if (!client_config.retries || (packet_num < client_config.retries)) {
if (packet_num == 0)
xid = random_xid();
@@ -355,7 +355,7 @@
break;
case RENEW_REQUESTED:
case REQUESTING:
- if (packet_num < client_config.retries) {
+ if (!client_config.retries || (packet_num < client_config.retries)) {
/* send request packet */
if (state == RENEW_REQUESTED)
send_renew(xid, server_addr, requested_ip); /* unicast */