diff mbox series

net: tftp: setup tftp_remote_ip and tftp_filename env variables

Message ID 20210301091703.3540605-1-art@khadas.com
State Deferred
Delegated to: Tom Rini
Headers show
Series net: tftp: setup tftp_remote_ip and tftp_filename env variables | expand

Commit Message

Art Nikpal March 1, 2021, 9:17 a.m. UTC
setup tftp_remote_ip and tftp_filename environment variable for next usage

Problem: no way determinate real filename and remote ip after tftp transfer
1) serverip can be different from real tftp remote ip 
2) filename same determined automatically


=> setenv bootfile && pxe get
=> printenv tftp_filename tftp_remote_ip serverip

Signed-off-by: Artem Lapkin <art@khadas.com>
 net/tftp.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series


diff --git a/net/tftp.c b/net/tftp.c
index 6fdb1a82..448103a1 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -798,6 +798,12 @@  void tftp_start(enum proto_t protocol)
 	       &tftp_remote_ip, &net_ip);
+	char tftp_remote_ip_str[22];
+	ip_to_string(tftp_remote_ip, tftp_remote_ip_str);
+	env_set("tftp_remote_ip", tftp_remote_ip_str);
+	env_set("tftp_filename", tftp_filename);
 	/* Check if we need to send across this subnet */
 	if (net_gateway.s_addr && net_netmask.s_addr) {
 		struct in_addr our_net;