aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2015-08-27 23:57:18 +0200
committerJoe Hershberger <joe.hershberger@ni.com>2015-10-28 14:55:47 -0500
commit454d9d3ec81c5b77adaecb9a6254336d4c5775a9 (patch)
tree7a7ed72f1643293fa2f2ba2a7e798e5b5ad7e69b
parent867d6ae2c9cec6a0f6f3a7472cf8397693f6cc35 (diff)
downloadu-boot-454d9d3ec81c5b77adaecb9a6254336d4c5775a9.zip
u-boot-454d9d3ec81c5b77adaecb9a6254336d4c5775a9.tar.gz
u-boot-454d9d3ec81c5b77adaecb9a6254336d4c5775a9.tar.bz2
net: send RFC1542 compliant value for bootp requests
RFC1542, 3.2: "The 'secs' field of a BOOTREQUEST message SHOULD represent the elapsed time, in seconds, since the client sent its first BOOTREQUEST message. Note that this implies that the 'secs' field of the first BOOTREQUEST message SHOULD be set to zero." Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r--net/bootp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/bootp.c b/net/bootp.c
index 3fac7f3..93eff87 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -711,7 +711,11 @@ void bootp_request(void)
bp->bp_htype = HWT_ETHER;
bp->bp_hlen = HWL_ETHER;
bp->bp_hops = 0;
- bp->bp_secs = htons(get_timer(0) / 1000);
+ /*
+ * according to RFC1542, should be 0 on first request, secs since
+ * first request otherwise
+ */
+ bp->bp_secs = htons(get_timer(bootp_start) / 1000);
zero_ip.s_addr = 0;
net_write_ip(&bp->bp_ciaddr, zero_ip);
net_write_ip(&bp->bp_yiaddr, zero_ip);
@@ -905,7 +909,7 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
bp->bp_htype = HWT_ETHER;
bp->bp_hlen = HWL_ETHER;
bp->bp_hops = 0;
- bp->bp_secs = htons(get_timer(0) / 1000);
+ bp->bp_secs = htons(get_timer(bootp_start) / 1000);
/* Do not set the client IP, your IP, or server IP yet, since it
* hasn't been ACK'ed by the server yet */