]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Allow to force TFTP to use a fixed UDP port
authorWolfgang Denk <wd@pollux.(none)>
Sat, 24 Sep 2005 20:37:32 +0000 (22:37 +0200)
committerWolfgang Denk <wd@pollux.(none)>
Sat, 24 Sep 2005 20:37:32 +0000 (22:37 +0200)
(Add a configuration option CONFIG_TFTP_PORT and optional env variable tftpport)
Patch by Jerry Van Baren, 10 Jan 2005

CHANGELOG
README
net/tftp.c

index 1ed2fb77a02eaed4bd261b5fd7eba3f547a040d4..bc194ffa815354e8d40924a6c5cc384d853ed8a3 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,11 @@
 Changes for U-Boot 1.1.4:
 ======================================================================
 
+* Allow to force TFTP to use a fixed UDP port
+  (Add a configuration option CONFIG_TFTP_PORT and optional env
+  variable tftpport)
+  Patch by Jerry Van Baren, 10 Jan 2005
+
 * Fix ethernet timeouts on dbau1550 and other au1x00 systems
   Patch by Leif Lindholm, 29 Dec 2004
 
diff --git a/README b/README
index e3d053717cc5c61b1a92aab3630147ccd87c8fdb..3b36e50e11d5995fb2b36dbebaf3b1a097aec4f5 100644 (file)
--- a/README
+++ b/README
@@ -1487,6 +1487,22 @@ The following options need to be configured:
                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
 
@@ -2452,6 +2468,9 @@ Some configuration options can be set using Environment Variables:
                  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 03a002767a736bca72ba437efd0b0097ccd514a5..a7c246a7de5a2e817826987c35a2de3fa5b5303f 100644 (file)
@@ -313,6 +313,10 @@ TftpTimeout (void)
 void
 TftpStart (void)
 {
+#ifdef CONFIG_TFTP_PORT
+       char *ep;             /* Environment pointer */
+#endif
+
        if (BootFile[0] == '\0') {
                sprintf(default_filename, "%02lX%02lX%02lX%02lX.img",
                        NetOurIP & 0xFF,
@@ -364,7 +368,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 */