Page MenuHomeFreeBSD

loader: tftp: Don't let tftp timeout
ClosedPublic

Authored by manu on Dec 13 2021, 10:47 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 21, 9:02 PM
Unknown Object (File)
May 8 2024, 3:58 PM
Unknown Object (File)
May 8 2024, 3:58 PM
Unknown Object (File)
May 8 2024, 3:57 PM
Unknown Object (File)
May 8 2024, 3:57 PM
Unknown Object (File)
May 8 2024, 1:07 PM
Unknown Object (File)
Mar 7 2024, 7:02 PM
Unknown Object (File)
Jan 22 2024, 8:40 PM
Subscribers

Details

Summary

When we load a kernel or module we open/close it a few times.
Since we're using the same port number each time and that we requested
the same file the ACK that we send are valid on the server side and the
server send us the file multiple times.
This makes tftp loading time very inconsistant due to the UDP "flood" that
we have to process.

MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG

Test Plan
Test done on one of my machine, rebooting between each tests :
x time-base
+ time-tftp-timeout
+-----------------------------------------------------------------------------------------------------------------------------+
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                                                                                                                            |
|+                             x xx    x   x x        x                              x  x                                    x|
|A                        |_________________M_____________A______________________________|                                    |
+-----------------------------------------------------------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x  10           104           193           116         128.9     29.856881
+  10            75            75            75            75             0
Difference at 95.0% confidence
	-53.9 +/- 19.8367
	-41.8154% +/- 8.95418%
	(Student's t, pooled s = 21.112)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

manu requested review of this revision.Dec 13 2021, 10:47 AM
This revision is now accepted and ready to land.Dec 13 2021, 5:21 PM
stand/libsa/tftp.c
600–601

There is a small nit, however....

When we did read whole file:

192.168.150.227 -> beastie TFTP Read "/boot/loader.conf" (octet)

beastie -> 192.168.150.227 TFTP OACK: blksize: 1428 tsize: 15

192.168.150.227 -> beastie TFTP Ack block 0

beastie -> 192.168.150.227 TFTP Data block 1 (15 bytes) (last block)

192.168.150.227 -> beastie TFTP Ack block 1
192.168.150.227 -> beastie TFTP Error: not defined

beastie -> 192.168.150.227 ICMP Destination unreachable (UDP port 37446 unreachable)

That is, tftpd did close the session after ACK, we did send Error 0 and we will get ICMP packet. So the clean way would be to send Error 0 only when we havent acked last packet yet...

Only send the last ack if we didn't do it prior.
This was the case for small file that fits in one block.

This revision now requires review to proceed.Dec 14 2021, 8:33 AM
manu marked an inline comment as done.Dec 14 2021, 8:33 AM
This revision was not accepted when it landed; it landed in state Needs Review.Dec 16 2021, 10:55 AM
This revision was automatically updated to reflect the committed changes.