[U-Boot] [PATCH 1/2] net: Add bootfile in DHCP Request

amessier.tyco at gmail.com amessier.tyco at gmail.com
Fri Jan 22 20:22:42 CET 2016


From: Alexandre Messier <amessier at tycoint.com>

Add the bootfile name in the DHCP Request packet, in addition
to it already being sent in the DHCP Discover.

This is needed by some DHCP servers so that the bootfile name is
properly returned by the server to the client in the DHCP Ack, as
expected by U-Boot.

Signed-off-by: Alexandre Messier <amessier at tycoint.com>
---
 README      | 5 +++++
 net/bootp.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/README b/README
index 0dc657d..05966ab 100644
--- a/README
+++ b/README
@@ -2191,6 +2191,7 @@ CBFS (Coreboot Filesystem) support
 		CONFIG_BOOTP_TIMEOFFSET
 		CONFIG_BOOTP_VENDOREX
 		CONFIG_BOOTP_MAY_FAIL
+		CONFIG_BOOTP_DHCPREQ_BOOTFILE
 
 		CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
 		environment variable, not the BOOTP server.
@@ -2231,6 +2232,10 @@ CBFS (Coreboot Filesystem) support
 		the DHCP timeout and retry process takes a longer than
 		this delay.
 
+		CONFIG_BOOTP_DHCPREQ_BOOTFILE - Set the bootfile name in
+		DHCPREQUEST packet, in addition to DHCPDISCOVER. This may be
+		needed by some DHCP servers in specific cases.
+
  - Link-local IP address negotiation:
 		Negotiate with other link-local clients on the local network
 		for an address that doesn't require explicit configuration.
diff --git a/net/bootp.c b/net/bootp.c
index b2f8ad4..8da94cf 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -918,6 +918,9 @@ static void dhcp_send_request_packet(struct bootp_hdr *bp_offer)
 	net_write_ip(&bp->bp_giaddr, zero_ip);
 
 	memcpy(bp->bp_chaddr, net_ethaddr, 6);
+#if defined(CONFIG_BOOTP_DHCPREQ_BOOTFILE)
+	copy_filename(bp->bp_file, net_boot_file_name, sizeof(bp->bp_file));
+#endif
 
 	/*
 	 * ID is the id of the OFFER packet
-- 
1.8.3.1



More information about the U-Boot mailing list