tech-net archive

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

Re: tftp protocol



On Wed, Oct 14, 2009 at 04:01:13PM +0100, Patrick Welche wrote:
> Looks like tsize negotiation - it looks as though the client sends tsize 0
> with the RRQ, then our opcode 6(?) offers a large tsize which client
> responds to with an error, then the client sends a RRQ with tsize 0, blksize
> 1420, and the server replies with opcode 6 blksize 1420 and the same large
> tsize as before. Block number is bound to roll over in this particular
> large file case...

and of course this is all described in the fine manual:

BUGS
     Files larger than 33488896 octets (65535 blocks) cannot be transferred
     without client and server supporting blocksize negotiation (RFCs 2347 and
     2348).

and opcode 6 is OACK as defined in RFC 2347.

The attached patch to tcpdump would have made this more obvious to me.

Cheers,

Patrick
Index: print-tftp.c
===================================================================
RCS file: /cvsroot/src/dist/tcpdump/print-tftp.c,v
retrieving revision 1.4
diff -u -r1.4 print-tftp.c
--- print-tftp.c        24 Jul 2007 11:53:48 -0000      1.4
+++ print-tftp.c        15 Oct 2009 10:18:56 -0000
@@ -58,6 +58,7 @@
        { DATA,         "DATA" },       /* data packet */
        { ACK,          "ACK" },        /* acknowledgement */
        { ERROR,        "ERROR" },      /* error code */
+       { OACK,         "OACK" },       /* option acknowledgment */
        { 0,            NULL }
 };
 
@@ -71,7 +72,9 @@
        { EBADID,       "EBADID" },     /* unknown transfer ID */
        { EEXISTS,      "EEXISTS" },    /* file already exists */
        { ENOUSER,      "ENOUSER" },    /* no such user */
+       { EOPTNEG,      "EOPTNEG" },    /* option negotiation failed */
        { 0,            NULL }
+
 };
 
 /*
@@ -104,6 +107,7 @@
 
        case RRQ:
        case WRQ:
+       case OACK:
                /*
                 * XXX Not all arpa/tftp.h's specify th_stuff as any
                 * array; use address of th_block instead
@@ -113,9 +117,10 @@
 #else
                p = (u_char *)&tp->th_block;
 #endif
-               fputs(" \"", stdout);
+               putchar(' ');
+               if (opcode != OACK) putchar('"');
                i = fn_print(p, snapend);
-               putchar('"');
+               if (opcode != OACK) putchar('"');
 
                /* Print the mode and any options */
                while ((p = (const u_char *)strchr((const char *)p, '\0')) != 
NULL) {


Home | Main Index | Thread Index | Old Index