[U-Boot-Users] Patch: allow a fixed port for TFTP (take 3)

Hi Wolfgang, try three on the patch attached. The change here is to rename the env variable per Tolunay Orkun's recommendation.
* Patch by Jerry Van Baren 11 January 2005 - Add a configuration option CONFIG_TFTP_PORT and optional env variable tftpsourceport to force TFTP to use a fixed UDP port.
gvb
Index: README =================================================================== RCS file: /cvsroot/u-boot/u-boot/README,v retrieving revision 1.117 diff -p -u -r1.117 README --- README 9 Jan 2005 23:16:42 -0000 1.117 +++ README 10 Jan 2005 04:13:50 -0000 @@ -1480,6 +1480,22 @@ The following options need to be configu When SystemACE support is added, the "ace" device type becomes available to the fat commands, i.e. fatls.
+- TFTP Fixed UDP Port: + CONFIG_TFTP_PORT + + If this is defined, the environment variable tftpsourceport + is used to supply the TFTP UDP source port value. + If tftpsourceport isn't defined, the normal pseudo-random port + number generator is used. + + The purpose for this is to allow a TFTP server to + blindly start the TFTP transfer using the pre-configured + target IP address and UDP port. This has the effect of + "punching through" the (Windows XP) firewall, allowing + the remainder of the TFTP transfer to proceed normally. + A better solution is to properly configure the firewall, + but sometimes that is not allowed. + - Show boot progress: CONFIG_SHOW_BOOT_PROGRESS
@@ -2432,6 +2448,9 @@ Some configuration options can be set us Useful on scripts which control the retry operation themselves.
+ tftpsourceport - If this is set, the value is used for TFTP's + UDP source port. + vlan - When set to a value < 4095 the traffic over ethernet is encapsulated/received over 802.1q VLAN tagged frames. Index: net/tftp.c =================================================================== RCS file: /cvsroot/u-boot/u-boot/net/tftp.c,v retrieving revision 1.9 diff -p -u -r1.9 tftp.c --- net/tftp.c 15 Apr 2004 21:48:55 -0000 1.9 +++ net/tftp.c 10 Jan 2005 04:13:51 -0000 @@ -301,6 +301,10 @@ TftpTimeout (void) void TftpStart (void) { +#ifdef CONFIG_TFTP_PORT + char *ep; /* Environment pointer */ +#endif + if (BootFile[0] == '\0') { IPaddr_t OurIP = ntohl(NetOurIP);
@@ -354,7 +358,13 @@ TftpStart (void) TftpServerPort = WELL_KNOWN_PORT; TftpTimeoutCount = 0; TftpState = STATE_RRQ; + /* Use a pseudo-random port unless a specific port is set */ TftpOurPort = 1024 + (get_timer(0) % 3072); +#ifdef CONFIG_TFTP_PORT + if ((ep = getenv("tftpsourceport")) != NULL) { + TftpOurPort= simple_strtol(ep, NULL, 10); + } +#endif TftpBlock = 0;
/* zero out server ether in case the server ip has changed */

In message 41E3ECBA.5030802@smiths-aerospace.com you wrote:
Hi Wolfgang, try three on the patch attached. The change here is to rename the env variable per Tolunay Orkun's recommendation.
I reject this because such a long variable name seems unacceptable to me. Don't make life unnecessarily hard to your users. Use a short name. How about "tftpport"?
Best regards,
Wolfgang Denk

Dear Wolfgang,
Wolfgang Denk wrote:
In message 41E3ECBA.5030802@smiths-aerospace.com you wrote:
Hi Wolfgang, try three on the patch attached. The change here is to rename the env variable per Tolunay Orkun's recommendation.
I reject this because such a long variable name seems unacceptable to me. Don't make life unnecessarily hard to your users. Use a short name. How about "tftpport"?
Wolfgang, "tftpport" is what he has done previously.
It is more appropriate and customary for "tftpport" to refer to the server port (i.e. reference to a port without a qualification of client/server, source/destination etc). This patch on the other hand is leaving the server port as is (well known port) and modifying the normally dynamic source (client) port to a fixed value via environment. I think, using "tftpport" would be a poor choice.
I will pledge for clarity over 6 more bytes in environment which most boards will not define anyway. If that is not reasonable, please allow for "tftpsrcport" or "tftpcport".
I actually want to provide a complimentary patch over this one to make the tftp server port configurable which the environment variable can be appropriately named as one of "tftpserverport", "tftpdestport" or "tftpsport". I also want to use the same CONFIG_TFTP_PORT variable to enable both environment variables unless you object in which case naming the config variables as CONFIG_TFTP_CLIENT_PORT and CONFIG_TFTP_SERVER_PORT is probably better.
Best regards, Tolunay

In message 41E4657F.6010406@orkun.us you wrote:
I reject this because such a long variable name seems unacceptable to me. Don't make life unnecessarily hard to your users. Use a short name. How about "tftpport"?
Wolfgang, "tftpport" is what he has done previously.
:-(
I will pledge for clarity over 6 more bytes in environment which most boards will not define anyway. If that is not reasonable, please allow for "tftpsrcport" or "tftpcport".
So be it "tftpsrcport" then. Or "tftpsrcp" :-)
["tftpcport" ??? TFT-PC-Port? Or 'c' like what???]
I actually want to provide a complimentary patch over this one to make the tftp server port configurable which the environment variable can be appropriately named as one of "tftpserverport", "tftpdestport" or
tftpdstport or tftpdstp, please.
"tftpsport". I also want to use the same CONFIG_TFTP_PORT variable to
[Seems to be some funny kind of exercise, this: TFTP sport. And is misleading - TFTP _S_ource Port ?]
enable both environment variables unless you object in which case naming the config variables as CONFIG_TFTP_CLIENT_PORT and CONFIG_TFTP_SERVER_PORT is probably better.
OK.
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
In message 41E4657F.6010406@orkun.us you wrote:
I will pledge for clarity over 6 more bytes in environment which most boards will not define anyway. If that is not reasonable, please allow for "tftpsrcport" or "tftpcport".
So be it "tftpsrcport" then. Or "tftpsrcp" :-)
I prefer "tftpsrcport". I hope Jerry will agee as well.
["tftpcport" ??? TFT-PC-Port? Or 'c' like what???]
'c' was to stand for "client". Just like bootpc and bootps in /etc/services
I actually want to provide a complimentary patch over this one to make the tftp server port configurable which the environment variable can be appropriately named as one of "tftpserverport", "tftpdestport" or
tftpdstport or tftpdstp, please.
IMHO, "tftpdstport" is better.
"tftpsport". I also want to use the same CONFIG_TFTP_PORT variable to
[Seems to be some funny kind of exercise, this: TFTP sport. And is misleading - TFTP _S_ource Port ?]
Yes, that is kind of vague. Again, I used bootpc and bootps analogy.
enable both environment variables unless you object in which case naming the config variables as CONFIG_TFTP_CLIENT_PORT and CONFIG_TFTP_SERVER_PORT is probably better.
OK.
OK for which? OK to use CONFIG_TFTP_PORT for enabling code for both "tftpsrcport" and "tftpdstport"?
Best regards, Tolunay

Tolunay Orkun wrote:
Wolfgang Denk wrote:
In message 41E4657F.6010406@orkun.us you wrote:
I will pledge for clarity over 6 more bytes in environment which most boards will not define anyway. If that is not reasonable, please allow for "tftpsrcport" or "tftpcport".
So be it "tftpsrcport" then. Or "tftpsrcp" :-)
I prefer "tftpsrcport". I hope Jerry will agee as well.
["tftpcport" ??? TFT-PC-Port? Or 'c' like what???]
'c' was to stand for "client". Just like bootpc and bootps in /etc/services
I actually want to provide a complimentary patch over this one to make the tftp server port configurable which the environment variable can be appropriately named as one of "tftpserverport", "tftpdestport" or
tftpdstport or tftpdstp, please.
IMHO, "tftpdstport" is better.
"tftpsport". I also want to use the same CONFIG_TFTP_PORT variable to
[Seems to be some funny kind of exercise, this: TFTP sport. And is misleading - TFTP _S_ource Port ?]
Yes, that is kind of vague. Again, I used bootpc and bootps analogy.
enable both environment variables unless you object in which case naming the config variables as CONFIG_TFTP_CLIENT_PORT and CONFIG_TFTP_SERVER_PORT is probably better.
OK.
OK for which? OK to use CONFIG_TFTP_PORT for enabling code for both "tftpsrcport" and "tftpdstport"?
Best regards, Tolunay
OK, If I follow all the quoting correctly :-O, an acceptable set of names is the following. This is not Tolunay's first choice (sorry), in this case I'll suck up and side with Wolfgang ;-).
tftpsrcp - Source UDP port for TFTP (Jerry's patch) tftpdstp - Destination UDP port for TFTP (Tolunay's projected follow-on)
Patch Version 4.rc1 to follow...
gvb "There comes a time in the history of any project when it becomes necessary to shoot the engineers and begin production." (attributed to MacUser in 1990)

Jerry Van Baren wrote:
OK, If I follow all the quoting correctly :-O, an acceptable set of names is the following. This is not Tolunay's first choice (sorry), in this case I'll suck up and side with Wolfgang ;-).
tftpsrcp - Source UDP port for TFTP (Jerry's patch) tftpdstp - Destination UDP port for TFTP (Tolunay's projected follow-on)
Spelling our "port" fully would make it more readable but I am OK with this. At least we are going to have some consistency between patches.
Per Wolfgang's comments, we are both using CONFIG_TFTP_PORT for your patch and the follow up patch I am going to submit soon.
Patch Version 4.rc1 to follow...
Thanks for your patience!

In message 41E528EA.8040906@smiths-aerospace.com you wrote:
OK, If I follow all the quoting correctly :-O, an acceptable set of names is the following. This is not Tolunay's first choice (sorry), in this case I'll suck up and side with Wolfgang ;-).
tftpsrcp - Source UDP port for TFTP (Jerry's patch) tftpdstp - Destination UDP port for TFTP (Tolunay's projected follow-on)
Patch Version 4.rc1 to follow...
You may have notived that I checked in the _porevious_ version of this patch, as the "Patch Version 4.rc1" announced here never made it to the list (or at least not into my stack). Please feel free to submit an incremental patch against the current git.
Best regards,
Wolfgang Denk

In message 20050924204741.113DD3527DC@atlas.denx.de I wrote:
Patch Version 4.rc1 to follow...
You may have notived that I checked in the _porevious_ version of this patch, as the "Patch Version 4.rc1" announced here never made it to the list (or at least not into my stack). Please feel free to submit an incremental patch against the current git.
Please forget this. I just ran over the new version of your patch and added it. Thanks.
Best regards,
Wolfgang Denk

In message 41E4DB2C.1010908@orkun.us you wrote:
enable both environment variables unless you object in which case naming the config variables as CONFIG_TFTP_CLIENT_PORT and CONFIG_TFTP_SERVER_PORT is probably better.
OK.
OK for which? OK to use CONFIG_TFTP_PORT for enabling code for both "tftpsrcport" and "tftpdstport"?
Yes.
Best regards,
Wolfgang Denk

Wolfgang Denk wrote:
In message 41E3ECBA.5030802@smiths-aerospace.com you wrote:
Hi Wolfgang, try three on the patch attached. The change here is to rename the env variable per Tolunay Orkun's recommendation.
I reject this because such a long variable name seems unacceptable to me. Don't make life unnecessarily hard to your users. Use a short name. How about "tftpport"?
Best regards,
Wolfgang Denk
OK, then I'll stick with my previous patch (Version 2 2005-01-10) which used "tftpport" (that was the only change between v.2 and v.3). I can re-send it to you if you have already trashed my original message.
Thanks, gvb
participants (3)
-
Jerry Van Baren
-
Tolunay Orkun
-
Wolfgang Denk