From 1f9cf67ab05b2034659dc21ebb7ae78c4ef1019b Mon Sep 17 00:00:00 2001 From: Eric Bénard Date: Thu, 29 Jan 2015 00:42:18 +0100 Subject: dhcp: fix request packet's requested IP option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the request packet, we are supposed to copy the IP that the DHCP server provided in the offer packet so that dhcp_extended can fill the option 50. There is actually an error in barebox as the pointer to the packet currently built is used as the source instead of the pointer to the offer packet. With this patch, barebox now sends a request packet which includes the right requested IP in option 50. Signed-off-by: Eric Bénard Signed-off-by: Sascha Hauer --- net/dhcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/dhcp.c b/net/dhcp.c index 9551d60ad4..a22fad0f3a 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -579,7 +579,7 @@ static void dhcp_send_request_packet(struct bootp *bp_offer) /* * Copy options from OFFER packet if present */ - net_copy_ip(&OfferedIP, &bp->bp_yiaddr); + net_copy_ip(&OfferedIP, &bp_offer->bp_yiaddr); extlen = dhcp_extended((u8 *)bp->bp_vend, DHCP_REQUEST, net_dhcp_server_ip, OfferedIP); -- cgit v1.2.3 From ea0a3b7da852b3e889d13d0cf95cdd4715c30c38 Mon Sep 17 00:00:00 2001 From: Eric Bénard Date: Thu, 29 Jan 2015 00:37:33 +0100 Subject: dhcp: fix request packet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit we are not supposed to fill ciaddr, yiaddr and siaddr in the request packet. Signed-off-by: Eric Bénard Signed-off-by: Sascha Hauer --- net/dhcp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'net') diff --git a/net/dhcp.c b/net/dhcp.c index a22fad0f3a..cad5dd2b59 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -559,9 +559,7 @@ static void dhcp_send_request_packet(struct bootp *bp_offer) bp->bp_hops = 0; /* FIXME what is this? */ // bp->bp_secs = htons(get_timer(0) / CFG_HZ); - net_copy_ip(&bp->bp_ciaddr, &bp_offer->bp_ciaddr); /* both in network byte order */ - net_copy_ip(&bp->bp_yiaddr, &bp_offer->bp_yiaddr); - net_copy_ip(&bp->bp_siaddr, &bp_offer->bp_siaddr); + /* * RFC3046 requires Relay Agents to discard packets with * nonzero and offered giaddr -- cgit v1.2.3 From 223adf761b6c3cc7e4535769a917e0c02b334302 Mon Sep 17 00:00:00 2001 From: Eric Bénard Date: Thu, 29 Jan 2015 00:37:34 +0100 Subject: dhcp: fix request packet's seconds elapsed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it's done in the discover packet so let's do it also in the request packet. Signed-off-by: Eric Bénard Signed-off-by: Sascha Hauer --- net/dhcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'net') diff --git a/net/dhcp.c b/net/dhcp.c index cad5dd2b59..19a846270e 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -557,8 +557,7 @@ static void dhcp_send_request_packet(struct bootp *bp_offer) bp->bp_htype = HWT_ETHER; bp->bp_hlen = HWL_ETHER; bp->bp_hops = 0; - /* FIXME what is this? */ -// bp->bp_secs = htons(get_timer(0) / CFG_HZ); + bp->bp_secs = htons(get_time_ns() >> 30); /* * RFC3046 requires Relay Agents to discard packets with -- cgit v1.2.3