u-boot/net
Mikhail Kshevetskiy 1dd034ec00 net/tftp: make tftpput working with servers that do not use OACK
Option Acknowledgment (OACK) is an extension of TFTP protocol (see rfc2347).
Not all tftp servers implements it. For example it does not supported by
tftpd server from debian-11 (https://packages.debian.org/bullseye/tftpd).

Starting the "tftpput $loadaddr $size out_file" command with such server
will results in the following packets flow:

192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 0
...

so, no data transfer happening.

Here is a packets flow for tftp-server with OACK support
(tftpd-hpa: https://packages.debian.org/stable/tftpd-hpa)

192.168.27.3   192.168.27.1   TFTP   Write Request, ...
192.168.27.1   192.168.27.3   TFTP   Option Acknowledgement, ...
192.168.27.3   192.168.27.1   TFTP   Data Packet, Block: 1
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 1
192.168.27.3   192.168.27.1   TFTP   Data Packet, Block: 2
192.168.27.1   192.168.27.3   TFTP   Acknowledgement, Block: 2

and this time data transfer starts normally.

As we can see there is no OACK packet in the first case. Investigating
an issue we'll find out:

1) tftp_start() sets

      tftp_state = STATE_SEND_WRQ;

2) on OACK tftp_handler() sets

      tftp_state = STATE_DATA;

   and send a first DATA packet.

3) on ACK tftp_handler() will call a tftp_send() function.
   tftp_send() will

   * tftpd with OACK support:

       Current state is STATE_DATA, so transmittion of data packet will
       happen.

   * tftpd without OACK support

      Current state is STATE_SEND_WRQ, so retransmission of WRQ packet
      will happen. Thus tftpd-server will retransmit an ACK.

      This will repeats until timeout happens.

      According to RFC1350 this is wrong. We should start data transfer
      instead of WRQ retransmission.

This patch fix an issue, so tftpput works fine with both types of servers.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
2024-08-01 08:10:00 -06:00
..
arp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
arp.h global: Drop common.h inclusion 2023-12-21 08:54:37 -05:00
bootp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
bootp.h net: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
cdp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
cdp.h SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
dhcpv6.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
dhcpv6.h net: dhcp6: Fix VCI string 2023-06-14 15:48:45 -04:00
dns.c net: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
dns.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dsa-uclass.c net: dsa: Fix OF fallback lookup for ports 2023-06-14 18:38:25 +08:00
eth_bootdev.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
eth_common.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
eth_internal.h net: remove duplicate eth_env_set_enetaddr_by_index() declaration 2024-07-31 17:55:08 -06:00
eth-uclass.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
fastboot_tcp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
fastboot_udp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
Kconfig Fix Kconfig coding style from spaces to tab 2024-07-05 13:57:02 -06:00
link_local.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
link_local.h global: Drop common.h inclusion 2023-12-21 08:54:37 -05:00
Makefile net: Fix compiling SPL when fastboot is enabled 2023-10-17 20:50:52 -04:00
mdio-mux-uclass.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mdio-uclass.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
ndisc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
net6.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
net_rand.h rng: Introduce SPL_DM_RNG 2024-05-05 11:21:39 -03:00
net.c net: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
nfs.c net: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
nfs.h net: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
pcap.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
ping6.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
ping.c net: Do not respond to ICMP_ECHO_REQUEST if we do not have an IP address 2021-01-19 09:15:02 -05:00
ping.h global: Drop common.h inclusion 2023-12-21 08:54:37 -05:00
rarp.c net: Remove duplicate newlines 2024-07-15 12:12:18 -06:00
rarp.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sntp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
tcp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
tftp.c net/tftp: make tftpput working with servers that do not use OACK 2024-08-01 08:10:00 -06:00
udp.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
wget.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
wol.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
wol.h net: Add new wol command - Wake on LAN 2018-07-02 14:14:20 -05:00