[PATCH v4 08/21] tftp: remove sanity check of first block

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Tue Aug 30 00:38:03 PDT 2022


With tftp window size support in the next patches, the first received
block might be !=1 (e.g. when it was reordered or dropped).  There could
be checked whether it is in the first window, but the corresponding
sanity check can be dropped completely:

- OACK logic verifies that we speak with a tftp server (which always
  sends block #1 as the first one).  Diagnostic will help only with non
  rfc 2743 servers (which are probably very rare resp. non existing
  nowadays)

- the code some lines later handles this case already

Remove the check and simplify things.

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
 fs/tftp.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/fs/tftp.c b/fs/tftp.c
index 264841f24407..51cb1109d2ff 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -321,14 +321,6 @@ static void tftp_recv(struct file_priv *priv,
 			priv->state = STATE_RDATA;
 			priv->tftp_con->udp->uh_dport = uh_sport;
 			priv->last_block = 0;
-
-			if (priv->block != 1) {	/* Assertion */
-				pr_err("error: First block is not block 1 (%d)\n",
-					priv->block);
-				priv->err = -EINVAL;
-				priv->state = STATE_DONE;
-				break;
-			}
 		}
 
 		if (priv->block == priv->last_block)
-- 
2.37.2




More information about the barebox mailing list