Commit ecb0ccd9c260701183bc8d35966e65e6a2feb2f6
1 parent
4bc12f1ccf
Exists in
master
and in
54 other branches
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
Showing 3 changed files with 34 additions and 0 deletions Side-by-side Diff
CHANGELOG
... | ... | @@ -2,6 +2,11 @@ |
2 | 2 | Changes for U-Boot 1.1.4: |
3 | 3 | ====================================================================== |
4 | 4 | |
5 | +* Allow to force TFTP to use a fixed UDP port | |
6 | + (Add a configuration option CONFIG_TFTP_PORT and optional env | |
7 | + variable tftpport) | |
8 | + Patch by Jerry Van Baren, 10 Jan 2005 | |
9 | + | |
5 | 10 | * Fix ethernet timeouts on dbau1550 and other au1x00 systems |
6 | 11 | Patch by Leif Lindholm, 29 Dec 2004 |
7 | 12 |
README
... | ... | @@ -1487,6 +1487,22 @@ |
1487 | 1487 | When SystemACE support is added, the "ace" device type |
1488 | 1488 | becomes available to the fat commands, i.e. fatls. |
1489 | 1489 | |
1490 | +- TFTP Fixed UDP Port: | |
1491 | + CONFIG_TFTP_PORT | |
1492 | + | |
1493 | + If this is defined, the environment variable tftpport | |
1494 | + is used to supply the TFTP UDP source port value. | |
1495 | + If tftpport isn't defined, the normal pseudo-random port | |
1496 | + number generator is used. | |
1497 | + | |
1498 | + The purpose for this is to allow a TFTP server to | |
1499 | + blindly start the TFTP transfer using the pre-configured | |
1500 | + target IP address and UDP port. This has the effect of | |
1501 | + "punching through" the (Windows XP) firewall, allowing | |
1502 | + the remainder of the TFTP transfer to proceed normally. | |
1503 | + A better solution is to properly configure the firewall, | |
1504 | + but sometimes that is not allowed. | |
1505 | + | |
1490 | 1506 | - Show boot progress: |
1491 | 1507 | CONFIG_SHOW_BOOT_PROGRESS |
1492 | 1508 | |
... | ... | @@ -2451,6 +2467,9 @@ |
2451 | 2467 | are tried once without success. |
2452 | 2468 | Useful on scripts which control the retry operation |
2453 | 2469 | themselves. |
2470 | + | |
2471 | + tftpport - If this is set, the value is used for TFTP's | |
2472 | + UDP source port. | |
2454 | 2473 | |
2455 | 2474 | vlan - When set to a value < 4095 the traffic over |
2456 | 2475 | ethernet is encapsulated/received over 802.1q |
net/tftp.c
... | ... | @@ -313,6 +313,10 @@ |
313 | 313 | void |
314 | 314 | TftpStart (void) |
315 | 315 | { |
316 | +#ifdef CONFIG_TFTP_PORT | |
317 | + char *ep; /* Environment pointer */ | |
318 | +#endif | |
319 | + | |
316 | 320 | if (BootFile[0] == '\0') { |
317 | 321 | sprintf(default_filename, "%02lX%02lX%02lX%02lX.img", |
318 | 322 | NetOurIP & 0xFF, |
319 | 323 | |
... | ... | @@ -364,7 +368,13 @@ |
364 | 368 | TftpServerPort = WELL_KNOWN_PORT; |
365 | 369 | TftpTimeoutCount = 0; |
366 | 370 | TftpState = STATE_RRQ; |
371 | + /* Use a pseudo-random port unless a specific port is set */ | |
367 | 372 | TftpOurPort = 1024 + (get_timer(0) % 3072); |
373 | +#ifdef CONFIG_TFTP_PORT | |
374 | + if ((ep = getenv("tftpport")) != NULL) { | |
375 | + TftpOurPort= simple_strtol(ep, NULL, 10); | |
376 | + } | |
377 | +#endif | |
368 | 378 | TftpBlock = 0; |
369 | 379 | |
370 | 380 | /* zero out server ether in case the server ip has changed */ |