[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inetutils-1.3.2 tftp file limit 16MB

From: Denis Laplante
Subject: Re: inetutils-1.3.2 tftp file limit 16MB
Date: Tue, 18 Dec 2001 09:16:31 -0800

Bonjour Alain,
At 09:53 -0500 12/18/01, Alain Magloire wrote:
>Unless I missed the obvious, changing this will make it impossible to work 
>with other
>since you are changing the struct size, tftp.h is an expose file and provided 
>convenience if the platform does not have it in /usr/include/arpa/tftp.h

  I disagree: changing from short to u_short still occupies 2 bytes, and only 
affects the interpretation of the sign, for example whether 0x8000 is smaller 
or larger than 0x7fff.  Of course for best advantage both server and client 
should probably change (I've only documented the client doing an integer 
overflow in processing the block number during ack, but I imagine server will 
have the same difficulty), but the client should see no difference in the size 
or contents of the tftphdr data structure.  I see that the Solaris include file 
/usr/include/arpa/tftp.h was not used for the GNU compilation, according to 
file access time (don't know why).

  I should mention that the same 16 MB+ file was transmitted successfully via 
TFTP from a Windows NT server to our Cisco router, so I believe such a 
(ridiculously) large file can be transmitted via this protocol.  Unfortunately 
I have not had the time to try and recompile GNU tftp/tftpd to test my proposed 


-- Denis Laplante <address@hidden> -- Network Analyst   --
-- ITServices Network Engineering         -- TEL: 604/822-9914 --

>> GNU tftp and/or tftpd has a 16 Mega Byte limit on file transfers, as 
>> demonstrated by a transfer with the following options
>> > tftp HOSTNAME
>> > bin
>> > verbose
>> > trace
>> > get BIGFILE
>> [...]
>> received DATA <block=32767, 512 bytes>
>> sent ACK <block=32767>
>> received DATA <block=-32768, 512 bytes>
>> sent ACK <block=32767>
>> received DATA <block=-32768, 512 bytes>
>> received DATA <block=-32768, 512 bytes>
>> sent ACK <block=32767>
>> sent ACK <block=32767>
>> sent ACK <block=32767>
>> Transfer timed out.
>> tftp> 
>> I believe that changing the data type for tu_block to unsigned short would 
>> raise the limit to 32M
>> [inetutils-1.3.2/include/arpa/tftp.h]
>> struct       tftphdr {
>>      short   th_opcode;              /* packet type */
>>      union {
>>              short   tu_block;       /* block # */
>>              short   tu_code;        /* error code */
>>              char    tu_stuff[1];    /* request packet stuff */
>>      } th_u;
>>      char    th_data[1];             /* data or error string */
>> };
>> #define      th_block        th_u.tu_block
>> #define      th_code         th_u.tu_code
>> #define      th_stuff        th_u.tu_stuff
>> #define      th_msg          th_data
>> , and changing variable 'block' in tftpd.c/tftp.c functions 
>> sendfile/recvfile to unsigned short would result in unlimited file size, 
>> because both sides of comparison would overflow into -32768 at the same time.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]