[U-Boot-Users] Patch: allow a fixed port for TFTP
Tolunay Orkun
listmember at orkun.us
Mon Jan 10 23:52:58 CET 2005
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
Jerry Van Baren wrote:
> 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
>
>
> ------------------------------------------------------------------------
>
> 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 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.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("tftpport")) != NULL) {
> + TftpOurPort= simple_strtol(ep, NULL, 10);
> + }
> +#endif
> TftpBlock = 0;
>
> /* zero out server ether in case the server ip has changed */
More information about the U-Boot
mailing list