Upgrade to tcpdump-4.0.0.
authorPeter Avalos <pavalos@theshell.com>
Mon, 6 Jul 2009 07:44:17 +0000 (21:44 -1000)
committerPeter Avalos <pavalos@theshell.com>
Mon, 6 Jul 2009 07:44:17 +0000 (21:44 -1000)
205 files changed:
contrib/tcpdump/CHANGES
contrib/tcpdump/INSTALL.txt [new file with mode: 0644]
contrib/tcpdump/README
contrib/tcpdump/README.DELETED
contrib/tcpdump/VERSION
contrib/tcpdump/addrtoname.c
contrib/tcpdump/addrtoname.h
contrib/tcpdump/af.c
contrib/tcpdump/af.h
contrib/tcpdump/aodv.h
contrib/tcpdump/appletalk.h
contrib/tcpdump/arcnet.h
contrib/tcpdump/atm.h
contrib/tcpdump/atmuni31.h
contrib/tcpdump/bgp.h
contrib/tcpdump/bootp.h
contrib/tcpdump/bpf_dump.c
contrib/tcpdump/chdlc.h
contrib/tcpdump/checksum.c [new file with mode: 0644]
contrib/tcpdump/dccp.h
contrib/tcpdump/decnet.h
contrib/tcpdump/enc.h
contrib/tcpdump/ether.h
contrib/tcpdump/ethertype.h
contrib/tcpdump/extract.h
contrib/tcpdump/fddi.h
contrib/tcpdump/gmpls.c
contrib/tcpdump/gmpls.h
contrib/tcpdump/gmt2local.c
contrib/tcpdump/gmt2local.h
contrib/tcpdump/icmp6.h
contrib/tcpdump/ieee802_11.h
contrib/tcpdump/ieee802_11_radio.h
contrib/tcpdump/igrp.h
contrib/tcpdump/interface.h
contrib/tcpdump/ip.h
contrib/tcpdump/ip6.h
contrib/tcpdump/ipfc.h
contrib/tcpdump/ipproto.c
contrib/tcpdump/ipproto.h
contrib/tcpdump/ipsec_doi.h
contrib/tcpdump/ipx.h
contrib/tcpdump/isakmp.h
contrib/tcpdump/l2tp.h
contrib/tcpdump/l2vpn.c
contrib/tcpdump/l2vpn.h
contrib/tcpdump/lane.h
contrib/tcpdump/llc.h
contrib/tcpdump/machdep.c
contrib/tcpdump/machdep.h
contrib/tcpdump/makemib
contrib/tcpdump/mpls.h
contrib/tcpdump/nameser.h
contrib/tcpdump/netbios.h
contrib/tcpdump/netdissect.h
contrib/tcpdump/nfs.h
contrib/tcpdump/nfsfh.h
contrib/tcpdump/nlpid.c
contrib/tcpdump/nlpid.h
contrib/tcpdump/ntp.h
contrib/tcpdump/oakley.h
contrib/tcpdump/ospf.h
contrib/tcpdump/ospf6.h
contrib/tcpdump/oui.c
contrib/tcpdump/oui.h
contrib/tcpdump/parsenfsfh.c
contrib/tcpdump/pcap-missing.h
contrib/tcpdump/pcap_dump_ftell.c
contrib/tcpdump/pf.h [deleted file]
contrib/tcpdump/pmap_prot.h
contrib/tcpdump/ppp.h
contrib/tcpdump/print-802_11.c
contrib/tcpdump/print-ah.c
contrib/tcpdump/print-aodv.c
contrib/tcpdump/print-ap1394.c
contrib/tcpdump/print-arcnet.c
contrib/tcpdump/print-arp.c
contrib/tcpdump/print-ascii.c
contrib/tcpdump/print-atalk.c
contrib/tcpdump/print-atm.c
contrib/tcpdump/print-beep.c
contrib/tcpdump/print-bfd.c
contrib/tcpdump/print-bgp.c
contrib/tcpdump/print-bootp.c
contrib/tcpdump/print-cdp.c
contrib/tcpdump/print-cfm.c [new file with mode: 0644]
contrib/tcpdump/print-chdlc.c
contrib/tcpdump/print-cip.c
contrib/tcpdump/print-cnfp.c
contrib/tcpdump/print-dccp.c
contrib/tcpdump/print-decnet.c
contrib/tcpdump/print-dhcp6.c
contrib/tcpdump/print-domain.c
contrib/tcpdump/print-dtp.c [new file with mode: 0644]
contrib/tcpdump/print-dvmrp.c
contrib/tcpdump/print-eap.c
contrib/tcpdump/print-egp.c
contrib/tcpdump/print-eigrp.c
contrib/tcpdump/print-enc.c
contrib/tcpdump/print-esp.c
contrib/tcpdump/print-ether.c
contrib/tcpdump/print-fddi.c
contrib/tcpdump/print-fr.c
contrib/tcpdump/print-frag6.c
contrib/tcpdump/print-gre.c
contrib/tcpdump/print-hsrp.c
contrib/tcpdump/print-icmp.c
contrib/tcpdump/print-icmp6.c
contrib/tcpdump/print-igmp.c
contrib/tcpdump/print-igrp.c
contrib/tcpdump/print-ip.c
contrib/tcpdump/print-ip6.c
contrib/tcpdump/print-ip6opts.c
contrib/tcpdump/print-ipcomp.c
contrib/tcpdump/print-ipfc.c
contrib/tcpdump/print-ipx.c
contrib/tcpdump/print-isakmp.c
contrib/tcpdump/print-isoclns.c
contrib/tcpdump/print-juniper.c
contrib/tcpdump/print-krb.c
contrib/tcpdump/print-l2tp.c
contrib/tcpdump/print-lane.c
contrib/tcpdump/print-ldp.c
contrib/tcpdump/print-llc.c
contrib/tcpdump/print-lldp.c [new file with mode: 0644]
contrib/tcpdump/print-lmp.c
contrib/tcpdump/print-lspping.c
contrib/tcpdump/print-lwapp.c [new file with mode: 0644]
contrib/tcpdump/print-lwres.c
contrib/tcpdump/print-mobile.c
contrib/tcpdump/print-mobility.c
contrib/tcpdump/print-mpcp.c [new file with mode: 0644]
contrib/tcpdump/print-mpls.c
contrib/tcpdump/print-msdp.c
contrib/tcpdump/print-netbios.c
contrib/tcpdump/print-nfs.c
contrib/tcpdump/print-ntp.c
contrib/tcpdump/print-null.c
contrib/tcpdump/print-ospf.c
contrib/tcpdump/print-ospf6.c
contrib/tcpdump/print-pflog.c
contrib/tcpdump/print-pgm.c
contrib/tcpdump/print-pim.c
contrib/tcpdump/print-ppp.c
contrib/tcpdump/print-pppoe.c
contrib/tcpdump/print-pptp.c
contrib/tcpdump/print-radius.c
contrib/tcpdump/print-raw.c
contrib/tcpdump/print-rip.c
contrib/tcpdump/print-ripng.c
contrib/tcpdump/print-rrcp.c [new file with mode: 0644]
contrib/tcpdump/print-rsvp.c
contrib/tcpdump/print-rt6.c
contrib/tcpdump/print-rx.c
contrib/tcpdump/print-sctp.c
contrib/tcpdump/print-sflow.c [new file with mode: 0644]
contrib/tcpdump/print-sip.c
contrib/tcpdump/print-sl.c
contrib/tcpdump/print-sll.c
contrib/tcpdump/print-slow.c
contrib/tcpdump/print-smb.c
contrib/tcpdump/print-snmp.c
contrib/tcpdump/print-stp.c
contrib/tcpdump/print-sunatm.c
contrib/tcpdump/print-sunrpc.c
contrib/tcpdump/print-symantec.c
contrib/tcpdump/print-syslog.c
contrib/tcpdump/print-tcp.c
contrib/tcpdump/print-telnet.c
contrib/tcpdump/print-tftp.c
contrib/tcpdump/print-timed.c
contrib/tcpdump/print-token.c
contrib/tcpdump/print-udld.c [new file with mode: 0644]
contrib/tcpdump/print-udp.c
contrib/tcpdump/print-vjc.c
contrib/tcpdump/print-vqp.c [new file with mode: 0644]
contrib/tcpdump/print-vrrp.c
contrib/tcpdump/print-vtp.c [new file with mode: 0644]
contrib/tcpdump/print-wb.c
contrib/tcpdump/print-zephyr.c
contrib/tcpdump/route6d.h
contrib/tcpdump/rpc_auth.h
contrib/tcpdump/rpc_msg.h
contrib/tcpdump/rx.h
contrib/tcpdump/sctpConstants.h
contrib/tcpdump/sctpHeader.h
contrib/tcpdump/setsignal.c
contrib/tcpdump/setsignal.h
contrib/tcpdump/slcompress.h
contrib/tcpdump/slip.h
contrib/tcpdump/sll.h
contrib/tcpdump/smb.h
contrib/tcpdump/smbutil.c
contrib/tcpdump/strcasecmp.c
contrib/tcpdump/tcp.h
contrib/tcpdump/tcpdump-stdinc.h
contrib/tcpdump/tcpdump.1
contrib/tcpdump/tcpdump.c
contrib/tcpdump/telnet.h
contrib/tcpdump/tftp.h
contrib/tcpdump/timed.h
contrib/tcpdump/token.h
contrib/tcpdump/udp.h
contrib/tcpdump/util.c
contrib/tcpdump/vfprintf.c

index aa29e30..3f3b675 100644 (file)
@@ -1,20 +1,36 @@
-$Header: /tcpdump/master/tcpdump/CHANGES,v 1.87.2.17 2007/09/13 13:39:44 ken Exp $
-
-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
+$Header: /tcpdump/master/tcpdump/CHANGES,v 1.98.2.2 2008-10-15 23:26:30 ken Exp $
+
+Mon.    October 27, 2008.  ken@netfunctional.ca.  Summary for 4.0.0 tcpdump release
+        Add support for Bluetooth Sniffing
+        Add support for Realtek Remote Control Protocol (openrrcp.org.ru)
+        Add support for 802.11 AVS
+        Add support for SMB over TCP
+        Add support for 4 byte BGP AS printing
+        Add support for compiling on case-insensitive file systems
+        Add support for ikev2 printing
+        Update support for decoding AFS
+        Update DHCPv6 printer
+        Use newer libpcap API's (allows -B option on all platforms)
+        Add -I to turn on monitor mode
+        Bugfixes in lldp, lspping, dccp, ESP, NFS printers
+        Cleanup unused files and various cruft
+
+Mon.    September 10, 2007.  ken@xelerance.com.  Summary for 3.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
+
+Wed.   July 23, 2007.  mcr@xelerance.com.  Summary for 3.9.7 libpcap release
 
        NFS: Print unsigned values as such. 
        RX: parse safely.
diff --git a/contrib/tcpdump/INSTALL.txt b/contrib/tcpdump/INSTALL.txt
new file mode 100644 (file)
index 0000000..e263f53
--- /dev/null
@@ -0,0 +1,254 @@
+@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.1.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
+
+If you have not built libpcap, and your system does not have libpcap
+installed, install libpcap first.  Your system might provide a version
+of libpcap that can be installed; if so, to compile tcpdump you might
+need to install a "developer" version of libpcap as well as the
+"run-time" version.  You can also install tcpdump.org's version of
+libpcap; see the README file in this directory for the ftp location.
+
+You will need an ANSI C compiler to build tcpdump. The configure script
+will abort if your compiler is not ANSI compliant. If this happens, use
+the GNU C compiler, available via anonymous ftp:
+
+       ftp://ftp.gnu.org/pub/gnu/gcc/
+
+After libpcap has been built (either install it with "make install" or
+make sure both the libpcap and tcpdump source trees are in the same
+directory), run ./configure (a shell script).  "configure" will
+determine your system attributes and generate an appropriate Makefile
+from Makefile.in.  Now build tcpdump by running "make".
+
+If everything builds ok, su and type "make install".  This will install
+tcpdump and the manual entry.  Any user will be able to use tcpdump to
+read saved captures.  Whether a user will be able to capture traffic
+depends on the OS and the configuration of the system; see the tcpdump
+man page for details.  DO NOT give untrusted users the ability to
+capture traffic.  If a user can capture traffic, he or she could use
+utilities such as tcpdump to capture any traffic on your net, including
+passwords.
+
+Note that most systems ship tcpdump, but usually an older version.
+Remember to remove or rename the installed binary when upgrading.
+
+If your system is not one which we have tested tcpdump on, you may have
+to modify the configure script and Makefile.in. Please send us patches
+for any modifications you need to make.
+
+Please see "PLATFORMS" for notes about tested platforms.
+
+
+FILES
+-----
+CHANGES                - description of differences between releases
+CREDITS                - people that have helped tcpdump along
+FILES          - list of files exported as part of the distribution
+INSTALL.txt    - this file
+LICENSE                - the license under which tcpdump is distributed
+Makefile.in    - compilation rules (input to the configure script)
+README         - description of distribution
+Readme.Win32   - notes on building tcpdump on Win32 systems (with WinPcap)
+VERSION                - version of this release
+acconfig.h     - autoconf input
+aclocal.m4     - autoconf macros
+addrtoname.c   - address to hostname routines
+addrtoname.h   - address to hostname definitions
+ah.h           - IPSEC Authentication Header definitions
+aodv.h         - AODV definitions
+appletalk.h    - AppleTalk definitions
+arcnet.h       - ARCNET definitions
+atime.awk      - TCP ack awk script
+atm.h          - ATM traffic type definitions
+atmuni31.h     - ATM Q.2931 definitions
+bgp.h          - BGP declarations
+bootp.h                - BOOTP definitions
+bpf_dump.c     - BPF program printing routines, in case libpcap doesn't
+                 have them
+chdlc.h                - Cisco HDLC definitions
+cpack.c                - functions to extract packed data
+cpack.h                - declarations of functions to extract packed data
+config.guess   - autoconf support
+config.h.in    - autoconf input
+config.sub     - autoconf support
+configure      - configure script (run this first)
+configure.in   - configure script source
+dccp.h         - DCCP definitions
+decnet.h       - DECnet definitions
+decode_prefix.h        - Declarations of "decode_prefix{4,6}()"
+enc.h          - OpenBSD IPsec encapsulation BPF layer definitions
+esp.h          - IPSEC Encapsulating Security Payload definitions
+ether.h                - Ethernet definitions
+ethertype.h    - Ethernet type value definitions
+extract.h      - alignment definitions
+fddi.h         - Fiber Distributed Data Interface definitions
+gmpls.c                - GMPLS definitions
+gmpls.h                - GMPLS declarations
+gmt2local.c    - time conversion routines
+gmt2local.h    - time conversion prototypes
+icmp6.h                - ICMPv6 definitiions
+ieee802_11.h   - IEEE 802.11 definitions
+ieee802_11_radio.h - radiotap header definitions
+igrp.h         - Interior Gateway Routing Protocol definitions
+install-sh     - BSD style install script
+interface.h    - globals, prototypes and definitions
+ip.h           - IP definitions
+ip6.h          - IPv6 definitions
+ipfc.h         - IP-over-Fibre Channel definitions
+ipproto.c      - IP protocol type value-to-name table
+ipproto.h      - IP protocol type value definitions
+ipsec_doi.h    - ISAKMP packet definitions - RFC2407
+ipx.h          - IPX definitions
+isakmp.h       - ISAKMP packet definitions - RFC2408
+l2vpn.c                - L2VPN encapsulation value-to-name table
+l2vpn.h                - L2VPN encapsulation definitions
+l2tp.h         - Layer Two Tunneling Protocol definitions
+lane.h         - ATM LANE definitions
+lbl/os-*.h     - OS-dependent defines and prototypes
+llc.h          - LLC definitions
+machdep.c      - machine dependent routines
+machdep.h      - machine dependent definitions
+makemib                - mib to header script
+mib.h          - mib definitions
+missing/*      - replacements for missing library functions
+mkdep          - construct Makefile dependency list
+mpls.h         - MPLS definitions
+nameser.h      - DNS definitions
+netbios.h      - NETBIOS definitions
+netdissect.h   - definitions and declarations for tcpdump-as-library
+                 (under development)
+nfs.h          - Network File System V2 definitions
+nfsfh.h                - Network File System file handle definitions
+nlpid.c                - OSI NLPID value-to-name table
+nlpid.h                - OSI NLPID definitions
+ntp.h          - Network Time Protocol definitions
+oakley.h       - ISAKMP packet definitions - RFC2409
+ospf.h         - Open Shortest Path First definitions
+ospf6.h                - IPv6 Open Shortest Path First definitions
+packetdat.awk  - TCP chunk summary awk script
+parsenfsfh.c   - Network File System file parser routines
+pcap_dump_ftell.c - pcap_dump_ftell() implementation, in case libpcap
+               doesn't have it
+pcap-missing.h - declarations of functions possibly missing from libpcap
+pmap_prot.h    - definitions for ONC RPC portmapper protocol
+ppp.h          - Point to Point Protocol definitions
+print-802_11.c - IEEE 802.11 printer routines
+print-ap1394.c - Apple IP-over-IEEE 1394 printer routines
+print-ah.c     - IPSEC Authentication Header printer routines
+print-aodv.c   - AODV printer routines
+print-arcnet.c - ARCNET printer routines
+print-arp.c    - Address Resolution Protocol printer routines
+print-ascii.c  - ASCII packet dump routines
+print-atalk.c  - AppleTalk printer routines
+print-atm.c    - ATM printer routines
+print-beep.c   - BEEP printer routines
+print-bgp.c    - Border Gateway Protocol printer routines
+print-bootp.c  - BOOTP and IPv4 DHCP printer routines
+print-bt.c     - Bluetooth printer routines
+print-cdp.c    - Cisco Discovery Protocol printer routines
+print-chdlc.c  - Cisco HDLC printer routines
+print-cip.c    - Classical-IP over ATM routines
+print-cnfp.c   - Cisco NetFlow printer routines
+print-dccp.c   - DCCP printer routines
+print-decnet.c - DECnet printer routines
+print-dhcp6.c  - IPv6 DHCP printer routines
+print-domain.c - Domain Name System printer routines
+print-dvmrp.c  - Distance Vector Multicast Routing Protocol printer routines
+print-eap.c    - EAP printer routines
+print-enc.c    - OpenBSD IPsec encapsulation BPF layer printer routines
+print-egp.c    - External Gateway Protocol printer routines
+print-esp.c    - IPSEC Encapsulating Security Payload printer routines
+print-ether.c  - Ethernet printer routines
+print-fddi.c   - Fiber Distributed Data Interface printer routines
+print-fr.c     - Frame Relay printer routines
+print-frag6.c  - IPv6 fragmentation header printer routines
+print-gre.c    - Generic Routing Encapsulation printer routines
+print-hsrp.c   - Cisco Hot Standby Router Protocol printer routines
+print-icmp.c   - Internet Control Message Protocol printer routines
+print-icmp6.c  - IPv6 Internet Control Message Protocol printer routines
+print-igmp.c   - Internet Group Management Protocol printer routines
+print-igrp.c   - Interior Gateway Routing Protocol printer routines
+print-ip.c     - IP printer routines
+print-ip6.c    - IPv6 printer routines
+print-ip6opts.c        - IPv6 header option printer routines
+print-ipcomp.c - IP Payload Compression Protocol printer routines
+print-ipx.c    - IPX printer routines
+print-isakmp.c - Internet Security Association and Key Management Protocol
+print-isoclns.c        - ISO CLNS, ESIS, and ISIS printer routines
+print-krb.c    - Kerberos printer routines
+print-l2tp.c   - Layer Two Tunneling Protocol printer routines
+print-lane.c   - ATM LANE printer routines
+print-llc.c    - IEEE 802.2 LLC printer routines
+print-lspping.c        - LSPPING printer routines
+print-lwres.c  - Lightweight Resolver protocol printer routines
+print-mobile.c - IPv4 mobility printer routines
+print-mobility.c - IPv6 mobility printer routines
+print-mpls.c   - Multi-Protocol Label Switching printer routines
+print-msdp.c   - Multicast Source Discovery Protocol printer routines
+print-netbios.c        - NetBIOS frame protocol printer routines
+print-nfs.c    - Network File System printer routines
+print-ntp.c    - Network Time Protocol printer routines
+print-null.c   - BSD loopback device printer routines
+print-ospf.c   - Open Shortest Path First printer routines
+print-ospf6.c  - IPv6 Open Shortest Path First printer routines
+print-pflog.c  - OpenBSD packet filter log file printer routines
+print-pgm.c    - Pragmatic General Multicast printer routines
+print-pim.c    - Protocol Independent Multicast printer routines
+print-ppp.c    - Point to Point Protocol printer routines
+print-pppoe.c  - PPP-over-Ethernet printer routines
+print-pptp.c   - Point-to-Point Tunnelling Protocol printer routines
+print-radius.c - Radius protocol printer routines
+print-raw.c    - Raw IP printer routines
+print-rip.c    - Routing Information Protocol printer routines
+print-ripng.c  - IPv6 Routing Information Protocol printer routines
+print-rrcp.c   - Realtek Remote Control Protocol routines
+print-rsvp.c   - Resource reSerVation Protocol (RSVP) printer routines
+print-rt6.c    - IPv6 routing header printer routines
+print-rx.c     - AFS RX printer routines
+print-sctp.c   - Stream Control Transmission Protocol printer routines
+print-sip.c    - SIP printer routines
+print-sl.c     - Compressed Serial Line Internet Protocol printer routines
+print-sll.c    - Linux "cooked" capture printer routines
+print-slow.c   - IEEE "slow protocol" (802.3ad) printer routines
+print-smb.c    - SMB/CIFS printer routines
+print-snmp.c   - Simple Network Management Protocol printer routines
+print-stp.c    - IEEE 802.1d spanning tree protocol printer routines
+print-sunatm.c - SunATM DLPI capture printer routines
+print-sunrpc.c - Sun Remote Procedure Call printer routines
+print-symantec.c - Symantec Enterprise Firewall printer routines
+print-tcp.c    - TCP printer routines
+print-telnet.c - Telnet option printer routines
+print-tftp.c   - Trivial File Transfer Protocol printer routines
+print-timed.c  - BSD time daemon protocol printer routines
+print-token.c  - Token Ring printer routines
+print-udp.c    - UDP printer routines
+print-vjc.c    - PPP Van Jacobson compression (RFC1144) printer routines
+print-vrrp.c   - Virtual Router Redundancy Protocol
+print-wb.c     - White Board printer routines
+print-zephyr.c - Zephyr printer routines
+route6d.h      - packet definition for IPv6 Routing Information Protocol
+rpc_auth.h     - definitions for ONC RPC authentication
+rpc_msg.h      - definitions for ONC RPC messages
+rx.h           - AFS RX definitions
+sctpConstants.h        - Stream Control Transmission Protocol constant definitions
+sctpHeader.h   - Stream Control Transmission Protocol packet definitions
+send-ack.awk   - unidirectional tcp send/ack awk script
+setsignal.c    - OS-independent signal routines
+setsignal.h    - OS-independent signal prototypes
+slcompress.h   - SLIP/PPP Van Jacobson compression (RFC1144) definitions
+slip.h         - SLIP definitions
+sll.h          - Linux "cooked" capture definitions
+smb.h          - SMB/CIFS definitions
+smbutil.c      - SMB/CIFS utility routines
+stime.awk      - TCP send awk script
+strcasecmp.c   - missing routine
+tcp.h          - TCP definitions
+tcpdump.1      - manual entry
+tcpdump.c      - main program
+telnet.h       - Telnet definitions
+tftp.h         - TFTP definitions
+timed.h                - BSD time daemon protocol definitions
+token.h                - Token Ring definitions
+udp.h          - UDP definitions
+util.c         - utility routines
+vfprintf.c     - emulation routine
+win32          - headers and routines for building on Win32 systems
index cb51d30..c2b6760 100644 (file)
@@ -1,10 +1,11 @@
-@(#) $Header: /tcpdump/master/tcpdump/README,v 1.65.2.1 2007/09/14 01:03:12 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/README,v 1.66.2.1 2008-05-30 01:38:20 guy Exp $ (LBL)
 
 TCPDUMP 3.9
 Now maintained by "The Tcpdump Group"
 See            www.tcpdump.org
 
-Please send inquiries/comments/reports to      tcpdump-workers@tcpdump.org
+Please send inquiries/comments/reports to:
+       tcpdump-workers@lists.tcpdump.org
 
 Anonymous CVS is available via:
        cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master login
@@ -68,15 +69,14 @@ trace files. See the above distribution for further details and
 documentation.
 
 Problems, bugs, questions, desirable enhancements, etc. should be sent
-to the address "tcpdump-workers@tcpdump.org".  Bugs, support requests,
-and feature requests may also be submitted on the SourceForge site for
-tcpdump at
+to the address "tcpdump-workers@lists.tcpdump.org".  Bugs, support
+requests, and feature requests may also be submitted on the SourceForge
+site for tcpdump at
 
        http://sourceforge.net/projects/tcpdump/
 
 Source code contributions, etc. should be sent to the email address
-"patches@tcpdump.org", or submitted as patches on the SourceForge site
-for tcpdump.
+submitted as patches on the SourceForge site for tcpdump.
 
 Current versions can be found at www.tcpdump.org, or the SourceForge
 site for tcpdump.
index b2af9f5..faea7ee 100644 (file)
@@ -1,21 +1,9 @@
-.#CHANGES.1.87
-.#tcpdump.c.1.253.2.5
-.cvsignore
-CHANGES.~1~
-CHANGES~
 CREDITS
-CVS/
-FILES
-INSTALL
-Makefile-devel-adds
 Makefile.in
-PLATFORMS
 Readme.Win32
-TODO
 acconfig.h
 aclocal.m4
 atime.awk
-autom4te.cache/
 config.guess
 config.h.in
 config.sub
@@ -26,8 +14,7 @@ lbl/
 missing/
 mkdep
 packetdat.awk
+print-bt.c
 send-ack.awk
 stime.awk
-tcpdump-3.9
-tests/
 win32/
index 53d615f..e67d114 100644 (file)
@@ -23,7 +23,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.9 2007/09/14 00:26:18 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.119 2007-08-08 14:06:34 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -79,7 +79,6 @@ extern int ether_ntohost(char *, const struct ether_addr *);
  */
 
 #define HASHNAMESIZE 4096
-#define BUFSIZE 128
 
 struct hnamemem {
        u_int32_t addr;
@@ -509,14 +508,19 @@ etheraddr_string(register const u_char *ep)
 }
 
 const char *
-linkaddr_string(const u_char *ep, const unsigned int len)
+linkaddr_string(const u_char *ep, const unsigned int type, const unsigned int len)
 {
        register u_int i;
        register char *cp;
        register struct enamemem *tp;
 
-       if (len == ETHER_ADDR_LEN)      /* XXX not totally correct... */
-               return etheraddr_string(ep);
+       if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) {
+            return etheraddr_string(ep);
+        }
+
+        if (type == LINKADDR_FRELAY) {
+            return q922_string(ep);
+        }
 
        tp = lookup_bytestring(ep, len);
        if (tp->e_name)
index 67ded6e..1df204a 100644 (file)
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/addrtoname.h,v 1.18 2001/09/17 21:57:51 fenner Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/addrtoname.h,v 1.20 2007-08-08 14:06:34 hannes Exp $ (LBL)
  */
 
 /* Name to address translation routines. */
 
-extern const char *linkaddr_string(const u_char *, const unsigned int);
+enum {
+    LINKADDR_ETHER,
+    LINKADDR_FRELAY,
+    LINKADDR_IEEE1394,
+    LINKADDR_ATM
+};
+
+#define BUFSIZE 128
+
+extern const char *linkaddr_string(const u_char *, const unsigned int, const unsigned int);
 extern const char *etheraddr_string(const u_char *);
 extern const char *etherproto_string(u_short);
 extern const char *tcpport_string(u_short);
index 76d6178..e3c77bf 100644 (file)
@@ -17,7 +17,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/af.c,v 1.3.2.1 2007/02/26 13:33:17 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/af.c,v 1.3 2006-03-23 14:58:44 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 1ba7662..c036cef 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/af.h,v 1.3.2.1 2007/02/26 13:33:17 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/af.h,v 1.3 2006-03-23 14:58:44 hannes Exp $ (LBL) */
 
 /*
  * Copyright (c) 1998-2006 The TCPDUMP project
index 335c175..456ec8b 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/aodv.h,v 1.3 2003/09/13 01:34:42 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/aodv.h,v 1.3 2003-09-13 01:34:42 guy Exp $ (LBL) */
 /*
  * Copyright (c) 2003 Bruce M. Simpson <bms@spc.org>
  * All rights reserved.
index 67e62ef..ff972f6 100644 (file)
@@ -20,7 +20,7 @@
  *
  * AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
  *
- * @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.16 2004/05/01 09:41:50 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.16 2004-05-01 09:41:50 hannes Exp $ (LBL)
  */
 
 struct LAP {
index 6e649f6..3b60956 100644 (file)
@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#) $Id: arcnet.h,v 1.3 2003/01/23 09:05:37 guy Exp $ (LBL)
+ * @(#) $Id: arcnet.h,v 1.3 2003-01-23 09:05:37 guy Exp $ (LBL)
  *
  * from: NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp
  */
index c6ac53e..65ac5c1 100644 (file)
@@ -14,7 +14,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.1.4.1 2005/06/20 07:45:05 hannes Exp $
+ * @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.3 2006-02-08 01:43:00 hannes Exp $
  */
 
 /*
@@ -30,3 +30,4 @@
  */
 #define ATM_OAM_NOHEC   0
 #define ATM_OAM_HEC     1
+#define ATM_HDR_LEN_NOHEC 4
index 304859a..32acfb1 100644 (file)
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/atmuni31.h,v 1.2 2002/08/05 07:47:23 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/atmuni31.h,v 1.2.6.1 2007-10-22 19:39:12 guy Exp $ (LBL)
  */
 
 /* Based on UNI3.1 standard by ATM Forum */
 
 /* ATM traffic types based on VPI=0 and (the following VCI */
-#define PPC                    0x05    /* Point-to-point signal msg */
-#define BCC                    0x02    /* Broadcast signal msg */
-#define OAMF4SC                        0x03    /* Segment OAM F4 flow cell */
-#define OAMF4EC                        0x04    /* End-to-end OAM F4 flow cell */
-#define METAC                  0x01    /* Meta signal msg */
-#define ILMIC                  0x10    /* ILMI msg */
+#define VCI_PPC                        0x05    /* Point-to-point signal msg */
+#define VCI_BCC                        0x02    /* Broadcast signal msg */
+#define VCI_OAMF4SC            0x03    /* Segment OAM F4 flow cell */
+#define VCI_OAMF4EC            0x04    /* End-to-end OAM F4 flow cell */
+#define VCI_METAC              0x01    /* Meta signal msg */
+#define VCI_ILMIC              0x10    /* ILMI msg */
 
 /* Q.2931 signalling messages */
 #define CALL_PROCEED           0x02    /* call proceeding */
index 06be3ea..5081596 100755 (executable)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/bgp.h,v 1.3 2004/06/16 08:45:15 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/bgp.h,v 1.3 2004-06-16 08:45:15 hannes Exp $ (LBL) */
 /* 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that: (1) source code
index 7c63d0c..8f61b13 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.15.4.3 2007/08/21 22:02:08 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.18 2007-08-21 21:59:11 guy Exp $ (LBL) */
 /*
  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1048.
  *
index 0cad4d9..f509b7e 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.16 2003/11/16 09:36:08 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.16.4.1 2008-02-14 20:54:53 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -35,7 +35,7 @@ static const char rcsid[] _U_ =
 #include "interface.h"
 
 void
-bpf_dump(struct bpf_program *p, int option)
+bpf_dump(const struct bpf_program *p, int option)
 {
        struct bpf_insn *insn;
        int i;
index 4fb6e1d..d117263 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/chdlc.h,v 1.1 2000/09/18 05:11:43 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/chdlc.h,v 1.1 2000-09-18 05:11:43 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
  *     The Regents of the University of California.  All rights reserved.
diff --git a/contrib/tcpdump/checksum.c b/contrib/tcpdump/checksum.c
new file mode 100644 (file)
index 0000000..f441be3
--- /dev/null
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 1998-2006 The TCPDUMP project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * miscellaneous checksumming routines
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/checksum.c,v 1.4 2006-09-25 09:23:32 hannes Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "interface.h"
+
+#define CRC10_POLYNOMIAL 0x633
+static u_int16_t crc10_table[256];
+
+static void
+init_crc10_table(void)
+{   
+    register int i, j;
+    register u_int16_t accum;
+    
+    for ( i = 0;  i < 256;  i++ )
+    {
+        accum = ((unsigned short) i << 2);
+        for ( j = 0;  j < 8;  j++ )
+        {
+            if ((accum <<= 1) & 0x400) accum ^= CRC10_POLYNOMIAL;
+        }
+        crc10_table[i] = accum;
+    }
+    return;
+}
+
+u_int16_t
+verify_crc10_cksum(u_int16_t accum, const u_char *p, int length)
+{
+    register int i;
+
+    for ( i = 0;  i < length;  i++ )
+    {
+        accum = ((accum << 8) & 0x3ff)
+            ^ crc10_table[( accum >> 2) & 0xff]
+            ^ *p++;
+    }
+    return accum;
+}
+
+/* precompute checksum tables */
+void
+init_checksum(void) {
+
+    init_crc10_table();
+
+}
+
+/*
+ * Creates the OSI Fletcher checksum. See 8473-1, Appendix C, section C.3.
+ * The checksum field of the passed PDU does not need to be reset to zero.
+ */
+u_int16_t
+create_osi_cksum (const u_int8_t *pptr, int checksum_offset, int length)
+{
+
+    int x;
+    int y;
+    u_int32_t mul;
+    u_int32_t c0;
+    u_int32_t c1;
+    u_int16_t checksum;
+    int index;
+
+    checksum = 0;
+
+    c0 = 0;
+    c1 = 0;
+
+    for (index = 0; index < length; index++) {
+        /*
+         * Ignore the contents of the checksum field.
+         */
+        if (index == checksum_offset ||
+            index == checksum_offset+1) {
+            c1 += c0;
+            pptr++;
+        } else {
+            c0 = c0 + *(pptr++);
+            c1 += c0;
+        } 
+    }
+
+    c0 = c0 % 255;
+    c1 = c1 % 255;
+
+    mul = (length - checksum_offset)*(c0);
+  
+    x = mul - c0 - c1;
+    y = c1 - mul - 1;
+
+    if ( y >= 0 ) y++;
+    if ( x < 0 ) x--;
+
+    x %= 255;
+    y %= 255;
+
+
+    if (x == 0) x = 255;
+    if (y == 0) y = 255;
+
+    y &= 0x00FF;
+    checksum = ((x << 8) | y);
+  
+    return checksum;
+}
index 1afa8c0..5c66e23 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/dccp.h,v 1.1.2.4 2006/05/12 01:46:17 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/dccp.h,v 1.5 2006-11-02 09:05:23 hannes Exp $ (LBL) */
 /*
  * Copyright (C) Arnaldo Carvalho de Melo 2004
  * Copyright (C) Ian McDonald 2005 <iam4@cs.waikato.ac.nz>
@@ -36,8 +36,8 @@ struct dccp_hdr {
        }               dccph_xtrs;
 };
 
-#define DCCPH_CCVAL(dh)        (((dh)->dccph_ccval_cscov) & 0x0F)
-#define DCCPH_CSCOV(dh)        (((dh)->dccph_ccval_cscov >> 4) & 0x0F)
+#define DCCPH_CCVAL(dh)        (((dh)->dccph_ccval_cscov >> 4) & 0xF)
+#define DCCPH_CSCOV(dh)        (((dh)->dccph_ccval_cscov) & 0xF)
 
 #define DCCPH_X(dh)    ((dh)->dccph_xtrs.dccph_xtr & 1)
 #define DCCPH_TYPE(dh) (((dh)->dccph_xtrs.dccph_xtr >> 1) & 0xF)
index 9a5c147..d25d157 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.11 2002/12/11 07:13:50 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.11 2002-12-11 07:13:50 guy Exp $ (LBL)
  */
 
 #ifndef WIN32
index f54b4eb..2d57e2b 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/enc.h,v 1.1 2003/03/08 08:55:33 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/enc.h,v 1.1 2003-03-08 08:55:33 guy Exp $ (LBL) */
 /* From $OpenBSD: if_enc.h,v 1.8 2001/06/25 05:14:00 angelos Exp $ */
 /*
  * The authors of this code are John Ioannidis (ji@tla.org),
index 3d3f3be..e8b3a71 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.8 2002/12/11 07:13:51 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.8 2002-12-11 07:13:51 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1982, 1986, 1993
  *     The Regents of the University of California.  All rights reserved.
index 36dc8e2..97550c7 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24.2.1 2005/07/10 14:51:10 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.29.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
  */
 
 /*
 #ifndef ETHERTYPE_PPP
 #define        ETHERTYPE_PPP           0x880b
 #endif
+#ifndef ETHERTYPE_MPCP
+#define        ETHERTYPE_MPCP          0x8808
+#endif
 #ifndef ETHERTYPE_SLOW
 #define        ETHERTYPE_SLOW          0x8809
 #endif
 #ifndef ETHERTYPE_JUMBO
 #define ETHERTYPE_JUMBO         0x8870
 #endif
+#ifndef ETHERTYPE_LLDP
+#define ETHERTYPE_LLDP          0x88cc
+#endif
 #ifndef ETHERTYPE_EAPOL
 #define ETHERTYPE_EAPOL        0x888e
 #endif
+#ifndef ETHERTYPE_RRCP
+#define ETHERTYPE_RRCP         0x8899
+#endif
 #ifndef        ETHERTYPE_LOOPBACK
 #define        ETHERTYPE_LOOPBACK      0x9000
 #endif
 #ifndef        ETHERTYPE_VMAN
 #define        ETHERTYPE_VMAN          0x9100 /* Extreme VMAN Protocol */ 
 #endif
+#ifndef        ETHERTYPE_CFM_OLD
+#define        ETHERTYPE_CFM_OLD       0xabcd /* 802.1ag depreciated */
+#endif
+#ifndef        ETHERTYPE_CFM
+#define        ETHERTYPE_CFM           0x8902 /* 802.1ag */
+#endif
 #ifndef        ETHERTYPE_ISO
 #define        ETHERTYPE_ISO           0xfefe  /* nonstandard - used in Cisco HDLC encapsulation */
 #endif
index f3db250..bab63f2 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.24 2005/01/15 02:06:50 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.25 2006-01-30 16:20:07 hannes Exp $ (LBL)
  */
 
 /*
@@ -115,6 +115,10 @@ typedef struct {
                     (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
                     (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
                     (u_int32_t)*((const u_int8_t *)(p) + 0)))
+#define EXTRACT_LE_24BITS(p) \
+       ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
+                    (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
+                    (u_int32_t)*((const u_int8_t *)(p) + 0)))
 #define EXTRACT_LE_64BITS(p) \
        ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 7) << 56 | \
                     (u_int64_t)*((const u_int8_t *)(p) + 6) << 48 | \
index 690af48..df38c8e 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.11 2002/12/11 07:13:51 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.11 2002-12-11 07:13:51 guy Exp $ (LBL)
  */
 
 /*
index 4d4b9ae..ff9adb5 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/gmpls.c,v 1.5.2.1 2005/05/19 06:44:02 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/gmpls.c,v 1.7 2006-04-14 07:11:59 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -25,6 +25,7 @@ static const char rcsid[] _U_ =
 #include <tcpdump-stdinc.h>
 
 #include "interface.h"
+#include "gmpls.h"
 
 /* rfc3471 */
 struct tok gmpls_link_prot_values[] = {
@@ -41,14 +42,21 @@ struct tok gmpls_link_prot_values[] = {
 
 /* rfc3471 */
 struct tok gmpls_switch_cap_values[] = {
-    { 1,       "Packet-Switch Capable-1"},
-    { 2,       "Packet-Switch Capable-2"},
-    { 3,       "Packet-Switch Capable-3"},
-    { 4,       "Packet-Switch Capable-4"},
-    { 51,      "Layer-2 Switch Capable"},
-    { 100,     "Time-Division-Multiplex"},
-    { 150,     "Lambda-Switch Capable"},
-    { 200,     "Fiber-Switch Capable"},
+    { GMPLS_PSC1, "Packet-Switch Capable-1"},
+    { GMPLS_PSC2, "Packet-Switch Capable-2"},
+    { GMPLS_PSC3, "Packet-Switch Capable-3"},
+    { GMPLS_PSC4, "Packet-Switch Capable-4"},
+    { GMPLS_L2SC, "Layer-2 Switch Capable"},
+    { GMPLS_TSC, "Time-Division-Multiplex"},
+    { GMPLS_LSC, "Lambda-Switch Capable"},
+    { GMPLS_FSC, "Fiber-Switch Capable"},
+    { 0, NULL }
+};
+
+/* rfc4205 */
+struct tok gmpls_switch_cap_tsc_indication_values[] = {
+    { 0, "Standard SONET/SDH" },
+    { 1, "Arbitrary SONET/SDH" },
     { 0, NULL }
 };
 
index 8c3f051..6b2db23 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.3.2.1 2005/05/19 06:44:03 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.5 2006-04-14 07:11:59 hannes Exp $ (LBL) */
 /* 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that: (1) source code
  * Original code by Hannes Gredler (hannes@juniper.net)
  */
 
+#define GMPLS_PSC1   1
+#define GMPLS_PSC2   2
+#define GMPLS_PSC3   3
+#define GMPLS_PSC4   4
+#define GMPLS_L2SC  51
+#define GMPLS_TSC  100
+#define GMPLS_LSC  150
+#define GMPLS_FSC  200
+
 extern struct tok gmpls_link_prot_values[];
 extern struct tok gmpls_switch_cap_values[];
+extern struct tok gmpls_switch_cap_tsc_indication_values[];
 extern struct tok gmpls_encoding_values[];
 extern struct tok gmpls_payload_values[];
 extern struct tok diffserv_te_bc_values[];
index 926e86c..1fe0e8a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.9 2003/11/16 09:36:09 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.9 2003-11-16 09:36:09 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 81b0e96..17120c5 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/gmt2local.h,v 1.2.1.1 1999/10/07 23:47:10 mcr Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/gmt2local.h,v 1.2.1.1 1999-10-07 23:47:10 mcr Exp $ (LBL)
  */
 #ifndef gmt2local_h
 #define gmt2local_h
index 20a51e3..5d27270 100644 (file)
@@ -1,5 +1,5 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.16.2.1 2005/09/05 09:29:28 guy Exp $ (LBL) */
-/*     $NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp $        */
+/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.18 2007-08-29 02:31:44 mcr Exp $ (LBL) */
+/*     NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp   */
 /*     $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $  */
 
 /*
index f578a43..3bcda7d 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.9.4.3 2007/07/22 20:01:16 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.12 2007-07-22 19:59:06 guy Exp $ (LBL) */
 /*
  * Copyright (c) 2001
  *     Fortress Technologies
index 142a35e..3f2b836 100644 (file)
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/sys/net80211/ieee80211_radiotap.h,v 1.5 2005/01/22 20:12:05 sam Exp $ */
-/* $NetBSD: ieee802_11_radio.h,v 1.2 2006/02/26 03:04:03 dyoung Exp $ */
-/* $Header: /tcpdump/master/tcpdump/ieee802_11_radio.h,v 1.1.2.1 2006/06/13 22:24:45 guy Exp $ */
+/* NetBSD: ieee802_11_radio.h,v 1.2 2006/02/26 03:04:03 dyoung Exp  */
+/* $Header: /tcpdump/master/tcpdump/ieee802_11_radio.h,v 1.3 2007-08-29 02:31:44 mcr Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004 David Young.  All rights reserved.
index 78876d3..b5f133b 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/igrp.h,v 1.6 2002/12/11 07:13:52 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/igrp.h,v 1.6 2002-12-11 07:13:52 guy Exp $ (LBL) */
 /* Cisco IGRP definitions */
 
 /* IGRP Header */
index 49ba87d..1f03123 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244.2.21 2007/03/28 07:45:46 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.280.2.4 2008-04-04 19:42:52 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -164,6 +164,11 @@ extern const char *ipxsap_string(u_short);
 extern const char *dnname_string(u_short);
 extern const char *dnnum_string(u_short);
 
+/* checksum routines */
+extern void init_checksum(void);
+extern u_int16_t verify_crc10_cksum(u_int16_t, const u_char *, int);
+extern u_int16_t create_osi_cksum(const u_int8_t *, int, int);
+
 /* The printer routines. */
 
 #include <pcap.h>
@@ -209,10 +214,13 @@ extern u_int fr_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int mfr_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int fr_print(register const u_char *, u_int);
 extern u_int mfr_print(register const u_char *, u_int);
+extern char *q922_string(const u_char *);
 extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int ieee802_11_radio_if_print(const struct pcap_pkthdr *,
        const u_char *);
 extern u_int ap1394_if_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int ieee802_11_radio_avs_if_print(const struct pcap_pkthdr *,
+       const u_char *);
 extern void gre_print(const u_char *, u_int);
 extern void icmp_print(const u_char *, u_int, const u_char *, int);
 extern void igmp_print(const u_char *, u_int);
@@ -236,8 +244,11 @@ extern void pimv1_print(const u_char *, u_int);
 extern void cisco_autorp_print(const u_char *, u_int);
 extern void rsvp_print(const u_char *, u_int);
 extern void ldp_print(const u_char *, u_int);
+extern void lldp_print(const u_char *, u_int);
 extern void lmp_print(const u_char *, u_int);
 extern void lspping_print(const u_char *, u_int);
+extern void lwapp_control_print(const u_char *, u_int, int);
+extern void lwapp_data_print(const u_char *, u_int);
 extern void eigrp_print(const u_char *, u_int);
 extern void mobile_print(const u_char *, u_int);
 extern void pim_print(const u_char *, u_int);
@@ -250,6 +261,7 @@ extern u_int pppoe_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int prism_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void q933_print(const u_char *, u_int);
 extern int vjc_print(register const char *, u_short);
+extern void vqp_print(register const u_char *, register u_int);
 extern u_int raw_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void rip_print(const u_char *, u_int);
 extern u_int sl_if_print(const struct pcap_pkthdr *, const u_char *);
@@ -281,7 +293,9 @@ extern u_int symantec_if_print(const struct pcap_pkthdr *, const u_char *);
 extern void tcp_print(const u_char *, u_int, const u_char *, int);
 extern void tftp_print(const u_char *, u_int);
 extern void timed_print(const u_char *);
+extern void udld_print(const u_char *, u_int);
 extern void udp_print(const u_char *, u_int, const u_char *, int);
+extern void vtp_print(const u_char *, u_int);
 extern void wb_print(const void *, u_int);
 extern int ah_print(register const u_char *);
 extern int ipcomp_print(register const u_char *, int *);
@@ -291,14 +305,19 @@ extern void ipx_netbios_print(const u_char *, u_int);
 extern void nbt_tcp_print(const u_char *, int);
 extern void nbt_udp137_print(const u_char *, int);
 extern void nbt_udp138_print(const u_char *, int);
+extern void smb_tcp_print(const u_char *, int);
 extern char *smb_errstr(int, int);
 extern const char *nt_errstr(u_int32_t);
 extern void print_data(const unsigned char *, int);
 extern void l2tp_print(const u_char *, u_int);
 extern void vrrp_print(const u_char *, u_int, int);
 extern void slow_print(const u_char *, u_int);
+extern void sflow_print(const u_char *, u_int);
+extern void mpcp_print(const u_char *, u_int);
+extern void cfm_print(const u_char *, u_int);
 extern void pgm_print(const u_char *, u_int, const u_char *);
 extern void cdp_print(const u_char *, u_int, u_int);
+extern void dtp_print(const u_char *, u_int);
 extern void stp_print(const u_char *, u_int);
 extern void radius_print(const u_char *, u_int);
 extern void lwres_print(const u_char *, u_int);
@@ -312,6 +331,7 @@ extern void hsrp_print(const u_char *, u_int);
 extern void bfd_print(const u_char *, u_int, u_int);
 extern void sip_print(const u_char *, u_int);
 extern void syslog_print(const u_char *, u_int);
+extern u_int bt_if_print(const struct pcap_pkthdr *, const u_char *);
 
 #ifdef INET6
 extern void ip6_print(const u_char *, u_int);
@@ -332,7 +352,7 @@ extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t);
 #ifndef HAVE_BPF_DUMP
 struct bpf_program;
 
-extern void bpf_dump(struct bpf_program *, int);
+extern void bpf_dump(const struct bpf_program *, int);
 
 #endif
 
@@ -340,10 +360,12 @@ extern void bpf_dump(struct bpf_program *, int);
 
 /* forward compatibility */
 
+#ifndef NETDISSECT_REWORKED
 extern netdissect_options *gndo;
 
 #define eflag gndo->ndo_eflag 
 #define fflag gndo->ndo_fflag 
+#define Kflag gndo->ndo_Kflag 
 #define nflag gndo->ndo_nflag 
 #define Nflag gndo->ndo_Nflag 
 #define Oflag gndo->ndo_Oflag 
@@ -359,13 +381,19 @@ extern netdissect_options *gndo;
 #define xflag gndo->ndo_xflag 
 #define Xflag gndo->ndo_Xflag 
 #define Cflag gndo->ndo_Cflag 
+#define Gflag gndo->ndo_Gflag 
 #define Aflag gndo->ndo_Aflag 
+#define Bflag gndo->ndo_Bflag 
+#define Iflag gndo->ndo_Iflag 
 #define suppress_default_print gndo->ndo_suppress_default_print
 #define packettype gndo->ndo_packettype
 #define tcpmd5secret gndo->ndo_tcpmd5secret
 #define Wflag gndo->ndo_Wflag
 #define WflagChars gndo->ndo_WflagChars
 #define Cflag_count gndo->ndo_Cflag_count
+#define Gflag_count gndo->ndo_Gflag_count
+#define Gflag_time gndo->ndo_Gflag_time 
 #define snaplen     gndo->ndo_snaplen
 #define snapend     gndo->ndo_snapend
 
+#endif
index e232ae0..a01d0f0 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.11.2.1 2007/09/14 01:30:02 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.12 2007-09-14 01:29:28 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1982, 1986, 1993
  *     The Regents of the University of California.  All rights reserved.
index acf465c..e4f9fe1 100644 (file)
@@ -1,5 +1,5 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.6.4.1 2005/04/20 10:04:37 guy Exp $ (LBL) */
-/*     $NetBSD: ip6.h,v 1.9 2000/07/13 05:34:21 itojun Exp $   */
+/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.8 2007-08-29 02:31:44 mcr Exp $ (LBL) */
+/*     NetBSD: ip6.h,v 1.9 2000/07/13 05:34:21 itojun Exp      */
 /*     $KAME: ip6.h,v 1.9 2000/07/02 21:01:32 itojun Exp $     */
 
 /*
index f822d4a..438d115 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/ipfc.h,v 1.4 2002/12/11 07:13:53 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ipfc.h,v 1.4 2002-12-11 07:13:53 guy Exp $ (LBL)
  */
 
 struct ipfc_header {
index 66ea356..7b89afb 100755 (executable)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/ipproto.c,v 1.3.2.3 2005/09/20 06:05:37 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/ipproto.c,v 1.6 2005-09-20 06:01:22 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 7e0f785..f525786 100644 (file)
@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.4.2.2 2005/09/20 06:05:37 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.6 2005-09-20 06:01:22 guy Exp $ (LBL)
  *
  * From:
  *     @(#)in.h        8.3 (Berkeley) 1/3/94
index 83d05ea..554a258 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-/* YIPS @(#)$Id: ipsec_doi.h,v 1.7 2002/12/11 07:13:53 guy Exp $ */
+/* YIPS @(#)$Id: ipsec_doi.h,v 1.7 2002-12-11 07:13:53 guy Exp $ */
 
 /* refer to RFC 2407 */
 
index a8c1cd5..bfc3019 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IPX protocol formats
  *
- * @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.8 2002/12/11 07:13:54 guy Exp $
+ * @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.8 2002-12-11 07:13:54 guy Exp $
  */
 
 /* well-known sockets */
index 94fac40..85d383d 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-/* YIPS @(#)$Id: isakmp.h,v 1.10 2002/12/11 07:13:54 guy Exp $ */
+/* YIPS @(#)$Id: isakmp.h,v 1.11 2007-08-29 02:38:14 mcr Exp $ */
 
 /* refer to RFC 2408 */
 
@@ -81,7 +81,7 @@ typedef struct { /* i_cookie + r_cookie */
 #define ISAKMP_TIMER_DEFAULT     10 /* seconds */
 #define ISAKMP_TRY_DEFAULT        3 /* times */
 
-/* 3.1 ISAKMP Header Format
+/* 3.1 ISAKMP Header Format (IKEv1 and IKEv2)
          0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         !                          Initiator                            !
@@ -128,8 +128,11 @@ struct isakmp {
 #define ISAKMP_NPTYPE_D     12 /* Delete */
 #define ISAKMP_NPTYPE_VID   13 /* Vendor ID */
 
-#define ISAKMP_MAJOR_VERSION  1
-#define ISAKMP_MINOR_VERSION  0
+#define IKEv1_MAJOR_VERSION  1
+#define IKEv1_MINOR_VERSION  0
+
+#define IKEv2_MAJOR_VERSION  2
+#define IKEv2_MINOR_VERSION  0
 
 /* Exchange Type */
 #define ISAKMP_ETYPE_NONE   0 /* NONE */
@@ -142,6 +145,13 @@ struct isakmp {
 /* Flags */
 #define ISAKMP_FLAG_E 0x01 /* Encryption Bit */
 #define ISAKMP_FLAG_C 0x02 /* Commit Bit */
+#define ISAKMP_FLAG_extra 0x04
+
+/* IKEv2 */
+#define ISAKMP_FLAG_I (1 << 3)  /* (I)nitiator */
+#define ISAKMP_FLAG_V (1 << 4)  /* (V)ersion   */
+#define ISAKMP_FLAG_R (1 << 5)  /* (R)esponse  */
+
 
 /* 3.2 Payload Generic Header
          0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -151,7 +161,7 @@ struct isakmp {
 */
 struct isakmp_gen {
        u_int8_t  np;       /* Next Payload */
-       u_int8_t  reserved; /* RESERVED, unused, must set to 0 */
+       u_int8_t  critical; /* bit 7 - critical, rest is RESERVED */
        u_int16_t len;      /* Payload Length */
 };
 
@@ -188,7 +198,7 @@ struct isakmp_data {
        message of a Base Exchange (see Section 4.4) and the value "0" in the
        first message of an Identity Protect Exchange (see Section 4.5).
        */
-struct isakmp_pl_sa {
+struct ikev1_pl_sa {
        struct isakmp_gen h;
        u_int32_t doi; /* Domain of Interpretation */
        u_int32_t sit; /* Situation */
@@ -202,7 +212,7 @@ struct isakmp_pl_sa {
        last within the security association proposal, then this field will
        be 0.
        */
-struct isakmp_pl_p {
+struct ikev1_pl_p {
        struct isakmp_gen h;
        u_int8_t p_no;      /* Proposal # */
        u_int8_t prot_id;   /* Protocol */
@@ -218,7 +228,7 @@ struct isakmp_pl_p {
        then this field will be 3.  If the current Transform payload is the
        last within the proposal, then this field will be 0.
        */
-struct isakmp_pl_t {
+struct ikev1_pl_t {
        struct isakmp_gen h;
        u_int8_t  t_no;     /* Transform # */
        u_int8_t  t_id;     /* Transform-Id */
@@ -227,14 +237,14 @@ struct isakmp_pl_t {
 };
 
 /* 3.7 Key Exchange Payload */
-struct isakmp_pl_ke {
+struct ikev1_pl_ke {
        struct isakmp_gen h;
        /* Key Exchange Data */
 };
 
 /* 3.8 Identification Payload */
        /* MUST NOT to be used, because of being defined in ipsec-doi. */
-struct isakmp_pl_id {
+struct ikev1_pl_id {
        struct isakmp_gen h;
        union {
                u_int8_t  id_type;   /* ID Type */
@@ -244,7 +254,7 @@ struct isakmp_pl_id {
 };
 
 /* 3.9 Certificate Payload */
-struct isakmp_pl_cert {
+struct ikev1_pl_cert {
        struct isakmp_gen h;
        u_int8_t encode; /* Cert Encoding */
        char   cert;   /* Certificate Data */
@@ -268,7 +278,7 @@ struct isakmp_pl_cert {
 #define ISAKMP_CERT_SPKI   9
 
 /* 3.10 Certificate Request Payload */
-struct isakmp_pl_cr {
+struct ikev1_pl_cr {
        struct isakmp_gen h;
        u_int8_t num_cert; /* # Cert. Types */
        /*
@@ -283,27 +293,27 @@ struct isakmp_pl_cr {
 
 /* 3.11 Hash Payload */
        /* may not be used, because of having only data. */
-struct isakmp_pl_hash {
+struct ikev1_pl_hash {
        struct isakmp_gen h;
        /* Hash Data */
 };
 
 /* 3.12 Signature Payload */
        /* may not be used, because of having only data. */
-struct isakmp_pl_sig {
+struct ikev1_pl_sig {
        struct isakmp_gen h;
        /* Signature Data */
 };
 
 /* 3.13 Nonce Payload */
        /* may not be used, because of having only data. */
-struct isakmp_pl_nonce {
+struct ikev1_pl_nonce {
        struct isakmp_gen h;
        /* Nonce Data */
 };
 
 /* 3.14 Notification Payload */
-struct isakmp_pl_n {
+struct ikev1_pl_n {
        struct isakmp_gen h;
        u_int32_t doi;      /* Domain of Interpretation */
        u_int8_t  prot_id;  /* Protocol-ID */
@@ -347,7 +357,7 @@ struct isakmp_pl_n {
 #define ISAKMP_LOG_RETRY_LIMIT_REACHED           65530
 
 /* 3.15 Delete Payload */
-struct isakmp_pl_d {
+struct ikev1_pl_d {
        struct isakmp_gen h;
        u_int32_t doi;      /* Domain of Interpretation */
        u_int8_t  prot_id;  /* Protocol-Id */
@@ -357,15 +367,15 @@ struct isakmp_pl_d {
 };
 
 \f
-struct isakmp_ph1tab {
-       struct isakmp_ph1 *head;
-       struct isakmp_ph1 *tail;
+struct ikev1_ph1tab {
+       struct ikev1_ph1 *head;
+       struct ikev1_ph1 *tail;
        int len;
 };
 
 struct isakmp_ph2tab {
-       struct isakmp_ph2 *head;
-       struct isakmp_ph2 *tail;
+       struct ikev1_ph2 *head;
+       struct ikev1_ph2 *tail;
        int len;
 };
 
@@ -375,4 +385,99 @@ struct isakmp_ph2tab {
 #define PFS_NEED       1
 #define PFS_NONEED     0
 
+/* IKEv2 (RFC4306) */
+
+/* 3.3  Security Association Payload -- generic header */
+/* 3.3.1.  Proposal Substructure */
+struct ikev2_p {
+       struct isakmp_gen h;
+       u_int8_t p_no;      /* Proposal # */
+       u_int8_t prot_id;   /* Protocol */
+       u_int8_t spi_size;  /* SPI Size */
+       u_int8_t num_t;     /* Number of Transforms */
+};
+
+/* 3.3.2.  Transform Substructure */
+struct ikev2_t {
+       struct isakmp_gen h;
+       u_int8_t t_type;    /* Transform Type (ENCR,PRF,INTEG,etc.*/
+       u_int8_t res2;      /* reserved byte */
+       u_int16_t t_id;     /* Transform ID */
+};
+
+enum ikev2_t_type {
+       IV2_T_ENCR = 1,
+       IV2_T_PRF  = 2,
+       IV2_T_INTEG= 3,
+       IV2_T_DH   = 4,
+       IV2_T_ESN  = 5,
+};
+
+/* 3.4.  Key Exchange Payload */
+struct ikev2_ke {
+       struct isakmp_gen h;
+       u_int16_t  ke_group;
+       u_int16_t  ke_res1;
+       /* KE data */
+};
+
+
+/* 3.10 Notification Payload */
+struct ikev2_n {
+       struct isakmp_gen h;
+       u_int8_t  prot_id;  /* Protocol-ID */
+       u_int8_t  spi_size; /* SPI Size */
+       u_int16_t type;     /* Notify Message Type */
+       /* SPI */
+       /* Notification Data */
+};
+
+enum ikev2_n_type {
+       IV2_NOTIFY_UNSUPPORTED_CRITICAL_PAYLOAD            = 1,
+       IV2_NOTIFY_INVALID_IKE_SPI                         = 4,
+       IV2_NOTIFY_INVALID_MAJOR_VERSION                   = 5,
+       IV2_NOTIFY_INVALID_SYNTAX                          = 7,
+       IV2_NOTIFY_INVALID_MESSAGE_ID                      = 9,
+       IV2_NOTIFY_INVALID_SPI                             =11,
+       IV2_NOTIFY_NO_PROPOSAL_CHOSEN                      =14,
+       IV2_NOTIFY_INVALID_KE_PAYLOAD                      =17,
+       IV2_NOTIFY_AUTHENTICATION_FAILED                   =24,
+       IV2_NOTIFY_SINGLE_PAIR_REQUIRED                    =34,
+       IV2_NOTIFY_NO_ADDITIONAL_SAS                       =35,
+       IV2_NOTIFY_INTERNAL_ADDRESS_FAILURE                =36,
+       IV2_NOTIFY_FAILED_CP_REQUIRED                      =37,
+       IV2_NOTIFY_INVALID_SELECTORS                       =39,
+       IV2_NOTIFY_INITIAL_CONTACT                         =16384,
+       IV2_NOTIFY_SET_WINDOW_SIZE                         =16385,
+       IV2_NOTIFY_ADDITIONAL_TS_POSSIBLE                  =16386,
+       IV2_NOTIFY_IPCOMP_SUPPORTED                        =16387,
+       IV2_NOTIFY_NAT_DETECTION_SOURCE_IP                 =16388,
+       IV2_NOTIFY_NAT_DETECTION_DESTINATION_IP            =16389,
+       IV2_NOTIFY_COOKIE                                  =16390,
+       IV2_NOTIFY_USE_TRANSPORT_MODE                      =16391,
+       IV2_NOTIFY_HTTP_CERT_LOOKUP_SUPPORTED              =16392,
+       IV2_NOTIFY_REKEY_SA                                =16393,
+       IV2_NOTIFY_ESP_TFC_PADDING_NOT_SUPPORTED           =16394,
+       IV2_NOTIFY_NON_FIRST_FRAGMENTS_ALSO                =16395
+};
+
+struct notify_messages {
+       u_int16_t type;
+       char     *msg;
+};
+
+/* 3.8 Notification Payload */
+struct ikev2_auth {
+       struct isakmp_gen h;
+       u_int8_t  auth_method;  /* Protocol-ID */
+       u_int8_t  reserved[3];
+       /* authentication data */
+};
+
+enum ikev2_auth_type {
+       IV2_RSA_SIG = 1,
+       IV2_SHARED  = 2,
+       IV2_DSS_SIG = 3,
+};
+
 #endif /* !defined(_ISAKMP_H_) */
index 1568883..5be24b9 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/l2tp.h,v 1.5 2001/11/05 10:03:27 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/l2tp.h,v 1.5 2001-11-05 10:03:27 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
  *      The Regents of the University of California.  All rights reserved.
index d98e69a..a822191 100755 (executable)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/l2vpn.c,v 1.1 2004/06/15 09:42:40 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/l2vpn.c,v 1.1 2004-06-15 09:42:40 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 64eb024..766cda5 100755 (executable)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/l2vpn.h,v 1.1 2004/06/15 09:42:41 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/l2vpn.h,v 1.1 2004-06-15 09:42:41 hannes Exp $ (LBL) */
 /* 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that: (1) source code
index 51b6e19..76cc020 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-/* $Id: lane.h,v 1.7 2002/12/11 07:13:54 guy Exp $ */
+/* $Id: lane.h,v 1.7 2002-12-11 07:13:54 guy Exp $ */
 
 #ifndef ETHER_ADDR_LEN
 #define ETHER_ADDR_LEN 6
index fc04c67..faa7256 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.17.2.4 2007/02/08 07:07:51 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.23 2007-04-13 09:43:11 hannes Exp $ (LBL)
  */
 
 /*
 #define        PID_CISCO_CDP           0x2000  /* Cisco Discovery Protocol */
 #define        PID_CISCO_VTP           0x2003  /* Cisco VLAN Trunk Protocol */
 #define        PID_CISCO_DTP           0x2004  /* Cisco Dynamic Trunk Protocol */
+#define        PID_CISCO_UDLD          0x0111  /* Unidirectional Link Detection */
+#define        PID_CISCO_PVST          0x010b  /* Per VLAN Spanning Tree+ and RPVST+ */
 
 /*
  * PIDs for use with OUI_RFC2684.
index 5b04503..2bcf317 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.13 2003/12/15 03:53:21 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.13 2003-12-15 03:53:21 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 8d49a7a..6328c82 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/machdep.h,v 1.2 2000/01/17 06:24:24 itojun Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/machdep.h,v 1.2 2000-01-17 06:24:24 itojun Exp $ (LBL)
  */
 #ifndef tcpdump_machdep_h
 #define tcpdump_machdep_h
index 2c80bef..b59e2f1 100755 (executable)
@@ -27,7 +27,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
-# @(#) $Id: makemib,v 1.3 2001/09/17 22:16:52 fenner Exp $ (jlv)
+# @(#) $Id: makemib,v 1.3 2001-09-17 22:16:52 fenner Exp $ (jlv)
 
 #
 # This script will read either ASN.1-style MIB files or the ".defs" files
index 69fc9c9..ae1c97e 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/mpls.h,v 1.1 2004/06/14 14:47:58 hannes Exp $ (LBL)
+/* @(#) $Header: /tcpdump/master/tcpdump/mpls.h,v 1.1 2004-06-14 14:47:58 hannes Exp $ (LBL)
  * Copyright (C) 2001 WIDE Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index e6391f4..f441f3e 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/nameser.h,v 1.14.4.2 2006/11/10 03:15:35 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/nameser.h,v 1.16 2006-11-10 03:18:21 guy Exp $ (LBL) */
 /*
  * Copyright (c) 1983, 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
index 34abeba..d3e2725 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * NETBIOS protocol formats
  *
- * @(#) $Header: /tcpdump/master/tcpdump/netbios.h,v 1.3 2002/12/11 07:13:55 guy Exp $
+ * @(#) $Header: /tcpdump/master/tcpdump/netbios.h,v 1.3 2002-12-11 07:13:55 guy Exp $
  */
 
 struct p8022Hdr {
index 3609455..cd6f2f1 100644 (file)
@@ -21,7 +21,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.16.2.4 2006/02/08 01:40:09 hannes Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.23.2.2 2008-04-04 19:42:52 guy Exp $ (LBL)
  */
 
 #ifndef netdissect_h
@@ -77,6 +77,7 @@ extern const char *tok2strbuf(const struct tok *, const char *, int,
 /* tok2str is deprecated */
 extern const char *tok2str(const struct tok *, const char *, int);
 extern char *bittok2str(const struct tok *, const char *, int);
+extern char *bittok2str_nosep(const struct tok *, const char *, int);
 
 
 typedef struct netdissect_options netdissect_options;
@@ -85,6 +86,7 @@ struct netdissect_options {
   int ndo_aflag;               /* translate network and broadcast addresses */
   int ndo_eflag;               /* print ethernet header */
   int ndo_fflag;               /* don't translate "foreign" IP address */
+  int ndo_Kflag;               /* don't check TCP checksums */
   int ndo_nflag;               /* leave addresses as numbers */
   int ndo_Nflag;               /* remove domains from printed host names */
   int ndo_qflag;               /* quick (shorter) output */
@@ -100,12 +102,17 @@ struct netdissect_options {
   int ndo_Aflag;               /* print packet only in ascii observing TAB,
                                 * LF, CR and SPACE as graphical chars
                                 */
+  int ndo_Bflag;               /* buffer size */
+  int ndo_Iflag;               /* rfmon (monitor) mode */
   int ndo_Oflag;                /* run filter code optimizer */
   int ndo_dlt;                  /* if != -1, ask libpcap for the DLT it names*/
   int ndo_pflag;                /* don't go promiscuous */
 
   int ndo_Cflag;                /* rotate dump files after this many bytes */ 
   int ndo_Cflag_count;      /* Keep track of which file number we're writing */
+  int ndo_Gflag;            /* rotate dump files after this many seconds */
+  int ndo_Gflag_count;      /* number of files created with Gflag rotation */
+  time_t ndo_Gflag_time;    /* The last time_t the dump file was rotated. */
   int ndo_Wflag;          /* recycle output files after this number of files */
   int ndo_WflagChars;
   int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
@@ -245,7 +252,7 @@ extern const char *dnnum_string(netdissect_options *, u_short);
 #include <pcap.h>
 
 
-extern void eap_print(netdissect_options *,const u_char *, u_int);    
+extern void eap_print(netdissect_options *,const u_char *, u_int);
 extern int esp_print(netdissect_options *,
                     register const u_char *bp, int len, register const u_char *bp2,
                     int *nhdr, int *padlen);
@@ -258,6 +265,7 @@ extern void ip_print(netdissect_options *,const u_char *, u_int);
 extern void ip_print_inner(netdissect_options *ndo,
                           const u_char *bp, u_int length, u_int nh,
                           const u_char *bp2);
+extern void rrcp_print(netdissect_options *,const u_char *, u_int);
 
 /* stuff that has not yet been rototiled */
 #if 0
index 3d47c7d..bf6c983 100644 (file)
@@ -1,5 +1,5 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/nfs.h,v 1.7 2002/12/11 07:13:55 guy Exp $ (LBL) */
-/*     $NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp $     */
+/* @(#) $Header: /tcpdump/master/tcpdump/nfs.h,v 1.8.2.1 2007-11-18 03:24:55 guy Exp $ (LBL) */
+/*     NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -286,21 +286,6 @@ struct nfs_uquad {
 };
 typedef        struct nfs_uquad        nfsuint64;
 
-#if 0 /* XXX - this doesn't seemed to be used and it doesn't work
-       * with non-gcc, so comment it out for now.
-       */
-
-/*
- * Used to convert between two u_longs and a u_quad_t.
- */
-union nfs_quadconvert {
-       u_int32_t lval[2];
-       u_int64_t qval;
-};
-typedef union nfs_quadconvert  nfsquad_t;
-
-#endif
-
 /*
  * NFS Version 3 special file number.
  */
index b8a82e4..0bca424 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/nfsfh.h,v 1.13 2002/04/24 06:27:05 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/nfsfh.h,v 1.13 2002-04-24 06:27:05 guy Exp $ (LBL) */
 
 /*
  * Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation,
index 7dfd6a6..47ebb53 100755 (executable)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/nlpid.c,v 1.4 2004/10/19 15:27:55 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/nlpid.c,v 1.4 2004-10-19 15:27:55 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index fdca446..31f6b66 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/nlpid.h,v 1.4 2004/10/19 15:27:55 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/nlpid.h,v 1.4 2004-10-19 15:27:55 hannes Exp $ (LBL) */
 /* 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that: (1) source code
index df85669..0614f73 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.8 2004/01/28 14:34:50 hannes Exp $ */
+/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.8 2004-01-28 14:34:50 hannes Exp $ */
 
 /*
  * Based on ntp.h from the U of MD implementation
index f40d607..ad32817 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-/* YIPS @(#)$Id: oakley.h,v 1.4 2002/12/11 07:13:56 guy Exp $ */
+/* YIPS @(#)$Id: oakley.h,v 1.4 2002-12-11 07:13:56 guy Exp $ */
 
 /* refer to RFC 2409 */
 
index 91a904f..2b1c6ee 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.16.2.2 2006/12/13 08:24:27 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.23 2007-10-08 07:53:21 hannes Exp $ (LBL) */
 /*
  * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
  *     The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
 /* Options field
  *
  * +------------------------------------+
- * | * | O | DC | EA | N/P | MC | E | T |
+ * | DN | O | DC | L | N/P | MC | E | T |
  * +------------------------------------+
  *
  */
@@ -41,6 +41,7 @@
 #define        OSPF_OPTION_MC  0x04    /* MC bit: Multicast capable */
 #define        OSPF_OPTION_NP  0x08    /* N/P bit: NSSA capable */
 #define        OSPF_OPTION_EA  0x10    /* EA bit: External Attribute capable */
+#define        OSPF_OPTION_L   0x10    /* L bit: Packet contains LLS data block */
 #define        OSPF_OPTION_DC  0x20    /* DC bit: Demand circuit capable */
 #define        OSPF_OPTION_O   0x40    /* O bit: Opaque LSA capable */
 #define        OSPF_OPTION_DN  0x80    /* DN bit: Up/Down Bit capable - draft-ietf-ospf-2547-dnbit-04 */
 #define OSPF_AUTH_MD5_LEN      16      /* length of MD5 authentication */
 
 /* db_flags    */
-#define        OSPF_DB_INIT            0x04        /*  */
+#define        OSPF_DB_INIT            0x04
 #define        OSPF_DB_MORE            0x02
-#define        OSPF_DB_MASTER          0x01
+#define        OSPF_DB_MASTER          0x01
+#define OSPF_DB_RESYNC          0x08  /* RFC4811 */
 
 /* ls_type     */
 #define        LS_TYPE_ROUTER          1   /* router link */
 #define LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW            7 /* rfc3630 */
 #define LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW              8 /* rfc3630 */
 #define LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP           9 /* rfc3630 */
-#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* draft-ietf-ccamp-ospf-gmpls-extensions */
-#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE 14 /* draft-ietf-ccamp-ospf-gmpls-extensions */
-#define LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR    15 /* draft-ietf-ccamp-ospf-gmpls-extensions */
-#define LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP    16 /* draft-ietf-ccamp-ospf-gmpls-extensions */
+#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* rfc4203 */
+#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE 14 /* rfc4203 */
+#define LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR    15 /* rfc4203 */
+#define LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP    16 /* rfc4203 */
 #define LS_OPAQUE_TE_LINK_SUBTLV_BW_CONSTRAINTS       17 /* rfc4124 */
 
 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP        1  /* rfc3630 */
 
 #define LS_OPAQUE_RI_TLV_CAP             1 /* draft-ietf-ospf-cap-03 */
 
-/*************************************************
- *
- * is the above a bug in the documentation?
- *
- *************************************************/
-
 
 /* rla_link.link_type  */
 #define        RLA_TYPE_ROUTER         1   /* point-to-point to another router */
 #define        MCLA_VERTEX_ROUTER      1
 #define        MCLA_VERTEX_NETWORK     2
 
+/* Link-Local-Signaling */
+#define OSPF_LLS_EO             1  /* RFC4811, RFC4812 */
+#define OSPF_LLS_MD5            2  /* RFC4813 */
+
+#define OSPF_LLS_EO_LR         0x00000001              /* RFC4811 */
+#define OSPF_LLS_EO_RS         0x00000002              /* RFC4812 */
+
+/*
+ * TOS metric struct (will be 0 or more in router links update)
+ */
+struct tos_metric {
+    u_int8_t tos_type;
+    u_int8_t reserved;
+    u_int8_t tos_metric[2];
+};
+struct tos_link {
+    u_int8_t link_type;
+    u_int8_t link_tos_count;
+    u_int8_t tos_metric[2];
+};
+union un_tos {
+    struct tos_link link;
+    struct tos_metric metrics;
+};
+
 /* link state advertisement header */
 struct lsa_hdr {
     u_int16_t ls_age;
@@ -172,9 +193,7 @@ struct lsa {
            struct rlalink {
                struct in_addr link_id;
                struct in_addr link_data;
-               u_int8_t link_type;
-               u_int8_t link_toscount;
-               u_int16_t link_tos0metric;
+                union un_tos un_tos;
            } rla_link[1];              /* may repeat   */
        } un_rla;
 
@@ -235,16 +254,6 @@ struct lsa {
     } lsa_un;
 };
 
-
-/*
- * TOS metric struct (will be 0 or more in router links update)
- */
-struct tos_metric {
-    u_int8_t tos_type;
-    u_int8_t tos_zero;
-    u_int16_t tos_metric;
-};
-
 #define        OSPF_AUTH_SIZE  8
 
 /*
@@ -275,7 +284,7 @@ struct ospfhdr {
 
        /* Database Description packet */
        struct {
-           u_int8_t db_zero[2];
+           u_int16_t db_ifmtu;
            u_int8_t db_options;
            u_int8_t db_flags;
            u_int32_t db_seq;
@@ -314,3 +323,6 @@ struct ospfhdr {
 #define        ospf_lsu        ospf_un.un_lsu
 #define        ospf_lsa        ospf_un.un_lsa
 
+/* Functions shared by ospf and ospf6 */
+extern int ospf_print_te_lsa(u_int8_t *, u_int);
+extern int ospf_print_grace_lsa(u_int8_t *, u_int);
index b8298ea..e2eabee 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.6 2002/12/11 07:13:56 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.7 2006-09-05 15:50:26 hannes Exp $ (LBL) */
 /*
  * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
  *     The Regents of the University of California.  All rights reserved.
  *
  * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
  */
-#define        OSPF_TYPE_UMD   0       /* UMd's special monitoring packets */
-#define        OSPF_TYPE_HELLO 1       /* Hello */
-#define        OSPF_TYPE_DB    2       /* Database Description */
-#define        OSPF_TYPE_LSR   3       /* Link State Request */
-#define        OSPF_TYPE_LSU   4       /* Link State Update */
-#define        OSPF_TYPE_LSA   5       /* Link State Ack */
-#define        OSPF_TYPE_MAX   6
+#define        OSPF_TYPE_HELLO         1       /* Hello */
+#define        OSPF_TYPE_DD            2       /* Database Description */
+#define        OSPF_TYPE_LS_REQ        3       /* Link State Request */
+#define        OSPF_TYPE_LS_UPDATE     4       /* Link State Update */
+#define        OSPF_TYPE_LS_ACK        5       /* Link State Ack */
 
 /* Options *_options   */
 #define OSPF6_OPTION_V6        0x01    /* V6 bit: A bit for peeping tom */
 #define        LS_TYPE_INTER_AR        4   /* Inter-Area-Router */
 #define        LS_TYPE_ASE             5   /* ASE */
 #define        LS_TYPE_GROUP           6   /* Group membership */
-#define        LS_TYPE_TYPE7           7   /* Type 7 LSA */
+#define        LS_TYPE_NSSA            7   /* NSSA */
 #define        LS_TYPE_LINK            8   /* Link LSA */
 #define        LS_TYPE_INTRA_AP        9   /* Intra-Area-Prefix */
-#define        LS_TYPE_MAX             10
+#define LS_TYPE_INTRA_ATE       10  /* Intra-Area-TE */
+#define LS_TYPE_GRACE           11  /* Grace LSA */
 #define LS_TYPE_MASK           0x1fff
 
 #define LS_SCOPE_LINKLOCAL     0x0000
 #define LS_SCOPE_AREA          0x2000
 #define LS_SCOPE_AS            0x4000
 #define LS_SCOPE_MASK          0x6000
-
-/*************************************************
- *
- * is the above a bug in the documentation?
- *
- *************************************************/
-
+#define LS_SCOPE_U              0x8000
 
 /* rla_link.link_type  */
 #define        RLA_TYPE_ROUTER         1   /* point-to-point to another router */
 #define        RLA_FLAG_E      0x02
 #define        RLA_FLAG_V      0x04
 #define        RLA_FLAG_W      0x08
+#define RLA_FLAG_N      0x10
+
+/* lsa_prefix options */
+#define LSA_PREFIX_OPT_NU 0x01
+#define LSA_PREFIX_OPT_LA 0x02
+#define LSA_PREFIX_OPT_MC 0x04
+#define LSA_PREFIX_OPT_P  0x08
+#define LSA_PREFIX_OPT_DN 0x10
 
 /* sla_tosmetric breakdown     */
 #define        SLA_MASK_TOS            0x7f000000
 #define SLA_SHIFT_TOS          24
 
 /* asla_metric */
-#define ASLA_FLAG_EXTERNAL     0x04000000
 #define ASLA_FLAG_FWDADDR      0x02000000
 #define ASLA_FLAG_ROUTETAG     0x01000000
 #define        ASLA_MASK_METRIC        0x00ffffff
 
-/* multicast vertex type */
-#define        MCLA_VERTEX_ROUTER      1
-#define        MCLA_VERTEX_NETWORK     2
-
 typedef u_int32_t rtrid_t;
 
 /* link state advertisement header */
-struct lsa_hdr {
+struct lsa6_hdr {
     u_int16_t ls_age;
     u_int16_t ls_type;
     rtrid_t ls_stateid;
@@ -107,16 +103,16 @@ struct lsa_hdr {
     u_int16_t ls_length;
 };
 
-struct lsa_prefix {
+struct lsa6_prefix {
     u_int8_t lsa_p_len;
     u_int8_t lsa_p_opt;
-    u_int16_t lsa_p_mbz;
+    u_int16_t lsa_p_metric;
     u_int8_t lsa_p_prefix[4];
 };
 
 /* link state advertisement */
-struct lsa {
-    struct lsa_hdr ls_hdr;
+struct lsa6 {
+    struct lsa6_hdr ls_hdr;
 
     /* Link state types */
     union {
@@ -128,7 +124,7 @@ struct lsa {
            } rla_flgandopt;
 #define rla_flags      rla_flgandopt.flg
 #define rla_options    rla_flgandopt.opt
-           struct rlalink {
+           struct rlalink6 {
                u_int8_t link_type;
                u_int8_t link_zero[1];
                u_int16_t link_metric;
@@ -147,13 +143,13 @@ struct lsa {
        /* Inter Area Prefix LSA */
        struct {
            u_int32_t inter_ap_metric;
-           struct lsa_prefix inter_ap_prefix[1];
+           struct lsa6_prefix inter_ap_prefix[1];
        } un_inter_ap;
 
        /* AS external links advertisements */
        struct {
            u_int32_t asla_metric;
-           struct lsa_prefix asla_prefix[1];
+           struct lsa6_prefix asla_prefix[1];
            /* some optional fields follow */
        } un_asla;
 
@@ -183,7 +179,7 @@ struct lsa {
 #define llsa_options   llsa_priandopt.opt
            struct in6_addr llsa_lladdr;
            u_int32_t llsa_nprefix;
-           struct lsa_prefix llsa_prefix[1];
+           struct lsa6_prefix llsa_prefix[1];
        } un_llsa;
 
        /* Intra-Area-Prefix */
@@ -192,21 +188,12 @@ struct lsa {
            u_int16_t intra_ap_lstype;
            rtrid_t intra_ap_lsid;
            rtrid_t intra_ap_rtid;
-           struct lsa_prefix intra_ap_prefix[1];
+           struct lsa6_prefix intra_ap_prefix[1];
        } un_intra_ap;
     } lsa_un;
 };
 
 
-/*
- * TOS metric struct (will be 0 or more in router links update)
- */
-struct tos_metric {
-    u_int8_t tos_type;
-    u_int8_t tos_zero;
-    u_int16_t tos_metric;
-};
-
 #define        OSPF_AUTH_SIZE  8
 
 /*
@@ -246,11 +233,11 @@ struct ospf6hdr {
            u_int8_t db_mbz;
            u_int8_t db_flags;
            u_int32_t db_seq;
-           struct lsa_hdr db_lshdr[1]; /* may repeat   */
+           struct lsa6_hdr db_lshdr[1]; /* may repeat  */
        } un_db;
 
        /* Link State Request */
-       struct lsr {
+       struct lsr6 {
            u_int16_t ls_mbz;
            u_int16_t ls_type;
            rtrid_t ls_stateid;
@@ -260,12 +247,12 @@ struct ospf6hdr {
        /* Link State Update */
        struct {
            u_int32_t lsu_count;
-           struct lsa lsu_lsa[1]; /* may repeat        */
+           struct lsa6 lsu_lsa[1]; /* may repeat       */
        } un_lsu;
 
        /* Link State Acknowledgement */
        struct {
-           struct lsa_hdr lsa_lshdr[1]; /* may repeat  */
+           struct lsa6_hdr lsa_lshdr[1]; /* may repeat */
        } un_lsa ;
     } ospf6_un ;
 };
index 7cdcd40..e6569d4 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.4.2.1 2005/04/17 01:20:56 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.8.2.1 2008-01-09 09:44:39 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -39,6 +39,9 @@ struct tok oui_values[] = {
     { OUI_APPLETALK, "Appletalk" },
     { OUI_JUNIPER, "Juniper" },
     { OUI_HP, "Hewlett-Packard" },
+    { OUI_IEEE_8021_PRIVATE, "IEEE 802.1 Private"},
+    { OUI_IEEE_8023_PRIVATE, "IEEE 802.3 Private"},
+    { OUI_TIA, "ANSI/TIA"},
     { 0, NULL }
 };
 
index 4d79e19..e70f82a 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.3.2.1 2005/04/17 01:20:56 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.7.2.1 2008-01-09 09:44:39 hannes Exp $ (LBL) */
 /* 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that: (1) source code
@@ -27,6 +27,9 @@ extern struct tok smi_values[];
 #define OUI_APPLETALK   0x080007        /* Appletalk */
 #define OUI_JUNIPER     0x009069        /* Juniper */
 #define OUI_HP          0x080009        /* Hewlett-Packard */
+#define OUI_IEEE_8021_PRIVATE 0x0080c2      /* IEEE 802.1 Organisation Specific - Annex F */
+#define OUI_IEEE_8023_PRIVATE 0x00120f      /* IEEE 802.3 Organisation Specific - Annex G */
+#define OUI_TIA         0x0012bb        /* TIA - Telecommunications Industry Association - ANSI/TIA-1057- 2006 */
 
 /*
  * These are SMI Network Management Private Enterprise Codes for
index ef1e0ba..d5f877d 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.28.2.1 2007/06/15 19:15:04 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.29 2006-06-13 22:21:38 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 1f2fcb4..5c0ece2 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.2.2.1 2005/06/03 22:10:16 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.3 2005-06-03 22:08:52 guy Exp $ (LBL)
  */
 
 #ifndef tcpdump_pcap_missing_h
index 438cd29..6eb3a4a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/pcap_dump_ftell.c,v 1.1.2.1 2005/06/03 22:10:17 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/pcap_dump_ftell.c,v 1.1 2005-06-03 22:08:52 guy Exp $ (LBL)";
 #endif
 
 #include <stdio.h>
diff --git a/contrib/tcpdump/pf.h b/contrib/tcpdump/pf.h
deleted file mode 100644 (file)
index c2d332a..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2001 Daniel Hartmeier
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *    - Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer. 
- *    - 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. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
- * COPYRIGHT HOLDERS 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.
- *
- * @(#) $Header: /tcpdump/master/tcpdump/pf.h,v 1.2 2004/04/02 06:36:25 guy Exp $ (LBL)
- */
-
-/*     from $OpenBSD: pfvar.h,v 1.170 2003/08/22 21:50:34 david Exp $ */
-
-enum   { PF_INOUT=0, PF_IN=1, PF_OUT=2 };
-enum   { PF_PASS=0, PF_DROP=1, PF_SCRUB=2, PF_NAT=3, PF_NONAT=4,
-         PF_BINAT=5, PF_NOBINAT=6, PF_RDR=7, PF_NORDR=8, PF_SYNPROXY_DROP=9 };
-
-/* Reasons code for passing/dropping a packet */
-#define PFRES_MATCH    0               /* Explicit match of a rule */
-#define PFRES_BADOFF   1               /* Bad offset for pull_hdr */
-#define PFRES_FRAG     2               /* Dropping following fragment */
-#define PFRES_SHORT    3               /* Dropping short packet */
-#define PFRES_NORM     4               /* Dropping by normalizer */
-#define PFRES_MEMORY   5               /* Dropped due to lacking mem */
-#define PFRES_MAX      6               /* total+1 */
-
-#define PFRES_NAMES { \
-       "match", \
-       "bad-offset", \
-       "fragment", \
-       "short", \
-       "normalize", \
-       "memory", \
-       NULL \
-}
-
-#define PF_RULESET_NAME_SIZE   16
-
-/*     from $OpenBSD: if_pflog.h,v 1.9 2003/07/15 20:27:27 dhartmei Exp $ */
-
-#ifndef IFNAMSIZ
-#define        IFNAMSIZ        16
-#endif
-
-struct pfloghdr {
-       u_int8_t        length;
-       u_int8_t        af;
-       u_int8_t        action;
-       u_int8_t        reason;
-       char            ifname[IFNAMSIZ];
-       char            ruleset[PF_RULESET_NAME_SIZE];
-       u_int32_t       rulenr;
-       u_int32_t       subrulenr;
-       u_int8_t        dir;
-       u_int8_t        pad[3];
-};
-#define PFLOG_HDRLEN           sizeof(struct pfloghdr)
index f93e841..67ad626 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.1.2.2 2005/04/27 21:44:06 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.3 2005-04-27 21:43:48 guy Exp $ (LBL) */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
index 71621ca..f1a2c48 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.16 2004/10/20 16:14:16 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.16 2004-10-20 16:14:16 hannes Exp $ (LBL) */
 /*
  * Point to Point Protocol (PPP) RFC1331
  *
index 21e316d..835d21b 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.15 2007/07/22 23:14:14 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.47.2.2 2007-12-29 23:25:28 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -264,7 +264,7 @@ parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset)
 
                        if (pbody->tim.length <= 3)
                                break;
-                       if (pbody->tim.length - 3 > sizeof pbody->tim.bitmap)
+                       if (pbody->tim.length - 3 > (int)sizeof pbody->tim.bitmap)
                                return;
                        if (!TTEST2(*(p + offset), pbody->tim.length - 3))
                                return;
@@ -1209,6 +1209,11 @@ ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
 {
        u_int32_t caphdr_len;
 
+       if (caplen < 8) {
+               printf("[|802.11]");
+               return caplen;
+       }
+
        caphdr_len = EXTRACT_32BITS(p + 4);
        if (caphdr_len < 8) {
                /*
@@ -1231,32 +1236,38 @@ ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
 
 #define PRISM_HDR_LEN          144
 
+#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
 #define WLANCAP_MAGIC_COOKIE_V1        0x80211001
+#define WLANCAP_MAGIC_COOKIE_V2        0x80211002
 
 /*
  * For DLT_PRISM_HEADER; like DLT_IEEE802_11, but with an extra header,
  * containing information such as radio information, which we
  * currently ignore.
  *
- * If, however, the packet begins with WLANCAP_MAGIC_COOKIE_V1, it's
- * really DLT_IEEE802_11_RADIO (currently, on Linux, there's no
- * ARPHRD_ type for DLT_IEEE802_11_RADIO, as there is a
- * ARPHRD_IEEE80211_PRISM for DLT_PRISM_HEADER, so
- * ARPHRD_IEEE80211_PRISM is used for DLT_IEEE802_11_RADIO, and
- * the first 4 bytes of the header are used to indicate which it is).
+ * If, however, the packet begins with WLANCAP_MAGIC_COOKIE_V1 or
+ * WLANCAP_MAGIC_COOKIE_V2, it's really DLT_IEEE802_11_RADIO_AVS
+ * (currently, on Linux, there's no ARPHRD_ type for
+ * DLT_IEEE802_11_RADIO_AVS, as there is a ARPHRD_IEEE80211_PRISM
+ * for DLT_PRISM_HEADER, so ARPHRD_IEEE80211_PRISM is used for
+ * the AVS header, and the first 4 bytes of the header are used to
+ * indicate whether it's a Prism header or an AVS header).
  */
 u_int
 prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
        u_int length = h->len;
+       u_int32_t msgcode;
 
        if (caplen < 4) {
                printf("[|802.11]");
                return caplen;
        }
 
-       if (EXTRACT_32BITS(p) == WLANCAP_MAGIC_COOKIE_V1)
+       msgcode = EXTRACT_32BITS(p);
+       if (msgcode == WLANCAP_MAGIC_COOKIE_V1 ||
+           msgcode == WLANCAP_MAGIC_COOKIE_V2)
                return ieee802_11_avs_radio_print(p, length, caplen);
 
        if (caplen < PRISM_HDR_LEN) {
@@ -1270,19 +1281,21 @@ prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
 
 /*
  * For DLT_IEEE802_11_RADIO; like DLT_IEEE802_11, but with an extra
- * header, containing information such as radio information, which we
- * currently ignore.
+ * header, containing information such as radio information.
  */
 u_int
 ieee802_11_radio_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
-       u_int caplen = h->caplen;
-       u_int length = h->len;
-
-       if (caplen < 8) {
-               printf("[|802.11]");
-               return caplen;
-       }
+       return ieee802_11_radio_print(p, h->len, h->caplen);
+}
 
-       return ieee802_11_radio_print(p, length, caplen);
+/*
+ * For DLT_IEEE802_11_RADIO_AVS; like DLT_IEEE802_11, but with an
+ * extra header, containing information such as radio information,
+ * which we currently ignore.
+ */
+u_int
+ieee802_11_radio_avs_if_print(const struct pcap_pkthdr *h, const u_char *p)
+{
+       return ieee802_11_avs_radio_print(p, h->len, h->caplen);
 }
index 92ed909..ecd106b 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.22 2003/11/19 00:36:06 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.22 2003-11-19 00:36:06 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 80a547d..c5f6622 100644 (file)
@@ -32,7 +32,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-aodv.c,v 1.11 2004/03/24 00:30:19 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-aodv.c,v 1.11 2004-03-24 00:30:19 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index a01ce34..dd9bc5a 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.3.2.1 2005/07/07 01:24:33 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.5 2006-02-11 22:12:06 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -60,8 +60,8 @@ ap1394_hdr_print(register const u_char *bp, u_int length)
        fp = (const struct firewire_header *)bp;
 
        (void)printf("%s > %s",
-                    linkaddr_string(fp->firewire_dhost, FIREWIRE_EUI64_LEN),
-                    linkaddr_string(fp->firewire_shost, FIREWIRE_EUI64_LEN));
+                    linkaddr_string(fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN),
+                    linkaddr_string(fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN));
 
        if (!qflag) {
                (void)printf(", ethertype %s (0x%04x)",
index 63f9c21..48a4303 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.20 2005/04/06 21:32:38 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.20 2005-04-06 21:32:38 mcr Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 68e9dc6..0ca86cf 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.64 2004/04/30 16:42:14 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.66 2006-03-03 22:53:21 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -49,24 +49,27 @@ static const char rcsid[] _U_ =
  * arp_tha and arp_tpa in that order, according to the lengths
  * specified.  Field names used correspond to RFC 826.
  */
-struct arp_pkthdr {
-       u_short ar_hrd;         /* format of hardware address */
-#define ARPHRD_ETHER   1       /* ethernet hardware format */
-#define ARPHRD_IEEE802 6       /* token-ring hardware format */
-#define ARPHRD_ARCNET  7       /* arcnet hardware format */
-#define ARPHRD_FRELAY  15      /* frame relay hardware format */
-#define ARPHRD_STRIP   23      /* Ricochet Starmode Radio hardware format */
-#define ARPHRD_IEEE1394        24      /* IEEE 1394 (FireWire) hardware format */
-       u_short ar_pro;         /* format of protocol address */
-       u_char  ar_hln;         /* length of hardware address */
-       u_char  ar_pln;         /* length of protocol address */
-       u_short ar_op;          /* one of: */
-#define        ARPOP_REQUEST   1       /* request to resolve address */
-#define        ARPOP_REPLY     2       /* response to previous request */
-#define        ARPOP_REVREQUEST 3      /* request protocol address given hardware */
-#define        ARPOP_REVREPLY  4       /* response giving protocol address */
-#define ARPOP_INVREQUEST 8     /* request to identify peer */
-#define ARPOP_INVREPLY 9       /* response identifying peer */
+struct  arp_pkthdr {
+        u_short ar_hrd;         /* format of hardware address */
+#define ARPHRD_ETHER    1       /* ethernet hardware format */
+#define ARPHRD_IEEE802  6       /* token-ring hardware format */
+#define ARPHRD_ARCNET   7       /* arcnet hardware format */
+#define ARPHRD_FRELAY   15      /* frame relay hardware format */
+#define ARPHRD_ATM2225  19      /* ATM (RFC 2225) */
+#define ARPHRD_STRIP    23      /* Ricochet Starmode Radio hardware format */
+#define ARPHRD_IEEE1394 24      /* IEEE 1394 (FireWire) hardware format */
+        u_short ar_pro;         /* format of protocol address */
+        u_char  ar_hln;         /* length of hardware address */
+        u_char  ar_pln;         /* length of protocol address */
+        u_short ar_op;          /* one of: */
+#define ARPOP_REQUEST   1       /* request to resolve address */
+#define ARPOP_REPLY     2       /* response to previous request */
+#define ARPOP_REVREQUEST 3      /* request protocol address given hardware */
+#define ARPOP_REVREPLY  4       /* response giving protocol address */
+#define ARPOP_INVREQUEST 8      /* request to identify peer */
+#define ARPOP_INVREPLY  9       /* response identifying peer */
+#define ARPOP_NAK       10      /* NAK - only valif for ATM ARP */
+
 /*
  * The remaining fields are variable in size,
  * according to the sizes above.
@@ -86,8 +89,8 @@ struct        arp_pkthdr {
 #define ARP_HDRLEN     8
 
 #define HRD(ap) EXTRACT_16BITS(&(ap)->ar_hrd)
-#define HLN(ap) ((ap)->ar_hln)
-#define PLN(ap) ((ap)->ar_pln)
+#define HRD_LEN(ap) ((ap)->ar_hln)
+#define PROTO_LEN(ap) ((ap)->ar_pln)
 #define OP(ap)  EXTRACT_16BITS(&(ap)->ar_op)
 #define PRO(ap) EXTRACT_16BITS(&(ap)->ar_pro)
 #define SHA(ap) (ar_sha(ap))
@@ -95,6 +98,29 @@ struct       arp_pkthdr {
 #define THA(ap) (ar_tha(ap))
 #define TPA(ap) (ar_tpa(ap))
 
+
+struct tok arpop_values[] = {
+    { ARPOP_REQUEST, "Request" },
+    { ARPOP_REPLY, "Reply" },
+    { ARPOP_REVREQUEST, "Reverse Request" },
+    { ARPOP_REVREPLY, "Reverse Reply" },
+    { ARPOP_INVREQUEST, "Inverse Request" },
+    { ARPOP_INVREPLY, "Inverse Reply" },
+    { ARPOP_NAK, "NACK Reply" },
+    { 0, NULL }
+};
+
+struct tok arphrd_values[] = {
+    { ARPHRD_ETHER, "Ethernet" },
+    { ARPHRD_IEEE802, "TokenRing" },
+    { ARPHRD_ARCNET, "ArcNet" },
+    { ARPHRD_FRELAY, "FrameRelay" },
+    { ARPHRD_STRIP, "Strip" },
+    { ARPHRD_IEEE1394, "IEEE 1394" },
+    { ARPHRD_ATM2225, "ATM" },
+    { 0, NULL }
+};
+
 /*
  * ATM Address Resolution Protocol.
  *
@@ -104,20 +130,18 @@ struct    arp_pkthdr {
  * the ATM number and subaddress - and the hardware addresses consist
  * of an ATM number and an ATM subaddress.
  */
-struct atmarp_pkthdr {
-       u_short aar_hrd;        /* format of hardware address */
-#define ARPHRD_ATM2225 19      /* ATM (RFC 2225) */
-       u_short aar_pro;        /* format of protocol address */
-       u_char  aar_shtl;       /* length of source ATM number */
-       u_char  aar_sstl;       /* length of source ATM subaddress */
-#define ATMARP_IS_E164 0x40    /* bit in type/length for E.164 format */
-#define ATMARP_LEN_MASK        0x3F    /* length of {sub}address in type/length */
-       u_short aar_op;         /* same as regular ARP */
-#define ATMARPOP_NAK   10      /* NAK */
-       u_char  aar_spln;       /* length of source protocol address */
-       u_char  aar_thtl;       /* length of target ATM number */
-       u_char  aar_tstl;       /* length of target ATM subaddress */
-       u_char  aar_tpln;       /* length of target protocol address */
+struct  atmarp_pkthdr {
+        u_short aar_hrd;        /* format of hardware address */
+        u_short aar_pro;        /* format of protocol address */
+        u_char  aar_shtl;       /* length of source ATM number */
+        u_char  aar_sstl;       /* length of source ATM subaddress */
+#define ATMARP_IS_E164  0x40    /* bit in type/length for E.164 format */
+#define ATMARP_LEN_MASK 0x3F    /* length of {sub}address in type/length */
+        u_short aar_op;         /* same as regular ARP */
+        u_char  aar_spln;       /* length of source protocol address */
+        u_char  aar_thtl;       /* length of target ATM number */
+        u_char  aar_tstl;       /* length of target ATM subaddress */
+        u_char  aar_tpln;       /* length of target protocol address */
 /*
  * The remaining fields are variable in size,
  * according to the sizes above.
@@ -132,19 +156,19 @@ struct    atmarp_pkthdr {
 #endif
 
 #define ATMHRD(ap)  EXTRACT_16BITS(&(ap)->aar_hrd)
-#define ATMSHLN(ap) ((ap)->aar_shtl & ATMARP_LEN_MASK)
+#define ATMSHRD_LEN(ap) ((ap)->aar_shtl & ATMARP_LEN_MASK)
 #define ATMSSLN(ap) ((ap)->aar_sstl & ATMARP_LEN_MASK)
-#define ATMSPLN(ap) ((ap)->aar_spln)
+#define ATMSPROTO_LEN(ap) ((ap)->aar_spln)
 #define ATMOP(ap)   EXTRACT_16BITS(&(ap)->aar_op)
 #define ATMPRO(ap)  EXTRACT_16BITS(&(ap)->aar_pro)
-#define ATMTHLN(ap) ((ap)->aar_thtl & ATMARP_LEN_MASK)
+#define ATMTHRD_LEN(ap) ((ap)->aar_thtl & ATMARP_LEN_MASK)
 #define ATMTSLN(ap) ((ap)->aar_tstl & ATMARP_LEN_MASK)
-#define ATMTPLN(ap) ((ap)->aar_tpln)
+#define ATMTPROTO_LEN(ap) ((ap)->aar_tpln)
 #define aar_sha(ap)    ((const u_char *)((ap)+1))
-#define aar_ssa(ap)    (aar_sha(ap) + ATMSHLN(ap))
+#define aar_ssa(ap)    (aar_sha(ap) + ATMSHRD_LEN(ap))
 #define aar_spa(ap)    (aar_ssa(ap) + ATMSSLN(ap))
-#define aar_tha(ap)    (aar_spa(ap) + ATMSPLN(ap))
-#define aar_tsa(ap)    (aar_tha(ap) + ATMTHLN(ap))
+#define aar_tha(ap)    (aar_spa(ap) + ATMSPROTO_LEN(ap))
+#define aar_tsa(ap)    (aar_tha(ap) + ATMTHRD_LEN(ap))
 #define aar_tpa(ap)    (aar_tsa(ap) + ATMTSLN(ap))
 };
 
@@ -165,10 +189,10 @@ atmarp_addr_print(netdissect_options *ndo,
        if (ha_len == 0)
                ND_PRINT((ndo, "<No address>"));
        else {
-               ND_PRINT((ndo, "%s", linkaddr_string(ha, ha_len)));
+               ND_PRINT((ndo, "%s", linkaddr_string(ha, LINKADDR_ATM, ha_len)));
                if (srca_len != 0) 
                        ND_PRINT((ndo, ",%s",
-                                 linkaddr_string(srca, srca_len)));
+                                 linkaddr_string(srca, LINKADDR_ATM, srca_len)));
        }
 }
 
@@ -186,69 +210,86 @@ atmarp_print(netdissect_options *ndo,
        pro = ATMPRO(ap);
        op = ATMOP(ap);
 
-       if (!ND_TTEST2(*aar_tpa(ap), ATMTPLN(ap))) {
-               ND_PRINT((ndo, "truncated-atmarp"));
+       if (!ND_TTEST2(*aar_tpa(ap), ATMTPROTO_LEN(ap))) {
+               ND_PRINT((ndo, "[|ARP]"));
                ND_DEFAULTPRINT((const u_char *)ap, length);
                return;
        }
 
+        if (!ndo->ndo_eflag) {
+            ND_PRINT((ndo, "ARP, "));
+        }
+
        if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
-           ATMSPLN(ap) != 4 || ATMTPLN(ap) != 4) {
-               ND_PRINT((ndo, "atmarp-#%d for proto #%d (%d/%d) hardware #%d",
-                         op, pro, ATMSPLN(ap), ATMTPLN(ap), hrd));
-               return;
+           ATMSPROTO_LEN(ap) != 4 ||
+            ATMTPROTO_LEN(ap) != 4 ||
+            ndo->ndo_vflag) {
+                ND_PRINT((ndo, "%s, %s (len %u/%u)",
+                          tok2str(arphrd_values, "Unknown Hardware (%u)", hrd),
+                          tok2str(ethertype_values, "Unknown Protocol (0x%04x)", pro),
+                          ATMSPROTO_LEN(ap),
+                          ATMTPROTO_LEN(ap)));
+
+                /* don't know know about the address formats */
+                if (!ndo->ndo_vflag) {
+                    goto out;
+                }
        }
-       if (pro == ETHERTYPE_TRAIL)
-               ND_PRINT((ndo, "trailer-"));
+
+        /* print operation */
+        printf("%s%s ",
+               ndo->ndo_vflag ? ", " : "", 
+               tok2str(arpop_values, "Unknown (%u)", op));
+
        switch (op) {
 
        case ARPOP_REQUEST:
-               ND_PRINT((ndo, "arp who-has %s", ipaddr_string(ATMTPA(ap))));
-               if (ATMTHLN(ap) != 0) {
+               ND_PRINT((ndo, "who-has %s", ipaddr_string(ATMTPA(ap))));
+               if (ATMTHRD_LEN(ap) != 0) {
                        ND_PRINT((ndo, " ("));
-                       atmarp_addr_print(ndo, ATMTHA(ap), ATMTHLN(ap),
+                       atmarp_addr_print(ndo, ATMTHA(ap), ATMTHRD_LEN(ap),
                            ATMTSA(ap), ATMTSLN(ap));
                        ND_PRINT((ndo, ")"));
                }
-               ND_PRINT((ndo, " tell %s", ipaddr_string(ATMSPA(ap))));
+               ND_PRINT((ndo, "tell %s", ipaddr_string(ATMSPA(ap))));
                break;
 
        case ARPOP_REPLY:
-               ND_PRINT((ndo, "arp reply %s", ipaddr_string(ATMSPA(ap))));
-               ND_PRINT((ndo, " is-at "));
-               atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
-                   ATMSSLN(ap));
+               ND_PRINT((ndo, "%s is-at ", ipaddr_string(ATMSPA(ap))));
+               atmarp_addr_print(ndo, ATMSHA(ap), ATMSHRD_LEN(ap), ATMSSA(ap),
+                                  ATMSSLN(ap));
                break;
 
        case ARPOP_INVREQUEST:
-               ND_PRINT((ndo, "invarp who-is "));
-               atmarp_addr_print(ndo, ATMTHA(ap), ATMTHLN(ap), ATMTSA(ap),
+               ND_PRINT((ndo, "who-is "));
+               atmarp_addr_print(ndo, ATMTHA(ap), ATMTHRD_LEN(ap), ATMTSA(ap),
                    ATMTSLN(ap));
                ND_PRINT((ndo, " tell "));
-               atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
+               atmarp_addr_print(ndo, ATMSHA(ap), ATMSHRD_LEN(ap), ATMSSA(ap),
                    ATMSSLN(ap));
                break;
 
        case ARPOP_INVREPLY:
-               ND_PRINT((ndo, "invarp reply "));
-               atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
+               atmarp_addr_print(ndo, ATMSHA(ap), ATMSHRD_LEN(ap), ATMSSA(ap),
                    ATMSSLN(ap));
-               ND_PRINT((ndo, " at %s", ipaddr_string(ATMSPA(ap))));
+               ND_PRINT((ndo, "at %s", ipaddr_string(ATMSPA(ap))));
                break;
 
-       case ATMARPOP_NAK:
-               ND_PRINT((ndo, "nak reply for %s",
-                         ipaddr_string(ATMSPA(ap))));
+       case ARPOP_NAK:
+               ND_PRINT((ndo, "for %s", ipaddr_string(ATMSPA(ap))));
                break;
 
        default:
-               ND_PRINT((ndo, "atmarp-#%d", op));
                ND_DEFAULTPRINT((const u_char *)ap, caplen);
                return;
        }
-       return;
+
+ out:
+        ND_PRINT((ndo, ", length %u", length));
+        return;
+
 trunc:
-       ND_PRINT((ndo, "[|atmarp]"));
+       ND_PRINT((ndo, "[|ARP]"));
 }
 
 void
@@ -256,81 +297,115 @@ arp_print(netdissect_options *ndo,
          const u_char *bp, u_int length, u_int caplen)
 {
        const struct arp_pkthdr *ap;
-       u_short pro, hrd, op;
+       u_short pro, hrd, op, linkaddr;
 
        ap = (const struct arp_pkthdr *)bp;
        ND_TCHECK(*ap);
+
        hrd = HRD(ap);
-       if (hrd == ARPHRD_ATM2225) {
-               atmarp_print(ndo, bp, length, caplen);
-               return;
-       }
        pro = PRO(ap);
        op = OP(ap);
 
-       if (!ND_TTEST2(*ar_tpa(ap), PLN(ap))) {
-               ND_PRINT((ndo, "truncated-arp"));
+        
+        /* if its ATM then call the ATM ARP printer
+           for Frame-relay ARP most of the fields
+           are similar to Ethernet so overload the Ethernet Printer
+           and set the linkaddr type for linkaddr_string() accordingly */
+
+        switch(hrd) {
+        case ARPHRD_ATM2225:
+            atmarp_print(ndo, bp, length, caplen);
+            return;
+        case ARPHRD_FRELAY:
+            linkaddr = LINKADDR_FRELAY;
+        default:
+            linkaddr = LINKADDR_ETHER;
+            break;
+       }
+
+       if (!ND_TTEST2(*ar_tpa(ap), PROTO_LEN(ap))) {
+               ND_PRINT((ndo, "[|ARP]"));
                ND_DEFAULTPRINT((const u_char *)ap, length);
                return;
        }
 
-       if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
-           PLN(ap) != 4 || HLN(ap) == 0) {
-               ND_PRINT((ndo, "arp-#%d for proto #%d (%d) hardware #%d (%d)",
-                         op, pro, PLN(ap), hrd, HLN(ap)));
-               return;
+        if (!ndo->ndo_eflag) {
+            ND_PRINT((ndo, "ARP, "));
+        }
+
+        /* print hardware type/len and proto type/len */
+        if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
+           PROTO_LEN(ap) != 4 ||
+            HRD_LEN(ap) == 0 ||
+            ndo->ndo_vflag) {
+            ND_PRINT((ndo, "%s (len %u), %s (len %u)",
+                      tok2str(arphrd_values, "Unknown Hardware (%u)", hrd),
+                      HRD_LEN(ap),
+                      tok2str(ethertype_values, "Unknown Protocol (0x%04x)", pro),
+                      PROTO_LEN(ap)));
+
+            /* don't know know about the address formats */
+            if (!ndo->ndo_vflag) {
+                goto out;
+            }
        }
-       if (pro == ETHERTYPE_TRAIL)
-               ND_PRINT((ndo, "trailer-"));
+
+        /* print operation */
+        printf("%s%s ",
+               ndo->ndo_vflag ? ", " : "", 
+               tok2str(arpop_values, "Unknown (%u)", op));
+
        switch (op) {
 
        case ARPOP_REQUEST:
-               ND_PRINT((ndo, "arp who-has %s", ipaddr_string(TPA(ap))));
-               if (memcmp((const char *)ezero, (const char *)THA(ap), HLN(ap)) != 0)
+               ND_PRINT((ndo, "who-has %s", ipaddr_string(TPA(ap))));
+               if (memcmp((const char *)ezero, (const char *)THA(ap), HRD_LEN(ap)) != 0)
                        ND_PRINT((ndo, " (%s)",
-                                 linkaddr_string(THA(ap), HLN(ap))));
+                                 linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap))));
                ND_PRINT((ndo, " tell %s", ipaddr_string(SPA(ap))));
                break;
 
        case ARPOP_REPLY:
-               ND_PRINT((ndo, "arp reply %s", ipaddr_string(SPA(ap))));
-               ND_PRINT((ndo, " is-at %s", linkaddr_string(SHA(ap), HLN(ap))));
+               ND_PRINT((ndo, "%s is-at %s",
+                          ipaddr_string(SPA(ap)),
+                          linkaddr_string(SHA(ap), linkaddr, HRD_LEN(ap))));
                break;
 
        case ARPOP_REVREQUEST:
-               ND_PRINT((ndo, "rarp who-is %s tell %s",
-                         linkaddr_string(THA(ap), HLN(ap)),
-                         linkaddr_string(SHA(ap), HLN(ap))));
+               ND_PRINT((ndo, "who-is %s tell %s",
+                         linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)),
+                         linkaddr_string(SHA(ap), linkaddr, HRD_LEN(ap))));
                break;
 
        case ARPOP_REVREPLY:
-               ND_PRINT((ndo, "rarp reply %s at %s",
-                         linkaddr_string(THA(ap), HLN(ap)),
+               ND_PRINT((ndo, "%s at %s",
+                         linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)),
                          ipaddr_string(TPA(ap))));
                break;
 
        case ARPOP_INVREQUEST:
-               ND_PRINT((ndo, "invarp who-is %s tell %s",
-                         linkaddr_string(THA(ap), HLN(ap)),
-                         linkaddr_string(SHA(ap), HLN(ap))));
+               ND_PRINT((ndo, "who-is %s tell %s",
+                         linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)),
+                         linkaddr_string(SHA(ap), linkaddr, HRD_LEN(ap))));
                break;
 
        case ARPOP_INVREPLY:
-               ND_PRINT((ndo,"invarp reply %s at %s",
-                         linkaddr_string(THA(ap), HLN(ap)),
+               ND_PRINT((ndo,"%s at %s",
+                         linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)),
                          ipaddr_string(TPA(ap))));
                break;
 
        default:
-               ND_PRINT((ndo, "arp-#%d", op));
                ND_DEFAULTPRINT((const u_char *)ap, caplen);
                return;
        }
-       if (hrd != ARPHRD_ETHER)
-               ND_PRINT((ndo, " hardware #%d", hrd));
+
+ out:
+        ND_PRINT((ndo, ", length %u", length));
+
        return;
 trunc:
-       ND_PRINT((ndo, "[|arp]"));
+       ND_PRINT((ndo, "[|ARP]"));
 }
 
 /*
index cd48edd..fa8793c 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.16.2.1 2005/07/06 20:54:49 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.17 2005-07-06 20:53:32 guy Exp $";
 #endif
 #include <tcpdump-stdinc.h>
 #include <stdio.h>
index f1f45a3..6ea1361 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.81 2004/05/01 09:41:50 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.81 2004-05-01 09:41:50 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index d664d6e..f50918b 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38.2.6 2006/01/25 13:27:24 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.48.2.1 2007-10-22 19:39:12 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -43,25 +43,51 @@ static const char rcsid[] _U_ =
 
 #include "ether.h"
 
+#define OAM_CRC10_MASK 0x3ff
+#define OAM_PAYLOAD_LEN 48
+#define OAM_FUNCTION_SPECIFIC_LEN 45 /* this excludes crc10 and cell-type/function-type */
+#define OAM_CELLTYPE_FUNCTYPE_LEN 1
+
 struct tok oam_f_values[] = {
-    { OAMF4SC, "OAM F4 (segment)" },
-    { OAMF4EC, "OAM F4 (end)" },
+    { VCI_OAMF4SC, "OAM F4 (segment)" },
+    { VCI_OAMF4EC, "OAM F4 (end)" },
+    { 0, NULL }
+};
+
+struct tok atm_pty_values[] = {
+    { 0x0, "user data, uncongested, SDU 0" },
+    { 0x1, "user data, uncongested, SDU 1" },
+    { 0x2, "user data, congested, SDU 0" },
+    { 0x3, "user data, congested, SDU 1" },
+    { 0x4, "VCC OAM F5 flow segment" },
+    { 0x5, "VCC OAM F5 flow end-to-end" },
+    { 0x6, "Traffic Control and resource Mgmt" },
     { 0, NULL }
 };
 
+#define OAM_CELLTYPE_FM 0x1
+#define OAM_CELLTYPE_PM 0x2
+#define OAM_CELLTYPE_AD 0x8
+#define OAM_CELLTYPE_SM 0xf
+
 struct tok oam_celltype_values[] = {
-    { 0x1, "Fault Management" },
-    { 0x2, "Performance Management" },
-    { 0x8, "activate/deactivate" },
-    { 0xf, "System Management" },
+    { OAM_CELLTYPE_FM, "Fault Management" },
+    { OAM_CELLTYPE_PM, "Performance Management" },
+    { OAM_CELLTYPE_AD, "activate/deactivate" },
+    { OAM_CELLTYPE_SM, "System Management" },
     { 0, NULL }
 };
 
+#define OAM_FM_FUNCTYPE_AIS       0x0
+#define OAM_FM_FUNCTYPE_RDI       0x1
+#define OAM_FM_FUNCTYPE_CONTCHECK 0x4
+#define OAM_FM_FUNCTYPE_LOOPBACK  0x8
+
 struct tok oam_fm_functype_values[] = {
-    { 0x0, "AIS" },
-    { 0x1, "RDI" },
-    { 0x4, "Continuity Check" },
-    { 0x8, "Loopback" },
+    { OAM_FM_FUNCTYPE_AIS, "AIS" },
+    { OAM_FM_FUNCTYPE_RDI, "RDI" },
+    { OAM_FM_FUNCTYPE_CONTCHECK, "Continuity Check" },
+    { OAM_FM_FUNCTYPE_LOOPBACK, "Loopback" },
     { 0, NULL }
 };
 
@@ -78,6 +104,14 @@ struct tok oam_ad_functype_values[] = {
     { 0, NULL }
 };
 
+#define OAM_FM_LOOPBACK_INDICATOR_MASK 0x1
+
+struct tok oam_fm_loopback_indicator_values[] = {
+    { 0x0, "Reply" },
+    { 0x1, "Request" },
+    { 0, NULL }
+};
+
 static const struct tok *oam_functype_values[16] = {
     NULL,
     oam_fm_functype_values, /* 1 */
@@ -261,24 +295,24 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
        if (vpi == 0) {
                switch (vci) {
 
-               case PPC:
+               case VCI_PPC:
                        sig_print(p, caplen);
                        return;
 
-               case BCC:
+               case VCI_BCC:
                        printf("broadcast sig: ");
                        return;
 
-               case OAMF4SC: /* fall through */
-               case OAMF4EC:
+               case VCI_OAMF4SC: /* fall through */
+               case VCI_OAMF4EC:
                         oam_print(p, length, ATM_OAM_HEC);
                        return;
 
-               case METAC:
+               case VCI_METAC:
                        printf("meta: ");
                        return;
 
-               case ILMIC:
+               case VCI_ILMIC:
                        printf("ilmi: ");
                        snmp_print(p, length);
                        return;
@@ -301,26 +335,53 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
        }
 }
 
+struct oam_fm_loopback_t {
+    u_int8_t loopback_indicator;
+    u_int8_t correlation_tag[4];
+    u_int8_t loopback_id[12];
+    u_int8_t source_id[12];
+    u_int8_t unused[16];
+};
+
+struct oam_fm_ais_rdi_t {
+    u_int8_t failure_type;
+    u_int8_t failure_location[16];
+    u_int8_t unused[28];
+};
+
 int 
 oam_print (const u_char *p, u_int length, u_int hec) {
 
     u_int32_t cell_header;
-    u_int16_t cell_type, func_type,vpi,vci,payload,clp;
+    u_int16_t vpi, vci, cksum, cksum_shouldbe, idx;
+    u_int8_t  cell_type, func_type, payload, clp;
+
+    union {
+        const struct oam_fm_loopback_t *oam_fm_loopback;
+        const struct oam_fm_ais_rdi_t *oam_fm_ais_rdi;
+    } oam_ptr;
+
 
     cell_header = EXTRACT_32BITS(p+hec);
-    cell_type = ((*(p+4+hec))>>4) & 0x0f;
-    func_type = *(p+4+hec) & 0x0f;
+    cell_type = ((*(p+ATM_HDR_LEN_NOHEC+hec))>>4) & 0x0f;
+    func_type = (*(p+ATM_HDR_LEN_NOHEC+hec)) & 0x0f;
 
     vpi = (cell_header>>20)&0xff;
     vci = (cell_header>>4)&0xffff;
     payload = (cell_header>>1)&0x7;
     clp = cell_header&0x1;
 
-    printf("%s, vpi %u, vci %u, payload %u, clp %u, ",
+    printf("%s, vpi %u, vci %u, payload [ %s ], clp %u, length %u",
            tok2str(oam_f_values, "OAM F5", vci),
-           vpi, vci, payload, clp);
+           vpi, vci,
+           tok2str(atm_pty_values, "Unknown", payload),
+           clp, length);
+
+    if (!vflag) {
+        return 1;
+    }
 
-    printf("cell-type %s (%u)",
+    printf("\n\tcell-type %s (%u)",
            tok2str(oam_celltype_values, "unknown", cell_type),
            cell_type);
 
@@ -328,9 +389,61 @@ oam_print (const u_char *p, u_int length, u_int hec) {
         printf(", func-type unknown (%u)", func_type);
     else
         printf(", func-type %s (%u)",
-               bittok2str(oam_functype_values[cell_type],"none",func_type),
+               tok2str(oam_functype_values[cell_type],"none",func_type),
                func_type);
 
-    printf(", length %u",length);
+    p += ATM_HDR_LEN_NOHEC + hec;
+
+    switch (cell_type << 4 | func_type) {
+    case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_LOOPBACK):
+        oam_ptr.oam_fm_loopback = (const struct oam_fm_loopback_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
+        printf("\n\tLoopback-Indicator %s, Correlation-Tag 0x%08x",
+               tok2str(oam_fm_loopback_indicator_values,
+                       "Unknown",
+                       oam_ptr.oam_fm_loopback->loopback_indicator & OAM_FM_LOOPBACK_INDICATOR_MASK),
+               EXTRACT_32BITS(&oam_ptr.oam_fm_loopback->correlation_tag));
+        printf("\n\tLocation-ID ");
+        for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->loopback_id); idx++) {
+            if (idx % 2) {
+                printf("%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->loopback_id[idx]));
+            }
+        }
+        printf("\n\tSource-ID   ");
+        for (idx = 0; idx < sizeof(oam_ptr.oam_fm_loopback->source_id); idx++) {
+            if (idx % 2) {
+                printf("%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_loopback->source_id[idx]));
+            }
+        }
+        break;
+
+    case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_AIS):
+    case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_RDI):
+        oam_ptr.oam_fm_ais_rdi = (const struct oam_fm_ais_rdi_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
+        printf("\n\tFailure-type 0x%02x", oam_ptr.oam_fm_ais_rdi->failure_type);
+        printf("\n\tLocation-ID ");
+        for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
+            if (idx % 2) {
+                printf("%04x ", EXTRACT_16BITS(&oam_ptr.oam_fm_ais_rdi->failure_location[idx]));
+            }
+        }
+        break;
+
+    case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_CONTCHECK):
+        /* FIXME */
+        break;
+
+    default:
+        break;
+    }
+
+    /* crc10 checksum verification */
+    cksum = EXTRACT_16BITS(p + OAM_CELLTYPE_FUNCTYPE_LEN + OAM_FUNCTION_SPECIFIC_LEN)
+        & OAM_CRC10_MASK;
+    cksum_shouldbe = verify_crc10_cksum(0, p, OAM_PAYLOAD_LEN);
+    
+    printf("\n\tcksum 0x%03x (%scorrect)",
+           cksum,
+           cksum_shouldbe == 0 ? "" : "in");
+
     return 1;
 }
index db40d61..b476dbf 100644 (file)
@@ -11,7 +11,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-  "@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.6 2003/11/16 09:36:13 guy Exp $";
+  "@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.6 2003-11-16 09:36:13 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 03e59dc..6406168 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bfd.c,v 1.5.2.5 2006/02/02 06:36:37 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-bfd.c,v 1.10 2006-02-02 06:35:52 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 34aa798..2dfdf52 100644 (file)
@@ -36,7 +36,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.91.2.12 2007/07/14 22:26:35 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.117.2.1 2007-12-08 10:08:07 hannes Exp $";
 #endif
 
 #include <tcpdump-stdinc.h>
@@ -49,8 +49,8 @@ static const char rcsid[] _U_ =
 #include "addrtoname.h"
 #include "extract.h"
 #include "bgp.h"
-#include "l2vpn.h"
 #include "af.h"
+#include "l2vpn.h"
 
 struct bgp {
        u_int8_t bgp_marker[16];
@@ -145,6 +145,9 @@ struct bgp_attr {
 #define BGPTYPE_MP_REACH_NLRI          14      /* RFC2283 */
 #define BGPTYPE_MP_UNREACH_NLRI                15      /* RFC2283 */
 #define BGPTYPE_EXTD_COMMUNITIES        16      /* draft-ietf-idr-bgp-ext-communities */
+#define BGPTYPE_AS4_PATH               17      /* RFC4893 */
+#define BGPTYPE_AGGREGATOR4            18      /* RFC4893 */
+#define BGPTYPE_PMSI_TUNNEL             22      /* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */
 #define BGPTYPE_ATTR_SET               128      /* draft-marques-ppvpn-ibgp */
 
 #define BGP_MP_NLRI_MINSIZE              3       /* End of RIB Marker detection */
@@ -152,11 +155,13 @@ struct bgp_attr {
 static struct tok bgp_attr_values[] = {
     { BGPTYPE_ORIGIN,           "Origin"},
     { BGPTYPE_AS_PATH,          "AS Path"},
+    { BGPTYPE_AS4_PATH,         "AS4 Path"},
     { BGPTYPE_NEXT_HOP,         "Next Hop"},
     { BGPTYPE_MULTI_EXIT_DISC,  "Multi Exit Discriminator"},
     { BGPTYPE_LOCAL_PREF,       "Local Preference"},
     { BGPTYPE_ATOMIC_AGGREGATE, "Atomic Aggregate"},
     { BGPTYPE_AGGREGATOR,       "Aggregator"},
+    { BGPTYPE_AGGREGATOR4,      "Aggregator4"},
     { BGPTYPE_COMMUNITIES,      "Community"},
     { BGPTYPE_ORIGINATOR_ID,    "Originator ID"},
     { BGPTYPE_CLUSTER_LIST,     "Cluster List"},
@@ -166,6 +171,7 @@ static struct tok bgp_attr_values[] = {
     { BGPTYPE_MP_REACH_NLRI,    "Multi-Protocol Reach NLRI"},
     { BGPTYPE_MP_UNREACH_NLRI,  "Multi-Protocol Unreach NLRI"},
     { BGPTYPE_EXTD_COMMUNITIES, "Extended Community"},
+    { BGPTYPE_PMSI_TUNNEL,      "PMSI Tunnel"},
     { BGPTYPE_ATTR_SET,         "Attribute Set"},
     { 255,                      "Reserved for development"},
     { 0, NULL}
@@ -176,6 +182,9 @@ static struct tok bgp_attr_values[] = {
 #define BGP_CONFED_AS_SEQUENCE 3 /* draft-ietf-idr-rfc3065bis-01 */
 #define BGP_CONFED_AS_SET      4 /* draft-ietf-idr-rfc3065bis-01  */
 
+#define BGP_AS_SEG_TYPE_MIN    BGP_AS_SET
+#define BGP_AS_SEG_TYPE_MAX    BGP_CONFED_AS_SET
+
 static struct tok bgp_as_path_segment_open_values[] = {
     { BGP_AS_SEQUENCE,         ""},
     { BGP_AS_SET,              "{ "},
@@ -267,6 +276,7 @@ static struct tok bgp_notify_minor_open_values[] = {
     { 4,                        "Unsupported Optional Parameter"},
     { 5,                        "Authentication Failure"},
     { 6,                        "Unacceptable Hold Time"},
+    { 7,                        "Capability Message Error"},
     { 0, NULL}
 };
 
@@ -300,6 +310,31 @@ static struct tok bgp_origin_values[] = {
     { 0, NULL}
 };
 
+#define BGP_PMSI_TUNNEL_RSVP_P2MP 1
+#define BGP_PMSI_TUNNEL_LDP_P2MP  2
+#define BGP_PMSI_TUNNEL_PIM_SSM   3
+#define BGP_PMSI_TUNNEL_PIM_SM    4
+#define BGP_PMSI_TUNNEL_PIM_BIDIR 5
+#define BGP_PMSI_TUNNEL_INGRESS   6
+#define BGP_PMSI_TUNNEL_LDP_MP2MP 7
+
+static struct tok bgp_pmsi_tunnel_values[] = {
+    { BGP_PMSI_TUNNEL_RSVP_P2MP, "RSVP-TE P2MP LSP"},
+    { BGP_PMSI_TUNNEL_LDP_P2MP, "LDP P2MP LSP"},
+    { BGP_PMSI_TUNNEL_PIM_SSM, "PIM-SSM Tree"},
+    { BGP_PMSI_TUNNEL_PIM_SM, "PIM-SM Tree"},
+    { BGP_PMSI_TUNNEL_PIM_BIDIR, "PIM-Bidir Tree"},
+    { BGP_PMSI_TUNNEL_INGRESS, "Ingress Replication"},
+    { BGP_PMSI_TUNNEL_LDP_MP2MP, "LDP MP2MP LSP"},
+    { 0, NULL}
+};
+
+static struct tok bgp_pmsi_flag_values[] = {
+    { 0x01, "Leaf Information required"},
+    { 0, NULL}
+};
+
+
 /* Subsequent address family identifier, RFC2283 section 7 */
 #define SAFNUM_RES                      0
 #define SAFNUM_UNICAST                  1
@@ -307,6 +342,8 @@ static struct tok bgp_origin_values[] = {
 #define SAFNUM_UNIMULTICAST             3
 /* labeled BGP RFC3107 */
 #define SAFNUM_LABUNICAST               4
+/* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */
+#define SAFNUM_MULTICAST_VPN            5
 #define SAFNUM_TUNNEL                   64 /* XXX */
 #define SAFNUM_VPLS                     65 /* XXX */
 #define SAFNUM_MDT                      66 /* XXX */
@@ -331,7 +368,8 @@ static struct tok bgp_safi_values[] = {
     { SAFNUM_VPNUNICAST,        "labeled VPN Unicast"},
     { SAFNUM_VPNMULTICAST,      "labeled VPN Multicast"},
     { SAFNUM_VPNUNIMULTICAST,   "labeled VPN Unicast+Multicast"},
-    { SAFNUM_RT_ROUTING_INFO,   "Route Target Routing Information"}, /* draft-marques-ppvpn-rt-constrain-01.txt */
+    { SAFNUM_RT_ROUTING_INFO,   "Route Target Routing Information"},
+    { SAFNUM_MULTICAST_VPN,     "Multicast VPN"},
     { 0, NULL }
 };
 
@@ -349,8 +387,6 @@ static struct tok bgp_safi_values[] = {
 #define BGP_EXT_COM_RO_2        0x0203  /* Route Origin,Format AN(4bytes):local(2bytes) */
 #define BGP_EXT_COM_LINKBAND    0x4004  /* Link Bandwidth,Format AS(2B):Bandwidth(4B) */
                                         /* rfc2547 bgp-mpls-vpns */
-#define BGP_EXT_COM_CISCO_MCAST 0x0009  /* cisco proprietary */
-
 #define BGP_EXT_COM_VPN_ORIGIN  0x0005  /* OSPF Domain ID / VPN of Origin  - draft-rosen-vpns-ospf-bgp-mpls */
 #define BGP_EXT_COM_VPN_ORIGIN2 0x0105  /* duplicate - keep for backwards compatability */
 #define BGP_EXT_COM_VPN_ORIGIN3 0x0205  /* duplicate - keep for backwards compatability */
@@ -364,6 +400,9 @@ static struct tok bgp_safi_values[] = {
 
 #define BGP_EXT_COM_L2INFO      0x800a  /* draft-kompella-ppvpn-l2vpn */
 
+#define BGP_EXT_COM_SOURCE_AS   0x0009  /* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */
+#define BGP_EXT_COM_VRF_RT_IMP  0x010a  /* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */
+
 /* http://www.cisco.com/en/US/tech/tk436/tk428/technologies_tech_note09186a00801eb09a.shtml  */
 #define BGP_EXT_COM_EIGRP_GEN   0x8800
 #define BGP_EXT_COM_EIGRP_METRIC_AS_DELAY  0x8801
@@ -386,7 +425,6 @@ static struct tok bgp_extd_comm_subtype_values[] = {
     { BGP_EXT_COM_RO_1,        "origin"},
     { BGP_EXT_COM_RO_2,        "origin"},
     { BGP_EXT_COM_LINKBAND,    "link-BW"},
-    { BGP_EXT_COM_CISCO_MCAST, "mdt-group"},
     { BGP_EXT_COM_VPN_ORIGIN,  "ospf-domain"},
     { BGP_EXT_COM_VPN_ORIGIN2, "ospf-domain"},
     { BGP_EXT_COM_VPN_ORIGIN3, "ospf-domain"},
@@ -402,6 +440,8 @@ static struct tok bgp_extd_comm_subtype_values[] = {
     { BGP_EXT_COM_EIGRP_METRIC_LOAD_MTU , "eigrp-route-metric (load, MTU)" },
     { BGP_EXT_COM_EIGRP_EXT_REMAS_REMID , "eigrp-external-route (remote-AS, remote-ID)" },
     { BGP_EXT_COM_EIGRP_EXT_REMPROTO_REMMETRIC , "eigrp-external-route (remote-proto, remote-metric)" },
+    { BGP_EXT_COM_SOURCE_AS, "source-AS" },
+    { BGP_EXT_COM_VRF_RT_IMP, "vrf-route-import"},
     { 0, NULL},
 };
 
@@ -494,6 +534,99 @@ trunc:
        return -2;
 }
 
+/*
+ * bgp_vpn_ip_print
+ *
+ * print an ipv4 or ipv6 address into a buffer dependend on address length.
+ */
+static char *
+bgp_vpn_ip_print (const u_char *pptr, u_int addr_length) {
+
+    /* worst case string is s fully formatted v6 address */
+    static char addr[sizeof("1234:5678:89ab:cdef:1234:5678:89ab:cdef")];
+    char *pos = addr;
+
+    switch(addr_length) {
+    case (sizeof(struct in_addr) << 3): /* 32 */
+        TCHECK2(pptr[0], sizeof(struct in_addr));
+        snprintf(pos, sizeof(addr), "%s", ipaddr_string(pptr));
+        break;
+#ifdef INET6
+    case (sizeof(struct in6_addr) << 3): /* 128 */
+        TCHECK2(pptr[0], sizeof(struct in6_addr));
+        snprintf(pos, sizeof(addr), "%s", ip6addr_string(pptr));
+        break;
+#endif
+    default:
+        snprintf(pos, sizeof(addr), "bogus address length %u", addr_length);
+        break;
+    }
+    pos += strlen(pos);
+
+trunc:
+    *(pos) = '\0';
+    return (addr);
+}
+
+/*
+ * bgp_vpn_sg_print
+ *
+ * print an multicast s,g entry into a buffer.
+ * the s,g entry is encoded like this.
+ *
+ * +-----------------------------------+
+ * | Multicast Source Length (1 octet) |
+ * +-----------------------------------+
+ * |   Multicast Source (Variable)     |
+ * +-----------------------------------+
+ * |  Multicast Group Length (1 octet) |
+ * +-----------------------------------+
+ * |  Multicast Group   (Variable)     |
+ * +-----------------------------------+
+ *
+ * return the number of bytes read from the wire.
+ */
+static int
+bgp_vpn_sg_print (const u_char *pptr, char *buf, u_int buflen) {
+
+    u_int8_t addr_length;
+    u_int total_length, offset;
+
+    total_length = 0;
+
+    /* Source address length, encoded in bits */
+    TCHECK2(pptr[0], 1);
+    addr_length =  *pptr++;
+
+    /* Source address */
+    TCHECK2(pptr[0], (addr_length >> 3));
+    total_length += (addr_length >> 3) + 1;
+    offset = strlen(buf);
+    if (addr_length) {
+        snprintf(buf + offset, buflen - offset, ", Source %s",
+                 bgp_vpn_ip_print(pptr, addr_length));
+        pptr += (addr_length >> 3);
+    }
+    
+    /* Group address length, encoded in bits */
+    TCHECK2(pptr[0], 1);
+    addr_length =  *pptr++;
+
+    /* Group address */
+    TCHECK2(pptr[0], (addr_length >> 3));
+    total_length += (addr_length >> 3) + 1;
+    offset = strlen(buf);
+    if (addr_length) {
+        snprintf(buf + offset, buflen - offset, ", Group %s",
+                 bgp_vpn_ip_print(pptr, addr_length));
+        pptr += (addr_length >> 3);
+    }
+
+trunc:
+    return (total_length);
+}
+
+
 /* RDs and RTs share the same semantics
  * we use bgp_vpn_rd_print for
  * printing route targets inside a NLRI */
@@ -507,10 +640,12 @@ bgp_vpn_rd_print (const u_char *pptr) {
     /* ok lets load the RD format */
     switch (EXTRACT_16BITS(pptr)) {
 
-        /* AS:IP-address fmt*/
+        /* 2-byte-AS:number fmt*/
     case 0:
-        snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u.%u.%u.%u",
-            EXTRACT_16BITS(pptr+2), *(pptr+4), *(pptr+5), *(pptr+6), *(pptr+7));
+        snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (= %u.%u.%u.%u)",
+                 EXTRACT_16BITS(pptr+2),
+                 EXTRACT_32BITS(pptr+4),
+                 *(pptr+4), *(pptr+5), *(pptr+6), *(pptr+7));
         break;
         /* IP-address:AS fmt*/
 
@@ -609,6 +744,108 @@ trunc:
        return -2;
 }
 
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI   1
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI   2
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI            3
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_SEG_LEAF 4
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_ACTIVE     5
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_SHARED_TREE_JOIN  6
+#define BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_TREE_JOIN  7
+
+static struct tok bgp_multicast_vpn_route_type_values[] = {
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI, "Intra-AS I-PMSI"},
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI, "Inter-AS I-PMSI"},
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI, "S-PMSI"},
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_SEG_LEAF, "Intra-AS Segment-Leaf"},
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_ACTIVE, "Source-Active"},
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_SHARED_TREE_JOIN, "Shared Tree Join"},
+    { BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_TREE_JOIN, "Source Tree Join"},
+};
+
+static int
+decode_multicast_vpn(const u_char *pptr, char *buf, u_int buflen)
+{
+        u_int8_t route_type, route_length, addr_length, sg_length;
+        u_int offset;
+
+       TCHECK2(pptr[0], 2);
+        route_type = *pptr++;
+        route_length = *pptr++;
+
+        snprintf(buf, buflen, "Route-Type: %s (%u), length: %u",
+                 tok2str(bgp_multicast_vpn_route_type_values,
+                         "Unknown", route_type),
+                 route_type, route_length);
+
+        switch(route_type) {
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI:
+            TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            offset = strlen(buf);
+            snprintf(buf + offset, buflen - offset, ", RD: %s, Originator %s",
+                     bgp_vpn_rd_print(pptr),
+                     bgp_vpn_ip_print(pptr + BGP_VPN_RD_LEN,
+                                      (route_length - BGP_VPN_RD_LEN) << 3));
+            break;
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI:
+            TCHECK2(pptr[0], BGP_VPN_RD_LEN + 4);
+            offset = strlen(buf);
+            snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %u",
+                     bgp_vpn_rd_print(pptr),
+                     EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN));
+            break;
+
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI:
+            TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            offset = strlen(buf);
+            snprintf(buf + offset, buflen - offset, ", RD: %s",
+                     bgp_vpn_rd_print(pptr));
+            pptr += BGP_VPN_RD_LEN;
+
+            sg_length = bgp_vpn_sg_print(pptr, buf, buflen);
+            addr_length =  route_length - sg_length;
+
+            TCHECK2(pptr[0], addr_length);
+            offset = strlen(buf);
+            snprintf(buf + offset, buflen - offset, ", Originator %s",
+                     bgp_vpn_ip_print(pptr, addr_length << 3));
+            break;
+
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_ACTIVE:
+            TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            offset = strlen(buf);
+            snprintf(buf + offset, buflen - offset, ", RD: %s",
+                     bgp_vpn_rd_print(pptr));
+            pptr += BGP_VPN_RD_LEN;
+
+            bgp_vpn_sg_print(pptr, buf, buflen);
+            break;
+
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_SHARED_TREE_JOIN: /* fall through */
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_TREE_JOIN:
+            TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            offset = strlen(buf);
+            snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %u",
+                     bgp_vpn_rd_print(pptr),
+                     EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN));
+            pptr += BGP_VPN_RD_LEN;
+
+            bgp_vpn_sg_print(pptr, buf, buflen);
+            break;
+
+            /*
+             * no per route-type printing yet.
+             */
+        case BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_SEG_LEAF:
+        default:
+            break;
+        }
+
+        return route_length + 2;
+
+trunc:
+       return -2;
+}
+
 /*
  * As I remember, some versions of systems have an snprintf() that
  * returns -1 if the buffer would have overflowed.  If the return
@@ -863,6 +1100,63 @@ trunc:
        return -2;
 }
 
+/*
+ * bgp_attr_get_as_size
+ *
+ * Try to find the size of the ASs encoded in an as-path. It is not obvious, as
+ * both Old speakers that do not support 4 byte AS, and the new speakers that do
+ * support, exchange AS-Path with the same path-attribute type value 0x02.
+ */
+static int
+bgp_attr_get_as_size (u_int8_t bgpa_type, const u_char *pptr, int len)
+{
+    const u_char *tptr = pptr;
+
+    /*
+     * If the path attribute is the optional AS4 path type, then we already
+     * know, that ASs must be encoded in 4 byte format.
+     */
+    if (bgpa_type == BGPTYPE_AS4_PATH) {
+        return 4;
+    }
+
+    /*
+     * Let us assume that ASs are of 2 bytes in size, and check if the AS-Path
+     * TLV is good. If not, ask the caller to try with AS encoded as 4 bytes
+     * each.
+     */
+    while (tptr < pptr + len) {
+        TCHECK(tptr[0]);
+
+        /*
+         * If we do not find a valid segment type, our guess might be wrong.
+         */
+        if (tptr[0] < BGP_AS_SEG_TYPE_MIN || tptr[0] > BGP_AS_SEG_TYPE_MAX) {
+            goto trunc;
+        }
+        TCHECK(tptr[1]);
+        tptr += 2 + tptr[1] * 2;
+    }
+
+    /*
+     * If we correctly reached end of the AS path attribute data content,
+     * then most likely ASs were indeed encoded as 2 bytes.
+     */
+    if (tptr == pptr + len) {
+        return 2;
+    }
+
+trunc:
+
+    /*
+     * We can come here, either we did not have enough data, or if we
+     * try to decode 4 byte ASs in 2 byte format. Either way, return 4,
+     * so that calller can try to decode each AS as of 4 bytes. If indeed
+     * there was not enough data, it will crib and end the parse anyways.
+     */
+   return 4;
+}
+
 static int
 bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
 {
@@ -878,6 +1172,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
        const u_char *tptr;
        char buf[MAXHOSTNAMELEN + 100];
        char tokbuf[TOKBUFSIZE];
+        int  as_size;
 
         tptr = pptr;
         tlen=len;
@@ -895,6 +1190,11 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                }
                break;
 
+
+        /*
+         * Process AS4 byte path and AS2 byte path attributes here.
+         */
+       case BGPTYPE_AS4_PATH:
        case BGPTYPE_AS_PATH:
                if (len % 2) {
                        printf("invalid len");
@@ -905,21 +1205,33 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                        break;
                 }
 
+                /*
+                 * BGP updates exchanged between New speakers that support 4
+                 * byte AS, ASs are always encoded in 4 bytes. There is no
+                 * definitive way to find this, just by the packet's
+                 * contents. So, check for packet's TLV's sanity assuming
+                 * 2 bytes first, and it does not pass, assume that ASs are
+                 * encoded in 4 bytes format and move on.
+                 */
+                as_size = bgp_attr_get_as_size(attr->bgpa_type, pptr, len);
+
                while (tptr < pptr + len) {
                        TCHECK(tptr[0]);
                         printf("%s", tok2strbuf(bgp_as_path_segment_open_values,
                                                "?", tptr[0],
                                                tokbuf, sizeof(tokbuf)));
-                        for (i = 0; i < tptr[1] * 2; i += 2) {
-                            TCHECK2(tptr[2 + i], 2);
-                            printf("%u ", EXTRACT_16BITS(&tptr[2 + i]));
+                        for (i = 0; i < tptr[1] * as_size; i += as_size) {
+                            TCHECK2(tptr[2 + i], as_size);
+                            printf("%u ",
+                                   as_size == 2 ?  EXTRACT_16BITS(&tptr[2 + i]) :
+                                                   EXTRACT_32BITS(&tptr[2 + i]));
                         }
                        TCHECK(tptr[0]);
                         printf("%s", tok2strbuf(bgp_as_path_segment_close_values,
                                                "?", tptr[0],
                                                tokbuf, sizeof(tokbuf)));
                         TCHECK(tptr[1]);
-                        tptr += 2 + tptr[1] * 2;
+                        tptr += 2 + tptr[1] * as_size;
                }
                break;
        case BGPTYPE_NEXT_HOP:
@@ -952,6 +1264,15 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                printf(" AS #%u, origin %s", EXTRACT_16BITS(tptr),
                        getname(tptr + 2));
                break;
+       case BGPTYPE_AGGREGATOR4:
+               if (len != 8) {
+                       printf("invalid len");
+                       break;
+               }
+               TCHECK2(tptr[0], 8);
+               printf(" AS #%u, origin %s", EXTRACT_32BITS(tptr),
+                       getname(tptr + 4));
+               break;
        case BGPTYPE_COMMUNITIES:
                if (len % 4) {
                        printf("invalid len");
@@ -1027,12 +1348,12 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                 case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST):
                 case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST):
                 case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST):
+                case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN):
 #ifdef INET6
                 case (AFNUM_INET6<<8 | SAFNUM_UNICAST):
                 case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
                 case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST):
                 case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST):
-                case (AFNUM_INET6<<8 | SAFNUM_RT_ROUTING_INFO):
                 case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST):
                 case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST):
                 case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST):
@@ -1073,6 +1394,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST):
                         case (AFNUM_INET<<8 | SAFNUM_LABUNICAST):
                         case (AFNUM_INET<<8 | SAFNUM_RT_ROUTING_INFO):
+                        case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN):
                             if (tlen < (int)sizeof(struct in_addr)) {
                                 printf("invalid len");
                                 tlen = 0;
@@ -1103,7 +1425,6 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
                         case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST):
                         case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST):
-                        case (AFNUM_INET6<<8 | SAFNUM_RT_ROUTING_INFO):
                             if (tlen < (int)sizeof(struct in6_addr)) {
                                 printf("invalid len");
                                 tlen = 0;
@@ -1248,6 +1569,16 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         else
                             printf("\n\t      %s", buf);
                         break;
+                    case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): /* fall through */
+                    case (AFNUM_INET6<<8 | SAFNUM_MULTICAST_VPN):
+                        advance = decode_multicast_vpn(tptr, buf, sizeof(buf));
+                        if (advance == -1)
+                            printf("\n\t    (illegal prefix length)");
+                        else if (advance == -2)
+                            goto trunc;
+                        else
+                            printf("\n\t      %s", buf);
+                        break;
 #ifdef INET6
                     case (AFNUM_INET6<<8 | SAFNUM_UNICAST):
                     case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
@@ -1280,15 +1611,6 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         else
                             printf("\n\t      %s", buf);
                         break;
-                    case (AFNUM_INET6<<8 | SAFNUM_RT_ROUTING_INFO):
-                        advance = decode_rt_routing_info(tptr, buf, sizeof(buf));
-                        if (advance == -1)
-                            printf("\n\t    (illegal prefix length)");
-                        else if (advance == -2)
-                            goto trunc;
-                        else
-                            printf("\n\t      %s", buf);
-                        break;
 #endif
                     case (AFNUM_VPLS<<8 | SAFNUM_VPLS):
                     case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST):
@@ -1459,6 +1781,16 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         else
                             printf("\n\t      %s", buf);
                         break;                                   
+                    case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): /* fall through */
+                    case (AFNUM_INET6<<8 | SAFNUM_MULTICAST_VPN):
+                        advance = decode_multicast_vpn(tptr, buf, sizeof(buf));
+                        if (advance == -1)
+                            printf("\n\t    (illegal prefix length)");
+                        else if (advance == -2)
+                            goto trunc;
+                        else
+                            printf("\n\t      %s", buf);
+                        break;
                     default:
                         TCHECK2(*(tptr-3),tlen);
                         printf("no AFI %u / SAFI %u decoder",af,safi);
@@ -1495,12 +1827,14 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                     switch(extd_comm) {
                     case BGP_EXT_COM_RT_0:
                     case BGP_EXT_COM_RO_0:
-                        printf(": %u:%s",
+                        printf(": %u:%u (= %s)",
                                EXTRACT_16BITS(tptr+2),
+                               EXTRACT_32BITS(tptr+4),
                                getname(tptr+4));
                         break;
                     case BGP_EXT_COM_RT_1:
                     case BGP_EXT_COM_RO_1:
+                    case BGP_EXT_COM_VRF_RT_IMP:
                         printf(": %s:%u",
                                getname(tptr+2),
                                EXTRACT_16BITS(tptr+6));
@@ -1516,11 +1850,6 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                         printf(": bandwidth: %.3f Mbps",
                                bw.f*8/1000000);
                         break;
-                    case BGP_EXT_COM_CISCO_MCAST:
-                        printf(": AS %u, group %s",
-                               EXTRACT_16BITS(tptr+2),
-                               getname(tptr+4));
-                        break;
                     case BGP_EXT_COM_VPN_ORIGIN:
                     case BGP_EXT_COM_VPN_ORIGIN2:
                     case BGP_EXT_COM_VPN_ORIGIN3:
@@ -1549,6 +1878,9 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                                        *(tptr+3),
                                EXTRACT_16BITS(tptr+4));
                         break;
+                    case BGP_EXT_COM_SOURCE_AS:
+                        printf(": AS %u", EXTRACT_16BITS(tptr+2));
+                        break;
                     default:
                         TCHECK2(*tptr,8);
                         print_unknown_data(tptr,"\n\t      ",8);
@@ -1559,6 +1891,64 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                 }
                 break;
 
+        case BGPTYPE_PMSI_TUNNEL:
+        {
+                u_int8_t tunnel_type, flags;
+            
+                tunnel_type = *(tptr+1);
+                flags = *tptr;
+                tlen = len;
+
+                TCHECK2(tptr[0], 5);
+                printf("\n\t    Tunnel-type %s (%u), Flags [%s], MPLS Label %u",
+                       tok2str(bgp_pmsi_tunnel_values, "Unknown", tunnel_type),
+                       tunnel_type,
+                       bittok2str(bgp_pmsi_flag_values, "none", flags),
+                       EXTRACT_24BITS(tptr+2)>>4);
+
+                tptr +=5;
+                tlen -= 5;
+
+                switch (tunnel_type) {
+                case BGP_PMSI_TUNNEL_PIM_SM: /* fall through */
+                case BGP_PMSI_TUNNEL_PIM_BIDIR:
+                    TCHECK2(tptr[0], 8);
+                    printf("\n\t      Sender %s, P-Group %s",
+                           ipaddr_string(tptr),
+                           ipaddr_string(tptr+4));
+                    break;
+
+                case BGP_PMSI_TUNNEL_PIM_SSM:
+                    TCHECK2(tptr[0], 8);
+                    printf("\n\t      Root-Node %s, P-Group %s",
+                           ipaddr_string(tptr),
+                           ipaddr_string(tptr+4));
+                    break;
+                case BGP_PMSI_TUNNEL_INGRESS:
+                    TCHECK2(tptr[0], 4);
+                    printf("\n\t      Tunnel-Endpoint %s",
+                           ipaddr_string(tptr));
+                    break;
+                case BGP_PMSI_TUNNEL_LDP_P2MP: /* fall through */
+                case BGP_PMSI_TUNNEL_LDP_MP2MP:
+                    TCHECK2(tptr[0], 8);
+                    printf("\n\t      Root-Node %s, LSP-ID 0x%08x",
+                           ipaddr_string(tptr),
+                           EXTRACT_32BITS(tptr+4));
+                    break;
+                case BGP_PMSI_TUNNEL_RSVP_P2MP:
+                    TCHECK2(tptr[0], 8);
+                    printf("\n\t      Extended-Tunnel-ID %s, P2MP-ID 0x%08x",
+                           ipaddr_string(tptr),
+                           EXTRACT_32BITS(tptr+4));
+                    break;
+                default:
+                    if (vflag <= 1) {
+                        print_unknown_data(tptr,"\n\t      ",tlen);
+                    }
+                }
+                break;
+        }
         case BGPTYPE_ATTR_SET:
                 TCHECK2(tptr[0], 4);
                 printf("\n\t    Origin AS: %u", EXTRACT_32BITS(tptr));
@@ -2077,3 +2467,10 @@ bgp_print(const u_char *dat, int length)
 trunc:
        printf(" [|BGP]");
 }
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 4
+ * End:
+ */
index e2086e4..b442c18 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78.2.9 2007/08/21 22:02:08 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.88 2007-09-20 15:04:45 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -352,9 +352,13 @@ static struct tok dhcp_msg_values[] = {
         { 0,                   NULL }
 };
 
-#define AGENT_SUBOPTION_CIRCUIT_ID 1
+#define AGENT_SUBOPTION_CIRCUIT_ID     1       /* RFC 3046 */
+#define AGENT_SUBOPTION_REMOTE_ID      2       /* RFC 3046 */
+#define AGENT_SUBOPTION_SUBSCRIBER_ID  6       /* RFC 3993 */
 static struct tok agent_suboption_values[] = {
         { AGENT_SUBOPTION_CIRCUIT_ID, "Circuit-ID" },
+        { AGENT_SUBOPTION_REMOTE_ID, "Remote-ID" },
+        { AGENT_SUBOPTION_SUBSCRIBER_ID, "Subscriber-ID" },
         { 0,                   NULL }
 };
 
@@ -686,9 +690,11 @@ rfc1048_print(register const u_char *bp)
                                           suboptlen);
                                        switch (subopt) {
 
-                                       case AGENT_SUBOPTION_CIRCUIT_ID:
-                                               fn_printn(bp, suboptlen, NULL);
-                                               break;
+                                        case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */
+                                        case AGENT_SUBOPTION_REMOTE_ID:
+                                        case AGENT_SUBOPTION_SUBSCRIBER_ID:
+                                                fn_printn(bp, suboptlen, NULL);
+                                                break;
 
                                        default:
                                                print_unknown_data(bp, "\n\t\t", suboptlen);
index 4398fbe..f8f4427 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.25 2004/10/07 14:53:11 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.25 2004-10-07 14:53:11 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-cfm.c b/contrib/tcpdump/print-cfm.c
new file mode 100644 (file)
index 0000000..bd98dd2
--- /dev/null
@@ -0,0 +1,641 @@
+/*
+ * Copyright (c) 1998-2006 The TCPDUMP project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * Support for the IEEE Connectivity Fault Management Protocols as per 802.1ag.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-cfm.c,v 1.5 2007-07-24 16:01:42 hannes Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "interface.h"
+#include "extract.h"
+#include "ether.h"
+#include "addrtoname.h"
+#include "oui.h"
+#include "af.h"
+
+/*
+ * Prototypes
+ */
+const char * cfm_egress_id_string(register const u_char *);
+int cfm_mgmt_addr_print(register const u_char *);
+
+struct cfm_common_header_t {
+    u_int8_t mdlevel_version;
+    u_int8_t opcode;
+    u_int8_t flags;
+    u_int8_t first_tlv_offset;
+};
+
+#define        CFM_VERSION 0
+#define CFM_EXTRACT_VERSION(x) (((x)&0x1f))
+#define CFM_EXTRACT_MD_LEVEL(x) (((x)&0xe0)>>5)
+
+#define        CFM_OPCODE_CCM 1
+#define        CFM_OPCODE_LBR 2
+#define        CFM_OPCODE_LBM 3
+#define        CFM_OPCODE_LTR 4
+#define        CFM_OPCODE_LTM 5
+
+static const struct tok cfm_opcode_values[] = {
+    { CFM_OPCODE_CCM, "Continouity Check Message"},
+    { CFM_OPCODE_LBR, "Loopback Reply"},
+    { CFM_OPCODE_LBM, "Loopback Message"},
+    { CFM_OPCODE_LTR, "Linktrace Reply"},
+    { CFM_OPCODE_LTM, "Linktrace Message"},
+    { 0, NULL}
+};
+
+/*
+ * Message Formats.
+ */
+struct cfm_ccm_t {
+    u_int8_t sequence[4];
+    u_int8_t ma_epi[2];
+    u_int8_t md_nameformat;
+    u_int8_t md_namelength;
+    u_int8_t md_name[46]; /* md name and short ma name */
+    u_int8_t reserved_itu[16];
+    u_int8_t reserved[6];
+};
+
+/*
+ * Timer Bases for the CCM Interval field.
+ * Expressed in units of seconds.
+ */
+const float ccm_interval_base[8] = {0, 0.003333, 0.01, 0.1, 1, 10, 60, 600};
+#define CCM_INTERVAL_MIN_MULTIPLIER 3.25
+#define CCM_INTERVAL_MAX_MULTIPLIER 3.5
+
+#define CFM_CCM_RDI_FLAG 0x80
+#define CFM_EXTRACT_CCM_INTERVAL(x) (((x)&0x07))
+
+#define CFM_CCM_MD_FORMAT_8021 0
+#define CFM_CCM_MD_FORMAT_NONE 1
+#define CFM_CCM_MD_FORMAT_DNS  2
+#define CFM_CCM_MD_FORMAT_MAC  3
+#define CFM_CCM_MD_FORMAT_CHAR 4
+
+static const struct tok cfm_md_nameformat_values[] = {
+    { CFM_CCM_MD_FORMAT_8021, "IEEE 802.1"},
+    { CFM_CCM_MD_FORMAT_NONE, "No MD Name present"},
+    { CFM_CCM_MD_FORMAT_DNS, "DNS string"},
+    { CFM_CCM_MD_FORMAT_MAC, "MAC + 16Bit Integer"},
+    { CFM_CCM_MD_FORMAT_CHAR, "Character string"},
+    { 0, NULL}
+};
+
+#define CFM_CCM_MA_FORMAT_8021 0
+#define CFM_CCM_MA_FORMAT_VID  1
+#define CFM_CCM_MA_FORMAT_CHAR 2
+#define CFM_CCM_MA_FORMAT_INT  3
+#define CFM_CCM_MA_FORMAT_VPN  4
+
+static const struct tok cfm_ma_nameformat_values[] = {
+    { CFM_CCM_MA_FORMAT_8021, "IEEE 802.1"},
+    { CFM_CCM_MA_FORMAT_VID, "Primary VID"},
+    { CFM_CCM_MA_FORMAT_CHAR, "Character string"},
+    { CFM_CCM_MA_FORMAT_INT, "16Bit Integer"},
+    { CFM_CCM_MA_FORMAT_VPN, "RFC2685 VPN-ID"},
+    { 0, NULL}
+};
+
+struct cfm_lbm_t {
+    u_int8_t transaction_id[4];
+    u_int8_t reserved[4];
+};
+
+struct cfm_ltm_t {
+    u_int8_t transaction_id[4];
+    u_int8_t egress_id[8];
+    u_int8_t ttl;
+    u_int8_t original_mac[ETHER_ADDR_LEN];
+    u_int8_t target_mac[ETHER_ADDR_LEN];
+    u_int8_t reserved[3];
+};
+
+static const struct tok cfm_ltm_flag_values[] = {
+    { 0x80, "Use Forwarding-DB only"},
+    { 0, NULL}
+};
+
+struct cfm_ltr_t {
+    u_int8_t transaction_id[4];
+    u_int8_t last_egress_id[8];
+    u_int8_t next_egress_id[8];
+    u_int8_t ttl;
+    u_int8_t replay_action;
+    u_int8_t reserved[6];
+};
+
+static const struct tok cfm_ltr_flag_values[] = {
+    { 0x80, "Forwarded"},
+    { 0x40, "Terminal MEP"},
+    { 0, NULL}
+};
+
+static const struct tok cfm_ltr_replay_action_values[] = {
+    { 1, "Exact Match"},
+    { 2, "Filtering DB"},
+    { 3, "MIP CCM DB"},
+    { 0, NULL}
+};
+
+
+#define CFM_TLV_END 0
+#define CFM_TLV_SENDER_ID 1
+#define CFM_TLV_PORT_STATUS 2
+#define CFM_TLV_INTERFACE_STATUS 3
+#define CFM_TLV_DATA 4
+#define CFM_TLV_REPLY_INGRESS 5
+#define CFM_TLV_REPLY_EGRESS 6
+#define CFM_TLV_PRIVATE 31
+
+static const struct tok cfm_tlv_values[] = {
+    { CFM_TLV_END, "End"},
+    { CFM_TLV_SENDER_ID, "Sender ID"},
+    { CFM_TLV_PORT_STATUS, "Port status"},
+    { CFM_TLV_INTERFACE_STATUS, "Interface status"},
+    { CFM_TLV_DATA, "Data"},
+    { CFM_TLV_REPLY_INGRESS, "Reply Ingress"},
+    { CFM_TLV_REPLY_EGRESS, "Reply Egress"},
+    { CFM_TLV_PRIVATE, "Organization Specific"},
+    { 0, NULL}
+};
+
+/*
+ * TLVs
+ */
+
+struct cfm_tlv_header_t {
+    u_int8_t type;
+    u_int8_t length[2];
+};
+
+/* FIXME define TLV formats */
+
+static const struct tok cfm_tlv_port_status_values[] = {
+    { 1, "Blocked"},
+    { 2, "Up"},
+    { 0, NULL}
+};
+
+static const struct tok cfm_tlv_interface_status_values[] = {
+    { 1, "Up"},
+    { 2, "Down"},
+    { 3, "Testing"},
+    { 5, "Dormant"},
+    { 6, "not present"},
+    { 7, "lower Layer down"},
+    { 0, NULL}
+};
+
+#define CFM_CHASSIS_ID_CHASSIS_COMPONENT 1
+#define CFM_CHASSIS_ID_INTERFACE_ALIAS 2
+#define CFM_CHASSIS_ID_PORT_COMPONENT 3
+#define CFM_CHASSIS_ID_MAC_ADDRESS 4
+#define CFM_CHASSIS_ID_NETWORK_ADDRESS 5
+#define CFM_CHASSIS_ID_INTERFACE_NAME 6
+#define CFM_CHASSIS_ID_LOCAL 7
+
+static const struct tok cfm_tlv_senderid_chassisid_values[] = {
+    { 0, "Reserved"},
+    { CFM_CHASSIS_ID_CHASSIS_COMPONENT, "Chassis component"},
+    { CFM_CHASSIS_ID_INTERFACE_ALIAS, "Interface alias"},
+    { CFM_CHASSIS_ID_PORT_COMPONENT, "Port component"},
+    { CFM_CHASSIS_ID_MAC_ADDRESS, "MAC address"},
+    { CFM_CHASSIS_ID_NETWORK_ADDRESS, "Network address"},
+    { CFM_CHASSIS_ID_INTERFACE_NAME, "Interface name"},
+    { CFM_CHASSIS_ID_LOCAL, "Locally assigned"},
+    { 0, NULL}
+};
+
+
+int
+cfm_mgmt_addr_print(register const u_char *tptr) {
+
+    u_int mgmt_addr_type;
+    u_int hexdump =  FALSE;
+
+    /*
+     * Altough AFIs are tpically 2 octects wide,
+     * 802.1ab specifies that this field width
+     * is only once octet
+     */
+    mgmt_addr_type = *tptr;
+    printf("\n\t  Management Address Type %s (%u)",
+           tok2str(af_values, "Unknown", mgmt_addr_type),
+           mgmt_addr_type);
+
+    /*
+     * Resolve the passed in Address.
+     */
+    switch(mgmt_addr_type) {
+    case AFNUM_INET:
+        printf(", %s", ipaddr_string(tptr + 1));
+        break;
+
+#ifdef INET6
+    case AFNUM_INET6:
+        printf(", %s", ip6addr_string(tptr + 1));
+        break;
+#endif
+
+    default:
+        hexdump = TRUE;
+        break;
+    }
+
+    return hexdump;
+}
+
+/*
+ * The egress-ID string is a 16-Bit string plus a MAC address.
+ */
+const char *
+cfm_egress_id_string(register const u_char *tptr) {
+    static char egress_id_buffer[80];
+    
+    snprintf(egress_id_buffer, sizeof(egress_id_buffer),
+             "MAC %0x4x-%s",
+             EXTRACT_16BITS(tptr),
+             etheraddr_string(tptr+2));
+
+    return egress_id_buffer;
+}
+
+void
+cfm_print(register const u_char *pptr, register u_int length) {
+
+    const struct cfm_common_header_t *cfm_common_header;
+    const struct cfm_tlv_header_t *cfm_tlv_header;
+    const u_int8_t *tptr, *tlv_ptr, *ma_name, *ma_nameformat, *ma_namelength;
+    u_int hexdump, tlen, cfm_tlv_len, cfm_tlv_type, ccm_interval;
+
+
+    union {
+        const struct cfm_ccm_t *cfm_ccm;
+        const struct cfm_lbm_t *cfm_lbm;
+        const struct cfm_ltm_t *cfm_ltm;
+        const struct cfm_ltr_t *cfm_ltr;
+    } msg_ptr;
+
+    tptr=pptr;
+    cfm_common_header = (const struct cfm_common_header_t *)pptr;
+    TCHECK(*cfm_common_header);
+
+    /*
+     * Sanity checking of the header.
+     */
+    if (CFM_EXTRACT_VERSION(cfm_common_header->mdlevel_version) != CFM_VERSION) {
+       printf("CFMv%u not supported, length %u",
+               CFM_EXTRACT_VERSION(cfm_common_header->mdlevel_version), length);
+       return;
+    }
+
+    printf("CFMv%u %s, MD Level %u, length %u",
+           CFM_EXTRACT_VERSION(cfm_common_header->mdlevel_version),
+           tok2str(cfm_opcode_values, "unknown (%u)", cfm_common_header->opcode),
+           CFM_EXTRACT_MD_LEVEL(cfm_common_header->mdlevel_version),
+           length);
+
+    /*
+     * In non-verbose mode just print the opcode and md-level.
+     */
+    if (vflag < 1) {
+        return;
+    }
+
+    printf("\n\tFirst TLV offset %u", cfm_common_header->first_tlv_offset);
+
+    tptr += sizeof(const struct cfm_common_header_t);
+    tlen = length - sizeof(struct cfm_common_header_t);
+
+    switch (cfm_common_header->opcode) {
+    case CFM_OPCODE_CCM:
+        msg_ptr.cfm_ccm = (const struct cfm_ccm_t *)tptr;
+
+        ccm_interval = CFM_EXTRACT_CCM_INTERVAL(cfm_common_header->flags);
+        printf(", Flags [CCM Interval %u%s]",
+               ccm_interval,
+               cfm_common_header->flags & CFM_CCM_RDI_FLAG ?
+               ", RDI" : "");
+
+        /*
+         * Resolve the CCM interval field.
+         */
+        if (ccm_interval) {
+            printf("\n\t  CCM Interval %.3fs"
+                   ", min CCM Lifetime %.3fs, max CCM Lifetime %.3fs",
+                   ccm_interval_base[ccm_interval],
+                   ccm_interval_base[ccm_interval] * CCM_INTERVAL_MIN_MULTIPLIER,
+                   ccm_interval_base[ccm_interval] * CCM_INTERVAL_MAX_MULTIPLIER);
+        }
+
+        printf("\n\t  Sequence Number 0x%08x, MA-End-Point-ID 0x%04x",
+               EXTRACT_32BITS(msg_ptr.cfm_ccm->sequence),
+               EXTRACT_16BITS(msg_ptr.cfm_ccm->ma_epi));
+
+
+        /*
+         * Resolve the MD fields.
+         */
+        printf("\n\t  MD Name Format %s (%u), MD Name length %u",
+               tok2str(cfm_md_nameformat_values, "Unknown",
+                       msg_ptr.cfm_ccm->md_nameformat),
+               msg_ptr.cfm_ccm->md_nameformat,
+               msg_ptr.cfm_ccm->md_namelength);
+
+        if (msg_ptr.cfm_ccm->md_nameformat != CFM_CCM_MD_FORMAT_NONE) {
+            printf("\n\t  MD Name: ");
+            switch (msg_ptr.cfm_ccm->md_nameformat) {
+            case CFM_CCM_MD_FORMAT_DNS:
+            case CFM_CCM_MD_FORMAT_CHAR:
+                safeputs((const char *)msg_ptr.cfm_ccm->md_name, msg_ptr.cfm_ccm->md_namelength);
+                break;
+
+            case CFM_CCM_MD_FORMAT_MAC:
+                printf("\n\t  MAC %s", etheraddr_string(
+                           msg_ptr.cfm_ccm->md_name));
+                break;
+
+                /* FIXME add printers for those MD formats - hexdump for now */
+            case CFM_CCM_MA_FORMAT_8021:
+            default:
+                print_unknown_data(msg_ptr.cfm_ccm->md_name, "\n\t    ",
+                                   msg_ptr.cfm_ccm->md_namelength);
+            }
+        }
+
+
+        /*
+         * Resolve the MA fields.
+         */
+        ma_nameformat = msg_ptr.cfm_ccm->md_name + msg_ptr.cfm_ccm->md_namelength;
+        ma_namelength = msg_ptr.cfm_ccm->md_name + msg_ptr.cfm_ccm->md_namelength + 1;
+        ma_name = msg_ptr.cfm_ccm->md_name + msg_ptr.cfm_ccm->md_namelength + 2;
+
+        printf("\n\t  MA Name-Format %s (%u), MA name length %u",
+               tok2str(cfm_ma_nameformat_values, "Unknown",
+                       *ma_nameformat),
+               *ma_nameformat,
+               *ma_namelength);        
+
+        printf("\n\t  MA Name: ");
+        switch (*ma_nameformat) {
+        case CFM_CCM_MA_FORMAT_CHAR:
+            safeputs((const char *)ma_name, *ma_namelength);
+            break;
+
+            /* FIXME add printers for those MA formats - hexdump for now */
+        case CFM_CCM_MA_FORMAT_8021:
+        case CFM_CCM_MA_FORMAT_VID:
+        case CFM_CCM_MA_FORMAT_INT:
+        case CFM_CCM_MA_FORMAT_VPN:
+        default:
+            print_unknown_data(ma_name, "\n\t    ", *ma_namelength);
+        }
+        break;
+
+    case CFM_OPCODE_LTM:
+        printf(", Flags [%s]",
+               bittok2str(cfm_ltm_flag_values, "none",  cfm_common_header->flags));
+
+        printf("\n\t  Transaction-ID 0x%08x, Egress-ID %s, ttl %u",
+               EXTRACT_32BITS(msg_ptr.cfm_ltm->transaction_id),
+               cfm_egress_id_string(msg_ptr.cfm_ltm->egress_id),
+               msg_ptr.cfm_ltm->ttl);
+
+        printf("\n\t  Original-MAC %s, Target-MAC %s",
+               etheraddr_string(msg_ptr.cfm_ltm->original_mac),
+               etheraddr_string(msg_ptr.cfm_ltm->target_mac));
+        break;
+
+    case CFM_OPCODE_LTR:
+        printf(", Flags [%s]",
+               bittok2str(cfm_ltr_flag_values, "none",  cfm_common_header->flags));
+
+        printf("\n\t  Transaction-ID 0x%08x, Last-Egress-ID %s",
+               EXTRACT_32BITS(msg_ptr.cfm_ltr->transaction_id),
+               cfm_egress_id_string(msg_ptr.cfm_ltr->last_egress_id));
+
+        printf("\n\t  Next-Egress-ID %s, ttl %u",
+               cfm_egress_id_string(msg_ptr.cfm_ltr->next_egress_id),
+               msg_ptr.cfm_ltr->ttl);
+
+        printf("\n\t  Replay-Action %s (%u)",
+               tok2str(cfm_ltr_replay_action_values,
+                       "Unknown",
+                       msg_ptr.cfm_ltr->replay_action),
+               msg_ptr.cfm_ltr->replay_action);
+        break;
+
+        /*
+         * No message decoder yet.
+         * Hexdump everything up until the start of the TLVs
+         */
+    case CFM_OPCODE_LBR:
+    case CFM_OPCODE_LBM:
+    default:
+        if (tlen > cfm_common_header->first_tlv_offset) {
+            print_unknown_data(tptr, "\n\t  ",
+                               tlen -  cfm_common_header->first_tlv_offset);
+        }
+        break;
+    }
+
+    /*
+     * Sanity check for not walking off.
+     */
+    if (tlen <= cfm_common_header->first_tlv_offset) {
+        return;
+    }
+
+    tptr += cfm_common_header->first_tlv_offset;
+    tlen -= cfm_common_header->first_tlv_offset;
+    
+    while (tlen > 0) {
+        cfm_tlv_header = (const struct cfm_tlv_header_t *)tptr;
+
+        /* Enough to read the tlv type ? */
+        TCHECK2(*tptr, 1);
+        cfm_tlv_type=cfm_tlv_header->type;
+
+        if (cfm_tlv_type != CFM_TLV_END) {
+            /* did we capture enough for fully decoding the object header ? */
+            TCHECK2(*tptr, sizeof(struct cfm_tlv_header_t));            
+            cfm_tlv_len=EXTRACT_16BITS(&cfm_tlv_header->length);
+        } else {
+            cfm_tlv_len = 0;
+        }
+
+        printf("\n\t%s TLV (0x%02x), length %u",
+               tok2str(cfm_tlv_values, "Unknown", cfm_tlv_type),
+               cfm_tlv_type,
+               cfm_tlv_len);
+
+        /* sanity check for not walking off and infinite loop check. */
+        if ((cfm_tlv_type != CFM_TLV_END) &&
+            ((cfm_tlv_len + sizeof(struct cfm_tlv_header_t) > tlen) ||
+             (!cfm_tlv_len))) {
+            print_unknown_data(tptr,"\n\t  ",tlen);
+            return;
+        }
+
+        tptr += sizeof(struct cfm_tlv_header_t);
+        tlen -= sizeof(struct cfm_tlv_header_t);
+        tlv_ptr = tptr;
+
+        /* did we capture enough for fully decoding the object ? */
+        if (cfm_tlv_type != CFM_TLV_END) {
+            TCHECK2(*tptr, cfm_tlv_len);
+        }
+        hexdump = FALSE;
+
+        switch(cfm_tlv_type) {
+        case CFM_TLV_END:
+            /* we are done - bail out */
+            return;
+
+        case CFM_TLV_PORT_STATUS:
+            printf(", Status: %s (%u)",
+                   tok2str(cfm_tlv_port_status_values, "Unknown", *tptr),
+                   *tptr);
+            break;
+
+        case CFM_TLV_INTERFACE_STATUS:
+            printf(", Status: %s (%u)",
+                   tok2str(cfm_tlv_interface_status_values, "Unknown", *tptr),
+                   *tptr);
+            break;
+
+        case CFM_TLV_PRIVATE:
+            printf(", Vendor: %s (%u), Sub-Type %u",
+                   tok2str(oui_values,"Unknown", EXTRACT_24BITS(tptr)),
+                   EXTRACT_24BITS(tptr),
+                   *(tptr+3));
+            hexdump = TRUE;
+            break;
+
+        case CFM_TLV_SENDER_ID:
+        {
+            u_int chassis_id_type, chassis_id_length;
+            u_int mgmt_addr_length;
+
+            /*
+             * Check if there is a Chassis-ID.
+             */
+            chassis_id_length = *tptr;
+            if (chassis_id_length > tlen) {
+                hexdump = TRUE;
+                break;
+            }
+
+            tptr++;
+            tlen--;
+
+            if (chassis_id_length) {
+                chassis_id_type = *tptr;
+                printf("\n\t  Chassis-ID Type %s (%u), Chassis-ID length %u",
+                       tok2str(cfm_tlv_senderid_chassisid_values,
+                               "Unknown",
+                               chassis_id_type),
+                       chassis_id_type,
+                       chassis_id_length);
+
+                switch (chassis_id_type) {
+                case CFM_CHASSIS_ID_MAC_ADDRESS:
+                    printf("\n\t  MAC %s", etheraddr_string(tptr+1));
+                    break;
+
+                case CFM_CHASSIS_ID_NETWORK_ADDRESS:
+                    hexdump |= cfm_mgmt_addr_print(tptr);
+                    break;
+
+                case CFM_CHASSIS_ID_INTERFACE_NAME: /* fall through */
+                case CFM_CHASSIS_ID_INTERFACE_ALIAS:
+                case CFM_CHASSIS_ID_LOCAL:
+                case CFM_CHASSIS_ID_CHASSIS_COMPONENT:
+                case CFM_CHASSIS_ID_PORT_COMPONENT:
+                    safeputs((const char *)tptr+1, chassis_id_length);
+                    break;
+
+                default:
+                    hexdump = TRUE;
+                    break;
+                }
+            }
+
+            tptr += chassis_id_length;
+            tlen -= chassis_id_length;
+
+            /*
+             * Check if there is a Management Address.
+             */
+            mgmt_addr_length = *tptr;
+            if (mgmt_addr_length > tlen) {
+                hexdump = TRUE;
+                break;
+            }
+
+            tptr++;
+            tlen--;
+
+            if (mgmt_addr_length) {
+                hexdump |= cfm_mgmt_addr_print(tptr);
+            }
+
+            tptr += mgmt_addr_length;
+            tlen -= mgmt_addr_length;
+
+        }
+        break;
+
+            /*
+             * FIXME those are the defined TLVs that lack a decoder
+             * you are welcome to contribute code ;-)
+             */
+
+        case CFM_TLV_DATA:
+        case CFM_TLV_REPLY_INGRESS:
+        case CFM_TLV_REPLY_EGRESS:
+        default:
+            hexdump = TRUE;
+            break;
+        }
+        /* do we want to see an additional hexdump ? */
+        if (hexdump || vflag > 1)
+            print_unknown_data(tlv_ptr, "\n\t  ", cfm_tlv_len);
+
+        tptr+=cfm_tlv_len;
+        tlen-=cfm_tlv_len;
+    }
+    return;
+trunc:
+    printf("\n\t\t packet exceeded snapshot");
+}
index b7654f5..238e91a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32.2.11 2005/11/29 08:57:10 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.43 2005-11-29 08:56:19 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 774b700..e9d672f 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.25.2.1 2005/07/07 01:24:34 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.26 2005-07-07 01:22:17 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 9fdfbd4..86d7128 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.16.2.1 2005/04/20 20:53:39 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.17 2005-04-20 20:53:18 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index e6bfca6..b7377cf 100644 (file)
@@ -9,7 +9,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-dccp.c,v 1.1.2.6 2006/02/19 05:08:44 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-dccp.c,v 1.7.2.1 2007-11-09 00:45:16 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -60,9 +60,20 @@ static const char *dccp_feature_nums[] = {
        "check data checksum",
 };
 
+static inline int dccp_csum_coverage(const struct dccp_hdr* dh, u_int len)
+{
+       u_int cov;
+       
+       if (DCCPH_CSCOV(dh) == 0)
+               return len;
+       cov = (dh->dccph_doff + DCCPH_CSCOV(dh) - 1) * sizeof(u_int32_t);
+       return (cov > len)? len : cov;
+}
+
 static int dccp_cksum(const struct ip *ip,
        const struct dccp_hdr *dh, u_int len)
 {
+       int cov = dccp_csum_coverage(dh, len);
        union phu {
                struct phdr {
                        u_int32_t src;
@@ -86,15 +97,15 @@ static int dccp_cksum(const struct ip *ip,
                phu.ph.dst = ip_finddst(ip);
 
        sp = &phu.pa[0];
-       return in_cksum((u_short *)dh, len, sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5]);
+       return in_cksum((u_short *)dh, cov, sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5]);
 }
 
 #ifdef INET6
 static int dccp6_cksum(const struct ip6_hdr *ip6, const struct dccp_hdr *dh, u_int len)
 {
        size_t i;
-       const u_int16_t *sp;
-       u_int32_t sum;
+       u_int32_t sum = 0;
+       int cov = dccp_csum_coverage(dh, len);
        union {
                struct {
                        struct in6_addr ph_src;
@@ -113,23 +124,10 @@ static int dccp6_cksum(const struct ip6_hdr *ip6, const struct dccp_hdr *dh, u_i
        phu.ph.ph_len = htonl(len);
        phu.ph.ph_nxt = IPPROTO_DCCP;
 
-       sum = 0;
        for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
                sum += phu.pa[i];
 
-       sp = (const u_int16_t *)dh;
-
-       for (i = 0; i < (len & ~1); i += 2)
-               sum += *sp++;
-
-       if (len & 1)
-               sum += htons((*(const u_int8_t *)sp) << 8);
-
-       while (sum > 0xffff)
-               sum = (sum & 0xffff) + (sum >> 16);
-       sum = ~sum & 0xffff;
-
-       return (sum);
+       return in_cksum((u_short *)dh, cov, sum);
 }
 #endif
 
@@ -279,32 +277,21 @@ void dccp_print(const u_char *bp, const u_char *data2, u_int len)
        }
 
        /* checksum calculation */
-#ifdef INET6
-       if (ip6) {
-               if (ip6->ip6_plen && vflag) {
-                       u_int16_t sum, dccp_sum;
+       if (vflag && TTEST2(bp[0], len)) {
+               u_int16_t sum = 0, dccp_sum;
 
+               dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);
+               (void)printf("cksum 0x%04x ", dccp_sum);
+               if (IP_V(ip) == 4)
+                       sum = dccp_cksum(ip, dh, len);
+#ifdef INET6
+               else if (IP_V(ip) == 6)
                        sum = dccp6_cksum(ip6, dh, len);
-                       dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);         
-                       printf("cksum 0x%04x", dccp_sum);               
-                       if (sum != 0) {
-                               (void)printf(" (incorrect (-> 0x%04x), ",in_cksum_shouldbe(dccp_sum, sum));
-                       } else
-                               (void)printf(" (correct), ");
-               }                                       
-       } else 
-#endif /* INET6 */
-       if (vflag)
-       {
-               u_int16_t sum, dccp_sum;
-
-               sum = dccp_cksum(ip, dh, len);
-               dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);         
-               printf("cksum 0x%04x", dccp_sum);               
-               if (sum != 0) {
-                       (void)printf(" (incorrect (-> 0x%04x), ",in_cksum_shouldbe(dccp_sum, sum));
-               } else
-                       (void)printf(" (correct), ");
+#endif
+               if (sum != 0)
+                       (void)printf("(incorrect -> 0x%04x), ",in_cksum_shouldbe(dccp_sum, sum));
+               else
+                       (void)printf("(correct), ");
        }
 
        switch (DCCPH_TYPE(dh)) {
index ae7ba5c..7fea582 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.38.2.1 2005/05/06 02:16:53 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.39 2005-05-06 02:16:26 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 9f4999d..ec0df76 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.35.2.1 2006/10/25 22:04:36 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.36.2.1 2008-02-06 10:26:27 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -80,6 +80,8 @@ static const char rcsid[] _U_ =
 #define DH6_INFORM_REQ 11
 #define DH6_RELAY_FORW 12
 #define DH6_RELAY_REPLY        13
+#define DH6_LEASEQUERY 14
+#define DH6_LQ_REPLY   15
 
 /* DHCP6 base packet format */
 struct dhcp6 {
@@ -130,6 +132,10 @@ struct dhcp6_relay {
 #  define DH6OPT_STCODE_NOTONLINK 4
 #  define DH6OPT_STCODE_USEMULTICAST 5
 #  define DH6OPT_STCODE_NOPREFIXAVAIL 6
+#  define DH6OPT_STCODE_UNKNOWNQUERYTYPE 7
+#  define DH6OPT_STCODE_MALFORMEDQUERY 8
+#  define DH6OPT_STCODE_NOTCONFIGURED 9
+#  define DH6OPT_STCODE_NOTALLOWED 10
 #define DH6OPT_RAPID_COMMIT 14
 #define DH6OPT_USER_CLASS 15
 #define DH6OPT_VENDOR_CLASS 16
@@ -155,6 +161,15 @@ struct dhcp6_relay {
 #define DH6OPT_REMOTE_ID 37
 #define DH6OPT_SUBSCRIBER_ID 38
 #define DH6OPT_CLIENT_FQDN 39
+#define DH6OPT_PANA_AGENT 40
+#define DH6OPT_NEW_POSIX_TIMEZONE 41
+#define DH6OPT_NEW_TZDB_TIMEZONE 42
+#define DH6OPT_ERO 43
+#define DH6OPT_LQ_QUERY 44
+#define DH6OPT_CLIENT_DATA 45
+#define DH6OPT_CLT_TIME 46
+#define DH6OPT_LQ_RELAY_DATA 47
+#define DH6OPT_LQ_CLIENT_LINK 48
 
 struct dhcp6opt {
        u_int16_t dh6opt_type;
@@ -280,6 +295,24 @@ dhcp6opt_name(int type)
                return "Subscriber ID";
        case DH6OPT_CLIENT_FQDN:
                return "Client FQDN";
+       case DH6OPT_PANA_AGENT:
+               return "PANA agent";
+       case DH6OPT_NEW_POSIX_TIMEZONE:
+               return "POSIX timezone";
+       case DH6OPT_NEW_TZDB_TIMEZONE:
+               return "POSIX tz database";
+       case DH6OPT_ERO:
+               return "Echo request option";
+       case DH6OPT_LQ_QUERY:
+               return "Lease query";
+       case DH6OPT_CLIENT_DATA:
+               return "LQ client data";
+       case DH6OPT_CLT_TIME:
+               return "Clt time";
+       case DH6OPT_LQ_RELAY_DATA:
+               return "LQ relay data";
+       case DH6OPT_LQ_CLIENT_LINK:
+               return "LQ client link";
        default:
                snprintf(genstr, sizeof(genstr), "opt_%d", type);
                return(genstr);
@@ -309,6 +342,14 @@ dhcp6stcode(int code)
                return "use multicast";
        case DH6OPT_STCODE_NOPREFIXAVAIL:
                return "no prefixes";
+       case DH6OPT_STCODE_UNKNOWNQUERYTYPE:
+               return "unknown query type";
+       case DH6OPT_STCODE_MALFORMEDQUERY:
+               return "malformed query";
+       case DH6OPT_STCODE_NOTCONFIGURED:
+               return "not configured";
+       case DH6OPT_STCODE_NOTALLOWED:
+               return "not allowed";
        default:
                snprintf(genstr, sizeof(genstr), "code%d", code);
                return(genstr);
@@ -420,6 +461,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                        printf(")");
                        break;
                case DH6OPT_ORO:
+               case DH6OPT_ERO:
                        if (optlen % 2) {
                                printf(" ?)");
                                break;
@@ -549,12 +591,15 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                        printf(")");
                        break;
                case DH6OPT_INTERFACE_ID:
+               case DH6OPT_SUBSCRIBER_ID:
                        /*
                         * Since we cannot predict the encoding, print hex dump
                         * at most 10 characters.
                         */
+                       printf(" ");
                        for (i = 0; i < optlen && i < 10; i++)
                                printf("%02x", ((u_char *)(dh6o + 1))[i]);
+                       printf("...)");
                        break;
                case DH6OPT_RECONF_MSG:
                        tp = (u_char *)(dh6o + 1);
@@ -579,6 +624,8 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                case DH6OPT_NIS_SERVERS:
                case DH6OPT_NISP_SERVERS:
                case DH6OPT_BCMCS_SERVER_A:
+               case DH6OPT_PANA_AGENT:
+               case DH6OPT_LQ_CLIENT_LINK:
                        if (optlen % 16) {
                                printf(" ?)");
                                break;
@@ -618,6 +665,21 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                        }
                        printf(")");
                        break;
+               case DH6OPT_IA_TA:
+                       if (optlen < 4) {
+                               printf(" ?)");
+                               break;
+                       }
+                       memcpy(&val32, dh6o + 1, sizeof(val32));
+                       val32 = ntohl(val32);
+                       printf(" IAID:%lu", (unsigned long)val32);
+                       if (optlen > 4) {
+                               /* there are sub-options */
+                               dhcp6opt_print((u_char *)(dh6o + 1) + 4,
+                                   (u_char *)(dh6o + 1) + optlen);
+                       }
+                       printf(")");
+                       break;
                case DH6OPT_IA_PD_PREFIX:
                        if (optlen < sizeof(ia_prefix) - 4) {
                                printf(" ?)");
@@ -643,6 +705,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                        printf(")");
                        break;
                case DH6OPT_LIFETIME:
+               case DH6OPT_CLT_TIME:
                        if (optlen != 4) {
                                printf(" ?)");
                                break;
@@ -651,6 +714,68 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                        val32 = ntohl(val32);
                        printf(" %d)", (int)val32);
                        break;
+               case DH6OPT_REMOTE_ID:
+                       if (optlen < 4) {
+                               printf(" ?)");
+                               break;
+                       }
+                       tp = (u_char *)(dh6o + 1);
+                       memcpy(&val32, &tp[0], sizeof(val32));
+                       val32 = ntohl(val32);
+                       printf(" %d ", (int)val32);
+                       /*
+                        * Print hex dump first 10 characters.
+                        */
+                       for (i = 4; i < optlen && i < 14; i++)
+                               printf("%02x", tp[i]);
+                       printf("...)");
+                       break;
+               case DH6OPT_LQ_QUERY:
+                       if (optlen < 17) {
+                               printf(" ?)");
+                               break;
+                       }
+                       tp = (u_char *)(dh6o + 1);
+                       switch (*tp) {
+                       case 1:
+                               printf(" by-address");
+                               break;
+                       case 2:
+                               printf(" by-clientID");
+                               break;
+                       default:
+                               printf(" type_%d", (int)*tp);
+                               break;
+                       }
+                       printf(" %s", ip6addr_string(&tp[1]));
+                       if (optlen > 17) {
+                               /* there are query-options */
+                               dhcp6opt_print(tp + 17, tp + optlen);
+                       }
+                       printf(")");
+                       break;
+               case DH6OPT_CLIENT_DATA:
+                       if (optlen > 0) {
+                               /* there are encapsulated options */
+                               dhcp6opt_print((u_char *)(dh6o + 1),
+                                   (u_char *)(dh6o + 1) + optlen);
+                       }
+                       printf(")");
+                       break;
+               case DH6OPT_LQ_RELAY_DATA:
+                       if (optlen < 16) {
+                               printf(" ?)");
+                               break;
+                       }
+                       tp = (u_char *)(dh6o + 1);
+                       printf(" %s ", ip6addr_string(&tp[0]));
+                       /*
+                        * Print hex dump first 10 characters.
+                        */
+                       for (i = 16; i < optlen && i < 26; i++)
+                               printf("%02x", tp[i]);
+                       printf("...)");
+                       break;
                default:
                        printf(")");
                        break;
@@ -725,6 +850,12 @@ dhcp6_print(const u_char *cp, u_int length)
        case DH6_RELAY_REPLY:
                name= "relay-reply";
                break;
+       case DH6_LEASEQUERY:
+               name= "leasequery";
+               break;
+       case DH6_LQ_REPLY:
+               name= "leasequery-reply";
+               break;
        default:
                name = NULL;
                break;
index d4a35d8..80b4b33 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.8 2007/02/13 19:19:27 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.97.2.1 2007-12-09 01:51:12 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -387,13 +387,22 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
                        printf(" (Cache flush)");
        }
 
-       /* ignore ttl */
-       cp += 2;
-       /* if T_OPT, save opt_flags */
-       if (typ == T_OPT)
+       if (typ == T_OPT) {
+               /* get opt flags */
+               cp += 2;
                opt_flags = EXTRACT_16BITS(cp);
-       /* ignore rest of ttl */
-       cp += 2;
+               /* ignore rest of ttl field */
+               cp += 2;
+       } else if (vflag > 2) {
+               /* print ttl */
+               printf(" [");
+               relts_print(EXTRACT_32BITS(cp));
+               printf("]");
+               cp += 4;
+       } else {
+               /* ignore ttl */
+               cp += 4;
+       }
 
        len = EXTRACT_16BITS(cp);
        cp += 2;
@@ -408,7 +417,7 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
        case T_A:
                if (!TTEST2(*cp, sizeof(struct in_addr)))
                        return(NULL);
-               printf(" %s", ipaddr_string(cp));
+               printf(" %s", intoa(htonl(EXTRACT_32BITS(cp))));
                break;
 
        case T_NS:
@@ -475,15 +484,24 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
 
 #ifdef INET6
        case T_AAAA:
+           {
+               struct in6_addr addr;
+               char ntop_buf[INET6_ADDRSTRLEN];
+
                if (!TTEST2(*cp, sizeof(struct in6_addr)))
                        return(NULL);
-               printf(" %s", ip6addr_string(cp));
+               memcpy(&addr, cp, sizeof(struct in6_addr));
+               printf(" %s",
+                   inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf)));
+
                break;
+           }
 
        case T_A6:
            {
                struct in6_addr a;
                int pbit, pbyte;
+               char ntop_buf[INET6_ADDRSTRLEN];
 
                if (!TTEST2(*cp, 1))
                        return(NULL);
@@ -497,7 +515,8 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
                                return(NULL);
                        memset(&a, 0, sizeof(a));
                        memcpy(&a.s6_addr[pbyte], cp + 1, sizeof(a) - pbyte);
-                       printf(" %u %s", pbit, ip6addr_string(&a));
+                       printf(" %u %s", pbit,
+                           inet_ntop(AF_INET6, &a, ntop_buf, sizeof(ntop_buf)));
                }
                if (pbit > 0) {
                        putchar(' ');
diff --git a/contrib/tcpdump/print-dtp.c b/contrib/tcpdump/print-dtp.c
new file mode 100644 (file)
index 0000000..c358a89
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 1998-2007 The TCPDUMP project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
+ * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
+ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE.
+ *
+ * Dynamic Trunk Protocol (DTP)
+ *
+ * Original code by Carles Kishimoto <carles.kishimoto@gmail.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "interface.h"
+#include "addrtoname.h"
+#include "extract.h"           
+#include "nlpid.h"
+
+#define DTP_HEADER_LEN                 1
+#define DTP_DOMAIN_TLV                 0x0001
+#define DTP_STATUS_TLV                 0x0002
+#define DTP_DTP_TYPE_TLV               0x0003
+#define DTP_NEIGHBOR_TLV               0x0004
+
+static struct tok dtp_tlv_values[] = {
+    { DTP_DOMAIN_TLV, "Domain TLV"},
+    { DTP_STATUS_TLV, "Status TLV"},
+    { DTP_DTP_TYPE_TLV, "DTP type TLV"},
+    { DTP_NEIGHBOR_TLV, "Neighbor TLV"},
+    { 0, NULL}
+};
+
+void
+dtp_print (const u_char *pptr, u_int length)
+{
+    int type, len;
+    const u_char *tptr;
+
+    if (length < DTP_HEADER_LEN)
+        goto trunc;
+
+    tptr = pptr; 
+
+    if (!TTEST2(*tptr, DTP_HEADER_LEN))        
+       goto trunc;
+
+    printf("DTPv%u, length %u", 
+           (*tptr),
+           length);
+
+    /*
+     * In non-verbose mode, just print version.
+     */
+    if (vflag < 1) {
+       return;
+    }
+
+    tptr += DTP_HEADER_LEN;
+
+    while (tptr < (pptr+length)) {
+
+        if (!TTEST2(*tptr, 4)) 
+            goto trunc;
+
+       type = EXTRACT_16BITS(tptr);
+        len  = EXTRACT_16BITS(tptr+2); 
+
+        /* infinite loop check */
+        if (type == 0 || len == 0) {
+            return;
+        }
+
+        printf("\n\t%s (0x%04x) TLV, length %u",
+               tok2str(dtp_tlv_values, "Unknown", type),
+               type, len);
+
+        switch (type) {
+       case DTP_DOMAIN_TLV:
+               printf(", %s", tptr+4);
+               break;
+
+       case DTP_STATUS_TLV:            
+       case DTP_DTP_TYPE_TLV:
+                printf(", 0x%x", *(tptr+4));
+                break;
+
+       case DTP_NEIGHBOR_TLV:
+                printf(", %s", etheraddr_string(tptr+4));
+                break;
+
+        default:
+            break;
+        }      
+        tptr += len;
+    }
+
+    return;
+
+ trunc:
+    printf("[|dtp]");
+}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 4
+ * End:
+ */
index 2c159bf..437e716 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.27 2003/11/19 09:42:04 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.27 2003-11-19 09:42:04 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index fb39e76..9fb333a 100644 (file)
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * Format and print bootp packets.
+ * Format and print EAP packets.
+ *
  */
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-eap.c,v 1.3 2004/04/23 19:03:39 mcr Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-eap.c,v 1.5 2007-10-04 16:41:33 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -35,37 +36,272 @@ static const char rcsid[] _U_ =
 #include <string.h>
 
 #include "netdissect.h"
+#include "interface.h"
 #include "addrtoname.h"
 #include "extract.h"
 #include "ether.h"
 
+#define        EAP_FRAME_TYPE_PACKET           0
+#define        EAP_FRAME_TYPE_START            1
+#define        EAP_FRAME_TYPE_LOGOFF           2
+#define        EAP_FRAME_TYPE_KEY              3
+#define        EAP_FRAME_TYPE_ENCAP_ASF_ALERT  4
+
+struct eap_frame_t {
+    unsigned char   version;
+    unsigned char   type;
+    unsigned char   length[2];
+};
+
+static const struct tok eap_frame_type_values[] = {
+    { EAP_FRAME_TYPE_PACKET,           "EAP packet" },
+    { EAP_FRAME_TYPE_START,                    "EAPOL start" },
+    { EAP_FRAME_TYPE_LOGOFF,           "EAPOL logoff" },
+    { EAP_FRAME_TYPE_KEY,                      "EAPOL key" },
+    { EAP_FRAME_TYPE_ENCAP_ASF_ALERT,  "Encapsulated ASF alert" },
+    { 0, NULL}
+};
+
+/* RFC 3748 */
 struct eap_packet_t {
-       unsigned char   code;
-       unsigned char   id;
-       unsigned char   length[2];
-       unsigned char   data[1];
+    unsigned char      code;
+    unsigned char      id;
+    unsigned char      length[2];
+};
+
+#define                EAP_REQUEST     1
+#define                EAP_RESPONSE    2
+#define                EAP_SUCCESS     3
+#define                EAP_FAILURE     4
+
+static const struct tok eap_code_values[] = {
+    { EAP_REQUEST,     "Request" },
+    { EAP_RESPONSE,    "Response" },
+    { EAP_SUCCESS,     "Success" },
+    { EAP_FAILURE,     "Failure" },
+    { 0, NULL}
+};
+
+#define                EAP_TYPE_NO_PROPOSED    0
+#define                EAP_TYPE_IDENTITY       1
+#define                EAP_TYPE_NOTIFICATION   2
+#define                EAP_TYPE_NAK            3
+#define                EAP_TYPE_MD5_CHALLENGE  4
+#define                EAP_TYPE_OTP            5
+#define                EAP_TYPE_GTC            6
+#define                EAP_TYPE_TLS            13              /* RFC 2716 */
+#define                EAP_TYPE_SIM            18              /* RFC 4186 */
+#define                EAP_TYPE_TTLS           21              /* draft-funk-eap-ttls-v0-01.txt */
+#define                EAP_TYPE_AKA            23              /* RFC 4187 */
+#define                EAP_TYPE_FAST           43              /* RFC 4851 */
+#define                EAP_TYPE_EXPANDED_TYPES 254
+#define                EAP_TYPE_EXPERIMENTAL   255
+
+static const struct tok eap_type_values[] = {
+    { EAP_TYPE_NO_PROPOSED,    "No proposed" },
+    { EAP_TYPE_IDENTITY,       "Identity" },
+    { EAP_TYPE_NOTIFICATION,    "Notification" },
+    { EAP_TYPE_NAK,            "Nak" },
+    { EAP_TYPE_MD5_CHALLENGE,   "MD5-challenge" },
+    { EAP_TYPE_OTP,            "OTP" },
+    { EAP_TYPE_GTC,            "GTC" },
+    { EAP_TYPE_TLS,            "TLS" },
+    { EAP_TYPE_SIM,            "SIM" },
+    { EAP_TYPE_TTLS,           "TTLS" },
+    { EAP_TYPE_AKA,            "AKA" },
+    { EAP_TYPE_FAST,           "FAST" },
+    { EAP_TYPE_EXPANDED_TYPES,  "Expanded types" },
+    { EAP_TYPE_EXPERIMENTAL,    "Experimental" },
+    { 0, NULL}
+};  
+
+#define EAP_TLS_EXTRACT_BIT_L(x)       (((x)&0x80)>>7)
+
+/* RFC 2716 - EAP TLS bits */
+#define EAP_TLS_FLAGS_LEN_INCLUDED             (1 << 7)
+#define EAP_TLS_FLAGS_MORE_FRAGMENTS           (1 << 6)
+#define EAP_TLS_FLAGS_START                    (1 << 5)
+
+static const struct tok eap_tls_flags_values[] = {
+       { EAP_TLS_FLAGS_LEN_INCLUDED, "L bit" },
+       { EAP_TLS_FLAGS_MORE_FRAGMENTS, "More fragments bit"},
+       { EAP_TLS_FLAGS_START, "Start bit"},
+       { 0, NULL}
+};
+
+#define EAP_TTLS_VERSION(x)            ((x)&0x07)
+
+/* EAP-AKA and EAP-SIM - RFC 4187 */
+#define EAP_AKA_CHALLENGE              1
+#define EAP_AKA_AUTH_REJECT            2
+#define EAP_AKA_SYNC_FAILURE           4
+#define EAP_AKA_IDENTITY               5
+#define EAP_SIM_START                  10
+#define EAP_SIM_CHALLENGE              11
+#define EAP_AKA_NOTIFICATION           12
+#define EAP_AKA_REAUTH                 13
+#define EAP_AKA_CLIENT_ERROR           14
+
+static const struct tok eap_aka_subtype_values[] = {
+    { EAP_AKA_CHALLENGE,       "Challenge" },
+    { EAP_AKA_AUTH_REJECT,     "Auth reject" },
+    { EAP_AKA_SYNC_FAILURE,    "Sync failure" },
+    { EAP_AKA_IDENTITY,                "Identity" },
+    { EAP_SIM_START,           "Start" },
+    { EAP_SIM_CHALLENGE,       "Challenge" },
+    { EAP_AKA_NOTIFICATION,    "Notification" },
+    { EAP_AKA_REAUTH,          "Reauth" },
+    { EAP_AKA_CLIENT_ERROR,    "Client error" },
+    { 0, NULL}
 };
 
 /*
- * Print bootp requests
+ * Print EAP requests / responses
  */
 void
-eap_print(netdissect_options *ndo,
-         register const u_char *cp,
-         u_int length _U_)
+eap_print(netdissect_options *ndo _U_,
+          register const u_char *cp,
+          u_int length _U_)
 {
-       const struct eap_packet_t *eap;
+    const struct eap_frame_t *eap;
+    const u_char *tptr;
+    u_int tlen, type, subtype;
+    int count=0, len;
+    
+    tptr = cp;
+    tlen = length;
+    eap = (const struct eap_frame_t *)cp;
+    TCHECK(*eap);
+
+    /* in non-verbose mode just lets print the basic info */
+    if (vflag < 1) {
+       printf("%s (%u) v%u, len %u",
+               tok2str(eap_frame_type_values, "unknown", eap->type),
+               eap->type,
+               eap->version,
+               EXTRACT_16BITS(eap->length));
+       return;
+    }
+  
+    printf("%s (%u) v%u, len %u", 
+           tok2str(eap_frame_type_values, "unknown", eap->type),
+           eap->type,
+           eap->version,
+           EXTRACT_16BITS(eap->length));
+
+    tptr += sizeof(const struct eap_frame_t);
+    tlen -= sizeof(const struct eap_frame_t);
+
+    switch (eap->type) {
+    case EAP_FRAME_TYPE_PACKET:
+        type = *(tptr);
+        len = EXTRACT_16BITS(tptr+2);
+        printf(", %s (%u), id %u, len %u",
+               tok2str(eap_code_values, "unknown", type),
+               type,
+               *(tptr+1),
+               len);
+
+        if (!TTEST2(*tptr, len)) 
+            goto trunc;
+
+        if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
+            subtype = *(tptr+4);
+            printf("\n\t\t Type %s (%u)",
+                   tok2str(eap_type_values, "unknown", *(tptr+4)),
+                   *(tptr+4));
+
+            switch (subtype) { 
+            case EAP_TYPE_IDENTITY:
+                if (len - 5 > 0) {
+                    printf(", Identity: ");
+                    safeputs((const char *)tptr+5, len-5);
+                }
+                break;
+
+            case EAP_TYPE_NOTIFICATION:
+                if (len - 5 > 0) {
+                    printf(", Notification: ");
+                    safeputs((const char *)tptr+5, len-5);
+                }
+                break;
+
+            case EAP_TYPE_NAK:
+                count = 5;
 
-       eap = (const struct eap_packet_t *)cp;
-       ND_TCHECK(eap->data);
+                /*
+                 * one or more octets indicating
+                 * the desired authentication
+                 * type one octet per type
+                 */
+                while (count < len) {  
+                    printf(" %s (%u),", 
+                           tok2str(eap_type_values, "unknown", *(tptr+count)),
+                           *(tptr+count));
+                    count++;
+                }
+                break;
 
-        ND_PRINT((ndo, "EAP code=%u id=%u length=%u ", 
-                 eap->code, eap->id, (eap->length[0]<<8) + eap->length[1]));
+            case EAP_TYPE_TTLS:
+                printf(" TTLSv%u", 
+                       EAP_TTLS_VERSION(*(tptr+5))); /* fall through */
+            case EAP_TYPE_TLS:
+                printf(" flags [%s] 0x%02x,", 
+                       bittok2str(eap_tls_flags_values, "none", *(tptr+5)),
+                       *(tptr+5));
 
-        if (!ndo->ndo_vflag)
-            return;
+                if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
+                   printf(" len %u", EXTRACT_32BITS(tptr+6));
+                }
+                break;
 
-trunc:
-       ;
+            case EAP_TYPE_FAST:
+                printf(" FASTv%u",
+                       EAP_TTLS_VERSION(*(tptr+5)));
+                printf(" flags [%s] 0x%02x,",
+                       bittok2str(eap_tls_flags_values, "none", *(tptr+5)),
+                       *(tptr+5));
+
+                if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
+                    printf(" len %u", EXTRACT_32BITS(tptr+6));
+                }
+
+                /* FIXME - TLV attributes follow */
+                break;
+
+            case EAP_TYPE_AKA:
+            case EAP_TYPE_SIM:
+                printf(" subtype [%s] 0x%02x,",
+                       tok2str(eap_aka_subtype_values, "unknown", *(tptr+5)),
+                       *(tptr+5));
+
+                /* FIXME - TLV attributes follow */
+                break;
+
+            case EAP_TYPE_MD5_CHALLENGE:       
+            case EAP_TYPE_OTP:
+            case EAP_TYPE_GTC:
+            case EAP_TYPE_EXPANDED_TYPES:
+            case EAP_TYPE_EXPERIMENTAL:
+            default:
+                break;
+            }
+        }
+        break; 
+
+    case EAP_FRAME_TYPE_LOGOFF:
+    case EAP_FRAME_TYPE_ENCAP_ASF_ALERT:
+    default:
+        break;
+    }
+    return;
+
+ trunc:
+    printf("\n\t[|EAP]");
 }
 
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * End:
+ */
index e5a811d..4a1d046 100644 (file)
@@ -20,7 +20,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.37 2005/01/12 11:19:09 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.38 2006-02-11 22:13:24 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -226,13 +226,23 @@ egp_print(register const u_int8_t *bp, register u_int length)
                printf("[|egp]");
                return;
        }
-       (void)printf("egp: ");
+
+        if (!vflag) {
+            printf("EGPv%u, AS %u, seq %u, length %u",
+                   egp->egp_version,
+                   EXTRACT_16BITS(&egp->egp_as),
+                   EXTRACT_16BITS(&egp->egp_sequence),
+                   length);
+            return;
+        } else
+            printf("EGPv%u, length %u",
+                   egp->egp_version,
+                   length);            
 
        if (egp->egp_version != EGP_VERSION) {
                printf("[version %d]", egp->egp_version);
                return;
        }
-       printf("as:%d seq:%d", EXTRACT_16BITS(&egp->egp_as), EXTRACT_16BITS(&egp->egp_sequence));
 
        type = egp->egp_type;
        code = egp->egp_code;
index 3168b3c..2787baf 100644 (file)
@@ -16,7 +16,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-eigrp.c,v 1.5.2.2 2005/05/06 02:53:41 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-eigrp.c,v 1.7 2005-05-06 02:53:26 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index f9b871b..9569534 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4 2005/04/06 21:32:39 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4.4.1 2008-02-06 10:34:15 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -70,8 +70,17 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
        printf("SPI 0x%08x: ", (u_int32_t)ntohl(hdr->spi));
 
        length -= ENC_HDRLEN;
-       /* XXX - use the address family */
-       ip_print(gndo, p + ENC_HDRLEN, length);
+       caplen -= ENC_HDRLEN;
+       p += ENC_HDRLEN;
+       
+       switch (hdr->af) {
+       case AF_INET:
+               ip_print(gndo, p, length);
+               break;
+       case AF_INET6:
+               ip6_print(p, length);
+               break;
+       }
 
 out:
        return (ENC_HDRLEN);
index 3ccc899..260fe87 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.55.2.1 2005/04/21 06:44:57 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.56 2005-04-21 06:44:40 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index f71a7cc..b66e885 100644 (file)
@@ -20,7 +20,7 @@
  */
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95.2.6 2006/02/20 18:15:03 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.105.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -65,14 +65,19 @@ const struct tok ethertype_values[] = {
     { ETHERTYPE_AARP,           "Appletalk ARP" },
     { ETHERTYPE_IPX,            "IPX" },
     { ETHERTYPE_PPP,            "PPP" },
+    { ETHERTYPE_MPCP,           "MPCP" },
     { ETHERTYPE_SLOW,           "Slow Protocols" },
     { ETHERTYPE_PPPOED,         "PPPoE D" },
     { ETHERTYPE_PPPOES,         "PPPoE S" },
     { ETHERTYPE_EAPOL,          "EAPOL" },
+    { ETHERTYPE_RRCP,           "RRCP" },
     { ETHERTYPE_JUMBO,          "Jumbo" },
     { ETHERTYPE_LOOPBACK,       "Loopback" },
     { ETHERTYPE_ISO,            "OSI" },
     { ETHERTYPE_GRE_ISO,        "GRE-OSI" },
+    { ETHERTYPE_CFM_OLD,        "CFM (old)" },
+    { ETHERTYPE_CFM,            "CFM" },
+    { ETHERTYPE_LLDP,           "LLDP" },
     { 0, NULL}
 };
 
@@ -291,6 +296,10 @@ ether_encap_print(u_short ether_type, const u_char *p,
                eap_print(gndo, p, length);
                return (1);
 
+       case ETHERTYPE_RRCP:
+               rrcp_print(gndo, p - 14 , length + 14);
+               return (1);
+
        case ETHERTYPE_PPP:
                if (length) {
                        printf(": ");
@@ -298,10 +307,23 @@ ether_encap_print(u_short ether_type, const u_char *p,
                }
                return (1);
 
+       case ETHERTYPE_MPCP:
+               mpcp_print(p, length);
+               return (1);
+
        case ETHERTYPE_SLOW:
                slow_print(p, length);
                return (1);
 
+       case ETHERTYPE_CFM:
+       case ETHERTYPE_CFM_OLD:
+               cfm_print(p, length);
+               return (1);
+
+       case ETHERTYPE_LLDP:
+               lldp_print(p, length);
+               return (1);
+
         case ETHERTYPE_LOOPBACK:
                 return (1);
 
index eeb7191..1e7d554 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64.2.2 2005/11/13 12:12:59 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.66 2005-11-13 12:12:41 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index b53a88b..f71aee6 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32.2.15 2006/02/01 14:39:56 hannes Exp $ (LBL)";
+       "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.51 2006-06-23 22:20:32 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -100,7 +100,7 @@ struct tok frf_flag_values[] = {
 /* Finds out Q.922 address length, DLCI and flags. Returns 0 on success
  * save the flags dep. on address length
  */
-static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *sdlcore,
+static int parse_q922_addr(const u_char *p, u_int *dlci,
                            u_int *addr_len, u_int8_t *flags)
 {
        if ((p[0] & FR_EA_BIT))
@@ -130,14 +130,26 @@ static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *sdlcore,
 
         flags[3] = p[0] & 0x02;
 
-       if (p[0] & 0x02)
-                *sdlcore =  p[0] >> 2;
-       else
-               *dlci = (*dlci << 6) | (p[0] >> 2);
+        *dlci = (*dlci << 6) | (p[0] >> 2);
 
        return 0;
 }
 
+char *q922_string(const u_char *p) {
+
+    static u_int dlci, addr_len;
+    static u_int8_t flags[4];
+    static char buffer[sizeof("DLCI xxxxxxxxxx")];
+    memset(buffer, 0, sizeof(buffer));
+
+    if (parse_q922_addr(p, &dlci, &addr_len, flags) == 0){
+        snprintf(buffer, sizeof(buffer), "DLCI %u", dlci);
+    }
+
+    return buffer;
+}
+
+
 /* Frame Relay packet structure, with flags and CRC removed
 
                   +---------------------------+
@@ -222,13 +234,12 @@ fr_print(register const u_char *p, u_int length)
 {
        u_int16_t extracted_ethertype;
        u_int dlci;
-        u_int sdlcore;
        u_int addr_len;
        u_int16_t nlpid;
        u_int hdr_len;
        u_int8_t flags[4];
 
-       if (parse_q922_addr(p, &dlci, &sdlcore, &addr_len, flags)) {
+       if (parse_q922_addr(p, &dlci, &addr_len, flags)) {
                printf("Q.922, invalid address");
                return 0;
        }
@@ -730,25 +741,29 @@ q933_print(const u_char *p, u_int length)
 
         codeset = p[2]&0x0f;   /* extract the codeset */
 
-       if (p[2] == MSG_ANSI_LOCKING_SHIFT)
-               is_ansi = 1;
+       if (p[2] == MSG_ANSI_LOCKING_SHIFT) {
+               is_ansi = 1;
+       }
     
         printf("%s", eflag ? "" : "Q.933, ");
 
        /* printing out header part */
        printf("%s, codeset %u", is_ansi ? "ANSI" : "CCITT", codeset);
 
-       if (p[0])
-               printf(", Call Ref: 0x%02x", p[0]);
-
-        if (vflag)
-            printf(", %s (0x%02x), length %u",
-                   tok2str(fr_q933_msg_values,"unknown message",p[1]),
-                   p[1],
-                   length);
-        else
-            printf(", %s",
-                   tok2str(fr_q933_msg_values,"unknown message 0x%02x",p[1]));            
+       if (p[0]) {
+               printf(", Call Ref: 0x%02x", p[0]);
+       }
+        if (vflag) {
+                printf(", %s (0x%02x), length %u",
+                      tok2str(fr_q933_msg_values,
+                              "unknown message", p[1]),
+                      p[1],
+                      length);
+        } else {
+                printf(", %s",
+                      tok2str(fr_q933_msg_values,
+                              "unknown message 0x%02x", p[1]));
+       }
 
         olen = length; /* preserve the original length for non verbose mode */
 
@@ -756,49 +771,57 @@ q933_print(const u_char *p, u_int length)
                printf("[|q.933]");
                return;
        }
-       length -= 2 - is_ansi;
+       length -= 2 + is_ansi;
        ptemp += 2 + is_ansi;
        
        /* Loop through the rest of IE */
-       while (length > sizeof(struct ie_tlv_header_t )) {
+       while (length > sizeof(struct ie_tlv_header_t)) {
                ie_p = (struct ie_tlv_header_t  *)ptemp;
-               if (length < sizeof(struct ie_tlv_header_t ) ||
-                   length < sizeof(struct ie_tlv_header_t ) + ie_p->ie_len) {
-                    if (vflag) /* not bark if there is just a trailer */
+               if (length < sizeof(struct ie_tlv_header_t) ||
+                   length < sizeof(struct ie_tlv_header_t) + ie_p->ie_len) {
+                    if (vflag) /* not bark if there is just a trailer */
                         printf("\n[|q.933]");
-                    else
+                    } else {
                         printf(", length %u",olen);
+                   }
                     return;
                }
 
                 /* lets do the full IE parsing only in verbose mode
                  * however some IEs (DLCI Status, Link Verify)
-                 * are also intereststing in non-verbose mode */
-                if (vflag)
+                 * are also interestting in non-verbose mode */
+                if (vflag) {
                     printf("\n\t%s IE (0x%02x), length %u: ",
-                           tok2str(fr_q933_ie_codesets[codeset],"unknown",ie_p->ie_type),
+                           tok2str(fr_q933_ie_codesets[codeset],
+                                  "unknown", ie_p->ie_type),
                            ie_p->ie_type,
                            ie_p->ie_len);
+               }
+
                 /* sanity check */
-                if (ie_p->ie_type == 0 || ie_p->ie_len == 0)
+                if (ie_p->ie_type == 0 || ie_p->ie_len == 0) {
                     return;
+               }
 
-                if (fr_q933_print_ie_codeset[codeset] != NULL)
+                if (fr_q933_print_ie_codeset[codeset] != NULL) {
                     ie_is_known = fr_q933_print_ie_codeset[codeset](ie_p, ptemp);
-               
-                if (vflag >= 1 && !ie_is_known)
+               }               
+
+                if (vflag >= 1 && !ie_is_known) {
                     print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len);
+               }
 
                 /* do we want to see a hexdump of the IE ? */
-                if (vflag> 1 && ie_is_known)
+                if (vflag> 1 && ie_is_known) {
                     print_unknown_data(ptemp+2,"\n\t  ",ie_p->ie_len);
+               }
 
                length = length - ie_p->ie_len - 2;
                ptemp = ptemp + ie_p->ie_len + 2;
        }
-        if (!vflag)
+        if (!vflag) {
             printf(", length %u",olen);
+       }
 }
 
 static int
@@ -810,24 +833,27 @@ fr_q933_print_ie_codeset5(const struct ie_tlv_header_t  *ie_p, const u_char *p)
 
         case FR_LMI_ANSI_REPORT_TYPE_IE: /* fall through */
         case FR_LMI_CCITT_REPORT_TYPE_IE:
-            if (vflag)
+            if (vflag) {
                 printf("%s (%u)",
                        tok2str(fr_lmi_report_type_ie_values,"unknown",p[2]),
                        p[2]);
+           }
             return 1;
 
         case FR_LMI_ANSI_LINK_VERIFY_IE: /* fall through */
         case FR_LMI_CCITT_LINK_VERIFY_IE:
         case FR_LMI_ANSI_LINK_VERIFY_IE_91:
-            if (!vflag)
+            if (!vflag) {
                 printf(", ");
+           }
             printf("TX Seq: %3d, RX Seq: %3d", p[2], p[3]);
             return 1;
 
         case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
         case FR_LMI_CCITT_PVC_STATUS_IE:
-            if (!vflag)
+            if (!vflag) {
                 printf(", ");
+           }
             /* now parse the DLCI information element. */                    
             if ((ie_p->ie_len < 3) ||
                 (p[2] & 0x80) ||
@@ -836,14 +862,17 @@ fr_q933_print_ie_codeset5(const struct ie_tlv_header_t  *ie_p, const u_char *p)
                 ((ie_p->ie_len == 5) && ((p[3] & 0x80) || (p[4] & 0x80) ||
                                    !(p[5] & 0x80))) ||
                 (ie_p->ie_len > 5) ||
-                !(p[ie_p->ie_len + 1] & 0x80))
+                !(p[ie_p->ie_len + 1] & 0x80)) {
                 printf("Invalid DLCI IE");
+           }
                     
             dlci = ((p[2] & 0x3F) << 4) | ((p[3] & 0x78) >> 3);
-            if (ie_p->ie_len == 4)
+            if (ie_p->ie_len == 4) {
                 dlci = (dlci << 6) | ((p[4] & 0x7E) >> 1);
-            else if (ie_p->ie_len == 5)
+           }
+            else if (ie_p->ie_len == 5) {
                 dlci = (dlci << 13) | (p[4] & 0x7F) | ((p[5] & 0x7E) >> 1);
+           }
 
             printf("DLCI %u: status %s%s", dlci,
                     p[ie_p->ie_len + 1] & 0x8 ? "New, " : "",
index 2c7788b..e125bd3 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.19.2.1 2005/04/20 22:33:21 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.20 2005-04-20 22:33:06 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index d739356..55f0e9d 100644 (file)
@@ -38,7 +38,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.28 2005/04/06 21:32:39 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.28 2005-04-06 21:32:39 mcr Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 1d22247..06304fd 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.9.2.1 2005/05/06 07:57:17 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.10 2005-05-06 07:56:52 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index e9e8459..36bff6a 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81.2.6 2007/09/13 17:40:18 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.87 2007-09-13 17:42:31 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -412,7 +412,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
                case ICMP_UNREACH_NEEDFRAG:
                    {
                        register const struct mtu_discovery *mp;
-                       mp = (struct mtu_discovery *)&dp->icmp_void;
+                       mp = (struct mtu_discovery *)(u_char *)&dp->icmp_void;
                        mtu = EXTRACT_16BITS(&mp->nexthopmtu);
                        if (mtu) {
                                (void)snprintf(buf, sizeof(buf),
index c503924..41d56b6 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.79.2.6 2005/09/05 09:29:28 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.85.2.1 2008-02-05 19:36:58 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1192,9 +1192,9 @@ icmp6_rrenum_print(const u_char *bp, const u_char *ep)
                            F(ICMP6_RR_FLAGS_PREVDONE, "P"));
                }
                printf("seg=%u,", rr6->rr_segnum);
-               printf("maxdelay=%u", rr6->rr_maxdelay);
+               printf("maxdelay=%u", EXTRACT_16BITS(&rr6->rr_maxdelay));
                if (rr6->rr_reserved)
-                       printf("rsvd=0x%x", EXTRACT_16BITS(&rr6->rr_reserved));
+                       printf("rsvd=0x%x", EXTRACT_32BITS(&rr6->rr_reserved));
                /*[*/
                printf("]");
 #undef F
index c310d55..a848562 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.15 2004/03/24 00:59:16 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.15 2004-03-24 00:59:16 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 898471d..3cede7e 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.20.2.1 2005/04/20 21:02:15 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.21 2005-04-20 21:01:56 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 07238f5..8bdf5eb 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.9 2007/09/14 01:30:02 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.159 2007-09-14 01:29:28 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -666,7 +666,7 @@ ip_print(netdissect_options *ndo,
                }
            }
 
-            printf(") ");
+            printf(")\n    ");
        }
 
        /*
index 29e5988..0758bb9 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.5 2007/09/21 07:07:52 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.52 2007-09-21 07:05:33 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 82163a2..7a4bf55 100644 (file)
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.17.2.1 2005/04/20 22:19:06 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.18 2005-04-20 22:18:50 guy Exp $";
 #endif
 
 #ifdef INET6
index 099e5ad..89130a3 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.20 2003/11/19 00:36:08 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.20 2003-11-19 00:36:08 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 6712e5f..c980765 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.7.2.2 2005/11/13 12:12:59 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.9 2005-11-13 12:12:42 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 5309aa4..604561c 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.40.2.2 2005/05/06 08:27:00 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.42 2005-05-06 08:26:44 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
index 09972f0..763f58a 100644 (file)
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.51 2005/04/07 00:28:17 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.56 2007-08-29 12:31:00 mcr Exp $ (LBL)";
 #endif
 
+#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -59,39 +60,64 @@ static const char rcsid[] _U_ =
 #define sockaddr_storage sockaddr
 #endif
 
-static const u_char *isakmp_sa_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_p_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_t_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_ke_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_id_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_cert_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_cr_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_sig_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_hash_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_nonce_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_n_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_d_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_vid_print(const struct isakmp_gen *,
-       u_int, const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_sub0_print(u_char, const struct isakmp_gen *,
+#define DECLARE_PRINTER(func) static const u_char *ike##func##_print( \
+               netdissect_options *ndo, u_char tpay,                 \
+               const struct isakmp_gen *ext,                         \
+               u_int item_len, \
+               const u_char *end_pointer, \
+               u_int32_t phase,\
+               u_int32_t doi0, \
+               u_int32_t proto0, int depth)
+
+DECLARE_PRINTER(v1_sa);
+DECLARE_PRINTER(v1_p);
+DECLARE_PRINTER(v1_t);
+DECLARE_PRINTER(v1_ke);
+DECLARE_PRINTER(v1_id);
+DECLARE_PRINTER(v1_cert);
+DECLARE_PRINTER(v1_cr);
+DECLARE_PRINTER(v1_sig);
+DECLARE_PRINTER(v1_hash);
+DECLARE_PRINTER(v1_nonce);
+DECLARE_PRINTER(v1_n);
+DECLARE_PRINTER(v1_d);
+DECLARE_PRINTER(v1_vid);
+
+DECLARE_PRINTER(v2_sa);
+DECLARE_PRINTER(v2_ke);
+DECLARE_PRINTER(v2_ID);
+DECLARE_PRINTER(v2_cert);
+DECLARE_PRINTER(v2_cr);
+DECLARE_PRINTER(v2_auth);
+DECLARE_PRINTER(v2_nonce);
+DECLARE_PRINTER(v2_n);
+DECLARE_PRINTER(v2_d);
+DECLARE_PRINTER(v2_vid);
+DECLARE_PRINTER(v2_TS);
+DECLARE_PRINTER(v2_e);
+DECLARE_PRINTER(v2_cp);
+DECLARE_PRINTER(v2_eap);
+
+static const u_char *ike_sub0_print(netdissect_options *ndo,u_char, const struct isakmp_gen *,
        const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
-static const u_char *isakmp_sub_print(u_char, const struct isakmp_gen *,
+static const u_char *ikev1_sub_print(netdissect_options *ndo,u_char, const struct isakmp_gen *,
        const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
+
+static const u_char *ikev2_sub_print(netdissect_options *ndo,
+                                    u_char np, const struct isakmp_gen *ext,
+                                    const u_char *ep, u_int32_t phase,
+                                    u_int32_t doi, u_int32_t proto,
+                                    int depth);
+
+
 static char *numstr(int);
 static void safememcpy(void *, const void *, size_t);
 
+static void
+ikev1_print(netdissect_options *ndo,
+           const u_char *bp,  u_int length,
+           const u_char *bp2, struct isakmp *base);
+
 #define MAXINITIATORS  20
 int ninitiator = 0;
 struct {
@@ -107,36 +133,73 @@ static const char *protoidstr[] = {
 
 /* isakmp->np */
 static const char *npstr[] = {
-       "none", "sa", "p", "t", "ke", "id", "cert", "cr", "hash",
-       "sig", "nonce", "n", "d", "vid"
+       "none", "sa", "p", "t", "ke", "id", "cert", "cr", "hash", /* 0 - 8 */
+       "sig", "nonce", "n", "d", "vid",      /* 9 - 13 */
+       "pay14", "pay15", "pay16", "pay17", "pay18", /* 14- 18 */
+       "pay19", "pay20", "pay21", "pay22", "pay23", /* 19- 23 */
+       "pay24", "pay25", "pay26", "pay27", "pay28", /* 24- 28 */
+       "pay29", "pay30", "pay31", "pay32",          /* 29- 32 */
+       "v2sa",  "v2ke",  "v2IDi", "v2IDr", "v2cert",/* 33- 37 */
+       "v2cr",  "v2auth","v2nonce", "v2n",   "v2d",   /* 38- 42 */
+       "v2vid", "v2TSi", "v2TSr", "v2e",   "v2cp",  /* 43- 47 */
+       "v2eap",                                     /* 48 */
+       
 };
 
 /* isakmp->np */
-static const u_char *(*npfunc[])(const struct isakmp_gen *, u_int,
-               const u_char *, u_int32_t, u_int32_t, u_int32_t, int) = {
+static const u_char *(*npfunc[])(netdissect_options *ndo, u_char tpay, 
+                                const struct isakmp_gen *ext,
+                                u_int item_len,
+                                const u_char *end_pointer,
+                                u_int32_t phase,
+                                u_int32_t doi0,
+                                u_int32_t proto0, int depth) = {
        NULL,
-       isakmp_sa_print,
-       isakmp_p_print,
-       isakmp_t_print,
-       isakmp_ke_print,
-       isakmp_id_print,
-       isakmp_cert_print,
-       isakmp_cr_print,
-       isakmp_hash_print,
-       isakmp_sig_print,
-       isakmp_nonce_print,
-       isakmp_n_print,
-       isakmp_d_print,
-       isakmp_vid_print,
+       ikev1_sa_print,
+       ikev1_p_print,
+       ikev1_t_print,