[PATCH] tester: Avoid TFTP race condition
Kinsey Moore
kinsey.moore at oarcorp.com
Tue May 18 18:28:53 UTC 2021
The socket timeout is already configured just above the while loop for sending the bulk
of the data and applies to all blocking operations. It defaults to 1s locally if not set.
Kinsey
-----Original Message-----
From: Gedare Bloom <gedare at rtems.org>
Sent: Tuesday, May 18, 2021 10:54
To: Kinsey Moore <kinsey.moore at oarcorp.com>
Cc: devel at rtems.org
Subject: Re: [PATCH] tester: Avoid TFTP race condition
seems ok, but is there a way to set a timeout in case the client
doesn't send a final ACK? Typical kind of network problem.
On Mon, May 17, 2021 at 12:29 PM Kinsey Moore <kinsey.moore at oarcorp.com> wrote:
>
> The u-boot TFTP client will fail a fully completed file retrieval if the
> final ACK gets an ICMP response that the port is unavailable which can
> occur if the port is closed before the ACK arrives from the client. This
> change causes the TFTP server to wait for the final ACK before closing
> the socket and prevents transfers from failing due to the race
> condition.
> ---
> tester/rt/tftpserver.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tester/rt/tftpserver.py b/tester/rt/tftpserver.py
> index d733301..46b594f 100644
> --- a/tester/rt/tftpserver.py
> +++ b/tester/rt/tftpserver.py
> @@ -418,8 +418,6 @@ class udp_handler(socketserver.BaseRequestHandler):
> ' < ' +
> session.decode(client_ip, client_port, response))
> sock.sendto(response, (client_ip, client_port))
> - if session.finished:
> - break
> try:
> data, address = sock.recvfrom(2 + 2 +
> session.get_block_size())
> @@ -438,6 +436,8 @@ class udp_handler(socketserver.BaseRequestHandler):
> log.trace('] tftp: %d: receive: %s: error: %s' \
> % (index, client, serr))
> return
> + if session.finished:
> + break
> response = session.process(address[0], address[1], data)
> except error.general as gerr:
> self._notice('] tftp: %dd: error: %s' % (index, gerr))
> --
> 2.20.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list