summaryrefslogtreecommitdiff
path: root/include/net.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-17 10:47:39 -0700
committerTom Rini <trini@konsulko.com>2023-01-23 18:11:40 -0500
commitc8c3fd24cc0dd9512237dc13528e90eb46e704a7 (patch)
tree0e4a7e820d9048c144e950b4faf48f7d209aec5e /include/net.h
parent843160fa7afc682651c5eea7d8e15f0767b66497 (diff)
net: Add a function to run dhcp
At present this must be done by executing the command. Also it involves fiddling with the environment to determine the correct autoload behaviour. Ideally it should be possible to run network operations without even having the command line present (CONFIG_CMDLINE). For now, add a function to handle DHCP, so it can be called from a bootdev more easily. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'include/net.h')
-rw-r--r--include/net.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net.h b/include/net.h
index 759d4669df1..399af5e0645 100644
--- a/include/net.h
+++ b/include/net.h
@@ -66,6 +66,21 @@ struct in_addr {
int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
/**
+ * dhcp_run() - Run DHCP on the current ethernet device
+ *
+ * This sets the autoload variable, then puts it back to similar to its original
+ * state (y, n or unset).
+ *
+ * @addr: Address to load the file into (0 if @autoload is false)
+ * @fname: Filename of file to load (NULL if @autoload is false or to use the
+ * default filename)
+ * @autoload: true to load the file, false to just get the network IP
+ * @return 0 if OK, -EINVAL if the environment failed, -ENOENT if ant file was
+ * not found
+ */
+int dhcp_run(ulong addr, const char *fname, bool autoload);
+
+/**
* An incoming packet handler.
* @param pkt pointer to the application packet
* @param dport destination UDP port