mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 23:41:50 +00:00
net: lwip: tftp: bind to TFTP port only when in server mode
The TFTP app should not bind to the TFTP server port when configured as a client. Instead, the local port should be chosen from the dynamic range (49152 ~ 65535) so that if the application is stopped and started again, the remote server will not consider the new packets as part of the same context (which would cause an error since a new RRQ would be unexpected). Submitted upstream: https://savannah.nongnu.org/patch/?10480 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
98ad145db6
commit
5634ecc88e
1 changed files with 6 additions and 4 deletions
|
@ -454,10 +454,12 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT);
|
if (mode == LWIP_TFTP_MODE_SERVER) {
|
||||||
if (ret != ERR_OK) {
|
ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT);
|
||||||
udp_remove(pcb);
|
if (ret != ERR_OK) {
|
||||||
return ret;
|
udp_remove(pcb);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tftp_state.handle = NULL;
|
tftp_state.handle = NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue