diff options
author | Jerome Forissier <jerome.forissier@linaro.org> | 2024-11-14 18:20:07 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-22 14:51:26 -0600 |
commit | 13e13f58671305ac20a889d7271d85cb7e27af78 (patch) | |
tree | 0184d09bb1bab7859951e2e6a9dd8178bec4aac6 | |
parent | 2cde2f4a0073ac1e4a528a1fab40e3d6c1f4bf29 (diff) |
net: lwip: dhcp: support arguments for TFTP file download
The dhcp command is supposed to have the following syntax as per
"help dhcp":
dhcp [loadAddress] [[hostIPaddr:]bootfilename]
In other words, any arguments should be passed to an implicit
tftpboot command after the DHCP exchange has occurred.
Add the missing code to the lwIP version of do_dhcp().
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
-rw-r--r-- | net/lwip/dhcp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c index bfc72ca6c57..9b882cf5b87 100644 --- a/net/lwip/dhcp.c +++ b/net/lwip/dhcp.c @@ -111,9 +111,21 @@ static int dhcp_loop(struct udevice *udev) int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { + int ret; + eth_set_current(); - return dhcp_loop(eth_get_dev()); + ret = dhcp_loop(eth_get_dev()); + if (ret) + return ret; + + if (argc > 1) { + struct cmd_tbl cmdtp = {}; + + return do_tftpb(&cmdtp, 0, argc, argv); + } + + return CMD_RET_SUCCESS; } int dhcp_run(ulong addr, const char *fname, bool autoload) |