]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
net: send RFC1542 compliant value for bootp requests
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Thu, 27 Aug 2015 21:57:18 +0000 (23:57 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 28 Oct 2015 19:55:47 +0000 (14:55 -0500)
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>
net/bootp.c

index 3fac7f3b3aa98b93e9ea492b725055c386ac4da7..93eff872468418a436343c2e6b40578ef1350527 100644 (file)
@@ -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 */