The tftpd tests all follow the same pattern:
- open a udp socket
- fork a child to exec tftpd, which subsequently handles requests on the socket
- use a client socket to send some message to the tftpd daemon
However, tftpd's first action is to mark its socket as non-blocking and
then read a request from it. If no data is present in the socket, tftpd
exits immediately with an error. So, there is a race; we often see
tftpd test timeouts when running tests in parallel. These timeouts also
arise periodically in CI.
One solution is to restructure the tests to create the server socket,
then write the request to the client socket, then fork tftpd. This
closes the race. However, this involves a lot of churn.
This patch fixes the problem a different way, by adding a new -b flag to
tftpd which makes it block for the initial request. I think this may be
acceptable as an alternative, and does not require extensive
restructuring of each tftpd test.