URL: <https://savannah.gnu.org/bugs/?62318>
Summary: Tftp module should not expect OACK packet Project: GNU GRUB Submitted by: pierrearm Submitted on: Fri 15 Apr 2022 10:15:05 AM UTC Category: Network Severity: Major Priority: 5 - Normal Item Group: None Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Release: Release: Git master Discussion Lock: Any Reproducibility: None Planned Release: None _______________________________________________________ Details: Hello, I think there is a bug in the tftp module. Here is my setup: Tftp server: xinetd daemon used It contains a file named 'file' containing the string 'salut'. grub.efi built with the following commands (built from latest master: 37ddd9457f13f92fd176bbb2951cfc1fbc93e6f7 kern/efi/init: Log a console error during a stack check failure): ./bootstrap ./configure --target=aarch64-linux-gnu --with-platform=efi --prefix={path_to_grub_dir}out make make install grub-mkstandalone -d out/lib/grub/arm64-efi/ -O arm64-efi -o grub.efi Commands issued after launching grub (the ip of the tftp server is 192.168.1.11): insmod tftp insmod efinet net_dhcp linux (tftp,192.168.1.11)file > error: time out opening `file'. I was trying to fetch the file 'file' from the tftp server, which resulted in an error. In grub-core/net/tftp.c, the tftp module expects to receive an OACK packet and retries GRUB_NET_TRIES (=40) times if no OACK packet is received. However, from RFC 2347 (https://datatracker.ietf.org/doc/html/rfc2347): """ When the client appends options to the end of a Read Request packet, three possible responses may be returned by the server: OACK - acknowledge of Read Request and the options; DATA - acknowledge of Read Request, but not the options; ERROR - the request has been denied. """ it is possible for the server to answer to a Read Request packet with a DATA packet. The xinetd daemon answers with a DATA packet (so no OACK). This results in the grub tftp module repeatedly trying to initiate a transfer and finally aborting. When using the tftpd-hpa dameon, an OACK packet is sent, which results in a working tftp transfer. I join to wireshark traces. The tftp server is at 192.168.1.11 and the client at 192.168.1.16: - one when using the xinetd daemon. You can see that the client sends a Read Request packet, the server directly starts sending the content of file, but the client re-sends a Read Request packet (40 times) - one when using the tftpd-hpa daemon. An OACK packet is sent from the server, and everything works as expected. Regards, Pierre _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Fri 15 Apr 2022 10:15:05 AM UTC Name: tftp_hpa.pcapng Size: 3KiB By: pierrearm <http://savannah.gnu.org/bugs/download.php?file_id=53090> ------------------------------------------------------- Date: Fri 15 Apr 2022 10:15:05 AM UTC Name: xinetd.pcapng Size: 68KiB By: pierrearm <http://savannah.gnu.org/bugs/download.php?file_id=53091> _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62318> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/