diff mbox series

[7/7] net/tftp: make tftpput working with servers that do not use OACK

Message ID 20221006031813.110472-1-mikhail.kshevetskiy@iopsys.eu
State Needs Review / ACK, archived
Delegated to: Dario Binacchi
Headers show
Series [1/7] mtd: replace name of 'rfree' field with 'free' in struct mtd_ooblayout_ops to better match it's description | expand

Commit Message

Mikhail Kshevetskiy Oct. 6, 2022, 3:18 a.m. UTC
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
 net/tftp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Tom Rini Oct. 6, 2022, 6:54 p.m. UTC | #1
On Thu, Oct 06, 2022 at 06:18:13AM +0300, mikhail.kshevetskiy@iopsys.eu wrote:

> From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
> 
> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
> ---
>  net/tftp.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/net/tftp.c b/net/tftp.c
> index dea9c25ffd..e120e4d766 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -483,8 +483,15 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
>  				tftp_prev_block = tftp_cur_block;
>  				tftp_cur_block = (unsigned short)(block + 1);
>  				update_block_number();
> -				if (ack_ok)
> +				if (ack_ok) {
> +					if (block == 0 &&
> +					    tftp_state == STATE_SEND_WRQ){
> +						/* connection's first ACK */
> +						tftp_state = STATE_DATA;
> +						tftp_remote_port = src;
> +					}
>  					tftp_send(); /* Send next data block */
> +				}
>  			}
>  		}
>  #endif

Can you please elaborate on how / when this would occur? Thanks.
diff mbox series

Patch

diff --git a/net/tftp.c b/net/tftp.c
index dea9c25ffd..e120e4d766 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -483,8 +483,15 @@  static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
 				tftp_prev_block = tftp_cur_block;
 				tftp_cur_block = (unsigned short)(block + 1);
 				update_block_number();
-				if (ack_ok)
+				if (ack_ok) {
+					if (block == 0 &&
+					    tftp_state == STATE_SEND_WRQ){
+						/* connection's first ACK */
+						tftp_state = STATE_DATA;
+						tftp_remote_port = src;
+					}
 					tftp_send(); /* Send next data block */
+				}
 			}
 		}
 #endif