Import tcpdump-3.9.8:
authorPeter Avalos <pavalos@dragonflybsd.org>
Thu, 11 Oct 2007 02:37:58 +0000 (02:37 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Thu, 11 Oct 2007 02:37:58 +0000 (02:37 +0000)
September 10, 2007.  ken@xelerance.com.  Summary for 0.9.8 tcpdump release
Rework ARP printer
Rework OSPFv3 printer
Add support for Frame-Relay ARP
Decode DHCP Option 121 (RFC 3442 Classless Static Route)
Decode DHCP Option 249 (MS Classless Static Route) the same as Option 121
TLV: Add support for Juniper .pcap extensions
Print EGP header in new-world-order style
Converted print-isakmp.c to NETDISSECT
Moved AF specific stuff into af.h
Test subsystem now table driven, and saves outputs and diffs to one place
Require <net/pfvar.h> for pf definitions - allows reading of pflog formatted
libpcap files on an OS other than where the file was generated

16 files changed:
contrib/tcpdump-3.9/CHANGES
contrib/tcpdump-3.9/README
contrib/tcpdump-3.9/VERSION
contrib/tcpdump-3.9/addrtoname.c
contrib/tcpdump-3.9/bootp.h
contrib/tcpdump-3.9/ip.h
contrib/tcpdump-3.9/print-bootp.c
contrib/tcpdump-3.9/print-icmp.c
contrib/tcpdump-3.9/print-ip.c
contrib/tcpdump-3.9/print-ip6.c
contrib/tcpdump-3.9/print-pflog.c
contrib/tcpdump-3.9/print-rsvp.c
contrib/tcpdump-3.9/print-sctp.c
contrib/tcpdump-3.9/print-tftp.c
contrib/tcpdump-3.9/tcpdump.c
contrib/tcpdump-3.9/tftp.h [new file with mode: 0644]

index 3eb70dc..aa29e30 100644 (file)
@@ -1,6 +1,20 @@
-$Header: /tcpdump/master/tcpdump/CHANGES,v 1.87.2.14 2007/07/24 02:17:13 mcr Exp $
+$Header: /tcpdump/master/tcpdump/CHANGES,v 1.87.2.17 2007/09/13 13:39:44 ken Exp $
 
-Wed.   July 23, 2007.  mcr@xelerance.com.  Summary for 0.9.7 libpcap release
+Mon.   September 10, 2007.  ken@xelerance.com.  Summary for 0.9.8 tcpdump release
+       Rework ARP printer
+       Rework OSPFv3 printer
+       Add support for Frame-Relay ARP
+       Decode DHCP Option 121 (RFC 3442 Classless Static Route)
+       Decode DHCP Option 249 (MS Classless Static Route) the same as Option 121
+       TLV: Add support for Juniper .pcap extensions
+       Print EGP header in new-world-order style
+       Converted print-isakmp.c to NETDISSECT
+       Moved AF specific stuff into af.h
+       Test subsystem now table driven, and saves outputs and diffs to one place
+        Require <net/pfvar.h> for pf definitions - allows reading of pflog formatted 
+         libpcap files on an OS other than where the file was generated
+
+Wed.   July 23, 2007.  mcr@xelerance.com.  Summary for 0.9.7 tcpdump release
 
        NFS: Print unsigned values as such. 
        RX: parse safely.
index 17df49d..cb51d30 100644 (file)
@@ -1,4 +1,4 @@
-@(#) $Header: /tcpdump/master/tcpdump/README,v 1.65 2004/10/12 02:01:59 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/README,v 1.65.2.1 2007/09/14 01:03:12 guy Exp $ (LBL)
 
 TCPDUMP 3.9
 Now maintained by "The Tcpdump Group"
@@ -11,10 +11,11 @@ Anonymous CVS is available via:
        (password "anoncvs")
        cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout tcpdump
 
-Version 3.9 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_9rel1":
+Version 3.9 of TCPDUMP can be retrieved with the CVS tag "tcpdump_3_9rel1":
        cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_9rel1 tcpdump
 
-Please send patches against the master copy to patches@tcpdump.org.
+Please submit patches against the master copy to the tcpdump project on
+sourceforge.net.
 
 formerly from  Lawrence Berkeley National Laboratory
                Network Research Group <tcpdump@ee.lbl.gov>
index bef9ad2..53d615f 100644 (file)
@@ -23,7 +23,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.8 2006/02/27 07:27:16 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.9 2007/09/14 00:26:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -69,7 +69,7 @@ extern int ether_ntohost(char *, const struct ether_addr *);
 #include "oui.h"
 
 #ifndef ETHER_ADDR_LEN
-#include "ether.h"
+#define ETHER_ADDR_LEN 6
 #endif
 
 /*
@@ -515,7 +515,7 @@ linkaddr_string(const u_char *ep, const unsigned int len)
        register char *cp;
        register struct enamemem *tp;
 
-       if (len == 6)   /* XXX not totally correct... */
+       if (len == ETHER_ADDR_LEN)      /* XXX not totally correct... */
                return etheraddr_string(ep);
 
        tp = lookup_bytestring(ep, len);
index 1519f2d..7c63d0c 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.15.4.1 2007/01/29 20:56:00 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.15.4.3 2007/08/21 22:02:08 guy Exp $ (LBL) */
 /*
  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1048.
  *
@@ -161,6 +161,9 @@ struct bootp {
 #define        TAG_NS_SEARCH           ((u_int8_t) 117)
 /* RFC 3011 */
 #define        TAG_IP4_SUBNET_SELECT   ((u_int8_t) 118)
+/* RFC 3442 */
+#define TAG_CLASSLESS_STATIC_RT        ((u_int8_t) 121)
+#define TAG_CLASSLESS_STA_RT_MS        ((u_int8_t) 249)
 /* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */
 #define        TAG_USER_CLASS          ((u_int8_t)  77)
 #define        TAG_SLP_NAMING_AUTH     ((u_int8_t)  80)
index 6dbd9de..e232ae0 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.11 2004/09/27 21:13:10 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.11.2.1 2007/09/14 01:30:02 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1982, 1986, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -102,6 +102,7 @@ struct ip {
 
 #define        IPOPT_RR                7               /* record packet route */
 #define        IPOPT_TS                68              /* timestamp */
+#define        IPOPT_RFC1393           82              /* traceroute RFC 1393 */
 #define        IPOPT_SECURITY          130             /* provide s,c,h,tcc */
 #define        IPOPT_LSRR              131             /* loose source route */
 #define        IPOPT_SATID             136             /* satnet id */
index b3acdf5..e2086e4 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78.2.7 2007/01/29 20:56:00 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78.2.9 2007/08/21 22:02:08 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -278,6 +278,9 @@ static struct tok tag2str[] = {
        { TAG_NS_SEARCH,        "sNSSEARCH" },  /* XXX 's' */
 /* RFC 3011 */
        { TAG_IP4_SUBNET_SELECT, "iSUBNET" },
+/* RFC 3442 */
+       { TAG_CLASSLESS_STATIC_RT, "$Classless-Static-Route" },
+       { TAG_CLASSLESS_STA_RT_MS, "$Classless-Static-Route-Microsoft" },
 /* http://www.iana.org/assignments/bootp-dhcp-extensions/index.htm */
        { TAG_USER_CLASS,       "aCLASS" },
        { TAG_SLP_NAMING_AUTH,  "aSLP-NA" },
@@ -360,7 +363,7 @@ static void
 rfc1048_print(register const u_char *bp)
 {
        register u_int16_t tag;
-       register u_int len, size;
+       register u_int len;
        register const char *cp;
        register char c;
        int first, idx;
@@ -456,12 +459,11 @@ rfc1048_print(register const u_char *bp)
                }
 
                /* Print data */
-               size = len;
                if (c == '?') {
                        /* Base default formats for unknown tags on data size */
-                       if (size & 1)
+                       if (len & 1)
                                c = 'b';
-                       else if (size & 2)
+                       else if (len & 2)
                                c = 's';
                        else
                                c = 'l';
@@ -472,20 +474,20 @@ rfc1048_print(register const u_char *bp)
                case 'a':
                        /* ascii strings */
                        putchar('"');
-                       if (fn_printn(bp, size, snapend)) {
+                       if (fn_printn(bp, len, snapend)) {
                                putchar('"');
                                goto trunc;
                        }
                        putchar('"');
-                       bp += size;
-                       size = 0;
+                       bp += len;
+                       len = 0;
                        break;
 
                case 'i':
                case 'l':
                case 'L':
                        /* ip addresses/32-bit words */
-                       while (size >= sizeof(ul)) {
+                       while (len >= sizeof(ul)) {
                                if (!first)
                                        putchar(',');
                                ul = EXTRACT_32BITS(bp);
@@ -497,14 +499,14 @@ rfc1048_print(register const u_char *bp)
                                else
                                        printf("%u", ul);
                                bp += sizeof(ul);
-                               size -= sizeof(ul);
+                               len -= sizeof(ul);
                                first = 0;
                        }
                        break;
 
                case 'p':
                        /* IP address pairs */
-                       while (size >= 2*sizeof(ul)) {
+                       while (len >= 2*sizeof(ul)) {
                                if (!first)
                                        putchar(',');
                                memcpy((char *)&ul, (const char *)bp, sizeof(ul));
@@ -513,27 +515,27 @@ rfc1048_print(register const u_char *bp)
                                memcpy((char *)&ul, (const char *)bp, sizeof(ul));
                                printf("%s)", ipaddr_string(&ul));
                                bp += sizeof(ul);
-                               size -= 2*sizeof(ul);
+                               len -= 2*sizeof(ul);
                                first = 0;
                        }
                        break;
 
                case 's':
                        /* shorts */
-                       while (size >= sizeof(us)) {
+                       while (len >= sizeof(us)) {
                                if (!first)
                                        putchar(',');
                                us = EXTRACT_16BITS(bp);
                                printf("%u", us);
                                bp += sizeof(us);
-                               size -= sizeof(us);
+                               len -= sizeof(us);
                                first = 0;
                        }
                        break;
 
                case 'B':
                        /* boolean */
-                       while (size > 0) {
+                       while (len > 0) {
                                if (!first)
                                        putchar(',');
                                switch (*bp) {
@@ -548,7 +550,7 @@ rfc1048_print(register const u_char *bp)
                                        break;
                                }
                                ++bp;
-                               --size;
+                               --len;
                                first = 0;
                        }
                        break;
@@ -557,7 +559,7 @@ rfc1048_print(register const u_char *bp)
                case 'x':
                default:
                        /* Bytes */
-                       while (size > 0) {
+                       while (len > 0) {
                                if (!first)
                                        putchar(c == 'x' ? ':' : '.');
                                if (c == 'x')
@@ -565,7 +567,7 @@ rfc1048_print(register const u_char *bp)
                                else
                                        printf("%u", *bp);
                                ++bp;
-                               --size;
+                               --len;
                                first = 0;
                        }
                        break;
@@ -575,21 +577,40 @@ rfc1048_print(register const u_char *bp)
                        switch (tag) {
 
                        case TAG_NETBIOS_NODE:
+                               /* this option should be at least 1 byte long */
+                               if (len < 1)  {
+                                       printf("ERROR: option %u len %u < 1 bytes",
+                                           TAG_NETBIOS_NODE, len);
+                                       bp += len;
+                                       len = 0;
+                                       break;
+                               }
                                tag = *bp++;
-                               --size;
+                               --len;
                                fputs(tok2str(nbo2str, NULL, tag), stdout);
                                break;
 
                        case TAG_OPT_OVERLOAD:
+                               /* this option should be at least 1 byte long */
+                               if (len < 1)  {
+                                       printf("ERROR: option %u len %u < 1 bytes",
+                                           TAG_OPT_OVERLOAD, len);
+                                       bp += len;
+                                       len = 0;
+                                       break;
+                               }
                                tag = *bp++;
-                               --size;
+                               --len;
                                fputs(tok2str(oo2str, NULL, tag), stdout);
                                break;
 
                        case TAG_CLIENT_FQDN:
-                               /* option 81 should be at least 3 bytes long */
+                               /* this option should be at least 3 bytes long */
                                if (len < 3)  {
-                                       printf("ERROR: option 81 len %u < 3 bytes", len);
+                                       printf("ERROR: option %u len %u < 3 bytes",
+                                           TAG_CLIENT_FQDN, len);
+                                       bp += len;
+                                       len = 0;
                                        break;
                                }
                                if (*bp)
@@ -599,86 +620,153 @@ rfc1048_print(register const u_char *bp)
                                        printf("%u/%u ", *bp, *(bp+1));
                                bp += 2;
                                putchar('"');
-                               if (fn_printn(bp, size - 3, snapend)) {
+                               if (fn_printn(bp, len - 3, snapend)) {
                                        putchar('"');
                                        goto trunc;
                                }
                                putchar('"');
-                               bp += size - 3;
-                               size = 0;
+                               bp += len - 3;
+                               len = 0;
                                break;
 
                        case TAG_CLIENT_ID:
-                           {   int type = *bp++;
-                               size--;
+                           {   int type;
+
+                               /* this option should be at least 1 byte long */
+                               if (len < 1)  {
+                                       printf("ERROR: option %u len %u < 1 bytes",
+                                           TAG_CLIENT_ID, len);
+                                       bp += len;
+                                       len = 0;
+                                       break;
+                               }
+                               type = *bp++;
+                               len--;
                                if (type == 0) {
                                        putchar('"');
-                                       if (fn_printn(bp, size, snapend)) {
+                                       if (fn_printn(bp, len, snapend)) {
                                                putchar('"');
                                                goto trunc;
                                        }
                                        putchar('"');
-                                       bp += size;
-                                       size = 0;
+                                       bp += len;
+                                       len = 0;
                                        break;
                                } else {
                                        printf("%s ", tok2str(arp2str, "hardware-type %u,", type));
-                               }
-                               while (size > 0) {
-                                       if (!first)
-                                               putchar(':');
-                                       printf("%02x", *bp);
-                                       ++bp;
-                                       --size;
-                                       first = 0;
+                                       while (len > 0) {
+                                               if (!first)
+                                                       putchar(':');
+                                               printf("%02x", *bp);
+                                               ++bp;
+                                               --len;
+                                               first = 0;
+                                       }
                                }
                                break;
                            }
 
-                        case TAG_AGENT_CIRCUIT:
-                        {
-                            while (size > 0 ) {
-                            subopt = *bp++;
-                            suboptlen = *bp++;
-                            size -= 2;
-                            printf("\n\t      %s SubOption %u, length %u: ",
-                                   tok2str(agent_suboption_values, "Unknown", subopt),
-                                   subopt,
-                                   suboptlen);
-
-                            if (subopt == 0 || suboptlen == 0) {
-                                break;
-                            }
-
-                            switch(subopt) {
-                            case AGENT_SUBOPTION_CIRCUIT_ID:
-                                for (idx = 0; idx < suboptlen; idx++) {
-                                    safeputchar(*(bp+idx));
-                                }
-                                break;
-                            default:
-                                print_unknown_data(bp, "\n\t\t", suboptlen);
-                            }
-
-                            size -= suboptlen;
-                            bp += suboptlen;
-                            }
-                        }
-                            break;
+                       case TAG_AGENT_CIRCUIT:
+                               while (len >= 2) {
+                                       subopt = *bp++;
+                                       suboptlen = *bp++;
+                                       len -= 2;
+                                       if (suboptlen > len) {
+                                               printf("\n\t      %s SubOption %u, length %u: length goes past end of option",
+                                                  tok2str(agent_suboption_values, "Unknown", subopt),
+                                                  subopt,
+                                                  suboptlen);
+                                               bp += len;
+                                               len = 0;
+                                               break;
+                                       }
+                                       printf("\n\t      %s SubOption %u, length %u: ",
+                                          tok2str(agent_suboption_values, "Unknown", subopt),
+                                          subopt,
+                                          suboptlen);
+                                       switch (subopt) {
+
+                                       case AGENT_SUBOPTION_CIRCUIT_ID:
+                                               fn_printn(bp, suboptlen, NULL);
+                                               break;
+
+                                       default:
+                                               print_unknown_data(bp, "\n\t\t", suboptlen);
+                                       }
+
+                                       len -= suboptlen;
+                                       bp += suboptlen;
+                           }
+                           break;
+
+                       case TAG_CLASSLESS_STATIC_RT:
+                       case TAG_CLASSLESS_STA_RT_MS:
+                       {       
+                               u_int mask_width, significant_octets, i;
+
+                               /* this option should be at least 5 bytes long */
+                               if (len < 5)  {
+                                       printf("ERROR: option %u len %u < 5 bytes",
+                                           TAG_CLASSLESS_STATIC_RT, len);
+                                       bp += len;
+                                       len = 0;
+                                       break;
+                               }
+                               while (len > 0) {
+                                       if (!first)
+                                               putchar(',');
+                                       mask_width = *bp++;
+                                       len--;
+                                       /* mask_width <= 32 */
+                                       if (mask_width > 32) {
+                                               printf("[ERROR: Mask width (%d) > 32]",  mask_width);
+                                               bp += len;
+                                               len = 0;
+                                               break;
+                                       }
+                                       significant_octets = (mask_width + 7) / 8;
+                                       /* significant octets + router(4) */
+                                       if (len < significant_octets + 4) {
+                                               printf("[ERROR: Remaining length (%u) < %u bytes]",  len, significant_octets + 4);
+                                               bp += len;
+                                               len = 0;
+                                               break;
+                                       }
+                                       putchar('(');
+                                       if (mask_width == 0)
+                                               printf("default");
+                                       else {
+                                               for (i = 0; i < significant_octets ; i++) {
+                                                       if (i > 0)
+                                                               putchar('.');
+                                                       printf("%d", *bp++);
+                                               }
+                                               for (i = significant_octets ; i < 4 ; i++)
+                                                       printf(".0");
+                                               printf("/%d", mask_width);
+                                       }
+                                       memcpy((char *)&ul, (const char *)bp, sizeof(ul));
+                                       printf(":%s)", ipaddr_string(&ul));
+                                       bp += sizeof(ul);
+                                       len -= (significant_octets + 4);
+                                       first = 0;
+                               }
+                       }
+                       break;
 
                        default:
                                printf("[unknown special tag %u, size %u]",
-                                   tag, size);
-                               bp += size;
-                               size = 0;
+                                   tag, len);
+                               bp += len;
+                               len = 0;
                                break;
                        }
                        break;
                }
                /* Data left over? */
-               if (size) {
+               if (len) {
                        printf("\n\t  trailing data length %u", len);
-                       bp += size;
+                       bp += len;
                }
        }
        return;
index 5197811..e9e8459 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81.2.4 2006/12/12 14:33:20 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81.2.6 2007/09/13 17:40:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -300,9 +300,6 @@ struct icmp_ext_t {
     u_int8_t icmp_ext_data[1];
 };
 
-struct icmp_mpls_ext_common_header_t {
-};
-
 struct icmp_mpls_ext_object_header_t {
     u_int8_t length[2];
     u_int8_t class_num;
index f054691..07238f5 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.8 2007/01/29 20:57:47 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.9 2007/09/14 01:30:02 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -50,6 +50,7 @@ struct tok ip_option_values[] = {
     { IPOPT_SSRR, "SSRR" },
     { IPOPT_LSRR, "LSRR" },
     { IPOPT_RA, "RA" },
+    { IPOPT_RFC1393, "traceroute" },
     { 0, NULL }
 };
 
index 9361f8f..29e5988 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.3 2005/09/20 06:05:38 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.5 2007/09/21 07:07:52 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -93,7 +93,7 @@ ip6_print(register const u_char *bp, register u_int length)
                (void)printf("flowlabel 0x%05x, ", flow & 0x000fffff);
 #endif
 
-            (void)printf("hlim %u, next-header: %s (%u), length: %u) ",
+            (void)printf("hlim %u, next-header %s (%u) payload length: %u) ",
                          ip6->ip6_hlim,
                          tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
                          ip6->ip6_nxt,
@@ -225,7 +225,7 @@ ip6_print(register const u_char *bp, register u_int length)
                        return;
 
                default:
-                       (void)printf("ip-proto-%d %d", ip6->ip6_nxt, len);
+                       (void)printf("ip-proto-%d %d", nh, len);
                        return;
                }
        }
index 76a2a99..dd9ba49 100644 (file)
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.13.2.2 2006/10/25 22:13:30 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.13.2.4 2007/09/13 17:18:10 gianluca Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#ifndef HAVE_NET_PFVAR_H
+#error "No pf headers available"
+#endif
+
+#include <sys/types.h>
+#ifndef WIN32
+#include <sys/socket.h>
+#endif
+#include <net/if.h>
+#include <net/pfvar.h>
+#include <net/if_pflog.h>
+
+
+
 #include <tcpdump-stdinc.h>
 
 #include <stdio.h>
@@ -35,7 +49,6 @@ static const char rcsid[] _U_ =
 
 #include "interface.h"
 #include "addrtoname.h"
-#include "pf.h"
 
 static struct tok pf_reasons[] = {
        { 0,    "0(match)" },
index 50d3b1f..ad51930 100644 (file)
@@ -17,7 +17,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33.2.14 2007/02/26 13:32:36 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33.2.15 2007/09/13 17:33:54 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -631,6 +631,8 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
     } bw;
     u_int8_t namelen;
 
+    u_int action, subchannel;
+
     while(tlen>=sizeof(struct rsvp_object_header)) {
         /* did we capture enough for fully decoding the object header ? */
         if (!TTEST2(*tptr, sizeof(struct rsvp_object_header)))
@@ -1577,8 +1579,6 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
             case RSVP_CTYPE_1: 
                 if (obj_tlen < 4)
                     return-1;
-
-                u_int action, subchannel;
                 action = (EXTRACT_16BITS(obj_tptr)>>8);
 
                 printf("%s  Action: %s (%u), Label type: %u", ident,
index db26e29..7a18978 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.16.2.4 2005/07/07 01:24:38 guy Exp $ (NETLAB/PEL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.16.2.5 2007/09/13 18:04:58 guy Exp $ (NETLAB/PEL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -206,6 +206,7 @@ void sctp_print(const u_char *bp,        /* beginning of sctp packet */
                        if (htons(chunkDescPtr->chunkLength) <
                            sizeof(struct sctpDataPart)+
                            sizeof(struct sctpChunkDesc)+1) {
+                               /* Less than 1 byte of chunk payload */
                                printf("bogus chunk length %u]",
                                    htons(chunkDescPtr->chunkLength));
                                return;
@@ -213,7 +214,7 @@ void sctp_print(const u_char *bp,        /* beginning of sctp packet */
                        default_print(payloadPtr,
                              htons(chunkDescPtr->chunkLength) -
                              (sizeof(struct sctpDataPart)+
-                             sizeof(struct sctpChunkDesc)+1));
+                             sizeof(struct sctpChunkDesc)));
                } else
                        printf("]");
              }
index 9efc0da..b517898 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.37 2003/11/16 09:36:40 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.37.2.1 2007/09/14 01:03:12 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -35,7 +35,6 @@ static const char rcsid[] _U_ =
 #ifdef SEGSIZE
 #undef SEGSIZE                                 /* SINIX sucks */
 #endif
-#include <arpa/tftp.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -43,6 +42,7 @@ static const char rcsid[] _U_ =
 #include "interface.h"
 #include "addrtoname.h"
 #include "extract.h"
+#include "tftp.h"
 
 /* op code to string mapping */
 static struct tok op2str[] = {
@@ -51,6 +51,7 @@ static struct tok op2str[] = {
        { DATA,         "DATA" },       /* data packet */
        { ACK,          "ACK" },        /* acknowledgement */
        { ERROR,        "ERROR" },      /* error code */
+       { OACK,         "OACK" },       /* option acknowledgement */
        { 0,            NULL }
 };
 
@@ -97,6 +98,7 @@ tftp_print(register const u_char *bp, u_int length)
 
        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
@@ -106,11 +108,15 @@ tftp_print(register const u_char *bp, u_int length)
 #else
                p = (u_char *)&tp->th_block;
 #endif
-               fputs(" \"", stdout);
+               putchar(' ');
+               /* Print filename or first option */
+               if (opcode != OACK)
+                       putchar('"');
                i = fn_print(p, snapend);
-               putchar('"');
+               if (opcode != OACK)
+                       putchar('"');
 
-               /* Print the mode and any options */
+               /* Print the mode (RRQ and WRQ only) and any options */
                while ((p = (const u_char *)strchr((const char *)p, '\0')) != NULL) {
                        if (length <= (u_int)(p - (const u_char *)&tp->th_block))
                                break;
@@ -134,7 +140,7 @@ tftp_print(register const u_char *bp, u_int length)
        case ERROR:
                /* Print error code string */
                TCHECK(tp->th_code);
-               printf(" %s ", tok2str(err2str, "tftp-err-#%d \"",
+               printf(" %s \"", tok2str(err2str, "tftp-err-#%d \"",
                                       EXTRACT_16BITS(&tp->th_code)));
                /* Print error message string */
                i = fn_print((const u_char *)tp->th_data, snapend);
index 9d87e3a..caf419e 100644 (file)
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253.2.12 2006/02/01 14:39:56 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253.2.13 2007/09/12 19:48:51 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -190,7 +190,7 @@ static struct printer printers[] = {
 #ifdef DLT_LTALK
        { ltalk_if_print,       DLT_LTALK },
 #endif
-#ifdef DLT_PFLOG
+#if defined(DLT_PFLOG) && defined(HAVE_NET_PFVAR_H)
        { pflog_if_print,       DLT_PFLOG },
 #endif
 #ifdef DLT_FR
diff --git a/contrib/tcpdump-3.9/tftp.h b/contrib/tcpdump-3.9/tftp.h
new file mode 100644 (file)
index 0000000..4408304
--- /dev/null
@@ -0,0 +1,82 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/tftp.h,v 1.1.2.1 2007/09/14 01:03:12 guy Exp $ (LBL) */
+/*
+ * Copyright (c) 1983, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)tftp.h      8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _TFTP_H_
+#define        _TFTP_H_
+
+/*
+ * Trivial File Transfer Protocol (IEN-133)
+ */
+#define        SEGSIZE         512             /* data segment size */
+
+/*
+ * Packet types.
+ */
+#define        RRQ     01                      /* read request */
+#define        WRQ     02                      /* write request */
+#define        DATA    03                      /* data packet */
+#define        ACK     04                      /* acknowledgement */
+#define        ERROR   05                      /* error code */
+#define OACK   06                      /* option acknowledgement */
+
+struct tftphdr {
+       unsigned short  th_opcode;              /* packet type */
+       union {
+               unsigned short  tu_block;       /* block # */
+               unsigned 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
+
+/*
+ * Error codes.
+ */
+#define        EUNDEF          0               /* not defined */
+#define        ENOTFOUND       1               /* file not found */
+#define        EACCESS         2               /* access violation */
+#define        ENOSPACE        3               /* disk full or allocation exceeded */
+#define        EBADOP          4               /* illegal TFTP operation */
+#define        EBADID          5               /* unknown transfer ID */
+#define        EEXISTS         6               /* file already exists */
+#define        ENOUSER         7               /* no such user */
+
+#endif /* !_TFTP_H_ */