tcpdump mailing list archives

patch to support floating port number for tftp


From: Motonori Shindo <mshindo () mshindo net>
Date: Fri, 09 May 2003 14:23:35 +0900 (JST)


Attached is a patch to better handle floating port number for
tftp. tftp uses 69/udp as the destination port for the first packet
(RRQ, WRQ), but arbitrary port number will be used for the subsequent
packets. This patch adds keyword "tftp" as a -T option to enforce the
interpretation as such.

Regards,



Index: interface.h
===================================================================
RCS file: /tcpdump/master/tcpdump/interface.h,v
retrieving revision 1.210
diff -c -r1.210 interface.h
*** interface.h 8 May 2003 15:05:42 -0000       1.210
--- interface.h 9 May 2003 05:23:08 -0000
***************
*** 94,99 ****
--- 94,100 ----
  #define PT_RTCP               5       /* Real-Time Applications control protocol */
  #define PT_SNMP               6       /* Simple Network Management Protocol */
  #define PT_CNFP               7       /* Cisco NetFlow protocol */
+ #define PT_TFTP               8       /* trivial file transfer protocol */
  
  #ifndef min
  #define min(a,b) ((a)>(b)?(b):(a))
Index: print-udp.c
===================================================================
RCS file: /tcpdump/master/tcpdump/print-udp.c,v
retrieving revision 1.116
diff -c -r1.116 print-udp.c
*** print-udp.c 8 May 2003 15:05:42 -0000       1.116
--- print-udp.c 9 May 2003 05:23:08 -0000
***************
*** 530,535 ****
--- 530,540 ----
                        udpipaddr_print(ip, sport, dport);
                        cnfp_print(cp, (const u_char *)ip);
                        break;
+ 
+               case PT_TFTP:
+                       udpipaddr_print(ip, sport, dport);
+                       tftp_print(cp, length);
+                       break;
                }
                return;
        }
Index: tcpdump.1
===================================================================
RCS file: /tcpdump/master/tcpdump/tcpdump.1,v
retrieving revision 1.142
diff -c -r1.142 tcpdump.1
*** tcpdump.1   31 Mar 2003 05:13:35 -0000      1.142
--- tcpdump.1   9 May 2003 05:23:09 -0000
***************
*** 421,426 ****
--- 421,427 ----
  \fBrtp\fR (Real-Time Applications protocol),
  \fBrtcp\fR (Real-Time Applications control protocol),
  \fBsnmp\fR (Simple Network Management Protocol),
+ \fBtftp\fR (Trivial File Transfer Protocol),
  \fBvat\fR (Visual Audio Tool),
  and
  \fBwb\fR (distributed White Board).
Index: tcpdump.c
===================================================================
RCS file: /tcpdump/master/tcpdump/tcpdump.c,v
retrieving revision 1.205
diff -c -r1.205 tcpdump.c
*** tcpdump.c   2 May 2003 08:46:28 -0000       1.205
--- tcpdump.c   9 May 2003 05:23:10 -0000
***************
*** 542,547 ****
--- 542,549 ----
                                packettype = PT_SNMP;
                        else if (strcasecmp(optarg, "cnfp") == 0)
                                packettype = PT_CNFP;
+                       else if (strcasecmp(optarg, "tftp") == 0)
+                               packettype = PT_TFTP;
                        else
                                error("unknown packet type `%s'", optarg);
                        break;

Current thread: