Patch: allow a fixed port for TFTP
Hi Wolfgang, try two on the patch attached.
* Patch by Jerry Van Baren 10 January 2005
- Add a configuration option CONFIG_TFTP_PORT and optional env variable tftpport to force TFTP to use a fixed UDP port.
gvb
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 050110-tftp.patch
Url: http://lists.denx.de/pipermail/u-boot/attachments/20050110/cb2dea1f/attachment.txt
Jerry,
I have expressed my view that this patch does not address a real problem. You mentioned that all these modifications were necessary because the user were unable to configure their computer (lack of necessary skills or lack of administrative access to configure Windows firewall).
Nevertheless, if Wolfgang approves it, I would prefer changes to the name of environment variable you are using. When referring to TCP/IP services, we normally associate ports with the port the server component is listening. Thus "tftpport" is not clear enough and may mislead people to the server port. I would prefer more verbose "tftpclientport" or "tftpsrcport". This would allow us to define "tftpserverport" or "tftpdestport" later if necessary as well.
I do not object to CONFIG_TFTP_PORT, since same variable could be use to enable configurable client and server ports if tftpserverport were to be defined. In fact, I would include support for server port environment support now since it would make your match more useful for a larger audience IMHO.
Best regards,
Tolunay
Quoted 83 lines · Jerry Van Baren
Hi Wolfgang, try two on the patch attached.
* Patch by Jerry Van Baren 10 January 2005
- Add a configuration optionCONFIG_TFTP_PORTand optional env variable tftpport 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 READMEREADME +19
-0@@ -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 tftpport + is used to supply the TFTP UDP source port value. + If tftpport 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. + tftpport - 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.9tftp.ctftp.c +10
-0@@ -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 ("tftpport" )) !=NULL ) { + TftpOurPort=simple_strtol (ep,NULL ,10 ); + } +#endif TftpBlock =0 ;/* zero out server ether in case the server ip has changed */
Quoted 22 lines · Tolunay Orkun
Jerry,
I have expressed my view that this patch does not address a real problem. You mentioned that all these modifications were necessary because the user were unable to configure their computer (lack of necessary skills or lack of administrative access to configure Windows firewall).
Nevertheless, if Wolfgang approves it, I would prefer changes to the name of environment variable you are using. When referring to TCP/IP services, we normally associate ports with the port the server component is listening. Thus "tftpport" is not clear enough and may mislead people to the server port. I would prefer more verbose "tftpclientport" or "tftpsrcport". This would allow us to define "tftpserverport" or "tftpdestport" later if necessary as well.
I do not object to
CONFIG_TFTP_PORT, since same variable could be use to enable configurable client and server ports if tftpserverport were to be defined. In fact, I would include support for server port environment support now since it would make your match more useful for a larger audience IMHO.
Quoted 12 lines
Best regards,
TolunayQuoted 7 lines · Jerry Van Baren
Hi Wolfgang, try two on the patch attached.
* Patch by Jerry Van Baren 10 January 2005
- Add a configuration optionCONFIG_TFTP_PORTand optional env variable tftpport to force TFTP to use a fixed UDP port.gvb
I kind of like tftpclientport, that is much more descriptive. Thanks for the suggestion. I've rolled Yet Another Patch[tm].
gvb
Quoted 2 lines · In message <[email protected]> you wrote:
I kind of like tftpclientport, that is much more descriptive. Thanks
... and a PITA to type. Please use SHORT and escriptive names.
Also keep in mind that the environment is limited in size, and that long names just add delay when booting (especially with environment in EEPROM).
Don't tell me I'm picking nits. I've seen cases where simply re- entering the same (!) value for the "baudrate" variable added nearly 5 seconds (!!!) to the total boot time.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "It is better to have tried and failed than to have failed to try, but the result's the same." - Mike Dennison
Quoted 4 lines · In message <[email protected]> you wrote:
* Patch by Jerry Van Baren 10 January 2005
- Add a configuration optionCONFIG_TFTP_PORTand optional env variable tftpport to force TFTP to use a fixed UDP port.
Added, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The White Rabbit put on his spectacles. "Where shall I begin, please your Majesty ?" he asked. "Begin at the beginning,", the King said, very gravely, "and go on till you come to the end: then stop." -- Lewis Carroll