diff mbox series

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

Message ID 20240627111551.99128-1-mikhail.kshevetskiy@iopsys.eu
State Changes Requested
Delegated to: Peter Robinson
Headers show
Series net/tftp: make tftpput working with servers that do not use OACK | expand

Commit Message

Mikhail Kshevetskiy June 27, 2024, 11:15 a.m. UTC
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
 net/tftp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Peter Robinson July 1, 2024, 3:56 p.m. UTC | #1
Please don't put the only detail in the subject, please outline the
fix here too, that should allow a more concise subject.

> 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 2e335413492..2534dec1c9f 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -494,8 +494,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
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/net/tftp.c b/net/tftp.c
index 2e335413492..2534dec1c9f 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -494,8 +494,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