mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-21 09:21:33 +01:00
tftp: make TFTP ports unconditionally configurable
A few lines of code being guarded by the CONFIG_TFTP_PORT option seems an unnecessary restriction on the TFTP support provided by a vanilla U-Boot image. In cases where the TFTP server cannot run as superuser - and hence cannot run on the well-known port 69 - this quirk incurs a full reconfiguration and rebuild of the bootloader only in order to select the appropriate destination port. Remove the CONFIG_TFTP_PORT option entirely and make the tftpdstp and tftpsrcp variables always have an effect. Their being unset will mean that U-Boot behaves the same as if CONFIG_TFTP_PORT was unset. Update the documentation accordingly. And fix up the single board which was originally enabling this option. Signed-off-by: Alvin Šipraga <alvin@pqrs.dk> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This commit is contained in:
parent
813a0df27a
commit
caa2ad6f8c
@ -42,7 +42,6 @@ CONFIG_ENV_OVERWRITE=y
|
||||
CONFIG_ENV_IS_IN_NAND=y
|
||||
CONFIG_ENV_RELOC_GD_ENV_ADDR=y
|
||||
CONFIG_NET_RETRY_COUNT=20
|
||||
CONFIG_TFTP_PORT=y
|
||||
CONFIG_TFTP_TSIZE=y
|
||||
CONFIG_AT91_GPIO=y
|
||||
CONFIG_GENERIC_ATMEL_MCI=y
|
||||
|
||||
@ -19,9 +19,8 @@ Description
|
||||
The tftpput command is used to transfer a file to a TFTP server.
|
||||
|
||||
By default the destination port is 69 and the source port is pseudo-random.
|
||||
If CONFIG_TFTP_PORT=y, the environment variable *tftpsrcp* can be used to set
|
||||
the source port and the environment variable *tftpdstp* can be used to set
|
||||
the destination port.
|
||||
The environment variable *tftpsrcp* can be used to set the source port and the
|
||||
environment variable *tftpdstp* can be used to set the destination port.
|
||||
|
||||
address
|
||||
memory address where the data starts
|
||||
@ -75,9 +74,6 @@ The command is only available if CONFIG_CMD_TFTPPUT=y.
|
||||
CONFIG_TFTP_BLOCKSIZE defines the size of the TFTP blocks sent. It defaults
|
||||
to 1468 matching an ethernet MTU of 1500.
|
||||
|
||||
If CONFIG_TFTP_PORT=y, the environment variables *tftpsrcp* and *tftpdstp* can
|
||||
be used to set the source and the destination ports.
|
||||
|
||||
CONFIG_TFTP_WINDOWSIZE can be used to set the TFTP window size of transmits
|
||||
after which an ACK response is required. The window size defaults to 1.
|
||||
|
||||
|
||||
18
net/Kconfig
18
net/Kconfig
@ -60,24 +60,6 @@ config SYS_FAULT_ECHO_LINK_DOWN
|
||||
this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to
|
||||
be configured.
|
||||
|
||||
config TFTP_PORT
|
||||
bool "Set TFTP UDP source/destination ports via the environment"
|
||||
help
|
||||
If this is defined, the environment variable tftpsrcp is used to
|
||||
supply the TFTP UDP source port value. If tftpsrcp isn't defined,
|
||||
the normal pseudo-random port number generator is used.
|
||||
|
||||
Also, the environment variable tftpdstp is used to supply the TFTP
|
||||
UDP destination port value. If tftpdstp isn't defined, the normal
|
||||
port 69 is used.
|
||||
|
||||
The purpose for tftpsrcp 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.
|
||||
|
||||
config TFTP_WINDOWSIZE
|
||||
int "TFTP window size"
|
||||
default 1
|
||||
|
||||
@ -926,14 +926,13 @@ void tftp_start(enum proto_t protocol)
|
||||
/* Use a pseudo-random port unless a specific port is set */
|
||||
tftp_our_port = 1024 + (get_timer(0) % 3072);
|
||||
|
||||
#ifdef CONFIG_TFTP_PORT
|
||||
ep = env_get("tftpdstp");
|
||||
if (ep != NULL)
|
||||
tftp_remote_port = simple_strtol(ep, NULL, 10);
|
||||
ep = env_get("tftpsrcp");
|
||||
if (ep != NULL)
|
||||
tftp_our_port = simple_strtol(ep, NULL, 10);
|
||||
#endif
|
||||
|
||||
tftp_cur_block = 0;
|
||||
tftp_windowsize = 1;
|
||||
tftp_last_nack = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user