[PATCH] udhcpc: add support IETF RFC2131 section-4.1 retransmission strategy
Frank TEO
frank128 at ymail.com
Fri Sep 28 07:04:02 UTC 2012
IETF RFC2131 section-4.1 retransmission strategy said
The client MUST adopt a retransmission strategy that incorporates a randomized exponential backoff algorithm...
first retransmission SHOULD be 4 seconds ...
next retransmission SHOULD be 8 seconds ...
retransmission delay SHOULD be doubled with subsequent retransmissions up to a maximum of 64 seconds.
The
randomized component is not implemented, since it should have some
minor msec/usec CPU execution differences accross different CPU speed
and platform.
Below is the syslog message after apply the patch. ((Next +XXs) are manually written.
udhcpc using option -T 4 -t 5 -A 60
/ # cat /var/log/messages | grep udhcpc
Jan 1 00:00:01 SDK2-06 daemon.info udhcpc[751]: udhcpc (v1.21.0.git) started
Jan 1 00:00:01 SDK2-06 daemon.info udhcpc[751]: Sending discover... (Next +4s)
Jan 1 00:00:05 SDK2-06 daemon.info udhcpc[751]: Sending discover... (Next +8s)
Jan 1 00:00:13 SDK2-06 daemon.info udhcpc[751]: Sending discover... (Next +16s)
Jan 1 00:00:29 SDK2-06 daemon.info udhcpc[751]: Sending discover... (Next +32s)
Jan 1 00:01:01 SDK2-06 daemon.info udhcpc[751]: Sending discover... (Next +64s)
Jan 1 00:02:05 SDK2-06 daemon.info udhcpc[751]: No lease, forking to background (tryagain +60s)
Jan 1 00:03:05 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +4s)
Jan 1 00:03:09 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +8s)
Jan 1 00:03:17 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +16s)
Jan 1 00:03:34 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +32s)
Jan 1 00:04:06 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +64s) + (tryagain +60s)
Jan 1 00:06:10 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +4s)
Jan 1 00:06:14 SDK2-06 daemon.info udhcpc[772]: Sending discover... (Next +8s)
Jan 1 00:06:22 SDK2-06 daemon.info udhcpc[772]: Sending discover...
Jan 1 00:06:38 SDK2-06 daemon.info udhcpc[772]: Sending discover...
Jan 1 00:07:10 SDK2-06 daemon.info udhcpc[772]: Sending discover...
The attached busybox-udhcpc-rfc2131-section-4-1.patch is patch without
applying discover_retries == 0 (infinite) patch 1c7a58dfb82ea04c525e0c19f94f2d800dee99e3.
I believe "discover_retries == 0 (infinite) patch" cannot reset "packet_num = 0;" which is required by this patch.
Since I am using -t greater than 0, so I am not affected.
diff -Naupr busybox-orig/networking/udhcp/dhcpc.c busybox-new/networking/udhcp/dhcpc.c
--- busybox-orig/networking/udhcp/dhcpc.c 2012-08-16 22:52:27.000000000 +0800
+++ busybox-new/networking/udhcp/dhcpc.c 2012-08-22 19:06:03.533954000 +0800
@@ -1447,7 +1447,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
xid = random_xid();
/* broadcast */
send_discover(xid, requested_ip);
- timeout = discover_timeout;
+ timeout = discover_timeout << packet_num;
packet_num++;
continue;
}
@@ -1474,7 +1474,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
if (packet_num < discover_retries) {
/* send broadcast select packet */
send_select(xid, server_addr, requested_ip);
- timeout = discover_timeout;
+ timeout = discover_timeout << packet_num;
packet_num++;
continue;
}
More information about the busybox
mailing list