net: tftp: setup tftp_remote_ip and tftp_filename env variables
PATCH 1/1 net: tftp: setup tftp_remote_ip and tftp_filename env variables
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
Example
=> setenv bootfile 192.168.100.80:/ && pxe get
...
=> printenv tftp_filename tftp_remote_ip serverip
tftp_filename=/pxelinux.cfg/default-arm-meson
tftp_remote_ip=192.168.100.80
serverip=192.168.100.1
Signed-off-by Artem Lapkin <[email protected]>
--- net/tftp.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/tftp.c +6 -0
@@ -798,6 +798,12 @@ void tftp_start(enum proto_t protocol)#endif &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;
Signature · 1 line
2.25.1