[BusyBox] [PATCH] tftp can not get or put more than 0xffff blocks

Hideki IWAMOTO h-iwamoto at kit.hi-ho.ne.jp
Mon Feb 16 15:57:58 UTC 2004


>dd if=/dev/zero of=/tftpboot/aaa bs=1M count=32
32+0 records in
32+0 records out
>touch /tftpboot/bbb
>chmod 777 /tftpboot/bbb

[current CVS version]

>_install/usr/bin/tftp -g -r aaa -l /tftpboot/bbb localhost
tftp: timeout
tftp: timeout
tftp: timeout
tftp: timeout
tftp: timeout
tftp: last timeout
>_install/usr/bin/tftp -p -l /tftpboot/aaa -r bbb localhost
tftp: timeout
tftp: timeout
tftp: timeout
tftp: timeout
tftp: timeout
tftp: last timeout

[patched version]

>_install/usr/bin/tftp -g -r aaa -l /tftpboot/bbb localhost
>_install/usr/bin/tftp -p -l /tftpboot/aaa -r bbb localhost



Index: networking/tftp.c
===================================================================
RCS file: /var/cvs/busybox/networking/tftp.c,v
retrieving revision 1.21
diff -u -r1.21 tftp.c
--- networking/tftp.c	17 Jan 2004 05:03:31 -0000	1.21
+++ networking/tftp.c	16 Feb 2004 15:20:50 -0000
@@ -156,7 +156,7 @@
 	int opcode = 0;
 	int finished = 0;
 	int timeout = bb_tftp_num_retries;
-	int block_nr = 1;
+	unsigned short block_nr = 1;
 
 #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
 	int want_option_ack = 0;
@@ -462,7 +462,7 @@
 
 		if (cmd_put && (opcode == TFTP_ACK)) {
 
-			if (tmp == (block_nr - 1)) {
+			if (tmp == (unsigned short)(block_nr - 1)) {
 				if (finished) {
 					break;
 				}


----
Hideki IWAMOTO  h-iwamoto at kit.hi-ho.ne.jp




More information about the busybox mailing list