[U-Boot] Different Port for TFTP communication

Hi,
I have a short question about TFTP usage in u-boot. Is it possible to change the Port for TFTP communication while u-boot is running. Standard path for TFTP is 69 an let's say, we want to change port to 1500.
Regards Mario

Dear Mario,
In message F50CAB352C149543A6F2FFE37D4B59348AC9E60A@S1.mackware.local you wrote:
I have a short question about TFTP usage in u-boot. Is it possible to change the Port for TFTP communication while u-boot is running. Standard path for TFTP is 69 an let's say, we want to change port to 1500.
As is, this cannot be changed. The TFTP port number is hard wired in the code - see "net/tftp.c":
... 18 /* Well known TFTP port # */ 19 #define WELL_KNOWN_PORT 69 ...
Of course it should be trivial to add a config option for this, or even make it changable at runtime. But I have to admit that I don't see many actual use cases for such a modification.
Could you please explain why you need to do this - is this just some exotic environment, or is this needed for some more general use case?
Best regards,
Wolfgang Denk

Dear Mario,
In message 20140407165243.3B074380958@gemini.denx.de I wrote:
As is, this cannot be changed. The TFTP port number is hard wired in the code - see "net/tftp.c":
... 18 /* Well known TFTP port # */ 19 #define WELL_KNOWN_PORT 69 ...
Actually this is not correct. There are options to use different port numbers, see further down below in the same file:
798 #ifdef CONFIG_TFTP_PORT 799 ep = getenv("tftpdstp"); 800 if (ep != NULL) 801 TftpRemotePort = simple_strtol(ep, NULL, 10); 802 ep = getenv("tftpsrcp"); 803 if (ep != NULL) 804 TftpOurPort = simple_strtol(ep, NULL, 10); 805 #endif
So just make sure to define CONFIG_TFTP_PORT in your board config file, and set the environment variables tftpdstp and/or tftpsrcp as needed.
Hope this helps.
Best regards,
Wolfgang Denk
participants (2)
-
Mario Albrecht
-
Wolfgang Denk