aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2005-05-29 18:17:16 +0000
committerSam Leffler <sam@FreeBSD.org>2005-05-29 18:17:16 +0000
commit1de50e9f417616cf647a842762944a2301cb1415 (patch)
treed59cebde657eda0af31fdab513367f5ad61113cd
parent5b0fe47811aa43b75fc69dbf7338cace232a4d48 (diff)
downloadsrc-1de50e9f417616cf647a842762944a2301cb1415.tar.gz
src-1de50e9f417616cf647a842762944a2301cb1415.zip
Virgin import of tcpdump v3.9.1 (alpha 096) from tcpdump.org
Notes
Notes: svn path=/vendor/tcpdump/dist/; revision=146773
-rw-r--r--contrib/tcpdump/.cvsignore1
-rw-r--r--contrib/tcpdump/CHANGES2
-rw-r--r--contrib/tcpdump/CREDITS15
-rw-r--r--contrib/tcpdump/FILES29
-rw-r--r--contrib/tcpdump/INSTALL23
-rw-r--r--contrib/tcpdump/Makefile.in19
-rw-r--r--contrib/tcpdump/README8
-rw-r--r--contrib/tcpdump/VERSION2
-rw-r--r--contrib/tcpdump/acconfig.h21
-rw-r--r--contrib/tcpdump/aclocal.m463
-rw-r--r--contrib/tcpdump/addrtoname.c86
-rw-r--r--contrib/tcpdump/appletalk.h3
-rwxr-xr-xcontrib/tcpdump/bgp.h17
-rw-r--r--contrib/tcpdump/bpf_dump.c2
-rw-r--r--contrib/tcpdump/config.h.in37
-rwxr-xr-xcontrib/tcpdump/configure1770
-rwxr-xr-xcontrib/tcpdump/configure.in272
-rw-r--r--contrib/tcpdump/cpack.c144
-rw-r--r--contrib/tcpdump/cpack.h51
-rw-r--r--contrib/tcpdump/decode_prefix.h41
-rw-r--r--contrib/tcpdump/ethertype.h15
-rw-r--r--contrib/tcpdump/extract.h38
-rw-r--r--contrib/tcpdump/gmpls.c13
-rw-r--r--contrib/tcpdump/gmpls.h3
-rw-r--r--contrib/tcpdump/gmt2local.c2
-rw-r--r--contrib/tcpdump/icmp6.h39
-rw-r--r--contrib/tcpdump/ieee802_11_radio.h201
-rw-r--r--contrib/tcpdump/interface.h96
-rw-r--r--contrib/tcpdump/ip.h3
-rwxr-xr-xcontrib/tcpdump/ipproto.c58
-rw-r--r--contrib/tcpdump/ipproto.h12
-rwxr-xr-xcontrib/tcpdump/l2vpn.c58
-rwxr-xr-xcontrib/tcpdump/l2vpn.h17
-rw-r--r--contrib/tcpdump/llc.h8
-rw-r--r--contrib/tcpdump/machdep.c2
-rw-r--r--contrib/tcpdump/mpls.h41
-rw-r--r--contrib/tcpdump/netdissect.h435
-rwxr-xr-xcontrib/tcpdump/nlpid.c45
-rw-r--r--contrib/tcpdump/nlpid.h32
-rw-r--r--contrib/tcpdump/ntp.h84
-rw-r--r--contrib/tcpdump/ospf.h34
-rw-r--r--contrib/tcpdump/oui.c10
-rw-r--r--contrib/tcpdump/oui.h9
-rw-r--r--contrib/tcpdump/parsenfsfh.c4
-rw-r--r--contrib/tcpdump/pcap-missing.h2
-rw-r--r--contrib/tcpdump/pf.h4
-rw-r--r--contrib/tcpdump/pmap_prot.h94
-rw-r--r--contrib/tcpdump/ppp.h8
-rw-r--r--contrib/tcpdump/print-802_11.c207
-rw-r--r--contrib/tcpdump/print-ah.c2
-rw-r--r--contrib/tcpdump/print-aodv.c2
-rw-r--r--contrib/tcpdump/print-ap1394.c4
-rw-r--r--contrib/tcpdump/print-arcnet.c17
-rw-r--r--contrib/tcpdump/print-arp.c143
-rw-r--r--contrib/tcpdump/print-ascii.c10
-rw-r--r--contrib/tcpdump/print-atalk.c11
-rw-r--r--contrib/tcpdump/print-atm.c103
-rw-r--r--contrib/tcpdump/print-beep.c2
-rw-r--r--contrib/tcpdump/print-bfd.c2
-rw-r--r--contrib/tcpdump/print-bgp.c1096
-rw-r--r--contrib/tcpdump/print-bootp.c2
-rw-r--r--contrib/tcpdump/print-cdp.c5
-rw-r--r--contrib/tcpdump/print-chdlc.c12
-rw-r--r--contrib/tcpdump/print-cip.c14
-rw-r--r--contrib/tcpdump/print-cnfp.c2
-rw-r--r--contrib/tcpdump/print-decnet.c2
-rw-r--r--contrib/tcpdump/print-dhcp6.c160
-rw-r--r--contrib/tcpdump/print-domain.c2
-rw-r--r--contrib/tcpdump/print-dvmrp.c2
-rw-r--r--contrib/tcpdump/print-eap.c71
-rw-r--r--contrib/tcpdump/print-egp.c6
-rw-r--r--contrib/tcpdump/print-eigrp.c481
-rw-r--r--contrib/tcpdump/print-enc.c12
-rw-r--r--contrib/tcpdump/print-esp.c109
-rw-r--r--contrib/tcpdump/print-ether.c72
-rw-r--r--contrib/tcpdump/print-fddi.c4
-rw-r--r--contrib/tcpdump/print-fr.c546
-rw-r--r--contrib/tcpdump/print-frag6.c2
-rw-r--r--contrib/tcpdump/print-gre.c169
-rw-r--r--contrib/tcpdump/print-hsrp.c2
-rw-r--r--contrib/tcpdump/print-icmp.c119
-rw-r--r--contrib/tcpdump/print-icmp6.c495
-rw-r--r--contrib/tcpdump/print-igmp.c3
-rw-r--r--contrib/tcpdump/print-igrp.c2
-rw-r--r--contrib/tcpdump/print-ip.c542
-rw-r--r--contrib/tcpdump/print-ip6.c88
-rw-r--r--contrib/tcpdump/print-ip6opts.c2
-rw-r--r--contrib/tcpdump/print-ipcomp.c2
-rw-r--r--contrib/tcpdump/print-ipfc.c4
-rw-r--r--contrib/tcpdump/print-ipx.c19
-rw-r--r--contrib/tcpdump/print-isakmp.c147
-rw-r--r--contrib/tcpdump/print-isoclns.c1300
-rw-r--r--contrib/tcpdump/print-juniper.c409
-rw-r--r--contrib/tcpdump/print-krb.c2
-rw-r--r--contrib/tcpdump/print-l2tp.c2
-rw-r--r--contrib/tcpdump/print-lane.c4
-rw-r--r--contrib/tcpdump/print-ldp.c158
-rw-r--r--contrib/tcpdump/print-llc.c33
-rw-r--r--contrib/tcpdump/print-lmp.c713
-rw-r--r--contrib/tcpdump/print-lspping.c859
-rw-r--r--contrib/tcpdump/print-lwres.c2
-rw-r--r--contrib/tcpdump/print-mobile.c4
-rw-r--r--contrib/tcpdump/print-mobility.c2
-rw-r--r--contrib/tcpdump/print-mpls.c34
-rw-r--r--contrib/tcpdump/print-msdp.c11
-rw-r--r--contrib/tcpdump/print-netbios.c2
-rw-r--r--contrib/tcpdump/print-nfs.c182
-rw-r--r--contrib/tcpdump/print-ntp.c149
-rw-r--r--contrib/tcpdump/print-null.c12
-rw-r--r--contrib/tcpdump/print-ospf.c169
-rw-r--r--contrib/tcpdump/print-ospf6.c2
-rw-r--r--contrib/tcpdump/print-pflog.c22
-rw-r--r--contrib/tcpdump/print-pim.c290
-rw-r--r--contrib/tcpdump/print-ppp.c405
-rw-r--r--contrib/tcpdump/print-pppoe.c42
-rw-r--r--contrib/tcpdump/print-pptp.c2
-rw-r--r--contrib/tcpdump/print-radius.c6
-rw-r--r--contrib/tcpdump/print-raw.c2
-rw-r--r--contrib/tcpdump/print-rip.c2
-rw-r--r--contrib/tcpdump/print-ripng.c26
-rw-r--r--contrib/tcpdump/print-rsvp.c481
-rw-r--r--contrib/tcpdump/print-rt6.c2
-rw-r--r--contrib/tcpdump/print-rx.c2
-rw-r--r--contrib/tcpdump/print-sctp.c17
-rw-r--r--contrib/tcpdump/print-sip.c60
-rw-r--r--contrib/tcpdump/print-sl.c6
-rw-r--r--contrib/tcpdump/print-sll.c52
-rw-r--r--contrib/tcpdump/print-smb.c538
-rw-r--r--contrib/tcpdump/print-snmp.c177
-rw-r--r--contrib/tcpdump/print-stp.c2
-rw-r--r--contrib/tcpdump/print-sunatm.c4
-rw-r--r--contrib/tcpdump/print-sunrpc.c25
-rw-r--r--contrib/tcpdump/print-symantec.c121
-rwxr-xr-xcontrib/tcpdump/print-syslog.c163
-rw-r--r--contrib/tcpdump/print-tcp.c172
-rw-r--r--contrib/tcpdump/print-telnet.c2
-rw-r--r--contrib/tcpdump/print-tftp.c2
-rw-r--r--contrib/tcpdump/print-timed.c2
-rw-r--r--contrib/tcpdump/print-token.c4
-rw-r--r--contrib/tcpdump/print-udp.c67
-rw-r--r--contrib/tcpdump/print-vjc.c4
-rw-r--r--contrib/tcpdump/print-vrrp.c2
-rw-r--r--contrib/tcpdump/print-wb.c2
-rw-r--r--contrib/tcpdump/print-zephyr.c2
-rw-r--r--contrib/tcpdump/rpc_auth.h84
-rw-r--r--contrib/tcpdump/rpc_msg.h133
-rw-r--r--contrib/tcpdump/setsignal.c2
-rw-r--r--contrib/tcpdump/smb.h4
-rw-r--r--contrib/tcpdump/smbutil.c1226
-rw-r--r--contrib/tcpdump/strcasecmp.c2
-rw-r--r--contrib/tcpdump/tcp.h6
-rw-r--r--contrib/tcpdump/tcpdump-stdinc.h70
-rw-r--r--contrib/tcpdump/tcpdump.1118
-rw-r--r--contrib/tcpdump/tcpdump.c490
-rw-r--r--contrib/tcpdump/udp.h6
-rw-r--r--contrib/tcpdump/util.c52
-rw-r--r--contrib/tcpdump/vfprintf.c2
157 files changed, 13963 insertions, 3657 deletions
diff --git a/contrib/tcpdump/.cvsignore b/contrib/tcpdump/.cvsignore
index f07c8e4d037b..791f14cdb7cf 100644
--- a/contrib/tcpdump/.cvsignore
+++ b/contrib/tcpdump/.cvsignore
@@ -9,3 +9,4 @@ config.h
stamp-h
stamp-h.in
tcpdump
+autom4te.cache
diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES
index e69ba224030e..db2078031693 100644
--- a/contrib/tcpdump/CHANGES
+++ b/contrib/tcpdump/CHANGES
@@ -1,4 +1,4 @@
-$Header: /tcpdump/master/tcpdump/CHANGES,v 1.84.2.3 2004/03/30 14:36:24 mcr Exp $
+$Header: /tcpdump/master/tcpdump/CHANGES,v 1.87 2004/03/30 14:42:38 mcr Exp $
Tue. March 30, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.3 release
diff --git a/contrib/tcpdump/CREDITS b/contrib/tcpdump/CREDITS
index b5c286c2b605..0370e07364e8 100644
--- a/contrib/tcpdump/CREDITS
+++ b/contrib/tcpdump/CREDITS
@@ -2,6 +2,7 @@ This file lists people who have contributed to tcpdump:
The current maintainers:
Bill Fenner <fenner@research.att.com>
+ David Young <dyoung@pobox.com>
Fulvio Risso <risso@polito.it>
Guy Harris <guy@alum.mit.edu>
Hannes Gredler <hannes@juniper.net>
@@ -10,8 +11,10 @@ The current maintainers:
Additional people who have contributed patches:
- Andrew Brown <atatat@atatdot.net>
Alfredo Andres <aandres@s21sec.com>
+ Albert Chin <china@thewrittenword.com>
+ Andrew Brown <atatat@atatdot.net>
+ Andrew Church <andrew@users.sourceforge.net>
Andrew Hintz <adhintz@users.sourceforge.net>
Andrew Tridgell <tridge@linuxcare.com>
Arkadiusz Miskiewicz <misiek@pld.org.pl>
@@ -33,6 +36,8 @@ Additional people who have contributed patches:
Darren Reed <darrenr@reed.wattle.id.au>
David Binderman <d.binderman@virgin.net>
David Young <dyoung@ojctech.com>
+ Eddie Kohler <xexd@sourceforge.net>
+ Francis Dupont <Francis.Dupont@enst-bretagne.fr>
Francisco Matias Cuenca-Acuna <mcuenca@george.rutgers.edu>
Frank Volf <volf@oasis.IAEhv.nl>
Fulvio Risso <risso@polito.it>
@@ -42,6 +47,7 @@ Additional people who have contributed patches:
Greg Stark <gsstark@mit.edu>
Gilbert Ramirez Jr. <gram@xiexie.org>
Gisle Vanem <giva@bgnett.no>
+ Hannes Viertel <hviertel@juniper.net>
Hank Leininger <tcpdump-workers@progressive-comp.com>
Harry Raaymakers <harryr@connect.com.au>
Heinz-Ado Arnolds <Ado.Arnolds@dhm-systems.de>
@@ -86,6 +92,7 @@ Additional people who have contributed patches:
Neil T. Spring <bluehal@users.sourceforge.net>
Niels Provos <provos@openbsd.org>
Nickolai Zeldovich <kolya@MIT.EDU>
+ Nicolas Ferrero <toorop@babylo.net>
Olaf Kirch <okir@caldera.de>
Onno van der Linden <onno@simplex.nl>
Pascal Hennequin <pascal.hennequin@int-evry.fr>
@@ -98,14 +105,18 @@ Additional people who have contributed patches:
Peter Jeremy <peter.jeremy@alcatel.com.au>
Phil Wood <cpw@lanl.gov>
Rafal Maszkowski <rzm@icm.edu.pl>
- Rick Jones <raj@cup.hp.com>
+ Raphael Raimbault <raphael.raimbault@netasq.com>
+ Rick Jones <rick.jones2@hp.com>
Rick Watson <watsonrick@users.sourceforge.net>
Rob Braun <bbraun@synack.net>
Roderick Schertler <roderick@argon.org>
Sami Farin <safari@iki.fi>
Scott Rose <syberpunk@users.sourceforge.net>
Sebastian Krahmer <krahmer@cs.uni-potsdam.de>
+ Sebastien Vincent <svincent@idems.fr>
Seth Webster <swebster@sst.ll.mit.edu>
+ Shinsuke Suzuki <suz@kame.net>
+ Steinar Haug <sthaug@nethelp.no>
Takashi Yamamoto <yamt@mwd.biglobe.ne.jp>
Terry Kennedy <terry@tmk.com>
Timo Koskiahde
diff --git a/contrib/tcpdump/FILES b/contrib/tcpdump/FILES
index 0b868170cc47..2479f27055c3 100644
--- a/contrib/tcpdump/FILES
+++ b/contrib/tcpdump/FILES
@@ -20,13 +20,17 @@ atm.h
atmuni31.h
bootp.h
bpf_dump.c
+bgp.h
chdlc.h
config.guess
config.h.in
config.sub
configure
configure.in
+cpack.c
+cpack.h
decnet.h
+decode_prefix.h
enc.h
esp.h
ether.h
@@ -39,17 +43,21 @@ gmt2local.c
gmt2local.h
icmp6.h
ieee802_11.h
+ieee802_11_radio.h
igrp.h
install-sh
interface.h
ip.h
ip6.h
ipfc.h
+ipproto.c
ipproto.h
ipsec_doi.h
ipx.h
isakmp.h
l2tp.h
+l2vpn.c
+l2vpn.h
lane.h
lbl/os-osf4.h
lbl/os-solaris2.h
@@ -79,22 +87,30 @@ missing/strlcat.c
missing/strlcpy.c
missing/strsep.c
mkdep
+mpls.h
nameser.h
netbios.h
+netdissect.h
nfs.h
nfsfh.h
+nlpid.c
+nlpid.h
ntp.h
oakley.h
ospf.h
ospf6.h
+oui.c
+oui.h
packetdat.awk
parsenfsfh.c
pcap-missing.h
+pf.h
+pmap_prot.h
ppp.h
print-802_11.c
-print-ap1394.c
print-ah.c
print-aodv.c
+print-ap1394.c
print-arcnet.c
print-arp.c
print-ascii.c
@@ -112,9 +128,11 @@ print-decnet.c
print-dhcp6.c
print-domain.c
print-dvmrp.c
+print-eap.c
print-egp.c
print-enc.c
print-esp.c
+print-eigrp.c
print-ether.c
print-fddi.c
print-fr.c
@@ -133,11 +151,14 @@ print-ipfc.c
print-ipx.c
print-isakmp.c
print-isoclns.c
+print-juniper.c
print-krb.c
print-l2tp.c
print-lane.c
print-ldp.c
print-llc.c
+print-lmp.c
+print-lspping.c
print-lwres.c
print-mobile.c
print-mobility.c
@@ -162,6 +183,7 @@ print-rsvp.c
print-rt6.c
print-rx.c
print-sctp.c
+print-sip.c
print-sl.c
print-sll.c
print-smb.c
@@ -169,6 +191,8 @@ print-snmp.c
print-stp.c
print-sunatm.c
print-sunrpc.c
+print-symantec.c
+print-syslog.c
print-tcp.c
print-telnet.c
print-tftp.c
@@ -180,6 +204,8 @@ print-vrrp.c
print-wb.c
print-zephyr.c
route6d.h
+rpc_auth.h
+rpc_msg.h
rx.h
sctpConstants.h
sctpHeader.h
@@ -211,7 +237,6 @@ win32/Include/telnet.h
win32/Include/w32_fzs.h
win32/Include/Netinet/in_systm.h
win32/Include/Netinet/ip.h
-win32/Include/Rpc/rpc.h
win32/Src/getopt.c
win32/prj/GNUmakefile
win32/prj/WinDump.dsp
diff --git a/contrib/tcpdump/INSTALL b/contrib/tcpdump/INSTALL
index 359397388de6..8ffb9f82bd7d 100644
--- a/contrib/tcpdump/INSTALL
+++ b/contrib/tcpdump/INSTALL
@@ -1,4 +1,4 @@
-@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.56.2.3 2004/03/17 19:47:47 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.63 2004/12/27 00:41:29 guy Exp $ (LBL)
If you have not built libpcap, do so first. See the README
file in this directory for the ftp location.
@@ -59,16 +59,20 @@ 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
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
@@ -81,16 +85,20 @@ 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
@@ -101,10 +109,15 @@ 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
@@ -112,6 +125,8 @@ ospf6.h - IPv6 Open Shortest Path First definitions
packetdat.awk - TCP chunk summary awk script
parsenfsfh.c - Network File System file parser routines
pcap-missing.h - declarations of functions possibly missing from libpcap
+pf.h - OpenBSD PF definitions
+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
@@ -133,6 +148,7 @@ 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
@@ -157,6 +173,7 @@ 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
@@ -181,6 +198,7 @@ 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-smb.c - SMB/CIFS printer routines
@@ -188,6 +206,7 @@ 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
@@ -199,6 +218,8 @@ 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
diff --git a/contrib/tcpdump/Makefile.in b/contrib/tcpdump/Makefile.in
index 38fe8742bc12..c7ead57c4efd 100644
--- a/contrib/tcpdump/Makefile.in
+++ b/contrib/tcpdump/Makefile.in
@@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.276.2.4 2004/03/28 21:25:02 fenner Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.293 2004/10/29 11:42:53 hannes Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
@@ -43,7 +43,7 @@ CC = @CC@
PROG = tcpdump
CCOPT = @V_CCOPT@
INCLS = -I. @V_INCLS@
-DEFS = @DEFS@ @V_DEFS@
+DEFS = @DEFS@ @CPPFLAGS@ @V_DEFS@
# Standard CFLAGS
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
@@ -65,25 +65,28 @@ INSTALL_DATA = @INSTALL_DATA@
@rm -f $@
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
-CSRC = addrtoname.c gmpls.c gmt2local.c machdep.c oui.c parsenfsfh.c \
+CSRC = addrtoname.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \
+ nlpid.c l2vpn.c machdep.c parsenfsfh.c \
print-802_11.c print-ap1394.c print-ah.c print-arcnet.c \
print-aodv.c print-arp.c print-ascii.c print-atalk.c print-atm.c \
print-beep.c print-bfd.c print-bgp.c print-bootp.c print-cdp.c \
print-chdlc.c print-cip.c print-cnfp.c print-decnet.c \
print-domain.c print-dvmrp.c print-enc.c print-egp.c \
+ print-eap.c print-eigrp.c\
print-esp.c print-ether.c print-fddi.c print-fr.c \
print-gre.c print-hsrp.c print-icmp.c print-igmp.c \
print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \
- print-ipx.c print-isakmp.c print-isoclns.c print-krb.c \
+ print-ipx.c print-isakmp.c print-isoclns.c print-juniper.c print-krb.c \
print-l2tp.c print-lane.c print-ldp.c print-llc.c \
+ print-lmp.c print-lspping.c \
print-lwres.c print-mobile.c print-mpls.c print-msdp.c \
print-nfs.c print-ntp.c print-null.c print-ospf.c \
print-pflog.c print-pim.c print-ppp.c print-pppoe.c \
print-pptp.c print-radius.c print-raw.c print-rip.c \
- print-rsvp.c print-rx.c print-sctp.c print-sl.c print-sll.c \
+ print-rsvp.c print-rx.c print-sctp.c print-sip.c print-sl.c print-sll.c \
print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
- print-tcp.c print-telnet.c print-tftp.c print-timed.c \
- print-token.c print-udp.c print-vjc.c print-vrrp.c \
+ print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
+ print-timed.c print-token.c print-udp.c print-vjc.c print-vrrp.c \
print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
LOCALSRC = @LOCALSRC@
@@ -95,7 +98,7 @@ SRC = $(CSRC) $(GENSRC) $(LOCALSRC)
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
# hack the extra indirection
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) $(LIBOBJS)
-HDR = addrtoname.h appletalk.h bootp.h decnet.h \
+HDR = addrtoname.h appletalk.h bootp.h cpack.h decnet.h \
ethertype.h extract.h fddi.h gmt2local.h igrp.h interface.h \
ipx.h llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h \
setsignal.h \
diff --git a/contrib/tcpdump/README b/contrib/tcpdump/README
index f1e02670a892..17df49d4db8f 100644
--- a/contrib/tcpdump/README
+++ b/contrib/tcpdump/README
@@ -1,6 +1,6 @@
-@(#) $Header: /tcpdump/master/tcpdump/README,v 1.63.2.1 2003/11/16 10:17:30 guy Exp $ (LBL)
+@(#) $Header: /tcpdump/master/tcpdump/README,v 1.65 2004/10/12 02:01:59 guy Exp $ (LBL)
-TCPDUMP 3.8
+TCPDUMP 3.9
Now maintained by "The Tcpdump Group"
See www.tcpdump.org
@@ -11,8 +11,8 @@ Anonymous CVS is available via:
(password "anoncvs")
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout tcpdump
-Version 3.8 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_8rel1":
- cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_8rel1 tcpdump
+Version 3.9 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_9rel1":
+ cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_9rel1 tcpdump
Please send patches against the master copy to patches@tcpdump.org.
diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION
index 269aa9c86de7..b233a760af14 100644
--- a/contrib/tcpdump/VERSION
+++ b/contrib/tcpdump/VERSION
@@ -1 +1 @@
-3.8.3
+3.9-PRE-CVS
diff --git a/contrib/tcpdump/acconfig.h b/contrib/tcpdump/acconfig.h
index 09e8351566af..4a743b8b8470 100644
--- a/contrib/tcpdump/acconfig.h
+++ b/contrib/tcpdump/acconfig.h
@@ -20,6 +20,8 @@
/* define if your struct __res_state has the nsort member */
#undef HAVE_NEW_RES_STATE
+/* define if <inttypes.h> defines PRI[doxu]64 macros */
+#undef INTTYPES_H_DEFINES_FORMATS
/*
* define if struct ether_header.ether_dhost is a struct with ether_addr_octet
@@ -86,6 +88,9 @@
/* define if libpcap has pcap_datalink_val_to_description() */
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
+/* define if you have getrpcbynumber() */
+#undef HAVE_GETRPCBYNUMBER
+
/* define if unaligned memory accesses fail */
#undef LBL_ALIGN
@@ -106,9 +111,17 @@
#undef int8_t
#undef int16_t
#undef int32_t
+#undef int64_t
+#undef u_int8_t
#undef u_int16_t
#undef u_int32_t
-#undef u_int8_t
+#undef u_int64_t
+
+/* Workaround for missing 64-bit formats */
+#undef PRId64
+#undef PRIo64
+#undef PRIx64
+#undef PRIu64
/* Whether or not to include the possibly-buggy SMB printer */
#undef TCPDUMP_DO_SMB
@@ -126,3 +139,9 @@
/* Define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>. */
#undef HAVE_NETDNET_DNETDB_H_DNET_HTOA
+
+/* define if should drop privileges by default */
+#undef WITH_USER
+
+/* define if should chroot when dropping privileges */
+#undef WITH_CHROOT
diff --git a/contrib/tcpdump/aclocal.m4 b/contrib/tcpdump/aclocal.m4
index 5db51f3283d3..bf6231144587 100644
--- a/contrib/tcpdump/aclocal.m4
+++ b/contrib/tcpdump/aclocal.m4
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.98.2.4 2004/03/28 21:04:49 fenner Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106 2005/03/27 03:31:01 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
@@ -166,8 +166,13 @@ AC_DEFUN(AC_LBL_C_INIT,
# at least some versions of HP's C compiler can inline that, but can't
# inline a function that returns a struct pointer.
#
+# Make sure we use the V_CCOPT flags, because some of those might
+# disable inlining.
+#
AC_DEFUN(AC_LBL_C_INLINE,
[AC_MSG_CHECKING(for inline)
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$V_CCOPT"
AC_CACHE_VAL(ac_cv_lbl_inline, [
ac_cv_lbl_inline=""
ac_lbl_cc_inline=no
@@ -195,6 +200,7 @@ AC_DEFUN(AC_LBL_C_INLINE,
if test "$ac_lbl_cc_inline" = yes ; then
ac_cv_lbl_inline=$ac_lbl_inline
fi])
+ CFLAGS="$save_CFLAGS"
if test ! -z "$ac_cv_lbl_inline" ; then
AC_MSG_RESULT($ac_cv_lbl_inline)
else
@@ -587,6 +593,47 @@ AC_DEFUN(AC_LBL_CHECK_TYPE,
fi])
dnl
+dnl Check whether a given format can be used to print 64-bit integers
+dnl
+AC_DEFUN(AC_LBL_CHECK_64BIT_FORMAT,
+ [
+ AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers])
+ AC_RUN_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016$1x", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+ ]])
+ ],
+ [
+ AC_DEFINE(PRId64, "$1d")
+ AC_DEFINE(PRIo64, "$1o")
+ AC_DEFINE(PRIx64, "$1x")
+ AC_DEFINE(PRIu64, "$1u")
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ $2
+ ])
+ ])
+
+dnl
dnl Checks to see if unaligned memory accesses fail
dnl
dnl usage:
@@ -980,6 +1027,20 @@ dnl check for u_int32_t
else
$1=no
fi
+dnl check for u_int64_t
+ AC_MSG_CHECKING(for u_int64_t)
+ AC_CACHE_VAL(ac_cv_u_int64_t,
+ AC_TRY_COMPILE([
+# include <sys/types.h>],
+ [u_int64_t i],
+ ac_cv_u_int64_t=yes,
+ ac_cv_u_int64_t=no))
+ AC_MSG_RESULT($ac_cv_u_int64_t)
+ if test $ac_cv_u_int64_t = yes; then
+ AC_DEFINE(HAVE_U_INT64_T)
+ else
+ $1=no
+ fi
])
dnl
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c
index 81d60e3a6ad2..852c89a5cccb 100644
--- a/contrib/tcpdump/addrtoname.c
+++ b/contrib/tcpdump/addrtoname.c
@@ -23,7 +23,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.96.2.6 2004/03/24 04:14:31 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108 2005/03/27 22:38:09 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -39,11 +39,15 @@ struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */
#include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */
-#ifdef HAVE_NETINET_ETHER_H
-#include <netinet/ether.h> /* ether_ntohost on linux */
-#endif /* HAVE_NETINET_ETHER_H */
+#ifdef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
+#include <netinet/ether.h>
+#endif /* NETINET_ETHER_H_DECLARES_ETHER_NTOHOST */
#endif /* USE_ETHER_NTOHOST */
+#if !defined(HAVE_DECL_ETHER_NTOHOST) || !HAVE_DECL_ETHER_NTOHOST
+extern int ether_ntohost(char *, const struct ether_addr *);
+#endif
+
#include <pcap.h>
#include <pcap-namedb.h>
#include <signal.h>
@@ -103,25 +107,20 @@ win32_gethostbyaddr(const char *addr, int len, int type)
memset(&addr6, 0, sizeof(addr6));
addr6.sin6_family = AF_INET6;
memcpy(&addr6.sin6_addr, addr, len);
-#ifdef __MINGW32__
- /* MinGW doesn't provide getnameinfo */
- return NULL;
-#else
if (getnameinfo((struct sockaddr *)&addr6, sizeof(addr6),
- hname, sizeof(hname), NULL, 0, 0)) {
- return NULL;
+ hname, sizeof(hname), NULL, 0, 0)) {
+ return NULL;
} else {
strcpy(host.h_name, hname);
return &host;
}
-#endif /* __MINGW32__ */
break;
default:
return NULL;
}
}
#define gethostbyaddr win32_gethostbyaddr
-#endif /* INET6 & WIN32*/
+#endif /* INET6 & WIN32 */
#ifdef INET6
struct h6namemem {
@@ -464,18 +463,25 @@ etheraddr_string(register const u_char *ep)
#ifdef USE_ETHER_NTOHOST
if (!nflag) {
char buf2[128];
- if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) {
+
+ /*
+ * We don't cast it to "const struct ether_addr *"
+ * because some systems don't modify the Ethernet
+ * address but fail to declare the second argument
+ * as a "const" pointer.
+ */
+ if (ether_ntohost(buf2, (struct ether_addr *)ep) == 0) {
tp->e_name = strdup(buf2);
return (tp->e_name);
}
}
#endif
cp = buf;
- *cp++ = hex[*ep >> 4 ];
+ *cp++ = hex[*ep >> 4 ];
*cp++ = hex[*ep++ & 0xf];
for (i = 5; (int)--i >= 0;) {
*cp++ = ':';
- *cp++ = hex[*ep >> 4 ];
+ *cp++ = hex[*ep >> 4 ];
*cp++ = hex[*ep++ & 0xf];
}
*cp = '\0';
@@ -486,7 +492,7 @@ etheraddr_string(register const u_char *ep)
const char *
linkaddr_string(const u_char *ep, const unsigned int len)
{
- register u_int i, j;
+ register u_int i;
register char *cp;
register struct enamemem *tp;
@@ -500,13 +506,11 @@ linkaddr_string(const u_char *ep, const unsigned int len)
tp->e_name = cp = (char *)malloc(len*3);
if (tp->e_name == NULL)
error("linkaddr_string: malloc");
- if ((j = *ep >> 4) != 0)
- *cp++ = hex[j];
+ *cp++ = hex[*ep >> 4];
*cp++ = hex[*ep++ & 0xf];
for (i = len-1; i > 0 ; --i) {
*cp++ = ':';
- if ((j = *ep >> 4) != 0)
- *cp++ = hex[j];
+ *cp++ = hex[*ep >> 4];
*cp++ = hex[*ep++ & 0xf];
}
*cp = '\0';
@@ -585,26 +589,32 @@ llcsap_string(u_char sap)
return (tp->name);
}
+#define ISONSAP_MAX_LENGTH 20
const char *
-isonsap_string(const u_char *nsap)
+isonsap_string(const u_char *nsap, register u_int nsap_length)
{
- register u_int i, nlen = nsap[0];
+ register u_int nsap_idx;
register char *cp;
register struct enamemem *tp;
+ if (nsap_length < 1 || nsap_length > ISONSAP_MAX_LENGTH)
+ error("isonsap_string: illegal length");
+
tp = lookup_nsap(nsap);
if (tp->e_name)
return tp->e_name;
- tp->e_name = cp = (char *)malloc(nlen * 2 + 2);
+ tp->e_name = cp = (char *)malloc(sizeof("xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx"));
if (cp == NULL)
error("isonsap_string: malloc");
- nsap++;
- *cp++ = '/';
- for (i = nlen; (int)--i >= 0;) {
+ for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
*cp++ = hex[*nsap >> 4];
*cp++ = hex[*nsap++ & 0xf];
+ if (((nsap_idx & 1) == 0) &&
+ (nsap_idx + 1 < nsap_length)) {
+ *cp++ = '.';
+ }
}
*cp = '\0';
return (tp->e_name);
@@ -705,13 +715,14 @@ init_servarray(void)
endservent();
}
-/*XXX from libbpfc.a */
-#ifndef WIN32
-extern struct eproto {
+/* in libpcap.a (nametoaddr.c) */
+#if defined(WIN32) && !defined(USE_STATIC_LIBPCAP)
+__declspec(dllimport)
#else
-__declspec( dllimport) struct eproto {
+extern
#endif
- char *s;
+const struct eproto {
+ const char *s;
u_short p;
} eproto_db[];
@@ -829,9 +840,16 @@ init_etherarray(void)
continue;
#ifdef USE_ETHER_NTOHOST
- /* Use yp/nis version of name if available */
- if (ether_ntohost(name, (const struct ether_addr *)el->addr) == 0) {
- tp->e_name = strdup(name);
+ /*
+ * Use YP/NIS version of name if available.
+ *
+ * We don't cast it to "const struct ether_addr *"
+ * because some systems don't modify the Ethernet
+ * address but fail to declare the second argument
+ * as a "const" pointer.
+ */
+ if (ether_ntohost(name, (struct ether_addr *)el->addr) == 0) {
+ tp->e_name = strdup(name);
continue;
}
#endif
diff --git a/contrib/tcpdump/appletalk.h b/contrib/tcpdump/appletalk.h
index 83e6f70e8e20..67e62ef870f2 100644
--- a/contrib/tcpdump/appletalk.h
+++ b/contrib/tcpdump/appletalk.h
@@ -20,7 +20,7 @@
*
* AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
*
- * @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.15 2002/12/11 07:13:49 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.16 2004/05/01 09:41:50 hannes Exp $ (LBL)
*/
struct LAP {
@@ -67,6 +67,7 @@ struct atShortDDP {
#define ddpECHO 4 /* ECHO type */
#define ddpIP 22 /* IP type */
#define ddpARP 23 /* ARP type */
+#define ddpEIGRP 88 /* EIGRP over Appletalk */
#define ddpKLAP 0x4b /* Kinetics KLAP type */
diff --git a/contrib/tcpdump/bgp.h b/contrib/tcpdump/bgp.h
new file mode 100755
index 000000000000..06be3ea7c0c1
--- /dev/null
+++ b/contrib/tcpdump/bgp.h
@@ -0,0 +1,17 @@
+/* @(#) $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
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+extern char *bgp_vpn_rd_print (const u_char *);
diff --git a/contrib/tcpdump/bpf_dump.c b/contrib/tcpdump/bpf_dump.c
index 4f289a14f906..0cad4d95542e 100644
--- a/contrib/tcpdump/bpf_dump.c
+++ b/contrib/tcpdump/bpf_dump.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.14.2.2 2003/11/16 08:51:04 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.16 2003/11/16 09:36:08 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/config.h.in b/contrib/tcpdump/config.h.in
index a8d564d6e90b..a02d6b7baa1c 100644
--- a/contrib/tcpdump/config.h.in
+++ b/contrib/tcpdump/config.h.in
@@ -20,6 +20,8 @@
/* define if your struct __res_state has the nsort member */
#undef HAVE_NEW_RES_STATE
+/* define if <inttypes.h> defines PRI[doxu]64 macros */
+#undef INTTYPES_H_DEFINES_FORMATS
/*
* define if struct ether_header.ether_dhost is a struct with ether_addr_octet
@@ -86,6 +88,9 @@
/* define if libpcap has pcap_datalink_val_to_description() */
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
+/* define if you have getrpcbynumber() */
+#undef HAVE_GETRPCBYNUMBER
+
/* define if unaligned memory accesses fail */
#undef LBL_ALIGN
@@ -106,9 +111,17 @@
#undef int8_t
#undef int16_t
#undef int32_t
+#undef int64_t
+#undef u_int8_t
#undef u_int16_t
#undef u_int32_t
-#undef u_int8_t
+#undef u_int64_t
+
+/* Workaround for missing 64-bit formats */
+#undef PRId64
+#undef PRIo64
+#undef PRIx64
+#undef PRIu64
/* Whether or not to include the possibly-buggy SMB printer */
#undef TCPDUMP_DO_SMB
@@ -127,9 +140,22 @@
/* Define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>. */
#undef HAVE_NETDNET_DNETDB_H_DNET_HTOA
+/* define if should drop privileges by default */
+#undef WITH_USER
+
+/* define if should chroot when dropping privileges */
+#undef WITH_CHROOT
+
+/* Define to 1 if you have the `alarm' function. */
+#undef HAVE_ALARM
+
/* Define to 1 if you have the `bpf_dump' function. */
#undef HAVE_BPF_DUMP
+/* Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
+ don't. */
+#undef HAVE_DECL_ETHER_NTOHOST
+
/* Define to 1 if you have the `ether_ntohost' function. */
#undef HAVE_ETHER_NTOHOST
@@ -253,6 +279,12 @@
/* define if your compiler has __attribute__ */
#undef HAVE___ATTRIBUTE__
+/* Define to 1 if netinet/ether.h declares `ether_ntohost' */
+#undef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
+
+/* Define to 1 if netinet/if_ether.h declares `ether_ntohost' */
+#undef NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@@ -280,6 +312,9 @@
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
+/* The size of a `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
/* The size of a `short', as computed by sizeof. */
#undef SIZEOF_SHORT
diff --git a/contrib/tcpdump/configure b/contrib/tcpdump/configure
index 7907b87ec93e..3af074505e1c 100755
--- a/contrib/tcpdump/configure
+++ b/contrib/tcpdump/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 1.169.2.3 .
+# From configure.in Revision: 1.188 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57.
#
@@ -853,6 +853,8 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--without-gcc don't use gcc
+ --with-user=USERNAME drop privileges by default to USERNAME
+ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY
--without-crypto disable crypto support
Some influential environment variables:
@@ -2501,6 +2503,8 @@ _ACEOF
echo "$as_me:$LINENO: checking for inline" >&5
echo $ECHO_N "checking for inline... $ECHO_C" >&6
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$V_CCOPT"
if test "${ac_cv_lbl_inline+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2566,6 +2570,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext
fi
fi
+ CFLAGS="$save_CFLAGS"
if test ! -z "$ac_cv_lbl_inline" ; then
echo "$as_me:$LINENO: result: $ac_cv_lbl_inline" >&5
echo "${ECHO_T}$ac_cv_lbl_inline" >&6
@@ -2646,7 +2651,6 @@ fi
echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5
echo "${ECHO_T}$ac_cv___attribute__" >&6
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -3123,8 +3127,7 @@ done
-
-for ac_header in fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h
+for ac_header in fcntl.h rpc/rpcent.h netdnet/dnetdb.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -3318,6 +3321,76 @@ fi
done
+if test "$ac_cv_header_netinet_if_ether_h" != yes; then
+ #
+ # The simple test didn't work.
+ # Do we need to include <net/if.h> first?
+ # Unset ac_cv_header_netinet_if_ether_h so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ { echo "$as_me:$LINENO: Rechecking with some additional includes" >&5
+echo "$as_me: Rechecking with some additional includes" >&6;}
+ unset ac_cv_header_netinet_if_ether_h
+
+for ac_header in netinet/if_ether.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+struct mbuf;
+struct rtentry;
+#include <net/if.h>
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
if test "${ac_cv_header_time+set}" = set; then
@@ -3724,6 +3797,46 @@ echo "${ECHO_T}no" >&6
;;
esac
+
+# Check whether --with-user or --without-user was given.
+if test "${with_user+set}" = set; then
+ withval="$with_user"
+
+fi;
+echo "$as_me:$LINENO: checking whether to drop root privileges by default" >&5
+echo $ECHO_N "checking whether to drop root privileges by default... $ECHO_C" >&6
+if test ! -z "$with_user" ; then
+ cat >>confdefs.h <<_ACEOF
+#define WITH_USER "$withval"
+_ACEOF
+
+ echo "$as_me:$LINENO: result: to \"$withval\"" >&5
+echo "${ECHO_T}to \"$withval\"" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+# Check whether --with-chroot or --without-chroot was given.
+if test "${with_chroot+set}" = set; then
+ withval="$with_chroot"
+
+fi;
+echo "$as_me:$LINENO: checking whether to chroot" >&5
+echo $ECHO_N "checking whether to chroot... $ECHO_C" >&6
+if test ! -z "$with_chroot" ; then
+ cat >>confdefs.h <<_ACEOF
+#define WITH_CHROOT "$withval"
+_ACEOF
+
+ echo "$as_me:$LINENO: result: to \"$withval\"" >&5
+echo "${ECHO_T}to \"$withval\"" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
echo "$as_me:$LINENO: checking whether to enable ipv6" >&5
echo $ECHO_N "checking whether to enable ipv6... $ECHO_C" >&6
# Check whether --enable-ipv6 or --disable-ipv6 was given.
@@ -5831,6 +5944,367 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${ac_cv_type_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long long *) 0)
+ return 0;
+if (sizeof (long long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long_long=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6
+
+echo "$as_me:$LINENO: checking size of long long" >&5
+echo $ECHO_N "checking size of long long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long long)); }
+unsigned long ulongval () { return (long) (sizeof (long long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
@@ -6331,11 +6805,6 @@ _ACEOF
fi
-if test "$missing_includes" = "yes"; then
- CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
- V_INCLS="$V_INCLS -I\$(srcdir)/missing"
-fi
-
@@ -6514,156 +6983,8 @@ fi
done
-for ac_func in ether_ntohost
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_var=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
- echo "$as_me:$LINENO: checking for buggy ether_ntohost" >&5
-echo $ECHO_N "checking for buggy ether_ntohost... $ECHO_C" >&6
-if test "${ac_cv_buggy_ether_ntohost+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
- if test "$cross_compiling" = yes; then
- ac_cv_buggy_ether_ntohost="not while cross-compiling"
-else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
- #include <netdb.h>
- #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/socket.h>
-
- int
- main(int argc, char **argv)
- {
- u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
- char name[MAXHOSTNAMELEN];
-
- ether_ntohost(name, (struct ether_addr *)ea);
- exit(0);
- }
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_buggy_ether_ntohost=no
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_buggy_ether_ntohost=yes
-fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_buggy_ether_ntohost" >&5
-echo "${ECHO_T}$ac_cv_buggy_ether_ntohost" >&6
- if test "$ac_cv_buggy_ether_ntohost" = "no"; then
- cat >>confdefs.h <<\_ACEOF
-#define USE_ETHER_NTOHOST 1
-_ACEOF
- fi
-
-fi
-done
-
-
-for ac_func in setlinebuf
+for ac_func in setlinebuf alarm
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -6836,7 +7157,7 @@ fi
done
if test $needsnprintf = yes; then
- LIBOBJS="$LIBOBJS snprintf.o.$ac_objext"
+ LIBOBJS="$LIBOBJS snprintf.$ac_objext"
fi
@@ -7365,6 +7686,9 @@ echo "$as_me:$LINENO: result: $ac_cv_search_getrpcbynumber" >&5
echo "${ECHO_T}$ac_cv_search_getrpcbynumber" >&6
if test "$ac_cv_search_getrpcbynumber" != no; then
test "$ac_cv_search_getrpcbynumber" = "none required" || LIBS="$ac_cv_search_getrpcbynumber $LIBS"
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETRPCBYNUMBER 1
+_ACEOF
fi
@@ -8509,7 +8833,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
- LIBOBJS="$LIBOBJS inet_ntop.o.$ac_objext"
+ LIBOBJS="$LIBOBJS inet_ntop.$ac_objext"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
echo "$as_me:$LINENO: checking for inet_pton" >&5
@@ -8554,7 +8878,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
- LIBOBJS="$LIBOBJS inet_pton.o.$ac_objext"
+ LIBOBJS="$LIBOBJS inet_pton.$ac_objext"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
echo "$as_me:$LINENO: checking for inet_aton" >&5
@@ -8599,9 +8923,492 @@ sed 's/^/| /' conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
- LIBOBJS="$LIBOBJS inet_aton.o.$ac_objext"
+ LIBOBJS="$LIBOBJS inet_aton.$ac_objext"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+#
+# Check for these after AC_LBL_LIBPCAP, for the same reason.
+#
+# You are in a twisty little maze of UN*Xes, all different.
+# Some might not have ether_ntohost().
+# Some might have it, but not declare it in any header file.
+# Some might have it, but declare it in <netinet/if_ether.h>.
+# Some might have it, but declare it in <netinet/ether.h>
+# (And some might have it but document it as something declared in
+# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
+#
+# Before you is a C compiler.
+#
+
+for ac_func in ether_ntohost
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+ echo "$as_me:$LINENO: checking for buggy ether_ntohost" >&5
+echo $ECHO_N "checking for buggy ether_ntohost... $ECHO_C" >&6
+if test "${ac_cv_buggy_ether_ntohost+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test "$cross_compiling" = yes; then
+ ac_cv_buggy_ether_ntohost="not while cross-compiling"
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <netdb.h>
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+
+ int
+ main(int argc, char **argv)
+ {
+ u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
+ char name[MAXHOSTNAMELEN];
+
+ ether_ntohost(name, (struct ether_addr *)ea);
+ exit(0);
+ }
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_buggy_ether_ntohost=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_buggy_ether_ntohost=yes
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_buggy_ether_ntohost" >&5
+echo "${ECHO_T}$ac_cv_buggy_ether_ntohost" >&6
+ if test "$ac_cv_buggy_ether_ntohost" = "no"; then
+ cat >>confdefs.h <<\_ACEOF
+#define USE_ETHER_NTOHOST 1
+_ACEOF
+
+ fi
+
+fi
+done
+
+if test "$ac_cv_func_ether_ntohost" = yes -a \
+ "$ac_cv_buggy_ether_ntohost" = "no"; then
+ #
+ # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
+ #
+ if test "$ac_cv_header_netinet_if_ether_h" = yes; then
+ #
+ # Yes. Does it declare ether_ntohost()?
+ #
+ echo "$as_me:$LINENO: checking whether ether_ntohost is declared" >&5
+echo $ECHO_N "checking whether ether_ntohost is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_ether_ntohost+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+struct mbuf;
+struct rtentry;
+#include <net/if.h>
+#include <netinet/if_ether.h>
+
+
+int
+main ()
+{
+#ifndef ether_ntohost
+ char *p = (char *) ether_ntohost;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_ether_ntohost=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_ether_ntohost=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_ether_ntohost" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ether_ntohost" >&6
+if test $ac_cv_have_decl_ether_ntohost = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ETHER_NTOHOST 1
+_ACEOF
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ETHER_NTOHOST 0
+_ACEOF
+
+
+fi
+
+
+ fi
+ #
+ # Did that succeed?
+ #
+ if test "$ac_cv_have_decl_ether_ntohost" != yes; then
+ #
+ # No, how about <netinet/ether.h>, as on Linux?
+ #
+
+for ac_header in netinet/ether.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ if test "$ac_cv_header_netinet_ether_h" = yes; then
+ #
+ # We have it - does it declare ether_ntohost()?
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ echo "$as_me:$LINENO: checking whether ether_ntohost is declared" >&5
+echo $ECHO_N "checking whether ether_ntohost is declared... $ECHO_C" >&6
+if test "${ac_cv_have_decl_ether_ntohost+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <netinet/ether.h>
+
+
+int
+main ()
+{
+#ifndef ether_ntohost
+ char *p = (char *) ether_ntohost;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_ether_ntohost=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_have_decl_ether_ntohost=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_have_decl_ether_ntohost" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ether_ntohost" >&6
+if test $ac_cv_have_decl_ether_ntohost = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ETHER_NTOHOST 1
+_ACEOF
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ETHER_NTOHOST 0
+_ACEOF
+
+
+fi
+
+
+ fi
+ fi
+fi
echo "$as_me:$LINENO: checking if sockaddr struct has sa_len member" >&5
@@ -8749,6 +9556,8 @@ fi
done
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
+ savedcflags="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
echo "$as_me:$LINENO: checking for pcap_if_t" >&5
echo $ECHO_N "checking for pcap_if_t... $ECHO_C" >&6
if test "${ac_cv_type_pcap_if_t+set}" = set; then
@@ -8806,7 +9615,9 @@ _ACEOF
fi
+ CFLAGS="$savedcflags"
fi
+
if test $ac_cv_func_pcap_lib_version = "no" ; then
echo "$as_me:$LINENO: checking whether pcap_version is defined by libpcap" >&5
echo $ECHO_N "checking whether pcap_version is defined by libpcap... $ECHO_C" >&6
@@ -8822,13 +9633,9 @@ int
main ()
{
-char *
-return_pcap_version(void)
-{
extern char pcap_version[];
- return pcap_version;
-}
+ return (int)pcap_version;
;
return 0;
@@ -8880,13 +9687,9 @@ int
main ()
{
-int
-return_pcap_debug(void)
-{
extern int pcap_debug;
return pcap_debug;
-}
;
return 0;
@@ -8939,13 +9742,9 @@ int
main ()
{
- int
- return_yydebug(void)
- {
extern int yydebug;
return yydebug;
- }
;
return 0;
@@ -9442,6 +10241,597 @@ echo "${ECHO_T}$ac_cv_lbl_have_u_int32_t" >&6
_ACEOF
fi
+echo "$as_me:$LINENO: checking for int64_t using $CC" >&5
+echo $ECHO_N "checking for int64_t using $CC... $ECHO_C" >&6
+ if test "${ac_cv_lbl_have_int64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# include "confdefs.h"
+# include <sys/types.h>
+# if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+# endif
+int
+main ()
+{
+int64_t i
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lbl_have_int64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lbl_have_int64_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+
+ echo "$as_me:$LINENO: result: $ac_cv_lbl_have_int64_t" >&5
+echo "${ECHO_T}$ac_cv_lbl_have_int64_t" >&6
+ if test $ac_cv_lbl_have_int64_t = no ; then
+ cat >>confdefs.h <<\_ACEOF
+#define int64_t long long
+_ACEOF
+
+ fi
+echo "$as_me:$LINENO: checking for u_int64_t using $CC" >&5
+echo $ECHO_N "checking for u_int64_t using $CC... $ECHO_C" >&6
+ if test "${ac_cv_lbl_have_u_int64_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# include "confdefs.h"
+# include <sys/types.h>
+# if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+# endif
+int
+main ()
+{
+u_int64_t i
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lbl_have_u_int64_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lbl_have_u_int64_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+
+ echo "$as_me:$LINENO: result: $ac_cv_lbl_have_u_int64_t" >&5
+echo "${ECHO_T}$ac_cv_lbl_have_u_int64_t" >&6
+ if test $ac_cv_lbl_have_u_int64_t = no ; then
+ cat >>confdefs.h <<\_ACEOF
+#define u_int64_t unsigned long long
+_ACEOF
+
+ fi
+
+#
+# We can't just check for <inttypes.h> - some systems have one that
+# doesn't define all the PRI[doxu]64 macros.
+#
+
+for ac_header in inttypes.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+ #
+ # OK, we have inttypes.h, but does it define those macros?
+ #
+ echo "$as_me:$LINENO: checking whether inttypes.h defines the PRI[doxu]64 macros" >&5
+echo $ECHO_N "checking whether inttypes.h defines the PRI[doxu]64 macros... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ printf("%" PRId64 "\n", (u_int64_t)1);
+ printf("%" PRIo64 "\n", (u_int64_t)1);
+ printf("%" PRIx64 "\n", (u_int64_t)1);
+ printf("%" PRIu64 "\n", (u_int64_t)1);
+ }
+
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ ac_lbl_inttypes_h_defines_formats=yes
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ ac_lbl_inttypes_h_defines_formats=no
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+else
+
+ #
+ # We don't have inttypes.h, so it obviously can't define those
+ # macros.
+ #
+ ac_lbl_inttypes_h_defines_formats=no
+
+fi
+
+done
+
+if test "$ac_lbl_inttypes_h_defines_formats" = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define INTTYPES_H_DEFINES_FORMATS 1
+_ACEOF
+
+else
+
+ echo "$as_me:$LINENO: checking whether %llx can be used to format 64-bit integers" >&5
+echo $ECHO_N "checking whether %llx can be used to format 64-bit integers... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016llx", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRId64 "lld"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIo64 "llo"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIx64 "llx"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIu64 "llu"
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+
+ echo "$as_me:$LINENO: checking whether %Lx can be used to format 64-bit integers" >&5
+echo $ECHO_N "checking whether %Lx can be used to format 64-bit integers... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016Lx", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRId64 "Ld"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIo64 "Lo"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIx64 "Lx"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIu64 "Lu"
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+
+ echo "$as_me:$LINENO: checking whether %qx can be used to format 64-bit integers" >&5
+echo $ECHO_N "checking whether %qx can be used to format 64-bit integers... $ECHO_C" >&6
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ #line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+# endif
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ u_int64_t t = 1;
+ char strbuf[16+1];
+ sprintf(strbuf, "%016qx", t << 32);
+ if (strcmp(strbuf, "0000000100000000") == 0)
+ exit(0);
+ else
+ exit(1);
+ }
+
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRId64 "qd"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIo64 "qo"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIx64 "qx"
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define PRIu64 "qu"
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+ { { echo "$as_me:$LINENO: error: neither %llx nor %Lx nor %qx worked on a 64-bit integer" >&5
+echo "$as_me: error: neither %llx nor %Lx nor %qx worked on a 64-bit integer" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+fi
rm -f os-proto.h
if test "${LBL_CFLAGS+set}" = set; then
@@ -9700,7 +11090,10 @@ echo "$as_me:$LINENO: checking for SSLeay" >&5
echo $ECHO_N "checking for SSLeay... $ECHO_C" >&6
ac_cv_ssleay_path=no
incdir=no
-for dir in /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
+
+Xprefix=`eval echo $prefix`
+
+for dir in $Xprefix /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
#
# XXX - is there a better way to check if a given library is
# in a given directory than checking each of the possible
@@ -9739,9 +11132,9 @@ if test "$ac_cv_ssleay_path" != no; then
LIBS="$LIBS -lrsaref"
fi
-echo "$as_me:$LINENO: checking for des_cbc_encrypt in -lcrypto" >&5
-echo $ECHO_N "checking for des_cbc_encrypt in -lcrypto... $ECHO_C" >&6
-if test "${ac_cv_lib_crypto_des_cbc_encrypt+set}" = set; then
+echo "$as_me:$LINENO: checking for DES_cbc_encrypt in -lcrypto" >&5
+echo $ECHO_N "checking for DES_cbc_encrypt in -lcrypto... $ECHO_C" >&6
+if test "${ac_cv_lib_crypto_DES_cbc_encrypt+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -9760,11 +11153,11 @@ extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char des_cbc_encrypt ();
+char DES_cbc_encrypt ();
int
main ()
{
-des_cbc_encrypt ();
+DES_cbc_encrypt ();
;
return 0;
}
@@ -9781,19 +11174,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_crypto_des_cbc_encrypt=yes
+ ac_cv_lib_crypto_DES_cbc_encrypt=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_crypto_des_cbc_encrypt=no
+ac_cv_lib_crypto_DES_cbc_encrypt=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_des_cbc_encrypt" >&5
-echo "${ECHO_T}$ac_cv_lib_crypto_des_cbc_encrypt" >&6
-if test $ac_cv_lib_crypto_des_cbc_encrypt = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_DES_cbc_encrypt" >&5
+echo "${ECHO_T}$ac_cv_lib_crypto_DES_cbc_encrypt" >&6
+if test $ac_cv_lib_crypto_DES_cbc_encrypt = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
@@ -9950,6 +11343,11 @@ fi
fi;
+if test "$missing_includes" = "yes"; then
+ CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
+ V_INCLS="$V_INCLS -I\$(srcdir)/missing"
+fi
+
diff --git a/contrib/tcpdump/configure.in b/contrib/tcpdump/configure.in
index 34794733673e..1bb29bb46f44 100755
--- a/contrib/tcpdump/configure.in
+++ b/contrib/tcpdump/configure.in
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.169.2.3 2004/03/28 21:04:48 fenner Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.188 2005/03/27 23:16:08 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
@@ -6,7 +6,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
dnl
-AC_REVISION($Revision: 1.169.2.3 $)
+AC_REVISION($Revision: 1.188 $)
AC_PREREQ(2.50)
AC_INIT(tcpdump.c)
@@ -15,10 +15,27 @@ AC_CANONICAL_HOST
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_C_INLINE
AC_C___ATTRIBUTE__
-
-AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h)
+AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
#include <sys/socket.h>])
+if test "$ac_cv_header_netinet_if_ether_h" != yes; then
+ #
+ # The simple test didn't work.
+ # Do we need to include <net/if.h> first?
+ # Unset ac_cv_header_netinet_if_ether_h so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ AC_MSG_NOTICE([Rechecking with some additional includes])
+ unset ac_cv_header_netinet_if_ether_h
+ AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+struct mbuf;
+struct rtentry;
+#include <net/if.h>])
+fi
+
AC_HEADER_TIME
case "$host_os" in
@@ -104,6 +121,24 @@ yes) AC_MSG_RESULT(yes)
;;
esac
+AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
+AC_MSG_CHECKING([whether to drop root privileges by default])
+if test ! -z "$with_user" ; then
+ AC_DEFINE_UNQUOTED(WITH_USER, "$withval")
+ AC_MSG_RESULT(to \"$withval\")
+else
+ AC_MSG_RESULT(no)
+fi
+
+AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
+AC_MSG_CHECKING([whether to chroot])
+if test ! -z "$with_chroot" ; then
+ AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
+ AC_MSG_RESULT(to \"$withval\")
+else
+ AC_MSG_RESULT(no)
+fi
+
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 enable ipv6 (with ipv4) support
@@ -412,6 +447,7 @@ AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(long long, 8)
dnl
dnl Checks for u_intXX_t
@@ -473,47 +509,16 @@ dnl
dnl Checks if res_state structure has nsort member.
AC_STRUCT_RES_STATE(ac_cv_res_state)
-dnl
-dnl set additional include path if necessary
-if test "$missing_includes" = "yes"; then
- CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
- V_INCLS="$V_INCLS -I\$(srcdir)/missing"
-fi
-
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
AC_CHECK_FUNCS(strftime)
-AC_CHECK_FUNCS(ether_ntohost, [
- AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
- AC_TRY_RUN([
- #include <netdb.h>
- #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/socket.h>
-
- int
- main(int argc, char **argv)
- {
- u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
- char name[MAXHOSTNAMELEN];
-
- ether_ntohost(name, (struct ether_addr *)ea);
- exit(0);
- }
- ], [ac_cv_buggy_ether_ntohost=no],
- [ac_cv_buggy_ether_ntohost=yes],
- [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
- if test "$ac_cv_buggy_ether_ntohost" = "no"; then
- AC_DEFINE(USE_ETHER_NTOHOST)
- fi
-])
-AC_CHECK_FUNCS(setlinebuf)
+AC_CHECK_FUNCS(setlinebuf alarm)
needsnprintf=no
AC_CHECK_FUNCS(vsnprintf snprintf,,
[needsnprintf=yes])
if test $needsnprintf = yes; then
- AC_LIBOBJ(snprintf.o)
+ AC_LIBOBJ(snprintf)
fi
AC_LBL_TYPE_SIGNAL
@@ -522,8 +527,8 @@ AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
-dnl HP/UX may need -lnsl for getrpcbynumber.
-AC_SEARCH_LIBS(getrpcbynumber, nsl)
+dnl Some platforms may need -lnsl for getrpcbynumber.
+AC_SEARCH_LIBS(getrpcbynumber, nsl, AC_DEFINE(HAVE_GETRPCBYNUMBER))
dnl AC_CHECK_LIB(z, uncompress)
dnl AC_CHECK_HEADERS(zlib.h)
@@ -550,7 +555,7 @@ AC_TRY_LINK([#include <sys/types.h>
#include <arpa/inet.h>], [char src[4], dst[128];
inet_ntop(AF_INET, src, dst, sizeof(dst));],
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
- AC_LIBOBJ(inet_ntop.o)])
+ AC_LIBOBJ(inet_ntop)])
AC_MSG_CHECKING(for inet_pton)
AC_TRY_LINK([#include <sys/types.h>
#include <sys/socket.h>
@@ -558,7 +563,7 @@ AC_TRY_LINK([#include <sys/types.h>
#include <arpa/inet.h>], [char src[128], dst[4];
inet_pton(AF_INET, src, dst);],
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
- AC_LIBOBJ(inet_pton.o)])
+ AC_LIBOBJ(inet_pton)])
AC_MSG_CHECKING(for inet_aton)
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>
@@ -566,7 +571,96 @@ AC_TRY_LINK([#include <sys/types.h>
struct in_addr dst;
inet_aton(src, &dst);],
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
- AC_LIBOBJ(inet_aton.o)])
+ AC_LIBOBJ(inet_aton)])
+
+#
+# Check for these after AC_LBL_LIBPCAP, for the same reason.
+#
+# You are in a twisty little maze of UN*Xes, all different.
+# Some might not have ether_ntohost().
+# Some might have it, but not declare it in any header file.
+# Some might have it, but declare it in <netinet/if_ether.h>.
+# Some might have it, but declare it in <netinet/ether.h>
+# (And some might have it but document it as something declared in
+# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
+#
+# Before you is a C compiler.
+#
+AC_CHECK_FUNCS(ether_ntohost, [
+ AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
+ AC_TRY_RUN([
+ #include <netdb.h>
+ #include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/socket.h>
+
+ int
+ main(int argc, char **argv)
+ {
+ u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
+ char name[MAXHOSTNAMELEN];
+
+ ether_ntohost(name, (struct ether_addr *)ea);
+ exit(0);
+ }
+ ], [ac_cv_buggy_ether_ntohost=no],
+ [ac_cv_buggy_ether_ntohost=yes],
+ [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
+ if test "$ac_cv_buggy_ether_ntohost" = "no"; then
+ AC_DEFINE(USE_ETHER_NTOHOST)
+ fi
+])
+if test "$ac_cv_func_ether_ntohost" = yes -a \
+ "$ac_cv_buggy_ether_ntohost" = "no"; then
+ #
+ # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>?
+ #
+ if test "$ac_cv_header_netinet_if_ether_h" = yes; then
+ #
+ # Yes. Does it declare ether_ntohost()?
+ #
+ AC_CHECK_DECLS(ether_ntohost,
+ [
+ AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
+ ],,
+ [
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+struct mbuf;
+struct rtentry;
+#include <net/if.h>
+#include <netinet/if_ether.h>
+ ])
+ fi
+ #
+ # Did that succeed?
+ #
+ if test "$ac_cv_have_decl_ether_ntohost" != yes; then
+ #
+ # No, how about <netinet/ether.h>, as on Linux?
+ #
+ AC_CHECK_HEADERS(netinet/ether.h)
+ if test "$ac_cv_header_netinet_ether_h" = yes; then
+ #
+ # We have it - does it declare ether_ntohost()?
+ # Unset ac_cv_have_decl_ether_ntohost so we don't
+ # treat the previous failure as a cached value and
+ # suppress the next test.
+ #
+ unset ac_cv_have_decl_ether_ntohost
+ AC_CHECK_DECLS(ether_ntohost,
+ [
+ AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
+ [Define to 1 if netinet/ether.h declares `ether_ntohost'])
+ ],,
+ [
+#include <netinet/ether.h>
+ ])
+ fi
+ fi
+fi
dnl portability macros for getaddrinfo/getnameinfo
dnl
@@ -578,22 +672,22 @@ fi
AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
-dnl Check for MacOS X, which may ship pcap.h from 0.6 but libpcap may
+dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
dnl have pcap_if_t.
+ savedcflags="$CFLAGS"
+ CFLAGS="$CFLAGS $V_INCLS"
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
+ CFLAGS="$savedcflags"
fi
+
if test $ac_cv_func_pcap_lib_version = "no" ; then
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
AC_TRY_LINK([],
[
-char *
-return_pcap_version(void)
-{
extern char pcap_version[];
- return pcap_version;
-}
+ return (int)pcap_version;
],
ac_lbl_cv_pcap_version_defined=yes,
ac_lbl_cv_pcap_version_defined=no)
@@ -607,13 +701,9 @@ fi
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
AC_TRY_LINK([],
[
-int
-return_pcap_debug(void)
-{
extern int pcap_debug;
return pcap_debug;
-}
],
ac_lbl_cv_pcap_debug_defined=yes,
ac_lbl_cv_pcap_debug_defined=no)
@@ -628,13 +718,9 @@ else
AC_MSG_CHECKING(whether yydebug is defined by libpcap)
AC_TRY_LINK([],
[
- int
- return_yydebug(void)
- {
extern int yydebug;
return yydebug;
- }
],
ac_lbl_cv_yydebug_defined=yes,
ac_lbl_cv_yydebug_defined=no)
@@ -681,6 +767,66 @@ AC_LBL_CHECK_TYPE(int16_t, short)
AC_LBL_CHECK_TYPE(u_int16_t, u_short)
AC_LBL_CHECK_TYPE(int32_t, int)
AC_LBL_CHECK_TYPE(u_int32_t, u_int)
+AC_LBL_CHECK_TYPE(int64_t, long long)
+AC_LBL_CHECK_TYPE(u_int64_t, unsigned long long)
+
+#
+# We can't just check for <inttypes.h> - some systems have one that
+# doesn't define all the PRI[doxu]64 macros.
+#
+AC_CHECK_HEADERS(inttypes.h,
+ [
+ #
+ # OK, we have inttypes.h, but does it define those macros?
+ #
+ AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[
+ #include <inttypes.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ main()
+ {
+ printf("%" PRId64 "\n", (u_int64_t)1);
+ printf("%" PRIo64 "\n", (u_int64_t)1);
+ printf("%" PRIx64 "\n", (u_int64_t)1);
+ printf("%" PRIu64 "\n", (u_int64_t)1);
+ }
+ ]])
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ ac_lbl_inttypes_h_defines_formats=yes
+ ],
+ [
+ AC_MSG_RESULT(no)
+ ac_lbl_inttypes_h_defines_formats=no
+ ])
+ ],
+ [
+ #
+ # We don't have inttypes.h, so it obviously can't define those
+ # macros.
+ #
+ ac_lbl_inttypes_h_defines_formats=no
+ ])
+if test "$ac_lbl_inttypes_h_defines_formats" = yes; then
+ AC_DEFINE(INTTYPES_H_DEFINES_FORMATS)
+else
+ AC_LBL_CHECK_64BIT_FORMAT(ll,
+ [
+ AC_LBL_CHECK_64BIT_FORMAT(L,
+ [
+ AC_LBL_CHECK_64BIT_FORMAT(q,
+ [
+ AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
+ ])
+ ])
+ ])
+fi
AC_LBL_DEVEL(V_CCOPT)
@@ -695,7 +841,10 @@ AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
AC_MSG_CHECKING(for SSLeay)
ac_cv_ssleay_path=no
incdir=no
-for dir in /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
+
+Xprefix=`eval echo $prefix`
+
+for dir in $Xprefix /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
#
# XXX - is there a better way to check if a given library is
# in a given directory than checking each of the possible
@@ -732,13 +881,20 @@ if test "$ac_cv_ssleay_path" != no; then
if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
LIBS="$LIBS -lrsaref"
fi
- AC_CHECK_LIB(crypto, des_cbc_encrypt)
+ AC_CHECK_LIB(crypto, DES_cbc_encrypt)
CPPFLAGS="$CPPFLAGS $V_INCLS"
AC_CHECK_HEADERS(openssl/evp.h)
fi
])
+dnl
+dnl set additional include path if necessary
+if test "$missing_includes" = "yes"; then
+ CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
+ V_INCLS="$V_INCLS -I\$(srcdir)/missing"
+fi
+
AC_SUBST(V_CCOPT)
AC_SUBST(V_DEFS)
AC_SUBST(V_GROUP)
diff --git a/contrib/tcpdump/cpack.c b/contrib/tcpdump/cpack.c
new file mode 100644
index 000000000000..14c0a9ee2a3e
--- /dev/null
+++ b/contrib/tcpdump/cpack.c
@@ -0,0 +1,144 @@
+/*-
+ * Copyright (c) 2003, 2004 David Young. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of David Young may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``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 DAVID
+ * YOUNG 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <tcpdump-stdinc.h>
+
+#include "cpack.h"
+#include "extract.h"
+
+static u_int8_t *
+cpack_next_boundary(u_int8_t *buf, u_int8_t *p, size_t alignment)
+{
+ size_t misalignment = (size_t)(p - buf) % alignment;
+
+ if (misalignment == 0)
+ return p;
+
+ return p + (alignment - misalignment);
+}
+
+/* Advance to the next wordsize boundary. Return NULL if fewer than
+ * wordsize bytes remain in the buffer after the boundary. Otherwise,
+ * return a pointer to the boundary.
+ */
+static u_int8_t *
+cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize)
+{
+ u_int8_t *next;
+
+ /* Ensure alignment. */
+ next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize);
+
+ /* Too little space for wordsize bytes? */
+ if (next - cs->c_buf + wordsize > cs->c_len)
+ return NULL;
+
+ return next;
+}
+
+int
+cpack_init(struct cpack_state *cs, u_int8_t *buf, size_t buflen)
+{
+ memset(cs, 0, sizeof(*cs));
+
+ cs->c_buf = buf;
+ cs->c_len = buflen;
+ cs->c_next = cs->c_buf;
+
+ return 0;
+}
+
+/* Unpack a 64-bit unsigned integer. */
+int
+cpack_uint64(struct cpack_state *cs, u_int64_t *u)
+{
+ u_int8_t *next;
+
+ if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ return -1;
+
+ *u = EXTRACT_LE_64BITS(next);
+
+ /* Move pointer past the u_int64_t. */
+ cs->c_next = next + sizeof(*u);
+ return 0;
+}
+
+/* Unpack a 32-bit unsigned integer. */
+int
+cpack_uint32(struct cpack_state *cs, u_int32_t *u)
+{
+ u_int8_t *next;
+
+ if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ return -1;
+
+ *u = EXTRACT_LE_32BITS(next);
+
+ /* Move pointer past the u_int32_t. */
+ cs->c_next = next + sizeof(*u);
+ return 0;
+}
+
+/* Unpack a 16-bit unsigned integer. */
+int
+cpack_uint16(struct cpack_state *cs, u_int16_t *u)
+{
+ u_int8_t *next;
+
+ if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL)
+ return -1;
+
+ *u = EXTRACT_LE_16BITS(next);
+
+ /* Move pointer past the u_int16_t. */
+ cs->c_next = next + sizeof(*u);
+ return 0;
+}
+
+/* Unpack an 8-bit unsigned integer. */
+int
+cpack_uint8(struct cpack_state *cs, u_int8_t *u)
+{
+ /* No space left? */
+ if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len)
+ return -1;
+
+ *u = *cs->c_next;
+
+ /* Move pointer past the u_int8_t. */
+ cs->c_next++;
+ return 0;
+}
diff --git a/contrib/tcpdump/cpack.h b/contrib/tcpdump/cpack.h
new file mode 100644
index 000000000000..14ed37692cd9
--- /dev/null
+++ b/contrib/tcpdump/cpack.h
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 2003, 2004 David Young. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of David Young may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``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 DAVID
+ * YOUNG 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.
+ */
+
+#ifndef _CPACK_H
+#define _CPACK_H
+
+struct cpack_state {
+ u_int8_t *c_buf;
+ u_int8_t *c_next;
+ size_t c_len;
+};
+
+int cpack_init(struct cpack_state *, u_int8_t *, size_t);
+
+int cpack_uint8(struct cpack_state *, u_int8_t *);
+int cpack_uint16(struct cpack_state *, u_int16_t *);
+int cpack_uint32(struct cpack_state *, u_int32_t *);
+int cpack_uint64(struct cpack_state *, u_int64_t *);
+
+#define cpack_int8(__s, __p) cpack_uint8((__s), (u_int8_t*)(__p))
+#define cpack_int16(__s, __p) cpack_uint16((__s), (u_int16_t*)(__p))
+#define cpack_int32(__s, __p) cpack_uint32((__s), (u_int32_t*)(__p))
+#define cpack_int64(__s, __p) cpack_uint64((__s), (u_int64_t*)(__p))
+
+#endif /* _CPACK_H */
diff --git a/contrib/tcpdump/decode_prefix.h b/contrib/tcpdump/decode_prefix.h
new file mode 100644
index 000000000000..b73847142f02
--- /dev/null
+++ b/contrib/tcpdump/decode_prefix.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 1999 WIDE Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
+ *
+ * Extensively modified by Hannes Gredler (hannes@juniper.net) for more
+ * complete BGP support.
+ */
+
+#ifndef tcpdump_decode_prefix_h
+#define tcpdump_decode_prefix_h
+
+extern int decode_prefix4(const u_char *pptr, char *buf, u_int buflen);
+#ifdef INET6
+extern int decode_prefix6(const u_char *pd, char *buf, u_int buflen);
+#endif
+
+#endif
diff --git a/contrib/tcpdump/ethertype.h b/contrib/tcpdump/ethertype.h
index f09ea6eff471..2513fbdad492 100644
--- a/contrib/tcpdump/ethertype.h
+++ b/contrib/tcpdump/ethertype.h
@@ -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.20 2003/07/01 19:10:26 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24 2004/10/07 16:04:07 hannes Exp $ (LBL)
*/
/*
@@ -33,6 +33,13 @@
* <netinet/if_ether.h> if all it needs are ETHERTYPE_ values.
*/
+#ifndef ETHERTYPE_LEN
+#define ETHERTYPE_LEN 2
+#endif
+
+#ifndef ETHERTYPE_GRE_ISO
+#define ETHERTYPE_GRE_ISO 0x00FE /* not really an ethertype only used in GRE */
+#endif
#ifndef ETHERTYPE_PUP
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
#endif
@@ -114,6 +121,12 @@
#ifndef ETHERTYPE_PPPOES
#define ETHERTYPE_PPPOES 0x8864
#endif
+#ifndef ETHERTYPE_JUMBO
+#define ETHERTYPE_JUMBO 0x8870
+#endif
+#ifndef ETHERTYPE_EAPOL
+#define ETHERTYPE_EAPOL 0x888e
+#endif
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
#endif
diff --git a/contrib/tcpdump/extract.h b/contrib/tcpdump/extract.h
index 25980e46a446..f3db2505dd41 100644
--- a/contrib/tcpdump/extract.h
+++ b/contrib/tcpdump/extract.h
@@ -18,11 +18,12 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.19 2002/12/11 07:13:51 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.24 2005/01/15 02:06:50 guy Exp $ (LBL)
*/
-/* Network to host order macros */
-
+/*
+ * Macros to extract possibly-unaligned big-endian integral values.
+ */
#ifdef LBL_ALIGN
/*
* The processor doesn't natively handle unaligned loads.
@@ -54,6 +55,10 @@ typedef struct {
((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val))
#define EXTRACT_32BITS(p) \
((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val))
+#define EXTRACT_64BITS(p) \
+ ((u_int64_t)(((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 0)->val)) << 32 | \
+ ((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 1)->val)) << 0))
+
#else /* HAVE___ATTRIBUTE__ */
/*
* We don't have __attribute__, so do unaligned loads of big-endian
@@ -68,6 +73,15 @@ typedef struct {
(u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
(u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
(u_int32_t)*((const u_int8_t *)(p) + 3)))
+#define EXTRACT_64BITS(p) \
+ ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 0) << 56 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 1) << 48 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 2) << 40 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 3) << 32 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 4) << 24 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 5) << 16 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 6) << 8 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 7)))
#endif /* HAVE___ATTRIBUTE__ */
#else /* LBL_ALIGN */
/*
@@ -78,6 +92,9 @@ typedef struct {
((u_int16_t)ntohs(*(const u_int16_t *)(p)))
#define EXTRACT_32BITS(p) \
((u_int32_t)ntohl(*(const u_int32_t *)(p)))
+#define EXTRACT_64BITS(p) \
+ ((u_int64_t)(((u_int64_t)ntohl(*((const u_int32_t *)(p) + 0))) << 32 | \
+ ((u_int64_t)ntohl(*((const u_int32_t *)(p) + 1))) << 0))
#endif /* LBL_ALIGN */
#define EXTRACT_24BITS(p) \
@@ -85,8 +102,10 @@ typedef struct {
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
(u_int32_t)*((const u_int8_t *)(p) + 2)))
-/* Little endian protocol host order macros */
-
+/*
+ * Macros to extract possibly-unaligned little-endian integral values.
+ * XXX - do loads on little-endian machines that support unaligned loads?
+ */
#define EXTRACT_LE_8BITS(p) (*(p))
#define EXTRACT_LE_16BITS(p) \
((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
@@ -96,3 +115,12 @@ 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_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 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 5) << 40 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 4) << 32 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 3) << 24 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 2) << 16 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 1) << 8 | \
+ (u_int64_t)*((const u_int8_t *)(p) + 0)))
diff --git a/contrib/tcpdump/gmpls.c b/contrib/tcpdump/gmpls.c
index 325b53a95a99..0716e260dd43 100644
--- a/contrib/tcpdump/gmpls.c
+++ b/contrib/tcpdump/gmpls.c
@@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/gmpls.c,v 1.2.2.2 2003/11/16 08:51:05 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/gmpls.c,v 1.5 2004/09/15 17:54:10 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -132,3 +132,14 @@ struct tok gmpls_payload_values[] = {
{ 58, "Fiber Channel"},
{ 0, NULL }
};
+
+#define DIFFSERV_BC_MODEL_RDM 0 /* draft-ietf-tewg-diff-te-proto-07 */
+#define DIFFSERV_BC_MODEL_MAM 1 /* draft-ietf-tewg-diff-te-proto-07 */
+#define DIFFSERV_BC_MODEL_EXTD_MAM 254 /* experimental */
+
+struct tok diffserv_te_bc_values[] = {
+ { DIFFSERV_BC_MODEL_RDM, "Russian dolls"},
+ { DIFFSERV_BC_MODEL_MAM, "Maximum allocation"},
+ { DIFFSERV_BC_MODEL_EXTD_MAM, "Maximum allocation with E-LSP support"},
+ { 0, NULL }
+};
diff --git a/contrib/tcpdump/gmpls.h b/contrib/tcpdump/gmpls.h
index f35211fbc85c..76ddc2f276be 100644
--- a/contrib/tcpdump/gmpls.h
+++ b/contrib/tcpdump/gmpls.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.2 2003/06/09 23:28:09 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.3 2004/09/15 17:54:11 hannes Exp $ (LBL) */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code
@@ -18,3 +18,4 @@ extern struct tok gmpls_link_prot_values[];
extern struct tok gmpls_switch_cap_values[];
extern struct tok gmpls_encoding_values[];
extern struct tok gmpls_payload_values[];
+extern struct tok diffserv_te_bc_values[];
diff --git a/contrib/tcpdump/gmt2local.c b/contrib/tcpdump/gmt2local.c
index 978e583c6266..926e86cfb7fc 100644
--- a/contrib/tcpdump/gmt2local.c
+++ b/contrib/tcpdump/gmt2local.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.7.2.2 2003/11/16 08:51:06 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
diff --git a/contrib/tcpdump/icmp6.h b/contrib/tcpdump/icmp6.h
index 931de2f24948..c0008556da89 100644
--- a/contrib/tcpdump/icmp6.h
+++ b/contrib/tcpdump/icmp6.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.14 2002/12/11 07:13:52 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.16 2005/01/14 10:41:50 hannes 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 $ */
@@ -117,18 +117,20 @@ struct icmp6_hdr {
#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
#define ICMP6_NI_QUERY 139 /* node information request */
#define ICMP6_NI_REPLY 140 /* node information reply */
+#define IND_SOLICIT 141 /* inverse neighbor solicitation */
+#define IND_ADVERT 142 /* inverse neighbor advertisement */
-/* The definitions below are experimental. TBA */
-#define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
-#define MLD6_MTRACE 142 /* mtrace messages */
+#define ICMP6_V2_MEMBERSHIP_REPORT 143 /* v2 membership report */
+#define MLDV2_LISTENER_REPORT 143 /* v2 multicast listener report */
+#define ICMP6_HADISCOV_REQUEST 144
+#define ICMP6_HADISCOV_REPLY 145
+#define ICMP6_MOBILEPREFIX_SOLICIT 146
+#define ICMP6_MOBILEPREFIX_ADVERT 147
-/* Folloing numbers are defined in the mobile-ip draft. */
-#define ICMP6_HADISCOV_REQUEST 150 /* XXX To be authorized */
-#define ICMP6_HADISCOV_REPLY 151 /* XXX To be authorized */
-#define ICMP6_MOBILEPREFIX_SOLICIT 152 /* XXX To be authorized */
-#define ICMP6_MOBILEPREFIX_ADVERT 153 /* XXX To be authorized */
+#define MLD6_MTRACE_RESP 200 /* mtrace response(to sender) */
+#define MLD6_MTRACE 201 /* mtrace messages */
-#define ICMP6_MAXTYPE 153
+#define ICMP6_MAXTYPE 201
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
@@ -176,6 +178,9 @@ struct mld6_hdr {
#define mld6_maxdelay mld6_hdr.icmp6_data16[0]
#define mld6_reserved mld6_hdr.icmp6_data16[1]
+#define MLD_MINLEN 24
+#define MLDV2_MINLEN 28
+
/*
* Neighbor Discovery
*/
@@ -240,10 +245,10 @@ struct nd_neighbor_advert { /* neighbor advertisement */
#define nd_na_code nd_na_hdr.icmp6_code
#define nd_na_cksum nd_na_hdr.icmp6_cksum
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
-/* netowkr endian */
-#define ND_NA_FLAG_ROUTER ((u_int32_t)htonl(0x80000000))
-#define ND_NA_FLAG_SOLICITED ((u_int32_t)htonl(0x40000000))
-#define ND_NA_FLAG_OVERRIDE ((u_int32_t)htonl(0x20000000))
+
+#define ND_NA_FLAG_ROUTER 0x80000000
+#define ND_NA_FLAG_SOLICITED 0x40000000
+#define ND_NA_FLAG_OVERRIDE 0x20000000
struct nd_redirect { /* redirect */
struct icmp6_hdr nd_rd_hdr;
@@ -278,9 +283,9 @@ struct nd_opt_prefix_info { /* prefix information */
u_int8_t nd_opt_pi_len;
u_int8_t nd_opt_pi_prefix_len;
u_int8_t nd_opt_pi_flags_reserved;
- u_int32_t nd_opt_pi_valid_time;
- u_int32_t nd_opt_pi_preferred_time;
- u_int32_t nd_opt_pi_reserved2;
+ u_int8_t nd_opt_pi_valid_time[4];
+ u_int8_t nd_opt_pi_preferred_time[4];
+ u_int8_t nd_opt_pi_reserved2[4];
struct in6_addr nd_opt_pi_prefix;
};
diff --git a/contrib/tcpdump/ieee802_11_radio.h b/contrib/tcpdump/ieee802_11_radio.h
new file mode 100644
index 000000000000..c56be0183fc1
--- /dev/null
+++ b/contrib/tcpdump/ieee802_11_radio.h
@@ -0,0 +1,201 @@
+/* $FreeBSD$ */
+/* $NetBSD: ieee80211_radiotap.h,v 1.3 2003/11/16 09:02:42 dyoung Exp $ */
+/* $Header: /tcpdump/master/tcpdump/ieee802_11_radio.h,v 1.1 2004/09/23 21:33:10 dyoung Exp $ */
+
+/*-
+ * Copyright (c) 2003, 2004 David Young. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of David Young may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``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 DAVID
+ * YOUNG 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.
+ */
+#ifndef _NET_IF_IEEE80211RADIOTAP_H_
+#define _NET_IF_IEEE80211RADIOTAP_H_
+
+/* A generic radio capture format is desirable. There is one for
+ * Linux, but it is neither rigidly defined (there were not even
+ * units given for some fields) nor easily extensible.
+ *
+ * I suggest the following extensible radio capture format. It is
+ * based on a bitmap indicating which fields are present.
+ *
+ * I am trying to describe precisely what the application programmer
+ * should expect in the following, and for that reason I tell the
+ * units and origin of each measurement (where it applies), or else I
+ * use sufficiently weaselly language ("is a monotonically nondecreasing
+ * function of...") that I cannot set false expectations for lawyerly
+ * readers.
+ */
+#ifdef _KERNEL
+#ifndef DLT_IEEE802_11_RADIO
+#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus WLAN header */
+#endif
+#endif /* _KERNEL */
+
+/* The radio capture header precedes the 802.11 header. */
+struct ieee80211_radiotap_header {
+ u_int8_t it_version; /* Version 0. Only increases
+ * for drastic changes,
+ * introduction of compatible
+ * new fields does not count.
+ */
+ u_int8_t it_pad;
+ u_int16_t it_len; /* length of the whole
+ * header in bytes, including
+ * it_version, it_pad,
+ * it_len, and data fields.
+ */
+ u_int32_t it_present; /* A bitmap telling which
+ * fields are present. Set bit 31
+ * (0x80000000) to extend the
+ * bitmap by another 32 bits.
+ * Additional extensions are made
+ * by setting bit 31.
+ */
+} __attribute__((__packed__));
+
+/* Name Data type Units
+ * ---- --------- -----
+ *
+ * IEEE80211_RADIOTAP_TSFT u_int64_t microseconds
+ *
+ * Value in microseconds of the MAC's 64-bit 802.11 Time
+ * Synchronization Function timer when the first bit of the
+ * MPDU arrived at the MAC. For received frames, only.
+ *
+ * IEEE80211_RADIOTAP_CHANNEL 2 x u_int16_t MHz, bitmap
+ *
+ * Tx/Rx frequency in MHz, followed by flags (see below).
+ *
+ * IEEE80211_RADIOTAP_FHSS u_int16_t see below
+ *
+ * For frequency-hopping radios, the hop set (first byte)
+ * and pattern (second byte).
+ *
+ * IEEE80211_RADIOTAP_RATE u_int8_t 500kb/s
+ *
+ * Tx/Rx data rate
+ *
+ * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from
+ * one milliwatt (dBm)
+ *
+ * RF signal power at the antenna, decibel difference from
+ * one milliwatt.
+ *
+ * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from
+ * one milliwatt (dBm)
+ *
+ * RF noise power at the antenna, decibel difference from one
+ * milliwatt.
+ *
+ * IEEE80211_RADIOTAP_DB_ANTSIGNAL u_int8_t decibel (dB)
+ *
+ * RF signal power at the antenna, decibel difference from an
+ * arbitrary, fixed reference.
+ *
+ * IEEE80211_RADIOTAP_DB_ANTNOISE u_int8_t decibel (dB)
+ *
+ * RF noise power at the antenna, decibel difference from an
+ * arbitrary, fixed reference point.
+ *
+ * IEEE80211_RADIOTAP_BARKER_CODE_LOCK u_int16_t unitless
+ *
+ * Quality of Barker code lock. Unitless. Monotonically
+ * nondecreasing with "better" lock strength. Called "Signal
+ * Quality" in datasheets. (Is there a standard way to measure
+ * this?)
+ *
+ * IEEE80211_RADIOTAP_TX_ATTENUATION u_int16_t unitless
+ *
+ * Transmit power expressed as unitless distance from max
+ * power set at factory calibration. 0 is max power.
+ * Monotonically nondecreasing with lower power levels.
+ *
+ * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u_int16_t decibels (dB)
+ *
+ * Transmit power expressed as decibel distance from max power
+ * set at factory calibration. 0 is max power. Monotonically
+ * nondecreasing with lower power levels.
+ *
+ * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from
+ * one milliwatt (dBm)
+ *
+ * Transmit power expressed as dBm (decibels from a 1 milliwatt
+ * reference). This is the absolute power level measured at
+ * the antenna port.
+ *
+ * IEEE80211_RADIOTAP_FLAGS u_int8_t bitmap
+ *
+ * Properties of transmitted and received frames. See flags
+ * defined below.
+ *
+ * IEEE80211_RADIOTAP_ANTENNA u_int8_t antenna index
+ *
+ * Unitless indication of the Rx/Tx antenna for this packet.
+ * The first antenna is antenna 0.
+ */
+enum ieee80211_radiotap_type {
+ IEEE80211_RADIOTAP_TSFT = 0,
+ IEEE80211_RADIOTAP_FLAGS = 1,
+ IEEE80211_RADIOTAP_RATE = 2,
+ IEEE80211_RADIOTAP_CHANNEL = 3,
+ IEEE80211_RADIOTAP_FHSS = 4,
+ IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
+ IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
+ IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
+ IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
+ IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
+ IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
+ IEEE80211_RADIOTAP_ANTENNA = 11,
+ IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
+ IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
+ IEEE80211_RADIOTAP_EXT = 31
+};
+
+#ifndef _KERNEL
+/* Channel flags. */
+#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
+#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
+#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
+#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
+#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
+#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
+#endif /* !_KERNEL */
+
+/* For IEEE80211_RADIOTAP_FLAGS */
+#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
+ * during CFP
+ */
+#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received
+ * with short
+ * preamble
+ */
+#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received
+ * with WEP encryption
+ */
+#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received
+ * with fragmentation
+ */
+
+#endif /* _NET_IF_IEEE80211RADIOTAP_H_ */
diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h
index df84eec15064..8a3665787da4 100644
--- a/contrib/tcpdump/interface.h
+++ b/contrib/tcpdump/interface.h
@@ -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.217.2.5 2004/03/17 19:47:48 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244 2005/04/06 21:33:27 mcr Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -61,30 +61,6 @@ extern char *strdup(const char *);
extern char *strsep(char **, const char *);
#endif
-struct tok {
- int v; /* value */
- const char *s; /* string */
-};
-
-extern int aflag; /* translate network and broadcast addresses */
-extern int dflag; /* print filter code */
-extern int eflag; /* print ethernet header */
-extern int fflag; /* don't translate "foreign" IP address */
-extern int nflag; /* leave addresses as numbers */
-extern int Nflag; /* remove domains from printed host names */
-extern int qflag; /* quick (shorter) output */
-extern int Rflag; /* print sequence # field in AH/ESP*/
-extern int sflag; /* use the libsmi to translate OIDs */
-extern int Sflag; /* print raw TCP sequence numbers */
-extern int tflag; /* print packet arrival time */
-extern int uflag; /* Print undecoded NFS handles */
-extern int vflag; /* verbose */
-extern int xflag; /* print packet in hex */
-extern int Xflag; /* print packet in hex/ascii */
-extern int Aflag; /* print packet only in ascii observing TAB, LF, CR and SPACE as graphical chars */
-extern char *espsecret;
-
-extern int packettype; /* as specified by -T */
#define PT_VAT 1 /* Visual Audio Tool */
#define PT_WB 2 /* distributed White Board */
#define PT_RPC 3 /* Remote Procedure Call */
@@ -132,10 +108,6 @@ extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
-extern int snaplen;
-/* global pointer to end of current packet (during printing) */
-extern const u_char *snapend;
-
/*
* True if "l" bytes of "var" were captured.
*
@@ -161,9 +133,7 @@ extern void relts_print(int);
extern int fn_print(const u_char *, const u_char *);
extern int fn_printn(const u_char *, u_int, const u_char *);
-extern const char *tok2str(const struct tok *, const char *, int);
extern int mask2plen(u_int32_t);
-extern char *bittok2str(const struct tok *, const char *, int);
extern const char *tok2strary_internal(const char **, int, const char *, int);
#define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
@@ -179,7 +149,7 @@ extern char *copy_argv(char **);
extern void safeputchar(int);
extern void safeputs(const char *);
-extern const char *isonsap_string(const u_char *);
+extern const char *isonsap_string(const u_char *, register u_int);
extern const char *llcsap_string(u_char);
extern const char *protoid_string(const u_char *);
extern const char *ipxsap_string(u_short);
@@ -191,11 +161,11 @@ extern const char *dnnum_string(u_short);
#include <pcap.h>
extern int print_unknown_data(const u_char *, const char *,int);
-extern void ascii_print_with_offset(const u_char *, const u_char *, u_int, u_int);
-extern void ascii_print(const u_char *, const u_char *, u_int);
-extern void hex_print_with_offset(const u_char *, const u_char *, u_int, u_int);
+extern void ascii_print_with_offset(const char *, const u_char *, u_int, u_int);
+extern void ascii_print(const char *, const u_char *, u_int);
+extern void hex_print_with_offset(const char *, const u_char *, u_int, u_int);
extern void telnet_print(const u_char *, u_int);
-extern void hex_print(const u_char *, const u_char *, u_int);
+extern void hex_print(const char *, const u_char *, u_int);
extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
const u_char *, u_short *);
@@ -203,20 +173,19 @@ extern int snap_print(const u_char *, u_int, u_int, u_short *, u_int32_t,
u_short, u_int);
extern void aarp_print(const u_char *, u_int);
extern void aodv_print(const u_char *, u_int, int);
-extern void arp_print(const u_char *, u_int, u_int);
extern void atalk_print(const u_char *, u_int);
extern void atm_print(u_int, u_int, u_int, const u_char *, u_int, u_int);
extern u_int atm_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sunatm_if_print(const struct pcap_pkthdr *, const u_char *);
+extern int oam_print(const u_char *, u_int);
extern void bootp_print(const u_char *, u_int);
extern void bgp_print(const u_char *, int);
extern void beep_print(const u_char *, u_int);
extern void cnfp_print(const u_char *, const u_char *);
extern void decnet_print(const u_char *, u_int, u_int);
extern void default_print(const u_char *, u_int);
-extern void default_print_unaligned(const u_char *, u_int);
extern void dvmrp_print(const u_char *, u_int);
-extern void egp_print(const u_char *);
+extern void egp_print(const u_char *, u_int);
extern u_int enc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int pflog_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int arcnet_if_print(const struct pcap_pkthdr *, const u_char *);
@@ -236,7 +205,6 @@ 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);
extern void igrp_print(const u_char *, u_int, const u_char *);
-extern void ip_print(const u_char *, u_int);
extern void ipN_print(const u_char *, u_int);
extern u_int ipfc_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ipx_print(const u_char *, u_int);
@@ -255,6 +223,9 @@ 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 lmp_print(const u_char *, u_int);
+extern void lspping_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);
extern u_int pppoe_print(const u_char *, u_int);
@@ -264,6 +235,7 @@ extern u_int ppp_hdlc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ppp_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
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 u_int raw_if_print(const struct pcap_pkthdr *, const u_char *);
extern void rip_print(const u_char *, u_int);
@@ -273,17 +245,20 @@ extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_mlfr_print(const struct pcap_pkthdr *, const u_char *);
+extern u_int juniper_mlppp_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
extern void snmp_print(const u_char *, u_int);
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
+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 udp_print(const u_char *, u_int, const u_char *, int);
extern void wb_print(const void *, u_int);
extern int ah_print(register const u_char *);
-extern int esp_print(register const u_char *, register const u_char *, int *, int *);
-extern void isakmp_print(const u_char *, u_int, const u_char *);
extern int ipcomp_print(register const u_char *, int *);
extern void rx_print(register const u_char *, int, int, int, u_char *);
extern void netbeui_print(u_short, const u_char *, int);
@@ -292,6 +267,7 @@ 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 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);
@@ -306,6 +282,8 @@ extern void mpls_lsp_ping_print(const u_char *, u_int);
extern void zephyr_print(const u_char *, int);
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);
#ifdef INET6
extern void ip6_print(const u_char *, u_int);
@@ -327,4 +305,38 @@ extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t);
struct bpf_program;
extern void bpf_dump(struct bpf_program *, int);
+
#endif
+
+#include "netdissect.h"
+
+/* forward compatibility */
+
+netdissect_options *gndo;
+
+#define eflag gndo->ndo_eflag
+#define fflag gndo->ndo_fflag
+#define nflag gndo->ndo_nflag
+#define Nflag gndo->ndo_Nflag
+#define Oflag gndo->ndo_Oflag
+#define pflag gndo->ndo_pflag
+#define qflag gndo->ndo_qflag
+#define Rflag gndo->ndo_Rflag
+#define sflag gndo->ndo_sflag
+#define Sflag gndo->ndo_Sflag
+#define tflag gndo->ndo_tflag
+#define Uflag gndo->ndo_Uflag
+#define uflag gndo->ndo_uflag
+#define vflag gndo->ndo_vflag
+#define xflag gndo->ndo_xflag
+#define Xflag gndo->ndo_Xflag
+#define Cflag gndo->ndo_Cflag
+#define Aflag gndo->ndo_Aflag
+#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 snaplen gndo->ndo_snaplen
+#define snapend gndo->ndo_snapend
+
diff --git a/contrib/tcpdump/ip.h b/contrib/tcpdump/ip.h
index 37ef7742a954..6dbd9def03ca 100644
--- a/contrib/tcpdump/ip.h
+++ b/contrib/tcpdump/ip.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.10 2002/12/11 07:13:53 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.11 2004/09/27 21:13:10 hannes Exp $ (LBL) */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -106,6 +106,7 @@ struct ip {
#define IPOPT_LSRR 131 /* loose source route */
#define IPOPT_SATID 136 /* satnet id */
#define IPOPT_SSRR 137 /* strict source route */
+#define IPOPT_RA 148 /* router-alert, rfc2113 */
/*
* Offsets to fields in options other than EOL and NOP.
diff --git a/contrib/tcpdump/ipproto.c b/contrib/tcpdump/ipproto.c
new file mode 100755
index 000000000000..f3fe7414e0e5
--- /dev/null
+++ b/contrib/tcpdump/ipproto.c
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/ipproto.c,v 1.3 2004/12/15 08:41:26 guy Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include "ipproto.h"
+#include "interface.h"
+
+struct tok ipproto_values[] = {
+ { IPPROTO_HOPOPTS, "Options" },
+ { IPPROTO_ICMP, "ICMP" },
+ { IPPROTO_IGMP, "IGMP" },
+ { IPPROTO_IPV4, "IPIP" },
+ { IPPROTO_TCP, "TCP" },
+ { IPPROTO_EGP, "EGP" },
+ { IPPROTO_PIGP, "IGRP" },
+ { IPPROTO_UDP, "UDP" },
+ { IPPROTO_IPV6, "IPv6" },
+ { IPPROTO_ROUTING, "Routing" },
+ { IPPROTO_FRAGMENT, "Fragment" },
+ { IPPROTO_RSVP, "RSVP" },
+ { IPPROTO_GRE, "GRE" },
+ { IPPROTO_ESP, "ESP" },
+ { IPPROTO_AH, "AH" },
+ { IPPROTO_MOBILE, "Mobile IP" },
+ { IPPROTO_ICMPV6, "ICMPv6" },
+ { IPPROTO_MOBILITY_OLD, "Mobile IP (old)" },
+ { IPPROTO_EIGRP, "EIGRP" },
+ { IPPROTO_OSPF, "OSPF" },
+ { IPPROTO_PIM, "PIM" },
+ { IPPROTO_IPCOMP, "Compressed IP" },
+ { IPPROTO_VRRP, "VRRP" },
+ { IPPROTO_SCTP, "SCTP" },
+ { IPPROTO_MOBILITY, "Mobility" },
+ { 0, NULL }
+};
+
diff --git a/contrib/tcpdump/ipproto.h b/contrib/tcpdump/ipproto.h
index b73cc200ae90..b2159d6324b0 100644
--- a/contrib/tcpdump/ipproto.h
+++ b/contrib/tcpdump/ipproto.h
@@ -30,13 +30,15 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.1.2.1 2003/11/24 20:31:22 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.4 2004/04/28 22:02:23 guy Exp $ (LBL)
*
* From:
* @(#)in.h 8.3 (Berkeley) 1/3/94
* $FreeBSD$
*/
+extern struct tok ipproto_values[];
+
#ifndef IPPROTO_IP
#define IPPROTO_IP 0 /* dummy for IP */
#endif
@@ -58,8 +60,8 @@
#ifndef IPPROTO_EGP
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#endif
-#ifndef IPPROTO_IGRP
-#define IPPROTO_IGRP 9
+#ifndef IPPROTO_PIGP
+#define IPPROTO_PIGP 9
#endif
#ifndef IPPROTO_UDP
#define IPPROTO_UDP 17 /* user datagram protocol */
@@ -113,8 +115,8 @@
#ifndef IPPROTO_ND
#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
#endif
-#ifndef IPPROTO_IGRP
-#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
+#ifndef IPPROTO_EIGRP
+#define IPPROTO_EIGRP 88 /* Cisco/GXS IGRP */
#endif
#ifndef IPPROTO_OSPF
#define IPPROTO_OSPF 89
diff --git a/contrib/tcpdump/l2vpn.c b/contrib/tcpdump/l2vpn.c
new file mode 100755
index 000000000000..d98e69adfd16
--- /dev/null
+++ b/contrib/tcpdump/l2vpn.c
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#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)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+#include "interface.h"
+#include "l2vpn.h"
+
+/* draft-ietf-pwe3-iana-allocation-04 */
+struct tok l2vpn_encaps_values[] = {
+ { 0x00, "Reserved"},
+ { 0x01, "Frame Relay"},
+ { 0x02, "ATM AAL5 VCC transport"},
+ { 0x03, "ATM transparent cell transport"},
+ { 0x04, "Ethernet VLAN"},
+ { 0x05, "Ethernet"},
+ { 0x06, "Cisco-HDLC"},
+ { 0x07, "PPP"},
+ { 0x08, "SONET/SDH Circuit Emulation Service over MPLS"},
+ { 0x09, "ATM n-to-one VCC cell transport"},
+ { 0x0a, "ATM n-to-one VPC cell transport"},
+ { 0x0b, "IP Layer2 Transport"},
+ { 0x0c, "ATM one-to-one VCC Cell Mode"},
+ { 0x0d, "ATM one-to-one VPC Cell Mode"},
+ { 0x0e, "ATM AAL5 PDU VCC transport"},
+ { 0x0f, "Frame-Relay Port mode"},
+ { 0x10, "SONET/SDH Circuit Emulation over Packet"},
+ { 0x11, "Structure-agnostic E1 over Packet"},
+ { 0x12, "Structure-agnostic T1 (DS1) over Packet"},
+ { 0x13, "Structure-agnostic E3 over Packet"},
+ { 0x14, "Structure-agnostic T3 (DS3) over Packet"},
+ { 0x15, "CESoPSN basic mode"},
+ { 0x16, "TDMoIP basic mode"},
+ { 0x17, "CESoPSN TDM with CAS"},
+ { 0x18, "TDMoIP TDM with CAS"},
+ { 0x40, "IP-interworking"},
+ { 0, NULL}
+};
diff --git a/contrib/tcpdump/l2vpn.h b/contrib/tcpdump/l2vpn.h
new file mode 100755
index 000000000000..64eb0247b7d2
--- /dev/null
+++ b/contrib/tcpdump/l2vpn.h
@@ -0,0 +1,17 @@
+/* @(#) $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
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+extern struct tok l2vpn_encaps_values[];
diff --git a/contrib/tcpdump/llc.h b/contrib/tcpdump/llc.h
index c11432645f29..9da9a39340c4 100644
--- a/contrib/tcpdump/llc.h
+++ b/contrib/tcpdump/llc.h
@@ -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.16 2002/12/11 07:13:54 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.17 2005/04/06 20:09:07 hannes Exp $ (LBL)
*/
/*
@@ -125,12 +125,6 @@ struct llc {
#define LLCSAP_ISONS 0xfe
#endif
-#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
-#define OUI_CISCO 0x00000c /* Cisco protocols */
-#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
-#define OUI_RFC2684 0x0080c2 /* RFC 2684 bridged Ethernet */
-#define OUI_APPLETALK 0x080007 /* Appletalk */
-
/*
* PIDs for use with OUI_CISCO.
*/
diff --git a/contrib/tcpdump/machdep.c b/contrib/tcpdump/machdep.c
index 6c73ee7cccb6..5b04503a7281 100644
--- a/contrib/tcpdump/machdep.c
+++ b/contrib/tcpdump/machdep.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.10.2.3 2003/12/15 03:53:42 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
diff --git a/contrib/tcpdump/mpls.h b/contrib/tcpdump/mpls.h
new file mode 100644
index 000000000000..69fc9c9176d0
--- /dev/null
+++ b/contrib/tcpdump/mpls.h
@@ -0,0 +1,41 @@
+/* @(#) $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
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
+ */
+
+#define LABEL_MASK 0xfffff000
+#define LABEL_SHIFT 12
+#define EXP_MASK 0x00000e00
+#define EXP_SHIFT 9
+#define STACK_MASK 0x00000100
+#define STACK_SHIFT 8
+#define TTL_MASK 0x000000ff
+#define TTL_SHIFT 0
+
+#define MPLS_LABEL(x) (((x) & LABEL_MASK) >> LABEL_SHIFT)
+#define MPLS_EXP(x) (((x) & EXP_MASK) >> EXP_SHIFT)
+#define MPLS_STACK(x) (((x) & STACK_MASK) >> STACK_SHIFT)
+#define MPLS_TTL(x) (((x) & TTL_MASK) >> TTL_SHIFT)
diff --git a/contrib/tcpdump/netdissect.h b/contrib/tcpdump/netdissect.h
new file mode 100644
index 000000000000..83114b25a217
--- /dev/null
+++ b/contrib/tcpdump/netdissect.h
@@ -0,0 +1,435 @@
+/*
+ * Copyright (c) 1988-1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Copyright (c) 1998-2004 Michael Richardson <mcr@tcpdump.org>
+ * 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, (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, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.16 2005/04/07 00:28:17 mcr Exp $ (LBL)
+ */
+
+#ifndef netdissect_h
+#define netdissect_h
+
+#ifdef HAVE_OS_PROTO_H
+#include "os-proto.h"
+#endif
+#include <sys/types.h>
+
+#ifndef HAVE___ATTRIBUTE__
+#define __attribute__(x)
+#endif
+
+/* snprintf et al */
+
+#include <stdarg.h>
+
+#if !defined(HAVE_SNPRINTF)
+int snprintf (char *str, size_t sz, const char *format, ...)
+ __attribute__ ((format (printf, 3, 4)));
+#endif
+
+#if !defined(HAVE_VSNPRINTF)
+int vsnprintf (char *str, size_t sz, const char *format, va_list ap)
+ __attribute__((format (printf, 3, 0)));
+#endif
+
+#ifndef HAVE_STRLCAT
+extern size_t strlcat (char *, const char *, size_t);
+#endif
+#ifndef HAVE_STRLCPY
+extern size_t strlcpy (char *, const char *, size_t);
+#endif
+
+#ifndef HAVE_STRDUP
+extern char *strdup (const char *str);
+#endif
+
+#ifndef HAVE_STRSEP
+extern char *strsep(char **, const char *);
+#endif
+
+struct tok {
+ int v; /* value */
+ const char *s; /* string */
+};
+
+#define TOKBUFSIZE 128
+extern const char *tok2strbuf(const struct tok *, const char *, int,
+ char *buf, size_t bufsize);
+
+/* tok2str is deprecated */
+extern const char *tok2str(const struct tok *, const char *, int);
+extern char *bittok2str(const struct tok *, const char *, int);
+
+
+typedef struct netdissect_options netdissect_options;
+
+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_nflag; /* leave addresses as numbers */
+ int ndo_Nflag; /* remove domains from printed host names */
+ int ndo_qflag; /* quick (shorter) output */
+ int ndo_Rflag; /* print sequence # field in AH/ESP*/
+ int ndo_sflag; /* use the libsmi to translate OIDs */
+ int ndo_Sflag; /* print raw TCP sequence numbers */
+ int ndo_tflag; /* print packet arrival time */
+ int ndo_Uflag; /* "unbuffered" output of dump files */
+ int ndo_uflag; /* Print undecoded NFS handles */
+ int ndo_vflag; /* verbose */
+ int ndo_xflag; /* print packet in hex */
+ int ndo_Xflag; /* print packet in hex/ascii */
+ int ndo_Aflag; /* print packet only in ascii observing TAB,
+ * LF, CR and SPACE as graphical chars
+ */
+ 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_Wflag; /* recycle output files after this number of files */
+ int ndo_WflagChars;
+ const char *ndo_dltname;
+
+ char *ndo_espsecret;
+ struct sa_list *ndo_sa_list_head; /* used by print-esp.c */
+ struct sa_list *ndo_sa_default;
+
+ char *ndo_tcpmd5secret; /* TCP-MD5 secret key */
+
+ struct esp_algorithm *ndo_espsecret_xform; /* cache of decoded */
+ char *ndo_espsecret_key;
+
+ int ndo_packettype; /* as specified by -T */
+
+ char *ndo_program_name; /*used to generate self-identifying messages */
+
+ int32_t ndo_thiszone; /* seconds offset from gmt to local time */
+
+ int ndo_snaplen;
+
+ /*global pointers to beginning and end of current packet (during printing) */
+ const u_char *ndo_packetp;
+ const u_char *ndo_snapend;
+
+ /* bookkeeping for ^T output */
+ int ndo_infodelay;
+
+ /* pointer to void function to output stuff */
+ void (*ndo_default_print)(netdissect_options *,
+ register const u_char *bp, register u_int length);
+ void (*ndo_info)(netdissect_options *, int verbose);
+
+ int (*ndo_printf)(netdissect_options *,
+ const char *fmt, ...);
+ void (*ndo_error)(netdissect_options *,
+ const char *fmt, ...);
+ void (*ndo_warning)(netdissect_options *,
+ const char *fmt, ...);
+};
+
+#define PT_VAT 1 /* Visual Audio Tool */
+#define PT_WB 2 /* distributed White Board */
+#define PT_RPC 3 /* Remote Procedure Call */
+#define PT_RTP 4 /* Real-Time Applications protocol */
+#define PT_RTCP 5 /* Real-Time Applications control protocol */
+#define PT_SNMP 6 /* Simple Network Management Protocol */
+#define PT_CNFP 7 /* Cisco NetFlow protocol */
+
+#ifndef min
+#define min(a,b) ((a)>(b)?(b):(a))
+#endif
+#ifndef max
+#define max(a,b) ((b)>(a)?(b):(a))
+#endif
+
+#ifndef INET6
+/*
+ * The default snapshot length. This value allows most printers to print
+ * useful information while keeping the amount of unwanted data down.
+ * In particular, it allows for an ethernet header, tcp/ip header, and
+ * 14 bytes of data (assuming no ip options).
+ */
+#define DEFAULT_SNAPLEN 68
+#else
+#define DEFAULT_SNAPLEN 96
+#endif
+
+#ifndef BIG_ENDIAN
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+#endif
+
+#define ESRC(ep) ((ep)->ether_shost)
+#define EDST(ep) ((ep)->ether_dhost)
+
+#ifndef NTOHL
+#define NTOHL(x) (x) = ntohl(x)
+#define NTOHS(x) (x) = ntohs(x)
+#define HTONL(x) (x) = htonl(x)
+#define HTONS(x) (x) = htons(x)
+#endif
+
+/*
+ * True if "l" bytes of "var" were captured.
+ *
+ * The "ndo->ndo_snapend - (l) <= ndo->ndo_snapend" checks to make sure
+ * "l" isn't so large that "ndo->ndo_snapend - (l)" underflows.
+ *
+ * The check is for <= rather than < because "l" might be 0.
+ */
+#define ND_TTEST2(var, l) (ndo->ndo_snapend - (l) <= ndo->ndo_snapend && \
+ (const u_char *)&(var) <= ndo->ndo_snapend - (l))
+
+/* True if "var" was captured */
+#define ND_TTEST(var) ND_TTEST2(var, sizeof(var))
+
+/* Bail if "l" bytes of "var" were not captured */
+#define ND_TCHECK2(var, l) if (!ND_TTEST2(var, l)) goto trunc
+
+/* Bail if "var" was not captured */
+#define ND_TCHECK(var) ND_TCHECK2(var, sizeof(var))
+
+#define ND_PRINT(STUFF) (*ndo->ndo_printf)STUFF
+#define ND_DEFAULTPRINT(ap, length) (*ndo->ndo_default_print)(ndo, ap, length)
+
+#if 0
+extern void ts_print(netdissect_options *ipdo,
+ const struct timeval *);
+extern void relts_print(int);
+#endif
+
+extern int fn_print(const u_char *, const u_char *);
+extern int fn_printn(const u_char *, u_int, const u_char *);
+extern const char *tok2str(const struct tok *, const char *, int);
+
+extern void wrapup(int);
+
+#if 0
+extern char *read_infile(netdissect_options *, char *);
+extern char *copy_argv(netdissect_options *, char **);
+#endif
+
+extern void safeputchar(int);
+extern void safeputs(const char *);
+
+#if 0
+extern const char *isonsap_string(netdissect_options *, const u_char *);
+extern const char *llcsap_string(netdissect_options *, u_char);
+extern const char *protoid_string(netdissect_options *, const u_char *);
+extern const char *dnname_string(netdissect_options *, u_short);
+extern const char *dnnum_string(netdissect_options *, u_short);
+#endif
+
+/* The printer routines. */
+
+#include <pcap.h>
+
+
+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);
+extern void arp_print(netdissect_options *,const u_char *, u_int, u_int);
+extern void isakmp_print(netdissect_options *,const u_char *,
+ u_int, const u_char *);
+extern void isakmp_rfc3948_print(netdissect_options *,const u_char *,
+ u_int, const u_char *);
+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);
+
+/* stuff that has not yet been rototiled */
+#if 0
+extern void ascii_print_with_offset(netdissect_options *, const char *,
+ u_int, u_int);
+extern void ascii_print(netdissect_options *,const char *, u_int);
+extern void hex_print_with_offset(netdissect_options *,const char *,
+ u_int, u_int);
+extern void telnet_print(netdissect_options *,const u_char *, u_int);
+extern void hex_print(netdissect_options *,const char *, u_int);
+extern int ether_encap_print(netdissect_options *,u_short, const u_char *,
+ u_int, u_int, u_short *);
+extern int llc_print(netdissect_options *,
+ const u_char *, u_int, u_int, const u_char *,
+ const u_char *, u_short *);
+extern void aarp_print(netdissect_options *,const u_char *, u_int);
+extern void atalk_print(netdissect_options *,const u_char *, u_int);
+extern void atm_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+extern void bootp_print(netdissect_options *,const u_char *,
+ u_int, u_short, u_short);
+extern void bgp_print(netdissect_options *,const u_char *, int);
+extern void bxxp_print(netdissect_options *,const u_char *, u_int);
+extern void chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
+ register const u_char *p);
+extern void chdlc_print(netdissect_options *ndo,
+ register const u_char *p, u_int length, u_int caplen);
+extern void cisco_autorp_print(netdissect_options *,
+ const u_char *, u_int);
+extern void cnfp_print(netdissect_options *,const u_char *cp,
+ u_int len, const u_char *bp);
+extern void decnet_print(netdissect_options *,const u_char *,
+ u_int, u_int);
+extern void default_print(netdissect_options *,const u_char *, u_int);
+extern void dvmrp_print(netdissect_options *,const u_char *, u_int);
+extern void egp_print(netdissect_options *,const u_char *, u_int,
+ const u_char *);
+
+extern void arcnet_if_print(u_char*,const struct pcap_pkthdr *,const u_char *);
+extern void ether_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
+extern void token_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
+extern void fddi_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+
+extern void gre_print(netdissect_options *,const u_char *, u_int);
+extern void icmp_print(netdissect_options *,const u_char *, u_int,
+ const u_char *);
+extern void hsrp_print(netdissect_options *ndo,
+ register const u_char *bp, register u_int len);
+extern void ieee802_11_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+extern void igmp_print(netdissect_options *,
+ register const u_char *, u_int);
+extern void igrp_print(netdissect_options *,const u_char *, u_int,
+ const u_char *);
+extern void ipN_print(netdissect_options *,const u_char *, u_int);
+extern void ipx_print(netdissect_options *,const u_char *, u_int);
+extern void isoclns_print(netdissect_options *,const u_char *,
+ u_int, u_int, const u_char *, const u_char *);
+extern void krb_print(netdissect_options *,const u_char *, u_int);
+extern void llap_print(netdissect_options *,const u_char *, u_int);
+extern const char *linkaddr_string(netdissect_options *ndo,
+ const u_char *ep, const unsigned int len);
+extern void ltalk_if_print(netdissect_options *ndo,
+ u_char *user, const struct pcap_pkthdr *h,
+ const u_char *p);
+extern void mpls_print(netdissect_options *ndo,
+ const u_char *bp, u_int length);
+extern void msdp_print(netdissect_options *ndo,
+ const unsigned char *sp, u_int length);
+extern void nfsreply_print(netdissect_options *,const u_char *,
+ u_int, const u_char *);
+extern void nfsreq_print(netdissect_options *,const u_char *,
+ u_int, const u_char *);
+extern void ns_print(netdissect_options *,const u_char *, u_int);
+extern void ntp_print(netdissect_options *,const u_char *, u_int);
+extern void null_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+extern void ospf_print(netdissect_options *,const u_char *,
+ u_int, const u_char *);
+extern void pimv1_print(netdissect_options *,const u_char *, u_int);
+extern void mobile_print(netdissect_options *,const u_char *, u_int);
+extern void pim_print(netdissect_options *,const u_char *, u_int);
+extern void pppoe_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+extern void pppoe_print(netdissect_options *,const u_char *, u_int);
+extern void ppp_print(netdissect_options *,
+ register const u_char *, u_int);
+
+extern void ppp_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+extern void ppp_hdlc_if_print(u_char *,
+ const struct pcap_pkthdr *, const u_char *);
+extern void ppp_bsdos_if_print(u_char *,
+ const struct pcap_pkthdr *, const u_char *);
+
+extern int vjc_print(netdissect_options *,register const char *,
+ register u_int, u_short);
+
+extern void raw_if_print(u_char *,
+ const struct pcap_pkthdr *, const u_char *);
+
+extern void rip_print(netdissect_options *,const u_char *, u_int);
+
+extern void sctp_print(netdissect_options *ndo,
+ const u_char *bp, const u_char *bp2,
+ u_int sctpPacketLength);
+
+extern void sl_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
+
+extern void lane_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
+extern void cip_if_print(u_char *,const struct pcap_pkthdr *,const u_char *);
+extern void sl_bsdos_if_print(u_char *,
+ const struct pcap_pkthdr *, const u_char *);
+extern void sll_if_print(u_char *,
+ const struct pcap_pkthdr *, const u_char *);
+
+extern void snmp_print(netdissect_options *,const u_char *, u_int);
+extern void sunrpcrequest_print(netdissect_options *,const u_char *,
+ u_int, const u_char *);
+extern void tcp_print(netdissect_options *,const u_char *, u_int,
+ const u_char *, int);
+extern void tftp_print(netdissect_options *,const u_char *, u_int);
+extern void timed_print(netdissect_options *,const u_char *, u_int);
+extern void udp_print(netdissect_options *,const u_char *, u_int,
+ const u_char *, int);
+extern void wb_print(netdissect_options *,const void *, u_int);
+extern int ah_print(netdissect_options *,register const u_char *,
+ register const u_char *);
+extern void esp_print_decodesecret(netdissect_options *ndo);
+extern int ipcomp_print(netdissect_options *,register const u_char *,
+ register const u_char *, int *);
+extern void rx_print(netdissect_options *,register const u_char *,
+ int, int, int, u_char *);
+extern void netbeui_print(netdissect_options *,u_short,
+ const u_char *, int);
+extern void ipx_netbios_print(netdissect_options *,const u_char *, u_int);
+extern void nbt_tcp_print(netdissect_options *,const u_char *, int);
+extern void nbt_udp137_print(netdissect_options *,
+ const u_char *data, int);
+extern void nbt_udp138_print(netdissect_options *,
+ const u_char *data, int);
+extern char *smb_errstr(netdissect_options *,int, int);
+extern const char *nt_errstr(netdissect_options *, u_int32_t);
+extern void print_data(netdissect_options *,const unsigned char *, int);
+extern void l2tp_print(netdissect_options *,const u_char *, u_int);
+extern void lcp_print(netdissect_options *,const u_char *, u_int);
+extern void vrrp_print(netdissect_options *,const u_char *bp,
+ u_int len, int ttl);
+extern void cdp_print(netdissect_options *,const u_char *,
+ u_int, u_int, const u_char *, const u_char *);
+extern void stp_print(netdissect_options *,const u_char *p, u_int length);
+extern void radius_print(netdissect_options *,const u_char *, u_int);
+extern void lwres_print(netdissect_options *,const u_char *, u_int);
+extern void pptp_print(netdissect_options *,const u_char *, u_int);
+
+#ifdef INET6
+extern void ip6_print(netdissect_options *,const u_char *, u_int);
+extern void ip6_opt_print(netdissect_options *,const u_char *, int);
+extern int hbhopt_print(netdissect_options *,const u_char *);
+extern int dstopt_print(netdissect_options *,const u_char *);
+extern int frag6_print(netdissect_options *,const u_char *,
+ const u_char *);
+extern void icmp6_print(netdissect_options *,const u_char *,
+ const u_char *);
+extern void ripng_print(netdissect_options *,const u_char *, int);
+extern int rt6_print(netdissect_options *,const u_char *, const u_char *);
+extern void ospf6_print(netdissect_options *,const u_char *, u_int);
+extern void dhcp6_print(netdissect_options *,const u_char *,
+ u_int, u_int16_t, u_int16_t);
+
+extern void zephyr_print(netdissect_options * ndo,
+ const u_char *cp, int length);
+
+#endif /*INET6*/
+extern u_short in_cksum(const u_short *,
+ register u_int, int);
+
+#endif
+
+#endif /* netdissect_h */
diff --git a/contrib/tcpdump/nlpid.c b/contrib/tcpdump/nlpid.c
new file mode 100755
index 000000000000..7dfd6a6f883d
--- /dev/null
+++ b/contrib/tcpdump/nlpid.c
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#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)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+#include "interface.h"
+#include "nlpid.h"
+
+struct tok nlpid_values[] = {
+ { NLPID_NULLNS, "NULL" },
+ { NLPID_Q933, "Q.933" },
+ { NLPID_LMI, "LMI" },
+ { NLPID_SNAP, "SNAP" },
+ { NLPID_CLNP, "CLNP" },
+ { NLPID_ESIS, "ES-IS" },
+ { NLPID_ISIS, "IS-IS" },
+ { NLPID_CONS, "CONS" },
+ { NLPID_IDRP, "IDRP" },
+ { NLPID_MFR, "FRF.15" },
+ { NLPID_IP, "IPv4" },
+ { NLPID_PPP, "PPP" },
+ { NLPID_X25_ESIS, "X25 ES-IS" },
+ { NLPID_IP6, "IPv6" },
+ { 0, NULL }
+};
diff --git a/contrib/tcpdump/nlpid.h b/contrib/tcpdump/nlpid.h
new file mode 100644
index 000000000000..fdca44655238
--- /dev/null
+++ b/contrib/tcpdump/nlpid.h
@@ -0,0 +1,32 @@
+/* @(#) $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
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+extern struct tok nlpid_values[];
+
+#define NLPID_NULLNS 0x00
+#define NLPID_Q933 0x08 /* ANSI T1.617 Annex D or ITU-T Q.933 Annex A */
+#define NLPID_LMI 0x09 /* The original, aka Cisco, aka Gang of Four */
+#define NLPID_SNAP 0x80
+#define NLPID_CLNP 0x81 /* iso9577 */
+#define NLPID_ESIS 0x82 /* iso9577 */
+#define NLPID_ISIS 0x83 /* iso9577 */
+#define NLPID_CONS 0x84
+#define NLPID_IDRP 0x85
+#define NLPID_MFR 0xb1 /* FRF.15 */
+#define NLPID_IP 0xcc
+#define NLPID_PPP 0xcf
+#define NLPID_X25_ESIS 0x8a
+#define NLPID_IP6 0x8e
diff --git a/contrib/tcpdump/ntp.h b/contrib/tcpdump/ntp.h
index f195d6db25d2..df856699ae89 100644
--- a/contrib/tcpdump/ntp.h
+++ b/contrib/tcpdump/ntp.h
@@ -1,4 +1,4 @@
-/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.7 2003/08/06 04:58:21 guy 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
@@ -37,48 +37,58 @@ struct s_fixedpt {
u_int16_t fraction;
};
-/* ================= Table 3.3. Packet Variables ================= */
-/*
- * 0 1 2 3
- * 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
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |LI | VN | Mode| Stratum | Poll | Precision |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Synchronizing Distance |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Synchronizing Dispersion |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Reference Clock Identifier |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |
- * | Reference Timestamp (64 bits) |
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |
- * | Originate Timestamp (64 bits) |
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |
- * | Receive Timestamp (64 bits) |
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |
- * | Transmit Timestamp (64 bits) |
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-*/
+/* rfc2030
+ * 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |LI | VN |Mode | Stratum | Poll | Precision |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Root Delay |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Root Dispersion |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Reference Identifier |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * | Reference Timestamp (64) |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * | Originate Timestamp (64) |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * | Receive Timestamp (64) |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * | Transmit Timestamp (64) |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Key Identifier (optional) (32) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * | |
+ * | Message Digest (optional) (128) |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
struct ntpdata {
u_char status; /* status of local clock and leap info */
u_char stratum; /* Stratum level */
u_char ppoll; /* poll value */
int precision:8;
- struct s_fixedpt distance;
- struct s_fixedpt dispersion;
+ struct s_fixedpt root_delay;
+ struct s_fixedpt root_dispersion;
u_int32_t refid;
- struct l_fixedpt reftime;
- struct l_fixedpt org;
- struct l_fixedpt rec;
- struct l_fixedpt xmt;
+ struct l_fixedpt ref_timestamp;
+ struct l_fixedpt org_timestamp;
+ struct l_fixedpt rec_timestamp;
+ struct l_fixedpt xmt_timestamp;
+ u_int32_t key_id;
+ u_int8_t message_digest[16];
};
/*
* Leap Second Codes (high order two bits)
diff --git a/contrib/tcpdump/ospf.h b/contrib/tcpdump/ospf.h
index 40c75c966a80..5fa008cf0d95 100644
--- a/contrib/tcpdump/ospf.h
+++ b/contrib/tcpdump/ospf.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.11 2003/10/22 17:08:46 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.16 2004/09/20 14:56:34 hannes Exp $ (LBL) */
/*
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
@@ -43,6 +43,7 @@
#define OSPF_OPTION_EA 0x10 /* EA bit: External Attribute capable */
#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 */
/* ospf_authtype */
#define OSPF_AUTH_NONE 0 /* No auth-data */
@@ -63,13 +64,14 @@
#define LS_TYPE_ASE 5 /* ASE */
#define LS_TYPE_GROUP 6 /* Group membership (multicast */
/* extensions 23 July 1991) */
-#define LS_TYPE_NSSA 7 /* rfc1587 - Not so Stubby Areas */
+#define LS_TYPE_NSSA 7 /* rfc3101 - Not so Stubby Areas */
#define LS_TYPE_OPAQUE_LL 9 /* rfc2370 - Opaque Link Local */
#define LS_TYPE_OPAQUE_AL 10 /* rfc2370 - Opaque Link Local */
#define LS_TYPE_OPAQUE_DW 11 /* rfc2370 - Opaque Domain Wide */
#define LS_OPAQUE_TYPE_TE 1 /* rfc3630 */
-#define LS_OPAQUE_TYPE_GRACE 3 /* draft-ietf-ospf-hitless-restart */
+#define LS_OPAQUE_TYPE_GRACE 3 /* rfc3623 */
+#define LS_OPAQUE_TYPE_RI 4 /* draft-ietf-ospf-cap-03 */
#define LS_OPAQUE_TE_TLV_ROUTER 1 /* rfc3630 */
#define LS_OPAQUE_TE_TLV_LINK 2 /* rfc3630 */
@@ -87,10 +89,22 @@
#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_DIFFSERV_TE 17 /* draft-ietf-tewg-diff-te-proto-06 */
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP 1 /* rfc3630 */
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */
+#define LS_OPAQUE_GRACE_TLV_PERIOD 1 /* rfc3623 */
+#define LS_OPAQUE_GRACE_TLV_REASON 2 /* rfc3623 */
+#define LS_OPAQUE_GRACE_TLV_INT_ADDRESS 3 /* rfc3623 */
+
+#define LS_OPAQUE_GRACE_TLV_REASON_UNKNOWN 0 /* rfc3623 */
+#define LS_OPAQUE_GRACE_TLV_REASON_SW_RESTART 1 /* rfc3623 */
+#define LS_OPAQUE_GRACE_TLV_REASON_SW_UPGRADE 2 /* rfc3623 */
+#define LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH 3 /* rfc3623 */
+
+#define LS_OPAQUE_RI_TLV_CAP 1 /* draft-ietf-ospf-cap-03 */
+
/*************************************************
*
* is the above a bug in the documentation?
@@ -198,6 +212,20 @@ struct lsa {
u_int8_t data[1]; /* may repeat */
} un_te_lsa_tlv;
+ /* Opaque Grace LSA */
+ struct {
+ u_int16_t type;
+ u_int16_t length;
+ u_int8_t data[1]; /* may repeat */
+ } un_grace_tlv;
+
+ /* Opaque Router information LSA */
+ struct {
+ u_int16_t type;
+ u_int16_t length;
+ u_int8_t data[1]; /* may repeat */
+ } un_ri_tlv;
+
/* Unknown LSA */
struct unknown {
u_int8_t data[1]; /* may repeat */
diff --git a/contrib/tcpdump/oui.c b/contrib/tcpdump/oui.c
index 3348bd298fc6..c2bb2beb2ea4 100644
--- a/contrib/tcpdump/oui.c
+++ b/contrib/tcpdump/oui.c
@@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.2.2.1 2004/02/06 14:38:51 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.4 2005/04/06 20:13:13 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -29,8 +29,12 @@ static const char rcsid[] _U_ =
/* FIXME complete OUI list using a script */
struct tok oui_values[] = {
- { 0x009069, "Juniper"},
- { 0x00000c, "Cisco"},
+ { OUI_ENCAP_ETHER, "Ethernet" },
+ { OUI_CISCO, "Cisco" },
+ { OUI_CISCO_90, "Cisco bridged" },
+ { OUI_RFC2684, "Ethernet bridged" },
+ { OUI_APPLETALK, "Appletalk" },
+ { OUI_JUNIPER, "Juniper"},
};
/* list taken from ethereal/packet-radius.c */
diff --git a/contrib/tcpdump/oui.h b/contrib/tcpdump/oui.h
index 39df977269ea..4dcaf3ef9235 100644
--- a/contrib/tcpdump/oui.h
+++ b/contrib/tcpdump/oui.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.2.2.1 2004/02/06 14:38:50 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.3 2005/04/06 20:13:13 hannes Exp $ (LBL) */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code
@@ -17,6 +17,13 @@
extern struct tok oui_values[];
extern struct tok smi_values[];
+#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
+#define OUI_CISCO 0x00000c /* Cisco protocols */
+#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
+#define OUI_RFC2684 0x0080c2 /* RFC 2684 bridged Ethernet */
+#define OUI_APPLETALK 0x080007 /* Appletalk */
+#define OUI_JUNIPER 0x009069 /* Juniper */
+
#define SMI_ACC 5
#define SMI_CISCO 9
#define SMI_SHIVA 166
diff --git a/contrib/tcpdump/parsenfsfh.c b/contrib/tcpdump/parsenfsfh.c
index 21af367ac2f4..686d01e48c7f 100644
--- a/contrib/tcpdump/parsenfsfh.c
+++ b/contrib/tcpdump/parsenfsfh.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.25.2.2 2003/11/16 08:51:07 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.28 2004/03/25 03:30:55 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -111,7 +111,7 @@ static int is_UCX(const unsigned char *);
void
Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
register const unsigned char *fh;
-int len;
+int len _U_;
my_fsid *fsidp;
ino_t *inop;
const char **osnamep; /* if non-NULL, return OS name here */
diff --git a/contrib/tcpdump/pcap-missing.h b/contrib/tcpdump/pcap-missing.h
index adf24d87171b..7739c1edcd7a 100644
--- a/contrib/tcpdump/pcap-missing.h
+++ b/contrib/tcpdump/pcap-missing.h
@@ -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.1.2.1 2003/11/18 23:12:11 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.2 2003/11/18 23:09:42 guy Exp $ (LBL)
*/
#ifndef tcpdump_pcap_missing_h
diff --git a/contrib/tcpdump/pf.h b/contrib/tcpdump/pf.h
index 314802c29b23..c2d332abb3cd 100644
--- a/contrib/tcpdump/pf.h
+++ b/contrib/tcpdump/pf.h
@@ -26,7 +26,7 @@
* 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.1.2.1 2004/03/28 21:25:03 fenner Exp $ (LBL)
+ * @(#) $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 $ */
@@ -64,7 +64,7 @@ enum { PF_PASS=0, PF_DROP=1, PF_SCRUB=2, PF_NAT=3, PF_NONAT=4,
struct pfloghdr {
u_int8_t length;
- sa_family_t af;
+ u_int8_t af;
u_int8_t action;
u_int8_t reason;
char ifname[IFNAMSIZ];
diff --git a/contrib/tcpdump/pmap_prot.h b/contrib/tcpdump/pmap_prot.h
new file mode 100644
index 000000000000..fdc4831fa634
--- /dev/null
+++ b/contrib/tcpdump/pmap_prot.h
@@ -0,0 +1,94 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.1 2004/12/27 00:41:30 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
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * from: @(#)pmap_prot.h 1.14 88/02/08 SMI
+ * from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC
+ * $FreeBSD$
+ */
+
+/*
+ * pmap_prot.h
+ * Protocol for the local binder service, or pmap.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * The following procedures are supported by the protocol:
+ *
+ * PMAPPROC_NULL() returns ()
+ * takes nothing, returns nothing
+ *
+ * PMAPPROC_SET(struct pmap) returns (bool_t)
+ * TRUE is success, FALSE is failure. Registers the tuple
+ * [prog, vers, prot, port].
+ *
+ * PMAPPROC_UNSET(struct pmap) returns (bool_t)
+ * TRUE is success, FALSE is failure. Un-registers pair
+ * [prog, vers]. prot and port are ignored.
+ *
+ * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).
+ * 0 is failure. Otherwise returns the port number where the pair
+ * [prog, vers] is registered. It may lie!
+ *
+ * PMAPPROC_DUMP() RETURNS (struct pmaplist *)
+ *
+ * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)
+ * RETURNS (port, string<>);
+ * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);
+ * Calls the procedure on the local machine. If it is not registered,
+ * this procedure is quite; ie it does not return error information!!!
+ * This procedure only is supported on rpc/udp and calls via
+ * rpc/udp. This routine only passes null authentication parameters.
+ * This file has no interface to xdr routines for PMAPPROC_CALLIT.
+ *
+ * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
+ */
+
+#ifndef _RPC_PMAPPROT_H
+#define _RPC_PMAPPROT_H
+
+#define PMAPPORT ((u_int16_t)111)
+#define PMAPPROG ((u_int32_t)100000)
+#define PMAPVERS ((u_int32_t)2)
+#define PMAPVERS_PROTO ((u_int32_t)2)
+#define PMAPVERS_ORIG ((u_int32_t)1)
+#define PMAPPROC_NULL ((u_int32_t)0)
+#define PMAPPROC_SET ((u_int32_t)1)
+#define PMAPPROC_UNSET ((u_int32_t)2)
+#define PMAPPROC_GETPORT ((u_int32_t)3)
+#define PMAPPROC_DUMP ((u_int32_t)4)
+#define PMAPPROC_CALLIT ((u_int32_t)5)
+
+struct pmap {
+ u_int32_t pm_prog;
+ u_int32_t pm_vers;
+ u_int32_t pm_prot;
+ u_int32_t pm_port;
+};
+
+#endif /* !_RPC_PMAPPROT_H */
diff --git a/contrib/tcpdump/ppp.h b/contrib/tcpdump/ppp.h
index d09efbd0029c..71621caa9ca7 100644
--- a/contrib/tcpdump/ppp.h
+++ b/contrib/tcpdump/ppp.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.14 2003/05/22 15:29:22 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
*
@@ -20,6 +20,9 @@
#define PPP_ADDRESS 0xff /* The address byte value */
#define PPP_CONTROL 0x03 /* The control byte value */
+#define PPP_WITHDIRECTION_IN 0x00 /* non-standard for DLT_PPP_WITHDIRECTION */
+#define PPP_WITHDIRECTION_OUT 0x01 /* non-standard for DLT_PPP_WITHDIRECTION */
+
/* Protocol numbers */
#define PPP_IP 0x0021 /* Raw IP */
#define PPP_OSI 0x0023 /* OSI Network Layer */
@@ -32,6 +35,7 @@
#define PPP_BRPDU 0x0031 /* Bridging PDU */
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
#define PPP_VINES 0x0035 /* Banyan Vines */
+#define PPP_ML 0x003d /* Multi-Link PPP */
#define PPP_IPV6 0x0057 /* IPv6 */
#define PPP_COMP 0x00fd /* Compressed Datagram */
@@ -60,7 +64,7 @@
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */
#define PPP_BACP 0xc02b /* Bandwidth Allocation Control Protocol */
#define PPP_BAP 0xc02d /* BAP */
-#define PPP_MP 0xc03d /* Multi-Link */
+#define PPP_MPCP 0xc03d /* Multi-Link */
#define PPP_SPAP_OLD 0xc123
#define PPP_EAP 0xc227
diff --git a/contrib/tcpdump/print-802_11.c b/contrib/tcpdump/print-802_11.c
index 56462c9448c4..c4c0ac8b1376 100644
--- a/contrib/tcpdump/print-802_11.c
+++ b/contrib/tcpdump/print-802_11.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.22.2.6 2003/12/10 09:52:33 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31 2004/11/04 07:35:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -41,15 +41,20 @@ static const char rcsid[] _U_ =
#include "extract.h"
+#include "cpack.h"
+
#include "ieee802_11.h"
+#include "ieee802_11_radio.h"
+#define PRINT_RATE(_sep, _r, _suf) \
+ printf("%s%2.1f%s", _sep, (.5 * ((_r) & 0x7f)), _suf)
#define PRINT_RATES(p) \
do { \
int z; \
const char *sep = " ["; \
for (z = 0; z < p.rates.length ; z++) { \
- printf("%s%2.1f", sep, (.5 * (p.rates.rate[z] & 0x7f))); \
- if (p.rates.rate[z] & 0x80) printf("*"); \
+ PRINT_RATE(sep, p.rates.rate[z], \
+ (p.rates.rate[z] & 0x80 ? "*" : "")); \
sep = " "; \
} \
if (p.rates.length != 0) \
@@ -910,7 +915,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
/*
* This is the top level routine of the printer. 'p' points
* to the 802.11 header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
@@ -919,9 +924,201 @@ ieee802_11_if_print(const struct pcap_pkthdr *h, const u_char *p)
return ieee802_11_print(p, h->len, h->caplen);
}
+static int
+print_radiotap_field(struct cpack_state *s, u_int32_t bit)
+{
+ union {
+ int8_t i8;
+ u_int8_t u8;
+ int16_t i16;
+ u_int16_t u16;
+ u_int32_t u32;
+ u_int64_t u64;
+ } u, u2;
+ int rc;
+
+ switch (bit) {
+ case IEEE80211_RADIOTAP_FLAGS:
+ case IEEE80211_RADIOTAP_RATE:
+ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
+ case IEEE80211_RADIOTAP_DB_ANTNOISE:
+ case IEEE80211_RADIOTAP_ANTENNA:
+ rc = cpack_uint8(s, &u.u8);
+ break;
+ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
+ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
+ rc = cpack_int8(s, &u.i8);
+ break;
+ case IEEE80211_RADIOTAP_CHANNEL:
+ rc = cpack_uint16(s, &u.u16);
+ if (rc != 0)
+ break;
+ rc = cpack_uint16(s, &u2.u16);
+ break;
+ case IEEE80211_RADIOTAP_FHSS:
+ case IEEE80211_RADIOTAP_LOCK_QUALITY:
+ case IEEE80211_RADIOTAP_TX_ATTENUATION:
+ rc = cpack_uint16(s, &u.u16);
+ break;
+ case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
+ rc = cpack_uint8(s, &u.u8);
+ break;
+ case IEEE80211_RADIOTAP_DBM_TX_POWER:
+ rc = cpack_int8(s, &u.i8);
+ break;
+ case IEEE80211_RADIOTAP_TSFT:
+ rc = cpack_uint64(s, &u.u64);
+ break;
+ default:
+ /* this bit indicates a field whose
+ * size we do not know, so we cannot
+ * proceed.
+ */
+ printf("[0x%08x] ", bit);
+ return -1;
+ }
+
+ if (rc != 0) {
+ printf("[|802.11]");
+ return rc;
+ }
+
+ switch (bit) {
+ case IEEE80211_RADIOTAP_CHANNEL:
+ printf("%u MHz ", u.u16);
+ if (u2.u16 != 0)
+ printf("(0x%04x) ", u2.u16);
+ break;
+ case IEEE80211_RADIOTAP_FHSS:
+ printf("fhset %d fhpat %d ", u.u16 & 0xff, (u.u16 >> 8) & 0xff);
+ break;
+ case IEEE80211_RADIOTAP_RATE:
+ PRINT_RATE("", u.u8, " Mb/s ");
+ break;
+ case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
+ printf("%ddB signal ", u.i8);
+ break;
+ case IEEE80211_RADIOTAP_DBM_ANTNOISE:
+ printf("%ddB noise ", u.i8);
+ break;
+ case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
+ printf("%ddB signal ", u.u8);
+ break;
+ case IEEE80211_RADIOTAP_DB_ANTNOISE:
+ printf("%ddB noise ", u.u8);
+ break;
+ case IEEE80211_RADIOTAP_LOCK_QUALITY:
+ printf("%u sq ", u.u16);
+ break;
+ case IEEE80211_RADIOTAP_TX_ATTENUATION:
+ printf("%d tx power ", -(int)u.u16);
+ break;
+ case IEEE80211_RADIOTAP_DB_TX_ATTENUATION:
+ printf("%ddB tx power ", -(int)u.u8);
+ break;
+ case IEEE80211_RADIOTAP_DBM_TX_POWER:
+ printf("%ddBm tx power ", u.i8);
+ break;
+ case IEEE80211_RADIOTAP_FLAGS:
+ if (u.u8 & IEEE80211_RADIOTAP_F_CFP)
+ printf("cfp ");
+ if (u.u8 & IEEE80211_RADIOTAP_F_SHORTPRE)
+ printf("short preamble ");
+ if (u.u8 & IEEE80211_RADIOTAP_F_WEP)
+ printf("wep ");
+ if (u.u8 & IEEE80211_RADIOTAP_F_FRAG)
+ printf("fragmented ");
+ break;
+ case IEEE80211_RADIOTAP_ANTENNA:
+ printf("antenna %d ", u.u8);
+ break;
+ case IEEE80211_RADIOTAP_TSFT:
+ printf("%" PRIu64 "us tsft ", u.u64);
+ break;
+ }
+ return 0;
+}
+
static u_int
ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
{
+#define BITNO_32(x) (((x) >> 16) ? 16 + BITNO_16((x) >> 16) : BITNO_16((x)))
+#define BITNO_16(x) (((x) >> 8) ? 8 + BITNO_8((x) >> 8) : BITNO_8((x)))
+#define BITNO_8(x) (((x) >> 4) ? 4 + BITNO_4((x) >> 4) : BITNO_4((x)))
+#define BITNO_4(x) (((x) >> 2) ? 2 + BITNO_2((x) >> 2) : BITNO_2((x)))
+#define BITNO_2(x) (((x) & 2) ? 1 : 0)
+#define BIT(n) (1 << n)
+#define IS_EXTENDED(__p) \
+ (EXTRACT_LE_32BITS(__p) & BIT(IEEE80211_RADIOTAP_EXT)) != 0
+
+ struct cpack_state cpacker;
+ struct ieee80211_radiotap_header *hdr;
+ u_int32_t present, next_present;
+ u_int32_t *presentp, *last_presentp;
+ enum ieee80211_radiotap_type bit;
+ int bit0;
+ const u_char *iter;
+ u_int len;
+
+ if (caplen < sizeof(*hdr)) {
+ printf("[|802.11]");
+ return caplen;
+ }
+
+ hdr = (struct ieee80211_radiotap_header *)p;
+
+ len = EXTRACT_LE_16BITS(&hdr->it_len);
+
+ if (caplen < len) {
+ printf("[|802.11]");
+ return caplen;
+ }
+ for (last_presentp = &hdr->it_present;
+ IS_EXTENDED(last_presentp) &&
+ (u_char*)(last_presentp + 1) <= p + len;
+ last_presentp++);
+
+ /* are there more bitmap extensions than bytes in header? */
+ if (IS_EXTENDED(last_presentp)) {
+ printf("[|802.11]");
+ return caplen;
+ }
+
+ iter = (u_char*)(last_presentp + 1);
+
+ if (cpack_init(&cpacker, (u_int8_t*)iter, len - (iter - p)) != 0) {
+ /* XXX */
+ printf("[|802.11]");
+ return caplen;
+ }
+
+ for (bit0 = 0, presentp = &hdr->it_present; presentp <= last_presentp;
+ presentp++, bit0 += 32) {
+ for (present = EXTRACT_LE_32BITS(presentp); present;
+ present = next_present) {
+ /* clear the least significant bit that is set */
+ next_present = present & (present - 1);
+
+ /* extract the least significant bit that is set */
+ bit = bit0 + BITNO_32(present ^ next_present);
+
+ if (print_radiotap_field(&cpacker, bit) != 0)
+ goto out;
+ }
+ }
+out:
+ return len + ieee802_11_print(p + len, length - len, caplen - len);
+#undef BITNO_32
+#undef BITNO_16
+#undef BITNO_8
+#undef BITNO_4
+#undef BITNO_2
+#undef BIT
+}
+
+static u_int
+ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
+{
u_int32_t caphdr_len;
caphdr_len = EXTRACT_32BITS(p + 4);
@@ -972,7 +1169,7 @@ prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
}
if (EXTRACT_32BITS(p) == WLANCAP_MAGIC_COOKIE_V1)
- return ieee802_11_radio_print(p, length, caplen);
+ return ieee802_11_avs_radio_print(p, length, caplen);
if (caplen < PRISM_HDR_LEN) {
printf("[|802.11]");
diff --git a/contrib/tcpdump/print-ah.c b/contrib/tcpdump/print-ah.c
index 4094c2598487..92ed9094d72d 100644
--- a/contrib/tcpdump/print-ah.c
+++ b/contrib/tcpdump/print-ah.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.19.2.3 2003/11/19 00:35:43 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
diff --git a/contrib/tcpdump/print-aodv.c b/contrib/tcpdump/print-aodv.c
index 099e3554f6c9..80a547dd305f 100644
--- a/contrib/tcpdump/print-aodv.c
+++ b/contrib/tcpdump/print-aodv.c
@@ -32,7 +32,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-aodv.c,v 1.8.2.3 2004/03/24 00:30:41 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
diff --git a/contrib/tcpdump/print-ap1394.c b/contrib/tcpdump/print-ap1394.c
index 8c074561778e..8cfbba63a11b 100644
--- a/contrib/tcpdump/print-ap1394.c
+++ b/contrib/tcpdump/print-ap1394.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.1.2.1 2004/03/17 22:15:53 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ap1394.c,v 1.3 2004/03/17 23:24:35 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -77,7 +77,7 @@ ap1394_hdr_print(register const u_char *bp, u_int length)
/*
* This is the top level routine of the printer. 'p' points
* to the ether header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
diff --git a/contrib/tcpdump/print-arcnet.c b/contrib/tcpdump/print-arcnet.c
index 32bb161ad101..63f9c215d7ac 100644
--- a/contrib/tcpdump/print-arcnet.c
+++ b/contrib/tcpdump/print-arcnet.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.15.2.2 2003/11/16 08:51:09 guy 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
@@ -103,7 +103,7 @@ arcnet_print(const u_char *bp, u_int length, int phds, int flag, u_int seqid)
/*
* This is the top level routine of the printer. 'p' points
* to the ARCNET header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
@@ -187,7 +187,7 @@ arcnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
/*
* This is the top level routine of the printer. 'p' points
* to the ARCNET header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured. It is quite similar
* to the non-Linux style printer except that Linux doesn't ever
* supply packets that look like exception frames, it always supplies
@@ -259,7 +259,7 @@ arcnet_encap_print(u_char arctype, const u_char *p,
case ARCTYPE_IP_OLD:
case ARCTYPE_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
return (1);
#ifdef INET6
@@ -271,7 +271,7 @@ arcnet_encap_print(u_char arctype, const u_char *p,
case ARCTYPE_ARP_OLD:
case ARCTYPE_ARP:
case ARCTYPE_REVARP:
- arp_print(p, length, caplen);
+ arp_print(gndo, p, length, caplen);
return (1);
case ARCTYPE_ATALK: /* XXX was this ever used? */
@@ -288,3 +288,10 @@ arcnet_encap_print(u_char arctype, const u_char *p,
return (0);
}
}
+
+/*
+ * Local Variables:
+ * c-style: bsd
+ * End:
+ */
+
diff --git a/contrib/tcpdump/print-arp.c b/contrib/tcpdump/print-arp.c
index da8e79960d7d..68e9dc6894c7 100644
--- a/contrib/tcpdump/print-arp.c
+++ b/contrib/tcpdump/print-arp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.61.2.2 2003/11/16 08:51:10 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.64 2004/04/30 16:42:14 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -33,7 +33,7 @@ static const char rcsid[] _U_ =
#include <stdio.h>
#include <string.h>
-#include "interface.h"
+#include "netdissect.h"
#include "addrtoname.h"
#include "ether.h"
#include "ethertype.h"
@@ -158,173 +158,184 @@ struct atmarp_pkthdr {
static u_char ezero[6];
static void
-atmarp_addr_print(const u_char *ha, u_int ha_len, const u_char *srca,
+atmarp_addr_print(netdissect_options *ndo,
+ const u_char *ha, u_int ha_len, const u_char *srca,
u_int srca_len)
{
if (ha_len == 0)
- (void)printf("<No address>");
+ ND_PRINT((ndo, "<No address>"));
else {
- (void)printf("%s", linkaddr_string(ha, ha_len));
- if (srca_len != 0)
- (void)printf(",%s", linkaddr_string(srca, srca_len));
+ ND_PRINT((ndo, "%s", linkaddr_string(ha, ha_len)));
+ if (srca_len != 0)
+ ND_PRINT((ndo, ",%s",
+ linkaddr_string(srca, srca_len)));
}
}
static void
-atmarp_print(const u_char *bp, u_int length, u_int caplen)
+atmarp_print(netdissect_options *ndo,
+ const u_char *bp, u_int length, u_int caplen)
{
const struct atmarp_pkthdr *ap;
u_short pro, hrd, op;
ap = (const struct atmarp_pkthdr *)bp;
- TCHECK(*ap);
+ ND_TCHECK(*ap);
hrd = ATMHRD(ap);
pro = ATMPRO(ap);
op = ATMOP(ap);
- if (!TTEST2(*aar_tpa(ap), ATMTPLN(ap))) {
- (void)printf("truncated-atmarp");
- default_print((const u_char *)ap, length);
+ if (!ND_TTEST2(*aar_tpa(ap), ATMTPLN(ap))) {
+ ND_PRINT((ndo, "truncated-atmarp"));
+ ND_DEFAULTPRINT((const u_char *)ap, length);
return;
}
if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
ATMSPLN(ap) != 4 || ATMTPLN(ap) != 4) {
- (void)printf("atmarp-#%d for proto #%d (%d/%d) hardware #%d",
- op, pro, ATMSPLN(ap), ATMTPLN(ap), hrd);
+ ND_PRINT((ndo, "atmarp-#%d for proto #%d (%d/%d) hardware #%d",
+ op, pro, ATMSPLN(ap), ATMTPLN(ap), hrd));
return;
}
if (pro == ETHERTYPE_TRAIL)
- (void)printf("trailer-");
+ ND_PRINT((ndo, "trailer-"));
switch (op) {
case ARPOP_REQUEST:
- (void)printf("arp who-has %s", ipaddr_string(ATMTPA(ap)));
+ ND_PRINT((ndo, "arp who-has %s", ipaddr_string(ATMTPA(ap))));
if (ATMTHLN(ap) != 0) {
- (void)printf(" (");
- atmarp_addr_print(ATMTHA(ap), ATMTHLN(ap),
+ ND_PRINT((ndo, " ("));
+ atmarp_addr_print(ndo, ATMTHA(ap), ATMTHLN(ap),
ATMTSA(ap), ATMTSLN(ap));
- (void)printf(")");
+ ND_PRINT((ndo, ")"));
}
- (void)printf(" tell %s", ipaddr_string(ATMSPA(ap)));
+ ND_PRINT((ndo, " tell %s", ipaddr_string(ATMSPA(ap))));
break;
case ARPOP_REPLY:
- (void)printf("arp reply %s", ipaddr_string(ATMSPA(ap)));
- (void)printf(" is-at ");
- atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
+ 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));
break;
case ARPOP_INVREQUEST:
- (void)printf("invarp who-is ");
- atmarp_addr_print(ATMTHA(ap), ATMTHLN(ap), ATMTSA(ap),
+ ND_PRINT((ndo, "invarp who-is "));
+ atmarp_addr_print(ndo, ATMTHA(ap), ATMTHLN(ap), ATMTSA(ap),
ATMTSLN(ap));
- (void)printf(" tell ");
- atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
+ ND_PRINT((ndo, " tell "));
+ atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
ATMSSLN(ap));
break;
case ARPOP_INVREPLY:
- (void)printf("invarp reply ");
- atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
+ ND_PRINT((ndo, "invarp reply "));
+ atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
ATMSSLN(ap));
- (void)printf(" at %s", ipaddr_string(ATMSPA(ap)));
+ ND_PRINT((ndo, " at %s", ipaddr_string(ATMSPA(ap))));
break;
case ATMARPOP_NAK:
- (void)printf("nak reply for %s",
- ipaddr_string(ATMSPA(ap)));
+ ND_PRINT((ndo, "nak reply for %s",
+ ipaddr_string(ATMSPA(ap))));
break;
default:
- (void)printf("atmarp-#%d", op);
- default_print((const u_char *)ap, caplen);
+ ND_PRINT((ndo, "atmarp-#%d", op));
+ ND_DEFAULTPRINT((const u_char *)ap, caplen);
return;
}
return;
trunc:
- (void)printf("[|atmarp]");
+ ND_PRINT((ndo, "[|atmarp]"));
}
void
-arp_print(const u_char *bp, u_int length, u_int caplen)
+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;
ap = (const struct arp_pkthdr *)bp;
- TCHECK(*ap);
+ ND_TCHECK(*ap);
hrd = HRD(ap);
if (hrd == ARPHRD_ATM2225) {
- atmarp_print(bp, length, caplen);
+ atmarp_print(ndo, bp, length, caplen);
return;
}
pro = PRO(ap);
op = OP(ap);
- if (!TTEST2(*ar_tpa(ap), PLN(ap))) {
- (void)printf("truncated-arp");
- default_print((const u_char *)ap, length);
+ if (!ND_TTEST2(*ar_tpa(ap), PLN(ap))) {
+ ND_PRINT((ndo, "truncated-arp"));
+ ND_DEFAULTPRINT((const u_char *)ap, length);
return;
}
if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
PLN(ap) != 4 || HLN(ap) == 0) {
- (void)printf("arp-#%d for proto #%d (%d) hardware #%d (%d)",
- op, pro, PLN(ap), hrd, HLN(ap));
+ ND_PRINT((ndo, "arp-#%d for proto #%d (%d) hardware #%d (%d)",
+ op, pro, PLN(ap), hrd, HLN(ap)));
return;
}
if (pro == ETHERTYPE_TRAIL)
- (void)printf("trailer-");
+ ND_PRINT((ndo, "trailer-"));
switch (op) {
case ARPOP_REQUEST:
- (void)printf("arp who-has %s", ipaddr_string(TPA(ap)));
+ ND_PRINT((ndo, "arp who-has %s", ipaddr_string(TPA(ap))));
if (memcmp((const char *)ezero, (const char *)THA(ap), HLN(ap)) != 0)
- (void)printf(" (%s)",
- linkaddr_string(THA(ap), HLN(ap)));
- (void)printf(" tell %s", ipaddr_string(SPA(ap)));
+ ND_PRINT((ndo, " (%s)",
+ linkaddr_string(THA(ap), HLN(ap))));
+ ND_PRINT((ndo, " tell %s", ipaddr_string(SPA(ap))));
break;
case ARPOP_REPLY:
- (void)printf("arp reply %s", ipaddr_string(SPA(ap)));
- (void)printf(" is-at %s", linkaddr_string(SHA(ap), HLN(ap)));
+ ND_PRINT((ndo, "arp reply %s", ipaddr_string(SPA(ap))));
+ ND_PRINT((ndo, " is-at %s", linkaddr_string(SHA(ap), HLN(ap))));
break;
case ARPOP_REVREQUEST:
- (void)printf("rarp who-is %s tell %s",
- linkaddr_string(THA(ap), HLN(ap)),
- linkaddr_string(SHA(ap), HLN(ap)));
+ ND_PRINT((ndo, "rarp who-is %s tell %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ linkaddr_string(SHA(ap), HLN(ap))));
break;
case ARPOP_REVREPLY:
- (void)printf("rarp reply %s at %s",
- linkaddr_string(THA(ap), HLN(ap)),
- ipaddr_string(TPA(ap)));
+ ND_PRINT((ndo, "rarp reply %s at %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ ipaddr_string(TPA(ap))));
break;
case ARPOP_INVREQUEST:
- (void)printf("invarp who-is %s tell %s",
- linkaddr_string(THA(ap), HLN(ap)),
- linkaddr_string(SHA(ap), HLN(ap)));
+ ND_PRINT((ndo, "invarp who-is %s tell %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ linkaddr_string(SHA(ap), HLN(ap))));
break;
case ARPOP_INVREPLY:
- (void)printf("invarp reply %s at %s",
- linkaddr_string(THA(ap), HLN(ap)),
- ipaddr_string(TPA(ap)));
+ ND_PRINT((ndo,"invarp reply %s at %s",
+ linkaddr_string(THA(ap), HLN(ap)),
+ ipaddr_string(TPA(ap))));
break;
default:
- (void)printf("arp-#%d", op);
- default_print((const u_char *)ap, caplen);
+ ND_PRINT((ndo, "arp-#%d", op));
+ ND_DEFAULTPRINT((const u_char *)ap, caplen);
return;
}
if (hrd != ARPHRD_ETHER)
- printf(" hardware #%d", hrd);
+ ND_PRINT((ndo, " hardware #%d", hrd));
return;
trunc:
- (void)printf("[|arp]");
+ ND_PRINT((ndo, "[|arp]"));
}
+
+/*
+ * Local Variables:
+ * c-style: bsd
+ * End:
+ */
+
diff --git a/contrib/tcpdump/print-ascii.c b/contrib/tcpdump/print-ascii.c
index b7f868d08631..02be8e0e7f8e 100644
--- a/contrib/tcpdump/print-ascii.c
+++ b/contrib/tcpdump/print-ascii.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.10.2.3 2003/12/29 22:42:20 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.16 2004/07/21 22:00:10 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
#include <stdio.h>
@@ -57,7 +57,7 @@ static const char rcsid[] _U_ =
(HEXDUMP_HEXSTUFF_PER_SHORT * HEXDUMP_SHORTS_PER_LINE)
void
-ascii_print_with_offset(register const u_char *ident, register const u_char *cp, register u_int length,
+ascii_print_with_offset(register const char *ident, register const u_char *cp, register u_int length,
register u_int oset)
{
register u_int i;
@@ -126,7 +126,7 @@ ascii_print_with_offset(register const u_char *ident, register const u_char *cp,
}
void
-ascii_print(register const u_char *ident, register const u_char *cp, register u_int length)
+ascii_print(register const char *ident, register const u_char *cp, register u_int length)
{
ascii_print_with_offset(ident, cp, length, 0);
}
@@ -135,7 +135,7 @@ ascii_print(register const u_char *ident, register const u_char *cp, register u_
* telnet_print() wants this. It is essentially default_print_unaligned()
*/
void
-hex_print_with_offset(register const u_char *ident, register const u_char *cp, register u_int length,
+hex_print_with_offset(register const char *ident, register const u_char *cp, register u_int length,
register u_int oset)
{
register u_int i, s;
@@ -162,7 +162,7 @@ hex_print_with_offset(register const u_char *ident, register const u_char *cp, r
* just for completeness
*/
void
-hex_print(register const u_char *ident, register const u_char *cp, register u_int length)
+hex_print(register const char *ident, register const u_char *cp, register u_int length)
{
hex_print_with_offset(ident, cp, length, 0);
}
diff --git a/contrib/tcpdump/print-atalk.c b/contrib/tcpdump/print-atalk.c
index 30224821f8d0..f1f45a3cb72d 100644
--- a/contrib/tcpdump/print-atalk.c
+++ b/contrib/tcpdump/print-atalk.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.78.2.2 2003/11/16 08:51:11 guy 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
@@ -172,6 +172,9 @@ atalk_print(register const u_char *bp, u_int length)
register const struct atDDP *dp;
u_short snet;
+ if(!eflag)
+ printf("AT ");
+
if (length < ddpSize) {
(void)printf(" [|ddp %d]", length);
return;
@@ -180,7 +183,7 @@ atalk_print(register const u_char *bp, u_int length)
snet = EXTRACT_16BITS(&dp->srcNet);
printf("%s.%s", ataddr_string(snet, dp->srcNode),
ddpskt_string(dp->srcSkt));
- printf(" > %s.%s:",
+ printf(" > %s.%s: ",
ataddr_string(EXTRACT_16BITS(&dp->dstNet), dp->dstNode),
ddpskt_string(dp->dstSkt));
bp += ddpSize;
@@ -241,6 +244,10 @@ ddp_print(register const u_char *bp, register u_int length, register int t,
atp_print((const struct atATP *)bp, length);
break;
+ case ddpEIGRP:
+ eigrp_print(bp, length);
+ break;
+
default:
(void)printf(" at-%s %d", tok2str(type2str, NULL, t), length);
break;
diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c
index a6cfa11e111d..1e2d0c5926ee 100644
--- a/contrib/tcpdump/print-atm.c
+++ b/contrib/tcpdump/print-atm.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.33.2.2 2003/11/16 08:51:11 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38 2005/01/19 16:46:27 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -43,6 +43,54 @@ static const char rcsid[] _U_ =
#include "ether.h"
+struct tok oam_celltype_values[] = {
+ { 0x1, "Fault Management" },
+ { 0x2, "Performance Management" },
+ { 0x8, "activate/deactivate" },
+ { 0xf, "System Management" },
+ { 0, NULL }
+};
+
+struct tok oam_fm_functype_values[] = {
+ { 0x0, "AIS" },
+ { 0x1, "RDI" },
+ { 0x4, "Continuity Check" },
+ { 0x8, "Loopback" },
+ { 0, NULL }
+};
+
+struct tok oam_pm_functype_values[] = {
+ { 0x0, "Forward Monitoring" },
+ { 0x1, "Backward Reporting" },
+ { 0x2, "Monitoring and Reporting" },
+ { 0, NULL }
+};
+
+struct tok oam_ad_functype_values[] = {
+ { 0x0, "Performance Monitoring" },
+ { 0x1, "Continuity Check" },
+ { 0, NULL }
+};
+
+static const struct tok *oam_functype_values[16] = {
+ NULL,
+ oam_fm_functype_values, /* 1 */
+ oam_pm_functype_values, /* 2 */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ oam_ad_functype_values, /* 8 */
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
/*
* Print an RFC 1483 LLC-encapsulated ATM frame.
*/
@@ -72,7 +120,7 @@ atm_llc_print(const u_char *p, int length, int caplen)
/*
* This is the top level routine of the printer. 'p' points
* to the LLC/SNAP header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
@@ -207,12 +255,9 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
printf("broadcast sig: ");
return;
- case OAMF4SC:
- printf("oamF4(segment): ");
- return;
-
+ case OAMF4SC: /* fall through */
case OAMF4EC:
- printf("oamF4(end): ");
+ oam_print(p, length);
return;
case METAC:
@@ -241,3 +286,47 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
break;
}
}
+
+int
+oam_print (const u_char *p, u_int length) {
+
+ u_int16_t cell_header, cell_type, func_type,vpi,vci,payload,clp;
+
+ cell_header = EXTRACT_32BITS(p);
+ cell_type = ((*(p+4))>>4) & 0x0f;
+ func_type = *(p) & 0x0f;
+
+ vpi = (cell_header>>20)&0xff;
+ vci = (cell_header>>4)&0xffff;
+ payload = (cell_header>>1)&0x7;
+ clp = cell_header&0x1;
+
+ switch (vci) {
+ case OAMF4SC:
+ printf("OAM F4 (segment), ");
+ break;
+ case OAMF4EC:
+ printf("OAM F4 (end), ");
+ break;
+ default:
+ printf("OAM F5, ");
+ break;
+ }
+
+ if (eflag)
+ printf("vpi %u, vci %u, payload %u, clp %u, ",vpi,vci,payload,clp);
+
+ printf("cell-type %s (%u)",
+ tok2str(oam_celltype_values, "unknown", cell_type),
+ cell_type);
+
+ if (oam_functype_values[cell_type] == NULL)
+ printf(", func-type unknown (%u)", func_type);
+ else
+ printf(", func-type %s (%u)",
+ bittok2str(oam_functype_values[cell_type],"none",func_type),
+ func_type);
+
+ printf(", length %u",length);
+ return 1;
+}
diff --git a/contrib/tcpdump/print-beep.c b/contrib/tcpdump/print-beep.c
index b566254670a2..db40d611245a 100644
--- a/contrib/tcpdump/print-beep.c
+++ b/contrib/tcpdump/print-beep.c
@@ -11,7 +11,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.4.2.2 2003/11/16 08:51:12 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
diff --git a/contrib/tcpdump/print-bfd.c b/contrib/tcpdump/print-bfd.c
index 2c6aec40290c..485dde8a45d9 100644
--- a/contrib/tcpdump/print-bfd.c
+++ b/contrib/tcpdump/print-bfd.c
@@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bfd.c,v 1.3.2.2 2003/11/16 08:51:12 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bfd.c,v 1.5 2003/11/16 09:36:14 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-bgp.c b/contrib/tcpdump/print-bgp.c
index bfa472a83fa7..135ffe399c8e 100644
--- a/contrib/tcpdump/print-bgp.c
+++ b/contrib/tcpdump/print-bgp.c
@@ -36,7 +36,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.72.2.4 2004/03/24 00:04:04 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.91 2005/03/27 01:31:25 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -45,8 +45,11 @@ static const char rcsid[] _U_ =
#include <string.h>
#include "interface.h"
+#include "decode_prefix.h"
#include "addrtoname.h"
#include "extract.h"
+#include "bgp.h"
+#include "l2vpn.h"
struct bgp {
u_int8_t bgp_marker[16];
@@ -90,6 +93,8 @@ struct bgp_opt {
};
#define BGP_OPT_SIZE 2 /* some compilers may pad to 4 bytes */
+#define BGP_UPDATE_MINSIZE 23
+
struct bgp_notification {
u_int8_t bgpn_marker[16];
u_int16_t bgpn_len;
@@ -139,6 +144,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_ATTR_SET 128 /* draft-marques-ppvpn-ibgp */
+
+#define BGP_MP_NLRI_MINSIZE 3 /* End of RIB Marker detection */
static struct tok bgp_attr_values[] = {
{ BGPTYPE_ORIGIN, "Origin"},
@@ -157,6 +165,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_ATTR_SET, "Attribute Set"},
{ 255, "Reserved for development"},
{ 0, NULL}
};
@@ -194,13 +203,19 @@ static struct tok bgp_opt_values[] = {
#define BGP_CAPCODE_MP 1
#define BGP_CAPCODE_RR 2
+#define BGP_CAPCODE_ORF 3 /* XXX */
#define BGP_CAPCODE_RESTART 64 /* draft-ietf-idr-restart-05 */
+#define BGP_CAPCODE_AS_NEW 65 /* XXX */
+#define BGP_CAPCODE_DYN_CAP 67 /* XXX */
#define BGP_CAPCODE_RR_CISCO 128
static struct tok bgp_capcode_values[] = {
{ BGP_CAPCODE_MP, "Multiprotocol Extensions"},
{ BGP_CAPCODE_RR, "Route Refresh"},
+ { BGP_CAPCODE_ORF, "Cooperative Route Filtering"},
{ BGP_CAPCODE_RESTART, "Graceful Restart"},
+ { BGP_CAPCODE_AS_NEW, "32-Bit AS Number"},
+ { BGP_CAPCODE_DYN_CAP, "Dynamic Capability"},
{ BGP_CAPCODE_RR_CISCO, "Route Refresh (Cisco)"},
{ 0, NULL}
};
@@ -291,6 +306,9 @@ static struct tok bgp_origin_values[] = {
#define SAFNUM_UNIMULTICAST 3
/* labeled BGP RFC3107 */
#define SAFNUM_LABUNICAST 4
+#define SAFNUM_TUNNEL 64 /* XXX */
+#define SAFNUM_VPLS 65 /* XXX */
+#define SAFNUM_MDT 66 /* XXX */
/* Section 4.3.4 of draft-rosen-rfc2547bis-03.txt */
#define SAFNUM_VPNUNICAST 128
#define SAFNUM_VPNMULTICAST 129
@@ -306,10 +324,13 @@ static struct tok bgp_safi_values[] = {
{ SAFNUM_MULTICAST, "Multicast"},
{ SAFNUM_UNIMULTICAST, "Unicast+Multicast"},
{ SAFNUM_LABUNICAST, "labeled Unicast"},
+ { SAFNUM_TUNNEL, "Tunnel"},
+ { SAFNUM_VPLS, "VPLS"},
+ { SAFNUM_MDT, "MDT"},
{ SAFNUM_VPNUNICAST, "labeled VPN Unicast"},
{ SAFNUM_VPNMULTICAST, "labeled VPN Multicast"},
{ SAFNUM_VPNUNIMULTICAST, "labeled VPN Unicast+Multicast"},
- { SAFNUM_RT_ROUTING_INFO, "Route Target Routing Information"},
+ { SAFNUM_RT_ROUTING_INFO, "Route Target Routing Information"}, /* draft-marques-ppvpn-rt-constrain-01.txt */
{ 0, NULL }
};
@@ -367,6 +388,7 @@ static struct tok bgp_afi_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 */
@@ -395,6 +417,7 @@ 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"},
@@ -426,25 +449,7 @@ static struct tok bgp_extd_comm_ospf_rtype_values[] = {
{ 0, NULL },
};
-static struct tok bgp_l2vpn_encaps_values[] = {
- { 0, "Reserved"},
- { 1, "Frame Relay"},
- { 2, "ATM AAL5 VCC transport"},
- { 3, "ATM transparent cell transport"},
- { 4, "Ethernet VLAN"},
- { 5, "Ethernet"},
- { 6, "Cisco-HDLC"},
- { 7, "PPP"},
- { 8, "CEM"},
- { 9, "ATM VCC cell transport"},
- { 10, "ATM VPC cell transport"},
- { 11, "MPLS"},
- { 12, "VPLS"},
- { 64, "IP-interworking"},
- { 0, NULL},
-};
-
-static int
+int
decode_prefix4(const u_char *pptr, char *buf, u_int buflen)
{
struct in_addr addr;
@@ -514,13 +519,11 @@ trunc:
/* RDs and RTs share the same semantics
* we use bgp_vpn_rd_print for
* printing route targets inside a NLRI */
-static char *
+char *
bgp_vpn_rd_print (const u_char *pptr) {
- /* allocate space for the following string
- * xxx.xxx.xxx.xxx:xxxxx
- * 21 bytes plus one termination byte */
- static char rd[22];
+ /* allocate space for the largest possible string */
+ static char rd[sizeof("xxxxxxxxxx:xxxxx (xxx.xxx.xxx.xxx:xxxxx)")];
char *pos = rd;
/* ok lets load the RD format */
@@ -540,8 +543,9 @@ bgp_vpn_rd_print (const u_char *pptr) {
/* 4-byte-AS:number fmt*/
case 2:
- snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u",
- EXTRACT_32BITS(pptr+2), EXTRACT_16BITS(pptr+6));
+ snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (%u.%u.%u.%u:%u)",
+ EXTRACT_32BITS(pptr+2), EXTRACT_16BITS(pptr+6),
+ *(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5), EXTRACT_16BITS(pptr+6));
break;
default:
snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format");
@@ -673,7 +677,7 @@ trunc:
}
#ifdef INET6
-static int
+int
decode_prefix6(const u_char *pd, char *buf, u_int buflen)
{
struct in6_addr addr;
@@ -768,6 +772,74 @@ trunc:
#endif
static int
+decode_labeled_clnp_prefix(const u_char *pptr, char *buf, u_int buflen)
+{
+ u_int8_t addr[19];
+ u_int plen;
+
+ TCHECK(pptr[0]);
+ plen = pptr[0]; /* get prefix length */
+ plen-=24; /* adjust prefixlen - labellength */
+
+ if (152 < plen)
+ return -1;
+
+ memset(&addr, 0, sizeof(addr));
+ TCHECK2(pptr[4], (plen + 7) / 8);
+ memcpy(&addr, &pptr[4], (plen + 7) / 8);
+ if (plen % 8) {
+ addr[(plen + 7) / 8 - 1] &=
+ ((0xff00 >> (plen % 8)) & 0xff);
+ }
+ /* the label may get offsetted by 4 bits so lets shift it right */
+ snprintf(buf, buflen, "%s/%d, label:%u %s",
+ isonsap_string(addr,(plen + 7) / 8 - 1),
+ plen,
+ EXTRACT_24BITS(pptr+1)>>4,
+ ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
+
+ return 4 + (plen + 7) / 8;
+
+trunc:
+ return -2;
+}
+
+static int
+decode_labeled_vpn_clnp_prefix(const u_char *pptr, char *buf, u_int buflen)
+{
+ u_int8_t addr[19];
+ u_int plen;
+
+ TCHECK(pptr[0]);
+ plen = pptr[0]; /* get prefix length */
+
+ plen-=(24+64); /* adjust prefixlen - labellength - RD len*/
+
+ if (152 < plen)
+ return -1;
+
+ memset(&addr, 0, sizeof(addr));
+ TCHECK2(pptr[12], (plen + 7) / 8);
+ memcpy(&addr, &pptr[12], (plen + 7) / 8);
+ if (plen % 8) {
+ addr[(plen + 7) / 8 - 1] &=
+ ((0xff00 >> (plen % 8)) & 0xff);
+ }
+ /* the label may get offsetted by 4 bits so lets shift it right */
+ snprintf(buf, buflen, "RD: %s, %s/%d, label:%u %s",
+ bgp_vpn_rd_print(pptr+4),
+ isonsap_string(addr,(plen + 7) / 8 - 1),
+ plen,
+ EXTRACT_24BITS(pptr+1)>>4,
+ ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
+
+ return 12 + (plen + 7) / 8;
+
+trunc:
+ return -2;
+}
+
+static int
bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
{
int i;
@@ -781,6 +853,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
int tlen;
const u_char *tptr;
char buf[MAXHOSTNAMELEN + 100];
+ char tokbuf[TOKBUFSIZE];
tptr = pptr;
tlen=len;
@@ -791,9 +864,13 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
printf("invalid len");
else {
TCHECK(*tptr);
- printf("%s", tok2str(bgp_origin_values, "Unknown Origin Typecode", tptr[0]));
+ printf("%s", tok2strbuf(bgp_origin_values,
+ "Unknown Origin Typecode",
+ tptr[0],
+ tokbuf, sizeof(tokbuf)));
}
break;
+
case BGPTYPE_AS_PATH:
if (len % 2) {
printf("invalid len");
@@ -806,13 +883,17 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
while (tptr < pptr + len) {
TCHECK(tptr[0]);
- printf("%s", tok2str(bgp_as_path_segment_open_values, "?", 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]));
}
TCHECK(tptr[0]);
- printf("%s", tok2str(bgp_as_path_segment_close_values, "?", tptr[0]));
+ printf("%s", tok2strbuf(bgp_as_path_segment_close_values,
+ "?", tptr[0],
+ tokbuf, sizeof(tokbuf)));
TCHECK(tptr[1]);
tptr += 2 + tptr[1] * 2;
}
@@ -905,22 +986,48 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
safi = tptr[2];
printf("\n\t AFI: %s (%u), %sSAFI: %s (%u)",
- tok2str(bgp_afi_values, "Unknown AFI", af),
+ tok2strbuf(bgp_afi_values, "Unknown AFI", af,
+ tokbuf, sizeof(tokbuf)),
af,
(safi>128) ? "vendor specific " : "", /* 128 is meanwhile wellknown */
- tok2str(bgp_safi_values, "Unknown SAFI", safi),
+ tok2strbuf(bgp_safi_values, "Unknown SAFI", safi,
+ tokbuf, sizeof(tokbuf)),
safi);
- if (af == AFNUM_INET || af==AFNUM_L2VPN)
- ;
+ switch(af<<8 | safi) {
+ case (AFNUM_INET<<8 | SAFNUM_UNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_MULTICAST):
+ 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_VPNUNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST):
#ifdef INET6
- else if (af == AFNUM_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):
#endif
- else {
- printf("\n\t no AFI %u decoder",af);
+ case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST):
+ break;
+ default:
+ printf("\n\t no AFI %u / SAFI %u decoder",af,safi);
if (vflag <= 1)
print_unknown_data(tptr,"\n\t ",tlen);
+ goto done;
break;
}
@@ -931,131 +1038,127 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
tptr++;
if (tlen) {
- printf("\n\t nexthop: ");
- while (tlen > 0) {
- switch (af) {
- case AFNUM_INET:
- switch(safi) {
- case SAFNUM_UNICAST:
- case SAFNUM_MULTICAST:
- case SAFNUM_UNIMULTICAST:
- case SAFNUM_LABUNICAST:
- case SAFNUM_RT_ROUTING_INFO:
- if (tlen < (int)sizeof(struct in_addr)) {
- printf("invalid len");
- tlen = 0;
- } else {
- TCHECK2(tptr[0], sizeof(struct in_addr));
- printf("%s",getname(tptr));
- tlen -= sizeof(struct in_addr);
- tptr += sizeof(struct in_addr);
- }
- break;
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- if (tlen < (int)(sizeof(struct in_addr)+BGP_VPN_RD_LEN)) {
- printf("invalid len");
- tlen = 0;
- } else {
- TCHECK2(tptr[0], sizeof(struct in_addr)+BGP_VPN_RD_LEN);
- printf("RD: %s, %s",
- bgp_vpn_rd_print(tptr),
- getname(tptr+BGP_VPN_RD_LEN));
- tlen -= (sizeof(struct in_addr)+BGP_VPN_RD_LEN);
- tptr += (sizeof(struct in_addr)+BGP_VPN_RD_LEN);
- }
- break;
- default:
- TCHECK2(tptr[0], tlen);
- printf("no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr,"\n\t ",tlen);
- tptr += tlen;
- tlen = 0;
- break;
- }
- break;
+ printf("\n\t nexthop: ");
+ while (tlen > 0) {
+ switch(af<<8 | safi) {
+ case (AFNUM_INET<<8 | SAFNUM_UNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_LABUNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_RT_ROUTING_INFO):
+ if (tlen < (int)sizeof(struct in_addr)) {
+ printf("invalid len");
+ tlen = 0;
+ } else {
+ TCHECK2(tptr[0], sizeof(struct in_addr));
+ printf("%s",getname(tptr));
+ tlen -= sizeof(struct in_addr);
+ tptr += sizeof(struct in_addr);
+ }
+ break;
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST):
+ if (tlen < (int)(sizeof(struct in_addr)+BGP_VPN_RD_LEN)) {
+ printf("invalid len");
+ tlen = 0;
+ } else {
+ TCHECK2(tptr[0], sizeof(struct in_addr)+BGP_VPN_RD_LEN);
+ printf("RD: %s, %s",
+ bgp_vpn_rd_print(tptr),
+ getname(tptr+BGP_VPN_RD_LEN));
+ tlen -= (sizeof(struct in_addr)+BGP_VPN_RD_LEN);
+ tptr += (sizeof(struct in_addr)+BGP_VPN_RD_LEN);
+ }
+ break;
#ifdef INET6
- case AFNUM_INET6:
- switch(safi) {
- case SAFNUM_UNICAST:
- case SAFNUM_MULTICAST:
- case SAFNUM_UNIMULTICAST:
- case SAFNUM_LABUNICAST:
- case SAFNUM_RT_ROUTING_INFO:
- if (tlen < (int)sizeof(struct in6_addr)) {
- printf("invalid len");
- tlen = 0;
- } else {
- TCHECK2(tptr[0], sizeof(struct in6_addr));
- printf("%s", getname6(tptr));
- tlen -= sizeof(struct in6_addr);
- tptr += sizeof(struct in6_addr);
- }
- break;
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- if (tlen < (int)(sizeof(struct in6_addr)+BGP_VPN_RD_LEN)) {
- printf("invalid len");
- tlen = 0;
- } else {
- TCHECK2(tptr[0], sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
- printf("RD: %s, %s",
- bgp_vpn_rd_print(tptr),
- getname6(tptr+BGP_VPN_RD_LEN));
- tlen -= (sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
- tptr += (sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
- }
- break;
- default:
- TCHECK2(tptr[0], tlen);
- printf("no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr,"\n\t ",tlen);
- tptr += tlen;
- tlen = 0;
- break;
- }
- break;
+ 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):
+ if (tlen < (int)sizeof(struct in6_addr)) {
+ printf("invalid len");
+ tlen = 0;
+ } else {
+ TCHECK2(tptr[0], sizeof(struct in6_addr));
+ printf("%s", getname6(tptr));
+ tlen -= sizeof(struct in6_addr);
+ tptr += sizeof(struct in6_addr);
+ }
+ break;
+ case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST):
+ if (tlen < (int)(sizeof(struct in6_addr)+BGP_VPN_RD_LEN)) {
+ printf("invalid len");
+ tlen = 0;
+ } else {
+ TCHECK2(tptr[0], sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
+ printf("RD: %s, %s",
+ bgp_vpn_rd_print(tptr),
+ getname6(tptr+BGP_VPN_RD_LEN));
+ tlen -= (sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
+ tptr += (sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
+ }
+ break;
#endif
- case AFNUM_L2VPN:
- switch(safi) {
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- if (tlen < (int)sizeof(struct in_addr)) {
- printf("invalid len");
- tlen = 0;
- } else {
- TCHECK2(tptr[0], sizeof(struct in_addr));
- printf("%s", getname(tptr));
- tlen -= (sizeof(struct in_addr));
- tptr += (sizeof(struct in_addr));
- }
- break;
- default:
- TCHECK2(tptr[0], tlen);
- printf("no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr,"\n\t ",tlen);
- tptr += tlen;
- tlen = 0;
- break;
- }
- break;
-
- default:
- TCHECK2(tptr[0], tlen);
- printf("no AFI %u decoder",af);
- if (vflag <= 1)
- print_unknown_data(tptr,"\n\t ",tlen);
- tptr += tlen;
- tlen = 0;
- break;
- }
- }
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST):
+ if (tlen < (int)sizeof(struct in_addr)) {
+ printf("invalid len");
+ tlen = 0;
+ } else {
+ TCHECK2(tptr[0], sizeof(struct in_addr));
+ printf("%s", getname(tptr));
+ tlen -= (sizeof(struct in_addr));
+ tptr += (sizeof(struct in_addr));
+ }
+ break;
+ case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
+ TCHECK2(tptr[0], tlen);
+ printf("%s",isonsap_string(tptr,tlen));
+ tptr += tlen;
+ tlen = 0;
+ break;
+
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST):
+ if (tlen < BGP_VPN_RD_LEN+1) {
+ printf("invalid len");
+ tlen = 0;
+ } else {
+ TCHECK2(tptr[0], tlen);
+ printf("RD: %s, %s",
+ bgp_vpn_rd_print(tptr),
+ isonsap_string(tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN));
+ /* rfc986 mapped IPv4 address ? */
+ if (EXTRACT_32BITS(tptr+BGP_VPN_RD_LEN) == 0x47000601)
+ printf(" = %s", getname(tptr+BGP_VPN_RD_LEN+4));
+#ifdef INET6
+ /* rfc1888 mapped IPv6 address ? */
+ else if (EXTRACT_24BITS(tptr+BGP_VPN_RD_LEN) == 0x350000)
+ printf(" = %s", getname6(tptr+BGP_VPN_RD_LEN+3));
+#endif
+ tptr += tlen;
+ tlen = 0;
+ }
+ break;
+ default:
+ TCHECK2(tptr[0], tlen);
+ printf("no AFI %u/SAFI %u decoder",af,safi);
+ if (vflag <= 1)
+ print_unknown_data(tptr,"\n\t ",tlen);
+ tptr += tlen;
+ tlen = 0;
+ goto done;
+ break;
+ }
+ }
}
tptr += tlen;
@@ -1075,292 +1178,267 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
}
while (len - (tptr - pptr) > 0) {
- switch (af) {
- case AFNUM_INET:
- switch (safi) {
- case SAFNUM_UNICAST:
- case SAFNUM_MULTICAST:
- case SAFNUM_UNIMULTICAST:
- advance = decode_prefix4(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;
- case SAFNUM_LABUNICAST:
- advance = decode_labeled_prefix4(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;
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- advance = decode_labeled_vpn_prefix4(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;
- case 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;
- default:
- TCHECK2(*(tptr-3),tlen);
- printf("\n\t no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- break;
+ switch (af<<8 | safi) {
+ case (AFNUM_INET<<8 | SAFNUM_UNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST):
+ advance = decode_prefix4(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;
+ case (AFNUM_INET<<8 | SAFNUM_LABUNICAST):
+ advance = decode_labeled_prefix4(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;
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_prefix4(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;
+ case (AFNUM_INET<<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;
#ifdef INET6
- case AFNUM_INET6:
- switch (safi) {
- case SAFNUM_UNICAST:
- case SAFNUM_MULTICAST:
- case SAFNUM_UNIMULTICAST:
- advance = decode_prefix6(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;
- case SAFNUM_LABUNICAST:
- advance = decode_labeled_prefix6(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;
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- advance = decode_labeled_vpn_prefix6(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;
- case 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;
- default:
- TCHECK2(*(tptr-3),tlen);
- printf("\n\t no SAFI %u decoder ",safi);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- break;
+ case (AFNUM_INET6<<8 | SAFNUM_UNICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST):
+ advance = decode_prefix6(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;
+ case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST):
+ advance = decode_labeled_prefix6(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;
+ case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_prefix6(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;
+ 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_L2VPN:
- switch(safi) {
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- advance = decode_labeled_vpn_l2(tptr, buf, sizeof(buf));
- if (advance == -1)
- printf("\n\t (illegal length)");
- else if (advance == -2)
- goto trunc;
- else
- printf("\n\t %s", buf);
- break;
- default:
- TCHECK2(*tptr,tlen);
- printf("no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- break;
-
-
- default:
- TCHECK2(*(tptr-3),tlen);
- printf("\n\t no AFI %u decoder ",af);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- tptr += advance;
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_l2(tptr, buf, sizeof(buf));
+ if (advance == -1)
+ printf("\n\t (illegal length)");
+ else if (advance == -2)
+ goto trunc;
+ else
+ printf("\n\t %s", buf);
+ break;
+ case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
+ advance = decode_labeled_clnp_prefix(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;
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_clnp_prefix(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,tlen);
+ printf("\n\t no AFI %u / SAFI %u decoder",af,safi);
+ if (vflag <= 1)
+ print_unknown_data(tptr,"\n\t ",tlen);
+ advance = 0;
+ tptr = pptr + len;
+ break;
+ }
+ break;
+
+ tptr += advance;
}
+ done:
break;
case BGPTYPE_MP_UNREACH_NLRI:
- TCHECK2(tptr[0], 3);
+ TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE);
af = EXTRACT_16BITS(tptr);
safi = tptr[2];
printf("\n\t AFI: %s (%u), %sSAFI: %s (%u)",
- tok2str(bgp_afi_values, "Unknown AFI", af),
+ tok2strbuf(bgp_afi_values, "Unknown AFI", af,
+ tokbuf, sizeof(tokbuf)),
af,
(safi>128) ? "vendor specific " : "", /* 128 is meanwhile wellknown */
- tok2str(bgp_safi_values, "Unknown SAFI", safi),
+ tok2strbuf(bgp_safi_values, "Unknown SAFI", safi,
+ tokbuf, sizeof(tokbuf)),
safi);
+ if (len == BGP_MP_NLRI_MINSIZE)
+ printf("\n\t End-of-Rib Marker (empty NLRI)");
+
tptr += 3;
while (len - (tptr - pptr) > 0) {
- switch (af) {
- case AFNUM_INET:
- switch (safi) {
- case SAFNUM_UNICAST:
- case SAFNUM_MULTICAST:
- case SAFNUM_UNIMULTICAST:
- advance = decode_prefix4(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;
- case SAFNUM_LABUNICAST:
- advance = decode_labeled_prefix4(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;
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- advance = decode_labeled_vpn_prefix4(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("\n\t no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- break;
-
+ switch (af<<8 | safi) {
+ case (AFNUM_INET<<8 | SAFNUM_UNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_UNIMULTICAST):
+ advance = decode_prefix4(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;
+ case (AFNUM_INET<<8 | SAFNUM_LABUNICAST):
+ advance = decode_labeled_prefix4(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;
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_prefix4(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:
- switch (safi) {
- case SAFNUM_UNICAST:
- case SAFNUM_MULTICAST:
- case SAFNUM_UNIMULTICAST:
- advance = decode_prefix6(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;
- case SAFNUM_LABUNICAST:
- advance = decode_labeled_prefix6(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;
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- advance = decode_labeled_vpn_prefix6(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("\n\t no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- break;
+ case (AFNUM_INET6<<8 | SAFNUM_UNICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_UNIMULTICAST):
+ advance = decode_prefix6(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;
+ case (AFNUM_INET6<<8 | SAFNUM_LABUNICAST):
+ advance = decode_labeled_prefix6(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;
+ case (AFNUM_INET6<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_INET6<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_prefix6(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_L2VPN:
- switch(safi) {
- case SAFNUM_VPNUNICAST:
- case SAFNUM_VPNMULTICAST:
- case SAFNUM_VPNUNIMULTICAST:
- advance = decode_labeled_vpn_l2(tptr, buf, sizeof(buf));
- if (advance == -1)
- printf("\n\t (illegal length)");
- else if (advance == -2)
- goto trunc;
- else
- printf("\n\t %s", buf);
- break;
- default:
- TCHECK2(*(tptr-3),tlen);
- printf("no SAFI %u decoder",safi);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
- break;
-
- default:
- TCHECK2(*(tptr-3),tlen);
- printf("\n\t no AFI %u decoder",af);
- if (vflag <= 1)
- print_unknown_data(tptr-3,"\n\t ",tlen);
- advance = 0;
- tptr = pptr + len;
- break;
- }
-
- tptr += advance;
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_l2(tptr, buf, sizeof(buf));
+ if (advance == -1)
+ printf("\n\t (illegal length)");
+ else if (advance == -2)
+ goto trunc;
+ else
+ printf("\n\t %s", buf);
+ break;
+ case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
+ advance = decode_labeled_clnp_prefix(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;
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNMULTICAST):
+ case (AFNUM_NSAP<<8 | SAFNUM_VPNUNIMULTICAST):
+ advance = decode_labeled_vpn_clnp_prefix(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);
+ if (vflag <= 1)
+ print_unknown_data(tptr-3,"\n\t ",tlen);
+ advance = 0;
+ tptr = pptr + len;
+ break;
+ }
+ break;
+ tptr += advance;
}
break;
case BGPTYPE_EXTD_COMMUNITIES:
@@ -1375,7 +1453,9 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
extd_comm=EXTRACT_16BITS(tptr);
printf("\n\t %s (0x%04x), Flags [%s]",
- tok2str(bgp_extd_comm_subtype_values, "unknown extd community typecode", extd_comm),
+ tok2strbuf(bgp_extd_comm_subtype_values,
+ "unknown extd community typecode",
+ extd_comm, tokbuf, sizeof(tokbuf)),
extd_comm,
bittok2str(bgp_extd_comm_flag_values, "none", extd_comm));
@@ -1404,6 +1484,11 @@ 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:
@@ -1416,17 +1501,19 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
case BGP_EXT_COM_OSPF_RTYPE2:
printf(": area:%s, router-type:%s, metric-type:%s%s",
getname(tptr+2),
- tok2str(bgp_extd_comm_ospf_rtype_values,
- "unknown (0x%02x)",
- *(tptr+6)),
+ tok2strbuf(bgp_extd_comm_ospf_rtype_values,
+ "unknown (0x%02x)",
+ *(tptr+6),
+ tokbuf, sizeof(tokbuf)),
(*(tptr+7) & BGP_OSPF_RTYPE_METRIC_TYPE) ? "E2" : "",
(*(tptr+6) == (BGP_OSPF_RTYPE_EXT ||BGP_OSPF_RTYPE_NSSA )) ? "E1" : "");
break;
case BGP_EXT_COM_L2INFO:
printf(": %s Control Flags [0x%02x]:MTU %u",
- tok2str(bgp_l2vpn_encaps_values,
- "unknown encaps",
- *(tptr+2)),
+ tok2strbuf(l2vpn_encaps_values,
+ "unknown encaps",
+ *(tptr+2),
+ tokbuf, sizeof(tokbuf)),
*(tptr+3),
EXTRACT_16BITS(tptr+4));
break;
@@ -1439,6 +1526,48 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
}
break;
+ case BGPTYPE_ATTR_SET:
+ TCHECK2(tptr[0], 4);
+ printf("\n\t Origin AS: %u", EXTRACT_32BITS(tptr));
+ tptr+=4;
+ len -=4;
+
+ while (len >= 2 ) {
+ int alen;
+ struct bgp_attr bgpa;
+
+ TCHECK2(tptr[0], sizeof(bgpa));
+ memcpy(&bgpa, tptr, sizeof(bgpa));
+ alen = bgp_attr_len(&bgpa);
+ tptr += bgp_attr_off(&bgpa);
+ len -= bgp_attr_off(&bgpa);
+
+ printf("\n\t %s (%u), length: %u",
+ tok2strbuf(bgp_attr_values,
+ "Unknown Attribute", bgpa.bgpa_type,
+ tokbuf, sizeof(tokbuf)),
+ bgpa.bgpa_type,
+ alen);
+
+ if (bgpa.bgpa_flags) {
+ printf(", Flags [%s%s%s%s",
+ bgpa.bgpa_flags & 0x80 ? "O" : "",
+ bgpa.bgpa_flags & 0x40 ? "T" : "",
+ bgpa.bgpa_flags & 0x20 ? "P" : "",
+ bgpa.bgpa_flags & 0x10 ? "E" : "");
+ if (bgpa.bgpa_flags & 0xf)
+ printf("+%x", bgpa.bgpa_flags & 0xf);
+ printf("]: ");
+ }
+ /* FIXME check for recursion */
+ if (!bgp_attr_print(&bgpa, tptr, alen))
+ return 0;
+ tptr += alen;
+ len -= alen;
+ }
+ break;
+
+
default:
TCHECK2(*pptr,len);
printf("\n\t no Attribute %u decoder",attr->bgpa_type); /* we have no decoder for the attribute */
@@ -1462,6 +1591,8 @@ bgp_open_print(const u_char *dat, int length)
int hlen;
const u_char *opt;
int i,cap_type,cap_len,tcap_len,cap_offset;
+ char tokbuf[TOKBUFSIZE];
+ char tokbuf2[TOKBUFSIZE];
TCHECK2(dat[0], BGP_OPEN_SIZE);
memcpy(&bgpo, dat, BGP_OPEN_SIZE);
@@ -1491,7 +1622,9 @@ bgp_open_print(const u_char *dat, int length)
}
printf("\n\t Option %s (%u), length: %u",
- tok2str(bgp_opt_values,"Unknown", bgpopt.bgpopt_type),
+ tok2strbuf(bgp_opt_values,"Unknown",
+ bgpopt.bgpopt_type,
+ tokbuf, sizeof(tokbuf)),
bgpopt.bgpopt_type,
bgpopt.bgpopt_len);
@@ -1501,15 +1634,21 @@ bgp_open_print(const u_char *dat, int length)
cap_type=opt[i+BGP_OPT_SIZE];
cap_len=opt[i+BGP_OPT_SIZE+1];
tcap_len=cap_len;
- printf("\n\t %s, length: %u",
- tok2str(bgp_capcode_values,"Unknown", cap_type),
+ printf("\n\t %s (%u), length: %u",
+ tok2strbuf(bgp_capcode_values, "Unknown",
+ cap_type, tokbuf, sizeof(tokbuf)),
+ cap_type,
cap_len);
switch(cap_type) {
case BGP_CAPCODE_MP:
printf("\n\t\tAFI %s (%u), SAFI %s (%u)",
- tok2str(bgp_afi_values,"Unknown", EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+2)),
+ tok2strbuf(bgp_afi_values, "Unknown",
+ EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+2),
+ tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+2),
- tok2str(bgp_safi_values,"Unknown", opt[i+BGP_OPT_SIZE+5]),
+ tok2strbuf(bgp_safi_values, "Unknown",
+ opt[i+BGP_OPT_SIZE+5],
+ tokbuf, sizeof(tokbuf)),
opt[i+BGP_OPT_SIZE+5]);
break;
case BGP_CAPCODE_RESTART:
@@ -1520,9 +1659,13 @@ bgp_open_print(const u_char *dat, int length)
cap_offset=4;
while(tcap_len>=4) {
printf("\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s",
- tok2str(bgp_afi_values,"Unknown", EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+cap_offset)),
+ tok2strbuf(bgp_afi_values,"Unknown",
+ EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+cap_offset),
+ tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+cap_offset),
- tok2str(bgp_safi_values,"Unknown", opt[i+BGP_OPT_SIZE+cap_offset+2]),
+ tok2strbuf(bgp_safi_values,"Unknown",
+ opt[i+BGP_OPT_SIZE+cap_offset+2],
+ tokbuf2, sizeof(tokbuf2)),
opt[i+BGP_OPT_SIZE+cap_offset+2],
((opt[i+BGP_OPT_SIZE+cap_offset+3])&0x80) ? "yes" : "no" );
tcap_len-=4;
@@ -1565,6 +1708,7 @@ bgp_update_print(const u_char *dat, int length)
const u_char *p;
int len;
int i;
+ char tokbuf[TOKBUFSIZE];
TCHECK2(dat[0], BGP_SIZE);
memcpy(&bgp, dat, BGP_SIZE);
@@ -1608,6 +1752,12 @@ bgp_update_print(const u_char *dat, int length)
TCHECK2(p[0], 2);
len = EXTRACT_16BITS(p);
+
+ if (len == 0 && length == BGP_UPDATE_MINSIZE) {
+ printf("\n\t End-of-Rib Marker (empty NLRI)");
+ return;
+ }
+
if (len) {
/* do something more useful!*/
i = 2;
@@ -1620,7 +1770,9 @@ bgp_update_print(const u_char *dat, int length)
aoff = bgp_attr_off(&bgpa);
printf("\n\t %s (%u), length: %u",
- tok2str(bgp_attr_values, "Unknown Attribute", bgpa.bgpa_type),
+ tok2strbuf(bgp_attr_values, "Unknown Attribute",
+ bgpa.bgpa_type,
+ tokbuf, sizeof(tokbuf)),
bgpa.bgpa_type,
alen);
@@ -1638,7 +1790,7 @@ bgp_update_print(const u_char *dat, int length)
goto trunc;
i += aoff + alen;
}
- }
+ }
p += 2 + len;
if (dat + length > p) {
@@ -1667,6 +1819,8 @@ bgp_notification_print(const u_char *dat, int length)
struct bgp_notification bgpn;
int hlen;
const u_char *tptr;
+ char tokbuf[TOKBUFSIZE];
+ char tokbuf2[TOKBUFSIZE];
TCHECK2(dat[0], BGP_NOTIFICATION_SIZE);
memcpy(&bgpn, dat, BGP_NOTIFICATION_SIZE);
@@ -1677,33 +1831,39 @@ bgp_notification_print(const u_char *dat, int length)
return;
printf(", %s (%u)",
- tok2str(bgp_notify_major_values, "Unknown Error", bgpn.bgpn_major),
+ tok2strbuf(bgp_notify_major_values, "Unknown Error",
+ bgpn.bgpn_major, tokbuf, sizeof(tokbuf)),
bgpn.bgpn_major);
switch (bgpn.bgpn_major) {
case BGP_NOTIFY_MAJOR_MSG:
printf(", subcode %s (%u)",
- tok2str(bgp_notify_minor_msg_values, "Unknown", bgpn.bgpn_minor),
+ tok2strbuf(bgp_notify_minor_msg_values, "Unknown",
+ bgpn.bgpn_minor, tokbuf, sizeof(tokbuf)),
bgpn.bgpn_minor);
break;
case BGP_NOTIFY_MAJOR_OPEN:
printf(", subcode %s (%u)",
- tok2str(bgp_notify_minor_open_values, "Unknown", bgpn.bgpn_minor),
+ tok2strbuf(bgp_notify_minor_open_values, "Unknown",
+ bgpn.bgpn_minor, tokbuf, sizeof(tokbuf)),
bgpn.bgpn_minor);
break;
case BGP_NOTIFY_MAJOR_UPDATE:
printf(", subcode %s (%u)",
- tok2str(bgp_notify_minor_update_values, "Unknown", bgpn.bgpn_minor),
+ tok2strbuf(bgp_notify_minor_update_values, "Unknown",
+ bgpn.bgpn_minor, tokbuf, sizeof(tokbuf)),
bgpn.bgpn_minor);
break;
case BGP_NOTIFY_MAJOR_CAP:
printf(" subcode %s (%u)",
- tok2str(bgp_notify_minor_cap_values, "Unknown", bgpn.bgpn_minor),
+ tok2strbuf(bgp_notify_minor_cap_values, "Unknown",
+ bgpn.bgpn_minor, tokbuf, sizeof(tokbuf)),
bgpn.bgpn_minor);
case BGP_NOTIFY_MAJOR_CEASE:
printf(", subcode %s (%u)",
- tok2str(bgp_notify_minor_cease_values, "Unknown", bgpn.bgpn_minor),
+ tok2strbuf(bgp_notify_minor_cease_values, "Unknown",
+ bgpn.bgpn_minor, tokbuf, sizeof(tokbuf)),
bgpn.bgpn_minor);
/* draft-ietf-idr-cease-subcode-02 mentions optionally 7 bytes
@@ -1713,9 +1873,11 @@ bgp_notification_print(const u_char *dat, int length)
tptr = dat + BGP_NOTIFICATION_SIZE;
TCHECK2(*tptr, 7);
printf(", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u",
- tok2str(bgp_afi_values, "Unknown", EXTRACT_16BITS(tptr)),
+ tok2strbuf(bgp_afi_values, "Unknown",
+ EXTRACT_16BITS(tptr), tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(tptr),
- tok2str(bgp_safi_values, "Unknown", *(tptr+2)),
+ tok2strbuf(bgp_safi_values, "Unknown", *(tptr+2),
+ tokbuf2, sizeof(tokbuf)),
*(tptr+2),
EXTRACT_32BITS(tptr+3));
}
@@ -1733,14 +1895,21 @@ static void
bgp_route_refresh_print(const u_char *pptr, int len) {
const struct bgp_route_refresh *bgp_route_refresh_header;
+ char tokbuf[TOKBUFSIZE];
+ char tokbuf2[TOKBUFSIZE];
+
bgp_route_refresh_header = (const struct bgp_route_refresh *)pptr;
printf("\n\t AFI %s (%u), SAFI %s (%u)",
- tok2str(bgp_afi_values,"Unknown",
- EXTRACT_16BITS(&bgp_route_refresh_header->afi)), /* this stinks but the compiler pads the structure weird */
+ tok2strbuf(bgp_afi_values,"Unknown",
+ /* this stinks but the compiler pads the structure
+ * weird */
+ EXTRACT_16BITS(&bgp_route_refresh_header->afi),
+ tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(&bgp_route_refresh_header->afi),
- tok2str(bgp_safi_values,"Unknown",
- bgp_route_refresh_header->safi),
+ tok2strbuf(bgp_safi_values,"Unknown",
+ bgp_route_refresh_header->safi,
+ tokbuf2, sizeof(tokbuf2)),
bgp_route_refresh_header->safi);
if (vflag > 1)
@@ -1753,11 +1922,13 @@ static int
bgp_header_print(const u_char *dat, int length)
{
struct bgp bgp;
+ char tokbuf[TOKBUFSIZE];
TCHECK2(dat[0], BGP_SIZE);
memcpy(&bgp, dat, BGP_SIZE);
printf("\n\t%s Message (%u), length: %u",
- tok2str(bgp_msg_values, "Unknown", bgp.bgp_type),
+ tok2strbuf(bgp_msg_values, "Unknown", bgp.bgp_type,
+ tokbuf, sizeof(tokbuf)),
bgp.bgp_type,
length);
@@ -1800,6 +1971,7 @@ bgp_print(const u_char *dat, int length)
};
struct bgp bgp;
u_int16_t hlen;
+ char tokbuf[TOKBUFSIZE];
ep = dat + length;
if (snapend < dat + length)
@@ -1847,7 +2019,11 @@ bgp_print(const u_char *dat, int length)
p += hlen;
start = p;
} else {
- printf("\n[|BGP %s]", tok2str(bgp_msg_values, "Unknown Message Type",bgp.bgp_type));
+ printf("\n[|BGP %s]",
+ tok2strbuf(bgp_msg_values,
+ "Unknown Message Type",
+ bgp.bgp_type,
+ tokbuf, sizeof(tokbuf)));
break;
}
}
diff --git a/contrib/tcpdump/print-bootp.c b/contrib/tcpdump/print-bootp.c
index 896bd9d831f2..e73915ed3195 100644
--- a/contrib/tcpdump/print-bootp.c
+++ b/contrib/tcpdump/print-bootp.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.75.2.3 2004/03/02 07:45:13 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78 2004/03/02 07:38:10 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-cdp.c b/contrib/tcpdump/print-cdp.c
index c69d962983e6..4398fbefdae7 100644
--- a/contrib/tcpdump/print-cdp.c
+++ b/contrib/tcpdump/print-cdp.c
@@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.19.2.5 2004/03/24 06:00:51 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.25 2004/10/07 14:53:11 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -41,6 +41,7 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "addrtoname.h"
#include "extract.h" /* must come after interface.h */
+#include "nlpid.h"
#define CDP_HEADER_LEN 4
@@ -260,7 +261,7 @@ cdp_print_addr(const u_char * p, int l)
goto trunc;
al = EXTRACT_16BITS(&p[pl]); /* address length */
- if (pt == PT_NLPID && pl == 1 && *p == 0xcc && al == 4) {
+ if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) {
/*
* IPv4: protocol type = NLPID, protocol length = 1
* (1-byte NLPID), protocol = 0xcc (NLPID for IPv4),
diff --git a/contrib/tcpdump/print-chdlc.c b/contrib/tcpdump/print-chdlc.c
index 583b0ba48a98..730d1aa6c870 100644
--- a/contrib/tcpdump/print-chdlc.c
+++ b/contrib/tcpdump/print-chdlc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.28.2.3 2004/03/24 00:46:03 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32 2005/04/06 21:32:38 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -76,7 +76,7 @@ chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
ip = (const struct ip *)(p + CHDLC_HDRLEN);
switch (proto) {
case ETHERTYPE_IP:
- ip_print((const u_char *)ip, length);
+ ip_print(gndo, (const u_char *)ip, length);
break;
#ifdef INET6
case ETHERTYPE_IPV6:
@@ -182,3 +182,11 @@ chdlc_slarp_print(const u_char *cp, u_int length)
trunc:
printf("[|slarp]");
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-cip.c b/contrib/tcpdump/print-cip.c
index 17dd308ef13e..b877788e913c 100644
--- a/contrib/tcpdump/print-cip.c
+++ b/contrib/tcpdump/print-cip.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.21.2.2 2003/11/16 08:51:15 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.25 2005/04/06 21:32:39 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -63,7 +63,7 @@ cip_print(int length)
/*
* This is the top level routine of the printer. 'p' points
* to the LLC/SNAP or raw header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
@@ -101,8 +101,16 @@ cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
/*
* LLC header is absent; treat it as just IP.
*/
- ip_print(p, length);
+ ip_print(gndo, p, length);
}
return (0);
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-cnfp.c b/contrib/tcpdump/print-cnfp.c
index 0179ba7beef5..2c1043f8c1b1 100644
--- a/contrib/tcpdump/print-cnfp.c
+++ b/contrib/tcpdump/print-cnfp.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.14.2.2 2003/11/16 08:51:15 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.16 2003/11/16 09:36:16 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-decnet.c b/contrib/tcpdump/print-decnet.c
index f84b080e4d89..43fe71d53dfa 100644
--- a/contrib/tcpdump/print-decnet.c
+++ b/contrib/tcpdump/print-decnet.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.36.2.2 2003/11/16 08:51:16 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.38 2003/11/16 09:36:17 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-dhcp6.c b/contrib/tcpdump/print-dhcp6.c
index 1193e3778a73..b304f878a743 100644
--- a/contrib/tcpdump/print-dhcp6.c
+++ b/contrib/tcpdump/print-dhcp6.c
@@ -30,14 +30,15 @@
* RFC3315: DHCPv6
* supported DHCPv6 options:
* RFC3319,
- * draft-ietf-dhc-dhcpv6-opt-dnsconfig-04.txt,
- * draft-ietf-dhc-dhcpv6-opt-prefix-delegation-05.txt
- * draft-ietf-dhc-dhcpv6-opt-timeconfig-02.txt,
+ * RFC3633,
+ * RFC3646,
+ * draft-ietf-dhc-dhcpv6-opt-timeconfig-03.txt,
+ * draft-ietf-dhc-lifetime-00.txt,
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.27.2.4 2003/11/18 23:26:14 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.35 2004/07/06 22:16:03 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -107,12 +108,17 @@ struct dhcp6_relay {
#define DH6OPT_IADDR 5
#define DH6OPT_ORO 6
#define DH6OPT_PREFERENCE 7
-# define DH6OPT_PREF_UNDEF -1
# define DH6OPT_PREF_MAX 255
#define DH6OPT_ELAPSED_TIME 8
#define DH6OPT_RELAY_MSG 9
/*#define DH6OPT_SERVER_MSG 10 deprecated */
#define DH6OPT_AUTH 11
+# define DH6OPT_AUTHPROTO_DELAYED 2
+# define DH6OPT_AUTHPROTO_RECONFIG 3
+# define DH6OPT_AUTHALG_HMACMD5 1
+# define DH6OPT_AUTHRDM_MONOCOUNTER 0
+# define DH6OPT_AUTHRECONFIG_KEY 1
+# define DH6OPT_AUTHRECONFIG_HMACMD5 2
#define DH6OPT_UNICAST 12
#define DH6OPT_STATUS_CODE 13
# define DH6OPT_STCODE_SUCCESS 0
@@ -133,25 +139,23 @@ struct dhcp6_relay {
#define DH6OPT_SIP_SERVER_A 22
#define DH6OPT_DNS 23
#define DH6OPT_DNSNAME 24
+#define DH6OPT_IA_PD 25
+#define DH6OPT_IA_PD_PREFIX 26
/*
- * The option type has not been assigned for the following options.
- * We temporarily adopt values used in the service specification document
+ * The old prefix delegation option used in the service specification document
* (200206xx version) by NTT Communications.
- * Note that we'll change the following definitions if different type values
- * are officially assigned.
*/
#define DH6OPT_PREFIX_DELEGATION 30
#define DH6OPT_PREFIX_INFORMATION 31
#define DH6OPT_PREFIX_REQUEST 32
/*
- * The followings are also unassigned numbers.
- * We temporarily use values as of KAME snap 20031013.
+ * The following one is an unassigned number.
+ * We temporarily use values as of KAME snap 20040322.
*/
-#define DH6OPT_IA_PD 33
-#define DH6OPT_IA_PD_PREFIX 34
#define DH6OPT_NTP_SERVERS 35
+#define DH6OPT_LIFETIME 36
struct dhcp6opt {
u_int16_t dh6opt_type;
@@ -176,6 +180,16 @@ struct dhcp6_ia_prefix {
struct in6_addr dh6opt_ia_prefix_addr;
} __attribute__ ((__packed__));
+struct dhcp6_auth {
+ u_int16_t dh6opt_auth_type;
+ u_int16_t dh6opt_auth_len;
+ u_int8_t dh6opt_auth_proto;
+ u_int8_t dh6opt_auth_alg;
+ u_int8_t dh6opt_auth_rdm;
+ u_int8_t dh6opt_auth_rdinfo[8];
+ /* authentication information follows */
+} __attribute__ ((__packed__));
+
static const char *
dhcp6opt_name(int type)
{
@@ -199,10 +213,20 @@ dhcp6opt_name(int type)
return "elapsed time";
case DH6OPT_RELAY_MSG:
return "relay message";
+ case DH6OPT_AUTH:
+ return "authentication";
+ case DH6OPT_UNICAST:
+ return "server unicast";
case DH6OPT_STATUS_CODE:
return "status code";
case DH6OPT_RAPID_COMMIT:
return "rapid commit";
+ case DH6OPT_USER_CLASS:
+ return "user class";
+ case DH6OPT_VENDOR_CLASS:
+ return "vendor class";
+ case DH6OPT_VENDOR_OPTS:
+ return "vendor-specific info";
case DH6OPT_INTERFACE_ID:
return "interface ID";
case DH6OPT_RECONF_MSG:
@@ -210,11 +234,13 @@ dhcp6opt_name(int type)
case DH6OPT_RECONF_ACCEPT:
return "reconfigure accept";
case DH6OPT_SIP_SERVER_D:
- return "SIP Servers Domain";
+ return "SIP servers domain";
case DH6OPT_SIP_SERVER_A:
- return "SIP Servers Address";
+ return "SIP servers address";
case DH6OPT_DNS:
return "DNS";
+ case DH6OPT_DNSNAME:
+ return "DNS name";
case DH6OPT_PREFIX_DELEGATION:
return "prefix delegation";
case DH6OPT_PREFIX_INFORMATION:
@@ -225,6 +251,8 @@ dhcp6opt_name(int type)
return "IA_PD prefix";
case DH6OPT_NTP_SERVERS:
return "NTP Server";
+ case DH6OPT_LIFETIME:
+ return "lifetime";
default:
snprintf(genstr, sizeof(genstr), "opt_%d", type);
return(genstr);
@@ -273,6 +301,8 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
struct in6_addr addr6;
struct dhcp6_ia ia;
struct dhcp6_ia_prefix ia_prefix;
+ struct dhcp6_auth authopt;
+ u_int authinfolen, authrealmlen;
if (cp == ep)
return;
@@ -374,6 +404,97 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
dhcp6_print((const u_char *)(dh6o + 1), optlen);
printf(")");
break;
+ case DH6OPT_AUTH:
+ if (optlen < sizeof(authopt) - sizeof(*dh6o)) {
+ printf(" ?)");
+ break;
+ }
+ memcpy(&authopt, dh6o, sizeof(authopt));
+ switch (authopt.dh6opt_auth_proto) {
+ case DH6OPT_AUTHPROTO_DELAYED:
+ printf(" proto: delayed");
+ break;
+ case DH6OPT_AUTHPROTO_RECONFIG:
+ printf(" proto: reconfigure");
+ break;
+ default:
+ printf(" proto: %d",
+ authopt.dh6opt_auth_proto);
+ break;
+ }
+ switch (authopt.dh6opt_auth_alg) {
+ case DH6OPT_AUTHALG_HMACMD5:
+ /* XXX: may depend on the protocol */
+ printf(", alg: HMAC-MD5");
+ break;
+ default:
+ printf(", alg: %d", authopt.dh6opt_auth_alg);
+ break;
+ }
+ switch (authopt.dh6opt_auth_rdm) {
+ case DH6OPT_AUTHRDM_MONOCOUNTER:
+ printf(", RDM: mono");
+ break;
+ default:
+ printf(", RDM: %d", authopt.dh6opt_auth_rdm);
+ break;
+ }
+ tp = (u_char *)&authopt.dh6opt_auth_rdinfo;
+ printf(", RD:");
+ for (i = 0; i < 4; i++, tp += sizeof(val16))
+ printf(" %04x", EXTRACT_16BITS(tp));
+
+ /* protocol dependent part */
+ tp = (u_char *)dh6o + sizeof(authopt);
+ authinfolen =
+ optlen + sizeof(*dh6o) - sizeof(authopt);
+ switch (authopt.dh6opt_auth_proto) {
+ case DH6OPT_AUTHPROTO_DELAYED:
+ if (authinfolen == 0)
+ break;
+ if (authinfolen < 20) {
+ printf(" ??");
+ break;
+ }
+ authrealmlen = authinfolen - 20;
+ if (authrealmlen > 0) {
+ printf(", realm: ");
+ }
+ for (i = 0; i < authrealmlen; i++, tp++)
+ printf("%02x", *tp);
+ printf(", key ID: %08x", EXTRACT_32BITS(tp));
+ tp += 4;
+ printf(", HMAC-MD5:");
+ for (i = 0; i < 4; i++, tp+= 4)
+ printf(" %08x", EXTRACT_32BITS(tp));
+ break;
+ case DH6OPT_AUTHPROTO_RECONFIG:
+ if (authinfolen != 17) {
+ printf(" ??");
+ break;
+ }
+ switch (*tp++) {
+ case DH6OPT_AUTHRECONFIG_KEY:
+ printf(" reconfig-key");
+ break;
+ case DH6OPT_AUTHRECONFIG_HMACMD5:
+ printf(" type: HMAC-MD5");
+ break;
+ default:
+ printf(" type: ??");
+ break;
+ }
+ printf(" value:");
+ for (i = 0; i < 4; i++, tp+= 4)
+ printf(" %08x", EXTRACT_32BITS(tp));
+ break;
+ default:
+ printf(" ??");
+ break;
+ }
+
+ printf(")");
+ break;
case DH6OPT_RAPID_COMMIT: /* nothing todo */
printf(")");
break;
@@ -487,6 +608,15 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
}
printf(")");
break;
+ case DH6OPT_LIFETIME:
+ if (optlen != 4) {
+ printf(" ?)");
+ break;
+ }
+ memcpy(&val32, dh6o + 1, sizeof(val32));
+ val32 = ntohl(val32);
+ printf(" %d)", (int)val32);
+ break;
default:
printf(")");
break;
diff --git a/contrib/tcpdump/print-domain.c b/contrib/tcpdump/print-domain.c
index e24869c20e3c..8955281949ff 100644
--- a/contrib/tcpdump/print-domain.c
+++ b/contrib/tcpdump/print-domain.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.86.2.3 2004/03/28 20:54:00 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89 2004/03/23 19:03:03 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-dvmrp.c b/contrib/tcpdump/print-dvmrp.c
index 5e45d55197c6..2c159bf94508 100644
--- a/contrib/tcpdump/print-dvmrp.c
+++ b/contrib/tcpdump/print-dvmrp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.24.2.3 2003/11/19 09:41:28 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
diff --git a/contrib/tcpdump/print-eap.c b/contrib/tcpdump/print-eap.c
new file mode 100644
index 000000000000..fb39e76f89b9
--- /dev/null
+++ b/contrib/tcpdump/print-eap.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2004 - Michael Richardson <mcr@xelerance.com>
+ *
+ * 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, (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, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Format and print bootp 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 $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "netdissect.h"
+#include "addrtoname.h"
+#include "extract.h"
+#include "ether.h"
+
+struct eap_packet_t {
+ unsigned char code;
+ unsigned char id;
+ unsigned char length[2];
+ unsigned char data[1];
+};
+
+/*
+ * Print bootp requests
+ */
+void
+eap_print(netdissect_options *ndo,
+ register const u_char *cp,
+ u_int length _U_)
+{
+ const struct eap_packet_t *eap;
+
+ eap = (const struct eap_packet_t *)cp;
+ ND_TCHECK(eap->data);
+
+ ND_PRINT((ndo, "EAP code=%u id=%u length=%u ",
+ eap->code, eap->id, (eap->length[0]<<8) + eap->length[1]));
+
+ if (!ndo->ndo_vflag)
+ return;
+
+trunc:
+ ;
+}
+
diff --git a/contrib/tcpdump/print-egp.c b/contrib/tcpdump/print-egp.c
index 6cfaa30bce8e..e5a811d7dc8d 100644
--- a/contrib/tcpdump/print-egp.c
+++ b/contrib/tcpdump/print-egp.c
@@ -20,7 +20,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.34.2.2 2003/11/16 08:51:18 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.37 2005/01/12 11:19:09 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -214,7 +214,7 @@ trunc:
}
void
-egp_print(register const u_int8_t *bp)
+egp_print(register const u_int8_t *bp, register u_int length)
{
register const struct egp_packet *egp;
register int status;
@@ -222,7 +222,7 @@ egp_print(register const u_int8_t *bp)
register int type;
egp = (struct egp_packet *)bp;
- if (!TTEST(*egp)) {
+ if (!TTEST2(*egp, length)) {
printf("[|egp]");
return;
}
diff --git a/contrib/tcpdump/print-eigrp.c b/contrib/tcpdump/print-eigrp.c
new file mode 100644
index 000000000000..f4db8ed74613
--- /dev/null
+++ b/contrib/tcpdump/print-eigrp.c
@@ -0,0 +1,481 @@
+/*
+ * Copyright (c) 1998-2004 Hannes Gredler <hannes@tcpdump.org>
+ * 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.
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-eigrp.c,v 1.5 2004/05/12 22:22:40 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 "addrtoname.h"
+
+/*
+ * packet format documented at
+ * http://www.rhyshaden.com/eigrp.htm
+ */
+
+struct eigrp_common_header {
+ u_int8_t version;
+ u_int8_t opcode;
+ u_int8_t checksum[2];
+ u_int8_t flags[4];
+ u_int8_t seq[4];
+ u_int8_t ack[4];
+ u_int8_t asn[4];
+};
+
+#define EIGRP_VERSION 2
+
+#define EIGRP_OPCODE_UPDATE 1
+#define EIGRP_OPCODE_QUERY 3
+#define EIGRP_OPCODE_REPLY 4
+#define EIGRP_OPCODE_HELLO 5
+#define EIGRP_OPCODE_IPXSAP 6
+#define EIGRP_OPCODE_PROBE 7
+
+static const struct tok eigrp_opcode_values[] = {
+ { EIGRP_OPCODE_UPDATE, "Update" },
+ { EIGRP_OPCODE_QUERY, "Query" },
+ { EIGRP_OPCODE_REPLY, "Reply" },
+ { EIGRP_OPCODE_HELLO, "Hello" },
+ { EIGRP_OPCODE_IPXSAP, "IPX SAP" },
+ { EIGRP_OPCODE_PROBE, "Probe" },
+ { 0, NULL}
+};
+
+static const struct tok eigrp_common_header_flag_values[] = {
+ { 0x01, "Init" },
+ { 0x02, "Conditionally Received" },
+ { 0, NULL}
+};
+
+struct eigrp_tlv_header {
+ u_int8_t type[2];
+ u_int8_t length[2];
+};
+
+#define EIGRP_TLV_GENERAL_PARM 0x0001
+#define EIGRP_TLV_AUTH 0x0002
+#define EIGRP_TLV_SEQ 0x0003
+#define EIGRP_TLV_SW_VERSION 0x0004
+#define EIGRP_TLV_MCAST_SEQ 0x0005
+#define EIGRP_TLV_IP_INT 0x0102
+#define EIGRP_TLV_IP_EXT 0x0103
+#define EIGRP_TLV_AT_INT 0x0202
+#define EIGRP_TLV_AT_EXT 0x0203
+#define EIGRP_TLV_AT_CABLE_SETUP 0x0204
+#define EIGRP_TLV_IPX_INT 0x0302
+#define EIGRP_TLV_IPX_EXT 0x0303
+
+static const struct tok eigrp_tlv_values[] = {
+ { EIGRP_TLV_GENERAL_PARM, "General Parameters"},
+ { EIGRP_TLV_AUTH, "Authentication"},
+ { EIGRP_TLV_SEQ, "Sequence"},
+ { EIGRP_TLV_SW_VERSION, "Software Version"},
+ { EIGRP_TLV_MCAST_SEQ, "Next Multicast Sequence"},
+ { EIGRP_TLV_IP_INT, "IP Internal routes"},
+ { EIGRP_TLV_IP_EXT, "IP External routes"},
+ { EIGRP_TLV_AT_INT, "AppleTalk Internal routes"},
+ { EIGRP_TLV_AT_EXT, "AppleTalk External routes"},
+ { EIGRP_TLV_AT_CABLE_SETUP, "AppleTalk Cable setup"},
+ { EIGRP_TLV_IPX_INT, "IPX Internal routes"},
+ { EIGRP_TLV_IPX_EXT, "IPX External routes"},
+ { 0, NULL}
+};
+
+struct eigrp_tlv_general_parm_t {
+ u_int8_t k1;
+ u_int8_t k2;
+ u_int8_t k3;
+ u_int8_t k4;
+ u_int8_t k5;
+ u_int8_t res;
+ u_int8_t holdtime[2];
+};
+
+struct eigrp_tlv_sw_version_t {
+ u_int8_t ios_major;
+ u_int8_t ios_minor;
+ u_int8_t eigrp_major;
+ u_int8_t eigrp_minor;
+};
+
+struct eigrp_tlv_ip_int_t {
+ u_int8_t nexthop[4];
+ u_int8_t delay[4];
+ u_int8_t bandwidth[4];
+ u_int8_t mtu[3];
+ u_int8_t hopcount;
+ u_int8_t reliability;
+ u_int8_t load;
+ u_int8_t reserved[2];
+ u_int8_t plen;
+ u_int8_t destination; /* variable length [1-4] bytes encoding */
+};
+
+struct eigrp_tlv_ip_ext_t {
+ u_int8_t nexthop[4];
+ u_int8_t origin_router[4];
+ u_int8_t origin_as[4];
+ u_int8_t tag[4];
+ u_int8_t metric[4];
+ u_int8_t reserved[2];
+ u_int8_t proto_id;
+ u_int8_t flags;
+ u_int8_t delay[4];
+ u_int8_t bandwidth[4];
+ u_int8_t mtu[3];
+ u_int8_t hopcount;
+ u_int8_t reliability;
+ u_int8_t load;
+ u_int8_t reserved2[2];
+ u_int8_t plen;
+ u_int8_t destination; /* variable length [1-4] bytes encoding */
+};
+
+struct eigrp_tlv_at_cable_setup_t {
+ u_int8_t cable_start[2];
+ u_int8_t cable_end[2];
+ u_int8_t router_id[4];
+};
+
+struct eigrp_tlv_at_int_t {
+ u_int8_t nexthop[4];
+ u_int8_t delay[4];
+ u_int8_t bandwidth[4];
+ u_int8_t mtu[3];
+ u_int8_t hopcount;
+ u_int8_t reliability;
+ u_int8_t load;
+ u_int8_t reserved[2];
+ u_int8_t cable_start[2];
+ u_int8_t cable_end[2];
+};
+
+struct eigrp_tlv_at_ext_t {
+ u_int8_t nexthop[4];
+ u_int8_t origin_router[4];
+ u_int8_t origin_as[4];
+ u_int8_t tag[4];
+ u_int8_t proto_id;
+ u_int8_t flags;
+ u_int8_t metric[2];
+ u_int8_t delay[4];
+ u_int8_t bandwidth[4];
+ u_int8_t mtu[3];
+ u_int8_t hopcount;
+ u_int8_t reliability;
+ u_int8_t load;
+ u_int8_t reserved2[2];
+ u_int8_t cable_start[2];
+ u_int8_t cable_end[2];
+};
+
+static const struct tok eigrp_ext_proto_id_values[] = {
+ { 0x01, "IGRP" },
+ { 0x02, "EIGRP" },
+ { 0x03, "Static" },
+ { 0x04, "RIP" },
+ { 0x05, "Hello" },
+ { 0x06, "OSPF" },
+ { 0x07, "IS-IS" },
+ { 0x08, "EGP" },
+ { 0x09, "BGP" },
+ { 0x0a, "IDRP" },
+ { 0x0b, "Connected" },
+ { 0, NULL}
+};
+
+void
+eigrp_print(register const u_char *pptr, register u_int len) {
+
+ const struct eigrp_common_header *eigrp_com_header;
+ const struct eigrp_tlv_header *eigrp_tlv_header;
+ const u_char *tptr,*tlv_tptr;
+ int tlen,eigrp_tlv_len,eigrp_tlv_type,tlv_tlen,byte_length, bit_length;
+ u_int8_t prefix[4];
+
+ union {
+ const struct eigrp_tlv_general_parm_t *eigrp_tlv_general_parm;
+ const struct eigrp_tlv_sw_version_t *eigrp_tlv_sw_version;
+ const struct eigrp_tlv_ip_int_t *eigrp_tlv_ip_int;
+ const struct eigrp_tlv_ip_ext_t *eigrp_tlv_ip_ext;
+ const struct eigrp_tlv_at_cable_setup_t *eigrp_tlv_at_cable_setup;
+ const struct eigrp_tlv_at_int_t *eigrp_tlv_at_int;
+ const struct eigrp_tlv_at_ext_t *eigrp_tlv_at_ext;
+ } tlv_ptr;
+
+ tptr=pptr;
+ eigrp_com_header = (const struct eigrp_common_header *)pptr;
+ TCHECK(*eigrp_com_header);
+
+ /*
+ * Sanity checking of the header.
+ */
+ if (eigrp_com_header->version != EIGRP_VERSION) {
+ printf("EIGRP version %u packet not supported",eigrp_com_header->version);
+ return;
+ }
+
+ /* in non-verbose mode just lets print the basic Message Type*/
+ if (vflag < 1) {
+ printf("EIGRP %s, length: %u",
+ tok2str(eigrp_opcode_values, "unknown (%u)",eigrp_com_header->opcode),
+ len);
+ return;
+ }
+
+ /* ok they seem to want to know everything - lets fully decode it */
+
+ tlen=len-sizeof(struct eigrp_common_header);
+
+ /* FIXME print other header info */
+ printf("\n\tEIGRP v%u, opcode: %s (%u), chksum: 0x%04x, Flags: [%s]\n\tseq: 0x%08x, ack: 0x%08x, AS: %u, length: %u",
+ eigrp_com_header->version,
+ tok2str(eigrp_opcode_values, "unknown, type: %u",eigrp_com_header->opcode),
+ eigrp_com_header->opcode,
+ EXTRACT_16BITS(&eigrp_com_header->checksum),
+ tok2str(eigrp_common_header_flag_values,
+ "none",
+ EXTRACT_32BITS(&eigrp_com_header->flags)),
+ EXTRACT_32BITS(&eigrp_com_header->seq),
+ EXTRACT_32BITS(&eigrp_com_header->ack),
+ EXTRACT_32BITS(&eigrp_com_header->asn),
+ tlen);
+
+ tptr+=sizeof(const struct eigrp_common_header);
+
+ while(tlen>0) {
+ /* did we capture enough for fully decoding the object header ? */
+ if (!TTEST2(*tptr, sizeof(struct eigrp_tlv_header)))
+ goto trunc;
+
+ eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
+ eigrp_tlv_len=EXTRACT_16BITS(&eigrp_tlv_header->length);
+ eigrp_tlv_type=EXTRACT_16BITS(&eigrp_tlv_header->type);
+
+
+ if (eigrp_tlv_len == 0 || eigrp_tlv_len > tlen) {
+ print_unknown_data(tptr+sizeof(sizeof(struct eigrp_tlv_header)),"\n\t ",tlen);
+ return;
+ }
+
+ printf("\n\t %s TLV (0x%04x), length: %u",
+ tok2str(eigrp_tlv_values,
+ "Unknown",
+ eigrp_tlv_type),
+ eigrp_tlv_type,
+ eigrp_tlv_len);
+
+ tlv_tptr=tptr+sizeof(struct eigrp_tlv_header);
+ tlv_tlen=eigrp_tlv_len-sizeof(struct eigrp_tlv_header);
+
+ /* did we capture enough for fully decoding the object ? */
+ if (!TTEST2(*tptr, eigrp_tlv_len))
+ goto trunc;
+
+ switch(eigrp_tlv_type) {
+
+ case EIGRP_TLV_GENERAL_PARM:
+ tlv_ptr.eigrp_tlv_general_parm = (const struct eigrp_tlv_general_parm_t *)tlv_tptr;
+
+ printf("\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u",
+ EXTRACT_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime),
+ tlv_ptr.eigrp_tlv_general_parm->k1,
+ tlv_ptr.eigrp_tlv_general_parm->k2,
+ tlv_ptr.eigrp_tlv_general_parm->k3,
+ tlv_ptr.eigrp_tlv_general_parm->k4,
+ tlv_ptr.eigrp_tlv_general_parm->k5);
+ break;
+
+ case EIGRP_TLV_SW_VERSION:
+ tlv_ptr.eigrp_tlv_sw_version = (const struct eigrp_tlv_sw_version_t *)tlv_tptr;
+
+ printf("\n\t IOS version: %u.%u, EIGRP version %u.%u",
+ tlv_ptr.eigrp_tlv_sw_version->ios_major,
+ tlv_ptr.eigrp_tlv_sw_version->ios_minor,
+ tlv_ptr.eigrp_tlv_sw_version->eigrp_major,
+ tlv_ptr.eigrp_tlv_sw_version->eigrp_minor);
+ break;
+
+ case EIGRP_TLV_IP_INT:
+ tlv_ptr.eigrp_tlv_ip_int = (const struct eigrp_tlv_ip_int_t *)tlv_tptr;
+
+ bit_length = tlv_ptr.eigrp_tlv_ip_int->plen;
+ if (bit_length < 0 || bit_length > 32) {
+ printf("\n\t illegal prefix length %u",bit_length);
+ break;
+ }
+ byte_length = (bit_length + 7) / 8; /* variable length encoding */
+ memset(prefix, 0, 4);
+ memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_int->destination,byte_length);
+
+ printf("\n\t IPv4 prefix: %15s/%u, nexthop: ",
+ ipaddr_string(prefix),
+ bit_length);
+ if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
+ printf("self");
+ else
+ printf("%s",ipaddr_string(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop)));
+
+ printf("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
+ (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
+ EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),
+ EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu),
+ tlv_ptr.eigrp_tlv_ip_int->hopcount,
+ tlv_ptr.eigrp_tlv_ip_int->reliability,
+ tlv_ptr.eigrp_tlv_ip_int->load);
+ break;
+
+ case EIGRP_TLV_IP_EXT:
+ tlv_ptr.eigrp_tlv_ip_ext = (const struct eigrp_tlv_ip_ext_t *)tlv_tptr;
+
+ bit_length = tlv_ptr.eigrp_tlv_ip_ext->plen;
+ if (bit_length < 0 || bit_length > 32) {
+ printf("\n\t illegal prefix length %u",bit_length);
+ break;
+ }
+ byte_length = (bit_length + 7) / 8; /* variable length encoding */
+ memset(prefix, 0, 4);
+ memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_ext->destination,byte_length);
+
+ printf("\n\t IPv4 prefix: %15s/%u, nexthop: ",
+ ipaddr_string(prefix),
+ bit_length);
+ if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
+ printf("self");
+ else
+ printf("%s",ipaddr_string(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop)));
+
+ printf("\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
+ ipaddr_string(tlv_ptr.eigrp_tlv_ip_ext->origin_router),
+ EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
+ tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id),
+ tlv_ptr.eigrp_tlv_ip_ext->flags,
+ EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag),
+ EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric));
+
+ printf("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
+ (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
+ EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
+ EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu),
+ tlv_ptr.eigrp_tlv_ip_ext->hopcount,
+ tlv_ptr.eigrp_tlv_ip_ext->reliability,
+ tlv_ptr.eigrp_tlv_ip_ext->load);
+ break;
+
+ case EIGRP_TLV_AT_CABLE_SETUP:
+ tlv_ptr.eigrp_tlv_at_cable_setup = (const struct eigrp_tlv_at_cable_setup_t *)tlv_tptr;
+
+ printf("\n\t Cable-range: %u-%u, Router-ID %u",
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
+ EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id));
+ break;
+
+ case EIGRP_TLV_AT_INT:
+ tlv_ptr.eigrp_tlv_at_int = (const struct eigrp_tlv_at_int_t *)tlv_tptr;
+
+ printf("\n\t Cable-Range: %u-%u, nexthop: ",
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start),
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end));
+
+ if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
+ printf("self");
+ else
+ printf("%u.%u",
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop),
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2]));
+
+ printf("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
+ (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100),
+ EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth),
+ EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu),
+ tlv_ptr.eigrp_tlv_at_int->hopcount,
+ tlv_ptr.eigrp_tlv_at_int->reliability,
+ tlv_ptr.eigrp_tlv_at_int->load);
+ break;
+
+ case EIGRP_TLV_AT_EXT:
+ tlv_ptr.eigrp_tlv_at_ext = (const struct eigrp_tlv_at_ext_t *)tlv_tptr;
+
+ printf("\n\t Cable-Range: %u-%u, nexthop: ",
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start),
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end));
+
+ if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
+ printf("self");
+ else
+ printf("%u.%u",
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop),
+ EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2]));
+
+ printf("\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
+ EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router),
+ EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as),
+ tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_at_ext->proto_id),
+ tlv_ptr.eigrp_tlv_at_ext->flags,
+ EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag),
+ EXTRACT_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric));
+
+ printf("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
+ (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100),
+ EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth),
+ EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu),
+ tlv_ptr.eigrp_tlv_at_ext->hopcount,
+ tlv_ptr.eigrp_tlv_at_ext->reliability,
+ tlv_ptr.eigrp_tlv_at_ext->load);
+ break;
+
+ /*
+ * FIXME those are the defined TLVs that lack a decoder
+ * you are welcome to contribute code ;-)
+ */
+
+ case EIGRP_TLV_AUTH:
+ case EIGRP_TLV_SEQ:
+ case EIGRP_TLV_MCAST_SEQ:
+ case EIGRP_TLV_IPX_INT:
+ case EIGRP_TLV_IPX_EXT:
+
+ default:
+ if (vflag <= 1)
+ print_unknown_data(tlv_tptr,"\n\t ",tlv_tlen);
+ break;
+ }
+ /* do we want to see an additionally hexdump ? */
+ if (vflag > 1)
+ print_unknown_data(tptr+sizeof(sizeof(struct eigrp_tlv_header)),"\n\t ",
+ eigrp_tlv_len-sizeof(struct eigrp_tlv_header));
+
+ tptr+=eigrp_tlv_len;
+ tlen-=eigrp_tlv_len;
+ }
+ return;
+trunc:
+ printf("\n\t\t packet exceeded snapshot");
+}
diff --git a/contrib/tcpdump/print-enc.c b/contrib/tcpdump/print-enc.c
index c7196e7d22e3..f9b871b351d8 100644
--- a/contrib/tcpdump/print-enc.c
+++ b/contrib/tcpdump/print-enc.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.1.2.2 2003/11/16 08:51:19 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4 2005/04/06 21:32:39 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -71,8 +71,16 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
length -= ENC_HDRLEN;
/* XXX - use the address family */
- ip_print(p + ENC_HDRLEN, length);
+ ip_print(gndo, p + ENC_HDRLEN, length);
out:
return (ENC_HDRLEN);
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-esp.c b/contrib/tcpdump/print-esp.c
index 0ca0cfa649cc..bf125eb09398 100644
--- a/contrib/tcpdump/print-esp.c
+++ b/contrib/tcpdump/print-esp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.44.2.4 2003/11/19 05:36:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.55 2004/07/21 22:00:11 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -50,11 +50,7 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
-#if defined(__MINGW32__) || defined(__WATCOMC__)
-extern char *strsep(char **stringp, const char *delim); /* Missing/strsep.c */
-#endif
-
-#include "interface.h"
+#include "netdissect.h"
#include "addrtoname.h"
#include "extract.h"
@@ -83,10 +79,8 @@ struct sa_list {
int secretlen;
};
-static struct sa_list *sa_list_head = NULL;
-static struct sa_list *sa_default = NULL;
-
-static void esp_print_addsa(struct sa_list *sa, int sa_def)
+static void esp_print_addsa(netdissect_options *ndo,
+ struct sa_list *sa, int sa_def)
{
/* copy the "sa" */
@@ -94,19 +88,19 @@ static void esp_print_addsa(struct sa_list *sa, int sa_def)
nsa = (struct sa_list *)malloc(sizeof(struct sa_list));
if (nsa == NULL)
- error("ran out of memory to allocate sa structure");
+ (*ndo->ndo_error)(ndo, "ran out of memory to allocate sa structure");
*nsa = *sa;
if (sa_def)
- sa_default = nsa;
+ ndo->ndo_sa_default = nsa;
- nsa->next = sa_list_head;
- sa_list_head = nsa;
+ nsa->next = ndo->ndo_sa_list_head;
+ ndo->ndo_sa_list_head = nsa;
}
-static int hexdigit(char hex)
+static int hexdigit(netdissect_options *ndo, char hex)
{
if (hex >= '0' && hex <= '9')
return (hex - '0');
@@ -115,16 +109,16 @@ static int hexdigit(char hex)
else if (hex >= 'a' && hex <= 'f')
return (hex - 'a' + 10);
else {
- printf("invalid hex digit %c in espsecret\n", hex);
+ (*ndo->ndo_error)(ndo, "invalid hex digit %c in espsecret\n", hex);
return 0;
}
}
-static int hex2byte(char *hexstring)
+static int hex2byte(netdissect_options *ndo, char *hexstring)
{
int byte;
- byte = (hexdigit(hexstring[0]) << 4) + hexdigit(hexstring[1]);
+ byte = (hexdigit(ndo, hexstring[0]) << 4) + hexdigit(ndo, hexstring[1]);
return byte;
}
@@ -135,7 +129,7 @@ static int hex2byte(char *hexstring)
* causes us to go read from this file instead.
*
*/
-static void esp_print_decode_onesecret(char *line)
+static void esp_print_decode_onesecret(netdissect_options *ndo, char *line)
{
struct sa_list sa1;
int sa_def;
@@ -177,7 +171,7 @@ static void esp_print_decode_onesecret(char *line)
if (fileline[0] == '#') continue;
if (fileline[0] == '\0') continue;
- esp_print_decode_onesecret(fileline);
+ esp_print_decode_onesecret(ndo, fileline);
}
fclose(secretfile);
@@ -196,7 +190,7 @@ static void esp_print_decode_onesecret(char *line)
spino = strtoul(spistr, &foo, 0);
if (spistr == foo || !spikey) {
- printf("print_esp: failed to decode spi# %s\n", foo);
+ (*ndo->ndo_warning)(ndo, "print_esp: failed to decode spi# %s\n", foo);
return;
}
@@ -218,7 +212,7 @@ static void esp_print_decode_onesecret(char *line)
#endif
sin->sin_family = AF_INET;
} else {
- printf("print_esp: can not decode IP# %s\n", spikey);
+ (*ndo->ndo_warning)(ndo, "print_esp: can not decode IP# %s\n", spikey);
return;
}
}
@@ -229,7 +223,6 @@ static void esp_print_decode_onesecret(char *line)
int len;
size_t i;
const EVP_CIPHER *evp;
- int ivlen = 8;
int authlen = 0;
/* skip any blank spaces */
@@ -238,7 +231,7 @@ static void esp_print_decode_onesecret(char *line)
colon = strchr(decode, ':');
if (colon == NULL) {
- printf("failed to decode espsecret: %s\n", decode);
+ (*ndo->ndo_warning)(ndo, "failed to decode espsecret: %s\n", decode);
return;
}
*colon = '\0';
@@ -258,7 +251,7 @@ static void esp_print_decode_onesecret(char *line)
}
evp = EVP_get_cipherbyname(decode);
if (!evp) {
- printf("failed to find cipher algo %s\n", decode);
+ (*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
sa1.evp = NULL;
sa1.authlen = 0;
sa1.ivlen = 0;
@@ -267,7 +260,7 @@ static void esp_print_decode_onesecret(char *line)
sa1.evp = evp;
sa1.authlen = authlen;
- sa1.ivlen = ivlen;
+ sa1.ivlen = EVP_CIPHER_iv_length(evp);
colon++;
if (colon[0] == '0' && colon[1] == 'x') {
@@ -276,13 +269,13 @@ static void esp_print_decode_onesecret(char *line)
len = strlen(colon) / 2;
if (len > 256) {
- printf("secret is too big: %d\n", len);
+ (*ndo->ndo_warning)(ndo, "secret is too big: %d\n", len);
return;
}
i = 0;
while (colon[0] != '\0' && colon[1]!='\0') {
- espsecret_key[i] = hex2byte(colon);
+ espsecret_key[i] = hex2byte(ndo, colon);
colon += 2;
i++;
}
@@ -302,28 +295,28 @@ static void esp_print_decode_onesecret(char *line)
}
}
- esp_print_addsa(&sa1, sa_def);
+ esp_print_addsa(ndo, &sa1, sa_def);
}
-static void esp_print_decodesecret(void)
+static void esp_print_decodesecret(netdissect_options *ndo)
{
char *line;
char *p;
- p = espsecret;
+ p = ndo->ndo_espsecret;
- while (espsecret && espsecret[0] != '\0') {
+ while (ndo->ndo_espsecret && ndo->ndo_espsecret[0] != '\0') {
/* pick out the first line or first thing until a comma */
- if ((line = strsep(&espsecret, "\n,")) == NULL) {
- line = espsecret;
- espsecret = NULL;
+ if ((line = strsep(&ndo->ndo_espsecret, "\n,")) == NULL) {
+ line = ndo->ndo_espsecret;
+ ndo->ndo_espsecret = NULL;
}
- esp_print_decode_onesecret(line);
+ esp_print_decode_onesecret(ndo, line);
}
}
-static void esp_init(void)
+static void esp_init(netdissect_options *ndo _U_)
{
OpenSSL_add_all_algorithms();
@@ -332,7 +325,8 @@ static void esp_init(void)
#endif
int
-esp_print(const u_char *bp, const u_char *bp2
+esp_print(netdissect_options *ndo,
+ const u_char *bp, const int length, const u_char *bp2
#ifndef HAVE_LIBCRYPTO
_U_
#endif
@@ -362,7 +356,7 @@ esp_print(const u_char *bp, const u_char *bp2
char *secret;
int ivlen = 0;
u_char *ivoff;
- const u_char *p;
+ u_char *p;
EVP_CIPHER_CTX ctx;
int blocksz;
static int initialized = 0;
@@ -375,7 +369,7 @@ esp_print(const u_char *bp, const u_char *bp2
advance = 0;
if (!initialized) {
- esp_init();
+ esp_init(ndo);
initialized = 1;
}
#endif
@@ -386,28 +380,28 @@ esp_print(const u_char *bp, const u_char *bp2
#endif
/* 'ep' points to the end of available data. */
- ep = snapend;
+ ep = ndo->ndo_snapend;
if ((u_char *)(esp + 1) >= ep) {
fputs("[|ESP]", stdout);
goto fail;
}
- printf("ESP(spi=0x%08x", EXTRACT_32BITS(&esp->esp_spi));
- printf(",seq=0x%x", EXTRACT_32BITS(&esp->esp_seq));
- printf(")");
+ (*ndo->ndo_printf)(ndo, "ESP(spi=0x%08x", EXTRACT_32BITS(&esp->esp_spi));
+ (*ndo->ndo_printf)(ndo, ",seq=0x%x)", EXTRACT_32BITS(&esp->esp_seq));
+ (*ndo->ndo_printf)(ndo, ", length %u", length);
#ifndef HAVE_LIBCRYPTO
goto fail;
#else
/* initiailize SAs */
- if (sa_list_head == NULL) {
- if (!espsecret)
+ if (ndo->ndo_sa_list_head == NULL) {
+ if (!ndo->ndo_espsecret)
goto fail;
- esp_print_decodesecret();
+ esp_print_decodesecret(ndo);
}
- if (sa_list_head == NULL)
+ if (ndo->ndo_sa_list_head == NULL)
goto fail;
ip = (struct ip *)bp2;
@@ -422,7 +416,7 @@ esp_print(const u_char *bp, const u_char *bp2
len = sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen);
/* see if we can find the SA, and if so, decode it */
- for (sa = sa_list_head; sa != NULL; sa = sa->next) {
+ for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa->daddr;
if (sa->spi == ntohl(esp->esp_spi) &&
sin6->sin6_family == AF_INET6 &&
@@ -440,7 +434,7 @@ esp_print(const u_char *bp, const u_char *bp2
len = EXTRACT_16BITS(&ip->ip_len);
/* see if we can find the SA, and if so, decode it */
- for (sa = sa_list_head; sa != NULL; sa = sa->next) {
+ for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
struct sockaddr_in *sin = (struct sockaddr_in *)&sa->daddr;
if (sa->spi == ntohl(esp->esp_spi) &&
sin->sin_family == AF_INET &&
@@ -457,7 +451,7 @@ esp_print(const u_char *bp, const u_char *bp2
* an unspecified one.
*/
if (sa == NULL)
- sa = sa_default;
+ sa = ndo->ndo_sa_default;
/* if not found fail */
if (sa == NULL)
@@ -475,11 +469,12 @@ esp_print(const u_char *bp, const u_char *bp2
ivlen = sa->ivlen;
secret = sa->secret;
espsecret_keylen = sa->secretlen;
+ ep = ep - sa->authlen;
if (sa->evp) {
memset(&ctx, 0, sizeof(ctx));
if (EVP_CipherInit(&ctx, sa->evp, secret, NULL, 0) < 0)
- printf("espkey init failed");
+ (*ndo->ndo_warning)(ndo, "espkey init failed");
blocksz = EVP_CIPHER_CTX_block_size(&ctx);
@@ -490,7 +485,6 @@ esp_print(const u_char *bp, const u_char *bp2
} else
advance = sizeof(struct newesp);
- ep = ep - sa->authlen;
/* sanity check for pad length */
if (ep - bp < *(ep - 2))
goto fail;
@@ -501,10 +495,17 @@ esp_print(const u_char *bp, const u_char *bp2
if (nhdr)
*nhdr = *(ep - 1);
- printf(": ");
+ (ndo->ndo_printf)(ndo, ": ");
return advance;
#endif
fail:
return -1;
}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-ether.c b/contrib/tcpdump/print-ether.c
index 20d7d81d99e7..2a33a12f5e48 100644
--- a/contrib/tcpdump/print-ether.c
+++ b/contrib/tcpdump/print-ether.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.82.2.3 2003/12/29 22:42:21 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95 2005/04/06 21:32:39 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -37,10 +37,24 @@ static const char rcsid[] _U_ =
#include "ethertype.h"
#include "ether.h"
-
-const u_char *snapend;
+#include "llc.h"
const struct tok ethertype_values[] = {
+ /* not really ethertypes but PIDs that are used
+ in the SNAP printer - its more convenient
+ to put them into a single tokentable */
+ { PID_RFC2684_ETH_FCS, "Ethernet + FCS" },
+ { PID_RFC2684_ETH_NOFCS, "Ethernet no FCS" },
+ { PID_RFC2684_802_4_FCS, "802.4 + FCS" },
+ { PID_RFC2684_802_4_NOFCS, "w/o FCS" },
+ { PID_RFC2684_802_5_FCS, "Tokenring + FCS" },
+ { PID_RFC2684_802_5_NOFCS, "Tokenring no FCS" },
+ { PID_RFC2684_FDDI_FCS, "FDDI + FCS" },
+ { PID_RFC2684_FDDI_NOFCS, "FDDI no FCS" },
+ { PID_RFC2684_802_6_FCS, "802.6 + FCS" },
+ { PID_RFC2684_802_6_NOFCS, "802.6 no FCS" },
+ { PID_RFC2684_BPDU, "BPDU" },
+ /* the real Ethertypes */
{ ETHERTYPE_IP, "IPv4" },
{ ETHERTYPE_MPLS, "MPLS unicast" },
{ ETHERTYPE_MPLS_MULTI, "MPLS multicast" },
@@ -69,7 +83,11 @@ const struct tok ethertype_values[] = {
{ ETHERTYPE_PPP, "PPP" },
{ ETHERTYPE_PPPOED, "PPPoE D" },
{ ETHERTYPE_PPPOES, "PPPoE S" },
+ { ETHERTYPE_EAPOL, "EAPOL" },
+ { ETHERTYPE_JUMBO, "Jumbo" },
{ ETHERTYPE_LOOPBACK, "Loopback" },
+ { ETHERTYPE_ISO, "OSI" },
+ { ETHERTYPE_GRE_ISO, "GRE-OSI" },
{ 0, NULL}
};
@@ -151,7 +169,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
/*
* This is the top level routine of the printer. 'p' points
* to the ether header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
@@ -184,7 +202,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
switch (ether_type) {
case ETHERTYPE_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
return (1);
#ifdef INET6
@@ -195,7 +213,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
case ETHERTYPE_ARP:
case ETHERTYPE_REVARP:
- arp_print(p, length, caplen);
+ arp_print(gndo, p, length, caplen);
return (1);
case ETHERTYPE_DN:
@@ -248,11 +266,44 @@ ether_encap_print(u_short ether_type, const u_char *p,
return (1);
+ case ETHERTYPE_JUMBO:
+ ether_type = ntohs(*(u_int16_t *)(p));
+ p += 2;
+ length -= 2;
+ caplen -= 2;
+
+ if (ether_type > ETHERMTU) {
+ if (eflag)
+ printf("ethertype %s, ",
+ tok2str(ethertype_values,"0x%04x", ether_type));
+ goto recurse;
+ }
+
+ *extracted_ether_type = 0;
+
+ if (llc_print(p, length, caplen, p - 16, p - 10,
+ extracted_ether_type) == 0) {
+ ether_hdr_print(p - 16, length + 2);
+ }
+
+ if (!xflag && !qflag)
+ default_print(p - 16, caplen + 2);
+
+ return (1);
+
+ case ETHERTYPE_ISO:
+ isoclns_print(p+1, length-1, length-1);
+ return(1);
+
case ETHERTYPE_PPPOED:
case ETHERTYPE_PPPOES:
pppoe_print(p, length);
return (1);
+ case ETHERTYPE_EAPOL:
+ eap_print(gndo, p, length);
+ return (1);
+
case ETHERTYPE_PPP:
if (length) {
printf(": ");
@@ -277,3 +328,12 @@ ether_encap_print(u_short ether_type, const u_char *p,
return (0);
}
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
+
diff --git a/contrib/tcpdump/print-fddi.c b/contrib/tcpdump/print-fddi.c
index cf6c1ccfc903..d4112e17dbd5 100644
--- a/contrib/tcpdump/print-fddi.c
+++ b/contrib/tcpdump/print-fddi.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.61.2.2 2003/11/16 08:51:20 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64 2004/03/17 23:24:37 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -298,7 +298,7 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
/*
* This is the top level routine of the printer. 'p' points
* to the FDDI header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
diff --git a/contrib/tcpdump/print-fr.c b/contrib/tcpdump/print-fr.c
index 0239e0c5187c..cc0f6ecbc692 100644
--- a/contrib/tcpdump/print-fr.c
+++ b/contrib/tcpdump/print-fr.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.17.2.3 2003/12/15 03:37:45 guy Exp $ (LBL)";
+ "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32 2005/04/06 21:32:39 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -37,50 +37,66 @@ static const char rcsid[] _U_ =
#include "addrtoname.h"
#include "interface.h"
#include "ethertype.h"
+#include "nlpid.h"
#include "extract.h"
+#include "oui.h"
-static void lmi_print(const u_char *, u_int);
+static void frf15_print(const u_char *, u_int);
-#define NLPID_LMI 0x08 /* ANSI T1.617 Annex D or ITU-T Q.933 Annex A */
-#define NLPID_CISCO_LMI 0x09 /* The original, aka Cisco, aka Gang of Four */
-#define NLPID_SNAP 0x80
-#define NLPID_CLNP 0x81
-#define NLPID_ESIS 0x82
-#define NLPID_ISIS 0x83
-#define NLPID_CONS 0x84
-#define NLPID_IDRP 0x85
-#define NLPID_X25_ESIS 0x8a
-#define NLPID_IPV6 0x8e
-#define NLPID_IP 0xcc
+/*
+ * the frame relay header has a variable length
+ *
+ * the EA bit determines if there is another byte
+ * in the header
+ *
+ * minimum header length is 2 bytes
+ * maximum header length is 4 bytes
+ *
+ * 7 6 5 4 3 2 1 0
+ * +----+----+----+----+----+----+----+----+
+ * | DLCI (6 bits) | CR | EA |
+ * +----+----+----+----+----+----+----+----+
+ * | DLCI (4 bits) |FECN|BECN| DE | EA |
+ * +----+----+----+----+----+----+----+----+
+ * | DLCI (7 bits) | EA |
+ * +----+----+----+----+----+----+----+----+
+ * | DLCI (6 bits) |SDLC| EA |
+ * +----+----+----+----+----+----+----+----+
+ */
#define FR_EA_BIT 0x01
+#define FR_CR_BIT 0x02000000
+#define FR_DE_BIT 0x00020000
+#define FR_BECN_BIT 0x00040000
+#define FR_FECN_BIT 0x00080000
+#define FR_SDLC_BIT 0x00000002
-/* Finds out Q.922 address length, DLCI and flags. Returns 0 on success */
-static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *addr_len,
- char **flags_ptr)
-{
- static char flags[32];
- size_t len;
+struct tok fr_header_flag_values[] = {
+ { FR_CR_BIT, "C!" },
+ { FR_DE_BIT, "DE" },
+ { FR_BECN_BIT, "BECN" },
+ { FR_FECN_BIT, "FECN" },
+ { FR_SDLC_BIT, "sdlcore" },
+ { 0, NULL }
+};
+
+
+/* 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,
+ u_int *addr_len, u_int8_t *flags)
+{
if ((p[0] & FR_EA_BIT))
return -1;
- *flags_ptr = flags;
*addr_len = 2;
*dlci = ((p[0] & 0xFC) << 2) | ((p[1] & 0xF0) >> 4);
- strcpy(flags, (p[0] & 0x02) ? "C!, " : "");
- if (p[1] & 0x08)
- strcat(flags, "FECN, ");
- if (p[1] & 0x04)
- strcat(flags, "BECN, ");
- if (p[1] & 0x02)
- strcat(flags, "DE, ");
-
- len = strlen(flags);
- if (len > 1)
- flags[len - 2] = '\x0'; /* delete trailing comma and space */
+ flags[0] = p[0] & 0x02; /* populate the first flag fields */
+ flags[1] = p[1] & 0x0c;
if (p[1] & FR_EA_BIT)
return 0; /* 2-byte Q.922 address */
@@ -96,42 +112,16 @@ static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *addr_len,
if ((p[0] & FR_EA_BIT) == 0)
return -1; /* more than 4 bytes of Q.922 address? */
- if (p[0] & 0x02) {
- len = strlen(flags);
- snprintf(flags + len, sizeof(flags) - len,
- "%sdlcore %x", len ? ", " : "", p[0] >> 2);
- } else
+ flags[3] = p[0] & 0x02;
+
+ if (p[0] & 0x02)
+ *sdlcore = p[0] >> 2;
+ else
*dlci = (*dlci << 6) | (p[0] >> 2);
return 0;
}
-
-static const char *fr_nlpids[256];
-
-static void
-init_fr_nlpids(void)
-{
- int i;
- static int fr_nlpid_flag = 0;
-
- if (!fr_nlpid_flag) {
- for (i=0; i < 256; i++)
- fr_nlpids[i] = NULL;
- fr_nlpids[NLPID_LMI] = "LMI";
- fr_nlpids[NLPID_CISCO_LMI] = "Cisco LMI";
- fr_nlpids[NLPID_SNAP] = "SNAP";
- fr_nlpids[NLPID_CLNP] = "CLNP";
- fr_nlpids[NLPID_ESIS] = "ESIS";
- fr_nlpids[NLPID_ISIS] = "ISIS";
- fr_nlpids[NLPID_CONS] = "CONS";
- fr_nlpids[NLPID_IDRP] = "IDRP";
- fr_nlpids[NLPID_X25_ESIS] = "X25_ESIS";
- fr_nlpids[NLPID_IP] = "IP";
- }
- fr_nlpid_flag = 1;
-}
-
/* Frame Relay packet structure, with flags and CRC removed
+---------------------------+
@@ -168,30 +158,31 @@ fr_hdrlen(const u_char *p, u_int addr_len, u_int caplen)
return addr_len + 1 /* UI */ + 1 /* NLPID */;
}
-static const char *
-fr_protostring(u_int8_t proto)
-{
- static char buf[5+1+2+1];
-
- init_fr_nlpids();
-
- if (nflag || fr_nlpids[proto] == NULL) {
- snprintf(buf, sizeof(buf), "proto %02x", proto);
- return buf;
- }
- return fr_nlpids[proto];
-}
-
static void
-fr_hdr_print(int length, u_int dlci, char *flags, u_char nlpid)
+fr_hdr_print(int length, u_int addr_len, u_int dlci, u_int8_t *flags, u_int16_t nlpid)
{
- if (qflag)
- (void)printf("DLCI %u, %s%slength %d: ",
- dlci, flags, *flags ? ", " : "", length);
- else
- (void)printf("DLCI %u, %s%s%s, length %d: ",
- dlci, flags, *flags ? ", " : "",
- fr_protostring(nlpid), length);
+ if (qflag) {
+ (void)printf("Q.922, DLCI %u, length %u: ",
+ dlci,
+ length);
+ } else {
+ if (nlpid <= 0xff) /* if its smaller than 256 then its a NLPID */
+ (void)printf("Q.922, hdr-len %u, DLCI %u, Flags [%s], NLPID %s (0x%02x), length %u: ",
+ addr_len,
+ dlci,
+ bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)),
+ tok2str(nlpid_values,"unknown", nlpid),
+ nlpid,
+ length);
+ else /* must be an ethertype */
+ (void)printf("Q.922, hdr-len %u, DLCI %u, Flags [%s], cisco-ethertype %s (0x%04x), length %u: ",
+ addr_len,
+ dlci,
+ bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)),
+ tok2str(ethertype_values, "unknown", nlpid),
+ nlpid,
+ length);
+ }
}
u_int
@@ -199,22 +190,23 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
{
register u_int length = h->len;
register u_int caplen = h->caplen;
- u_short extracted_ethertype;
+ u_int16_t extracted_ethertype;
u_int32_t orgcode;
register u_short et;
u_int dlci;
- int addr_len;
- u_char nlpid;
+ u_int sdlcore;
+ u_int addr_len;
+ u_int16_t nlpid;
u_int hdr_len;
- char *flags;
+ u_int8_t flags[4];
if (caplen < 4) { /* minimum frame header length */
printf("[|fr]");
return caplen;
}
- if (parse_q922_addr(p, &dlci, &addr_len, &flags)) {
- printf("Invalid Q.922 address");
+ if (parse_q922_addr(p, &dlci, &sdlcore, &addr_len, flags)) {
+ printf("Q.922, invalid address");
return caplen;
}
@@ -225,8 +217,24 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
return caplen;
}
- if (p[addr_len] != 0x03)
- printf("UI %02x! ", p[addr_len]);
+ if (p[addr_len] != 0x03 && dlci != 0) {
+
+ /* lets figure out if we have cisco style encapsulation: */
+ extracted_ethertype = EXTRACT_16BITS(p+addr_len);
+
+ if (eflag)
+ fr_hdr_print(length, addr_len, dlci, flags, extracted_ethertype);
+
+ if (ether_encap_print(extracted_ethertype,
+ p+addr_len+ETHERTYPE_LEN,
+ length-addr_len-ETHERTYPE_LEN,
+ caplen-addr_len-ETHERTYPE_LEN,
+ &extracted_ethertype) == 0)
+ /* ether_type not known, probably it wasn't one */
+ printf("UI %02x! ", p[addr_len]);
+ else
+ return hdr_len;
+ }
if (!p[addr_len + 1]) { /* pad byte should be used with 3-byte Q.922 */
if (addr_len != 3)
@@ -236,55 +244,63 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
nlpid = p[hdr_len - 1];
+ if (eflag)
+ fr_hdr_print(length, addr_len, dlci, flags, nlpid);
+
p += hdr_len;
length -= hdr_len;
caplen -= hdr_len;
- if (eflag)
- fr_hdr_print(length, dlci, flags, nlpid);
-
switch (nlpid) {
case NLPID_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
- case NLPID_IPV6:
+ case NLPID_IP6:
ip6_print(p, length);
break;
#endif
case NLPID_CLNP:
case NLPID_ESIS:
case NLPID_ISIS:
- isoclns_print(p, length, caplen);
+ isoclns_print(p-1, length+1, caplen+1); /* OSI printers need the NLPID field */
break;
case NLPID_SNAP:
orgcode = EXTRACT_24BITS(p);
et = EXTRACT_16BITS(p + 3);
+
+ if (eflag)
+ (void)printf("SNAP, oui %s (0x%06x), ethertype %s (0x%04x): ",
+ tok2str(oui_values,"Unknown",orgcode),
+ orgcode,
+ tok2str(ethertype_values,"Unknown", et),
+ et);
+
if (snap_print((const u_char *)(p + 5), length - 5,
caplen - 5, &extracted_ethertype, orgcode, et,
0) == 0) {
/* ether_type not known, print raw packet */
- if (!eflag)
- fr_hdr_print(length + hdr_len,
- dlci, flags, nlpid);
- if (extracted_ethertype) {
- printf("(SNAP %s) ",
- etherproto_string(htons(extracted_ethertype)));
- }
+ if (!eflag)
+ fr_hdr_print(length + hdr_len, hdr_len,
+ dlci, flags, nlpid);
if (!xflag && !qflag)
- default_print(p - hdr_len, caplen + hdr_len);
+ default_print(p - hdr_len, caplen + hdr_len);
}
break;
- case NLPID_LMI:
- lmi_print(p, length);
+ case NLPID_Q933:
+ q933_print(p, length);
break;
+ case NLPID_MFR:
+ frf15_print(p, length);
+ break;
+
default:
if (!eflag)
- fr_hdr_print(length + hdr_len,
+ fr_hdr_print(length + hdr_len, addr_len,
dlci, flags, nlpid);
if (!xflag)
default_print(p, caplen);
@@ -293,6 +309,55 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
return hdr_len;
}
+/* an NLPID of 0xb1 indicates a 2-byte
+ * FRF.15 header
+ *
+ * 7 6 5 4 3 2 1 0
+ * +----+----+----+----+----+----+----+----+
+ * ~ Q.922 header ~
+ * +----+----+----+----+----+----+----+----+
+ * | NLPID (8 bits) | NLPID=0xb1
+ * +----+----+----+----+----+----+----+----+
+ * | B | E | C |seq. (high 4 bits) | R |
+ * +----+----+----+----+----+----+----+----+
+ * | sequence (low 8 bits) |
+ * +----+----+----+----+----+----+----+----+
+ */
+
+struct tok frf15_flag_values[] = {
+ { 0x80, "Begin" },
+ { 0x40, "End" },
+ { 0x20, "Control" },
+ { 0, NULL }
+};
+
+#define FR_FRF15_FRAGTYPE 0x01
+
+static void
+frf15_print (const u_char *p, u_int length) {
+
+ u_int16_t sequence_num, flags;
+
+ flags = p[0]&0xe0;
+ sequence_num = (p[0]&0x1e)<<7 | p[1];
+
+ printf("FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u",
+ sequence_num,
+ bittok2str(frf15_flag_values,"none",flags),
+ flags&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End",
+ length);
+
+/* TODO:
+ * depending on all permutations of the B, E and C bit
+ * dig as deep as we can - e.g. on the first (B) fragment
+ * there is enough payload to print the IP header
+ * on non (B) fragments it depends if the fragmentation
+ * model is end-to-end or interface based wether we want to print
+ * another Q.922 header
+ */
+
+}
+
/*
* Q.933 decoding portion for framerelay specific.
*/
@@ -340,148 +405,205 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
#define MSG_TYPE_STATUS 0x7D
#define MSG_TYPE_STATUS_ENQ 0x75
-#define MSG_ANSI_LOCKING_SHIFT 0x95
-#define ONE_BYTE_IE_MASK 0xF0 /* details? */
-
-#define ANSI_REPORT_TYPE_IE 0x01
-#define ANSI_LINK_VERIFY_IE_91 0x19 /* details? */
-#define ANSI_LINK_VERIFY_IE 0x03
-#define ANSI_PVC_STATUS_IE 0x07
+struct tok fr_q933_msg_values[] = {
+ { MSG_TYPE_ESC_TO_NATIONAL, "ESC to National" },
+ { MSG_TYPE_ALERT, "Alert" },
+ { MSG_TYPE_CALL_PROCEEDING, "Call proceeding" },
+ { MSG_TYPE_CONNECT, "Connect" },
+ { MSG_TYPE_CONNECT_ACK, "Connect ACK" },
+ { MSG_TYPE_PROGRESS, "Progress" },
+ { MSG_TYPE_SETUP, "Setup" },
+ { MSG_TYPE_DISCONNECT, "Disconnect" },
+ { MSG_TYPE_RELEASE, "Release" },
+ { MSG_TYPE_RELEASE_COMPLETE, "Release Complete" },
+ { MSG_TYPE_RESTART, "Restart" },
+ { MSG_TYPE_RESTART_ACK, "Restart ACK" },
+ { MSG_TYPE_STATUS, "Status Reply" },
+ { MSG_TYPE_STATUS_ENQ, "Status Enquiry" },
+ { 0, NULL }
+};
-#define CCITT_REPORT_TYPE_IE 0x51
-#define CCITT_LINK_VERIFY_IE 0x53
-#define CCITT_PVC_STATUS_IE 0x57
+#define MSG_ANSI_LOCKING_SHIFT 0x95
-struct common_ie_header {
- u_int8_t ie_id;
- u_int8_t ie_len;
+#define FR_LMI_ANSI_REPORT_TYPE_IE 0x01
+#define FR_LMI_ANSI_LINK_VERIFY_IE_91 0x19 /* details? */
+#define FR_LMI_ANSI_LINK_VERIFY_IE 0x03
+#define FR_LMI_ANSI_PVC_STATUS_IE 0x07
+
+#define FR_LMI_CCITT_REPORT_TYPE_IE 0x51
+#define FR_LMI_CCITT_LINK_VERIFY_IE 0x53
+#define FR_LMI_CCITT_PVC_STATUS_IE 0x57
+
+struct tok fr_q933_ie_values_codeset5[] = {
+ { FR_LMI_ANSI_REPORT_TYPE_IE, "ANSI Report Type" },
+ { FR_LMI_ANSI_LINK_VERIFY_IE_91, "ANSI Link Verify" },
+ { FR_LMI_ANSI_LINK_VERIFY_IE, "ANSI Link Verify" },
+ { FR_LMI_ANSI_PVC_STATUS_IE, "ANSI PVC Status" },
+ { FR_LMI_CCITT_REPORT_TYPE_IE, "CCITT Report Type" },
+ { FR_LMI_CCITT_LINK_VERIFY_IE, "CCITT Link Verify" },
+ { FR_LMI_CCITT_PVC_STATUS_IE, "CCITT PVC Status" },
+ { 0, NULL }
};
-#define FULL_STATUS 0
-#define LINK_VERIFY 1
-#define ASYNC_PVC 2
+#define FR_LMI_REPORT_TYPE_IE_FULL_STATUS 0
+#define FR_LMI_REPORT_TYPE_IE_LINK_VERIFY 1
+#define FR_LMI_REPORT_TYPE_IE_ASYNC_PVC 2
+struct tok fr_lmi_report_type_ie_values[] = {
+ { FR_LMI_REPORT_TYPE_IE_FULL_STATUS, "Full Status" },
+ { FR_LMI_REPORT_TYPE_IE_LINK_VERIFY, "Link verify" },
+ { FR_LMI_REPORT_TYPE_IE_ASYNC_PVC, "Async PVC Status" },
+ { 0, NULL }
+};
-/* Parses DLCI information element. */
-static const char * parse_dlci_ie(const u_char *p, u_int ie_len, char *buffer,
- size_t buffer_len)
-{
- u_int dlci;
+/* array of 16 codepages - currently we only support codepage 5 */
+static struct tok *fr_q933_ie_codesets[] = {
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ fr_q933_ie_values_codeset5,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
- if ((ie_len < 3) ||
- (p[0] & 0x80) ||
- ((ie_len == 3) && !(p[1] & 0x80)) ||
- ((ie_len == 4) && ((p[1] & 0x80) || !(p[2] & 0x80))) ||
- ((ie_len == 5) && ((p[1] & 0x80) || (p[2] & 0x80) ||
- !(p[3] & 0x80))) ||
- (ie_len > 5) ||
- !(p[ie_len - 1] & 0x80))
- return "Invalid DLCI IE";
-
- dlci = ((p[0] & 0x3F) << 4) | ((p[1] & 0x78) >> 3);
- if (ie_len == 4)
- dlci = (dlci << 6) | ((p[2] & 0x7E) >> 1);
- else if (ie_len == 5)
- dlci = (dlci << 13) | (p[2] & 0x7F) | ((p[3] & 0x7E) >> 1);
-
- snprintf(buffer, buffer_len, "DLCI %d: status %s%s", dlci,
- p[ie_len - 1] & 0x8 ? "New, " : "",
- p[ie_len - 1] & 0x2 ? "Active" : "Inactive");
-
- return buffer;
-}
+struct common_ie_header {
+ u_int8_t ie_id;
+ u_int8_t ie_len;
+};
-static void
-lmi_print(const u_char *p, u_int length)
+void
+q933_print(const u_char *p, u_int length)
{
const u_char *ptemp = p;
- const char *decode_str;
- char temp_str[255];
struct common_ie_header *ie_p;
+ int olen;
int is_ansi = 0;
+ u_int dlci,codeset;
if (length < 9) { /* shortest: Q.933a LINK VERIFY */
- printf("[|lmi]");
+ printf("[|q.933]");
return;
}
+ codeset = p[2]&0x0f; /* extract the codeset */
+
if (p[2] == MSG_ANSI_LOCKING_SHIFT)
is_ansi = 1;
- /* printing out header part */
- printf(is_ansi ? "ANSI" : "CCITT");
- if (p[0])
- printf(" Call Ref: %02x!", p[0]);
+ printf("%s", eflag ? "" : "Q.933, ");
- switch(p[1]) {
+ /* printing out header part */
+ printf(is_ansi ? "ANSI" : "CCITT ");
- case MSG_TYPE_STATUS:
- printf(" STATUS REPLY\n");
- break;
+ if (p[0])
+ printf(", Call Ref: 0x%02x", p[0]);
- case MSG_TYPE_STATUS_ENQ:
- printf(" STATUS ENQUIRY\n");
- break;
+ 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]));
- default:
- printf(" UNKNOWN MSG Type %02x\n", p[1]);
- break;
- }
+ olen = length; /* preserve the original length for non verbose mode */
if (length < (u_int)(2 - is_ansi)) {
- printf("[|lmi]");
+ printf("[|q.933]");
return;
}
length -= 2 - is_ansi;
ptemp += 2 + is_ansi;
/* Loop through the rest of IE */
- while (length > 0) {
+ while (length > sizeof(struct common_ie_header)) {
ie_p = (struct common_ie_header *)ptemp;
if (length < sizeof(struct common_ie_header) ||
length < sizeof(struct common_ie_header) + ie_p->ie_len) {
- printf("[|lmi]");
- return;
+ if (vflag) /* not bark if there is just a trailer */
+ printf("\n[|q.933]");
+ else
+ printf(", length %u",olen);
+ return;
}
- if ((is_ansi && ie_p->ie_id == ANSI_REPORT_TYPE_IE) ||
- (!is_ansi && ie_p->ie_id == CCITT_REPORT_TYPE_IE)) {
- switch(ptemp[2]) {
-
- case FULL_STATUS:
- decode_str = "FULL STATUS";
- break;
-
- case LINK_VERIFY:
- decode_str = "LINK VERIFY";
- break;
-
- case ASYNC_PVC:
- decode_str = "Async PVC Status";
- break;
-
- default:
- decode_str = "Reserved Value";
- break;
- }
- } else if ((is_ansi && (ie_p->ie_id == ANSI_LINK_VERIFY_IE_91 ||
- ie_p->ie_id == ANSI_LINK_VERIFY_IE)) ||
- (!is_ansi && ie_p->ie_id == CCITT_LINK_VERIFY_IE)) {
- snprintf(temp_str, sizeof(temp_str),
- "TX Seq: %3d, RX Seq: %3d",
- ptemp[2], ptemp[3]);
- decode_str = temp_str;
- } else if ((is_ansi && ie_p->ie_id == ANSI_PVC_STATUS_IE) ||
- (!is_ansi && ie_p->ie_id == CCITT_PVC_STATUS_IE)) {
- decode_str = parse_dlci_ie(ptemp + 2, ie_p->ie_len,
- temp_str, sizeof(temp_str));
- } else
- decode_str = "Non-decoded Value";
-
- printf("\t\tIE: %02X Len: %d, %s\n",
- ie_p->ie_id, ie_p->ie_len, decode_str);
+ /* 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)
+ printf("\n\t%s IE (%u), length %u: ",
+ tok2str(fr_q933_ie_codesets[codeset],"unknown",ie_p->ie_id),
+ ie_p->ie_id,
+ ie_p->ie_len);
+
+ switch (ie_p->ie_id) {
+
+ case FR_LMI_ANSI_REPORT_TYPE_IE: /* fall through */
+ case FR_LMI_CCITT_REPORT_TYPE_IE:
+ if (vflag)
+ printf("%s (%u)",
+ tok2str(fr_lmi_report_type_ie_values,"unknown",ptemp[2]),
+ ptemp[2]);
+ break;
+
+ 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)
+ printf(", ");
+ printf("TX Seq: %3d, RX Seq: %3d", ptemp[2], ptemp[3]);
+ break;
+ case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
+ case FR_LMI_CCITT_PVC_STATUS_IE:
+ if (!vflag)
+ printf(", ");
+ /* now parse the DLCI information element. */
+ if ((ie_p->ie_len < 3) ||
+ (ptemp[2] & 0x80) ||
+ ((ie_p->ie_len == 3) && !(ptemp[3] & 0x80)) ||
+ ((ie_p->ie_len == 4) && ((ptemp[3] & 0x80) || !(ptemp[4] & 0x80))) ||
+ ((ie_p->ie_len == 5) && ((ptemp[3] & 0x80) || (ptemp[4] & 0x80) ||
+ !(ptemp[5] & 0x80))) ||
+ (ie_p->ie_len > 5) ||
+ !(ptemp[ie_p->ie_len + 1] & 0x80))
+ printf("Invalid DLCI IE");
+
+ dlci = ((ptemp[2] & 0x3F) << 4) | ((ptemp[3] & 0x78) >> 3);
+ if (ie_p->ie_len == 4)
+ dlci = (dlci << 6) | ((ptemp[4] & 0x7E) >> 1);
+ else if (ie_p->ie_len == 5)
+ dlci = (dlci << 13) | (ptemp[4] & 0x7F) | ((ptemp[5] & 0x7E) >> 1);
+
+ printf("DLCI %u: status %s%s", dlci,
+ ptemp[ie_p->ie_len + 1] & 0x8 ? "New, " : "",
+ ptemp[ie_p->ie_len + 1] & 0x2 ? "Active" : "Inactive");
+ break;
+
+ default:
+ if (vflag <= 1)
+ print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len);
+ break;
+ }
+
+ /* do we want to see a hexdump of the IE ? */
+ if (vflag> 1)
+ 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)
+ printf(", length %u",olen);
}
diff --git a/contrib/tcpdump/print-frag6.c b/contrib/tcpdump/print-frag6.c
index 2356efbbb0c0..534c5c121183 100644
--- a/contrib/tcpdump/print-frag6.c
+++ b/contrib/tcpdump/print-frag6.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.16.2.3 2003/11/19 00:35:43 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.19 2003/11/19 00:36:07 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-gre.c b/contrib/tcpdump/print-gre.c
index 8657b5822924..d739356ac818 100644
--- a/contrib/tcpdump/print-gre.c
+++ b/contrib/tcpdump/print-gre.c
@@ -38,7 +38,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.22.2.2 2003/11/16 08:51:24 guy 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
@@ -55,6 +55,7 @@ static const char rcsid[] _U_ =
#include "extract.h"
#include "ip.h"
+#include "ethertype.h"
#define GRE_CP 0x8000 /* checksum present */
#define GRE_RP 0x4000 /* routing present */
@@ -63,11 +64,19 @@ static const char rcsid[] _U_ =
#define GRE_sP 0x0800 /* source routing */
#define GRE_RECRS 0x0700 /* recursion count */
#define GRE_AP 0x0080 /* acknowledgment# present */
-#define GRE_VERS 0x0007 /* protocol version */
-#define GREPROTO_IP 0x0800 /* IP */
-#define GREPROTO_PPP 0x880b /* PPTP */
-#define GREPROTO_ISO 0x00fe /* OSI */
+struct tok gre_flag_values[] = {
+ { GRE_CP, "checksum present"},
+ { GRE_RP, "routing present"},
+ { GRE_KP, "key present"},
+ { GRE_SP, "sequence# present"},
+ { GRE_sP, "source routing present"},
+ { GRE_RECRS, "recursion count"},
+ { GRE_AP, "ack present"},
+ { 0, NULL }
+};
+
+#define GRE_VERS_MASK 0x0007 /* protocol version */
/* source route entry types */
#define GRESRE_IP 0x0800 /* IP */
@@ -88,14 +97,20 @@ gre_print(const u_char *bp, u_int length)
printf("[|gre]");
return;
}
- vers = EXTRACT_16BITS(bp) & 7;
-
- if (vers == 0)
- gre_print_0(bp, len);
- else if (vers == 1)
- gre_print_1(bp, len);
- else
- printf("gre-unknown-version=%u", vers);
+ vers = EXTRACT_16BITS(bp) & GRE_VERS_MASK;
+ printf("GREv%u",vers);
+
+ switch(vers) {
+ case 0:
+ gre_print_0(bp, len);
+ break;
+ case 1:
+ gre_print_1(bp, len);
+ break;
+ default:
+ printf(" ERROR: unknown-version");
+ break;
+ }
return;
}
@@ -107,14 +122,9 @@ gre_print_0(const u_char *bp, u_int length)
u_int16_t flags, prot;
flags = EXTRACT_16BITS(bp);
- if (vflag) {
- printf("[%s%s%s%s%s] ",
- (flags & GRE_CP) ? "C" : "",
- (flags & GRE_RP) ? "R" : "",
- (flags & GRE_KP) ? "K" : "",
- (flags & GRE_SP) ? "S" : "",
- (flags & GRE_sP) ? "s" : "");
- }
+ if (vflag)
+ printf(", Flags [%s]",
+ bittok2str(gre_flag_values,"none",flags));
len -= 2;
bp += 2;
@@ -129,13 +139,13 @@ gre_print_0(const u_char *bp, u_int length)
if (len < 2)
goto trunc;
if (vflag)
- printf("sum 0x%x ", EXTRACT_16BITS(bp));
+ printf(", sum 0x%x", EXTRACT_16BITS(bp));
bp += 2;
len -= 2;
if (len < 2)
goto trunc;
- printf("off 0x%x ", EXTRACT_16BITS(bp));
+ printf(", off 0x%x", EXTRACT_16BITS(bp));
bp += 2;
len -= 2;
}
@@ -143,7 +153,7 @@ gre_print_0(const u_char *bp, u_int length)
if (flags & GRE_KP) {
if (len < 4)
goto trunc;
- printf("key=0x%x ", EXTRACT_32BITS(bp));
+ printf(", key=0x%x", EXTRACT_32BITS(bp));
bp += 4;
len -= 4;
}
@@ -151,7 +161,7 @@ gre_print_0(const u_char *bp, u_int length)
if (flags & GRE_SP) {
if (len < 4)
goto trunc;
- printf("seq %u ", EXTRACT_32BITS(bp));
+ printf(", seq %u", EXTRACT_32BITS(bp));
bp += 4;
len -= 4;
}
@@ -182,11 +192,37 @@ gre_print_0(const u_char *bp, u_int length)
}
}
+ if (eflag)
+ printf(", proto %s (0x%04x)",
+ tok2str(ethertype_values,"unknown",prot),
+ prot);
+
+ printf(", length %u",length);
+
+ if (vflag < 1)
+ printf(": "); /* put in a colon as protocol demarc */
+ else
+ printf("\n\t"); /* if verbose go multiline */
+
switch (prot) {
- case GREPROTO_IP:
- ip_print(bp, len);
+ case ETHERTYPE_IP:
+ ip_print(gndo, bp, len);
+ break;
+#ifdef INET6
+ case ETHERTYPE_IPV6:
+ ip6_print(bp, len);
break;
- case GREPROTO_ISO:
+#endif
+ case ETHERTYPE_MPLS:
+ mpls_print(bp, len);
+ break;
+ case ETHERTYPE_IPX:
+ ipx_print(bp, len);
+ break;
+ case ETHERTYPE_ATALK:
+ atalk_print(bp, len);
+ break;
+ case ETHERTYPE_GRE_ISO:
isoclns_print(bp, len, len);
break;
default:
@@ -208,15 +244,9 @@ gre_print_1(const u_char *bp, u_int length)
len -= 2;
bp += 2;
- if (vflag) {
- printf("[%s%s%s%s%s%s] ",
- (flags & GRE_CP) ? "C" : "",
- (flags & GRE_RP) ? "R" : "",
- (flags & GRE_KP) ? "K" : "",
- (flags & GRE_SP) ? "S" : "",
- (flags & GRE_sP) ? "s" : "",
- (flags & GRE_AP) ? "A" : "");
- }
+ if (vflag)
+ printf(", Flags [%s]",
+ bittok2str(gre_flag_values,"none",flags));
if (len < 2)
goto trunc;
@@ -224,22 +254,6 @@ gre_print_1(const u_char *bp, u_int length)
len -= 2;
bp += 2;
- if (flags & GRE_CP) {
- printf("cpset!");
- return;
- }
- if (flags & GRE_RP) {
- printf("rpset!");
- return;
- }
- if ((flags & GRE_KP) == 0) {
- printf("kpunset!");
- return;
- }
- if (flags & GRE_sP) {
- printf("spset!");
- return;
- }
if (flags & GRE_KP) {
u_int32_t k;
@@ -247,7 +261,7 @@ gre_print_1(const u_char *bp, u_int length)
if (len < 4)
goto trunc;
k = EXTRACT_32BITS(bp);
- printf("call %d ", k & 0xffff);
+ printf(", call %d", k & 0xffff);
len -= 4;
bp += 4;
}
@@ -255,7 +269,7 @@ gre_print_1(const u_char *bp, u_int length)
if (flags & GRE_SP) {
if (len < 4)
goto trunc;
- printf("seq %u ", EXTRACT_32BITS(bp));
+ printf(", seq %u", EXTRACT_32BITS(bp));
bp += 4;
len -= 4;
}
@@ -263,19 +277,32 @@ gre_print_1(const u_char *bp, u_int length)
if (flags & GRE_AP) {
if (len < 4)
goto trunc;
- printf("ack %u ", EXTRACT_32BITS(bp));
+ printf(", ack %u", EXTRACT_32BITS(bp));
bp += 4;
len -= 4;
}
- if ((flags & GRE_SP) == 0) {
- printf("no-payload");
- return;
- }
+ if ((flags & GRE_SP) == 0)
+ printf(", no-payload");
+
+ if (eflag)
+ printf(", proto %s (0x%04x)",
+ tok2str(ethertype_values,"unknown",prot),
+ prot);
+
+ printf(", length %u",length);
+
+ if ((flags & GRE_SP) == 0)
+ return;
+
+ if (vflag < 1)
+ printf(": "); /* put in a colon as protocol demarc */
+ else
+ printf("\n\t"); /* if verbose go multiline */
switch (prot) {
- case GREPROTO_PPP:
- printf("gre-ppp-payload");
+ case ETHERTYPE_PPP:
+ ppp_print(bp, len);
break;
default:
printf("gre-proto-0x%x", prot);
@@ -293,17 +320,17 @@ gre_sre_print(u_int16_t af, u_int8_t sreoff, u_int8_t srelen,
{
switch (af) {
case GRESRE_IP:
- printf("(rtaf=ip");
+ printf(", (rtaf=ip");
gre_sre_ip_print(sreoff, srelen, bp, len);
printf(") ");
break;
case GRESRE_ASN:
- printf("(rtaf=asn");
+ printf(", (rtaf=asn");
gre_sre_asn_print(sreoff, srelen, bp, len);
printf(") ");
break;
default:
- printf("(rtaf=0x%x) ", af);
+ printf(", (rtaf=0x%x) ", af);
}
}
void
@@ -313,15 +340,15 @@ gre_sre_ip_print(u_int8_t sreoff, u_int8_t srelen, const u_char *bp, u_int len)
const u_char *up = bp;
if (sreoff & 3) {
- printf(" badoffset=%u", sreoff);
+ printf(", badoffset=%u", sreoff);
return;
}
if (srelen & 3) {
- printf(" badlength=%u", srelen);
+ printf(", badlength=%u", srelen);
return;
}
if (sreoff >= srelen) {
- printf(" badoff/len=%u/%u", sreoff, srelen);
+ printf(", badoff/len=%u/%u", sreoff, srelen);
return;
}
@@ -346,15 +373,15 @@ gre_sre_asn_print(u_int8_t sreoff, u_int8_t srelen, const u_char *bp, u_int len)
const u_char *up = bp;
if (sreoff & 1) {
- printf(" badoffset=%u", sreoff);
+ printf(", badoffset=%u", sreoff);
return;
}
if (srelen & 1) {
- printf(" badlength=%u", srelen);
+ printf(", badlength=%u", srelen);
return;
}
if (sreoff >= srelen) {
- printf(" badoff/len=%u/%u", sreoff, srelen);
+ printf(", badoff/len=%u/%u", sreoff, srelen);
return;
}
diff --git a/contrib/tcpdump/print-hsrp.c b/contrib/tcpdump/print-hsrp.c
index 92050383f910..03dace7d5a93 100644
--- a/contrib/tcpdump/print-hsrp.c
+++ b/contrib/tcpdump/print-hsrp.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.7.2.2 2003/11/16 08:51:24 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.9 2003/11/16 09:36:22 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-icmp.c b/contrib/tcpdump/print-icmp.c
index 3cfbe6b62d1d..aa58bda0a4a3 100644
--- a/contrib/tcpdump/print-icmp.c
+++ b/contrib/tcpdump/print-icmp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.73.2.3 2004/03/24 00:56:34 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81 2005/04/06 21:32:40 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -40,6 +40,7 @@ static const char rcsid[] _U_ =
#include "ip.h"
#include "udp.h"
#include "ipproto.h"
+#include "mpls.h"
/*
* Interface Control Message Protocol Definitions.
@@ -85,6 +86,12 @@ struct icmp {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
+ struct mpls_ext {
+ u_int8_t legacy_header[128]; /* extension header starts 128 bytes after ICMP header */
+ u_int8_t version_res[2];
+ u_int8_t checksum[2];
+ u_int8_t data[1];
+ } mpls_ext;
u_int32_t id_mask;
u_int8_t id_data[1];
} icmp_dun;
@@ -94,8 +101,14 @@ struct icmp {
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
+#define icmp_mpls_ext_version icmp_dun.mpls_ext.version_res
+#define icmp_mpls_ext_checksum icmp_dun.mpls_ext.checksum
+#define icmp_mpls_ext_data icmp_dun.mpls_ext.data
};
+#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
+#define ICMP_MPLS_EXT_VERSION 2
+
/*
* Lower bounds on packet lengths for various types.
* For the error advice packets must first insure that the
@@ -105,6 +118,7 @@ struct icmp {
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
+#define ICMP_EXTD_MINLEN (156 - sizeof (struct ip)) /* draft-bonica-icmp-mpls-02 */
#define ICMP_TSLEN (8 + 3 * sizeof (u_int32_t)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
@@ -158,6 +172,8 @@ struct icmp {
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+#define ICMP_MPLS_EXT_TYPE(type) \
+ ((type) == ICMP_UNREACH || (type) == ICMP_TIMXCEED)
/* rfc1700 */
#ifndef ICMP_UNREACH_NET_UNKNOWN
#define ICMP_UNREACH_NET_UNKNOWN 6 /* destination net unknown */
@@ -260,6 +276,19 @@ struct id_rdiscovery {
u_int32_t ird_pref;
};
+/* draft-bonica-icmp-mpls-02 */
+struct icmp_mpls_ext_object_header_t {
+ u_int8_t length[2];
+ u_int8_t class_num;
+ u_int8_t ctype;
+};
+
+static const struct tok icmp_mpls_ext_obj_values[] = {
+ { 1, "MPLS Stack Entry" },
+ { 2, "Extended Payload" },
+ { 0, NULL}
+};
+
void
icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
{
@@ -269,7 +298,10 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
const char *str, *fmt;
const struct ip *oip;
const struct udphdr *ouh;
- u_int hlen, dport, mtu;
+ const u_int8_t *obj_tptr;
+ u_int32_t raw_label;
+ const struct icmp_mpls_ext_object_header_t *icmp_mpls_ext_object_header;
+ u_int hlen, dport, mtu, obj_tlen, obj_class_num, obj_ctype;
char buf[MAXHOSTNAMELEN + 100];
dp = (struct icmp *)bp;
@@ -477,7 +509,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
str = tok2str(icmp2str, "type-#%d", dp->icmp_type);
break;
}
- (void)printf("icmp %d: %s", plen, str);
+ (void)printf("ICMP %s, length %u", str, plen);
if (vflag && !fragmented) { /* don't attempt checksumming if this is a frag */
u_int16_t sum, icmp_sum;
if (TTEST2(*bp, plen)) {
@@ -490,13 +522,88 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
}
}
}
- if (vflag > 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
+ if (vflag >= 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
bp += 8;
- (void)printf(" for ");
+ (void)printf("\n\t");
ip = (struct ip *)bp;
snaplen = snapend - bp;
- ip_print(bp, EXTRACT_16BITS(&ip->ip_len));
+ ip_print(gndo, bp, EXTRACT_16BITS(&ip->ip_len));
}
+
+ if (vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(dp->icmp_type)) {
+
+ TCHECK(*(dp->icmp_mpls_ext_version));
+ printf("\n\tMPLS extension v%u",ICMP_MPLS_EXT_EXTRACT_VERSION(*(dp->icmp_mpls_ext_version)));
+
+ /*
+ * Sanity checking of the header.
+ */
+ if (ICMP_MPLS_EXT_EXTRACT_VERSION(*(dp->icmp_mpls_ext_version)) != ICMP_MPLS_EXT_VERSION) {
+ printf(" packet not supported");
+ return;
+ }
+
+ hlen = plen - ICMP_EXTD_MINLEN;
+ TCHECK2(*(dp->icmp_mpls_ext_checksum), 2);
+ printf(", checksum 0x%04x (unverified), length %u", /* FIXME */
+ EXTRACT_16BITS(dp->icmp_mpls_ext_checksum),
+ hlen);
+
+ hlen -= 4; /* subtract common header size */
+ obj_tptr = (u_int8_t *)dp->icmp_mpls_ext_data;
+
+ while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
+
+ icmp_mpls_ext_object_header = (struct icmp_mpls_ext_object_header_t *)obj_tptr;
+ TCHECK(*icmp_mpls_ext_object_header);
+ obj_tlen = EXTRACT_16BITS(icmp_mpls_ext_object_header->length);
+ obj_class_num = icmp_mpls_ext_object_header->class_num;
+ obj_ctype = icmp_mpls_ext_object_header->ctype;
+ obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t);
+
+ printf("\n\t %s Object (%u), Class-Type: %u, length %u",
+ tok2str(icmp_mpls_ext_obj_values,"unknown",obj_class_num),
+ obj_class_num,
+ obj_ctype,
+ obj_tlen);
+
+ hlen-=sizeof(struct icmp_mpls_ext_object_header_t); /* length field includes tlv header */
+ if (obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))
+ break;
+ obj_tlen-=sizeof(struct icmp_mpls_ext_object_header_t);
+
+ switch (obj_class_num) {
+ case 1:
+ switch(obj_ctype) {
+ case 1:
+ TCHECK2(*obj_tptr, 4);
+ raw_label = EXTRACT_32BITS(obj_tptr);
+ printf("\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label));
+ if (MPLS_STACK(raw_label))
+ printf(", [S]");
+ printf(", ttl %u", MPLS_TTL(raw_label));
+ break;
+ default:
+ print_unknown_data(obj_tptr, "\n\t ", obj_tlen);
+ }
+ break;
+
+ /*
+ * FIXME those are the defined objects that lack a decoder
+ * you are welcome to contribute code ;-)
+ */
+ case 2:
+ default:
+ print_unknown_data(obj_tptr, "\n\t ", obj_tlen);
+ break;
+ }
+ if (hlen < obj_tlen)
+ break;
+ hlen -= obj_tlen;
+ obj_tptr += obj_tlen;
+ }
+ }
+
return;
trunc:
fputs("[|icmp]", stdout);
diff --git a/contrib/tcpdump/print-icmp6.c b/contrib/tcpdump/print-icmp6.c
index 88580b2502dc..4cf7deb0d5f2 100644
--- a/contrib/tcpdump/print-icmp6.c
+++ b/contrib/tcpdump/print-icmp6.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.72.2.4 2004/03/24 00:14:09 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.79 2005/01/14 10:41:50 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -51,6 +51,8 @@ static const char *get_lifetime(u_int32_t);
static void print_lladdr(const u_char *, size_t);
static void icmp6_opt_print(const u_char *, int);
static void mld6_print(const u_char *);
+static void mldv2_report_print(const u_char *, u_int);
+static void mldv2_query_print(const u_char *, u_int);
static struct udphdr *get_upperlayer(u_char *, u_int *);
static void dnsname_print(const u_char *, const u_char *);
static void icmp6_nodeinfo_print(u_int, const u_char *, const u_char *);
@@ -60,6 +62,92 @@ static void icmp6_rrenum_print(const u_char *, const u_char *);
#define abs(a) ((0 < (a)) ? (a) : -(a))
#endif
+static struct tok icmp6_type_values[] = {
+ { ICMP6_DST_UNREACH, "destination unreachable"},
+ { ICMP6_PACKET_TOO_BIG, "packet too big"},
+ { ICMP6_TIME_EXCEEDED, "time exceeded in-transit"},
+ { ICMP6_PARAM_PROB, "parameter problem"},
+ { ICMP6_ECHO_REQUEST, "echo request"},
+ { ICMP6_ECHO_REPLY, "echo reply"},
+ { MLD6_LISTENER_QUERY, "multicast listener query "},
+ { MLD6_LISTENER_REPORT, "multicast listener report "},
+ { MLD6_LISTENER_DONE, "multicast listener done "},
+ { ND_ROUTER_SOLICIT, "router solicitation "},
+ { ND_ROUTER_ADVERT, "router advertisement"},
+ { ND_NEIGHBOR_SOLICIT, "neighbor solicitation"},
+ { ND_NEIGHBOR_ADVERT, "neighbor advertisment"},
+ { ND_REDIRECT, "redirect"},
+ { ICMP6_ROUTER_RENUMBERING, "router renumbering"},
+ { IND_SOLICIT, "inverse neighbor solicitation"},
+ { IND_ADVERT, "inverse neighbor advertisement"},
+ { MLDV2_LISTENER_REPORT, "multicast listener report v2 "},
+ { ICMP6_HADISCOV_REQUEST, "ha discovery request"},
+ { ICMP6_HADISCOV_REPLY, "ha discovery reply"},
+ { ICMP6_MOBILEPREFIX_SOLICIT, "mobile router solicitation"},
+ { ICMP6_MOBILEPREFIX_ADVERT, "mobile router advertisement"},
+ { ICMP6_WRUREQUEST, "who-are-you request"},
+ { ICMP6_WRUREPLY, "who-are-you reply"},
+ { ICMP6_NI_QUERY, "node information query"},
+ { ICMP6_NI_REPLY, "node information reply"},
+ { MLD6_MTRACE, "mtrace message"},
+ { MLD6_MTRACE_RESP, "mtrace response"},
+ { 0, NULL }
+};
+
+static struct tok icmp6_dst_unreach_code_values[] = {
+ { ICMP6_DST_UNREACH_NOROUTE, "unreachable route" },
+ { ICMP6_DST_UNREACH_ADMIN, " unreachable prohibited"},
+ { ICMP6_DST_UNREACH_BEYONDSCOPE, "beyond scope"},
+ { ICMP6_DST_UNREACH_ADDR, "unreachable address"},
+ { ICMP6_DST_UNREACH_NOPORT, "unreachable port"},
+ { 0, NULL }
+};
+
+static struct tok icmp6_opt_pi_flag_values[] = {
+ { ND_OPT_PI_FLAG_ONLINK, "onlink" },
+ { ND_OPT_PI_FLAG_AUTO, "auto" },
+ { ND_OPT_PI_FLAG_ROUTER, "router" },
+ { 0, NULL }
+};
+
+static struct tok icmp6_opt_ra_flag_values[] = {
+ { ND_RA_FLAG_MANAGED, "managed" },
+ { ND_RA_FLAG_OTHER, "other stateful"},
+ { ND_RA_FLAG_HOME_AGENT, "home agent"},
+ { 0, NULL }
+};
+
+static struct tok icmp6_nd_na_flag_values[] = {
+ { ND_NA_FLAG_ROUTER, "router" },
+ { ND_NA_FLAG_SOLICITED, "solicited" },
+ { ND_NA_FLAG_OVERRIDE, "override" },
+ { 0, NULL }
+};
+
+
+static struct tok icmp6_opt_values[] = {
+ { ND_OPT_SOURCE_LINKADDR, "source link-address"},
+ { ND_OPT_TARGET_LINKADDR, "destination link-address"},
+ { ND_OPT_PREFIX_INFORMATION, "prefix info"},
+ { ND_OPT_REDIRECTED_HEADER, "redirected header"},
+ { ND_OPT_MTU, "mtu"},
+ { ND_OPT_ADVINTERVAL, "advertisment interval"},
+ { ND_OPT_HOMEAGENT_INFO, "homeagent information"},
+ { ND_OPT_ROUTE_INFO, "route info"},
+ { 0, NULL }
+};
+
+/* mldv2 report types */
+static struct tok mldv2report2str[] = {
+ { 1, "is_in" },
+ { 2, "is_ex" },
+ { 3, "to_in" },
+ { 4, "to_ex" },
+ { 5, "allow" },
+ { 6, "block" },
+ { 0, NULL }
+};
+
static const char *
get_rtpref(u_int v)
{
@@ -178,27 +266,35 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
}
}
+ printf("ICMP6, %s", tok2str(icmp6_type_values,"unknown icmp6 type (%u)",dp->icmp6_type));
+
+ /* display cosmetics: print the packet length for printer that use the vflag now */
+ if (vflag && (dp->icmp6_type ==
+ ND_ROUTER_SOLICIT ||
+ ND_ROUTER_ADVERT ||
+ ND_NEIGHBOR_ADVERT ||
+ ND_NEIGHBOR_SOLICIT ||
+ ND_REDIRECT ||
+ ICMP6_HADISCOV_REPLY ||
+ ICMP6_MOBILEPREFIX_ADVERT ))
+ printf(", length %u", length);
+
switch (dp->icmp6_type) {
case ICMP6_DST_UNREACH:
TCHECK(oip->ip6_dst);
+ printf(", %s", tok2str(icmp6_dst_unreach_code_values,"unknown unreach code (%u)",dp->icmp6_code));
switch (dp->icmp6_code) {
- case ICMP6_DST_UNREACH_NOROUTE:
- printf("icmp6: %s unreachable route",
- ip6addr_string(&oip->ip6_dst));
- break;
+
+ case ICMP6_DST_UNREACH_NOROUTE: /* fall through */
case ICMP6_DST_UNREACH_ADMIN:
- printf("icmp6: %s unreachable prohibited",
- ip6addr_string(&oip->ip6_dst));
- break;
+ case ICMP6_DST_UNREACH_ADDR:
+ printf(" %s",ip6addr_string(&oip->ip6_dst));
+ break;
case ICMP6_DST_UNREACH_BEYONDSCOPE:
- printf("icmp6: %s beyond scope of source address %s",
+ printf(" %s, source address %s",
ip6addr_string(&oip->ip6_dst),
ip6addr_string(&oip->ip6_src));
break;
- case ICMP6_DST_UNREACH_ADDR:
- printf("icmp6: %s unreachable address",
- ip6addr_string(&oip->ip6_dst));
- break;
case ICMP6_DST_UNREACH_NOPORT:
if ((ouh = get_upperlayer((u_char *)oip, &prot))
== NULL)
@@ -207,46 +303,46 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
dport = EXTRACT_16BITS(&ouh->uh_dport);
switch (prot) {
case IPPROTO_TCP:
- printf("icmp6: %s tcp port %s unreachable",
+ printf(", %s tcp port %s",
ip6addr_string(&oip->ip6_dst),
tcpport_string(dport));
break;
case IPPROTO_UDP:
- printf("icmp6: %s udp port %s unreachable",
+ printf(", %s udp port %s",
ip6addr_string(&oip->ip6_dst),
udpport_string(dport));
break;
default:
- printf("icmp6: %s protocol %d port %d unreachable",
+ printf(", %s protocol %d port %d unreachable",
ip6addr_string(&oip->ip6_dst),
oip->ip6_nxt, dport);
break;
}
break;
default:
- printf("icmp6: %s unreachable code-#%d",
- ip6addr_string(&oip->ip6_dst),
- dp->icmp6_code);
- break;
+ if (vflag <= 1) {
+ print_unknown_data(bp,"\n\t",length);
+ return;
+ }
+ break;
}
break;
case ICMP6_PACKET_TOO_BIG:
TCHECK(dp->icmp6_mtu);
- printf("icmp6: too big %u", EXTRACT_32BITS(&dp->icmp6_mtu));
+ printf(", mtu %u", EXTRACT_32BITS(&dp->icmp6_mtu));
break;
case ICMP6_TIME_EXCEEDED:
TCHECK(oip->ip6_dst);
switch (dp->icmp6_code) {
case ICMP6_TIME_EXCEED_TRANSIT:
- printf("icmp6: time exceeded in-transit for %s",
+ printf(" for %s",
ip6addr_string(&oip->ip6_dst));
break;
case ICMP6_TIME_EXCEED_REASSEMBLY:
- printf("icmp6: ip6 reassembly time exceeded");
+ printf(" (reassembly)");
break;
default:
- printf("icmp6: time exceeded code-#%d",
- dp->icmp6_code);
+ printf(", unknown code (%u)", dp->icmp6_code);
break;
}
break;
@@ -254,19 +350,16 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
TCHECK(oip->ip6_dst);
switch (dp->icmp6_code) {
case ICMP6_PARAMPROB_HEADER:
- printf("icmp6: parameter problem errorneous - octet %u",
- EXTRACT_32BITS(&dp->icmp6_pptr));
+ printf(", errorneous - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr));
break;
case ICMP6_PARAMPROB_NEXTHEADER:
- printf("icmp6: parameter problem next header - octet %u",
- EXTRACT_32BITS(&dp->icmp6_pptr));
+ printf(", next header - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr));
break;
case ICMP6_PARAMPROB_OPTION:
- printf("icmp6: parameter problem option - octet %u",
- EXTRACT_32BITS(&dp->icmp6_pptr));
+ printf(", option - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr));
break;
default:
- printf("icmp6: parameter problem code-#%d",
+ printf(", code-#%d",
dp->icmp6_code);
break;
}
@@ -274,59 +367,47 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
case ICMP6_ECHO_REQUEST:
case ICMP6_ECHO_REPLY:
TCHECK(dp->icmp6_seq);
- printf("icmp6: echo %s seq %u",
- dp->icmp6_type == ICMP6_ECHO_REQUEST ?
- "request" : "reply",
- EXTRACT_16BITS(&dp->icmp6_seq));
+ printf(", seq %u", EXTRACT_16BITS(&dp->icmp6_seq));
break;
case ICMP6_MEMBERSHIP_QUERY:
- printf("icmp6: multicast listener query ");
- mld6_print((const u_char *)dp);
+ if (length == MLD_MINLEN) {
+ mld6_print((const u_char *)dp);
+ } else if (length >= MLDV2_MINLEN) {
+ printf("v2 ");
+ mldv2_query_print((const u_char *)dp, length);
+ } else {
+ printf(" unknown-version (len %u) ", length);
+ }
break;
case ICMP6_MEMBERSHIP_REPORT:
- printf("icmp6: multicast listener report ");
mld6_print((const u_char *)dp);
break;
case ICMP6_MEMBERSHIP_REDUCTION:
- printf("icmp6: multicast listener done ");
mld6_print((const u_char *)dp);
break;
case ND_ROUTER_SOLICIT:
- printf("icmp6: router solicitation ");
- if (vflag) {
#define RTSOLLEN 8
+ if (vflag) {
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
length - RTSOLLEN);
}
break;
case ND_ROUTER_ADVERT:
- printf("icmp6: router advertisement");
+#define RTADVLEN 16
if (vflag) {
struct nd_router_advert *p;
p = (struct nd_router_advert *)dp;
TCHECK(p->nd_ra_retransmit);
- printf("(chlim=%d, ", (int)p->nd_ra_curhoplimit);
- if (p->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED)
- printf("M");
- if (p->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
- printf("O");
- if (p->nd_ra_flags_reserved & ND_RA_FLAG_HOME_AGENT)
- printf("H");
-
- if ((p->nd_ra_flags_reserved & ~ND_RA_FLAG_RTPREF_MASK)
- != 0)
- printf(" ");
+ printf("\n\thop limit %u, Flags [%s]" \
+ ", pref %s, router lifetime %us, reachable time %us, retrans time %us",
+ (u_int)p->nd_ra_curhoplimit,
+ bittok2str(icmp6_opt_ra_flag_values,"none",(p->nd_ra_flags_reserved)),
+ get_rtpref(p->nd_ra_flags_reserved),
+ EXTRACT_16BITS(&p->nd_ra_router_lifetime),
+ EXTRACT_32BITS(&p->nd_ra_reachable),
+ EXTRACT_32BITS(&p->nd_ra_retransmit));
- printf("pref=%s, ",
- get_rtpref(p->nd_ra_flags_reserved));
-
- printf("router_ltime=%d, ", EXTRACT_16BITS(&p->nd_ra_router_lifetime));
- printf("reachable_time=%u, ",
- EXTRACT_32BITS(&p->nd_ra_reachable));
- printf("retrans_time=%u)",
- EXTRACT_32BITS(&p->nd_ra_retransmit));
-#define RTADVLEN 16
icmp6_opt_print((const u_char *)dp + RTADVLEN,
length - RTADVLEN);
}
@@ -336,8 +417,7 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
struct nd_neighbor_solicit *p;
p = (struct nd_neighbor_solicit *)dp;
TCHECK(p->nd_ns_target);
- printf("icmp6: neighbor sol: who has %s",
- ip6addr_string(&p->nd_ns_target));
+ printf(", who has %s", ip6addr_string(&p->nd_ns_target));
if (vflag) {
#define NDSOLLEN 24
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
@@ -351,26 +431,13 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
p = (struct nd_neighbor_advert *)dp;
TCHECK(p->nd_na_target);
- printf("icmp6: neighbor adv: tgt is %s",
+ printf(", tgt is %s",
ip6addr_string(&p->nd_na_target));
if (vflag) {
-#define ND_NA_FLAG_ALL \
- (ND_NA_FLAG_ROUTER|ND_NA_FLAG_SOLICITED|ND_NA_FLAG_OVERRIDE)
- /* we don't need ntohl() here. see advanced-api-04. */
- if (p->nd_na_flags_reserved & ND_NA_FLAG_ALL) {
-#undef ND_NA_FLAG_ALL
- u_int32_t flags;
-
- flags = p->nd_na_flags_reserved;
- printf("(");
- if (flags & ND_NA_FLAG_ROUTER)
- printf("R");
- if (flags & ND_NA_FLAG_SOLICITED)
- printf("S");
- if (flags & ND_NA_FLAG_OVERRIDE)
- printf("O");
- printf(")");
- }
+ printf(", Flags [%s]",
+ bittok2str(icmp6_nd_na_flag_values,
+ "none",
+ EXTRACT_32BITS(&p->nd_na_flags_reserved)));
#define NDADVLEN 24
icmp6_opt_print((const u_char *)dp + NDADVLEN,
length - NDADVLEN);
@@ -381,8 +448,7 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
case ND_REDIRECT:
#define RDR(i) ((struct nd_redirect *)(i))
TCHECK(RDR(dp)->nd_rd_dst);
- printf("icmp6: redirect %s",
- getname6((const u_char *)&RDR(dp)->nd_rd_dst));
+ printf(", %s", getname6((const u_char *)&RDR(dp)->nd_rd_dst));
TCHECK(RDR(dp)->nd_rd_target);
printf(" to %s",
getname6((const u_char*)&RDR(dp)->nd_rd_target));
@@ -401,58 +467,55 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
case ICMP6_NI_REPLY:
icmp6_nodeinfo_print(length, bp, ep);
break;
- case ICMP6_HADISCOV_REQUEST:
- printf("icmp6: ha discovery request");
- if (vflag) {
- TCHECK(dp->icmp6_data16[0]);
- printf("(id=%d)", EXTRACT_16BITS(&dp->icmp6_data16[0]));
- }
+ case IND_SOLICIT:
+ case IND_ADVERT:
break;
+ case ICMP6_V2_MEMBERSHIP_REPORT:
+ mldv2_report_print((const u_char *) dp, length);
+ break;
+ case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */
+ case ICMP6_HADISCOV_REQUEST:
+ TCHECK(dp->icmp6_data16[0]);
+ printf(", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0]));
+ break;
case ICMP6_HADISCOV_REPLY:
- printf("icmp6: ha discovery reply");
if (vflag) {
struct in6_addr *in6;
u_char *cp;
TCHECK(dp->icmp6_data16[0]);
- printf("(id=%d", EXTRACT_16BITS(&dp->icmp6_data16[0]));
+ printf(", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0]));
cp = (u_char *)dp + length;
in6 = (struct in6_addr *)(dp + 1);
for (; (u_char *)in6 < cp; in6++) {
TCHECK(*in6);
printf(", %s", ip6addr_string(in6));
}
- printf(")");
- }
- break;
- case ICMP6_MOBILEPREFIX_SOLICIT:
- printf("icmp6: mobile router solicitation");
- if (vflag) {
- TCHECK(dp->icmp6_data16[0]);
- printf("(id=%d)", EXTRACT_16BITS(&dp->icmp6_data16[0]));
}
break;
case ICMP6_MOBILEPREFIX_ADVERT:
- printf("icmp6: mobile router advertisement");
if (vflag) {
TCHECK(dp->icmp6_data16[0]);
- printf("(id=%d", EXTRACT_16BITS(&dp->icmp6_data16[0]));
+ printf(", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0]));
if (dp->icmp6_data16[1] & 0xc0)
printf(" ");
if (dp->icmp6_data16[1] & 0x80)
printf("M");
if (dp->icmp6_data16[1] & 0x40)
printf("O");
- printf(")");
#define MPADVLEN 8
icmp6_opt_print((const u_char *)dp + MPADVLEN,
length - MPADVLEN);
}
break;
default:
- printf("icmp6: type-#%d", dp->icmp6_type);
- break;
- }
+ printf(", length %u", length);
+ if (vflag <= 1)
+ print_unknown_data(bp,"\n\t", length);
+ return;
+ }
+ if (!vflag)
+ printf(", length %u", length);
return;
trunc:
fputs("[|icmp6]", stdout);
@@ -564,89 +627,57 @@ icmp6_opt_print(const u_char *bp, int resid)
if (cp + (op->nd_opt_len << 3) > ep)
goto trunc;
+ printf("\n\t %s option (%u), length %u (%u): ",
+ tok2str(icmp6_opt_values, "unknown", op->nd_opt_type),
+ op->nd_opt_type,
+ op->nd_opt_len << 3,
+ op->nd_opt_len);
+
switch (op->nd_opt_type) {
case ND_OPT_SOURCE_LINKADDR:
opl = (struct nd_opt_hdr *)op;
- printf("(src lladdr: ");
l = (op->nd_opt_len << 3) - 2;
print_lladdr(cp + 2, l);
- /*(*/
- printf(")");
break;
case ND_OPT_TARGET_LINKADDR:
opl = (struct nd_opt_hdr *)op;
- printf("(tgt lladdr: ");
l = (op->nd_opt_len << 3) - 2;
print_lladdr(cp + 2, l);
- /*(*/
- printf(")");
break;
case ND_OPT_PREFIX_INFORMATION:
opp = (struct nd_opt_prefix_info *)op;
TCHECK(opp->nd_opt_pi_prefix);
- printf("(prefix info: "); /*)*/
- if (op->nd_opt_len != 4) {
- printf("badlen");
- /*(*/
- printf(")");
- break;
- }
- if (opp->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ONLINK)
- printf("L");
- if (opp->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO)
- printf("A");
- if (opp->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ROUTER)
- printf("R");
- if (opp->nd_opt_pi_flags_reserved)
- printf(" ");
- printf("valid_ltime=%s,",
- get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_valid_time)));
- printf("preferred_ltime=%s,",
- get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time)));
- printf("prefix=%s/%d",
- ip6addr_string(&opp->nd_opt_pi_prefix),
- opp->nd_opt_pi_prefix_len);
- if (opp->nd_opt_pi_len != 4)
- printf("!");
- /*(*/
- printf(")");
+ printf("%s/%u%s, Flags [%s], valid time %ss",
+ ip6addr_string(&opp->nd_opt_pi_prefix),
+ opp->nd_opt_pi_prefix_len,
+ (op->nd_opt_len != 4) ? "badlen" : "",
+ bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved),
+ get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_valid_time)));
+ printf(", pref. time %ss", get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time)));
break;
case ND_OPT_REDIRECTED_HEADER:
opr = (struct icmp6_opts_redirect *)op;
- printf("(redirect)");
+ print_unknown_data(bp,"\n\t ",op->nd_opt_len<<3);
/* xxx */
break;
case ND_OPT_MTU:
opm = (struct nd_opt_mtu *)op;
TCHECK(opm->nd_opt_mtu_mtu);
- printf("(mtu:"); /*)*/
- if (op->nd_opt_len != 1) {
- printf("badlen");
- /*(*/
- printf(")");
- break;
- }
- printf(" mtu=%u", EXTRACT_32BITS(&opm->nd_opt_mtu_mtu));
- if (opm->nd_opt_mtu_len != 1)
- printf("!");
- printf(")");
- break;
+ printf(" %u%s",
+ EXTRACT_32BITS(&opm->nd_opt_mtu_mtu),
+ (op->nd_opt_len != 1) ? "bad option length" : "" );
+ break;
case ND_OPT_ADVINTERVAL:
opa = (struct nd_opt_advinterval *)op;
TCHECK(opa->nd_opt_adv_interval);
- printf("(advint:"); /*)*/
- printf(" advint=%u",
- EXTRACT_32BITS(&opa->nd_opt_adv_interval));
- /*(*/
- printf(")");
+ printf(" %us", EXTRACT_32BITS(&opa->nd_opt_adv_interval));
break;
case ND_OPT_HOMEAGENT_INFO:
oph = (struct nd_opt_homeagent_info *)op;
TCHECK(oph->nd_opt_hai_lifetime);
- printf("(ha info:"); /*)*/
- printf(" pref=%d", EXTRACT_16BITS(&oph->nd_opt_hai_preference));
- printf(", lifetime=%u", EXTRACT_16BITS(&oph->nd_opt_hai_lifetime));
- printf(")");
+ printf(" preference %u, lifetime %u",
+ EXTRACT_16BITS(&oph->nd_opt_hai_preference),
+ EXTRACT_16BITS(&oph->nd_opt_hai_lifetime));
break;
case ND_OPT_ROUTE_INFO:
opri = (struct nd_opt_route_info *)op;
@@ -667,20 +698,22 @@ icmp6_opt_print(const u_char *bp, int resid)
default:
goto trunc;
}
- printf("(rtinfo:"); /*)*/
printf(" %s/%u", ip6addr_string(&in6),
opri->nd_opt_rti_prefixlen);
printf(", pref=%s", get_rtpref(opri->nd_opt_rti_flags));
printf(", lifetime=%s",
get_lifetime(EXTRACT_32BITS(&opri->nd_opt_rti_lifetime)));
- /*(*/
- printf(")");
break;
default:
- printf("(unknown opt_type=%d, opt_len=%d)",
- op->nd_opt_type, op->nd_opt_len);
- break;
+ if (vflag <= 1) {
+ print_unknown_data(cp+2,"\n\t ", (op->nd_opt_len << 3) - 2); /* skip option header */
+ return;
+ }
+ break;
}
+ /* do we want to see an additional hexdump ? */
+ if (vflag> 1)
+ print_unknown_data(cp+2,"\n\t ", (op->nd_opt_len << 3) - 2); /* skip option header */
cp += op->nd_opt_len << 3;
resid -= op->nd_opt_len << 3;
@@ -710,6 +743,128 @@ mld6_print(const u_char *bp)
}
static void
+mldv2_report_print(const u_char *bp, u_int len)
+{
+ struct icmp6_hdr *icp = (struct icmp6_hdr *) bp;
+ u_int group, nsrcs, ngroups;
+ u_int i, j;
+
+ /* Minimum len is 8 */
+ if (len < 8) {
+ printf(" [invalid len %d]", len);
+ return;
+ }
+
+ TCHECK(icp->icmp6_data16[1]);
+ ngroups = ntohs(icp->icmp6_data16[1]);
+ printf(", %d group record(s)", ngroups);
+ if (vflag > 0) {
+ /* Print the group records */
+ group = 8;
+ for (i = 0; i < ngroups; i++) {
+ /* type(1) + auxlen(1) + numsrc(2) + grp(16) */
+ if (len < group + 20) {
+ printf(" [invalid number of groups]");
+ return;
+ }
+ TCHECK2(bp[group + 4], 16);
+ printf(" [gaddr %s", ip6addr_string(&bp[group + 4]));
+ printf(" %s", tok2str(mldv2report2str, " [v2-report-#%d]",
+ bp[group]));
+ nsrcs = (bp[group + 2] << 8) + bp[group + 3];
+ /* Check the number of sources and print them */
+ if (len < group + 20 + (nsrcs * 16)) {
+ printf(" [invalid number of sources %d]", nsrcs);
+ return;
+ }
+ if (vflag == 1)
+ printf(", %d source(s)", nsrcs);
+ else {
+ /* Print the sources */
+ (void)printf(" {");
+ for (j = 0; j < nsrcs; j++) {
+ TCHECK2(bp[group + 20 + j * 16], 16);
+ printf(" %s", ip6addr_string(&bp[group + 20 + j * 16]));
+ }
+ (void)printf(" }");
+ }
+ /* Next group record */
+ group += 20 + nsrcs * 16;
+ printf("]");
+ }
+ }
+ return;
+trunc:
+ (void)printf("[|icmp6]");
+ return;
+}
+
+static void
+mldv2_query_print(const u_char *bp, u_int len)
+{
+ struct icmp6_hdr *icp = (struct icmp6_hdr *) bp;
+ u_int mrc;
+ int mrt, qqi;
+ u_int nsrcs;
+ register u_int i;
+
+ /* Minimum len is 28 */
+ if (len < 28) {
+ printf(" [invalid len %d]", len);
+ return;
+ }
+ TCHECK(icp->icmp6_data16[0]);
+ mrc = ntohs(icp->icmp6_data16[0]);
+ if (mrc < 32768) {
+ mrt = mrc;
+ } else {
+ mrt = ((mrc & 0x0fff) | 0x1000) << (((mrc & 0x7000) >> 12) + 3);
+ }
+ if (vflag) {
+ (void)printf(" [max resp delay=%d]", mrt);
+ }
+ TCHECK2(bp[8], 16);
+ printf(" [gaddr %s", ip6addr_string(&bp[8]));
+
+ if (vflag) {
+ TCHECK(bp[25]);
+ if (bp[24] & 0x08) {
+ printf(" sflag");
+ }
+ if (bp[24] & 0x07) {
+ printf(" robustness=%d", bp[24] & 0x07);
+ }
+ if (bp[25] < 128) {
+ qqi = bp[25];
+ } else {
+ qqi = ((bp[25] & 0x0f) | 0x10) << (((bp[25] & 0x70) >> 4) + 3);
+ }
+ printf(" qqi=%d", qqi);
+ }
+
+ TCHECK2(bp[26], 2);
+ nsrcs = ntohs(*(u_short *)&bp[26]);
+ if (nsrcs > 0) {
+ if (len < 28 + nsrcs * 16)
+ printf(" [invalid number of sources]");
+ else if (vflag > 1) {
+ printf(" {");
+ for (i = 0; i < nsrcs; i++) {
+ TCHECK2(bp[28 + i * 16], 16);
+ printf(" %s", ip6addr_string(&bp[28 + i * 16]));
+ }
+ printf(" }");
+ } else
+ printf(", %d source(s)", nsrcs);
+ }
+ printf("]");
+ return;
+trunc:
+ (void)printf("[|icmp6]");
+ return;
+}
+
+void
dnsname_print(const u_char *cp, const u_char *ep)
{
int i;
@@ -764,10 +919,10 @@ icmp6_nodeinfo_print(u_int icmp6len, const u_char *bp, const u_char *ep)
case ICMP6_NI_QUERY:
if (siz == sizeof(*dp) + 4) {
/* KAME who-are-you */
- printf("icmp6: who-are-you request");
+ printf(" who-are-you request");
break;
}
- printf("icmp6: node information query");
+ printf(" node information query");
TCHECK2(*dp, sizeof(*ni6));
ni6 = (struct icmp6_nodeinfo *)dp;
@@ -883,7 +1038,7 @@ icmp6_nodeinfo_print(u_int icmp6len, const u_char *bp, const u_char *ep)
needcomma = 0;
ni6 = (struct icmp6_nodeinfo *)dp;
- printf("icmp6: node information reply");
+ printf(" node information reply");
printf(" ("); /*)*/
switch (ni6->ni_code) {
case ICMP6_NI_SUCCESS:
diff --git a/contrib/tcpdump/print-igmp.c b/contrib/tcpdump/print-igmp.c
index 717ae169c385..c310d55b9dc0 100644
--- a/contrib/tcpdump/print-igmp.c
+++ b/contrib/tcpdump/print-igmp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.11.2.3 2003/11/19 09:41:29 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
@@ -300,6 +300,7 @@ igmp_print(register const u_char *bp, register u_int len)
print_igmpv3_report(bp, len);
break;
case 0x17:
+ TCHECK2(bp[4], 4);
(void)printf("igmp leave %s", ipaddr_string(&bp[4]));
break;
case 0x13:
diff --git a/contrib/tcpdump/print-igrp.c b/contrib/tcpdump/print-igrp.c
index 4622a935376a..b1666900a403 100644
--- a/contrib/tcpdump/print-igrp.c
+++ b/contrib/tcpdump/print-igrp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.18.2.2 2003/11/16 08:51:26 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.20 2003/11/16 09:36:23 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-ip.c b/contrib/tcpdump/print-ip.c
index 0cc559892e1c..96739fedf592 100644
--- a/contrib/tcpdump/print-ip.c
+++ b/contrib/tcpdump/print-ip.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.128.2.6 2004/03/24 09:01:39 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149 2005/04/07 00:28:17 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -41,11 +41,23 @@ static const char rcsid[] _U_ =
#include "ip.h"
#include "ipproto.h"
+struct tok ip_option_values[] = {
+ { IPOPT_EOL, "EOL" },
+ { IPOPT_NOP, "NOP" },
+ { IPOPT_TS, "timestamp" },
+ { IPOPT_SECURITY, "security" },
+ { IPOPT_RR, "RR" },
+ { IPOPT_SSRR, "SSRR" },
+ { IPOPT_LSRR, "LSRR" },
+ { IPOPT_RA, "RA" },
+ { 0, NULL }
+};
+
/*
* print the recorded route in an IP RR, LSRR or SSRR option.
*/
static void
-ip_printroute(const char *type, register const u_char *cp, u_int length)
+ip_printroute(register const u_char *cp, u_int length)
{
register u_int ptr;
register u_int len;
@@ -54,25 +66,21 @@ ip_printroute(const char *type, register const u_char *cp, u_int length)
printf(" [bad length %u]", length);
return;
}
- printf(" %s{", type);
if ((length + 1) & 3)
printf(" [bad length %u]", length);
ptr = cp[2] - 1;
if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1)
printf(" [bad ptr %u]", cp[2]);
- type = "";
for (len = 3; len < length; len += 4) {
- if (ptr == len)
- type = "#";
- printf("%s%s", type, ipaddr_string(&cp[len]));
- type = " ";
+ printf("%s", ipaddr_string(&cp[len]));
+ if (ptr > len)
+ printf (", ");
}
- printf("%s}", ptr == len? "#" : "");
}
/*
- * If source-routing is present, return the final destination.
+ * If source-routing is present and valid, return the final destination.
* Otherwise, return IP destination.
*
* This is used for UDP and TCP pseudo-header in the checksum
@@ -94,14 +102,15 @@ ip_finddst(const struct ip *ip)
TCHECK(*cp);
tt = *cp;
- if (tt == IPOPT_NOP || tt == IPOPT_EOL)
+ if (tt == IPOPT_EOL)
+ break;
+ else if (tt == IPOPT_NOP)
len = 1;
else {
TCHECK(cp[1]);
len = cp[1];
- }
- if (len < 2) {
- return 0;
+ if (len < 2)
+ break;
}
TCHECK2(*cp, len);
switch (tt) {
@@ -109,15 +118,14 @@ ip_finddst(const struct ip *ip)
case IPOPT_SSRR:
case IPOPT_LSRR:
if (len < 7)
- return 0;
+ break;
memcpy(&retval, cp + len - 4, 4);
return retval;
}
}
- return ip->ip_dst.s_addr;
-
trunc:
- return 0;
+ memcpy(&retval, &ip->ip_dst.s_addr, sizeof(u_int32_t));
+ return retval;
}
static void
@@ -188,75 +196,56 @@ done:
static void
ip_optprint(register const u_char *cp, u_int length)
{
- register u_int len;
+ register u_int option_len;
- for (; length > 0; cp += len, length -= len) {
- int tt;
+ for (; length > 0; cp += option_len, length -= option_len) {
+ u_int option_code;
TCHECK(*cp);
- tt = *cp;
- if (tt == IPOPT_NOP || tt == IPOPT_EOL)
- len = 1;
+ option_code = *cp;
+
+ if (option_code == IPOPT_NOP ||
+ option_code == IPOPT_EOL)
+ option_len = 1;
+
else {
TCHECK(cp[1]);
- len = cp[1];
- if (len < 2) {
- printf("[|ip op len %d]", len);
- return;
- }
- TCHECK2(*cp, len);
+ option_len = cp[1];
}
- switch (tt) {
- case IPOPT_EOL:
- printf(" EOL");
- if (length > 1)
- printf("-%d", length - 1);
- return;
+ printf("%s (%u) len %u",
+ tok2str(ip_option_values,"unknown",option_code),
+ option_code,
+ option_len);
- case IPOPT_NOP:
- printf(" NOP");
- break;
+ if (option_len < 2)
+ return;
- case IPOPT_TS:
- ip_printts(cp, len);
- break;
+ TCHECK2(*cp, option_len);
-#ifndef IPOPT_SECURITY
-#define IPOPT_SECURITY 130
-#endif /* IPOPT_SECURITY */
- case IPOPT_SECURITY:
- printf(" SECURITY{%d}", len);
- break;
+ switch (option_code) {
+ case IPOPT_EOL:
+ return;
- case IPOPT_RR:
- ip_printroute("RR", cp, len);
+ case IPOPT_TS:
+ ip_printts(cp, option_len);
break;
+ case IPOPT_RR: /* fall through */
case IPOPT_SSRR:
- ip_printroute("SSRR", cp, len);
- break;
-
case IPOPT_LSRR:
- ip_printroute("LSRR", cp, len);
+ ip_printroute( cp, option_len);
break;
-#ifndef IPOPT_RA
-#define IPOPT_RA 148 /* router alert */
-#endif
case IPOPT_RA:
- printf(" RA");
- if (len != 4)
- printf("{%d}", len);
- else {
- TCHECK(cp[3]);
- if (cp[2] || cp[3])
- printf("%d.%d", cp[2], cp[3]);
- }
+ TCHECK(cp[3]);
+ if (EXTRACT_16BITS(&cp[2]) != 0)
+ printf("value %u", EXTRACT_16BITS(&cp[2]));
break;
+ case IPOPT_NOP: /* nothing to print - fall through */
+ case IPOPT_SECURITY:
default:
- printf(" IPOPT-%d{%d}", cp[0], len);
break;
}
}
@@ -367,70 +356,255 @@ static struct tok ip_frag_values[] = {
{ 0, NULL }
};
+struct ip_print_demux_state {
+ const struct ip *ip;
+ const u_char *cp;
+ u_int len, off;
+ u_char nh;
+ int advance;
+};
+
+static void
+ip_print_demux(netdissect_options *ndo,
+ struct ip_print_demux_state *ipds)
+{
+ struct protoent *proto;
+
+again:
+ switch (ipds->nh) {
+
+ case IPPROTO_AH:
+ ipds->nh = *ipds->cp;
+ ipds->advance = ah_print(ipds->cp);
+ if (ipds->advance <= 0)
+ break;
+ ipds->cp += ipds->advance;
+ ipds->len -= ipds->advance;
+ goto again;
+
+ case IPPROTO_ESP:
+ {
+ int enh, padlen;
+ ipds->advance = esp_print(ndo, ipds->cp, ipds->len,
+ (const u_char *)ipds->ip,
+ &enh, &padlen);
+ if (ipds->advance <= 0)
+ break;
+ ipds->cp += ipds->advance;
+ ipds->len -= ipds->advance + padlen;
+ ipds->nh = enh & 0xff;
+ goto again;
+ }
+
+ case IPPROTO_IPCOMP:
+ {
+ int enh;
+ ipds->advance = ipcomp_print(ipds->cp, &enh);
+ if (ipds->advance <= 0)
+ break;
+ ipds->cp += ipds->advance;
+ ipds->len -= ipds->advance;
+ ipds->nh = enh & 0xff;
+ goto again;
+ }
+
+ case IPPROTO_SCTP:
+ sctp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len);
+ break;
+
+ case IPPROTO_TCP:
+ tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
+ (ipds->off &~ 0x6000));
+ break;
+
+ case IPPROTO_UDP:
+ udp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
+ (ipds->off &~ 0x6000));
+ break;
+
+ case IPPROTO_ICMP:
+ /* pass on the MF bit plus the offset to detect fragments */
+ icmp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
+ (ipds->off & 0x3fff));
+ break;
+
+ case IPPROTO_PIGP:
+ /*
+ * XXX - the current IANA protocol number assignments
+ * page lists 9 as "any private interior gateway
+ * (used by Cisco for their IGRP)" and 88 as
+ * "EIGRP" from Cisco.
+ *
+ * Recent BSD <netinet/in.h> headers define
+ * IP_PROTO_PIGP as 9 and IP_PROTO_IGRP as 88.
+ * We define IP_PROTO_PIGP as 9 and
+ * IP_PROTO_EIGRP as 88; those names better
+ * match was the current protocol number
+ * assignments say.
+ */
+ igrp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
+ break;
+
+ case IPPROTO_EIGRP:
+ eigrp_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_ND:
+ ND_PRINT((ndo, " nd %d", ipds->len));
+ break;
+
+ case IPPROTO_EGP:
+ egp_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_OSPF:
+ ospf_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
+ break;
+
+ case IPPROTO_IGMP:
+ igmp_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_IPV4:
+ /* DVMRP multicast tunnel (ip-in-ip encapsulation) */
+ ip_print(gndo, ipds->cp, ipds->len);
+ if (! vflag) {
+ ND_PRINT((ndo, " (ipip-proto-4)"));
+ return;
+ }
+ break;
+
+#ifdef INET6
+ case IPPROTO_IPV6:
+ /* ip6-in-ip encapsulation */
+ ip6_print(ipds->cp, ipds->len);
+ break;
+#endif /*INET6*/
+
+ case IPPROTO_RSVP:
+ rsvp_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_GRE:
+ /* do it */
+ gre_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_MOBILE:
+ mobile_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_PIM:
+ pim_print(ipds->cp, ipds->len);
+ break;
+
+ case IPPROTO_VRRP:
+ vrrp_print(ipds->cp, ipds->len, ipds->ip->ip_ttl);
+ break;
+
+ default:
+ if ((proto = getprotobynumber(ipds->nh)) != NULL)
+ ND_PRINT((ndo, " %s", proto->p_name));
+ else
+ ND_PRINT((ndo, " ip-proto-%d", ipds->nh));
+ ND_PRINT((ndo, " %d", ipds->len));
+ break;
+ }
+}
+
+void
+ip_print_inner(netdissect_options *ndo,
+ const u_char *bp,
+ u_int length, u_int nh,
+ const u_char *bp2)
+{
+ struct ip_print_demux_state ipd;
+
+ ipd.ip = (const struct ip *)bp2;
+ ipd.cp = bp;
+ ipd.len = length;
+ ipd.off = 0;
+ ipd.nh = nh;
+ ipd.advance = 0;
+
+ ip_print_demux(ndo, &ipd);
+}
+
+
/*
* print an IP datagram.
*/
void
-ip_print(register const u_char *bp, register u_int length)
+ip_print(netdissect_options *ndo,
+ const u_char *bp,
+ u_int length)
{
- register const struct ip *ip;
- register u_int hlen, len, len0, off;
+ struct ip_print_demux_state ipd;
+ struct ip_print_demux_state *ipds=&ipd;
const u_char *ipend;
- register const u_char *cp;
- u_char nh;
- int advance;
- struct protoent *proto;
+ u_int hlen;
u_int16_t sum, ip_sum;
+ struct protoent *proto;
- ip = (const struct ip *)bp;
- if (IP_V(ip) != 4) { /* print version if != 4 */
- printf("IP%u ", IP_V(ip));
- if (IP_V(ip) == 6)
+ ipds->ip = (const struct ip *)bp;
+ if (IP_V(ipds->ip) != 4) { /* print version if != 4 */
+ printf("IP%u ", IP_V(ipds->ip));
+ if (IP_V(ipds->ip) == 6)
printf(", wrong link-layer encapsulation");
}
- else
+ else if (!eflag)
printf("IP ");
- if ((u_char *)(ip + 1) > snapend) {
+ if ((u_char *)(ipds->ip + 1) > snapend) {
printf("[|ip]");
return;
}
if (length < sizeof (struct ip)) {
- (void)printf("truncated-ip %d", length);
+ (void)printf("truncated-ip %u", length);
return;
}
- hlen = IP_HL(ip) * 4;
+ hlen = IP_HL(ipds->ip) * 4;
if (hlen < sizeof (struct ip)) {
(void)printf("bad-hlen %u", hlen);
return;
}
- len = EXTRACT_16BITS(&ip->ip_len);
- if (length < len)
+ ipds->len = EXTRACT_16BITS(&ipds->ip->ip_len);
+ if (length < ipds->len)
(void)printf("truncated-ip - %u bytes missing! ",
- len - length);
- if (len < hlen) {
- (void)printf("bad-len %u", len);
- return;
+ ipds->len - length);
+ if (ipds->len < hlen) {
+#ifdef GUESS_TSO
+ if (ipds->len) {
+ (void)printf("bad-len %u", ipds->len);
+ return;
+ }
+ else {
+ /* we guess that it is a TSO send */
+ ipds->len = length;
+ }
+#else
+ (void)printf("bad-len %u", ipds->len);
+ return;
+#endif /* GUESS_TSO */
}
/*
* Cut off the snapshot length to the end of the IP payload.
*/
- ipend = bp + len;
+ ipend = bp + ipds->len;
if (ipend < snapend)
snapend = ipend;
- len -= hlen;
- len0 = len;
+ ipds->len -= hlen;
- off = EXTRACT_16BITS(&ip->ip_off);
+ ipds->off = EXTRACT_16BITS(&ipds->ip->ip_off);
if (vflag) {
- (void)printf("(tos 0x%x", (int)ip->ip_tos);
+ (void)printf("(tos 0x%x", (int)ipds->ip->ip_tos);
/* ECN bits */
- if (ip->ip_tos & 0x03) {
- switch (ip->ip_tos & 0x03) {
+ if (ipds->ip->ip_tos & 0x03) {
+ switch (ipds->ip->ip_tos & 0x03) {
case 1:
(void)printf(",ECT(1)");
break;
@@ -442,8 +616,8 @@ ip_print(register const u_char *bp, register u_int length)
}
}
- if (ip->ip_ttl >= 1)
- (void)printf(", ttl %3u", ip->ip_ttl);
+ if (ipds->ip->ip_ttl >= 1)
+ (void)printf(", ttl %3u", ipds->ip->ip_ttl);
/*
* for the firewall guys, print id, offset.
@@ -451,23 +625,25 @@ ip_print(register const u_char *bp, register u_int length)
* For unfragmented datagrams, note the don't fragment flag.
*/
- (void)printf(", id %u, offset %u, flags [%s]",
- EXTRACT_16BITS(&ip->ip_id),
- (off & 0x1fff) * 8,
- bittok2str(ip_frag_values, "none", off & 0xe000 ));
+ (void)printf(", id %u, offset %u, flags [%s], proto: %s (%u)",
+ EXTRACT_16BITS(&ipds->ip->ip_id),
+ (ipds->off & 0x1fff) * 8,
+ bittok2str(ip_frag_values, "none", ipds->off&0xe000 ),
+ tok2str(ipproto_values,"unknown",ipds->ip->ip_p),
+ ipds->ip->ip_p);
- (void)printf(", length: %u", EXTRACT_16BITS(&ip->ip_len));
+ (void)printf(", length: %u", EXTRACT_16BITS(&ipds->ip->ip_len));
if ((hlen - sizeof(struct ip)) > 0) {
- (void)printf(", optlength: %u (", hlen - (u_int)sizeof(struct ip));
- ip_optprint((u_char *)(ip + 1), hlen - sizeof(struct ip));
+ printf(", options ( ");
+ ip_optprint((u_char *)(ipds->ip + 1), hlen - sizeof(struct ip));
printf(" )");
}
- if ((u_char *)ip + hlen <= snapend) {
- sum = in_cksum((const u_short *)ip, hlen, 0);
+ if ((u_char *)ipds->ip + hlen <= snapend) {
+ sum = in_cksum((const u_short *)ipds->ip, hlen, 0);
if (sum != 0) {
- ip_sum = EXTRACT_16BITS(&ip->ip_sum);
+ ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum);
(void)printf(", bad cksum %x (->%x)!", ip_sum,
in_cksum_shouldbe(ip_sum, sum));
}
@@ -480,133 +656,17 @@ ip_print(register const u_char *bp, register u_int length)
* If this is fragment zero, hand it to the next higher
* level protocol.
*/
- if ((off & 0x1fff) == 0) {
- cp = (const u_char *)ip + hlen;
- nh = ip->ip_p;
-
- if (nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
- nh != IPPROTO_SCTP) {
- (void)printf("%s > %s: ", ipaddr_string(&ip->ip_src),
- ipaddr_string(&ip->ip_dst));
- }
-again:
- switch (nh) {
-
- case IPPROTO_AH:
- nh = *cp;
- advance = ah_print(cp);
- if (advance <= 0)
- break;
- cp += advance;
- len -= advance;
- goto again;
-
- case IPPROTO_ESP:
- {
- int enh, padlen;
- advance = esp_print(cp, (const u_char *)ip, &enh, &padlen);
- if (advance <= 0)
- break;
- cp += advance;
- len -= advance + padlen;
- nh = enh & 0xff;
- goto again;
- }
-
- case IPPROTO_IPCOMP:
- {
- int enh;
- advance = ipcomp_print(cp, &enh);
- if (advance <= 0)
- break;
- cp += advance;
- len -= advance;
- nh = enh & 0xff;
- goto again;
- }
-
- case IPPROTO_SCTP:
- sctp_print(cp, (const u_char *)ip, len);
- break;
-
- case IPPROTO_TCP:
- tcp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
- break;
-
- case IPPROTO_UDP:
- udp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
- break;
-
- case IPPROTO_ICMP:
- /* pass on the MF bit plus the offset to detect fragments */
- icmp_print(cp, len, (const u_char *)ip, (off & 0x3fff));
- break;
-
- case IPPROTO_IGRP:
- igrp_print(cp, len, (const u_char *)ip);
- break;
-
- case IPPROTO_ND:
- (void)printf(" nd %d", len);
- break;
-
- case IPPROTO_EGP:
- egp_print(cp);
- break;
-
- case IPPROTO_OSPF:
- ospf_print(cp, len, (const u_char *)ip);
- break;
-
- case IPPROTO_IGMP:
- igmp_print(cp, len);
- break;
-
- case IPPROTO_IPV4:
- /* DVMRP multicast tunnel (ip-in-ip encapsulation) */
- ip_print(cp, len);
- if (! vflag) {
- printf(" (ipip-proto-4)");
- return;
- }
- break;
-
-#ifdef INET6
- case IPPROTO_IPV6:
- /* ip6-in-ip encapsulation */
- ip6_print(cp, len);
- break;
-#endif /*INET6*/
-
- case IPPROTO_RSVP:
- rsvp_print(cp, len);
- break;
-
- case IPPROTO_GRE:
- /* do it */
- gre_print(cp, len);
- break;
-
- case IPPROTO_MOBILE:
- mobile_print(cp, len);
- break;
-
- case IPPROTO_PIM:
- pim_print(cp, len);
- break;
-
- case IPPROTO_VRRP:
- vrrp_print(cp, len, ip->ip_ttl);
- break;
-
- default:
- if ((proto = getprotobynumber(nh)) != NULL)
- (void)printf(" %s", proto->p_name);
- else
- (void)printf(" ip-proto-%d", nh);
- printf(" %d", len);
- break;
+ if ((ipds->off & 0x1fff) == 0) {
+ ipds->cp = (const u_char *)ipds->ip + hlen;
+ ipds->nh = ipds->ip->ip_p;
+
+ if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP &&
+ ipds->nh != IPPROTO_SCTP) {
+ (void)printf("%s > %s: ",
+ ipaddr_string(&ipds->ip->ip_src),
+ ipaddr_string(&ipds->ip->ip_dst));
}
+ ip_print_demux(ndo, ipds);
} else {
/* Ultra quiet now means that all this stuff should be suppressed */
if (qflag > 1) return;
@@ -616,13 +676,13 @@ again:
* next level protocol header. print the ip addr
* and the protocol.
*/
- if (off & 0x1fff) {
- (void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
- ipaddr_string(&ip->ip_dst));
- if ((proto = getprotobynumber(ip->ip_p)) != NULL)
+ if (ipds->off & 0x1fff) {
+ (void)printf("%s > %s:", ipaddr_string(&ipds->ip->ip_src),
+ ipaddr_string(&ipds->ip->ip_dst));
+ if ((proto = getprotobynumber(ipds->ip->ip_p)) != NULL)
(void)printf(" %s", proto->p_name);
else
- (void)printf(" ip-proto-%d", ip->ip_p);
+ (void)printf(" ip-proto-%d", ipds->ip->ip_p);
}
}
}
@@ -640,7 +700,7 @@ ipN_print(register const u_char *bp, register u_int length)
memcpy (&hdr, (char *)ip, 4);
switch (IP_V(&hdr)) {
case 4:
- ip_print (bp, length);
+ ip_print (gndo, bp, length);
return;
#ifdef INET6
case 6:
@@ -653,5 +713,11 @@ ipN_print(register const u_char *bp, register u_int length)
}
}
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-ip6.c b/contrib/tcpdump/print-ip6.c
index 948e020bdae2..f4bd60364641 100644
--- a/contrib/tcpdump/print-ip6.c
+++ b/contrib/tcpdump/print-ip6.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.32.2.8 2003/11/24 20:31:22 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47 2005/04/06 21:32:40 mcr Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -63,16 +63,43 @@ ip6_print(register const u_char *bp, register u_int length)
TCHECK(*ip6);
if (length < sizeof (struct ip6_hdr)) {
- (void)printf("truncated-ip6 %d", length);
+ (void)printf("truncated-ip6 %u", length);
return;
}
+ if (!eflag)
+ printf("IP6 ");
+
payload_len = EXTRACT_16BITS(&ip6->ip6_plen);
len = payload_len + sizeof(struct ip6_hdr);
if (length < len)
- (void)printf("truncated-ip6 - %d bytes missing!",
+ (void)printf("truncated-ip6 - %u bytes missing!",
len - length);
+ if (vflag) {
+ flow = EXTRACT_32BITS(&ip6->ip6_flow);
+ printf("(");
+#if 0
+ /* rfc1883 */
+ if (flow & 0x0f000000)
+ (void)printf("pri 0x%02x, ", (flow & 0x0f000000) >> 24);
+ if (flow & 0x00ffffff)
+ (void)printf("flowlabel 0x%06x, ", flow & 0x00ffffff);
+#else
+ /* RFC 2460 */
+ if (flow & 0x0ff00000)
+ (void)printf("class 0x%02x, ", (flow & 0x0ff00000) >> 20);
+ if (flow & 0x000fffff)
+ (void)printf("flowlabel 0x%05x, ", flow & 0x000fffff);
+#endif
+
+ (void)printf("hlim %u, next-header: %s (%u), length: %u) ",
+ ip6->ip6_hlim,
+ tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
+ ip6->ip6_nxt,
+ payload_len);
+ }
+
/*
* Cut off the snapshot length to the end of the IP payload.
*/
@@ -106,7 +133,7 @@ ip6_print(register const u_char *bp, register u_int length)
case IPPROTO_FRAGMENT:
advance = frag6_print(cp, (const u_char *)ip6);
if (snapend <= cp + advance)
- goto end;
+ return;
nh = *cp;
fragmented = 1;
break;
@@ -125,23 +152,23 @@ ip6_print(register const u_char *bp, register u_int length)
*/
advance = mobility_print(cp, (const u_char *)ip6);
nh = *cp;
- goto end;
+ return;
case IPPROTO_ROUTING:
advance = rt6_print(cp, (const u_char *)ip6);
nh = *cp;
break;
case IPPROTO_SCTP:
sctp_print(cp, (const u_char *)ip6, len);
- goto end;
+ return;
case IPPROTO_TCP:
tcp_print(cp, len, (const u_char *)ip6, fragmented);
- goto end;
+ return;
case IPPROTO_UDP:
udp_print(cp, len, (const u_char *)ip6, fragmented);
- goto end;
+ return;
case IPPROTO_ICMPV6:
icmp6_print(cp, len, (const u_char *)ip6, fragmented);
- goto end;
+ return;
case IPPROTO_AH:
advance = ah_print(cp);
nh = *cp;
@@ -149,7 +176,7 @@ ip6_print(register const u_char *bp, register u_int length)
case IPPROTO_ESP:
{
int enh, padlen;
- advance = esp_print(cp, (const u_char *)ip6, &enh, &padlen);
+ advance = esp_print(gndo, cp, len, (const u_char *)ip6, &enh, &padlen);
nh = enh & 0xff;
len -= padlen;
break;
@@ -164,56 +191,29 @@ ip6_print(register const u_char *bp, register u_int length)
case IPPROTO_PIM:
pim_print(cp, len);
- goto end;
+ return;
case IPPROTO_OSPF:
ospf6_print(cp, len);
- goto end;
+ return;
case IPPROTO_IPV6:
ip6_print(cp, len);
- goto end;
+ return;
case IPPROTO_IPV4:
- ip_print(cp, len);
- goto end;
+ ip_print(gndo, cp, len);
+ return;
case IPPROTO_NONE:
(void)printf("no next header");
- goto end;
+ return;
default:
(void)printf("ip-proto-%d %d", ip6->ip6_nxt, len);
- goto end;
+ return;
}
}
- end:
-
- flow = EXTRACT_32BITS(&ip6->ip6_flow);
-#if 0
- /* rfc1883 */
- if (flow & 0x0f000000)
- (void)printf(" [pri 0x%x]", (flow & 0x0f000000) >> 24);
- if (flow & 0x00ffffff)
- (void)printf(" [flowlabel 0x%x]", flow & 0x00ffffff);
-#else
- /* RFC 2460 */
- if (flow & 0x0ff00000)
- (void)printf(" [class 0x%x]", (flow & 0x0ff00000) >> 20);
- if (flow & 0x000fffff)
- (void)printf(" [flowlabel 0x%x]", flow & 0x000fffff);
-#endif
-
- if (ip6->ip6_hlim <= 1)
- (void)printf(" [hlim %u]", ip6->ip6_hlim);
-
- if (vflag) {
- printf(" (");
- (void)printf("len %u", payload_len);
- if (ip6->ip6_hlim > 1)
- (void)printf(", hlim %d", (int)ip6->ip6_hlim);
- printf(")");
- }
return;
trunc:
(void)printf("[|ip6]");
diff --git a/contrib/tcpdump/print-ip6opts.c b/contrib/tcpdump/print-ip6opts.c
index a6960b86513d..dc63da84d285 100644
--- a/contrib/tcpdump/print-ip6opts.c
+++ b/contrib/tcpdump/print-ip6opts.c
@@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.14.2.3 2003/11/19 00:35:44 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.17 2003/11/19 00:36:08 guy Exp $";
#endif
#ifdef INET6
diff --git a/contrib/tcpdump/print-ipcomp.c b/contrib/tcpdump/print-ipcomp.c
index 7a3c1baf3a21..099e5ad9b69e 100644
--- a/contrib/tcpdump/print-ipcomp.c
+++ b/contrib/tcpdump/print-ipcomp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.17.2.3 2003/11/19 00:35:45 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
diff --git a/contrib/tcpdump/print-ipfc.c b/contrib/tcpdump/print-ipfc.c
index 1262ecf2d455..6fa4fe1e6067 100644
--- a/contrib/tcpdump/print-ipfc.c
+++ b/contrib/tcpdump/print-ipfc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.4.2.2 2003/11/16 08:51:28 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.7 2004/03/17 23:24:37 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -125,7 +125,7 @@ ipfc_print(const u_char *p, u_int length, u_int caplen)
/*
* This is the top level routine of the printer. 'p' points
* to the Network_Header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
diff --git a/contrib/tcpdump/print-ipx.c b/contrib/tcpdump/print-ipx.c
index f7b522adc88a..3094cfcaae47 100644
--- a/contrib/tcpdump/print-ipx.c
+++ b/contrib/tcpdump/print-ipx.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.34.2.2 2003/11/16 08:51:28 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.40 2004/05/26 19:57:57 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -56,12 +56,15 @@ ipx_print(const u_char *p, u_int length)
{
const struct ipxHdr *ipx = (const struct ipxHdr *)p;
+ if (!eflag)
+ printf("IPX ");
+
TCHECK(ipx->srcSkt);
(void)printf("%s.%04x > ",
ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode),
EXTRACT_16BITS(&ipx->srcSkt));
- (void)printf("%s.%04x:",
+ (void)printf("%s.%04x: ",
ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode),
EXTRACT_16BITS(&ipx->dstSkt));
@@ -94,7 +97,7 @@ ipx_decode(const struct ipxHdr *ipx, const u_char *datap, u_int length)
dstSkt = EXTRACT_16BITS(&ipx->dstSkt);
switch (dstSkt) {
case IPX_SKT_NCP:
- (void)printf(" ipx-ncp %d", length);
+ (void)printf("ipx-ncp %d", length);
break;
case IPX_SKT_SAP:
ipx_sap_print((u_short *)datap, length);
@@ -103,25 +106,25 @@ ipx_decode(const struct ipxHdr *ipx, const u_char *datap, u_int length)
ipx_rip_print((u_short *)datap, length);
break;
case IPX_SKT_NETBIOS:
- (void)printf(" ipx-netbios %d", length);
+ (void)printf("ipx-netbios %d", length);
#ifdef TCPDUMP_DO_SMB
ipx_netbios_print(datap, length);
#endif
break;
case IPX_SKT_DIAGNOSTICS:
- (void)printf(" ipx-diags %d", length);
+ (void)printf("ipx-diags %d", length);
break;
case IPX_SKT_NWLINK_DGM:
- (void)printf(" ipx-nwlink-dgm %d", length);
+ (void)printf("ipx-nwlink-dgm %d", length);
#ifdef TCPDUMP_DO_SMB
ipx_netbios_print(datap, length);
#endif
break;
case IPX_SKT_EIGRP:
- (void)printf(" ipx-eigrp %d", length);
+ eigrp_print(datap, length);
break;
default:
- (void)printf(" ipx-#%x %d", dstSkt, length);
+ (void)printf("ipx-#%x %d", dstSkt, length);
break;
}
}
diff --git a/contrib/tcpdump/print-isakmp.c b/contrib/tcpdump/print-isakmp.c
index d5caa739db45..09972f0292b5 100644
--- a/contrib/tcpdump/print-isakmp.c
+++ b/contrib/tcpdump/print-isakmp.c
@@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.36.2.11 2004/03/24 01:32:42 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.51 2005/04/07 00:28:17 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -415,9 +415,10 @@ isakmp_attr_print(const u_char *p, const u_char *ep)
}
static const u_char *
-isakmp_sa_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase, u_int32_t doi0 _U_,
- u_int32_t proto0, int depth)
+isakmp_sa_print(const struct isakmp_gen *ext,
+ u_int item_len _U_,
+ const u_char *ep, u_int32_t phase, u_int32_t doi0 _U_,
+ u_int32_t proto0, int depth)
{
const struct isakmp_pl_sa *p;
struct isakmp_pl_sa sa;
@@ -475,9 +476,9 @@ trunc:
}
static const u_char *
-isakmp_p_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase, u_int32_t doi0,
- u_int32_t proto0 _U_, int depth)
+isakmp_p_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep, u_int32_t phase, u_int32_t doi0,
+ u_int32_t proto0 _U_, int depth)
{
const struct isakmp_pl_p *p;
struct isakmp_pl_p prop;
@@ -633,9 +634,9 @@ trunc:
}
static const u_char *
-isakmp_ke_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi _U_,
- u_int32_t proto _U_, int depth _U_)
+isakmp_ke_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase _U_, u_int32_t doi _U_,
+ u_int32_t proto _U_, int depth _U_)
{
struct isakmp_gen e;
@@ -656,9 +657,9 @@ trunc:
}
static const u_char *
-isakmp_id_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase, u_int32_t doi _U_,
- u_int32_t proto _U_, int depth _U_)
+isakmp_id_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase, u_int32_t doi _U_,
+ u_int32_t proto _U_, int depth _U_)
{
#define USE_IPSECDOI_IN_PHASE1 1
const struct isakmp_pl_id *p;
@@ -834,9 +835,10 @@ trunc:
}
static const u_char *
-isakmp_cert_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi0 _U_,
- u_int32_t proto0 _U_, int depth _U_)
+isakmp_cert_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase _U_,
+ u_int32_t doi0 _U_,
+ u_int32_t proto0 _U_, int depth _U_)
{
const struct isakmp_pl_cert *p;
struct isakmp_pl_cert cert;
@@ -865,9 +867,9 @@ trunc:
}
static const u_char *
-isakmp_cr_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi0 _U_,
- u_int32_t proto0 _U_, int depth _U_)
+isakmp_cr_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase _U_, u_int32_t doi0 _U_,
+ u_int32_t proto0 _U_, int depth _U_)
{
const struct isakmp_pl_cert *p;
struct isakmp_pl_cert cert;
@@ -896,9 +898,9 @@ trunc:
}
static const u_char *
-isakmp_hash_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi _U_,
- u_int32_t proto _U_, int depth _U_)
+isakmp_hash_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase _U_, u_int32_t doi _U_,
+ u_int32_t proto _U_, int depth _U_)
{
struct isakmp_gen e;
@@ -919,9 +921,9 @@ trunc:
}
static const u_char *
-isakmp_sig_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi _U_,
- u_int32_t proto _U_, int depth _U_)
+isakmp_sig_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase _U_, u_int32_t doi _U_,
+ u_int32_t proto _U_, int depth _U_)
{
struct isakmp_gen e;
@@ -942,9 +944,11 @@ trunc:
}
static const u_char *
-isakmp_nonce_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi _U_,
- u_int32_t proto _U_, int depth _U_)
+isakmp_nonce_print(const struct isakmp_gen *ext,
+ u_int item_len _U_,
+ const u_char *ep _U_,
+ u_int32_t phase _U_, u_int32_t doi _U_,
+ u_int32_t proto _U_, int depth _U_)
{
struct isakmp_gen e;
@@ -1092,8 +1096,9 @@ isakmp_n_print(const struct isakmp_gen *ext, u_int item_len,
break;
default:
/* NULL is dummy */
- isakmp_print(cp, item_len - sizeof(*p) - n.spi_size,
- NULL);
+ isakmp_print(gndo, cp,
+ item_len - sizeof(*p) - n.spi_size,
+ NULL);
}
printf(")");
}
@@ -1104,9 +1109,9 @@ trunc:
}
static const u_char *
-isakmp_d_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi0 _U_,
- u_int32_t proto0 _U_, int depth _U_)
+isakmp_d_print(const struct isakmp_gen *ext, u_int item_len _U_,
+ const u_char *ep _U_, u_int32_t phase _U_, u_int32_t doi0 _U_,
+ u_int32_t proto0 _U_, int depth _U_)
{
const struct isakmp_pl_d *p;
struct isakmp_pl_d d;
@@ -1147,9 +1152,10 @@ trunc:
}
static const u_char *
-isakmp_vid_print(const struct isakmp_gen *ext, u_int item_len,
- const u_char *ep, u_int32_t phase _U_, u_int32_t doi _U_,
- u_int32_t proto _U_, int depth _U_)
+isakmp_vid_print(const struct isakmp_gen *ext,
+ u_int item_len _U_, const u_char *ep _U_,
+ u_int32_t phase _U_, u_int32_t doi _U_,
+ u_int32_t proto _U_, int depth _U_)
{
struct isakmp_gen e;
@@ -1196,7 +1202,7 @@ isakmp_sub0_print(u_char np, const struct isakmp_gen *ext, const u_char *ep,
* XXX - what if item_len is too short, or too long,
* for this payload type?
*/
- cp = (*NPFUNC(np))(ext, item_len, ep, phase, doi, proto, depth);
+ cp = (*npfunc[np])(ext, item_len, ep, phase, doi, proto, depth);
} else {
printf("%s", NPSTR(np));
cp += item_len;
@@ -1268,7 +1274,9 @@ safememcpy(void *p, const void *q, size_t l)
}
void
-isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
+isakmp_print(netdissect_options *ndo,
+ const u_char *bp, u_int length,
+ const u_char *bp2)
{
const struct isakmp *p;
struct isakmp base;
@@ -1279,7 +1287,7 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
int major, minor;
p = (const struct isakmp *)bp;
- ep = snapend;
+ ep = ndo->ndo_snapend;
if ((struct isakmp *)ep < p + 1) {
printf("[|isakmp]");
@@ -1378,3 +1386,64 @@ done:
}
}
}
+
+void
+isakmp_rfc3948_print(netdissect_options *ndo,
+ const u_char *bp, u_int length,
+ const u_char *bp2)
+{
+ const u_char *ep;
+ ep = ndo->ndo_snapend;
+
+ if(length == 1 && bp[0]==0xff) {
+ ND_PRINT((ndo, "isakmp-nat-keep-alive"));
+ return;
+ }
+
+ if(length < 4) {
+ goto trunc;
+ }
+
+ /*
+ * see if this is an IKE packet
+ */
+ if(bp[0]==0 && bp[1]==0 && bp[2]==0 && bp[3]==0) {
+ ND_PRINT((ndo, "NONESP-encap: "));
+ isakmp_print(ndo, bp+4, length-4, bp2);
+ return;
+ }
+
+ /* must be an ESP packet */
+ {
+ int nh, enh, padlen;
+ int advance;
+
+ ND_PRINT((ndo, "UDP-encap: "));
+
+ advance = esp_print(ndo, bp, length, bp2, &enh, &padlen);
+ if(advance <= 0)
+ return;
+
+ bp += advance;
+ length -= advance + padlen;
+ nh = enh & 0xff;
+
+ ip_print_inner(ndo, bp, length, nh, bp2);
+ return;
+ }
+
+trunc:
+ printf("[|isakmp]");
+ return;
+}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
+
+
+
+
diff --git a/contrib/tcpdump/print-isoclns.c b/contrib/tcpdump/print-isoclns.c
index bef8b23c84c4..37ecf0bf97f6 100644
--- a/contrib/tcpdump/print-isoclns.c
+++ b/contrib/tcpdump/print-isoclns.c
@@ -21,12 +21,12 @@
* Original code by Matt Thomas, Digital Equipment Corporation
*
* Extensively modified by Hannes Gredler (hannes@juniper.net) for more
- * complete IS-IS support.
+ * complete IS-IS & CLNP support.
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.106.2.5 2004/03/24 01:45:26 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133 2005/04/06 21:32:40 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -42,15 +42,10 @@ static const char rcsid[] _U_ =
#include "addrtoname.h"
#include "ethertype.h"
#include "ether.h"
+#include "nlpid.h"
#include "extract.h"
#include "gmpls.h"
-
-#define NLPID_CLNS 129 /* 0x81 */
-#define NLPID_ESIS 130 /* 0x82 */
-#define NLPID_ISIS 131 /* 0x83 */
-#define NLPID_IP6 0x8e
-#define NLPID_IP 0xcc
-#define NLPID_NULLNS 0
+#include "oui.h"
#define IPV4 1 /* AFI value */
#define IPV6 2 /* AFI value */
@@ -64,29 +59,35 @@ static const char rcsid[] _U_ =
#define LSP_ID_LEN SYSTEM_ID_LEN+2
#define ISIS_VERSION 1
-#define PDU_TYPE_MASK 0x1F
-#define PRIORITY_MASK 0x7F
-
-#define L1_LAN_IIH 15
-#define L2_LAN_IIH 16
-#define PTP_IIH 17
-#define L1_LSP 18
-#define L2_LSP 20
-#define L1_CSNP 24
-#define L2_CSNP 25
-#define L1_PSNP 26
-#define L2_PSNP 27
+#define ESIS_VERSION 1
+#define CLNP_VERSION 1
+
+#define ISIS_PDU_TYPE_MASK 0x1F
+#define ESIS_PDU_TYPE_MASK 0x1F
+#define CLNP_PDU_TYPE_MASK 0x1F
+#define CLNP_FLAG_MASK 0xE0
+#define ISIS_LAN_PRIORITY_MASK 0x7F
+
+#define ISIS_PDU_L1_LAN_IIH 15
+#define ISIS_PDU_L2_LAN_IIH 16
+#define ISIS_PDU_PTP_IIH 17
+#define ISIS_PDU_L1_LSP 18
+#define ISIS_PDU_L2_LSP 20
+#define ISIS_PDU_L1_CSNP 24
+#define ISIS_PDU_L2_CSNP 25
+#define ISIS_PDU_L1_PSNP 26
+#define ISIS_PDU_L2_PSNP 27
static struct tok isis_pdu_values[] = {
- { L1_LAN_IIH, "L1 Lan IIH"},
- { L2_LAN_IIH, "L2 Lan IIH"},
- { PTP_IIH, "p2p IIH"},
- { L1_LSP, "L1 LSP"},
- { L2_LSP, "L2 LSP"},
- { L1_CSNP, "L1 CSNP"},
- { L2_CSNP, "L2 CSNP"},
- { L1_PSNP, "L1 PSNP"},
- { L2_PSNP, "L2 PSNP"},
+ { ISIS_PDU_L1_LAN_IIH, "L1 Lan IIH"},
+ { ISIS_PDU_L2_LAN_IIH, "L2 Lan IIH"},
+ { ISIS_PDU_PTP_IIH, "p2p IIH"},
+ { ISIS_PDU_L1_LSP, "L1 LSP"},
+ { ISIS_PDU_L2_LSP, "L2 LSP"},
+ { ISIS_PDU_L1_CSNP, "L1 CSNP"},
+ { ISIS_PDU_L2_CSNP, "L2 CSNP"},
+ { ISIS_PDU_L1_PSNP, "L1 PSNP"},
+ { ISIS_PDU_L2_PSNP, "L2 PSNP"},
{ 0, NULL}
};
@@ -98,155 +99,273 @@ static struct tok isis_pdu_values[] = {
* list taken from rfc3359 plus some memory from veterans ;-)
*/
-#define TLV_AREA_ADDR 1 /* iso10589 */
-#define TLV_IS_REACH 2 /* iso10589 */
-#define TLV_ESNEIGH 3 /* iso10589 */
-#define TLV_PART_DIS 4 /* iso10589 */
-#define TLV_PREFIX_NEIGH 5 /* iso10589 */
-#define TLV_ISNEIGH 6 /* iso10589 */
-#define TLV_ISNEIGH_VARLEN 7 /* iso10589 */
-#define TLV_PADDING 8 /* iso10589 */
-#define TLV_LSP 9 /* iso10589 */
-#define TLV_AUTH 10 /* iso10589, rfc3567 */
-#define TLV_CHECKSUM 12 /* rfc3358 */
-#define TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
-#define TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */
-#define TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
-#define TLV_DECNET_PHASE4 42
-#define TLV_LUCENT_PRIVATE 66
-#define TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
-#define TLV_PROTOCOLS 129 /* rfc1195 */
-#define TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
-#define TLV_IDRP_INFO 131 /* rfc1195 */
-#define TLV_IPADDR 132 /* rfc1195 */
-#define TLV_IPAUTH 133 /* rfc1195 */
-#define TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */
-#define TLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
-#define TLV_HOSTNAME 137 /* rfc2763 */
-#define TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
-#define TLV_NORTEL_PRIVATE1 176
-#define TLV_NORTEL_PRIVATE2 177
-#define TLV_HOLDTIME 198 /* ES-IS */
-#define TLV_RESTART_SIGNALING 211 /* draft-ietf-isis-restart-01 */
-#define TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
-#define TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
-#define TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
-#define TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */
-#define TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */
-#define TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */
-#define TLV_PTP_ADJ 240 /* rfc3373 */
-#define TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */
-#define TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-proprietary-tlv-00 */
+#define ISIS_TLV_AREA_ADDR 1 /* iso10589 */
+#define ISIS_TLV_IS_REACH 2 /* iso10589 */
+#define ISIS_TLV_ESNEIGH 3 /* iso10589 */
+#define ISIS_TLV_PART_DIS 4 /* iso10589 */
+#define ISIS_TLV_PREFIX_NEIGH 5 /* iso10589 */
+#define ISIS_TLV_ISNEIGH 6 /* iso10589 */
+#define ISIS_TLV_ISNEIGH_VARLEN 7 /* iso10589 */
+#define ISIS_TLV_PADDING 8 /* iso10589 */
+#define ISIS_TLV_LSP 9 /* iso10589 */
+#define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */
+#define ISIS_TLV_CHECKSUM 12 /* rfc3358 */
+#define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
+#define ISIS_TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */
+#define ISIS_TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
+#define ISIS_TLV_DECNET_PHASE4 42
+#define ISIS_TLV_LUCENT_PRIVATE 66
+#define ISIS_TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
+#define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */
+#define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
+#define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */
+#define ISIS_TLV_IPADDR 132 /* rfc1195 */
+#define ISIS_TLV_IPAUTH 133 /* rfc1195 */
+#define ISIS_TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */
+#define ISIS_TLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
+#define ISIS_TLV_HOSTNAME 137 /* rfc2763 */
+#define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
+#define ISIS_TLV_NORTEL_PRIVATE1 176
+#define ISIS_TLV_NORTEL_PRIVATE2 177
+#define ISIS_TLV_RESTART_SIGNALING 211 /* draft-ietf-isis-restart-01 */
+#define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
+#define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
+#define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
+#define ISIS_TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */
+#define ISIS_TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */
+#define ISIS_TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */
+#define ISIS_TLV_PTP_ADJ 240 /* rfc3373 */
+#define ISIS_TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */
+#define ISIS_TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-experimental-tlv-01 */
static struct tok isis_tlv_values[] = {
- { TLV_AREA_ADDR, "Area address(es)"},
- { TLV_IS_REACH, "IS Reachability"},
- { TLV_ESNEIGH, "ES Neighbor(s)"},
- { TLV_PART_DIS, "Partition DIS"},
- { TLV_PREFIX_NEIGH, "Prefix Neighbors"},
- { TLV_ISNEIGH, "IS Neighbor(s)"},
- { TLV_ISNEIGH_VARLEN, "IS Neighbor(s) (variable length)"},
- { TLV_PADDING, "Padding"},
- { TLV_LSP, "LSP entries"},
- { TLV_AUTH, "Authentication"},
- { TLV_CHECKSUM, "Checksum"},
- { TLV_LSP_BUFFERSIZE, "LSP Buffersize"},
- { TLV_EXT_IS_REACH, "Extended IS Reachability"},
- { TLV_IS_ALIAS_ID, "IS Alias ID"},
- { TLV_DECNET_PHASE4, "DECnet Phase IV"},
- { TLV_LUCENT_PRIVATE, "Lucent Proprietary"},
- { TLV_INT_IP_REACH, "IPv4 Internal Reachability"},
- { TLV_PROTOCOLS, "Protocols supported"},
- { TLV_EXT_IP_REACH, "IPv4 External Reachability"},
- { TLV_IDRP_INFO, "Inter-Domain Information Type"},
- { TLV_IPADDR, "IPv4 Interface address(es)"},
- { TLV_IPAUTH, "IPv4 authentication (deprecated)"},
- { TLV_TE_ROUTER_ID, "Traffic Engineering Router ID"},
- { TLV_EXTD_IP_REACH, "Extended IPv4 Reachability"},
- { TLV_HOSTNAME, "Hostname"},
- { TLV_SHARED_RISK_GROUP, "Shared Risk Link Group"},
- { TLV_NORTEL_PRIVATE1, "Nortel Proprietary"},
- { TLV_NORTEL_PRIVATE2, "Nortel Proprietary"},
- { TLV_HOLDTIME, "Holdtime"},
- { TLV_RESTART_SIGNALING, "Restart Signaling"},
- { TLV_MT_IS_REACH, "Multi Topology IS Reachability"},
- { TLV_MT_SUPPORTED, "Multi Topology"},
- { TLV_IP6ADDR, "IPv6 Interface address(es)"},
- { TLV_MT_IP_REACH, "Multi-Topology IPv4 Reachability"},
- { TLV_IP6_REACH, "IPv6 reachability"},
- { TLV_MT_IP6_REACH, "Multi-Topology IP6 Reachability"},
- { TLV_PTP_ADJ, "Point-to-point Adjacency State"},
- { TLV_IIH_SEQNR, "Hello PDU Sequence Number"},
- { TLV_VENDOR_PRIVATE, "Vendor Private"},
+ { ISIS_TLV_AREA_ADDR, "Area address(es)"},
+ { ISIS_TLV_IS_REACH, "IS Reachability"},
+ { ISIS_TLV_ESNEIGH, "ES Neighbor(s)"},
+ { ISIS_TLV_PART_DIS, "Partition DIS"},
+ { ISIS_TLV_PREFIX_NEIGH, "Prefix Neighbors"},
+ { ISIS_TLV_ISNEIGH, "IS Neighbor(s)"},
+ { ISIS_TLV_ISNEIGH_VARLEN, "IS Neighbor(s) (variable length)"},
+ { ISIS_TLV_PADDING, "Padding"},
+ { ISIS_TLV_LSP, "LSP entries"},
+ { ISIS_TLV_AUTH, "Authentication"},
+ { ISIS_TLV_CHECKSUM, "Checksum"},
+ { ISIS_TLV_LSP_BUFFERSIZE, "LSP Buffersize"},
+ { ISIS_TLV_EXT_IS_REACH, "Extended IS Reachability"},
+ { ISIS_TLV_IS_ALIAS_ID, "IS Alias ID"},
+ { ISIS_TLV_DECNET_PHASE4, "DECnet Phase IV"},
+ { ISIS_TLV_LUCENT_PRIVATE, "Lucent Proprietary"},
+ { ISIS_TLV_INT_IP_REACH, "IPv4 Internal Reachability"},
+ { ISIS_TLV_PROTOCOLS, "Protocols supported"},
+ { ISIS_TLV_EXT_IP_REACH, "IPv4 External Reachability"},
+ { ISIS_TLV_IDRP_INFO, "Inter-Domain Information Type"},
+ { ISIS_TLV_IPADDR, "IPv4 Interface address(es)"},
+ { ISIS_TLV_IPAUTH, "IPv4 authentication (deprecated)"},
+ { ISIS_TLV_TE_ROUTER_ID, "Traffic Engineering Router ID"},
+ { ISIS_TLV_EXTD_IP_REACH, "Extended IPv4 Reachability"},
+ { ISIS_TLV_SHARED_RISK_GROUP, "Shared Risk Link Group"},
+ { ISIS_TLV_NORTEL_PRIVATE1, "Nortel Proprietary"},
+ { ISIS_TLV_NORTEL_PRIVATE2, "Nortel Proprietary"},
+ { ISIS_TLV_HOSTNAME, "Hostname"},
+ { ISIS_TLV_RESTART_SIGNALING, "Restart Signaling"},
+ { ISIS_TLV_MT_IS_REACH, "Multi Topology IS Reachability"},
+ { ISIS_TLV_MT_SUPPORTED, "Multi Topology"},
+ { ISIS_TLV_IP6ADDR, "IPv6 Interface address(es)"},
+ { ISIS_TLV_MT_IP_REACH, "Multi-Topology IPv4 Reachability"},
+ { ISIS_TLV_IP6_REACH, "IPv6 reachability"},
+ { ISIS_TLV_MT_IP6_REACH, "Multi-Topology IP6 Reachability"},
+ { ISIS_TLV_PTP_ADJ, "Point-to-point Adjacency State"},
+ { ISIS_TLV_IIH_SEQNR, "Hello PDU Sequence Number"},
+ { ISIS_TLV_VENDOR_PRIVATE, "Vendor Private"},
+ { 0, NULL }
+};
+
+#define ESIS_OPTION_PROTOCOLS 129
+#define ESIS_OPTION_QOS_MAINTENANCE 195 /* iso9542 */
+#define ESIS_OPTION_SECURITY 197 /* iso9542 */
+#define ESIS_OPTION_ES_CONF_TIME 198 /* iso9542 */
+#define ESIS_OPTION_PRIORITY 205 /* iso9542 */
+#define ESIS_OPTION_ADDRESS_MASK 225 /* iso9542 */
+#define ESIS_OPTION_SNPA_MASK 226 /* iso9542 */
+
+static struct tok esis_option_values[] = {
+ { ESIS_OPTION_PROTOCOLS, "Protocols supported"},
+ { ESIS_OPTION_QOS_MAINTENANCE, "QoS Maintenance" },
+ { ESIS_OPTION_SECURITY, "Security" },
+ { ESIS_OPTION_ES_CONF_TIME, "ES Configuration Time" },
+ { ESIS_OPTION_PRIORITY, "Priority" },
+ { ESIS_OPTION_ADDRESS_MASK, "Addressk Mask" },
+ { ESIS_OPTION_SNPA_MASK, "SNPA Mask" },
{ 0, NULL }
};
-#define SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* draft-ietf-isis-gmpls-extensions */
-#define SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */
-#define SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* draft-ietf-isis-gmpls-extensions */
-#define SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* draft-ietf-isis-gmpls-extensions */
+#define CLNP_OPTION_DISCARD_REASON 193
+#define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
+#define CLNP_OPTION_PRIORITY 205 /* iso8473 */
+
+static struct tok clnp_option_values[] = {
+ { CLNP_OPTION_DISCARD_REASON, "Discard Reason"},
+ { CLNP_OPTION_PRIORITY, "Priority"},
+ { CLNP_OPTION_QOS_MAINTENANCE, "QoS Maintenance"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_class_values[] = {
+ { 0x0, "General"},
+ { 0x8, "Address"},
+ { 0x9, "Source Routeing"},
+ { 0xa, "Lifetime"},
+ { 0xb, "PDU Discarded"},
+ { 0xc, "Reassembly"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_general_values[] = {
+ { 0x0, "Reason not specified"},
+ { 0x1, "Protocol procedure error"},
+ { 0x2, "Incorrect checksum"},
+ { 0x3, "PDU discarded due to congestion"},
+ { 0x4, "Header syntax error (cannot be parsed)"},
+ { 0x5, "Segmentation needed but not permitted"},
+ { 0x6, "Incomplete PDU received"},
+ { 0x7, "Duplicate option"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_address_values[] = {
+ { 0x0, "Destination address unreachable"},
+ { 0x1, "Destination address unknown"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_source_routeing_values[] = {
+ { 0x0, "Unspecified source routeing error"},
+ { 0x1, "Syntax error in source routeing field"},
+ { 0x2, "Unknown address in source routeing field"},
+ { 0x3, "Path not acceptable"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_lifetime_values[] = {
+ { 0x0, "Lifetime expired while data unit in transit"},
+ { 0x1, "Lifetime expired during reassembly"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_pdu_discard_values[] = {
+ { 0x0, "Unsupported option not specified"},
+ { 0x1, "Unsupported protocol version"},
+ { 0x2, "Unsupported security option"},
+ { 0x3, "Unsupported source routeing option"},
+ { 0x4, "Unsupported recording of route option"},
+ { 0, NULL }
+};
+
+static struct tok clnp_option_rfd_reassembly_values[] = {
+ { 0x0, "Reassembly interference"},
+ { 0, NULL }
+};
+
+/* array of 16 error-classes */
+static struct tok *clnp_option_rfd_error_class[] = {
+ clnp_option_rfd_general_values,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ clnp_option_rfd_address_values,
+ clnp_option_rfd_source_routeing_values,
+ clnp_option_rfd_lifetime_values,
+ clnp_option_rfd_pdu_discard_values,
+ clnp_option_rfd_reassembly_values,
+ NULL,
+ NULL,
+ NULL
+};
+
+
+#define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* draft-ietf-isis-gmpls-extensions */
+#define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_DIFFSERV_TE 12 /* draft-ietf-tewg-diff-te-proto-06 */
+#define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */
+#define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* draft-ietf-isis-gmpls-extensions */
+#define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* draft-ietf-isis-gmpls-extensions */
static struct tok isis_ext_is_reach_subtlv_values[] = {
- { SUBTLV_EXT_IS_REACH_ADMIN_GROUP, "Administrative groups" },
- { SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID, "Link Local/Remote Identifier" },
- { SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID, "Link Remote Identifier" },
- { SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR, "IPv4 interface address" },
- { SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR, "IPv4 neighbor address" },
- { SUBTLV_EXT_IS_REACH_MAX_LINK_BW, "Maximum link bandwidth" },
- { SUBTLV_EXT_IS_REACH_RESERVABLE_BW, "Reservable link bandwidth" },
- { SUBTLV_EXT_IS_REACH_UNRESERVED_BW, "Unreserved bandwidth" },
- { SUBTLV_EXT_IS_REACH_TE_METRIC, "Traffic Engineering Metric" },
- { SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE, "Link Protection Type" },
- { SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR, "Interface Switching Capability" },
- { 250, "Reserved for cisco specific extensions" },
- { 251, "Reserved for cisco specific extensions" },
- { 252, "Reserved for cisco specific extensions" },
- { 253, "Reserved for cisco specific extensions" },
- { 254, "Reserved for cisco specific extensions" },
- { 255, "Reserved for future expansion" },
+ { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP, "Administrative groups" },
+ { ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID, "Link Local/Remote Identifier" },
+ { ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID, "Link Remote Identifier" },
+ { ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR, "IPv4 interface address" },
+ { ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR, "IPv4 neighbor address" },
+ { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW, "Maximum link bandwidth" },
+ { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW, "Reservable link bandwidth" },
+ { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW, "Unreserved bandwidth" },
+ { ISIS_SUBTLV_EXT_IS_REACH_DIFFSERV_TE, "Diffserv TE" },
+ { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC, "Traffic Engineering Metric" },
+ { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE, "Link Protection Type" },
+ { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR, "Interface Switching Capability" },
+ { 250, "Reserved for cisco specific extensions" },
+ { 251, "Reserved for cisco specific extensions" },
+ { 252, "Reserved for cisco specific extensions" },
+ { 253, "Reserved for cisco specific extensions" },
+ { 254, "Reserved for cisco specific extensions" },
+ { 255, "Reserved for future expansion" },
{ 0, NULL }
};
-#define SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1
-#define SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2
+#define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */
+#define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */
+#define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */
static struct tok isis_ext_ip_reach_subtlv_values[] = {
- { SUBTLV_EXTD_IP_REACH_ADMIN_TAG32, "32-Bit Administrative tag" },
- { SUBTLV_EXTD_IP_REACH_ADMIN_TAG64, "64-Bit Administrative tag" },
+ { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32, "32-Bit Administrative tag" },
+ { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64, "64-Bit Administrative tag" },
+ { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR, "Management Prefix Color" },
{ 0, NULL }
};
-#define SUBTLV_AUTH_SIMPLE 1
-#define SUBTLV_AUTH_MD5 54
-#define SUBTLV_AUTH_MD5_LEN 16
-#define SUBTLV_AUTH_PRIVATE 255
+#define ISIS_SUBTLV_AUTH_SIMPLE 1
+#define ISIS_SUBTLV_AUTH_MD5 54
+#define ISIS_SUBTLV_AUTH_MD5_LEN 16
+#define ISIS_SUBTLV_AUTH_PRIVATE 255
static struct tok isis_subtlv_auth_values[] = {
- { SUBTLV_AUTH_SIMPLE, "simple text password"},
- { SUBTLV_AUTH_MD5, "HMAC-MD5 password"},
- { SUBTLV_AUTH_PRIVATE, "Routing Domain private password"},
+ { ISIS_SUBTLV_AUTH_SIMPLE, "simple text password"},
+ { ISIS_SUBTLV_AUTH_MD5, "HMAC-MD5 password"},
+ { ISIS_SUBTLV_AUTH_PRIVATE, "Routing Domain private password"},
{ 0, NULL }
};
-#define SUBTLV_IDRP_RES 0
-#define SUBTLV_IDRP_LOCAL 1
-#define SUBTLV_IDRP_ASN 2
+#define ISIS_SUBTLV_IDRP_RES 0
+#define ISIS_SUBTLV_IDRP_LOCAL 1
+#define ISIS_SUBTLV_IDRP_ASN 2
static struct tok isis_subtlv_idrp_values[] = {
- { SUBTLV_IDRP_RES, "Reserved"},
- { SUBTLV_IDRP_LOCAL, "Routing-Domain Specific"},
- { SUBTLV_IDRP_ASN, "AS Number Tag"},
+ { ISIS_SUBTLV_IDRP_RES, "Reserved"},
+ { ISIS_SUBTLV_IDRP_LOCAL, "Routing-Domain Specific"},
+ { ISIS_SUBTLV_IDRP_ASN, "AS Number Tag"},
{ 0, NULL}
};
-#define ISIS_8BIT_MASK(x) ((x)&0xff)
+#define CLNP_SEGMENT_PART 0x80
+#define CLNP_MORE_SEGMENTS 0x40
+#define CLNP_REQUEST_ER 0x20
+
+static struct tok clnp_flag_values[] = {
+ { CLNP_SEGMENT_PART, "Segmentation permitted"},
+ { CLNP_MORE_SEGMENTS, "more Segments"},
+ { CLNP_REQUEST_ER, "request Error Report"},
+ { 0, NULL}
+};
#define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
#define ISIS_MASK_LSP_ISTYPE_BITS(x) ((x)&0x3)
@@ -308,13 +427,6 @@ static struct tok isis_lsp_istype_values[] = {
{ 0, NULL }
};
-static struct tok osi_nlpid_values[] = {
- { NLPID_CLNS, "CLNS"},
- { NLPID_IP, "IPv4"},
- { NLPID_IP6, "IPv6"},
- { 0, NULL }
-};
-
/*
* Katz's point to point adjacency TLV uses codes to tell us the state of
* the remote adjacency. Enumerate them.
@@ -324,7 +436,6 @@ static struct tok osi_nlpid_values[] = {
#define ISIS_PTP_ADJ_INIT 1
#define ISIS_PTP_ADJ_DOWN 2
-
static struct tok isis_ptp_adjancey_values[] = {
{ ISIS_PTP_ADJ_UP, "Up" },
{ ISIS_PTP_ADJ_INIT, "Initializing" },
@@ -340,6 +451,7 @@ struct isis_tlv_ptp_adj {
};
static int osi_cksum(const u_int8_t *, u_int);
+static int clnp_print(const u_int8_t *, u_int);
static void esis_print(const u_int8_t *, u_int);
static int isis_print(const u_int8_t *, u_int);
@@ -434,35 +546,6 @@ struct isis_tlv_lsp {
u_int8_t checksum[2];
};
-static char *
-print_nsap(register const u_int8_t *pptr, register int nsap_length)
-{
- int nsap_idx;
- static char nsap_ascii_output[sizeof("xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx")];
- char *junk_buf = nsap_ascii_output;
-
- if (nsap_length < 1 || nsap_length > 20) {
- snprintf(nsap_ascii_output, sizeof(nsap_ascii_output),
- "illegal length");
- return (nsap_ascii_output);
- }
-
- for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
- if (!TTEST2(*pptr, 1))
- return (0);
- snprintf(junk_buf,
- sizeof(nsap_ascii_output) - (junk_buf - nsap_ascii_output),
- "%02x", *pptr++);
- junk_buf += strlen(junk_buf);
- if (((nsap_idx & 1) == 0) &&
- (nsap_idx + 1 < nsap_length)) {
- *junk_buf++ = '.';
- }
- }
- *(junk_buf) = '\0';
- return (nsap_ascii_output);
-}
-
#define ISIS_COMMON_HEADER_SIZE (sizeof(struct isis_common_header))
#define ISIS_IIH_LAN_HEADER_SIZE (sizeof(struct isis_iih_lan_header))
#define ISIS_IIH_PTP_HEADER_SIZE (sizeof(struct isis_iih_ptp_header))
@@ -476,15 +559,21 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen)
header = (const struct isis_common_header *)p;
- printf("%sOSI", caplen < 1 ? "|" : "");
-
- if (caplen < 1) /* enough bytes on the wire ? */
- return;
+ if (caplen <= 1) { /* enough bytes on the wire ? */
+ printf("|OSI");
+ return;
+ }
+ if (eflag)
+ printf("OSI NLPID %s (0x%02x): ",
+ tok2str(nlpid_values,"Unknown",*p),
+ *p);
+
switch (*p) {
- case NLPID_CLNS:
- (void)printf(", CLNS, length %u", length);
+ case NLPID_CLNP:
+ if (!clnp_print(p, length))
+ print_unknown_data(p,"\n\t",caplen);
break;
case NLPID_ESIS:
@@ -497,188 +586,477 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen)
break;
case NLPID_NULLNS:
- (void)printf(", ISO NULLNS, length: %u", length);
+ (void)printf(", length: %u", length);
break;
+ case NLPID_Q933:
+ q933_print(p+1, length-1);
+ break;
+
+ case NLPID_IP:
+ ip_print(gndo, p+1, length-1);
+ break;
+
+#ifdef INET6
+ case NLPID_IP6:
+ ip6_print(p+1, length-1);
+ break;
+#endif
+
+ case NLPID_PPP:
+ ppp_print(p+1, length-1);
+ break;
+
default:
- (void)printf(", Unknown NLPID 0x%02x, length: %u", p[0], length);
+ if (!eflag)
+ printf("OSI NLPID 0x%02x unknown",*p);
+ (void)printf(", length: %u", length);
if (caplen > 1)
print_unknown_data(p,"\n\t",caplen);
break;
}
}
-#define ESIS_REDIRECT 6
-#define ESIS_ESH 2
-#define ESIS_ISH 4
+#define CLNP_PDU_ER 1
+#define CLNP_PDU_DT 28
+#define CLNP_PDU_MD 29
+#define CLNP_PDU_ERQ 30
+#define CLNP_PDU_ERP 31
+
+static struct tok clnp_pdu_values[] = {
+ { CLNP_PDU_ER, "Error Report"},
+ { CLNP_PDU_MD, "MD"},
+ { CLNP_PDU_DT, "Data"},
+ { CLNP_PDU_ERQ, "Echo Request"},
+ { CLNP_PDU_ERP, "Echo Response"},
+ { 0, NULL }
+};
+
+struct clnp_header_t {
+ u_int8_t nlpid;
+ u_int8_t length_indicator;
+ u_int8_t version;
+ u_int8_t lifetime; /* units of 500ms */
+ u_int8_t type;
+ u_int8_t segment_length[2];
+ u_int8_t cksum[2];
+};
+
+struct clnp_segment_header_t {
+ u_int8_t data_unit_id[2];
+ u_int8_t segment_offset[2];
+ u_int8_t total_length[2];
+};
+
+/*
+ * clnp_print
+ * Decode CLNP packets. Return 0 on error.
+ */
+
+static int clnp_print (const u_int8_t *pptr, u_int length)
+{
+ const u_int8_t *optr,*source_address,*dest_address;
+ u_int li,source_address_length,dest_address_length, clnp_pdu_type, clnp_flags;
+ const struct clnp_header_t *clnp_header;
+ const struct clnp_segment_header_t *clnp_segment_header;
+ u_int8_t rfd_error_major,rfd_error_minor;
+
+ clnp_header = (const struct clnp_header_t *) pptr;
+ TCHECK(*clnp_header);
+
+ li = clnp_header->length_indicator;
+ optr = pptr;
+
+ if (!eflag)
+ printf("CLNP");
+
+ /*
+ * Sanity checking of the header.
+ */
+
+ if (clnp_header->version != CLNP_VERSION) {
+ printf("version %d packet not supported", clnp_header->version);
+ return (0);
+ }
+
+ /* FIXME further header sanity checking */
+
+ clnp_pdu_type = clnp_header->type & CLNP_PDU_TYPE_MASK;
+ clnp_flags = clnp_header->type & CLNP_FLAG_MASK;
+
+ pptr += sizeof(struct clnp_header_t);
+ li -= sizeof(struct clnp_header_t);
+ dest_address_length = *pptr;
+ dest_address = pptr + 1;
+
+ pptr += (1 + dest_address_length);
+ li -= (1 + dest_address_length);
+ source_address_length = *pptr;
+ source_address = pptr +1;
+
+ pptr += (1 + source_address_length);
+ li -= (1 + source_address_length);
+
+ if (vflag < 1) {
+ printf("%s%s > %s, %s, length %u",
+ eflag ? "" : ", ",
+ isonsap_string(source_address, source_address_length),
+ isonsap_string(dest_address, dest_address_length),
+ tok2str(clnp_pdu_values,"unknown (%u)",clnp_pdu_type),
+ length);
+ return (1);
+ }
+ printf("%slength %u",eflag ? "" : ", ",length);
+
+ printf("\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x ",
+ tok2str(clnp_pdu_values, "unknown (%u)",clnp_pdu_type),
+ clnp_header->length_indicator,
+ clnp_header->version,
+ clnp_header->lifetime/2,
+ (clnp_header->lifetime%2)*5,
+ EXTRACT_16BITS(clnp_header->segment_length),
+ EXTRACT_16BITS(clnp_header->cksum));
+
+ /* do not attempt to verify the checksum if it is zero */
+ if (EXTRACT_16BITS(clnp_header->cksum) == 0)
+ printf("(unverified)");
+ else printf("(%s)", osi_cksum(optr, clnp_header->length_indicator) ? "incorrect" : "correct");
+
+ printf("\n\tFlags [%s]",
+ bittok2str(clnp_flag_values,"none",clnp_flags));
+
+ printf("\n\tsource address (length %u): %s\n\tdest address (length %u): %s",
+ source_address_length,
+ isonsap_string(source_address, source_address_length),
+ dest_address_length,
+ isonsap_string(dest_address,dest_address_length));
+
+ if (clnp_flags & CLNP_SEGMENT_PART) {
+ clnp_segment_header = (const struct clnp_segment_header_t *) pptr;
+ printf("\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
+ EXTRACT_16BITS(clnp_segment_header->data_unit_id),
+ EXTRACT_16BITS(clnp_segment_header->segment_offset),
+ EXTRACT_16BITS(clnp_segment_header->total_length));
+ pptr+=sizeof(const struct clnp_segment_header_t);
+ li-=sizeof(const struct clnp_segment_header_t);
+ }
+
+ /* now walk the options */
+ while (li >= 2) {
+ u_int op, opli;
+ const u_int8_t *tptr;
+
+ if (snapend - pptr < 2)
+ return (0);
+ if (li < 2) {
+ printf(", bad opts/li");
+ return (0);
+ }
+ op = *pptr++;
+ opli = *pptr++;
+ li -= 2;
+ if (opli > li) {
+ printf(", opt (%d) too long", op);
+ return (0);
+ }
+ li -= opli;
+ tptr = pptr;
+
+ if (snapend < pptr)
+ return(0);
+
+ printf("\n\t %s Option #%u, length %u, value: ",
+ tok2str(clnp_option_values,"Unknown",op),
+ op,
+ opli);
+
+ switch (op) {
+
+ case CLNP_OPTION_PRIORITY:
+ printf("%u", *tptr);
+ break;
+
+ case CLNP_OPTION_DISCARD_REASON:
+ rfd_error_major = (*tptr&0xf0) >> 4;
+ rfd_error_minor = *tptr&0x0f;
+ printf("\n\t Class: %s Error (0x%01x), %s (0x%01x)",
+ tok2str(clnp_option_rfd_class_values,"Unknown",rfd_error_major),
+ rfd_error_major,
+ tok2str(clnp_option_rfd_error_class[rfd_error_major],"Unknown",rfd_error_minor),
+ rfd_error_minor);
+ break;
+
+ /*
+ * FIXME those are the defined Options that lack a decoder
+ * you are welcome to contribute code ;-)
+ */
+
+ default:
+ print_unknown_data(tptr,"\n\t ",opli);
+ break;
+ }
+ if (vflag > 1)
+ print_unknown_data(pptr,"\n\t ",opli);
+ pptr += opli;
+ }
+
+ switch (clnp_pdu_type) {
+
+ case CLNP_PDU_ER: /* fall through */
+ case CLNP_PDU_ERP:
+ if (*(pptr) == NLPID_CLNP) {
+ printf("\n\t-----original packet-----\n\t");
+ /* FIXME recursion protection */
+ clnp_print(pptr, length-clnp_header->length_indicator);
+ break;
+ }
+
+ case CLNP_PDU_DT:
+ case CLNP_PDU_MD:
+ case CLNP_PDU_ERQ:
+
+ default:
+ /* dump the PDU specific data */
+ if (length-(pptr-optr) > 0) {
+ printf("\n\t undecoded non-header data, length %u",length-clnp_header->length_indicator);
+ print_unknown_data(pptr,"\n\t ",length-(pptr-optr));
+ }
+ }
+
+ return (1);
+
+ trunc:
+ fputs("[|clnp]", stdout);
+ return (1);
+
+}
+
+
+#define ESIS_PDU_REDIRECT 6
+#define ESIS_PDU_ESH 2
+#define ESIS_PDU_ISH 4
-static struct tok esis_values[] = {
- { ESIS_REDIRECT, "redirect"},
- { ESIS_ESH, "ESH"},
- { ESIS_ISH, "ISH"},
+static struct tok esis_pdu_values[] = {
+ { ESIS_PDU_REDIRECT, "redirect"},
+ { ESIS_PDU_ESH, "ESH"},
+ { ESIS_PDU_ISH, "ISH"},
{ 0, NULL }
};
-struct esis_hdr {
+struct esis_header_t {
+ u_int8_t nlpid;
+ u_int8_t length_indicator;
u_int8_t version;
u_int8_t reserved;
u_int8_t type;
- u_int8_t tmo[2];
+ u_int8_t holdtime[2];
u_int8_t cksum[2];
};
static void
-esis_print(const u_int8_t *p, u_int length)
+esis_print(const u_int8_t *pptr, u_int length)
{
- const u_int8_t *ep;
- u_int li;
- const struct esis_hdr *eh;
+ const u_int8_t *optr;
+ u_int li,esis_pdu_type,source_address_length, source_address_number;
+ const struct esis_header_t *esis_header;
+
+ if (!eflag)
+ printf("ES-IS");
if (length <= 2) {
if (qflag)
- printf(" bad pkt!");
+ printf("bad pkt!");
else
- printf(" no header at all!");
+ printf("no header at all!");
return;
}
- li = p[1];
- eh = (const struct esis_hdr *) &p[2];
- ep = p + li;
+
+ esis_header = (const struct esis_header_t *) pptr;
+ li = esis_header->length_indicator;
+ optr = pptr;
+
+ /*
+ * Sanity checking of the header.
+ */
+
+ if (esis_header->nlpid != NLPID_ESIS) {
+ printf(" nlpid 0x%02x packet not supported", esis_header->nlpid);
+ return;
+ }
+
+ if (esis_header->version != ESIS_VERSION) {
+ printf(" version %d packet not supported", esis_header->version);
+ return;
+ }
+
if (li > length) {
- if (qflag)
- printf(" bad pkt!");
- else
- printf(" LI(%d) > PDU size (%d)!", li, length);
- return;
+ printf(" length indicator(%d) > PDU size (%d)!", li, length);
+ return;
}
- if (li < sizeof(struct esis_hdr) + 2) {
- if (qflag)
- printf(" bad pkt!");
- else {
- printf(" too short for esis header %d:", li);
- while (--length != 0)
- printf("%02X", *p++);
- }
- return;
+
+ if (li < sizeof(struct esis_header_t) + 2) {
+ printf(" length indicator < min PDU size %d:", li);
+ while (--length != 0)
+ printf("%02X", *pptr++);
+ return;
}
- printf(", ES-IS, %s, length %u",
- tok2str(esis_values,"unknown type: %u",eh->type & 0x1f),
- length);
+ esis_pdu_type = esis_header->type & ESIS_PDU_TYPE_MASK;
- if(vflag < 1)
- return;
+ if (vflag < 1) {
+ printf("%s%s, length %u",
+ eflag ? "" : ", ",
+ tok2str(esis_pdu_values,"unknown type (%u)",esis_pdu_type),
+ length);
+ return;
+ } else
+ printf("%slength %u\n\t%s (%u)",
+ eflag ? "" : ", ",
+ length,
+ tok2str(esis_pdu_values,"unknown type: %u", esis_pdu_type),
+ esis_pdu_type);
+
+ printf(", v: %u%s", esis_header->version, esis_header->version == ESIS_VERSION ? "" : "unsupported" );
+ printf(", checksum: 0x%04x ", EXTRACT_16BITS(esis_header->cksum));
+ /* do not attempt to verify the checksum if it is zero */
+ if (EXTRACT_16BITS(esis_header->cksum) == 0)
+ printf("(unverified)");
+ else printf("(%s)", osi_cksum(pptr, li) ? "incorrect" : "correct");
- if (vflag && osi_cksum(p, li)) {
- printf(" bad cksum (got 0x%02x%02x)",
- eh->cksum[1], eh->cksum[0]);
- default_print(p, length);
- return;
- }
- if (eh->version != 1) {
- printf(" unsupported version %d", eh->version);
- return;
- }
- p += sizeof(*eh) + 2;
- li -= sizeof(*eh) + 2; /* protoid * li */
+ printf(", holding time: %us, length indicator: %u",EXTRACT_16BITS(esis_header->holdtime),li);
- switch (eh->type & 0x1f) {
- case ESIS_REDIRECT: {
- const u_int8_t *dst, *snpa, *is;
+ if (vflag > 1)
+ print_unknown_data(optr,"\n\t",sizeof(struct esis_header_t));
- dst = p; p += *p + 1;
- if (p > snapend)
- return;
- printf("\n\t\t %s", isonsap_string(dst));
- snpa = p; p += *p + 1;
- is = p; p += *p + 1;
- if (p > snapend)
+ pptr += sizeof(struct esis_header_t);
+ li -= sizeof(struct esis_header_t);
+
+ switch (esis_pdu_type) {
+ case ESIS_PDU_REDIRECT: {
+ const u_int8_t *dst, *snpa, *tptr;
+
+ dst = pptr; pptr += *pptr + 1;
+ if (pptr > snapend)
return;
- if (p > ep) {
- printf(" [bad li]");
+ printf("\n\t %s", isonsap_string(dst+1,*dst));
+ snpa = pptr; pptr += *pptr + 1;
+ tptr = pptr; pptr += *pptr + 1;
+ if (pptr > snapend)
return;
- }
- if (is[0] == 0)
- printf(" > %s", etheraddr_string(&snpa[1]));
+
+ if (tptr[0] == 0)
+ printf("\n\t %s", etheraddr_string(&snpa[1]));
else
- printf(" > %s", isonsap_string(is));
- li = ep - p;
+ printf("\n\t %s", isonsap_string(tptr+1,*tptr));
break;
}
- case ESIS_ESH:
- break;
+ case ESIS_PDU_ESH:
+ source_address_number = *pptr;
+ pptr++;
+ li--;
+
+ printf("\n\t Number of Source Addresses: %u", source_address_number);
+
+ while (source_address_number > 0) {
+ source_address_length = *pptr;
+ printf("\n\t NET (length: %u): %s",
+ source_address_length,
+ isonsap_string(pptr+1,source_address_length));
+
+ pptr += source_address_length+1;
+ li -= source_address_length+1;
+ source_address_number--;
+ }
- case ESIS_ISH: {
- const u_int8_t *is;
+ break;
- is = p; p += *p + 1;
- if (p > ep) {
- printf(" [bad li]");
- return;
- }
- if (p > snapend)
- return;
- if (!qflag)
- printf("\n\tNET: %s", print_nsap(is+1,*is));
- li = ep - p;
- break;
+ case ESIS_PDU_ISH: {
+ source_address_length = *pptr;
+ printf("\n\t NET (length: %u): %s", source_address_length, isonsap_string(pptr+1, source_address_length));
+ pptr += source_address_length+1;
+ li -= source_address_length +1;
+ break;
}
default:
if (vflag <= 1) {
- if (p < snapend)
- print_unknown_data(p,"\n\t ",snapend-p);
+ if (pptr < snapend)
+ print_unknown_data(pptr,"\n\t ",snapend-pptr);
}
return;
}
- /* hexdump - FIXME ? */
- if (vflag > 1) {
- if (p < snapend)
- print_unknown_data(p,"\n\t ",snapend-p);
+ /* now walk the options */
+ while (li >= 2) {
+ u_int op, opli;
+ const u_int8_t *tptr;
+
+ if (snapend - pptr < 2)
+ return;
+ if (li < 2) {
+ printf(", bad opts/li");
+ return;
+ }
+ op = *pptr++;
+ opli = *pptr++;
+ li -= 2;
+ if (opli > li) {
+ printf(", opt (%d) too long", op);
+ return;
+ }
+ li -= opli;
+ tptr = pptr;
+
+ if (snapend < pptr)
+ return;
+
+ printf("\n\t %s Option #%u, length %u, value: ",
+ tok2str(esis_option_values,"Unknown",op),
+ op,
+ opli);
+
+ switch (op) {
+
+ case ESIS_OPTION_ES_CONF_TIME:
+ printf("%us", EXTRACT_16BITS(tptr));
+ break;
+
+
+ case ESIS_OPTION_PROTOCOLS:
+ while (opli>0) {
+ printf("%s (0x%02x)",
+ tok2str(nlpid_values,
+ "unknown",
+ *tptr),
+ *tptr);
+ if (opli>1) /* further NPLIDs ? - put comma */
+ printf(", ");
+ tptr++;
+ opli--;
+ }
+ break;
+
+ /*
+ * FIXME those are the defined Options that lack a decoder
+ * you are welcome to contribute code ;-)
+ */
+
+ case ESIS_OPTION_QOS_MAINTENANCE:
+ case ESIS_OPTION_SECURITY:
+ case ESIS_OPTION_PRIORITY:
+ case ESIS_OPTION_ADDRESS_MASK:
+ case ESIS_OPTION_SNPA_MASK:
+
+ default:
+ print_unknown_data(tptr,"\n\t ",opli);
+ break;
+ }
+ if (vflag > 1)
+ print_unknown_data(pptr,"\n\t ",opli);
+ pptr += opli;
}
- if (vflag)
- while (p < ep && li) {
- u_int op, opli;
- const u_int8_t *q;
-
- if (snapend - p < 2)
- return;
- if (li < 2) {
- printf(", bad opts/li");
- return;
- }
- op = *p++;
- opli = *p++;
- li -= 2;
- if (opli > li) {
- printf(", opt (%d) too long", op);
- return;
- }
- li -= opli;
- q = p;
- p += opli;
-
- if (snapend < p)
- return;
-
- if (op == TLV_HOLDTIME && opli == 2) {
- printf("\n\tholdtime: %us", EXTRACT_16BITS(q));
- continue;
- }
-
- if (op == TLV_PROTOCOLS && opli >= 1) {
- printf("\n\t%s (length: %u): %s",
- tok2str(isis_tlv_values, "unknown", op),
- opli,
- tok2str(osi_nlpid_values,"Unknown 0x%02x",*q));
- continue;
- }
-
- print_unknown_data(q,"\n\t ",opli);
- }
-}
+}
/* shared routine for printing system, node and lsp-ids */
static char *
@@ -808,7 +1186,8 @@ isis_print_ip_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
goto trunctlv;
switch(subt) {
- case SUBTLV_EXTD_IP_REACH_ADMIN_TAG32:
+ case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR: /* fall through */
+ case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32:
while (subl >= 4) {
printf(", 0x%08x (=%u)",
EXTRACT_32BITS(tptr),
@@ -817,7 +1196,7 @@ isis_print_ip_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
subl-=4;
}
break;
- case SUBTLV_EXTD_IP_REACH_ADMIN_TAG64:
+ case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64:
while (subl >= 8) {
printf(", 0x%08x%08x",
EXTRACT_32BITS(tptr),
@@ -847,7 +1226,7 @@ trunctlv:
static int
isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) {
- int priority_level;
+ int priority_level,bandwidth_constraint;
union { /* int to float conversion buffer for several subTLVs */
float f;
u_int32_t i;
@@ -866,28 +1245,28 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
goto trunctlv;
switch(subt) {
- case SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
- case SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
- case SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
+ case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
if (subl >= 4) {
printf(", 0x%08x", EXTRACT_32BITS(tptr));
if (subl == 8) /* draft-ietf-isis-gmpls-extensions */
printf(", 0x%08x", EXTRACT_32BITS(tptr+4));
}
break;
- case SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
- case SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
+ case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
+ case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
if (subl >= 4)
printf(", %s", ipaddr_string(tptr));
break;
- case SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
- case SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
+ case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
+ case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
if (subl >= 4) {
bw.i = EXTRACT_32BITS(tptr);
printf(", %.3f Mbps", bw.f*8/1000000 );
}
break;
- case SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
+ case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
if (subl >= 32) {
for (priority_level = 0; priority_level < 8; priority_level++) {
bw.i = EXTRACT_32BITS(tptr);
@@ -899,18 +1278,34 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
}
}
break;
- case SUBTLV_EXT_IS_REACH_TE_METRIC:
+ case ISIS_SUBTLV_EXT_IS_REACH_DIFFSERV_TE:
+ printf("%sBandwidth Constraints Model ID: %s (%u)",
+ ident,
+ tok2str(diffserv_te_bc_values, "unknown", *tptr),
+ *tptr);
+ tptr++;
+ /* decode BCs until the subTLV ends */
+ for (bandwidth_constraint = 0; bandwidth_constraint < (subl-1)/4; bandwidth_constraint++) {
+ bw.i = EXTRACT_32BITS(tptr);
+ printf("%s Bandwidth constraint %d: %.3f Mbps",
+ ident,
+ bandwidth_constraint,
+ bw.f*8/1000000 );
+ tptr+=4;
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC:
if (subl >= 3)
printf(", %u", EXTRACT_24BITS(tptr));
break;
- case SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
if (subl >= 2) {
printf(", %s, Priority %u",
bittok2str(gmpls_link_prot_values, "none", *tptr),
*(tptr+1));
}
break;
- case SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
+ case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
if (subl >= 36) {
printf("%s Interface Switching Capability:%s",
ident,
@@ -969,7 +1364,7 @@ isis_print_ext_is_reach (const u_int8_t *tptr,const char *ident, int tlv_type) {
printf("%sIS Neighbor: %s", ident, isis_print_id(tptr, NODE_ID_LEN));
tptr+=(NODE_ID_LEN);
- if (tlv_type != TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */
+ if (tlv_type != ISIS_TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */
if (!TTEST2(*tptr, 3)) /* and is therefore skipped */
return(0);
printf(", Metric: %d",EXTRACT_24BITS(tptr));
@@ -1131,7 +1526,7 @@ isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi
static int isis_print (const u_int8_t *p, u_int length)
{
- const struct isis_common_header *header;
+ const struct isis_common_header *isis_header;
const struct isis_iih_lan_header *header_iih_lan;
const struct isis_iih_ptp_header *header_iih_ptp;
@@ -1148,13 +1543,13 @@ static int isis_print (const u_int8_t *p, u_int length)
u_int8_t ext_is_len, ext_ip_len, mt_len;
const u_int8_t *optr, *pptr, *tptr;
u_short packet_len,pdu_len;
- u_int i;
+ u_int i,vendor_id;
packet_len=length;
optr = p; /* initialize the _o_riginal pointer to the packet start -
need it for parsing the checksum TLV */
- header = (const struct isis_common_header *)p;
- TCHECK(*header);
+ isis_header = (const struct isis_common_header *)p;
+ TCHECK(*isis_header);
pptr = p+(ISIS_COMMON_HEADER_SIZE);
header_iih_lan = (const struct isis_iih_lan_header *)pptr;
header_iih_ptp = (const struct isis_iih_ptp_header *)pptr;
@@ -1162,39 +1557,42 @@ static int isis_print (const u_int8_t *p, u_int length)
header_csnp = (const struct isis_csnp_header *)pptr;
header_psnp = (const struct isis_psnp_header *)pptr;
+ if (!eflag)
+ printf("IS-IS");
+
/*
* Sanity checking of the header.
*/
- if (header->version != ISIS_VERSION) {
- printf(", version %d packet not supported", header->version);
+ if (isis_header->version != ISIS_VERSION) {
+ printf("version %d packet not supported", isis_header->version);
return (0);
}
- if ((header->id_length != SYSTEM_ID_LEN) && (header->id_length != 0)) {
- printf(", system ID length of %d is not supported",
- header->id_length);
+ if ((isis_header->id_length != SYSTEM_ID_LEN) && (isis_header->id_length != 0)) {
+ printf("system ID length of %d is not supported",
+ isis_header->id_length);
return (0);
}
- if (header->pdu_version != ISIS_VERSION) {
- printf(", version %d packet not supported", header->pdu_version);
+ if (isis_header->pdu_version != ISIS_VERSION) {
+ printf("version %d packet not supported", isis_header->pdu_version);
return (0);
}
- max_area = header->max_area;
+ max_area = isis_header->max_area;
switch(max_area) {
case 0:
max_area = 3; /* silly shit */
break;
case 255:
- printf(", bad packet -- 255 areas");
+ printf("bad packet -- 255 areas");
return (0);
default:
break;
}
- id_length = header->id_length;
+ id_length = isis_header->id_length;
switch(id_length) {
case 0:
id_length = 6; /* silly shit again */
@@ -1217,44 +1615,45 @@ static int isis_print (const u_int8_t *p, u_int length)
/* toss any non 6-byte sys-ID len PDUs */
if (id_length != 6 ) {
- printf(", bad packet -- illegal sys-ID length (%u)", id_length);
+ printf("bad packet -- illegal sys-ID length (%u)", id_length);
return (0);
}
- pdu_type=header->pdu_type;
+ pdu_type=isis_header->pdu_type;
/* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
if (vflag < 1) {
- printf(", IS-IS, %s",
+ printf("%s%s",
+ eflag ? "" : ", ",
tok2str(isis_pdu_values,"unknown PDU-Type %u",pdu_type));
switch (pdu_type) {
- case L1_LAN_IIH:
- case L2_LAN_IIH:
+ case ISIS_PDU_L1_LAN_IIH:
+ case ISIS_PDU_L2_LAN_IIH:
printf(", src-id %s",
isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN));
printf(", lan-id %s, prio %u",
isis_print_id(header_iih_lan->lan_id,NODE_ID_LEN),
header_iih_lan->priority);
break;
- case PTP_IIH:
+ case ISIS_PDU_PTP_IIH:
printf(", src-id %s", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN));
break;
- case L1_LSP:
- case L2_LSP:
+ case ISIS_PDU_L1_LSP:
+ case ISIS_PDU_L2_LSP:
printf(", lsp-id %s, seq 0x%08x, lifetime %5us",
isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
EXTRACT_32BITS(header_lsp->sequence_number),
EXTRACT_16BITS(header_lsp->remaining_lifetime));
break;
- case L1_CSNP:
- case L2_CSNP:
- printf(", src-id %s", isis_print_id(header_csnp->source_id,SYSTEM_ID_LEN));
+ case ISIS_PDU_L1_CSNP:
+ case ISIS_PDU_L2_CSNP:
+ printf(", src-id %s", isis_print_id(header_csnp->source_id,NODE_ID_LEN));
break;
- case L1_PSNP:
- case L2_PSNP:
- printf(", src-id %s", isis_print_id(header_psnp->source_id,SYSTEM_ID_LEN));
+ case ISIS_PDU_L1_PSNP:
+ case ISIS_PDU_L2_PSNP:
+ printf(", src-id %s", isis_print_id(header_psnp->source_id,NODE_ID_LEN));
break;
}
@@ -1264,19 +1663,19 @@ static int isis_print (const u_int8_t *p, u_int length)
}
/* ok they seem to want to know everything - lets fully decode it */
- printf(", IS-IS, length: %u",length);
+ printf("%slength %u", eflag ? "" : ", ",length);
printf("\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
tok2str(isis_pdu_values,
"unknown, type %u",
pdu_type),
- header->fixed_len,
- header->version,
- header->pdu_version,
+ isis_header->fixed_len,
+ isis_header->version,
+ isis_header->pdu_version,
id_length,
- header->id_length,
+ isis_header->id_length,
max_area,
- header->max_area);
+ isis_header->max_area);
if (vflag > 1) {
if(!print_unknown_data(optr,"\n\t",8)) /* provide the _o_riginal pointer */
@@ -1285,11 +1684,11 @@ static int isis_print (const u_int8_t *p, u_int length)
switch (pdu_type) {
- case L1_LAN_IIH:
- case L2_LAN_IIH:
- if (header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)) {
+ case ISIS_PDU_L1_LAN_IIH:
+ case ISIS_PDU_L2_LAN_IIH:
+ if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)) {
printf(", bogus fixed header length %u should be %lu",
- header->fixed_len, (unsigned long)ISIS_IIH_LAN_HEADER_SIZE);
+ isis_header->fixed_len, (unsigned long)ISIS_IIH_LAN_HEADER_SIZE);
return (0);
}
@@ -1309,7 +1708,7 @@ static int isis_print (const u_int8_t *p, u_int length)
printf("\n\t lan-id: %s, Priority: %u, PDU length: %u",
isis_print_id(header_iih_lan->lan_id, NODE_ID_LEN),
- (header_iih_lan->priority) & PRIORITY_MASK,
+ (header_iih_lan->priority) & ISIS_LAN_PRIORITY_MASK,
pdu_len);
if (vflag > 1) {
@@ -1321,10 +1720,10 @@ static int isis_print (const u_int8_t *p, u_int length)
pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE);
break;
- case PTP_IIH:
- if (header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)) {
+ case ISIS_PDU_PTP_IIH:
+ if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)) {
printf(", bogus fixed header length %u should be %lu",
- header->fixed_len, (unsigned long)ISIS_IIH_PTP_HEADER_SIZE);
+ isis_header->fixed_len, (unsigned long)ISIS_IIH_PTP_HEADER_SIZE);
return (0);
}
@@ -1355,11 +1754,11 @@ static int isis_print (const u_int8_t *p, u_int length)
pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE);
break;
- case L1_LSP:
- case L2_LSP:
- if (header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE)) {
+ case ISIS_PDU_L1_LSP:
+ case ISIS_PDU_L2_LSP:
+ if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE)) {
printf(", bogus fixed header length %u should be %lu",
- header->fixed_len, (unsigned long)ISIS_LSP_HEADER_SIZE);
+ isis_header->fixed_len, (unsigned long)ISIS_LSP_HEADER_SIZE);
return (0);
}
@@ -1409,11 +1808,11 @@ static int isis_print (const u_int8_t *p, u_int length)
pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE);
break;
- case L1_CSNP:
- case L2_CSNP:
- if (header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)) {
+ case ISIS_PDU_L1_CSNP:
+ case ISIS_PDU_L2_CSNP:
+ if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)) {
printf(", bogus fixed header length %u should be %lu",
- header->fixed_len, (unsigned long)ISIS_CSNP_HEADER_SIZE);
+ isis_header->fixed_len, (unsigned long)ISIS_CSNP_HEADER_SIZE);
return (0);
}
@@ -1441,11 +1840,11 @@ static int isis_print (const u_int8_t *p, u_int length)
pptr = p + (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE);
break;
- case L1_PSNP:
- case L2_PSNP:
- if (header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)) {
+ case ISIS_PDU_L1_PSNP:
+ case ISIS_PDU_L2_PSNP:
+ if (isis_header->fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)) {
printf("- bogus fixed header length %u should be %lu",
- header->fixed_len, (unsigned long)ISIS_PSNP_HEADER_SIZE);
+ isis_header->fixed_len, (unsigned long)ISIS_PSNP_HEADER_SIZE);
return (0);
}
@@ -1508,14 +1907,14 @@ static int isis_print (const u_int8_t *p, u_int length)
/* now check if we have a decoder otherwise do a hexdump at the end*/
switch (tlv_type) {
- case TLV_AREA_ADDR:
+ case ISIS_TLV_AREA_ADDR:
if (!TTEST2(*tptr, 1))
goto trunctlv;
alen = *tptr++;
while (tmp && alen < tmp) {
printf("\n\t Area address (length: %u): %s",
alen,
- print_nsap(tptr, alen));
+ isonsap_string(tptr,alen));
tptr += alen;
tmp -= alen + 1;
if (tmp==0) /* if this is the last area address do not attemt a boundary check */
@@ -1525,7 +1924,7 @@ static int isis_print (const u_int8_t *p, u_int length)
alen = *tptr++;
}
break;
- case TLV_ISNEIGH:
+ case ISIS_TLV_ISNEIGH:
while (tmp >= ETHER_ADDR_LEN) {
if (!TTEST2(*tptr, ETHER_ADDR_LEN))
goto trunctlv;
@@ -1535,7 +1934,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_ISNEIGH_VARLEN:
+ case ISIS_TLV_ISNEIGH_VARLEN:
if (!TTEST2(*tptr, 1))
goto trunctlv;
lan_alen = *tptr++; /* LAN adress length */
@@ -1550,10 +1949,10 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_PADDING:
+ case ISIS_TLV_PADDING:
break;
- case TLV_MT_IS_REACH:
+ case ISIS_TLV_MT_IS_REACH:
while (tmp >= 2+NODE_ID_LEN+3+1) {
mt_len = isis_print_mtid(tptr, "\n\t ");
if (mt_len == 0) /* did something go wrong ? */
@@ -1570,7 +1969,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_IS_ALIAS_ID:
+ case ISIS_TLV_IS_ALIAS_ID:
while (tmp >= NODE_ID_LEN+1) { /* is it worth attempting a decode ? */
ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ",tlv_type);
if (ext_is_len == 0) /* did something go wrong ? */
@@ -1580,7 +1979,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_EXT_IS_REACH:
+ case ISIS_TLV_EXT_IS_REACH:
while (tmp >= NODE_ID_LEN+3+1) { /* is it worth attempting a decode ? */
ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ",tlv_type);
if (ext_is_len == 0) /* did something go wrong ? */
@@ -1589,7 +1988,7 @@ static int isis_print (const u_int8_t *p, u_int length)
tptr+=ext_is_len;
}
break;
- case TLV_IS_REACH:
+ case ISIS_TLV_IS_REACH:
if (!TTEST2(*tptr,1)) /* check if there is one byte left to read out the virtual flag */
goto trunctlv;
printf("\n\t %s",
@@ -1608,7 +2007,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_ESNEIGH:
+ case ISIS_TLV_ESNEIGH:
tlv_es_reach = (const struct isis_tlv_es_reach *)tptr;
while (tmp >= sizeof(struct isis_tlv_es_reach)) {
if (!TTEST(*tlv_es_reach))
@@ -1622,13 +2021,13 @@ static int isis_print (const u_int8_t *p, u_int length)
break;
/* those two TLVs share the same format */
- case TLV_INT_IP_REACH:
- case TLV_EXT_IP_REACH:
+ case ISIS_TLV_INT_IP_REACH:
+ case ISIS_TLV_EXT_IP_REACH:
if (!isis_print_tlv_ip_reach(pptr, "\n\t ", tlv_len))
return (1);
break;
- case TLV_EXTD_IP_REACH:
+ case ISIS_TLV_EXTD_IP_REACH:
while (tmp>0) {
ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV4);
if (ext_ip_len == 0) /* did something go wrong ? */
@@ -1638,7 +2037,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_MT_IP_REACH:
+ case ISIS_TLV_MT_IP_REACH:
while (tmp>0) {
mt_len = isis_print_mtid(tptr, "\n\t ");
if (mt_len == 0) /* did something go wrong ? */
@@ -1655,7 +2054,7 @@ static int isis_print (const u_int8_t *p, u_int length)
break;
#ifdef INET6
- case TLV_IP6_REACH:
+ case ISIS_TLV_IP6_REACH:
while (tmp>0) {
ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV6);
if (ext_ip_len == 0) /* did something go wrong ? */
@@ -1665,7 +2064,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_MT_IP6_REACH:
+ case ISIS_TLV_MT_IP6_REACH:
while (tmp>0) {
mt_len = isis_print_mtid(tptr, "\n\t ");
if (mt_len == 0) /* did something go wrong ? */
@@ -1681,7 +2080,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_IP6ADDR:
+ case ISIS_TLV_IP6ADDR:
while (tmp>0) {
if (!TTEST2(*tptr, 16))
goto trunctlv;
@@ -1694,7 +2093,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
#endif
- case TLV_AUTH:
+ case ISIS_TLV_AUTH:
if (!TTEST2(*tptr, 1))
goto trunctlv;
@@ -1704,23 +2103,23 @@ static int isis_print (const u_int8_t *p, u_int length)
*tptr));
switch (*tptr) {
- case SUBTLV_AUTH_SIMPLE:
+ case ISIS_SUBTLV_AUTH_SIMPLE:
for(i=1;i<tlv_len;i++) {
if (!TTEST2(*(tptr+i), 1))
goto trunctlv;
printf("%c",*(tptr+i));
}
break;
- case SUBTLV_AUTH_MD5:
+ case ISIS_SUBTLV_AUTH_MD5:
for(i=1;i<tlv_len;i++) {
if (!TTEST2(*(tptr+i), 1))
goto trunctlv;
printf("%02x",*(tptr+i));
}
- if (tlv_len != SUBTLV_AUTH_MD5_LEN+1)
+ if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1)
printf(", (malformed subTLV) ");
break;
- case SUBTLV_AUTH_PRIVATE:
+ case ISIS_SUBTLV_AUTH_PRIVATE:
default:
if(!print_unknown_data(tptr+1,"\n\t\t ",tlv_len-1))
return(0);
@@ -1728,7 +2127,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_PTP_ADJ:
+ case ISIS_TLV_PTP_ADJ:
tlv_ptp_adj = (const struct isis_tlv_ptp_adj *)tptr;
if(tmp>=1) {
if (!TTEST2(*tptr, 1))
@@ -1762,13 +2161,13 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_PROTOCOLS:
+ case ISIS_TLV_PROTOCOLS:
printf("\n\t NLPID(s): ");
while (tmp>0) {
if (!TTEST2(*(tptr), 1))
goto trunctlv;
printf("%s (0x%02x)",
- tok2str(osi_nlpid_values,
+ tok2str(nlpid_values,
"unknown",
*tptr),
*tptr);
@@ -1779,13 +2178,13 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_TE_ROUTER_ID:
+ case ISIS_TLV_TE_ROUTER_ID:
if (!TTEST2(*pptr, 4))
goto trunctlv;
printf("\n\t Traffic Engineering Router ID: %s", ipaddr_string(pptr));
break;
- case TLV_IPADDR:
+ case ISIS_TLV_IPADDR:
while (tmp>0) {
if (!TTEST2(*tptr, 4))
goto trunctlv;
@@ -1795,7 +2194,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_HOSTNAME:
+ case ISIS_TLV_HOSTNAME:
printf("\n\t Hostname: ");
while (tmp>0) {
if (!TTEST2(*tptr, 1))
@@ -1805,7 +2204,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_SHARED_RISK_GROUP:
+ case ISIS_TLV_SHARED_RISK_GROUP:
if (!TTEST2(*tptr, NODE_ID_LEN))
goto trunctlv;
printf("\n\t IS Neighbor: %s", isis_print_id(tptr, NODE_ID_LEN));
@@ -1838,7 +2237,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_LSP:
+ case ISIS_TLV_LSP:
tlv_lsp = (const struct isis_tlv_lsp *)tptr;
while(tmp>0) {
if (!TTEST((tlv_lsp->lsp_id)[LSP_ID_LEN-1]))
@@ -1859,7 +2258,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_CHECKSUM:
+ case ISIS_TLV_CHECKSUM:
if (!TTEST2(*tptr, 2))
goto trunctlv;
printf("\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr));
@@ -1873,7 +2272,7 @@ static int isis_print (const u_int8_t *p, u_int length)
else printf("(%s)", osi_cksum(optr, length) ? "incorrect" : "correct");
break;
- case TLV_MT_SUPPORTED:
+ case ISIS_TLV_MT_SUPPORTED:
while (tmp>1) {
/* length can only be a multiple of 2, otherwise there is
something broken -> so decode down until length is 1 */
@@ -1890,7 +2289,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_RESTART_SIGNALING:
+ case ISIS_TLV_RESTART_SIGNALING:
if (!TTEST2(*tptr, 3))
goto trunctlv;
printf("\n\t Flags [%s], Remaining holding time %us",
@@ -1899,7 +2298,7 @@ static int isis_print (const u_int8_t *p, u_int length)
tptr+=3;
break;
- case TLV_IDRP_INFO:
+ case ISIS_TLV_IDRP_INFO:
if (!TTEST2(*tptr, 1))
goto trunctlv;
printf("\n\t Inter-Domain Information Type: %s",
@@ -1907,13 +2306,13 @@ static int isis_print (const u_int8_t *p, u_int length)
"Unknown (0x%02x)",
*tptr));
switch (*tptr++) {
- case SUBTLV_IDRP_ASN:
+ case ISIS_SUBTLV_IDRP_ASN:
if (!TTEST2(*tptr, 2)) /* fetch AS number */
goto trunctlv;
printf("AS Number: %u",EXTRACT_16BITS(tptr));
break;
- case SUBTLV_IDRP_LOCAL:
- case SUBTLV_IDRP_RES:
+ case ISIS_SUBTLV_IDRP_LOCAL:
+ case ISIS_SUBTLV_IDRP_RES:
default:
if(!print_unknown_data(tptr,"\n\t ",tlv_len-1))
return(0);
@@ -1921,13 +2320,13 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_LSP_BUFFERSIZE:
+ case ISIS_TLV_LSP_BUFFERSIZE:
if (!TTEST2(*tptr, 2))
goto trunctlv;
printf("\n\t LSP Buffersize: %u",EXTRACT_16BITS(tptr));
break;
- case TLV_PART_DIS:
+ case ISIS_TLV_PART_DIS:
while (tmp >= SYSTEM_ID_LEN) {
if (!TTEST2(*tptr, SYSTEM_ID_LEN))
goto trunctlv;
@@ -1937,7 +2336,7 @@ static int isis_print (const u_int8_t *p, u_int length)
}
break;
- case TLV_PREFIX_NEIGH:
+ case ISIS_TLV_PREFIX_NEIGH:
if (!TTEST2(*tptr, sizeof(struct isis_metric_block)))
goto trunctlv;
printf("\n\t Metric Block");
@@ -1953,23 +2352,26 @@ static int isis_print (const u_int8_t *p, u_int length)
if (!TTEST2(*tptr, prefix_len/2))
goto trunctlv;
printf("\n\t\tAddress: %s/%u",
- print_nsap(tptr,prefix_len/2),
+ isonsap_string(tptr,prefix_len/2),
prefix_len*4);
tptr+=prefix_len/2;
tmp-=prefix_len/2;
}
break;
- case TLV_IIH_SEQNR:
+ case ISIS_TLV_IIH_SEQNR:
if (!TTEST2(*tptr, 4)) /* check if four bytes are on the wire */
goto trunctlv;
printf("\n\t Sequence number: %u", EXTRACT_32BITS(tptr) );
break;
- case TLV_VENDOR_PRIVATE:
+ case ISIS_TLV_VENDOR_PRIVATE:
if (!TTEST2(*tptr, 3)) /* check if enough byte for a full oui */
goto trunctlv;
- printf("\n\t Vendor OUI Code: 0x%06x", EXTRACT_24BITS(tptr) );
+ vendor_id = EXTRACT_24BITS(tptr);
+ printf("\n\t Vendor: %s (%u)",
+ tok2str(oui_values,"Unknown",vendor_id),
+ vendor_id);
tptr+=3;
tmp-=3;
if (tmp > 0) /* hexdump the rest */
@@ -1981,11 +2383,11 @@ static int isis_print (const u_int8_t *p, u_int length)
* you are welcome to contribute code ;-)
*/
- case TLV_DECNET_PHASE4:
- case TLV_LUCENT_PRIVATE:
- case TLV_IPAUTH:
- case TLV_NORTEL_PRIVATE1:
- case TLV_NORTEL_PRIVATE2:
+ case ISIS_TLV_DECNET_PHASE4:
+ case ISIS_TLV_LUCENT_PRIVATE:
+ case ISIS_TLV_IPAUTH:
+ case ISIS_TLV_NORTEL_PRIVATE1:
+ case ISIS_TLV_NORTEL_PRIVATE2:
default:
if (vflag <= 1) {
@@ -2035,3 +2437,11 @@ osi_cksum(const u_int8_t *tptr, u_int len)
}
return (c0 | c1);
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-juniper.c b/contrib/tcpdump/print-juniper.c
new file mode 100644
index 000000000000..5d48bf7bfff0
--- /dev/null
+++ b/contrib/tcpdump/print-juniper.c
@@ -0,0 +1,409 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8 2005/04/06 21:32:41 mcr Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <pcap.h>
+#include <stdio.h>
+
+#include "interface.h"
+#include "extract.h"
+#include "ppp.h"
+#include "llc.h"
+#include "nlpid.h"
+
+#define JUNIPER_BPF_OUT 0 /* Outgoing packet */
+#define JUNIPER_BPF_IN 1 /* Incoming packet */
+#define JUNIPER_BPF_PKT_IN 0x1 /* Incoming packet */
+#define JUNIPER_BPF_NO_L2 0x2 /* L2 header stripped */
+
+#define LS_COOKIE_ID 0x54
+#define LS_MLFR_LEN 4
+#define ML_MLFR_LEN 2
+
+#define ATM2_PKT_TYPE_MASK 0x70
+#define ATM2_GAP_COUNT_MASK 0x3F
+
+int ip_heuristic_guess(register const u_char *, u_int);
+int juniper_ppp_heuristic_guess(register const u_char *, u_int);
+static int juniper_parse_header (const u_char *, u_int8_t *, u_int);
+
+u_int
+juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ register u_int length = h->len;
+ register u_int caplen = h->caplen;
+ u_int8_t direction,bundle,cookie_len;
+ u_int32_t cookie,proto;
+
+ if(juniper_parse_header(p, &direction,length) == 0)
+ return 0;
+
+ p+=4;
+ length-=4;
+ caplen-=4;
+
+ if (p[0] == LS_COOKIE_ID) {
+ cookie=EXTRACT_32BITS(p);
+ if (eflag) printf("LSPIC-MLPPP cookie 0x%08x, ",cookie);
+ cookie_len = LS_MLFR_LEN;
+ bundle = cookie & 0xff;
+ } else {
+ cookie=EXTRACT_16BITS(p);
+ if (eflag) printf("MLPIC-MLPPP cookie 0x%04x, ",cookie);
+ cookie_len = ML_MLFR_LEN;
+ bundle = (cookie >> 8) & 0xff;
+ }
+
+ proto = EXTRACT_16BITS(p+cookie_len);
+ p += cookie_len;
+ length-= cookie_len;
+ caplen-= cookie_len;
+
+ /* suppress Bundle-ID if frame was captured on a child-link
+ * this may be the case if the cookie looks like a proto */
+ if (eflag &&
+ cookie != PPP_OSI &&
+ cookie != (PPP_ADDRESS << 8 | PPP_CONTROL))
+ printf("Bundle-ID %u, ",bundle);
+
+ switch (cookie) {
+ case PPP_OSI:
+ ppp_print(p-2,length+2);
+ break;
+ case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */
+ default:
+ ppp_print(p,length);
+ break;
+ }
+
+ return cookie_len;
+}
+
+
+u_int
+juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ register u_int length = h->len;
+ register u_int caplen = h->caplen;
+ u_int8_t direction,bundle,cookie_len;
+ u_int32_t cookie,proto,frelay_len = 0;
+
+ if(juniper_parse_header(p, &direction,length) == 0)
+ return 0;
+
+ p+=4;
+ length-=4;
+ caplen-=4;
+
+ if (p[0] == LS_COOKIE_ID) {
+ cookie=EXTRACT_32BITS(p);
+ if (eflag) printf("LSPIC-MLFR cookie 0x%08x, ",cookie);
+ cookie_len = LS_MLFR_LEN;
+ bundle = cookie & 0xff;
+ } else {
+ cookie=EXTRACT_16BITS(p);
+ if (eflag) printf("MLPIC-MLFR cookie 0x%04x, ",cookie);
+ cookie_len = ML_MLFR_LEN;
+ bundle = (cookie >> 8) & 0xff;
+ }
+
+ proto = EXTRACT_16BITS(p+cookie_len);
+ p += cookie_len+2;
+ length-= cookie_len+2;
+ caplen-= cookie_len+2;
+
+ /* suppress Bundle-ID if frame was captured on a child-link */
+ if (eflag && cookie != 1) printf("Bundle-ID %u, ",bundle);
+
+ switch (proto) {
+ case (LLC_UI):
+ case (LLC_UI<<8):
+ isoclns_print(p, length, caplen);
+ break;
+ case (LLC_UI<<8 | NLPID_Q933):
+ case (LLC_UI<<8 | NLPID_IP):
+ case (LLC_UI<<8 | NLPID_IP6):
+ isoclns_print(p-1, length+1, caplen+1); /* pass IP{4,6} to the OSI layer for proper link-layer printing */
+ break;
+ default:
+ printf("unknown protocol 0x%04x, length %u",proto, length);
+ }
+
+ return cookie_len + frelay_len;
+}
+
+/*
+ * ATM1 PIC cookie format
+ *
+ * +-----+-------------------------+-------------------------------+
+ * |fmtid| vc index | channel ID |
+ * +-----+-------------------------+-------------------------------+
+ */
+
+u_int
+juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ register u_int length = h->len;
+ register u_int caplen = h->caplen;
+ u_int16_t extracted_ethertype;
+ u_int8_t direction;
+ u_int32_t cookie1;
+
+ if(juniper_parse_header(p, &direction,length) == 0)
+ return 0;
+
+ p+=4;
+ length-=4;
+ caplen-=4;
+
+ cookie1=EXTRACT_32BITS(p);
+
+ if (eflag) {
+ /* FIXME decode channel-id, vc-index, fmt-id
+ for once lets just hexdump the cookie */
+
+ printf("ATM1 cookie 0x%08x, ", cookie1);
+ }
+
+ p+=4;
+ length-=4;
+ caplen-=4;
+
+ if ((cookie1 >> 24) == 0x80) { /* OAM cell ? */
+ oam_print(p,length);
+ return 0;
+ }
+
+ if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
+ EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
+
+ if (llc_print(p, length, caplen, NULL, NULL,
+ &extracted_ethertype) != 0)
+ return 8;
+ }
+
+ if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */
+ isoclns_print(p + 1, length - 1, caplen - 1);
+ /* FIXME check if frame was recognized */
+ return 8;
+ }
+
+ if(ip_heuristic_guess(p, length) != 0) /* last try - vcmux encaps ? */
+ return 0;
+
+ return (8);
+}
+
+/*
+ * ATM2 PIC cookie format
+ *
+ * +-------------------------------+---------+---+-----+-----------+
+ * | channel ID | reserv |AAL| CCRQ| gap cnt |
+ * +-------------------------------+---------+---+-----+-----------+
+ */
+
+u_int
+juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
+{
+ register u_int length = h->len;
+ register u_int caplen = h->caplen;
+ u_int16_t extracted_ethertype;
+ u_int8_t direction;
+ u_int32_t cookie1,cookie2;
+
+ if(juniper_parse_header(p, &direction,length) == 0)
+ return 0;
+
+ p+=4;
+ length-=4;
+ caplen-=4;
+
+ cookie1=EXTRACT_32BITS(p);
+ cookie2=EXTRACT_32BITS(p+4);
+
+ if (eflag) {
+ /* FIXME decode channel, fmt-id, ccrq, aal, gap cnt
+ for once lets just hexdump the cookie */
+
+ printf("ATM2 cookie 0x%08x%08x, ",
+ EXTRACT_32BITS(p),
+ EXTRACT_32BITS(p+4));
+ }
+
+ p+=8;
+ length-=8;
+ caplen-=8;
+
+ if (cookie2 & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */
+ oam_print(p,length);
+ return 12;
+ }
+
+ if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
+ EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
+
+ if (llc_print(p, length, caplen, NULL, NULL,
+ &extracted_ethertype) != 0)
+ return 12;
+ }
+
+ if (direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
+ (cookie1 & ATM2_GAP_COUNT_MASK)) {
+ ether_print(p, length, caplen);
+ return 12;
+ }
+
+ if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */
+ isoclns_print(p + 1, length - 1, caplen - 1);
+ /* FIXME check if frame was recognized */
+ return 12;
+ }
+
+ if(juniper_ppp_heuristic_guess(p, length) != 0) /* PPPoA vcmux encaps ? */
+ return 12;
+
+ if(ip_heuristic_guess(p, length) != 0) /* last try - vcmux encaps ? */
+ return 12;
+
+ return (12);
+}
+
+
+/* try to guess, based on all PPP protos that are supported in
+ * a juniper router if the payload data is encapsulated using PPP */
+int
+juniper_ppp_heuristic_guess(register const u_char *p, u_int length) {
+
+ switch(EXTRACT_16BITS(p)) {
+ case PPP_IP :
+ case PPP_OSI :
+ case PPP_MPLS_UCAST :
+ case PPP_MPLS_MCAST :
+ case PPP_IPCP :
+ case PPP_OSICP :
+ case PPP_MPLSCP :
+ case PPP_LCP :
+ case PPP_PAP :
+ case PPP_CHAP :
+ case PPP_ML :
+#ifdef INET6
+ case PPP_IPV6 :
+ case PPP_IPV6CP :
+#endif
+ ppp_print(p, length);
+ break;
+
+ default:
+ return 0; /* did not find a ppp header */
+ break;
+ }
+ return 1; /* we printed a ppp packet */
+}
+
+int
+ip_heuristic_guess(register const u_char *p, u_int length) {
+
+ switch(p[0]) {
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4a:
+ case 0x4b:
+ case 0x4c:
+ case 0x4d:
+ case 0x4e:
+ case 0x4f:
+ ip_print(gndo, p, length);
+ break;
+#ifdef INET6
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6a:
+ case 0x6b:
+ case 0x6c:
+ case 0x6d:
+ case 0x6e:
+ case 0x6f:
+ ip6_print(p, length);
+ break;
+#endif
+ default:
+ return 0; /* did not find a ip header */
+ break;
+ }
+ return 1; /* we printed an v4/v6 packet */
+}
+
+static int
+juniper_parse_header (const u_char *p, u_int8_t *direction, u_int length) {
+
+ *direction = p[3]&JUNIPER_BPF_PKT_IN;
+
+ if (EXTRACT_24BITS(p) != 0x4d4743) /* magic number found ? */
+ return -1;
+
+ if (*direction == JUNIPER_BPF_PKT_IN) {
+ if (eflag)
+ printf("%3s ", "In");
+ }
+ else {
+ if (eflag)
+ printf("%3s ", "Out");
+ }
+
+ if ((p[3] & JUNIPER_BPF_NO_L2 ) == JUNIPER_BPF_NO_L2 ) {
+ if (eflag)
+ printf("no-L2-hdr, ");
+
+ /* there is no link-layer present -
+ * perform the v4/v6 heuristics
+ * to figure out what it is
+ */
+ if(ip_heuristic_guess(p+8,length-8) == 0)
+ printf("no IP-hdr found!");
+
+ return 0; /* stop parsing the output further */
+
+ }
+ return 1; /* everything went ok so far. continue parsing */
+}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-krb.c b/contrib/tcpdump/print-krb.c
index 1d3a6d75a245..d6c8e14f4f7f 100644
--- a/contrib/tcpdump/print-krb.c
+++ b/contrib/tcpdump/print-krb.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.21.2.2 2003/11/16 08:51:30 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.23 2003/11/16 09:36:26 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-l2tp.c b/contrib/tcpdump/print-l2tp.c
index a8f0568c614e..a4036d106328 100644
--- a/contrib/tcpdump/print-l2tp.c
+++ b/contrib/tcpdump/print-l2tp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.14.2.3 2003/12/26 23:21:42 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.17 2003/12/26 23:20:58 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-lane.c b/contrib/tcpdump/print-lane.c
index 3cdee5a5b967..93ef256d520e 100644
--- a/contrib/tcpdump/print-lane.c
+++ b/contrib/tcpdump/print-lane.c
@@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.20.2.2 2003/11/16 08:51:31 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.23 2004/03/17 23:24:37 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -84,7 +84,7 @@ lane_hdr_print(register const u_char *bp, int length)
/*
* This is the top level routine of the printer. 'p' points
* to the LANE header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*
* This assumes 802.3, not 802.5, LAN emulation.
diff --git a/contrib/tcpdump/print-ldp.c b/contrib/tcpdump/print-ldp.c
index 1162ac39afd0..61d2a54e2268 100644
--- a/contrib/tcpdump/print-ldp.c
+++ b/contrib/tcpdump/print-ldp.c
@@ -11,11 +11,12 @@
* FOR A PARTICULAR PURPOSE.
*
* Original code by Hannes Gredler (hannes@juniper.net)
+ * and Steinar Haug (sthaug@nethelp.no)
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.4.2.2 2003/11/16 08:51:31 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.8 2004/06/15 09:42:42 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -29,9 +30,12 @@ static const char rcsid[] _U_ =
#include <string.h>
#include "interface.h"
+#include "decode_prefix.h"
#include "extract.h"
#include "addrtoname.h"
+#include "l2vpn.h"
+
/*
* ldp common header
*
@@ -142,6 +146,7 @@ static const struct tok ldp_msg_values[] = {
#define LDP_TLV_COMMON_SESSION 0x0500
#define LDP_TLV_ATM_SESSION_PARM 0x0501
#define LDP_TLV_FR_SESSION_PARM 0x0502
+#define LDP_TLV_FT_SESSION 0x0503
#define LDP_TLV_LABEL_REQUEST_MSG_ID 0x0600
static const struct tok ldp_tlv_values[] = {
@@ -163,10 +168,29 @@ static const struct tok ldp_tlv_values[] = {
{ LDP_TLV_COMMON_SESSION, "Common Session Parameters" },
{ LDP_TLV_ATM_SESSION_PARM, "ATM Session Parameters" },
{ LDP_TLV_FR_SESSION_PARM, "Frame-Relay Session Parameters" },
+ { LDP_TLV_FT_SESSION, "Fault-Tolerant Session Parameters" },
{ LDP_TLV_LABEL_REQUEST_MSG_ID, "Label Request Message ID" },
{ 0, NULL}
};
+#define LDP_FEC_WILDCARD 0x01
+#define LDP_FEC_PREFIX 0x02
+#define LDP_FEC_HOSTADDRESS 0x03
+/* From draft-martini-l2circuit-trans-mpls-13.txt */
+#define LDP_FEC_MARTINI_VC 0x80
+
+static const struct tok ldp_fec_values[] = {
+ { LDP_FEC_WILDCARD, "Wildcard" },
+ { LDP_FEC_PREFIX, "Prefix" },
+ { LDP_FEC_HOSTADDRESS, "Host address" },
+ { LDP_FEC_MARTINI_VC, "Martini VC" },
+ { 0, NULL}
+};
+
+/* RFC1700 address family numbers, same definition in print-bgp.c */
+#define AFNUM_INET 1
+#define AFNUM_INET6 2
+
#define FALSE 0
#define TRUE 1
@@ -198,7 +222,11 @@ ldp_tlv_print(register const u_char *tptr) {
};
const struct ldp_tlv_header *ldp_tlv_header;
- u_short tlv_type,tlv_len,tlv_tlen;
+ u_short tlv_type,tlv_len,tlv_tlen,af,ft_flags;
+ u_char fec_type;
+ u_int ui;
+ char buf[100];
+ int i;
ldp_tlv_header = (const struct ldp_tlv_header *)tptr;
tlv_len=EXTRACT_16BITS(ldp_tlv_header->length);
@@ -238,23 +266,121 @@ ldp_tlv_print(register const u_char *tptr) {
printf("\n\t Sequence Number: %u", EXTRACT_32BITS(tptr));
break;
+ case LDP_TLV_ADDRESS_LIST:
+ af = EXTRACT_16BITS(tptr);
+ tptr+=2;
+ printf("\n\t Adress Family: ");
+ if (af == AFNUM_INET) {
+ printf("IPv4, addresses:");
+ for (i=0; i<(tlv_tlen-2)/4; i++) {
+ printf(" %s",ipaddr_string(tptr));
+ tptr+=4;
+ }
+ }
+#ifdef INET6
+ else if (af == AFNUM_INET6) {
+ printf("IPv6, addresses:");
+ for (i=0; i<(tlv_tlen-2)/16; i++) {
+ printf(" %s",ip6addr_string(tptr));
+ tptr+=16;
+ }
+ }
+#endif
+ break;
+
+ case LDP_TLV_COMMON_SESSION:
+ printf("\n\t Version: %u, Keepalive: %us, Flags: [Downstream %s, Loop Detection %s]",
+ EXTRACT_16BITS(tptr), EXTRACT_16BITS(tptr+2),
+ (EXTRACT_16BITS(tptr+6)&0x8000) ? "On Demand" : "Unsolicited",
+ (EXTRACT_16BITS(tptr+6)&0x4000) ? "Enabled" : "Disabled"
+ );
+ break;
+
+ case LDP_TLV_FEC:
+ fec_type = *tptr;
+ printf("\n\t %s FEC (0x%02x)",
+ tok2str(ldp_fec_values, "Unknown", fec_type),
+ fec_type);
+
+ tptr+=1;
+ switch(fec_type) {
+
+ case LDP_FEC_WILDCARD:
+ break;
+ case LDP_FEC_PREFIX:
+ af = EXTRACT_16BITS(tptr);
+ tptr+=2;
+ if (af == AFNUM_INET) {
+ i=decode_prefix4(tptr,buf,sizeof(buf));
+ printf(": IPv4 prefix %s",buf);
+ }
+#ifdef INET6
+ else if (af == AFNUM_INET6) {
+ i=decode_prefix6(tptr,buf,sizeof(buf));
+ printf(": IPv6 prefix %s",buf);
+ }
+#endif
+ break;
+ case LDP_FEC_HOSTADDRESS:
+ break;
+ case LDP_FEC_MARTINI_VC:
+ printf(": %s, %scontrol word, VC %u",
+ tok2str(l2vpn_encaps_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
+ EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ",
+ EXTRACT_32BITS(tptr+7));
+ break;
+ }
+
+ break;
+
+ case LDP_TLV_GENERIC_LABEL:
+ printf("\n\t Label: %u", EXTRACT_32BITS(tptr) & 0xfffff);
+ break;
+
+ case LDP_TLV_STATUS:
+ ui = EXTRACT_32BITS(tptr);
+ tptr+=4;
+ printf("\n\t Status: 0x%02x, Flags: [%s and %s forward]",
+ ui&0x3fffffff,
+ ui&0x80000000 ? "Fatal error" : "Advisory Notification",
+ ui&0x40000000 ? "do" : "don't");
+ ui = EXTRACT_32BITS(tptr);
+ tptr+=4;
+ if (ui)
+ printf(", causing Message ID: 0x%08x", ui);
+ break;
+
+ case LDP_TLV_FT_SESSION:
+ ft_flags = EXTRACT_16BITS(tptr);
+ printf("\n\t Flags: [%sReconnect, %sSave State, %sAll-Label Protection, %s Checkpoint, %sRe-Learn State]",
+ ft_flags&0x8000 ? "" : "No ",
+ ft_flags&0x8 ? "" : "Don't ",
+ ft_flags&0x4 ? "" : "No ",
+ ft_flags&0x2 ? "Sequence Numbered Label" : "All Labels",
+ ft_flags&0x1 ? "" : "Don't ");
+ tptr+=4;
+ ui = EXTRACT_32BITS(tptr);
+ if (ui)
+ printf(", Reconnect Timeout: %ums", ui);
+ tptr+=4;
+ ui = EXTRACT_32BITS(tptr);
+ if (ui)
+ printf(", Recovery Time: %ums", ui);
+ break;
+
+
/*
* FIXME those are the defined TLVs that lack a decoder
* you are welcome to contribute code ;-)
*/
- case LDP_TLV_FEC:
- case LDP_TLV_ADDRESS_LIST:
case LDP_TLV_HOP_COUNT:
case LDP_TLV_PATH_VECTOR:
- case LDP_TLV_GENERIC_LABEL:
case LDP_TLV_ATM_LABEL:
case LDP_TLV_FR_LABEL:
- case LDP_TLV_STATUS:
case LDP_TLV_EXTD_STATUS:
case LDP_TLV_RETURNED_PDU:
case LDP_TLV_RETURNED_MSG:
- case LDP_TLV_COMMON_SESSION:
case LDP_TLV_ATM_SESSION_PARM:
case LDP_TLV_FR_SESSION_PARM:
case LDP_TLV_LABEL_REQUEST_MSG_ID:
@@ -304,8 +430,8 @@ ldp_print(register const u_char *pptr, register u_int len) {
/* ok they seem to want to know everything - lets fully decode it */
tlen=EXTRACT_16BITS(ldp_com_header->pdu_length);
- tptr+=sizeof(const struct ldp_common_header);
- tlen-=sizeof(const struct ldp_common_header);
+ tptr += sizeof(const struct ldp_common_header);
+ tlen -= sizeof(const struct ldp_common_header)-4; /* Type & Length fields not included */
while(tlen>0) {
/* did we capture enough for fully decoding the msg header ? */
@@ -336,7 +462,12 @@ ldp_print(register const u_char *pptr, register u_int len) {
switch(msg_type) {
+ case LDP_MSG_NOTIF:
case LDP_MSG_HELLO:
+ case LDP_MSG_INIT:
+ case LDP_MSG_KEEPALIVE:
+ case LDP_MSG_ADDRESS:
+ case LDP_MSG_LABEL_MAPPING:
while(msg_tlen >= 4) {
processed = ldp_tlv_print(msg_tptr);
if (processed == 0)
@@ -351,12 +482,7 @@ ldp_print(register const u_char *pptr, register u_int len) {
* you are welcome to contribute code ;-)
*/
- case LDP_MSG_NOTIF:
- case LDP_MSG_INIT:
- case LDP_MSG_KEEPALIVE:
- case LDP_MSG_ADDRESS:
case LDP_MSG_ADDRESS_WITHDRAW:
- case LDP_MSG_LABEL_MAPPING:
case LDP_MSG_LABEL_REQUEST:
case LDP_MSG_LABEL_WITHDRAW:
case LDP_MSG_LABEL_RELEASE:
@@ -372,8 +498,8 @@ ldp_print(register const u_char *pptr, register u_int len) {
print_unknown_data(tptr+sizeof(sizeof(struct ldp_msg_header)),"\n\t ",
msg_len);
- tptr+=msg_len;
- tlen-=msg_len;
+ tptr += msg_len+4;
+ tlen -= msg_len+4;
}
return;
trunc:
diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c
index 4caaf5d86fc1..fb54641bdc7a 100644
--- a/contrib/tcpdump/print-llc.c
+++ b/contrib/tcpdump/print-llc.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.53.2.3 2003/12/29 22:33:18 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61 2005/04/06 21:32:41 mcr Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -42,6 +42,7 @@ static const char rcsid[] _U_ =
#include "llc.h"
#include "ethertype.h"
+#include "oui.h"
static struct tok llc_values[] = {
{ LLCSAP_NULL, "Null" },
@@ -94,7 +95,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
memcpy((char *)&llc, (char *)p, min(caplen, sizeof(llc)));
if (eflag)
- printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x, ",
+ printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x: ",
tok2str(llc_values,"Unknown",llc.dsap),
llc.dsap,
tok2str(llc_values,"Unknown",llc.ssap),
@@ -116,9 +117,12 @@ llc_print(const u_char *p, u_int length, u_int caplen,
* such as an 802.11 network; this has appeared in at
* least one capture file.)
*/
- printf("(NOV-802.3) ");
- ipx_print(p, length);
- return (1);
+
+ if (eflag)
+ printf("IPX-802.3: ");
+
+ ipx_print(p, length);
+ return (1);
}
if (llc.ssap == LLCSAP_8021D && llc.dsap == LLCSAP_8021D) {
@@ -127,7 +131,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
}
if (llc.ssap == LLCSAP_IP && llc.dsap == LLCSAP_IP) {
- ip_print(p+4, length-4);
+ ip_print(gndo, p+4, length-4);
return (1);
}
@@ -216,6 +220,14 @@ llc_print(const u_char *p, u_int length, u_int caplen,
orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
+
+ if (eflag)
+ (void)printf("oui %s (0x%06x), ethertype %s (0x%04x): ",
+ tok2str(oui_values,"Unknown",orgcode),
+ orgcode,
+ tok2str(ethertype_values,"Unknown", et),
+ et);
+
/*
* XXX - what *is* the right bridge pad value here?
* Does anybody ever bridge one form of LAN traffic
@@ -308,7 +320,6 @@ llc_print(const u_char *p, u_int length, u_int caplen,
length -= 4;
caplen -= 4;
}
- (void)printf(" len=%d", length);
return(1);
}
@@ -427,3 +438,11 @@ snap_print(const u_char *p, u_int length, u_int caplen,
}
return (0);
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-lmp.c b/contrib/tcpdump/print-lmp.c
new file mode 100644
index 000000000000..d2089fe8346f
--- /dev/null
+++ b/contrib/tcpdump/print-lmp.c
@@ -0,0 +1,713 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.5 2004/04/27 14:03:44 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 "addrtoname.h"
+#include "gmpls.h"
+
+/*
+ * LMP common header
+ *
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Vers | (Reserved) | Flags | Msg Type |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | LMP Length | (Reserved) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+struct lmp_common_header {
+ u_int8_t version_res[2];
+ u_int8_t flags;
+ u_int8_t msg_type;
+ u_int8_t length[2];
+ u_int8_t reserved[2];
+};
+
+#define LMP_VERSION 1
+#define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
+
+static const struct tok lmp_header_flag_values[] = {
+ { 0x00, "Control Channel Down"},
+ { 0x02, "LMP restart"},
+ { 0, NULL}
+};
+
+static const struct tok lmp_obj_te_link_flag_values[] = {
+ { 0x01, "Fault Management Supported"},
+ { 0x02, "Link Verification Supported"},
+ { 0, NULL}
+};
+
+static const struct tok lmp_obj_data_link_flag_values[] = {
+ { 0x01, "Data Link Port"},
+ { 0x02, "Allocated for user traffic"},
+ { 0x04, "Failed link"},
+ { 0, NULL}
+};
+
+static const struct tok lmp_obj_channel_status_values[] = {
+ { 1, "Signal Okay"},
+ { 2, "Signal Degraded"},
+ { 3, "Signal Fail"},
+ { 0, NULL}
+};
+
+static const struct tok lmp_obj_begin_verify_flag_values[] = {
+ { 0x0001, "Verify all links"},
+ { 0x0002, "Data link type"},
+ { 0, NULL}
+};
+
+static const struct tok lmp_obj_begin_verify_error_values[] = {
+ { 0x01, "\n\t\tLink Verification Procedure Not supported"},
+ { 0x02, "\n\t\tUnwilling to verify"},
+ { 0x04, "\n\t\tUnsupported verification transport mechanism"},
+ { 0x08, "\n\t\tLink_Id configuration error"},
+ { 0x10, "\n\t\tUnknown object c-type"},
+ { 0, NULL}
+};
+
+static const struct tok lmp_obj_link_summary_error_values[] = {
+ { 0x01, "\n\t\tUnacceptable non-negotiable LINK_SUMMARY parameters"},
+ { 0x02, "\n\t\tRenegotiate LINK_SUMMARY parameters"},
+ { 0x04, "\n\t\tInvalid TE-LINK Object"},
+ { 0x08, "\n\t\tInvalid DATA-LINK Object"},
+ { 0x10, "\n\t\tUnknown TE-LINK Object c-type"},
+ { 0x20, "\n\t\tUnknown DATA-LINK Object c-type"},
+ { 0, NULL}
+};
+
+#define LMP_MSGTYPE_CONFIG 1
+#define LMP_MSGTYPE_CONFIG_ACK 2
+#define LMP_MSGTYPE_CONFIG_NACK 3
+#define LMP_MSGTYPE_HELLO 4
+#define LMP_MSGTYPE_VERIFY_BEGIN 5
+#define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
+#define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
+#define LMP_MSGTYPE_VERIFY_END 8
+#define LMP_MSGTYPE_VERIFY_END_ACK 9
+#define LMP_MSGTYPE_TEST 10
+#define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
+#define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
+#define LMP_MSGTYPE_TEST_STATUS_ACK 13
+#define LMP_MSGTYPE_LINK_SUMMARY 14
+#define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
+#define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
+#define LMP_MSGTYPE_CHANNEL_STATUS 17
+#define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
+#define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
+#define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
+
+static const struct tok lmp_msg_type_values[] = {
+ { LMP_MSGTYPE_CONFIG, "Config"},
+ { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
+ { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
+ { LMP_MSGTYPE_HELLO, "Hello"},
+ { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
+ { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
+ { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
+ { LMP_MSGTYPE_VERIFY_END, "End Verify"},
+ { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
+ { LMP_MSGTYPE_TEST, "Test"},
+ { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
+ { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
+ { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
+ { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
+ { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
+ { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
+ { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
+ { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
+ { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
+ { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
+ { 0, NULL}
+};
+
+/*
+ * LMP object header
+ *
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |N| C-Type | Class | Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | |
+ * // (object contents) //
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+struct lmp_object_header {
+ u_int8_t ctype;
+ u_int8_t class_num;
+ u_int8_t length[2];
+};
+
+#define LMP_OBJ_CC_ID 1
+#define LMP_OBJ_NODE_ID 2
+#define LMP_OBJ_LINK_ID 3
+#define LMP_OBJ_INTERFACE_ID 4
+#define LMP_OBJ_MESSAGE_ID 5
+#define LMP_OBJ_CONFIG 6
+#define LMP_OBJ_HELLO 7
+#define LMP_OBJ_VERIFY_BEGIN 8
+#define LMP_OBJ_VERIFY_BEGIN_ACK 9
+#define LMP_OBJ_VERIFY_ID 10
+#define LMP_OBJ_TE_LINK 11
+#define LMP_OBJ_DATA_LINK 12
+#define LMP_OBJ_CHANNEL_STATUS 13
+#define LMP_OBJ_CHANNEL_STATUS_REQ 14
+#define LMP_OBJ_ERROR_CODE 20
+
+static const struct tok lmp_obj_values[] = {
+ { LMP_OBJ_CC_ID, "Control Channel ID" },
+ { LMP_OBJ_NODE_ID, "Node ID" },
+ { LMP_OBJ_LINK_ID, "Link ID" },
+ { LMP_OBJ_INTERFACE_ID, "Interface ID" },
+ { LMP_OBJ_MESSAGE_ID, "Message ID" },
+ { LMP_OBJ_CONFIG, "Configuration" },
+ { LMP_OBJ_HELLO, "Hello" },
+ { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
+ { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
+ { LMP_OBJ_VERIFY_ID, "Verify ID" },
+ { LMP_OBJ_TE_LINK, "TE Link" },
+ { LMP_OBJ_DATA_LINK, "Data Link" },
+ { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
+ { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
+ { LMP_OBJ_ERROR_CODE, "Error Code" },
+ { 0, NULL}
+};
+
+#define INT_SWITCHING_TYPE_SUBOBJ 1
+#define WAVELENGTH_SUBOBJ 2
+
+static const struct tok lmp_data_link_subobj[] = {
+ { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
+ { WAVELENGTH_SUBOBJ , "Wavelength" },
+ { 0, NULL}
+};
+
+#define LMP_CTYPE_IPV4 1
+#define LMP_CTYPE_IPV6 2
+
+#define LMP_CTYPE_LOC 1
+#define LMP_CTYPE_RMT 2
+#define LMP_CTYPE_UNMD 3
+
+#define LMP_CTYPE_IPV4_LOC 1
+#define LMP_CTYPE_IPV4_RMT 2
+#define LMP_CTYPE_IPV6_LOC 3
+#define LMP_CTYPE_IPV6_RMT 4
+#define LMP_CTYPE_UNMD_LOC 5
+#define LMP_CTYPE_UNMD_RMT 6
+
+#define LMP_CTYPE_1 1
+#define LMP_CTYPE_2 2
+
+#define LMP_CTYPE_HELLO_CONFIG 1
+#define LMP_CTYPE_HELLO 1
+
+#define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
+#define LMP_CTYPE_LINK_SUMMARY_ERROR 2
+
+#define FALSE 0
+#define TRUE 1
+
+/*
+ * the ctypes are not globally unique so for
+ * translating it to strings we build a table based
+ * on objects offsetted by the ctype
+ */
+
+static const struct tok lmp_ctype_values[] = {
+ { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
+ { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
+ { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
+ { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
+ { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
+ { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
+ { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
+ { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
+ { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
+ { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
+ { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
+ { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
+ { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
+ { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
+ { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
+ { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
+ { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
+ { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
+ { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
+ { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
+ { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
+ { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
+ { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
+ { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
+ { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
+ { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
+ { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
+ { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
+ { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
+ { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
+ { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
+ { 0, NULL}
+};
+
+void
+lmp_print(register const u_char *pptr, register u_int len) {
+
+ const struct lmp_common_header *lmp_com_header;
+ const struct lmp_object_header *lmp_obj_header;
+ const u_char *tptr,*obj_tptr;
+ int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
+ int hexdump;
+ int offset,subobj_type,subobj_len,total_subobj_len;
+
+ union { /* int to float conversion buffer */
+ float f;
+ u_int32_t i;
+ } bw;
+
+ tptr=pptr;
+ lmp_com_header = (const struct lmp_common_header *)pptr;
+ TCHECK(*lmp_com_header);
+
+ /*
+ * Sanity checking of the header.
+ */
+ if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) {
+ printf("LMP version %u packet not supported",
+ LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]));
+ return;
+ }
+
+ /* in non-verbose mode just lets print the basic Message Type*/
+ if (vflag < 1) {
+ printf("LMPv%u %s Message, length: %u",
+ LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
+ tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type),
+ len);
+ return;
+ }
+
+ /* ok they seem to want to know everything - lets fully decode it */
+
+ tlen=EXTRACT_16BITS(lmp_com_header->length);
+
+ printf("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
+ LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]),
+ tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type),
+ bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags),
+ tlen);
+
+ tptr+=sizeof(const struct lmp_common_header);
+ tlen-=sizeof(const struct lmp_common_header);
+
+ while(tlen>0) {
+ /* did we capture enough for fully decoding the object header ? */
+ if (!TTEST2(*tptr, sizeof(struct lmp_object_header)))
+ goto trunc;
+
+ lmp_obj_header = (const struct lmp_object_header *)tptr;
+ lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length);
+ lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f;
+
+ if(lmp_obj_len % 4 || lmp_obj_len < 4)
+ return;
+
+ printf("\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
+ tok2str(lmp_obj_values,
+ "Unknown",
+ lmp_obj_header->class_num),
+ lmp_obj_header->class_num,
+ tok2str(lmp_ctype_values,
+ "Unknown",
+ ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
+ lmp_obj_ctype,
+ (lmp_obj_header->ctype)&0x80 ? "" : "non-",
+ lmp_obj_len);
+
+ obj_tptr=tptr+sizeof(struct lmp_object_header);
+ obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
+
+ /* did we capture enough for fully decoding the object ? */
+ if (!TTEST2(*tptr, lmp_obj_len))
+ goto trunc;
+ hexdump=FALSE;
+
+ switch(lmp_obj_header->class_num) {
+
+ case LMP_OBJ_CC_ID:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_LOC:
+ case LMP_CTYPE_RMT:
+ printf("\n\t Control Channel ID: %u (0x%08x)",
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_LINK_ID:
+ case LMP_OBJ_INTERFACE_ID:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_IPV4_LOC:
+ case LMP_CTYPE_IPV4_RMT:
+ printf("\n\t IPv4 Link ID: %s (0x%08x)",
+ ipaddr_string(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+#ifdef INET6
+ case LMP_CTYPE_IPV6_LOC:
+ case LMP_CTYPE_IPV6_RMT:
+ printf("\n\t IPv6 Link ID: %s (0x%08x)",
+ ip6addr_string(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+#endif
+ case LMP_CTYPE_UNMD_LOC:
+ case LMP_CTYPE_UNMD_RMT:
+ printf("\n\t Link ID: %u (0x%08x)",
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_MESSAGE_ID:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_1:
+ printf("\n\t Message ID: %u (0x%08x)",
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+ case LMP_CTYPE_2:
+ printf("\n\t Message ID Ack: %u (0x%08x)",
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_NODE_ID:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_LOC:
+ case LMP_CTYPE_RMT:
+ printf("\n\t Node ID: %s (0x%08x)",
+ ipaddr_string(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_CONFIG:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_HELLO_CONFIG:
+ printf("\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
+ EXTRACT_16BITS(obj_tptr),
+ EXTRACT_16BITS(obj_tptr+2));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_HELLO:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_HELLO:
+ printf("\n\t TxSeqNum: %u\n\t RcvSeqNum: %u",
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr+4));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_TE_LINK:
+ printf("\n\t Flags: [%s]",
+ bittok2str(lmp_obj_te_link_flag_values,
+ "none",
+ EXTRACT_16BITS(obj_tptr)>>8));
+
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_IPV4:
+ printf("\n\t Local Link-ID: %s (0x%08x) \
+ \n\t Remote Link-ID: %s (0x%08x)",
+ ipaddr_string(obj_tptr+4),
+ EXTRACT_32BITS(obj_tptr+4),
+ ipaddr_string(obj_tptr+8),
+ EXTRACT_32BITS(obj_tptr+8));
+ break;
+
+#ifdef INET6
+ case LMP_CTYPE_IPV6:
+#endif
+ case LMP_CTYPE_UNMD:
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_DATA_LINK:
+ printf("\n\t Flags: [%s]",
+ bittok2str(lmp_obj_data_link_flag_values,
+ "none",
+ EXTRACT_16BITS(obj_tptr)>>8));
+
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_IPV4:
+ case LMP_CTYPE_UNMD:
+ printf("\n\t Local Interface ID: %s (0x%08x) \
+ \n\t Remote Interface ID: %s (0x%08x)",
+ ipaddr_string(obj_tptr+4),
+ EXTRACT_32BITS(obj_tptr+4),
+ ipaddr_string(obj_tptr+8),
+ EXTRACT_32BITS(obj_tptr+8));
+
+ total_subobj_len = lmp_obj_len - 16;
+ offset = 12;
+ while (total_subobj_len > 0 && hexdump == FALSE ) {
+ subobj_type = EXTRACT_16BITS(obj_tptr+offset)>>8;
+ subobj_len = EXTRACT_16BITS(obj_tptr+offset)&0x00FF;
+ printf("\n\t Subobject, Type: %s (%u), Length: %u",
+ tok2str(lmp_data_link_subobj,
+ "Unknown",
+ subobj_type),
+ subobj_type,
+ subobj_len);
+ switch(subobj_type) {
+ case INT_SWITCHING_TYPE_SUBOBJ:
+ printf("\n\t\t Switching Type: %s (%u)",
+ tok2str(gmpls_switch_cap_values,
+ "Unknown",
+ EXTRACT_16BITS(obj_tptr+offset+2)>>8),
+ EXTRACT_16BITS(obj_tptr+offset+2)>>8);
+ printf("\n\t\t Encoding Type: %s (%u)",
+ tok2str(gmpls_encoding_values,
+ "Unknown",
+ EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF),
+ EXTRACT_16BITS(obj_tptr+offset+2)&0x00FF);
+ bw.i = EXTRACT_32BITS(obj_tptr+offset+4);
+ printf("\n\t\t Min Reservable Bandwidth: %.3f Mbps",
+ bw.f);
+ bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
+ printf("\n\t\t Max Reservable Bandwidth: %.3f Mbps",
+ bw.f);
+ break;
+ case WAVELENGTH_SUBOBJ:
+ printf("\n\t\t Wavelength: %u",
+ EXTRACT_32BITS(obj_tptr+offset+4));
+ break;
+ default:
+ /* Any Unknown Subobject ==> Exit loop */
+ hexdump=TRUE;
+ break;
+ }
+ total_subobj_len-=subobj_len;
+ offset+=subobj_len;
+ }
+
+ break;
+#ifdef INET6
+ case LMP_CTYPE_IPV6:
+#endif
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_VERIFY_BEGIN:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_1:
+ printf("\n\t Flags: %s",
+ bittok2str(lmp_obj_begin_verify_flag_values,
+ "none",
+ EXTRACT_16BITS(obj_tptr)));
+ printf("\n\t Verify Interval: %u",
+ EXTRACT_16BITS(obj_tptr+2));
+ printf("\n\t Data links: %u",
+ EXTRACT_32BITS(obj_tptr+4));
+ printf("\n\t Encoding type: %s",
+ tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8)));
+ printf("\n\t Verify Tranport Mechanism: %u (0x%x) %s",
+ EXTRACT_16BITS(obj_tptr+10),
+ EXTRACT_16BITS(obj_tptr+10),
+ EXTRACT_16BITS(obj_tptr+10)&8000 ? "(Payload test messages capable)" : "");
+ bw.i = EXTRACT_32BITS(obj_tptr+12);
+ printf("\n\t Transmission Rate: %.3f Mbps",bw.f);
+ printf("\n\t Wavelength: %u",
+ EXTRACT_32BITS(obj_tptr+16));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_VERIFY_BEGIN_ACK:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_1:
+ printf("\n\t Verify Dead Interval: %u \
+ \n\t Verify Transport Response: %u",
+ EXTRACT_16BITS(obj_tptr),
+ EXTRACT_16BITS(obj_tptr+2));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_VERIFY_ID:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_1:
+ printf("\n\t Verify ID: %u",
+ EXTRACT_32BITS(obj_tptr));
+ break;
+
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_CHANNEL_STATUS:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_IPV4:
+ case LMP_CTYPE_UNMD:
+ offset = 0;
+ /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
+ while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
+ printf("\n\t Interface ID: %s (0x%08x)",
+ ipaddr_string(obj_tptr+offset),
+ EXTRACT_32BITS(obj_tptr+offset));
+
+ printf("\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ?
+ "Allocated" : "Non-allocated",
+ (EXTRACT_32BITS(obj_tptr+offset+4)>>31));
+
+ printf("\n\t\t Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ?
+ "Transmit" : "Receive",
+ (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1);
+
+ printf("\n\t\t Channel Status: %s (%u)",
+ tok2str(lmp_obj_channel_status_values,
+ "Unknown",
+ EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF),
+ EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF);
+ offset+=8;
+ }
+ break;
+#ifdef INET6
+ case LMP_CTYPE_IPV6:
+#endif
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_CHANNEL_STATUS_REQ:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_IPV4:
+ case LMP_CTYPE_UNMD:
+ offset = 0;
+ while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) {
+ printf("\n\t Interface ID: %s (0x%08x)",
+ ipaddr_string(obj_tptr+offset),
+ EXTRACT_32BITS(obj_tptr+offset));
+ offset+=4;
+ }
+ break;
+#ifdef INET6
+ case LMP_CTYPE_IPV6:
+#endif
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ case LMP_OBJ_ERROR_CODE:
+ switch(lmp_obj_ctype) {
+ case LMP_CTYPE_BEGIN_VERIFY_ERROR:
+ printf("\n\t Error Code: %s",
+ bittok2str(lmp_obj_begin_verify_error_values,
+ "none",
+ EXTRACT_32BITS(obj_tptr)));
+ break;
+
+ case LMP_CTYPE_LINK_SUMMARY_ERROR:
+ printf("\n\t Error Code: %s",
+ bittok2str(lmp_obj_link_summary_error_values,
+ "none",
+ EXTRACT_32BITS(obj_tptr)));
+ break;
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
+ default:
+ if (vflag <= 1)
+ print_unknown_data(obj_tptr,"\n\t ",obj_tlen);
+ break;
+ }
+ /* do we want to see an additionally hexdump ? */
+ if (vflag > 1 || hexdump==TRUE)
+ print_unknown_data(tptr+sizeof(sizeof(struct lmp_object_header)),"\n\t ",
+ lmp_obj_len-sizeof(struct lmp_object_header));
+
+ tptr+=lmp_obj_len;
+ tlen-=lmp_obj_len;
+ }
+ return;
+trunc:
+ printf("\n\t\t packet exceeded snapshot");
+}
diff --git a/contrib/tcpdump/print-lspping.c b/contrib/tcpdump/print-lspping.c
new file mode 100644
index 000000000000..34e433c236cc
--- /dev/null
+++ b/contrib/tcpdump/print-lspping.c
@@ -0,0 +1,859 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.12 2004/11/11 12:02:31 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 "addrtoname.h"
+
+#include "bgp.h"
+#include "l2vpn.h"
+
+/*
+ * LSPPING common header
+ *
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Version Number | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Message Type | Reply mode | Return Code | Return Subcode|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sender's Handle |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sequence Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | TimeStamp Sent (seconds) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | TimeStamp Sent (microseconds) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | TimeStamp Received (seconds) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | TimeStamp Received (microseconds) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | TLVs ... |
+ * . .
+ * . .
+ * . .
+ */
+
+struct lspping_common_header {
+ u_int8_t version[2];
+ u_int8_t reserved[2];
+ u_int8_t msg_type;
+ u_int8_t reply_mode;
+ u_int8_t return_code;
+ u_int8_t return_subcode;
+ u_int8_t sender_handle[4];
+ u_int8_t seq_number[4];
+ u_int8_t ts_sent_sec[4];
+ u_int8_t ts_sent_usec[4];
+ u_int8_t ts_rcvd_sec[4];
+ u_int8_t ts_rcvd_usec[4];
+};
+
+#define LSPPING_VERSION 1
+#define FALSE 0
+#define TRUE 1
+
+static const struct tok lspping_msg_type_values[] = {
+ { 1, "MPLS Echo Request"},
+ { 2, "MPLS Echo Reply"},
+ { 0, NULL}
+};
+
+static const struct tok lspping_reply_mode_values[] = {
+ { 1, "Do not reply"},
+ { 2, "Reply via an IPv4/IPv6 UDP packet"},
+ { 3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"},
+ { 4, "Reply via application level control channel"},
+ { 0, NULL}
+};
+
+static const struct tok lspping_return_code_values[] = {
+ { 0, "No return code or return code contained in the Error Code TLV"},
+ { 1, "Malformed echo request received"},
+ { 2, "One or more of the TLVs was not understood"},
+ { 3, "Replying router is an egress for the FEC at stack depth"},
+ { 4, "Replying router has no mapping for the FEC at stack depth"},
+ { 5, "Reserved"},
+ { 6, "Reserved"},
+ { 7, "Reserved"},
+ { 8, "Label switched at stack-depth"},
+ { 9, "Label switched but no MPLS forwarding at stack-depth"},
+ { 10, "Mapping for this FEC is not the given label at stack depth"},
+ { 11, "No label entry at stack-depth"},
+ { 12, "Protocol not associated with interface at FEC stack depth"},
+};
+
+
+/*
+ * LSPPING TLV header
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Type | Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Value |
+ * . .
+ * . .
+ * . .
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+struct lspping_tlv_header {
+ u_int8_t type[2];
+ u_int8_t length[2];
+};
+
+#define LSPPING_TLV_TARGET_FEC_STACK 1
+#define LSPPING_TLV_DOWNSTREAM_MAPPING 2
+#define LSPPING_TLV_PAD 3
+#define LSPPING_TLV_ERROR_CODE 4
+#define LSPPING_TLV_VENDOR_PRIVATE 5
+
+static const struct tok lspping_tlv_values[] = {
+ { LSPPING_TLV_TARGET_FEC_STACK, "Target FEC Stack" },
+ { LSPPING_TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" },
+ { LSPPING_TLV_PAD, "Pad" },
+ { LSPPING_TLV_ERROR_CODE, "Error Code" },
+ { LSPPING_TLV_VENDOR_PRIVATE, "Vendor Enterprise Code" },
+ { 0, NULL}
+};
+
+#define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4 1
+#define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6 2
+#define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4 3
+#define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6 4
+#define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4 6
+#define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6 7
+#define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT 8
+#define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD 9
+#define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID 10
+#define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4 11
+#define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6 12
+
+static const struct tok lspping_tlvtargetfec_subtlv_values[] = {
+ { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4, "LDP IPv4 prefix"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6, "LDP IPv6 prefix"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4, "RSVP IPv4 Session Query"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6, "RSVP IPv6 Session Query"},
+ { 5, "Reserved"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4, "VPN IPv4 prefix"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6, "VPN IPv6 prefix"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT, "L2 VPN endpoint"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD, "L2 circuit ID (old)"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID, "L2 circuit ID"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4, "BGP labeled IPv4 prefix"},
+ { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6, "BGP labeled IPv6 prefix"},
+ { 0, NULL}
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv4 prefix |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Prefix Length | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t {
+ u_int8_t prefix [4];
+ u_int8_t prefix_len;
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv6 prefix |
+ * | (16 octets) |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Prefix Length | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t {
+ u_int8_t prefix [16];
+ u_int8_t prefix_len;
+};
+
+/*
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sender identifier |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv4 prefix |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Prefix Length | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t {
+ u_int8_t sender_id [4];
+ u_int8_t prefix [4];
+ u_int8_t prefix_len;
+};
+
+/*
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sender identifier |
+ * | (16 octets) |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv6 prefix |
+ * | (16 octets) |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Prefix Length | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t {
+ u_int8_t sender_id [16];
+ u_int8_t prefix [16];
+ u_int8_t prefix_len;
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv4 tunnel end point address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Must Be Zero | Tunnel ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Extended Tunnel ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv4 tunnel sender address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Must Be Zero | LSP ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t {
+ u_int8_t tunnel_endpoint [4];
+ u_int8_t res[2];
+ u_int8_t tunnel_id[2];
+ u_int8_t extended_tunnel_id[4];
+ u_int8_t tunnel_sender [4];
+ u_int8_t res2[2];
+ u_int8_t lsp_id [2];
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv6 tunnel end point address |
+ * | |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Must Be Zero | Tunnel ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Extended Tunnel ID |
+ * | |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv6 tunnel sender address |
+ * | |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Must Be Zero | LSP ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t {
+ u_int8_t tunnel_endpoint [16];
+ u_int8_t res[2];
+ u_int8_t tunnel_id[2];
+ u_int8_t extended_tunnel_id[16];
+ u_int8_t tunnel_sender [16];
+ u_int8_t res2[2];
+ u_int8_t lsp_id [2];
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Route Distinguisher |
+ * | (8 octets) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv4 prefix |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Prefix Length | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t {
+ u_int8_t rd [8];
+ u_int8_t prefix [4];
+ u_int8_t prefix_len;
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Route Distinguisher |
+ * | (8 octets) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IPv6 prefix |
+ * | (16 octets) |
+ * | |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Prefix Length | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t {
+ u_int8_t rd [8];
+ u_int8_t prefix [16];
+ u_int8_t prefix_len;
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Route Distinguisher |
+ * | (8 octets) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sender's CE ID | Receiver's CE ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encapsulation Type | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * 0 1 2 3
+ */
+struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t {
+ u_int8_t rd [8];
+ u_int8_t sender_ce_id [2];
+ u_int8_t receiver_ce_id [2];
+ u_int8_t encapsulation[2];
+};
+
+/*
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Remote PE Address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | VC ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encapsulation Type | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t {
+ u_int8_t remote_pe_address [4];
+ u_int8_t vc_id [4];
+ u_int8_t encapsulation[2];
+};
+
+/*
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sender's PE Address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Remote PE Address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | VC ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encapsulation Type | Must Be Zero |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t {
+ u_int8_t sender_pe_address [4];
+ u_int8_t remote_pe_address [4];
+ u_int8_t vc_id [4];
+ u_int8_t encapsulation[2];
+};
+
+/*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | MTU | Address Type | Resvd (SBZ) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Downstream IP Address (4 or 16 octets) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Downstream Interface Address (4 or 16 octets) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Hash Key Type | Depth Limit | Multipath Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * . .
+ * . (Multipath Information) .
+ * . .
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Downstream Label | Protocol |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * . .
+ * . .
+ * . .
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Downstream Label | Protocol |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+struct lspping_tlv_downstream_map_ipv4_t {
+ u_int8_t mtu [2];
+ u_int8_t address_type;
+ u_int8_t res;
+ u_int8_t downstream_ip[4];
+ u_int8_t downstream_interface[4];
+};
+
+struct lspping_tlv_downstream_map_ipv6_t {
+ u_int8_t mtu [2];
+ u_int8_t address_type;
+ u_int8_t res;
+ u_int8_t downstream_ip[16];
+ u_int8_t downstream_interface[16];
+};
+
+struct lspping_tlv_downstream_map_info_t {
+ u_int8_t hash_key_type;
+ u_int8_t depth_limit;
+ u_int8_t multipath_length [2];
+};
+
+#define LSPPING_AFI_IPV4 1
+#define LSPPING_AFI_UNMB 2
+#define LSPPING_AFI_IPV6 3
+
+static const struct tok lspping_tlv_downstream_addr_values[] = {
+ { LSPPING_AFI_IPV4, "IPv4"},
+ { LSPPING_AFI_IPV6, "IPv6"},
+ { LSPPING_AFI_UNMB, "Unnumbered"},
+ { 0, NULL}
+};
+
+void
+lspping_print(register const u_char *pptr, register u_int len) {
+
+ const struct lspping_common_header *lspping_com_header;
+ const struct lspping_tlv_header *lspping_tlv_header;
+ const struct lspping_tlv_header *lspping_subtlv_header;
+ const u_char *tptr,*tlv_tptr,*subtlv_tptr;
+ int tlen,lspping_tlv_len,lspping_tlv_type,tlv_tlen;
+ int tlv_hexdump,subtlv_hexdump;
+ int lspping_subtlv_len,lspping_subtlv_type;
+ struct timeval timestamp;
+
+ union {
+ const struct lspping_tlv_downstream_map_ipv4_t *lspping_tlv_downstream_map_ipv4;
+ const struct lspping_tlv_downstream_map_ipv6_t *lspping_tlv_downstream_map_ipv6;
+ const struct lspping_tlv_downstream_map_info_t *lspping_tlv_downstream_map_info;
+ } tlv_ptr;
+
+ union {
+ const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *lspping_tlv_targetfec_subtlv_ldp_ipv4;
+ const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *lspping_tlv_targetfec_subtlv_ldp_ipv6;
+ const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *lspping_tlv_targetfec_subtlv_rsvp_ipv4;
+ const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *lspping_tlv_targetfec_subtlv_rsvp_ipv6;
+ const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv4;
+ const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv6;
+ const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *lspping_tlv_targetfec_subtlv_l2vpn_endpt;
+ const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *lspping_tlv_targetfec_subtlv_l2vpn_vcid_old;
+ const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *lspping_tlv_targetfec_subtlv_l2vpn_vcid;
+ const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *lspping_tlv_targetfec_subtlv_bgp_ipv4;
+ const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *lspping_tlv_targetfec_subtlv_bgp_ipv6;
+ } subtlv_ptr;
+
+ tptr=pptr;
+ lspping_com_header = (const struct lspping_common_header *)pptr;
+ TCHECK(*lspping_com_header);
+
+ /*
+ * Sanity checking of the header.
+ */
+ if (EXTRACT_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
+ printf("LSP-PING version %u packet not supported",
+ EXTRACT_16BITS(&lspping_com_header->version[0]));
+ return;
+ }
+
+ /* in non-verbose mode just lets print the basic Message Type*/
+ if (vflag < 1) {
+ printf("LSP-PINGv%u, %s, seq %u, length: %u",
+ EXTRACT_16BITS(&lspping_com_header->version[0]),
+ tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type),
+ EXTRACT_32BITS(lspping_com_header->seq_number),
+ len);
+ return;
+ }
+
+ /* ok they seem to want to know everything - lets fully decode it */
+
+ tlen=len;
+
+ printf("\n\tLSP-PINGv%u, msg-type: %s (%u), reply-mode: %s (%u)",
+ EXTRACT_16BITS(&lspping_com_header->version[0]),
+ tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
+ lspping_com_header->msg_type,
+ tok2str(lspping_reply_mode_values, "unknown",lspping_com_header->reply_mode),
+ lspping_com_header->reply_mode);
+
+ /*
+ * the following return codes require that the subcode is attached
+ * at the end of the translated token output
+ */
+ if (lspping_com_header->return_code == 3 ||
+ lspping_com_header->return_code == 4 ||
+ lspping_com_header->return_code == 8 ||
+ lspping_com_header->return_code == 10 ||
+ lspping_com_header->return_code == 11 ||
+ lspping_com_header->return_code == 12 )
+ printf("\n\t Return Code: %s %u (%u), Return Subcode: (%u)",
+ tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
+ lspping_com_header->return_subcode,
+ lspping_com_header->return_code,
+ lspping_com_header->return_subcode);
+ else
+ printf("\n\t Return Code: %s (%u), Return Subcode: (%u)",
+ tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
+ lspping_com_header->return_code,
+ lspping_com_header->return_subcode);
+
+ printf("\n\t Sender Handle: 0x%08x, Sequence: %u",
+ EXTRACT_32BITS(lspping_com_header->sender_handle),
+ EXTRACT_32BITS(lspping_com_header->seq_number));
+
+ timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec);
+ timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec);
+ printf("\n\t Sender Timestamp: ");
+ ts_print(&timestamp);
+
+ timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec);
+ timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec);
+ printf("Receiver Timestamp: ");
+ if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
+ ts_print(&timestamp);
+ else
+ printf("no timestamp");
+
+ tptr+=sizeof(const struct lspping_common_header);
+ tlen-=sizeof(const struct lspping_common_header);
+
+ while(tlen>(int)sizeof(struct lspping_tlv_header)) {
+ /* did we capture enough for fully decoding the tlv header ? */
+ if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
+ goto trunc;
+
+ lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
+ lspping_tlv_type=EXTRACT_16BITS(lspping_tlv_header->type);
+ lspping_tlv_len=EXTRACT_16BITS(lspping_tlv_header->length);
+
+ if (lspping_tlv_len == 0)
+ return;
+
+ if(lspping_tlv_len % 4 || lspping_tlv_len < 4) { /* aligned to four octet boundary */
+ printf("\n\t ERROR: TLV %u bogus size %u",lspping_tlv_type,lspping_tlv_len);
+ return;
+ }
+
+ printf("\n\t %s TLV (%u), length: %u",
+ tok2str(lspping_tlv_values,
+ "Unknown",
+ lspping_tlv_type),
+ lspping_tlv_type,
+ lspping_tlv_len);
+
+ tlv_tptr=tptr+sizeof(struct lspping_tlv_header);
+ tlv_tlen=lspping_tlv_len; /* header not included -> no adjustment */
+
+ /* did we capture enough for fully decoding the tlv ? */
+ if (!TTEST2(*tptr, lspping_tlv_len))
+ goto trunc;
+ tlv_hexdump=FALSE;
+
+ switch(lspping_tlv_type) {
+ case LSPPING_TLV_TARGET_FEC_STACK:
+ while(tlv_tlen>(int)sizeof(struct lspping_tlv_header)) {
+
+ /* did we capture enough for fully decoding the subtlv header ? */
+ if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
+ goto trunc;
+ subtlv_hexdump=FALSE;
+
+ lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
+ lspping_subtlv_type=EXTRACT_16BITS(lspping_subtlv_header->type);
+ lspping_subtlv_len=EXTRACT_16BITS(lspping_subtlv_header->length);
+ subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header);
+
+ if (lspping_subtlv_len == 0)
+ break;
+
+ printf("\n\t %s subTLV (%u), length: %u",
+ tok2str(lspping_tlvtargetfec_subtlv_values,
+ "Unknown",
+ lspping_subtlv_type),
+ lspping_subtlv_type,
+ lspping_subtlv_len);
+
+ switch(lspping_subtlv_type) {
+
+ case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4 = \
+ (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr;
+ printf("\n\t %s/%u",
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix),
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len);
+ break;
+
+#ifdef INET6
+ case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6 = \
+ (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr;
+ printf("\n\t %s/%u",
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix),
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len);
+ break;
+#endif
+
+ case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4 = \
+ (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr;
+ printf("\n\t %s/%u, sender-id %s",
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix),
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len,
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id));
+ break;
+
+#ifdef INET6
+ case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6 = \
+ (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr;
+ printf("\n\t %s/%u, sender-id %s",
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix),
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len,
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id));
+ break;
+#endif
+
+ case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4 = \
+ (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *)subtlv_tptr;
+ printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
+ "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id));
+ break;
+
+#ifdef INET6
+ case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6 = \
+ (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *)subtlv_tptr;
+ printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
+ "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id));
+ break;
+#endif
+
+ case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4 = \
+ (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *)subtlv_tptr;
+ printf("\n\t RD: %s, %s/%u",
+ bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd),
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix),
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len);
+ break;
+
+#ifdef INET6
+ case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6 = \
+ (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *)subtlv_tptr;
+ printf("\n\t RD: %s, %s/%u",
+ bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd),
+ ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix),
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len);
+ break;
+#endif
+
+ case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt = \
+ (const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *)subtlv_tptr;
+ printf("\n\t RD: %s, Sender CE-ID: %u, Receiver CE-ID: %u" \
+ "\n\t Encapsulation Type: %s (%u)",
+ bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ce_id),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ce_id),
+ tok2str(l2vpn_encaps_values,
+ "unknown",
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation));
+
+ break;
+
+ /* the old L2VPN VCID subTLV does not have support for the sender field */
+ case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old = \
+ (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *)subtlv_tptr;
+ printf("\n\t Remote PE: %s" \
+ "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
+ EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->vc_id),
+ tok2str(l2vpn_encaps_values,
+ "unknown",
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation)),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation));
+
+ break;
+
+ case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID:
+ subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid = \
+ (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *)subtlv_tptr;
+ printf("\n\t Sender PE: %s, Remote PE: %s" \
+ "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
+ ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
+ EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->vc_id),
+ tok2str(l2vpn_encaps_values,
+ "unknown",
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation)),
+ EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation));
+
+ break;
+
+ default:
+ subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
+ break;
+ }
+ /* do we want to see an additionally subtlv hexdump ? */
+ if (vflag > 1 || subtlv_hexdump==TRUE)
+ print_unknown_data(tlv_tptr+sizeof(struct lspping_tlv_header), \
+ "\n\t ",
+ lspping_subtlv_len);
+
+ tlv_tptr+=lspping_subtlv_len;
+ tlv_tlen-=lspping_subtlv_len+sizeof(struct lspping_tlv_header);
+ }
+ break;
+
+ case LSPPING_TLV_DOWNSTREAM_MAPPING:
+ /* that strange thing with the downstream map TLV is that until now
+ * we do not know if its IPv4 or IPv6 , after we found the adress-type
+ * lets recast the tlv_tptr and move on */
+
+ tlv_ptr.lspping_tlv_downstream_map_ipv4= \
+ (const struct lspping_tlv_downstream_map_ipv4_t *)tlv_tptr;
+ tlv_ptr.lspping_tlv_downstream_map_ipv6= \
+ (const struct lspping_tlv_downstream_map_ipv6_t *)tlv_tptr;
+ printf("\n\t MTU: %u, Address-Type: %s (%u)",
+ EXTRACT_16BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->mtu),
+ tok2str(lspping_tlv_downstream_addr_values,
+ "unknown",
+ tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type),
+ tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type);
+
+ switch(tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type) {
+
+ case LSPPING_AFI_IPV4:
+ printf("\n\t Downstream IP: %s" \
+ "\n\t Downstream Interface IP: %s",
+ ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
+ ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
+ tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
+ tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
+ break;
+#ifdef INET6
+ case LSPPING_AFI_IPV6:
+ printf("\n\t Downstream IP: %s" \
+ "\n\t Downstream Interface IP: %s",
+ ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip),
+ ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface));
+ tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
+ tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
+ break;
+#endif
+ case LSPPING_AFI_UNMB:
+ printf("\n\t Downstream IP: %s" \
+ "\n\t Downstream Interface Index: 0x%08x",
+ ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
+ EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
+ tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
+ tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
+ break;
+
+ default:
+ /* should not happen ! - no error message - tok2str() has barked already */
+ break;
+ }
+
+ tlv_ptr.lspping_tlv_downstream_map_info= \
+ (const struct lspping_tlv_downstream_map_info_t *)tlv_tptr;
+
+ /* FIXME add hash-key type, depth limit, multipath processing */
+
+
+ tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_info_t);
+ tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_info_t);
+
+ /* FIXME print downstream labels */
+
+
+ tlv_hexdump=TRUE; /* dump the TLV until code complete */
+
+ break;
+
+ /*
+ * FIXME those are the defined TLVs that lack a decoder
+ * you are welcome to contribute code ;-)
+ */
+
+ case LSPPING_TLV_PAD:
+ case LSPPING_TLV_ERROR_CODE:
+ case LSPPING_TLV_VENDOR_PRIVATE:
+
+ default:
+ if (vflag <= 1)
+ print_unknown_data(tlv_tptr,"\n\t ",tlv_tlen);
+ break;
+ }
+ /* do we want to see an additionally tlv hexdump ? */
+ if (vflag > 1 || tlv_hexdump==TRUE)
+ print_unknown_data(tptr+sizeof(sizeof(struct lspping_tlv_header)),"\n\t ",
+ lspping_tlv_len);
+
+ tptr+=lspping_tlv_len;
+ tlen-=lspping_tlv_len+sizeof(struct lspping_tlv_header);
+ }
+ return;
+trunc:
+ printf("\n\t\t packet exceeded snapshot");
+}
diff --git a/contrib/tcpdump/print-lwres.c b/contrib/tcpdump/print-lwres.c
index 5272d4391a47..d0d6fe1cddfa 100644
--- a/contrib/tcpdump/print-lwres.c
+++ b/contrib/tcpdump/print-lwres.c
@@ -29,7 +29,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-lwres.c,v 1.10.2.3 2004/03/24 01:54:58 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-lwres.c,v 1.13 2004/03/24 01:54:29 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-mobile.c b/contrib/tcpdump/print-mobile.c
index 581510242527..fe6f013fa690 100644
--- a/contrib/tcpdump/print-mobile.c
+++ b/contrib/tcpdump/print-mobile.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.12.2.2 2003/11/16 08:51:33 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.15 2004/03/24 01:58:14 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -77,7 +77,7 @@ mobile_print(const u_char *bp, u_int length)
mob = (const struct mobile_ip *)bp;
- if (length < MOBILE_SIZE) {
+ if (length < MOBILE_SIZE || !TTEST(*mob)) {
fputs("[|mobile]", stdout);
return;
}
diff --git a/contrib/tcpdump/print-mobility.c b/contrib/tcpdump/print-mobility.c
index f5a1a4cdf387..a1a24a93c579 100644
--- a/contrib/tcpdump/print-mobility.c
+++ b/contrib/tcpdump/print-mobility.c
@@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.9.2.2 2003/11/16 08:51:33 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.11 2003/11/16 09:36:28 guy Exp $";
#endif
#ifdef INET6
diff --git a/contrib/tcpdump/print-mpls.c b/contrib/tcpdump/print-mpls.c
index 6e936c8698b8..3cb350451414 100644
--- a/contrib/tcpdump/print-mpls.c
+++ b/contrib/tcpdump/print-mpls.c
@@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.8.2.2 2003/11/16 08:51:34 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.13 2005/04/06 21:32:41 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -44,20 +44,7 @@ static const char rcsid[] _U_ =
#include "addrtoname.h"
#include "interface.h"
#include "extract.h" /* must come after interface.h */
-
-#define LABEL_MASK 0xfffff000
-#define LABEL_SHIFT 12
-#define EXP_MASK 0x00000e00
-#define EXP_SHIFT 9
-#define STACK_MASK 0x00000100
-#define STACK_SHIFT 8
-#define TTL_MASK 0x000000ff
-#define TTL_SHIFT 0
-
-#define MPLS_LABEL(x) (((x) & LABEL_MASK) >> LABEL_SHIFT)
-#define MPLS_EXP(x) (((x) & EXP_MASK) >> EXP_SHIFT)
-#define MPLS_STACK(x) (((x) & STACK_MASK) >> STACK_SHIFT)
-#define MPLS_TTL(x) (((x) & TTL_MASK) >> TTL_SHIFT)
+#include "mpls.h"
static const char *mpls_labelname[] = {
/*0*/ "IPv4 explicit NULL", "router alert", "IPv6 explicit NULL",
@@ -99,7 +86,7 @@ mpls_print(const u_char *bp, u_int length)
switch (MPLS_LABEL(v)) {
case 0: /* IPv4 explicit NULL label */
case 3: /* IPv4 implicit NULL label */
- ip_print(p, length - (p - bp));
+ ip_print(gndo, p, length - (p - bp));
break;
#ifdef INET6
case 2: /* IPv6 explicit NULL label */
@@ -135,7 +122,7 @@ mpls_print(const u_char *bp, u_int length)
case 0x4f:
if (vflag>0) {
printf("\n\t");
- ip_print(p, length - (p - bp));
+ ip_print(gndo, p, length - (p - bp));
}
else printf(", IP, length: %u",length);
break;
@@ -184,13 +171,10 @@ trunc:
printf("[|MPLS]");
}
+
/*
- * draft-ietf-mpls-lsp-ping-02.txt
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
*/
-void
-mpls_lsp_ping_print(const u_char *pptr, u_int length)
-{
- printf("UDP, LSP-PING, length: %u", length);
- if (vflag >1)
- print_unknown_data(pptr,"\n\t ", length);
-}
diff --git a/contrib/tcpdump/print-msdp.c b/contrib/tcpdump/print-msdp.c
index 0606574ab3ea..3f79b68b1ac0 100644
--- a/contrib/tcpdump/print-msdp.c
+++ b/contrib/tcpdump/print-msdp.c
@@ -17,7 +17,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-msdp.c,v 1.4.2.2 2003/11/16 08:51:34 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-msdp.c,v 1.7 2005/04/06 21:32:41 mcr Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -70,7 +70,7 @@ msdp_print(const unsigned char *sp, u_int length)
(void)printf(" [w/data]");
if (vflag > 1) {
(void)printf(" ");
- ip_print(sp + *sp * 12 + 8 - 3,
+ ip_print(gndo, sp + *sp * 12 + 8 - 3,
len - (*sp * 12 + 8));
}
}
@@ -99,3 +99,10 @@ msdp_print(const unsigned char *sp, u_int length)
trunc:
(void)printf(" [|msdp]");
}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-netbios.c b/contrib/tcpdump/print-netbios.c
index c25f343abd89..419953cb5c63 100644
--- a/contrib/tcpdump/print-netbios.c
+++ b/contrib/tcpdump/print-netbios.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-netbios.c,v 1.18.2.2 2003/11/16 08:51:35 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-netbios.c,v 1.20 2003/11/16 09:36:29 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-nfs.c b/contrib/tcpdump/print-nfs.c
index 77d4ebffbf84..6fa765dff22d 100644
--- a/contrib/tcpdump/print-nfs.c
+++ b/contrib/tcpdump/print-nfs.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.99.2.2 2003/11/16 08:51:35 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.106 2005/01/05 08:16:45 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,8 +30,6 @@ static const char rcsid[] _U_ =
#include <tcpdump-stdinc.h>
-#include <rpc/rpc.h>
-
#include <pcap.h>
#include <stdio.h>
#include <string.h>
@@ -47,15 +45,16 @@ static const char rcsid[] _U_ =
#ifdef INET6
#include "ip6.h"
#endif
+#include "rpc_auth.h"
+#include "rpc_msg.h"
static void nfs_printfh(const u_int32_t *, const u_int);
-static void xid_map_enter(const struct rpc_msg *, const u_char *);
-static int32_t xid_map_find(const struct rpc_msg *, const u_char *,
+static void xid_map_enter(const struct sunrpc_msg *, const u_char *);
+static int32_t xid_map_find(const struct sunrpc_msg *, const u_char *,
u_int32_t *, u_int32_t *);
-static void interp_reply(const struct rpc_msg *, u_int32_t, u_int32_t, int);
+static void interp_reply(const struct sunrpc_msg *, u_int32_t, u_int32_t, int);
static const u_int32_t *parse_post_op_attr(const u_int32_t *, int);
static void print_sattr3(const struct nfsv3_sattr *sa3, int verbose);
-static int print_int64(const u_int32_t *dp, int how);
static void print_nfsaddr(const u_char *, const char *, const char *);
/*
@@ -157,59 +156,6 @@ static struct tok type2str[] = {
{ 0, NULL }
};
-/*
- * Print out a 64-bit integer. This appears to be different on each system,
- * try to make the best of it. The integer stored as 2 consecutive XDR
- * encoded 32-bit integers, to which a pointer is passed.
- *
- * Assume that a system that has INT64_FORMAT defined, has a 64-bit
- * integer datatype and can print it.
- */
-
-#define UNSIGNED 0
-#define SIGNED 1
-#define HEX 2
-
-static int print_int64(const u_int32_t *dp, int how)
-{
-#ifdef INT64_FORMAT
- u_int64_t res;
-
- res = ((u_int64_t)EXTRACT_32BITS(&dp[0]) << 32) | (u_int64_t)EXTRACT_32BITS(&dp[1]);
- switch (how) {
- case SIGNED:
- printf(INT64_FORMAT, res);
- break;
- case UNSIGNED:
- printf(U_INT64_FORMAT, res);
- break;
- case HEX:
- printf(HEX_INT64_FORMAT, res);
- break;
- default:
- return (0);
- }
-#else
- u_int32_t high;
-
- high = EXTRACT_32BITS(&dp[0]);
-
- switch (how) {
- case SIGNED:
- case UNSIGNED:
- case HEX:
- if (high != 0)
- printf("0x%x%08x", high, EXTRACT_32BITS(&dp[1]));
- else
- printf("0x%x", EXTRACT_32BITS(&dp[1]));
- break;
- default:
- return (0);
- }
-#endif
- return 1;
-}
-
static void
print_nfsaddr(const u_char *bp, const char *s, const char *d)
{
@@ -340,12 +286,12 @@ void
nfsreply_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
- register const struct rpc_msg *rp;
+ register const struct sunrpc_msg *rp;
u_int32_t proc, vers;
char srcid[20], dstid[20]; /*fits 32bit*/
nfserr = 0; /* assume no error */
- rp = (const struct rpc_msg *)bp;
+ rp = (const struct sunrpc_msg *)bp;
if (!nflag) {
strlcpy(srcid, "nfs", sizeof(srcid));
@@ -358,9 +304,9 @@ nfsreply_print(register const u_char *bp, u_int length,
}
print_nfsaddr(bp2, srcid, dstid);
(void)printf("reply %s %d",
- EXTRACT_32BITS(&rp->rm_reply.rp_stat) == MSG_ACCEPTED?
- "ok":"ERR",
- length);
+ EXTRACT_32BITS(&rp->rm_reply.rp_stat) == SUNRPC_MSG_ACCEPTED?
+ "ok":"ERR",
+ length);
if (xid_map_find(rp, bp2, &proc, &vers) >= 0)
interp_reply(rp, proc, vers, length);
@@ -371,7 +317,7 @@ nfsreply_print(register const u_char *bp, u_int length,
* If the packet was truncated, return 0.
*/
static const u_int32_t *
-parsereq(register const struct rpc_msg *rp, register u_int length)
+parsereq(register const struct sunrpc_msg *rp, register u_int length)
{
register const u_int32_t *dp;
register u_int len;
@@ -471,7 +417,7 @@ void
nfsreq_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
- register const struct rpc_msg *rp;
+ register const struct sunrpc_msg *rp;
register const u_int32_t *dp;
nfs_type type;
int v3;
@@ -480,7 +426,7 @@ nfsreq_print(register const u_char *bp, u_int length,
char srcid[20], dstid[20]; /*fits 32bit*/
nfserr = 0; /* assume no error */
- rp = (const struct rpc_msg *)bp;
+ rp = (const struct sunrpc_msg *)bp;
if (!nflag) {
snprintf(srcid, sizeof(srcid), "%u",
EXTRACT_32BITS(&rp->rm_xid));
@@ -553,9 +499,9 @@ nfsreq_print(register const u_char *bp, u_int length,
(dp = parsefh(dp, v3)) != NULL) {
if (v3) {
TCHECK(dp[2]);
- printf(" %u bytes @ ",
- EXTRACT_32BITS(&dp[2]));
- print_int64(dp, UNSIGNED);
+ printf(" %u bytes @ %" PRIu64,
+ EXTRACT_32BITS(&dp[2]),
+ EXTRACT_64BITS(&dp[0]));
} else {
TCHECK(dp[1]);
printf(" %u bytes @ %u",
@@ -571,10 +517,11 @@ nfsreq_print(register const u_char *bp, u_int length,
if ((dp = parsereq(rp, length)) != NULL &&
(dp = parsefh(dp, v3)) != NULL) {
if (v3) {
- TCHECK(dp[4]);
- printf(" %u bytes @ ",
- EXTRACT_32BITS(&dp[4]));
- print_int64(dp, UNSIGNED);
+ TCHECK(dp[2]);
+ printf(" %u (%u) bytes @ %" PRIu64,
+ EXTRACT_32BITS(&dp[4]),
+ EXTRACT_32BITS(&dp[2]),
+ EXTRACT_64BITS(&dp[0]));
if (vflag) {
dp += 3;
TCHECK(dp[0]);
@@ -689,9 +636,9 @@ nfsreq_print(register const u_char *bp, u_int length,
* We shouldn't really try to interpret the
* offset cookie here.
*/
- printf(" %u bytes @ ",
- EXTRACT_32BITS(&dp[4]));
- print_int64(dp, SIGNED);
+ printf(" %u bytes @ %" PRId64,
+ EXTRACT_32BITS(&dp[4]),
+ EXTRACT_64BITS(&dp[0]));
if (vflag)
printf(" verf %08x%08x", dp[2],
dp[3]);
@@ -718,11 +665,14 @@ nfsreq_print(register const u_char *bp, u_int length,
* We don't try to interpret the offset
* cookie here.
*/
- printf(" %u bytes @ ", EXTRACT_32BITS(&dp[4]));
- print_int64(dp, SIGNED);
- if (vflag)
+ printf(" %u bytes @ %" PRId64,
+ EXTRACT_32BITS(&dp[4]),
+ EXTRACT_64BITS(&dp[0]));
+ if (vflag) {
+ TCHECK(dp[5]);
printf(" max %u verf %08x%08x",
EXTRACT_32BITS(&dp[5]), dp[2], dp[3]);
+ }
return;
}
break;
@@ -752,8 +702,10 @@ nfsreq_print(register const u_char *bp, u_int length,
printf(" commit");
if ((dp = parsereq(rp, length)) != NULL &&
(dp = parsefh(dp, v3)) != NULL) {
- printf(" %u bytes @ ", EXTRACT_32BITS(&dp[2]));
- print_int64(dp, UNSIGNED);
+ TCHECK(dp[2]);
+ printf(" %u bytes @ %" PRIu64,
+ EXTRACT_32BITS(&dp[2]),
+ EXTRACT_64BITS(&dp[0]));
return;
}
break;
@@ -859,7 +811,7 @@ int xid_map_next = 0;
int xid_map_hint = 0;
static void
-xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
+xid_map_enter(const struct sunrpc_msg *rp, const u_char *bp)
{
struct ip *ip = NULL;
#ifdef INET6
@@ -907,7 +859,7 @@ xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
* version in vers return, or returns -1 on failure
*/
static int
-xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
+xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, u_int32_t *proc,
u_int32_t *vers)
{
int i;
@@ -974,11 +926,11 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
* If the packet was truncated, return 0.
*/
static const u_int32_t *
-parserep(register const struct rpc_msg *rp, register u_int length)
+parserep(register const struct sunrpc_msg *rp, register u_int length)
{
register const u_int32_t *dp;
u_int len;
- enum accept_stat astat;
+ enum sunrpc_accept_stat astat;
/*
* Portability note:
@@ -1012,30 +964,30 @@ parserep(register const struct rpc_msg *rp, register u_int length)
astat = EXTRACT_32BITS(dp);
switch (astat) {
- case SUCCESS:
+ case SUNRPC_SUCCESS:
break;
- case PROG_UNAVAIL:
+ case SUNRPC_PROG_UNAVAIL:
printf(" PROG_UNAVAIL");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case PROG_MISMATCH:
+ case SUNRPC_PROG_MISMATCH:
printf(" PROG_MISMATCH");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case PROC_UNAVAIL:
+ case SUNRPC_PROC_UNAVAIL:
printf(" PROC_UNAVAIL");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case GARBAGE_ARGS:
+ case SUNRPC_GARBAGE_ARGS:
printf(" GARBAGE_ARGS");
nfserr = 1; /* suppress trunc string */
return (NULL);
- case SYSTEM_ERR:
+ case SUNRPC_SYSTEM_ERR:
printf(" SYSTEM_ERR");
nfserr = 1; /* suppress trunc string */
return (NULL);
@@ -1089,8 +1041,8 @@ parsefattr(const u_int32_t *dp, int verbose, int v3)
EXTRACT_32BITS(&fap->fa_gid));
if (v3) {
TCHECK(fap->fa3_size);
- printf(" sz ");
- print_int64((u_int32_t *)&fap->fa3_size, UNSIGNED);
+ printf(" sz %" PRIu64,
+ EXTRACT_64BITS((u_int32_t *)&fap->fa3_size));
} else {
TCHECK(fap->fa2_size);
printf(" sz %d", EXTRACT_32BITS(&fap->fa2_size));
@@ -1104,10 +1056,10 @@ parsefattr(const u_int32_t *dp, int verbose, int v3)
EXTRACT_32BITS(&fap->fa_nlink),
EXTRACT_32BITS(&fap->fa3_rdev.specdata1),
EXTRACT_32BITS(&fap->fa3_rdev.specdata2));
- printf(" fsid ");
- print_int64((u_int32_t *)&fap->fa3_fsid, HEX);
- printf(" fileid ");
- print_int64((u_int32_t *)&fap->fa3_fileid, HEX);
+ printf(" fsid %" PRIx64,
+ EXTRACT_64BITS((u_int32_t *)&fap->fa3_fsid));
+ printf(" fileid %" PRIx64,
+ EXTRACT_64BITS((u_int32_t *)&fap->fa3_fileid));
printf(" a/m/ctime %u.%06u",
EXTRACT_32BITS(&fap->fa3_atime.nfsv3_sec),
EXTRACT_32BITS(&fap->fa3_atime.nfsv3_nsec));
@@ -1215,20 +1167,15 @@ parsestatfs(const u_int32_t *dp, int v3)
sfsp = (const struct nfs_statfs *)dp;
if (v3) {
- printf(" tbytes ");
- print_int64((u_int32_t *)&sfsp->sf_tbytes, UNSIGNED);
- printf(" fbytes ");
- print_int64((u_int32_t *)&sfsp->sf_fbytes, UNSIGNED);
- printf(" abytes ");
- print_int64((u_int32_t *)&sfsp->sf_abytes, UNSIGNED);
+ printf(" tbytes %" PRIu64 " fbytes %" PRIu64 " abytes %" PRIu64,
+ EXTRACT_64BITS((u_int32_t *)&sfsp->sf_tbytes),
+ EXTRACT_64BITS((u_int32_t *)&sfsp->sf_fbytes),
+ EXTRACT_64BITS((u_int32_t *)&sfsp->sf_abytes));
if (vflag) {
- printf(" tfiles ");
- print_int64((u_int32_t *)&sfsp->sf_tfiles, UNSIGNED);
- printf(" ffiles ");
- print_int64((u_int32_t *)&sfsp->sf_ffiles, UNSIGNED);
- printf(" afiles ");
- print_int64((u_int32_t *)&sfsp->sf_afiles, UNSIGNED);
- printf(" invar %u",
+ printf(" tfiles %" PRIu64 " ffiles %" PRIu64 " afiles %" PRIu64 " invar %u",
+ EXTRACT_64BITS((u_int32_t *)&sfsp->sf_tfiles),
+ EXTRACT_64BITS((u_int32_t *)&sfsp->sf_ffiles),
+ EXTRACT_64BITS((u_int32_t *)&sfsp->sf_afiles),
EXTRACT_32BITS(&sfsp->sf_invarsec));
}
} else {
@@ -1272,8 +1219,7 @@ trunc:
static const u_int32_t *
parse_wcc_attr(const u_int32_t *dp)
{
- printf(" sz ");
- print_int64(dp, UNSIGNED);
+ printf(" sz %" PRIu64, EXTRACT_64BITS(&dp[0]));
printf(" mtime %u.%06u ctime %u.%06u",
EXTRACT_32BITS(&dp[2]), EXTRACT_32BITS(&dp[3]),
EXTRACT_32BITS(&dp[4]), EXTRACT_32BITS(&dp[5]));
@@ -1419,10 +1365,10 @@ parsefsinfo(const u_int32_t *dp)
EXTRACT_32BITS(&sfp->fs_wtpref),
EXTRACT_32BITS(&sfp->fs_dtpref));
if (vflag) {
- printf(" rtmult %u wtmult %u maxfsz ",
+ printf(" rtmult %u wtmult %u maxfsz %" PRIu64,
EXTRACT_32BITS(&sfp->fs_rtmult),
- EXTRACT_32BITS(&sfp->fs_wtmult));
- print_int64((u_int32_t *)&sfp->fs_maxfilesize, UNSIGNED);
+ EXTRACT_32BITS(&sfp->fs_wtmult),
+ EXTRACT_64BITS((u_int32_t *)&sfp->fs_maxfilesize));
printf(" delta %u.%06u ",
EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_sec),
EXTRACT_32BITS(&sfp->fs_timedelta.nfsv3_nsec));
@@ -1463,7 +1409,7 @@ trunc:
}
static void
-interp_reply(const struct rpc_msg *rp, u_int32_t proc, u_int32_t vers, int length)
+interp_reply(const struct sunrpc_msg *rp, u_int32_t proc, u_int32_t vers, int length)
{
register const u_int32_t *dp;
register int v3;
diff --git a/contrib/tcpdump/print-ntp.c b/contrib/tcpdump/print-ntp.c
index d1560089b57c..da1e791b819f 100644
--- a/contrib/tcpdump/print-ntp.c
+++ b/contrib/tcpdump/print-ntp.c
@@ -25,7 +25,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.37.2.2 2003/11/16 08:51:36 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.41 2004/01/28 14:54:50 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -52,6 +52,26 @@ static void p_sfix(const struct s_fixedpt *);
static void p_ntp_time(const struct l_fixedpt *);
static void p_ntp_delta(const struct l_fixedpt *, const struct l_fixedpt *);
+static struct tok ntp_mode_values[] = {
+ { MODE_UNSPEC, "unspecified" },
+ { MODE_SYM_ACT, "symmetric active" },
+ { MODE_SYM_PAS, "symmetric passive" },
+ { MODE_CLIENT, "Client" },
+ { MODE_SERVER, "Server" },
+ { MODE_BROADCAST, "Broadcast" },
+ { MODE_RES1, "Reserved" },
+ { MODE_RES2, "Reserved" },
+ { 0, NULL }
+};
+
+static struct tok ntp_leapind_values[] = {
+ { NO_WARNING, "" },
+ { PLUS_SEC, "+1s" },
+ { MINUS_SEC, "-1s" },
+ { ALARM, "clock unsynchronized" },
+ { 0, NULL }
+};
+
/*
* Print ntp requests
*/
@@ -62,90 +82,49 @@ ntp_print(register const u_char *cp, u_int length)
int mode, version, leapind;
bp = (struct ntpdata *)cp;
- /* Note funny sized packets */
- if (length != sizeof(struct ntpdata))
- (void)printf(" [len=%d]", length);
TCHECK(bp->status);
version = (int)(bp->status & VERSIONMASK) >> 3;
printf("NTPv%d", version);
- leapind = bp->status & LEAPMASK;
- switch (leapind) {
-
- case NO_WARNING:
- break;
-
- case PLUS_SEC:
- fputs(" +1s", stdout);
- break;
-
- case MINUS_SEC:
- fputs(" -1s", stdout);
- break;
- }
-
mode = bp->status & MODEMASK;
- switch (mode) {
-
- case MODE_UNSPEC: /* unspecified */
- fputs(" unspec", stdout);
- break;
-
- case MODE_SYM_ACT: /* symmetric active */
- fputs(" sym_act", stdout);
- break;
-
- case MODE_SYM_PAS: /* symmetric passive */
- fputs(" sym_pas", stdout);
- break;
+ if (!vflag) {
+ printf (", %s, length %u",
+ tok2str(ntp_mode_values, "Unknown mode", mode),
+ length);
+ return;
+ }
+
+ printf (", length %u\n\t%s",
+ length,
+ tok2str(ntp_mode_values, "Unknown mode", mode));
- case MODE_CLIENT: /* client */
- fputs(" client", stdout);
- break;
-
- case MODE_SERVER: /* server */
- fputs(" server", stdout);
- break;
-
- case MODE_BROADCAST: /* broadcast */
- fputs(" bcast", stdout);
- break;
-
- case MODE_RES1: /* reserved */
- fputs(" res1", stdout);
- break;
-
- case MODE_RES2: /* reserved */
- fputs(" res2", stdout);
- break;
-
- }
+ leapind = bp->status & LEAPMASK;
+ printf (", Leap indicator: %s (%u)",
+ tok2str(ntp_leapind_values, "Unknown", leapind),
+ leapind);
TCHECK(bp->stratum);
- printf(", strat %d", bp->stratum);
+ printf(", Stratum %u", bp->stratum);
TCHECK(bp->ppoll);
- printf(", poll %d", bp->ppoll);
+ printf(", poll %us", bp->ppoll);
/* Can't TCHECK bp->precision bitfield so bp->distance + 0 instead */
- TCHECK2(bp->distance, 0);
- printf(", prec %d", bp->precision);
-
- if (!vflag)
- return;
+ TCHECK2(bp->root_delay, 0);
+ printf(", precision %d", bp->precision);
- TCHECK(bp->distance);
- fputs(" dist ", stdout);
- p_sfix(&bp->distance);
+ TCHECK(bp->root_delay);
+ fputs("\n\tRoot Delay: ", stdout);
+ p_sfix(&bp->root_delay);
- TCHECK(bp->dispersion);
- fputs(", disp ", stdout);
- p_sfix(&bp->dispersion);
+ TCHECK(bp->root_dispersion);
+ fputs(", Root dispersion: ", stdout);
+ p_sfix(&bp->root_dispersion);
TCHECK(bp->refid);
- fputs(", ref ", stdout);
+ fputs(", Reference-ID: ", stdout);
/* Interpretation depends on stratum */
switch (bp->stratum) {
@@ -172,21 +151,29 @@ ntp_print(register const u_char *cp, u_int length)
break;
}
- TCHECK(bp->reftime);
- putchar('@');
- p_ntp_time(&(bp->reftime));
+ TCHECK(bp->ref_timestamp);
+ fputs("\n\t Reference Timestamp: ", stdout);
+ p_ntp_time(&(bp->ref_timestamp));
+
+ TCHECK(bp->org_timestamp);
+ fputs("\n\t Originator Timestamp: ", stdout);
+ p_ntp_time(&(bp->org_timestamp));
+
+ TCHECK(bp->rec_timestamp);
+ fputs("\n\t Receive Timestamp: ", stdout);
+ p_ntp_time(&(bp->rec_timestamp));
+
+ TCHECK(bp->xmt_timestamp);
+ fputs("\n\t Transmit Timestamp: ", stdout);
+ p_ntp_time(&(bp->xmt_timestamp));
- TCHECK(bp->org);
- fputs(" orig ", stdout);
- p_ntp_time(&(bp->org));
+ fputs("\n\t Originator - Receive Timestamp: ", stdout);
+ p_ntp_delta(&(bp->org_timestamp), &(bp->rec_timestamp));
- TCHECK(bp->rec);
- fputs(" rec ", stdout);
- p_ntp_delta(&(bp->org), &(bp->rec));
+ fputs("\n\t Originator - Transmit Timestamp: ", stdout);
+ p_ntp_delta(&(bp->org_timestamp), &(bp->xmt_timestamp));
- TCHECK(bp->xmt);
- fputs(" xmt ", stdout);
- p_ntp_delta(&(bp->org), &(bp->xmt));
+ /* FIXME key-id, authentication */
return;
@@ -229,9 +216,9 @@ p_ntp_time(register const struct l_fixedpt *lfp)
#ifdef HAVE_STRFTIME
/*
- * For extra verbosity, print the time in human-readable format.
+ * print the time in human-readable format.
*/
- if (vflag > 1 && i) {
+ if (i) {
time_t seconds = i - JAN_1970;
struct tm *tm;
char time_buf[128];
diff --git a/contrib/tcpdump/print-null.c b/contrib/tcpdump/print-null.c
index c34693103d59..7d24884ff3b4 100644
--- a/contrib/tcpdump/print-null.c
+++ b/contrib/tcpdump/print-null.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.49.2.2 2003/11/16 08:51:36 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53 2005/04/06 21:32:41 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -125,7 +125,7 @@ null_print(u_int family, u_int length)
/*
* This is the top level routine of the printer. 'p' points
* to the ether header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
@@ -163,7 +163,7 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p)
switch (family) {
case BSD_AF_INET:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
@@ -197,3 +197,9 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p)
return (NULL_HDRLEN);
}
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-ospf.c b/contrib/tcpdump/print-ospf.c
index d239cafd1ea8..5a217feb2055 100644
--- a/contrib/tcpdump/print-ospf.c
+++ b/contrib/tcpdump/print-ospf.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.45.2.4 2004/03/24 02:44:30 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.56 2004/09/29 16:49:31 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -51,6 +51,7 @@ static struct tok ospf_option_values[] = {
{ OSPF_OPTION_EA, "Advertise External" },
{ OSPF_OPTION_DC, "Demand Circuit" },
{ OSPF_OPTION_O, "Opaque" },
+ { OSPF_OPTION_DN, "Up/Down" },
{ 0, NULL }
};
@@ -103,6 +104,7 @@ static struct tok ospf_dd_flag_values[] = {
static struct tok lsa_opaque_values[] = {
{ LS_OPAQUE_TYPE_TE, "Traffic Engineering" },
{ LS_OPAQUE_TYPE_GRACE, "Graceful restart" },
+ { LS_OPAQUE_TYPE_RI, "Router Information" },
{ 0, NULL }
};
@@ -126,11 +128,24 @@ static struct tok lsa_opaque_te_link_tlv_subtlv_values[] = {
{ LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE, "Link Protection Type" },
{ LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR, "Interface Switching Capability" },
{ LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP, "Shared Risk Link Group" },
+ { LS_OPAQUE_TE_LINK_SUBTLV_DIFFSERV_TE, "Diffserv TE" },
{ 0, NULL }
};
-#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP 1 /* rfc3630 */
-#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */
+static struct tok lsa_opaque_grace_tlv_values[] = {
+ { LS_OPAQUE_GRACE_TLV_PERIOD, "Grace Period" },
+ { LS_OPAQUE_GRACE_TLV_REASON, "Graceful restart Reason" },
+ { LS_OPAQUE_GRACE_TLV_INT_ADDRESS, "IPv4 interface address" },
+ { 0, NULL }
+};
+
+static struct tok lsa_opaque_grace_tlv_reason_values[] = {
+ { LS_OPAQUE_GRACE_TLV_REASON_UNKNOWN, "Unknown" },
+ { LS_OPAQUE_GRACE_TLV_REASON_SW_RESTART, "Software Restart" },
+ { LS_OPAQUE_GRACE_TLV_REASON_SW_UPGRADE, "Software Reload/Upgrade" },
+ { LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH, "Control Processor Switch" },
+ { 0, NULL }
+};
static struct tok lsa_opaque_te_tlv_link_type_sub_tlv_values[] = {
{ LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP, "Point-to-point" },
@@ -138,6 +153,25 @@ static struct tok lsa_opaque_te_tlv_link_type_sub_tlv_values[] = {
{ 0, NULL }
};
+static struct tok lsa_opaque_ri_tlv_values[] = {
+ { LS_OPAQUE_RI_TLV_CAP, "Router Capabilities" },
+ { 0, NULL }
+};
+
+static struct tok lsa_opaque_ri_tlv_cap_values[] = {
+ { 1, "Reserved" },
+ { 2, "Reserved" },
+ { 4, "Reserved" },
+ { 8, "Reserved" },
+ { 16, "graceful restart capable" },
+ { 32, "graceful restart helper" },
+ { 64, "Stub router support" },
+ { 128, "Traffic engineering" },
+ { 256, "p2p over LAN" },
+ { 512, "path computation server" },
+ { 0, NULL }
+};
+
static char tstr[] = " [|ospf]";
#ifdef WIN32
@@ -219,7 +253,7 @@ ospf_print_lsa(register const struct lsa *lsap)
register const struct aslametric *almp;
register const struct mcla *mcp;
register const u_int32_t *lp;
- register int j, k, tlv_type, tlv_length, subtlv_type, subtlv_length, priority_level;
+ register int j, k, tlv_type, tlv_length, subtlv_type, subtlv_length, priority_level, bandwidth_constraint;
register int ls_length;
const u_int8_t *tptr;
int count_srlg;
@@ -348,6 +382,7 @@ ospf_print_lsa(register const struct lsa *lsap)
break;
case LS_TYPE_ASE:
+ case LS_TYPE_NSSA: /* fall through - those LSAs share the same format */
TCHECK(lsap->lsa_un.un_nla.nla_mask);
printf("\n\t Mask %s",
ipaddr_string(&lsap->lsa_un.un_asla.asla_mask));
@@ -412,6 +447,117 @@ ospf_print_lsa(register const struct lsa *lsap)
case LS_TYPE_OPAQUE_DW:
switch (*(&lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) {
+ case LS_OPAQUE_TYPE_RI:
+ tptr = (u_int8_t *)(&lsap->lsa_un.un_ri_tlv.type);
+
+ while (ls_length != 0) {
+ TCHECK2(*tptr, 4);
+ if (ls_length < 4) {
+ printf("\n\t Remaining LS length %u < 4", ls_length);
+ return(ls_end);
+ }
+ tlv_type = EXTRACT_16BITS(tptr);
+ tlv_length = EXTRACT_16BITS(tptr+2);
+ tptr+=4;
+ ls_length-=4;
+
+ printf("\n\t %s TLV (%u), length: %u, value: ",
+ tok2str(lsa_opaque_ri_tlv_values,"unknown",tlv_type),
+ tlv_type,
+ tlv_length);
+
+ if (tlv_length > ls_length) {
+ printf("\n\t Bogus length %u > %u", tlv_length,
+ ls_length);
+ return(ls_end);
+ }
+ ls_length-=tlv_length;
+ TCHECK2(*tptr, tlv_length);
+ switch(tlv_type) {
+
+ case LS_OPAQUE_RI_TLV_CAP:
+ if (tlv_length != 4) {
+ printf("\n\t Bogus length %u != 4", tlv_length);
+ return(ls_end);
+ }
+ printf("Capabilities: %s",
+ bittok2str(lsa_opaque_ri_tlv_cap_values, "Unknown", EXTRACT_32BITS(tptr)));
+ break;
+ default:
+ if (vflag <= 1) {
+ if(!print_unknown_data(tptr,"\n\t ",tlv_length))
+ return(ls_end);
+ }
+ break;
+
+ }
+ tptr+=tlv_length;
+ }
+
+ break;
+ case LS_OPAQUE_TYPE_GRACE:
+ tptr = (u_int8_t *)(&lsap->lsa_un.un_grace_tlv.type);
+
+ while (ls_length != 0) {
+ TCHECK2(*tptr, 4);
+ if (ls_length < 4) {
+ printf("\n\t Remaining LS length %u < 4", ls_length);
+ return(ls_end);
+ }
+ tlv_type = EXTRACT_16BITS(tptr);
+ tlv_length = EXTRACT_16BITS(tptr+2);
+ tptr+=4;
+ ls_length-=4;
+
+ printf("\n\t %s TLV (%u), length: %u, value: ",
+ tok2str(lsa_opaque_grace_tlv_values,"unknown",tlv_type),
+ tlv_type,
+ tlv_length);
+
+ if (tlv_length > ls_length) {
+ printf("\n\t Bogus length %u > %u", tlv_length,
+ ls_length);
+ return(ls_end);
+ }
+ ls_length-=tlv_length;
+ TCHECK2(*tptr, tlv_length);
+ switch(tlv_type) {
+
+ case LS_OPAQUE_GRACE_TLV_PERIOD:
+ if (tlv_length != 4) {
+ printf("\n\t Bogus length %u != 4", tlv_length);
+ return(ls_end);
+ }
+ printf("%us",EXTRACT_32BITS(tptr));
+ break;
+ case LS_OPAQUE_GRACE_TLV_REASON:
+ if (tlv_length != 1) {
+ printf("\n\t Bogus length %u != 1", tlv_length);
+ return(ls_end);
+ }
+ printf("%s (%u)",
+ tok2str(lsa_opaque_grace_tlv_reason_values, "Unknown", *tptr),
+ *tptr);
+ break;
+ case LS_OPAQUE_GRACE_TLV_INT_ADDRESS:
+ if (tlv_length != 4) {
+ printf("\n\t Bogus length %u != 4", tlv_length);
+ return(ls_end);
+ }
+ printf("%s", ipaddr_string(tptr));
+ break;
+ default:
+ if (vflag <= 1) {
+ if(!print_unknown_data(tptr,"\n\t ",tlv_length))
+ return(ls_end);
+ }
+ break;
+
+ }
+ tptr+=tlv_length;
+ }
+
+ break;
case LS_OPAQUE_TYPE_TE:
tptr = (u_int8_t *)(&lsap->lsa_un.un_te_lsa_tlv.type);
@@ -488,6 +634,18 @@ ospf_print_lsa(register const struct lsa *lsap)
bw.f*8/1000000 );
}
break;
+ case LS_OPAQUE_TE_LINK_SUBTLV_DIFFSERV_TE:
+ printf("\n\t\tBandwidth Constraints Model ID: %s (%u)",
+ tok2str(diffserv_te_bc_values, "unknown", *tptr),
+ *tptr);
+ /* decode BCs until the subTLV ends */
+ for (bandwidth_constraint = 0; bandwidth_constraint < (subtlv_length-4)/4; bandwidth_constraint++) {
+ bw.i = EXTRACT_32BITS(tptr+4+bandwidth_constraint*4);
+ printf("\n\t\t Bandwidth constraint %d: %.3f Mbps",
+ bandwidth_constraint,
+ bw.f*8/1000000 );
+ }
+ break;
case LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC:
printf(", Metric %u", EXTRACT_32BITS(tptr));
break;
@@ -736,10 +894,9 @@ ospf_print(register const u_char *bp, register u_int length,
/* value. If it's not valid, say so and return */
TCHECK(op->ospf_type);
cp = tok2str(type2str, "unknown LS-type", op->ospf_type);
- printf("OSPFv%u, %s (%u), length: %u",
+ printf("OSPFv%u, %s, length: %u",
op->ospf_version,
cp,
- op->ospf_type,
length);
if (*cp == 'u')
return;
diff --git a/contrib/tcpdump/print-ospf6.c b/contrib/tcpdump/print-ospf6.c
index 5e6e69a3a350..6325a2192025 100644
--- a/contrib/tcpdump/print-ospf6.c
+++ b/contrib/tcpdump/print-ospf6.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.11.2.2 2003/11/16 08:51:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.13 2003/11/16 09:36:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-pflog.c b/contrib/tcpdump/print-pflog.c
index 24634b2ff612..f8b18a9239b2 100644
--- a/contrib/tcpdump/print-pflog.c
+++ b/contrib/tcpdump/print-pflog.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.7.2.4 2004/03/29 21:56:26 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pflog.c,v 1.13 2005/04/06 21:32:41 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -75,11 +75,14 @@ static struct tok pf_directions[] = {
static void
pflog_print(const struct pfloghdr *hdr)
{
- if (ntohl(hdr->subrulenr) == (u_int32_t)-1)
- printf("rule %u/", ntohl(hdr->rulenr));
+ u_int32_t rulenr, subrulenr;
+
+ rulenr = ntohl(hdr->rulenr);
+ subrulenr = ntohl(hdr->subrulenr);
+ if (subrulenr == (u_int32_t)-1)
+ printf("rule %u/", rulenr);
else
- printf("rule %u.%s.%u/", ntohl(hdr->rulenr), hdr->ruleset,
- ntohl(hdr->subrulenr));
+ printf("rule %u.%s.%u/", rulenr, hdr->ruleset, subrulenr);
printf("%s: %s %s on %s: ",
tok2str(pf_reasons, "unkn(%u)", hdr->reason),
@@ -133,7 +136,7 @@ pflog_if_print(const struct pcap_pkthdr *h, register const u_char *p)
#if OPENBSD_AF_INET != AF_INET
case OPENBSD_AF_INET: /* XXX: read pcap files */
#endif
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
@@ -158,3 +161,10 @@ trunc:
printf("[|pflog]");
return (hdrlen);
}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-pim.c b/contrib/tcpdump/print-pim.c
index de3b4d518b4b..9bdbd6303491 100644
--- a/contrib/tcpdump/print-pim.c
+++ b/contrib/tcpdump/print-pim.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.37.2.4 2004/03/24 02:52:37 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45 2005/04/06 21:32:42 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -29,6 +29,56 @@ static const char rcsid[] _U_ =
#endif
#include <tcpdump-stdinc.h>
+#include "interface.h"
+
+#define PIMV2_TYPE_HELLO 0
+#define PIMV2_TYPE_REGISTER 1
+#define PIMV2_TYPE_REGISTER_STOP 2
+#define PIMV2_TYPE_JOIN_PRUNE 3
+#define PIMV2_TYPE_BOOTSTRAP 4
+#define PIMV2_TYPE_ASSERT 5
+#define PIMV2_TYPE_GRAFT 6
+#define PIMV2_TYPE_GRAFT_ACK 7
+#define PIMV2_TYPE_CANDIDATE_RP 8
+#define PIMV2_TYPE_PRUNE_REFRESH 9
+
+static struct tok pimv2_type_values[] = {
+ { PIMV2_TYPE_HELLO, "Hello" },
+ { PIMV2_TYPE_REGISTER, "Register" },
+ { PIMV2_TYPE_REGISTER_STOP, "Register Stop" },
+ { PIMV2_TYPE_JOIN_PRUNE, "Join / Prune" },
+ { PIMV2_TYPE_BOOTSTRAP, "Bootstrap" },
+ { PIMV2_TYPE_ASSERT, "Assert" },
+ { PIMV2_TYPE_GRAFT, "Graft" },
+ { PIMV2_TYPE_GRAFT_ACK, "Graft Acknowledgement" },
+ { PIMV2_TYPE_CANDIDATE_RP, "Candidate RP Advertisement" },
+ { PIMV2_TYPE_PRUNE_REFRESH, "Prune Refresh" },
+ { 0, NULL}
+};
+
+#define PIMV2_HELLO_OPTION_HOLDTIME 1
+#define PIMV2_HELLO_OPTION_LANPRUNEDELAY 2
+#define PIMV2_HELLO_OPTION_DR_PRIORITY_OLD 18
+#define PIMV2_HELLO_OPTION_DR_PRIORITY 19
+#define PIMV2_HELLO_OPTION_GENID 20
+#define PIMV2_HELLO_OPTION_REFRESH_CAP 21
+#define PIMV2_HELLO_OPTION_BIDIR_CAP 22
+#define PIMV2_HELLO_OPTION_ADDRESS_LIST 24
+#define PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD 65001
+
+static struct tok pimv2_hello_option_values[] = {
+ { PIMV2_HELLO_OPTION_HOLDTIME, "Hold Time" },
+ { PIMV2_HELLO_OPTION_LANPRUNEDELAY, "LAN Prune Delay" },
+ { PIMV2_HELLO_OPTION_DR_PRIORITY_OLD, "DR Priority (Old)" },
+ { PIMV2_HELLO_OPTION_DR_PRIORITY, "DR Priority" },
+ { PIMV2_HELLO_OPTION_GENID, "Generation ID" },
+ { PIMV2_HELLO_OPTION_REFRESH_CAP, "State Refresh Capability" },
+ { PIMV2_HELLO_OPTION_BIDIR_CAP, "Bi-Directional Capability" },
+ { PIMV2_HELLO_OPTION_ADDRESS_LIST, "Address List" },
+ { PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD, "Address List (Old)" },
+ { 0, NULL}
+};
+
/*
* XXX: We consider a case where IPv6 is not ready yet for portability,
@@ -363,12 +413,25 @@ pim_print(register const u_char *bp, register u_int len)
#endif
switch (PIM_VER(pim->pim_typever)) {
- case 2: /* avoid hardcoding? */
- (void)printf("pim v2");
- pimv2_print(bp, len);
- break;
+ case 2:
+ if (!vflag) {
+ printf("PIMv%u, %s, length: %u",
+ PIM_VER(pim->pim_typever),
+ tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
+ len);
+ return;
+ } else {
+ printf("PIMv%u, length: %u\n\t%s",
+ PIM_VER(pim->pim_typever),
+ len,
+ tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)));
+ pimv2_print(bp, len);
+ }
+ break;
default:
- (void)printf("pim v%d", PIM_VER(pim->pim_typever));
+ printf("PIMv%u, length: %u",
+ PIM_VER(pim->pim_typever),
+ len);
break;
}
return;
@@ -561,94 +624,86 @@ pimv2_print(register const u_char *bp, register u_int len)
TCHECK(pim->pim_rsv);
pimv2_addr_len = pim->pim_rsv;
if (pimv2_addr_len != 0)
- (void)printf("[RFC2117-encoding] ");
+ (void)printf(", RFC2117-encoding");
switch (PIM_TYPE(pim->pim_typever)) {
- case 0:
+ case PIMV2_TYPE_HELLO:
{
u_int16_t otype, olen;
- (void)printf(" Hello");
bp += 4;
while (bp < ep) {
TCHECK2(bp[0], 4);
otype = EXTRACT_16BITS(&bp[0]);
olen = EXTRACT_16BITS(&bp[2]);
TCHECK2(bp[0], 4 + olen);
+
+ printf("\n\t %s Option (%u), length: %u, Value: ",
+ tok2str( pimv2_hello_option_values,"Unknown",otype),
+ otype,
+ olen);
+ bp += 4;
+
switch (otype) {
- case 1: /* Hold time */
- (void)printf(" (Hold-time ");
- relts_print(EXTRACT_16BITS(&bp[4]));
- (void)printf(")");
- break;
+ case PIMV2_HELLO_OPTION_HOLDTIME:
+ relts_print(EXTRACT_16BITS(bp));
+ break;
- case 2: /* LAN Prune Delay */
- (void)printf(" (LAN-Prune-Delay: ");
+ case PIMV2_HELLO_OPTION_LANPRUNEDELAY:
if (olen != 4) {
- (void)printf("!olen=%d!)", olen);
+ (void)printf("ERROR: Option Lenght != 4 Bytes (%u)", olen);
} else {
char t_bit;
u_int16_t lan_delay, override_interval;
- lan_delay = EXTRACT_16BITS(&bp[4]);
- override_interval = EXTRACT_16BITS(&bp[6]);
+ lan_delay = EXTRACT_16BITS(bp);
+ override_interval = EXTRACT_16BITS(bp+2);
t_bit = (lan_delay & 0x8000)? 1 : 0;
lan_delay &= ~0x8000;
- (void)printf("T-bit=%d lan-delay=%dms override-interval=%dms)",
+ (void)printf("\n\t T-bit=%d, LAN delay %dms, Override interval %dms",
t_bit, lan_delay, override_interval);
}
break;
- case 18: /* Old DR-Priority */
- if (olen == 4)
- (void)printf(" (OLD-DR-Priority: %d)",
- EXTRACT_32BITS(&bp[4]));
- else
- goto unknown;
- break;
-
-
- case 19: /* DR-Priority */
- if (olen == 0) {
- (void)printf(" (OLD-bidir-capable)");
- break;
- }
- (void)printf(" (DR-Priority: ");
- if (olen != 4) {
- (void)printf("!olen=%d!)", olen);
- } else {
- (void)printf("%d)", EXTRACT_32BITS(&bp[4]));
- }
- break;
-
- case 20:
- (void)printf(" (Genid: 0x%08x)", EXTRACT_32BITS(&bp[4]));
+ case PIMV2_HELLO_OPTION_DR_PRIORITY_OLD:
+ case PIMV2_HELLO_OPTION_DR_PRIORITY:
+ switch (olen) {
+ case 0:
+ printf("Bi-Directional Capability (Old)");
+ break;
+ case 4:
+ printf("%u", EXTRACT_32BITS(bp));
+ break;
+ default:
+ printf("ERROR: Option Lenght != 4 Bytes (%u)", olen);
+ break;
+ }
+ break;
+
+ case PIMV2_HELLO_OPTION_GENID:
+ (void)printf("0x%08x", EXTRACT_32BITS(bp));
break;
- case 21:
- (void)printf(" (State Refresh Capable; v%d", bp[4]);
- if (bp[5] != 0) {
- (void)printf(" interval ");
- relts_print(bp[5]);
+ case PIMV2_HELLO_OPTION_REFRESH_CAP:
+ (void)printf("v%d", *bp);
+ if (*(bp+1) != 0) {
+ (void)printf(", interval ");
+ relts_print(*(bp+1));
}
- if (EXTRACT_16BITS(&bp[6]) != 0) {
- (void)printf(" ?0x%04x?", EXTRACT_16BITS(&bp[6]));
+ if (EXTRACT_16BITS(bp+2) != 0) {
+ (void)printf(" ?0x%04x?", EXTRACT_16BITS(bp+2));
}
- (void)printf(")");
break;
- case 22: /* Bidir-Capable */
- (void)printf(" (bidir-capable)");
+ case PIMV2_HELLO_OPTION_BIDIR_CAP:
break;
- case 24: /* Address List */
- case 65001: /* Address List (old implementations) */
- (void)printf(" (%saddr-list",
- otype == 65001 ? "old" : "");
+ case PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD:
+ case PIMV2_HELLO_OPTION_ADDRESS_LIST:
if (vflag > 1) {
- const u_char *ptr = &bp[4];
- while (ptr < &bp[4 + olen]) {
+ const u_char *ptr = bp;
+ while (ptr < (bp+olen)) {
int advance;
- printf(" ");
+ printf("\n\t ");
advance = pimv2_addr_print(ptr, pimv2_unicast, 0);
if (advance < 0) {
printf("...");
@@ -657,23 +712,24 @@ pimv2_print(register const u_char *bp, register u_int len)
ptr += advance;
}
}
- (void)printf(")");
break;
default:
- unknown:
- if (vflag)
- (void)printf(" [Hello option %d]", otype);
+ if (vflag <= 1)
+ print_unknown_data(bp,"\n\t ",olen);
+ break;
}
- bp += 4 + olen;
+ /* do we want to see an additionally hexdump ? */
+ if (vflag> 1)
+ print_unknown_data(bp,"\n\t ",olen);
+ bp += olen;
}
break;
}
- case 1:
+ case PIMV2_TYPE_REGISTER:
{
struct ip *ip;
- (void)printf(" Register");
if (vflag && bp + 8 <= ep) {
(void)printf(" %s%s", bp[4] & 0x80 ? "B" : "",
bp[4] & 0x40 ? "N" : "");
@@ -687,7 +743,7 @@ pimv2_print(register const u_char *bp, register u_int len)
switch (IP_V(ip)) {
case 4: /* IPv4 */
printf(" ");
- ip_print(bp, len);
+ ip_print(gndo, bp, len);
break;
#ifdef INET6
case 6: /* IPv6 */
@@ -702,8 +758,7 @@ pimv2_print(register const u_char *bp, register u_int len)
break;
}
- case 2:
- (void)printf(" Register-Stop");
+ case PIMV2_TYPE_REGISTER_STOP:
bp += 4; len -= 4;
if (bp >= ep)
break;
@@ -723,9 +778,46 @@ pimv2_print(register const u_char *bp, register u_int len)
bp += advance; len -= advance;
break;
- case 3:
- case 6:
- case 7:
+ case PIMV2_TYPE_JOIN_PRUNE:
+ case PIMV2_TYPE_GRAFT:
+ case PIMV2_TYPE_GRAFT_ACK:
+
+
+ /*
+ * 0 1 2 3
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |PIM Ver| Type | Addr length | Checksum |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Unicast-Upstream Neighbor Address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Reserved | Num groups | Holdtime |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Multicast Group Address-1 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Number of Joined Sources | Number of Pruned Sources |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Joined Source Address-1 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Joined Source Address-n |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Pruned Source Address-1 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Pruned Source Address-n |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Multicast Group Address-n |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
{
u_int8_t ngroup;
u_int16_t holdtime;
@@ -733,22 +825,11 @@ pimv2_print(register const u_char *bp, register u_int len)
u_int16_t nprune;
int i, j;
- switch (PIM_TYPE(pim->pim_typever)) {
- case 3:
- (void)printf(" Join/Prune");
- break;
- case 6:
- (void)printf(" Graft");
- break;
- case 7:
- (void)printf(" Graft-ACK");
- break;
- }
bp += 4; len -= 4;
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
if (bp >= ep)
break;
- (void)printf(" upstream-neighbor=");
+ (void)printf(", upstream-neighbor: ");
if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
(void)printf("...");
break;
@@ -759,11 +840,11 @@ pimv2_print(register const u_char *bp, register u_int len)
break;
ngroup = bp[1];
holdtime = EXTRACT_16BITS(&bp[2]);
- (void)printf(" groups=%u", ngroup);
+ (void)printf("\n\t %u group(s)", ngroup);
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
- (void)printf(" holdtime=");
+ (void)printf(", holdtime: ");
if (holdtime == 0xffff)
- (void)printf("infty");
+ (void)printf("infinite");
else
relts_print(holdtime);
}
@@ -771,7 +852,7 @@ pimv2_print(register const u_char *bp, register u_int len)
for (i = 0; i < ngroup; i++) {
if (bp >= ep)
goto jp_done;
- (void)printf(" (group%d: ", i);
+ (void)printf("\n\t group #%u: ", i+1);
if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) {
(void)printf("...)");
goto jp_done;
@@ -783,36 +864,32 @@ pimv2_print(register const u_char *bp, register u_int len)
}
njoin = EXTRACT_16BITS(&bp[0]);
nprune = EXTRACT_16BITS(&bp[2]);
- (void)printf(" join=%u", njoin);
+ (void)printf(", joined sources: %u, pruned sources: %u", njoin,nprune);
bp += 4; len -= 4;
for (j = 0; j < njoin; j++) {
- (void)printf(" ");
+ (void)printf("\n\t joined source #%u: ",j+1);
if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) {
(void)printf("...)");
goto jp_done;
}
bp += advance; len -= advance;
}
- (void)printf(" prune=%u", nprune);
for (j = 0; j < nprune; j++) {
- (void)printf(" ");
+ (void)printf("\n\t pruned source #%u: ",j+1);
if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) {
(void)printf("...)");
goto jp_done;
}
bp += advance; len -= advance;
}
- (void)printf(")");
}
jp_done:
break;
}
- case 4:
+ case PIMV2_TYPE_BOOTSTRAP:
{
int i, j, frpcnt;
-
- (void)printf(" Bootstrap");
bp += 4;
/* Fragment Tag, Hash Mask len, and BSR-priority */
@@ -886,8 +963,7 @@ pimv2_print(register const u_char *bp, register u_int len)
bs_done:
break;
}
- case 5:
- (void)printf(" Assert");
+ case PIMV2_TYPE_ASSERT:
bp += 4; len -= 4;
if (bp >= ep)
break;
@@ -913,11 +989,9 @@ pimv2_print(register const u_char *bp, register u_int len)
(void)printf(" metric=%u", EXTRACT_32BITS(&bp[4]));
break;
- case 8:
+ case PIMV2_TYPE_CANDIDATE_RP:
{
int i, pfxcnt;
-
- (void)printf(" Candidate-RP-Advertisement");
bp += 4;
/* Prefix-Cnt, Priority, and Holdtime */
@@ -953,8 +1027,7 @@ pimv2_print(register const u_char *bp, register u_int len)
break;
}
- case 9:
- (void)printf(" Prune-Refresh");
+ case PIMV2_TYPE_PRUNE_REFRESH:
(void)printf(" src=");
if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
(void)printf("...");
@@ -989,3 +1062,10 @@ pimv2_print(register const u_char *bp, register u_int len)
trunc:
(void)printf("[|pim]");
}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c
index f4e5bd0b1704..a685322ce51b 100644
--- a/contrib/tcpdump/print-ppp.c
+++ b/contrib/tcpdump/print-ppp.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.89.2.3 2004/03/24 03:32:43 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108 2005/04/06 21:32:42 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -47,6 +47,7 @@ static const char rcsid[] _U_ =
#include <pcap.h>
#include <stdio.h>
+#include <stdlib.h>
#include "interface.h"
#include "extract.h"
@@ -54,6 +55,7 @@ static const char rcsid[] _U_ =
#include "ppp.h"
#include "chdlc.h"
#include "ethertype.h"
+#include "oui.h"
/*
* The following constatns are defined by IANA. Please refer to
@@ -70,13 +72,16 @@ struct tok ppptype2str[] = {
{ PPP_DECNET, "DECNET" },
{ PPP_APPLE, "APPLE" },
{ PPP_IPX, "IPX" },
- { PPP_VJC, "VJC" },
- { PPP_VJNC, "VJNC" },
+ { PPP_VJC, "VJC IP" },
+ { PPP_VJNC, "VJNC IP" },
{ PPP_BRPDU, "BRPDU" },
{ PPP_STII, "STII" },
{ PPP_VINES, "VINES" },
{ PPP_MPLS_UCAST, "MPLS" },
{ PPP_MPLS_MCAST, "MPLS" },
+ { PPP_COMP, "Compressed"},
+ { PPP_ML, "MLPPP"},
+ { PPP_IPV6, "IP6"},
{ PPP_HELLO, "HELLO" },
{ PPP_LUXCOM, "LUXCOM" },
@@ -89,15 +94,19 @@ struct tok ppptype2str[] = {
{ PPP_IPXCP, "IPXCP" },
{ PPP_STIICP, "STIICP" },
{ PPP_VINESCP, "VINESCP" },
+ { PPP_IPV6CP, "IP6CP" },
{ PPP_MPLSCP, "MPLSCP" },
{ PPP_LCP, "LCP" },
{ PPP_PAP, "PAP" },
{ PPP_LQM, "LQM" },
{ PPP_CHAP, "CHAP" },
+ { PPP_EAP, "EAP" },
+ { PPP_SPAP, "SPAP" },
+ { PPP_SPAP_OLD, "Old-SPAP" },
{ PPP_BACP, "BACP" },
{ PPP_BAP, "BAP" },
- { PPP_MP, "ML" },
+ { PPP_MPCP, "MLPPP-CP" },
{ 0, NULL }
};
@@ -196,7 +205,7 @@ static const char *lcpconfopts[] = {
"deprecated(15)", /* used to be a Compund-Frames */
"deprecated(16)", /* used to be a Nominal-Data-Encap */
"MRRU", /* (17) */
- "SSNHF", /* (18) */
+ "12-Bit seq #", /* (18) */
"End-Disc", /* (19) */
"Proprietary", /* (20) */
"DCE-Id", /* (21) */
@@ -211,7 +220,6 @@ static const char *lcpconfopts[] = {
"PPP-Muxing", /* (30) */
};
-/* IPV6CP - to be supported */
/* ECP - to be supported */
/* CCP Config Options */
@@ -275,17 +283,36 @@ static const char *ccpconfopts[] = {
/* SDCP - to be supported */
/* IPCP Config Options */
-
#define IPCPOPT_2ADDR 1 /* RFC1172, RFC1332 (deprecated) */
#define IPCPOPT_IPCOMP 2 /* RFC1332 */
#define IPCPOPT_ADDR 3 /* RFC1332 */
#define IPCPOPT_MOBILE4 4 /* RFC2290 */
-
#define IPCPOPT_PRIDNS 129 /* RFC1877 */
#define IPCPOPT_PRINBNS 130 /* RFC1877 */
#define IPCPOPT_SECDNS 131 /* RFC1877 */
#define IPCPOPT_SECNBNS 132 /* RFC1877 */
+struct tok ipcpopt_values[] = {
+ { IPCPOPT_2ADDR, "IP-Addrs" },
+ { IPCPOPT_IPCOMP, "IP-Comp" },
+ { IPCPOPT_ADDR, "IP-Addr" },
+ { IPCPOPT_MOBILE4, "Home-Addr" },
+ { IPCPOPT_PRIDNS, "Pri-DNS" },
+ { IPCPOPT_PRINBNS, "Pri-NBNS" },
+ { IPCPOPT_SECDNS, "Sec-DNS" },
+ { IPCPOPT_SECNBNS, "Sec-NBNS" },
+ { 0, NULL }
+};
+
+
+/* IP6CP Config Options */
+#define IP6CP_IFID 1
+
+struct tok ip6cpopt_values[] = {
+ { IP6CP_IFID, "Interface-ID" },
+ { 0, NULL }
+};
+
/* ATCP - to be supported */
/* OSINLCP - to be supported */
/* BVCP - to be supported */
@@ -300,6 +327,13 @@ static const char *ccpconfopts[] = {
#define AUTHALG_MSCHAP1 128 /* RFC2433 */
#define AUTHALG_MSCHAP2 129 /* RFC2795 */
+struct tok authalg_values[] = {
+ { AUTHALG_CHAPMD5, "MD5" },
+ { AUTHALG_MSCHAP1, "MS-CHAPv1" },
+ { AUTHALG_MSCHAP2, "MS-CHAPv2" },
+ { 0, NULL }
+};
+
/* FCS Alternatives - to be supported */
/* Multilink Endpoint Discriminator (RFC1717) */
@@ -325,14 +359,12 @@ static const char *ccpconfopts[] = {
#define CHAP_SUCC 3
#define CHAP_FAIL 4
-#define CHAP_CODEMIN CHAP_CHAL
-#define CHAP_CODEMAX CHAP_FAIL
-
-static const char *chapcode[] = {
- "Chal", /* (1) */
- "Resp", /* (2) */
- "Succ", /* (3) */
- "Fail", /* (4) */
+struct tok chapcode_values[] = {
+ { CHAP_CHAL, "Challenge" },
+ { CHAP_RESP, "Response" },
+ { CHAP_SUCC, "Success" },
+ { CHAP_FAIL, "Fail" },
+ { 0, NULL}
};
/* PAP */
@@ -341,13 +373,11 @@ static const char *chapcode[] = {
#define PAP_AACK 2
#define PAP_ANAK 3
-#define PAP_CODEMIN PAP_AREQ
-#define PAP_CODEMAX PAP_ANAK
-
-static const char *papcode[] = {
- "Auth-Req", /* (1) */
- "Auth-Ack", /* (2) */
- "Auth-Nak", /* (3) */
+struct tok papcode_values[] = {
+ { PAP_AREQ, "Auth-Req" },
+ { PAP_AACK, "Auth-ACK" },
+ { PAP_ANAK, "Auth-NACK" },
+ { 0, NULL }
};
/* BAP */
@@ -364,11 +394,14 @@ static void handle_ctrl_proto (u_int proto,const u_char *p, int length);
static void handle_chap (const u_char *p, int length);
static void handle_pap (const u_char *p, int length);
static void handle_bap (const u_char *p, int length);
+static void handle_mlppp(const u_char *p, int length);
static int print_lcp_config_options (const u_char *p, int);
static int print_ipcp_config_options (const u_char *p, int);
+static int print_ip6cp_config_options (const u_char *p, int);
static int print_ccp_config_options (const u_char *p, int);
static int print_bacp_config_options (const u_char *p, int);
static void handle_ppp (u_int proto, const u_char *p, int length);
+static void ppp_hdlc(const u_char *p, int length);
/* generic Control Protocol (e.g. LCP, IPCP, CCP, etc.) handler */
static void
@@ -382,7 +415,7 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
tptr=pptr;
- typestr = tok2str(ppptype2str, "unknown", proto);
+ typestr = tok2str(ppptype2str, "unknown ctrl-proto (0x%04x)", proto);
printf("%s, ",typestr);
if (length < 4) /* FIXME weak boundary checking */
@@ -401,7 +434,7 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
tptr += 2;
if (length <= 4)
- return; /* there may be a NULL confreq etc. */
+ goto print_len_and_return; /* there may be a NULL confreq etc. */
switch (code) {
case CPCODES_VEXT:
@@ -411,7 +444,9 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
printf(", Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
tptr += 4;
TCHECK2(*tptr, 3);
- printf(" OUI 0x%06x", EXTRACT_24BITS(tptr));
+ printf(" Vendor: %s (%u)",
+ tok2str(oui_values,"Unknown",EXTRACT_24BITS(tptr)),
+ EXTRACT_24BITS(tptr));
/* XXX: need to decode Kind and Value(s)? */
break;
case CPCODES_CONF_REQ:
@@ -427,6 +462,9 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
case PPP_IPCP:
pfunc = print_ipcp_config_options;
break;
+ case PPP_IPV6CP:
+ pfunc = print_ip6cp_config_options;
+ break;
case PPP_CCP:
pfunc = print_ccp_config_options;
break;
@@ -435,13 +473,16 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
break;
default:
/*
- * This should never happen, but we set
- * "pfunc" to squelch uninitialized
- * variable warnings from compilers.
+ * No print routine for the options for
+ * this protocol.
*/
pfunc = NULL;
break;
}
+
+ if (pfunc == NULL) /* catch the above null pointer if unknown CP */
+ break;
+
if ((j = (*pfunc)(tptr, len)) == 0)
break;
x -= j;
@@ -492,6 +533,8 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
print_unknown_data(pptr-2,"\n\t",length+2);
break;
}
+
+ print_len_and_return:
printf(", length %u", length);
if (vflag >1)
@@ -516,7 +559,7 @@ print_lcp_config_options(const u_char *p, int length)
if (length < len)
return 0;
if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX))
- printf(", %s ", lcpconfopts[opt]);
+ printf(", %s (%u)", lcpconfopts[opt],opt);
else {
printf(", unknown LCP option 0x%02x", opt);
return len;
@@ -526,11 +569,13 @@ print_lcp_config_options(const u_char *p, int length)
case LCPOPT_VEXT:
if (len >= 6) {
TCHECK2(*(p + 2), 3);
- printf(" OUI 0x%06x", EXTRACT_24BITS(p+2));
+ printf(" Vendor: %s (%u)",
+ tok2str(oui_values,"Unknown",EXTRACT_24BITS(p+2)),
+ EXTRACT_24BITS(p+2));
#if 0
TCHECK(p[5]);
- printf(" kind 0x%02x", p[5]);
- printf(" val 0x")
+ printf(", kind: 0x%02x", p[5]);
+ printf(", Value: 0x")
for (i = 0; i < len - 6; i++) {
TCHECK(p[6 + i]);
printf("%02x", p[6 + i]);
@@ -547,45 +592,26 @@ print_lcp_config_options(const u_char *p, int length)
case LCPOPT_ACCM:
if (len == 6) {
TCHECK2(*(p + 2), 4);
- printf(" %08x", EXTRACT_32BITS(p + 2));
+ printf(" 0x%08x", EXTRACT_32BITS(p + 2));
}
break;
case LCPOPT_AP:
if (len >= 4) {
TCHECK2(*(p + 2), 2);
+ printf(" %s", tok2str(ppptype2str,"Unknown Auth Proto (0x04x)",EXTRACT_16BITS(p+2)));
+
switch (EXTRACT_16BITS(p+2)) {
- case PPP_PAP:
- printf(" PAP");
- break;
case PPP_CHAP:
- printf(" CHAP");
TCHECK(p[4]);
- switch (p[4]) {
- default:
- printf(", unknown-algorithm-%u", p[4]);
- break;
- case AUTHALG_CHAPMD5:
- printf(", MD5");
- break;
- case AUTHALG_MSCHAP1:
- printf(", MSCHAPv1");
- break;
- case AUTHALG_MSCHAP2:
- printf(", MSCHAPv2");
- break;
- }
+ printf(", %s",tok2str(authalg_values,"Unknown Auth Alg %u",p[4]));
break;
+ case PPP_PAP: /* fall through */
case PPP_EAP:
- printf(" EAP");
- break;
case PPP_SPAP:
- printf(" SPAP");
- break;
case PPP_SPAP_OLD:
- printf(" Old-SPAP");
- break;
+ break;
default:
- printf("unknown");
+ print_unknown_data(p,"\n\t",len);
}
}
break;
@@ -691,7 +717,7 @@ print_lcp_config_options(const u_char *p, int length)
case LCPOPT_DEP14:
case LCPOPT_DEP15:
case LCPOPT_DEP16:
- case LCPOPT_MLSSNHF:
+ case LCPOPT_MLSSNHF:
case LCPOPT_PROP:
case LCPOPT_DCEID:
case LCPOPT_MPP:
@@ -712,6 +738,27 @@ trunc:
return 0;
}
+/* ML-PPP*/
+struct tok ppp_ml_flag_values[] = {
+ { 0x80, "begin" },
+ { 0x40, "end" },
+ { 0, NULL }
+};
+
+static void
+handle_mlppp(const u_char *p, int length) {
+
+ if (!eflag)
+ printf("MLPPP, ");
+
+ printf("seq 0x%03x, Flags [%s], length %u",
+ (EXTRACT_16BITS(p))&0x0fff, /* only support 12-Bit sequence space for now */
+ bittok2str(ppp_ml_flag_values, "none", *p & 0xc0),
+ length);
+
+ return;
+}
+
/* CHAP */
static void
handle_chap(const u_char *p, int length)
@@ -733,16 +780,13 @@ handle_chap(const u_char *p, int length)
TCHECK(*p);
code = *p;
- if ((code >= CHAP_CODEMIN) && (code <= CHAP_CODEMAX))
- printf("%s", chapcode[code - 1]);
- else {
- printf("0x%02x", code);
- return;
- }
+ printf("CHAP, %s (0x%02x)",
+ tok2str(chapcode_values,"unknown",code),
+ code);
p++;
TCHECK(*p);
- printf("(%u)", *p); /* ID */
+ printf(", id %u", *p); /* ID */
p++;
TCHECK2(*p, 2);
@@ -815,16 +859,13 @@ handle_pap(const u_char *p, int length)
TCHECK(*p);
code = *p;
- if ((code >= PAP_CODEMIN) && (code <= PAP_CODEMAX))
- printf("%s", papcode[code - 1]);
- else {
- printf("0x%02x", code);
- return;
- }
+ printf("PAP, %s (0x%02x)",
+ tok2str(papcode_values,"unknown",code),
+ code);
p++;
TCHECK(*p);
- printf("(%u)", *p); /* ID */
+ printf(", id %u", *p); /* ID */
p++;
TCHECK2(*p, 2);
@@ -902,61 +943,41 @@ print_ipcp_config_options(const u_char *p, int length)
opt = p[0];
if (length < len)
return 0;
+
+ printf(", %s (0x%02x) ",
+ tok2str(ipcpopt_values,"unknown",opt),
+ opt);
+
switch (opt) {
case IPCPOPT_2ADDR: /* deprecated */
if (len != 10)
goto invlen;
TCHECK2(*(p + 6), 4);
- printf(", IP-Addrs src %s, dst %s",
+ printf("src %s, dst %s",
ipaddr_string(p + 2),
ipaddr_string(p + 6));
break;
case IPCPOPT_IPCOMP:
if (len < 4)
goto invlen;
- printf(", IP-Comp");
TCHECK2(*(p + 2), 2);
if (EXTRACT_16BITS(p + 2) == PPP_VJC) {
- printf(" VJ-Comp");
+ printf("VJ-Comp");
/* XXX: VJ-Comp parameters should be decoded */
} else
- printf(" unknown-comp-proto=%04x", EXTRACT_16BITS(p + 2));
- break;
- case IPCPOPT_ADDR:
- if (len != 6)
- goto invlen;
- TCHECK2(*(p + 2), 4);
- printf(", IP-Addr %s", ipaddr_string(p + 2));
+ printf("unknown-comp-proto %04x", EXTRACT_16BITS(p + 2));
break;
+
+ case IPCPOPT_ADDR: /* those options share the same format - fall through */
case IPCPOPT_MOBILE4:
- if (len != 6)
- goto invlen;
- TCHECK2(*(p + 2), 4);
- printf(", Home-Addr %s", ipaddr_string(p + 2));
- break;
case IPCPOPT_PRIDNS:
- if (len != 6)
- goto invlen;
- TCHECK2(*(p + 2), 4);
- printf(", Pri-DNS %s", ipaddr_string(p + 2));
- break;
case IPCPOPT_PRINBNS:
- if (len != 6)
- goto invlen;
- TCHECK2(*(p + 2), 4);
- printf(", Pri-NBNS %s", ipaddr_string(p + 2));
- break;
case IPCPOPT_SECDNS:
- if (len != 6)
- goto invlen;
- TCHECK2(*(p + 2), 4);
- printf(", Sec-DNS %s", ipaddr_string(p + 2));
- break;
case IPCPOPT_SECNBNS:
if (len != 6)
goto invlen;
TCHECK2(*(p + 2), 4);
- printf(", Sec-NBNS %s", ipaddr_string(p + 2));
+ printf("%s", ipaddr_string(p + 2));
break;
default:
printf(", unknown-%d", opt);
@@ -973,6 +994,51 @@ trunc:
return 0;
}
+/* IP6CP config options */
+static int
+print_ip6cp_config_options(const u_char *p, int length)
+{
+ int len, opt;
+
+ if (length < 2)
+ return 0;
+ TCHECK2(*p, 2);
+ len = p[1];
+ opt = p[0];
+ if (length < len)
+ return 0;
+
+ printf(", %s (0x%02x) ",
+ tok2str(ip6cpopt_values,"unknown",opt),
+ opt);
+
+ switch (opt) {
+ case IP6CP_IFID:
+ if (len != 10)
+ goto invlen;
+ TCHECK2(*(p + 2), 8);
+ printf("%04x:%04x:%04x:%04x",
+ EXTRACT_16BITS(p + 2),
+ EXTRACT_16BITS(p + 4),
+ EXTRACT_16BITS(p + 6),
+ EXTRACT_16BITS(p + 8));
+ break;
+ default:
+ printf(", unknown-%d", opt);
+ break;
+ }
+ return len;
+
+invlen:
+ printf(", invalid-length-%d", opt);
+ return 0;
+
+trunc:
+ printf("[|ip6cp]");
+ return 0;
+}
+
+
/* CCP config options */
static int
print_ccp_config_options(const u_char *p, int length)
@@ -1047,12 +1113,83 @@ trunc:
}
+static void
+ppp_hdlc(const u_char *p, int length)
+{
+ u_char *b, *s, *t, c;
+ int i, proto;
+ const void *se;
+
+ b = (u_int8_t *)malloc(length);
+ if (b == NULL)
+ return;
+
+ /*
+ * Unescape all the data into a temporary, private, buffer.
+ * Do this so that we dont overwrite the original packet
+ * contents.
+ */
+ for (s = (u_char *)p, t = b, i = length; i > 0; i--) {
+ c = *s++;
+ if (c == 0x7d) {
+ if (i > 1) {
+ i--;
+ c = *s++ ^ 0x20;
+ } else
+ continue;
+ }
+ *t++ = c;
+ }
+
+ se = snapend;
+ snapend = t;
+
+ /* now lets guess about the payload codepoint format */
+ proto = *b; /* start with a one-octet codepoint guess */
+
+ switch (proto) {
+ case PPP_IP:
+ ip_print(gndo, b+1, t - b - 1);
+ goto cleanup;
+#ifdef INET6
+ case PPP_IPV6:
+ ip6_print(b+1, t - b - 1);
+ goto cleanup;
+#endif
+ default: /* no luck - try next guess */
+ break;
+ }
+
+ proto = EXTRACT_16BITS(b); /* next guess - load two octets */
+
+ switch (proto) {
+ case (PPP_ADDRESS << 8 | PPP_CONTROL): /* looks like a PPP frame */
+ proto = EXTRACT_16BITS(b+2); /* load the PPP proto-id */
+ handle_ppp(proto, b+4, t - b - 4);
+ break;
+ default: /* last guess - proto must be a PPP proto-id */
+ handle_ppp(proto, b+2, t - b - 2);
+ break;
+ }
+
+cleanup:
+ snapend = se;
+ free(b);
+ return;
+}
+
+
/* PPP */
static void
handle_ppp(u_int proto, const u_char *p, int length)
{
+ if ((proto & 0xff00) == 0x7e00) {/* is this an escape code ? */
+ ppp_hdlc(p-1, length);
+ return;
+ }
+
switch (proto) {
- case PPP_LCP:
+ case PPP_LCP: /* fall through */
case PPP_IPCP:
case PPP_OSICP:
case PPP_MPLSCP:
@@ -1061,6 +1198,9 @@ handle_ppp(u_int proto, const u_char *p, int length)
case PPP_BACP:
handle_ctrl_proto(proto, p, length);
break;
+ case PPP_ML:
+ handle_mlppp(p, length);
+ break;
case PPP_CHAP:
handle_chap(p, length);
break;
@@ -1071,8 +1211,9 @@ handle_ppp(u_int proto, const u_char *p, int length)
handle_bap(p, length);
break;
case ETHERTYPE_IP: /*XXX*/
+ case PPP_VJNC:
case PPP_IP:
- ip_print(p, length);
+ ip_print(gndo, p, length);
break;
#ifdef INET6
case ETHERTYPE_IPV6: /*XXX*/
@@ -1091,10 +1232,13 @@ handle_ppp(u_int proto, const u_char *p, int length)
case PPP_MPLS_MCAST:
mpls_print(p, length);
break;
+ case PPP_COMP:
+ printf("compressed PPP data");
+ break;
default:
- printf("unknown PPP protocol (0x%04x)", proto);
- print_unknown_data(p,"\n\t",length);
- break;
+ printf("%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", proto));
+ print_unknown_data(p,"\n\t",length);
+ break;
}
}
@@ -1102,7 +1246,7 @@ handle_ppp(u_int proto, const u_char *p, int length)
u_int
ppp_print(register const u_char *p, u_int length)
{
- u_int proto;
+ u_int proto,ppp_header;
u_int olen = length; /* _o_riginal length */
u_int hdr_len = 0;
@@ -1113,11 +1257,30 @@ ppp_print(register const u_char *p, u_int length)
if (length < 2)
goto trunc;
TCHECK2(*p, 2);
- if (*p == PPP_ADDRESS && *(p + 1) == PPP_CONTROL) {
- p += 2; /* ACFC not used */
- length -= 2;
- hdr_len += 2;
- }
+ ppp_header = EXTRACT_16BITS(p);
+
+ switch(ppp_header) {
+ case (PPP_WITHDIRECTION_IN << 8 | PPP_CONTROL):
+ if (eflag) printf("In ");
+ p += 2;
+ length -= 2;
+ hdr_len += 2;
+ break;
+ case (PPP_WITHDIRECTION_OUT << 8 | PPP_CONTROL):
+ if (eflag) printf("Out ");
+ p += 2;
+ length -= 2;
+ hdr_len += 2;
+ break;
+ case (PPP_ADDRESS << 8 | PPP_CONTROL):
+ p += 2; /* ACFC not used */
+ length -= 2;
+ hdr_len += 2;
+ break;
+
+ default:
+ break;
+ }
if (length < 2)
goto trunc;
@@ -1136,7 +1299,7 @@ ppp_print(register const u_char *p, u_int length)
}
if (eflag)
- printf("PPP-%s (0x%04x), length %u: ",
+ printf("%s (0x%04x), length %u: ",
tok2str(ppptype2str, "unknown", proto),
proto,
olen);
@@ -1434,3 +1597,11 @@ printx:
#endif /* __bsdi__ */
return (hdrlength);
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
diff --git a/contrib/tcpdump/print-pppoe.c b/contrib/tcpdump/print-pppoe.c
index 69179c61b48d..8835e1e9d8dc 100644
--- a/contrib/tcpdump/print-pppoe.c
+++ b/contrib/tcpdump/print-pppoe.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
-"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.24.2.4 2004/03/24 03:04:22 guy Exp $ (LBL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.30 2004/08/27 03:57:41 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -101,9 +101,15 @@ pppoe_if_print(const struct pcap_pkthdr *h, register const u_char *p)
u_int
pppoe_print(register const u_char *bp, u_int length)
{
- u_short pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid, pppoe_length;
+ u_int16_t pppoe_ver, pppoe_type, pppoe_code, pppoe_sessionid;
+ u_int pppoe_length;
const u_char *pppoe_packet, *pppoe_payload;
+ if (length < PPPOE_HDRLEN) {
+ (void)printf("truncated-pppoe %u", length);
+ return (length);
+ }
+ length -= PPPOE_HDRLEN;
pppoe_packet = bp;
TCHECK2(*pppoe_packet, PPPOE_HDRLEN);
pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4;
@@ -113,11 +119,6 @@ pppoe_print(register const u_char *bp, u_int length)
pppoe_length = EXTRACT_16BITS(pppoe_packet + 4);
pppoe_payload = pppoe_packet + PPPOE_HDRLEN;
- if (snapend < pppoe_payload) {
- printf(" truncated PPPoE");
- return (PPPOE_HDRLEN);
- }
-
if (pppoe_ver != 1) {
printf(" [ver %d]",pppoe_ver);
}
@@ -127,25 +128,29 @@ pppoe_print(register const u_char *bp, u_int length)
printf("PPPoE %s", tok2str(pppoecode2str, "PAD-%x", pppoe_code));
if (pppoe_code == PPPOE_PADI && pppoe_length > 1484 - PPPOE_HDRLEN) {
- printf(" [len %d!]",pppoe_length);
+ printf(" [len %u!]",pppoe_length);
+ }
+ if (pppoe_length > length) {
+ printf(" [len %u > %u!]", pppoe_length, length);
+ pppoe_length = length;
}
if (pppoe_sessionid) {
printf(" [ses 0x%x]", pppoe_sessionid);
}
- if (pppoe_payload + pppoe_length < snapend && snapend-pppoe_payload+14 > 64) {
+ if (pppoe_length < length && length + ETHER_HDRLEN > 60) {
/* (small packets are probably just padded up to the ethernet
- minimum of 64 bytes) */
- printf(" [length %d (%d extra bytes)]",
- pppoe_length, snapend - pppoe_payload - pppoe_length);
+ minimum of 60 bytes of data + 4 bytes of CRC) */
+ printf(" [length %u (%u extra bytes)]",
+ pppoe_length, length - pppoe_length);
#if RESPECT_PAYLOAD_LENGTH
- snapend = pppoe_payload+pppoe_length;
+ if (snaplend > pppoe_payload+pppoe_length)
+ snapend = pppoe_payload+pppoe_length;
#else
/* Actual PPPoE implementations appear to ignore the payload
length and use the full ethernet frame anyways */
- pppoe_length = snapend-pppoe_payload;
+ pppoe_length = length;
#endif
-
}
if (pppoe_code) {
@@ -155,11 +160,11 @@ pppoe_print(register const u_char *bp, u_int length)
/*
* loop invariant:
- * p points to next tag,
+ * p points to current tag,
* tag_type is previous tag or 0xffff for first iteration
*/
- while (tag_type && p + 4 < pppoe_payload + length &&
- p + 4 < snapend) {
+ while (tag_type && p < pppoe_payload + pppoe_length) {
+ TCHECK2(*p, 4);
tag_type = EXTRACT_16BITS(p);
tag_len = EXTRACT_16BITS(p + 2);
p += 4;
@@ -172,6 +177,7 @@ pppoe_print(register const u_char *bp, u_int length)
unsigned tag_str_len = 0;
/* TODO print UTF-8 decoded text */
+ TCHECK2(*p, tag_len);
for (v = p; v < p + tag_len && tag_str_len < MAXTAGPRINT-1; v++)
if (*v >= 32 && *v < 127) {
tag_str[tag_str_len++] = *v;
diff --git a/contrib/tcpdump/print-pptp.c b/contrib/tcpdump/print-pptp.c
index 11e8330c561a..c4c8300d9aed 100644
--- a/contrib/tcpdump/print-pptp.c
+++ b/contrib/tcpdump/print-pptp.c
@@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.9.2.2 2003/11/16 08:51:39 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.11 2003/11/16 09:36:33 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-radius.c b/contrib/tcpdump/print-radius.c
index b3f790ec908b..0f8eaf5a076f 100644
--- a/contrib/tcpdump/print-radius.c
+++ b/contrib/tcpdump/print-radius.c
@@ -44,7 +44,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "$Id: print-radius.c,v 1.19.2.4 2004/02/06 14:38:51 hannes Exp $";
+ "$Id: print-radius.c,v 1.27 2004/07/21 21:45:47 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -840,9 +840,9 @@ radius_attr_print(register const u_char *attr, u_int length)
printf(" [|radius]");
return;
}
- /* do we want to see an additionally hexdump ? */
+ /* do we also want to see a hex dump ? */
if (vflag> 1 && rad_attr->len >= 2)
- print_unknown_data((char *)rad_attr+2,"\n\t ",(rad_attr->len)-2);
+ print_unknown_data((u_char *)rad_attr+2,"\n\t ",(rad_attr->len)-2);
length-=(rad_attr->len);
rad_attr = (struct radius_attr *)( ((char *)(rad_attr))+rad_attr->len);
diff --git a/contrib/tcpdump/print-raw.c b/contrib/tcpdump/print-raw.c
index 00153e58cb03..0fe6dd1947b3 100644
--- a/contrib/tcpdump/print-raw.c
+++ b/contrib/tcpdump/print-raw.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.39.2.2 2003/11/16 08:51:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.41 2003/11/16 09:36:34 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-rip.c b/contrib/tcpdump/print-rip.c
index 8c4301f7b20a..772a2e056c7e 100644
--- a/contrib/tcpdump/print-rip.c
+++ b/contrib/tcpdump/print-rip.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.55.2.2 2003/11/16 08:51:41 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.57 2003/11/16 09:36:34 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-ripng.c b/contrib/tcpdump/print-ripng.c
index 3432207fc8ac..5e7a02ecc413 100644
--- a/contrib/tcpdump/print-ripng.c
+++ b/contrib/tcpdump/print-ripng.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ripng.c,v 1.15.2.2 2003/11/16 08:51:42 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ripng.c,v 1.18 2005/01/04 00:15:54 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -31,22 +31,6 @@ static const char rcsid[] _U_ =
#ifdef INET6
#include <tcpdump-stdinc.h>
-
-#ifdef WIN32
-const struct in6_addr in6addr_any; /* :: */
-#endif /* WIN32 */
-
-#ifdef __MINGW32__
-int
-IN6_ADDR_EQUAL(const struct in6_addr *a, const struct in6_addr *b)
-{
- return (memcmp(a, b, sizeof(struct in6_addr)) == 0);
-}
-
-#define IN6_IS_ADDR_UNSPECIFIED(a) IN6_ADDR_EQUAL((a), &in6addr_any)
-
-#endif /* __MINGW32__ */
-
#include <stdio.h>
#include "route6d.h"
@@ -54,6 +38,14 @@ IN6_ADDR_EQUAL(const struct in6_addr *a, const struct in6_addr *b)
#include "addrtoname.h"
#include "extract.h"
+#if !defined(IN6_IS_ADDR_UNSPECIFIED) && !defined(_MSC_VER) /* MSVC inline */
+static int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *addr)
+{
+ static const struct in6_addr in6addr_any; /* :: */
+ return (memcmp(addr, &in6addr_any, sizeof(*addr)) == 0);
+}
+#endif
+
static int
rip6_entry_print(register const struct netinfo6 *ni, int metric)
{
diff --git a/contrib/tcpdump/print-rsvp.c b/contrib/tcpdump/print-rsvp.c
index 534878ed2a8a..959a620ca09e 100644
--- a/contrib/tcpdump/print-rsvp.c
+++ b/contrib/tcpdump/print-rsvp.c
@@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.24.2.3 2004/03/24 04:01:08 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33 2005/01/13 07:08:54 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -140,6 +140,7 @@ static const struct tok rsvp_header_flag_values[] = {
#define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
#define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
#define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
+#define RSVP_OBJ_CLASSTYPE 125 /* draft-ietf-tewg-diff-te-proto-07 */
#define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
#define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
#define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
@@ -179,6 +180,7 @@ static const struct tok rsvp_obj_values[] = {
{ RSVP_OBJ_LABEL_SET, "Label Set" },
{ RSVP_OBJ_ACCEPT_LABEL_SET, "Acceptable Label Set" },
{ RSVP_OBJ_DETOUR, "Detour" },
+ { RSVP_OBJ_CLASSTYPE, "Class Type" },
{ RSVP_OBJ_SUGGESTED_LABEL, "Suggested Label" },
{ RSVP_OBJ_PROPERTIES, "Properties" },
{ RSVP_OBJ_FASTREROUTE, "Fast Re-Route" },
@@ -231,6 +233,9 @@ static const struct tok rsvp_ctype_values[] = {
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV4, "IPv4" },
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV6, "IPv6" },
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
+ { 256*RSVP_OBJ_MESSAGE_ID+RSVP_CTYPE_1, "1" },
+ { 256*RSVP_OBJ_MESSAGE_ID_ACK+RSVP_CTYPE_1, "1" },
+ { 256*RSVP_OBJ_MESSAGE_ID_LIST+RSVP_CTYPE_1, "1" },
{ 256*RSVP_OBJ_STYLE+RSVP_CTYPE_1, "1" },
{ 256*RSVP_OBJ_HELLO+RSVP_CTYPE_1, "Hello Request" },
{ 256*RSVP_OBJ_HELLO+RSVP_CTYPE_2, "Hello Ack" },
@@ -261,6 +266,7 @@ static const struct tok rsvp_ctype_values[] = {
{ 256*RSVP_OBJ_FASTREROUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
{ 256*RSVP_OBJ_DETOUR+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
{ 256*RSVP_OBJ_PROPERTIES+RSVP_CTYPE_1, "1" },
+ { 256*RSVP_OBJ_CLASSTYPE+RSVP_CTYPE_1, "1" },
{ 0, NULL}
};
@@ -342,10 +348,12 @@ static struct tok rsvp_obj_prop_tlv_values[] = {
#define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
#define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
+#define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 125
static struct tok rsvp_obj_error_code_values[] = {
{ RSVP_OBJ_ERROR_SPEC_CODE_ROUTING, "Routing Problem" },
{ RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY, "Notify Error" },
+ { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE, "Diffserv TE Error" },
{ 0, NULL}
};
@@ -363,6 +371,17 @@ static struct tok rsvp_obj_error_code_routing_values[] = {
{ 0, NULL}
};
+static struct tok rsvp_obj_error_code_diffserv_te_values[] = {
+ { 1, "Unexpected CLASSTYPE object" },
+ { 2, "Unsupported Class-Type" },
+ { 3, "Invalid Class-Type value" },
+ { 4, "Class-Type and setup priority do not form a configured TE-Class" },
+ { 5, "Class-Type and holding priority do not form a configured TE-Class" },
+ { 6, "Inconsistency between signaled PSC and signaled Class-Type" },
+ { 7, "Inconsistency between signaled PHBs and signaled Class-Type" },
+ { 0, NULL}
+};
+
#define FALSE 0
#define TRUE 1
@@ -516,58 +535,18 @@ rsvp_intserv_print(const u_char *tptr, u_short obj_tlen) {
return (parameter_length+4); /* header length 4 bytes */
}
-void
-rsvp_print(register const u_char *pptr, register u_int len) {
+static int
+rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
- const struct rsvp_common_header *rsvp_com_header;
const struct rsvp_object_header *rsvp_obj_header;
- const u_char *tptr,*obj_tptr;
- u_short tlen,rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen;
- int hexdump,processed,padbytes,error_code,error_value;
+ const u_char *obj_tptr;
+ u_short rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen;
+ int hexdump,processed,padbytes,error_code,error_value,i;
union {
float f;
u_int32_t i;
} bw;
u_int8_t namelen;
- u_int i;
-
- tptr=pptr;
- rsvp_com_header = (const struct rsvp_common_header *)pptr;
- TCHECK(*rsvp_com_header);
-
- /*
- * Sanity checking of the header.
- */
- if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
- printf("RSVP version %u packet not supported",
- RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
- return;
- }
-
- /* in non-verbose mode just lets print the basic Message Type*/
- if (vflag < 1) {
- printf("RSVP %s Message, length: %u",
- tok2str(rsvp_msg_type_values, "unknown (%u)",rsvp_com_header->msg_type),
- len);
- return;
- }
-
- /* ok they seem to want to know everything - lets fully decode it */
-
- tlen=EXTRACT_16BITS(rsvp_com_header->length);
-
- printf("RSVP\n\tv: %u, msg-type: %s, Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
- RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
- tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
- bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
- tlen,
- rsvp_com_header->ttl,
- EXTRACT_16BITS(rsvp_com_header->checksum));
-
- if (tlen < sizeof(const struct rsvp_common_header))
- return;
- tptr+=sizeof(const struct rsvp_common_header);
- tlen-=sizeof(const struct rsvp_common_header);
while(tlen>0) {
/* did we capture enough for fully decoding the object header ? */
@@ -578,10 +557,14 @@ rsvp_print(register const u_char *pptr, register u_int len) {
rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length);
rsvp_obj_ctype=rsvp_obj_header->ctype;
- if(rsvp_obj_len % 4 || rsvp_obj_len < sizeof(struct rsvp_object_header))
- return;
+ if(rsvp_obj_len % 4 || rsvp_obj_len < sizeof(struct rsvp_object_header)) {
+ printf("ERROR: object header too short %u < %lu", rsvp_obj_len,
+ (unsigned long)sizeof(const struct rsvp_object_header));
+ return -1;
+ }
- printf("\n\t %s Object (%u) Flags: [%s",
+ printf("%s%s Object (%u) Flags: [%s",
+ ident,
tok2str(rsvp_obj_values,
"Unknown",
rsvp_obj_header->class_num),
@@ -598,13 +581,13 @@ rsvp_print(register const u_char *pptr, register u_int len) {
((rsvp_obj_header->class_num)<<8)+rsvp_obj_ctype),
rsvp_obj_ctype,
rsvp_obj_len);
-
+
obj_tptr=tptr+sizeof(struct rsvp_object_header);
obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header);
/* did we capture enough for fully decoding the object ? */
if (!TTEST2(*tptr, rsvp_obj_len))
- goto trunc;
+ return -1;
hexdump=FALSE;
switch(rsvp_obj_header->class_num) {
@@ -612,11 +595,13 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
if (obj_tlen < 8)
- return;
- printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
+ return -1;
+ printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
+ ident,
ipaddr_string(obj_tptr),
*(obj_tptr+4));
- printf("\n\t Flags: [0x%02x], DestPort %u",
+ printf("%s Flags: [0x%02x], DestPort %u",
+ ident,
*(obj_tptr+5),
EXTRACT_16BITS(obj_tptr+6));
obj_tlen-=8;
@@ -625,11 +610,13 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#ifdef INET6
case RSVP_CTYPE_IPV6:
if (obj_tlen < 20)
- return;
- printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
+ return -1;
+ printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
+ ident,
ip6addr_string(obj_tptr),
*(obj_tptr+16));
- printf("\n\t Flags: [0x%02x], DestPort %u",
+ printf("%s Flags: [0x%02x], DestPort %u",
+ ident,
*(obj_tptr+17),
EXTRACT_16BITS(obj_tptr+18));
obj_tlen-=20;
@@ -638,8 +625,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
case RSVP_CTYPE_TUNNEL_IPV6:
if (obj_tlen < 36)
- return;
- printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
+ return -1;
+ printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
+ ident,
ip6addr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+18),
ip6addr_string(obj_tptr+20));
@@ -649,8 +637,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#endif
case RSVP_CTYPE_TUNNEL_IPV4:
if (obj_tlen < 12)
- return;
- printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
+ return -1;
+ printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+6),
ipaddr_string(obj_tptr+8));
@@ -666,8 +655,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
if (obj_tlen < 4)
- return;
- printf("\n\t IPv4 Receiver Address: %s",
+ return -1;
+ printf("%s IPv4 Receiver Address: %s",
+ ident,
ipaddr_string(obj_tptr));
obj_tlen-=4;
obj_tptr+=4;
@@ -675,8 +665,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#ifdef INET6
case RSVP_CTYPE_IPV6:
if (obj_tlen < 16)
- return;
- printf("\n\t IPv6 Receiver Address: %s",
+ return -1;
+ printf("%s IPv6 Receiver Address: %s",
+ ident,
ip6addr_string(obj_tptr));
obj_tlen-=16;
obj_tptr+=16;
@@ -691,8 +682,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
if (obj_tlen < 4)
- return;
- printf("\n\t IPv4 Notify Node Address: %s",
+ return -1;
+ printf("%s IPv4 Notify Node Address: %s",
+ ident,
ipaddr_string(obj_tptr));
obj_tlen-=4;
obj_tptr+=4;
@@ -700,8 +692,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#ifdef INET6
case RSVP_CTYPE_IPV6:
if (obj_tlen < 16)
- return;
- printf("\n\t IPv6 Notify Node Address: %s",
+ return-1;
+ printf("%s IPv6 Notify Node Address: %s",
+ ident,
ip6addr_string(obj_tptr));
obj_tlen-=16;
obj_tptr+=16;
@@ -719,24 +712,27 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
while(obj_tlen >= 4 ) {
- printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr));
+ printf("%s Label: %u", ident, EXTRACT_32BITS(obj_tptr));
obj_tlen-=4;
obj_tptr+=4;
}
break;
case RSVP_CTYPE_2:
if (obj_tlen < 4)
- return;
- printf("\n\t Generalized Label: %u",
+ return-1;
+ printf("%s Generalized Label: %u",
+ ident,
EXTRACT_32BITS(obj_tptr));
obj_tlen-=4;
obj_tptr+=4;
break;
case RSVP_CTYPE_3:
if (obj_tlen < 12)
- return;
- printf("\n\t Waveband ID: %u\n\t Start Label: %u, Stop Label: %u",
+ return-1;
+ printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
+ ident,
EXTRACT_32BITS(obj_tptr),
+ ident,
EXTRACT_32BITS(obj_tptr+4),
EXTRACT_32BITS(obj_tptr+8));
obj_tlen-=12;
@@ -751,8 +747,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
if (obj_tlen < 4)
- return;
- printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
+ return-1;
+ printf("%s Reservation Style: %s, Flags: [0x%02x]",
+ ident,
tok2str(rsvp_resstyle_values,
"Unknown",
EXTRACT_24BITS(obj_tptr+1)),
@@ -769,8 +766,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
if (obj_tlen < 8)
- return;
- printf("\n\t Source Address: %s, Source Port: %u",
+ return-1;
+ printf("%s Source Address: %s, Source Port: %u",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+6));
obj_tlen-=8;
@@ -779,8 +777,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#ifdef INET6
case RSVP_CTYPE_IPV6:
if (obj_tlen < 20)
- return;
- printf("\n\t Source Address: %s, Source Port: %u",
+ return-1;
+ printf("%s Source Address: %s, Source Port: %u",
+ ident,
ip6addr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+18));
obj_tlen-=20;
@@ -789,8 +788,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#endif
case RSVP_CTYPE_TUNNEL_IPV4:
if (obj_tlen < 8)
- return;
- printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
+ return-1;
+ printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+6));
obj_tlen-=8;
@@ -805,7 +805,8 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
while(obj_tlen >= 4 ) {
- printf("\n\t L3 Protocol ID: %s",
+ printf("%s L3 Protocol ID: %s",
+ ident,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
EXTRACT_16BITS(obj_tptr+2)));
@@ -815,16 +816,19 @@ rsvp_print(register const u_char *pptr, register u_int len) {
break;
case RSVP_CTYPE_2:
if (obj_tlen < 12)
- return;
- printf("\n\t L3 Protocol ID: %s",
+ return-1;
+ printf("%s L3 Protocol ID: %s",
+ ident,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
EXTRACT_16BITS(obj_tptr+2)));
printf(",%s merge capability",((*(obj_tptr+4))&0x80) ? "no" : "" );
- printf("\n\t Minimum VPI/VCI: %u/%u",
+ printf("%s Minimum VPI/VCI: %u/%u",
+ ident,
(EXTRACT_16BITS(obj_tptr+4))&0xfff,
(EXTRACT_16BITS(obj_tptr+6))&0xfff);
- printf("\n\t Maximum VPI/VCI: %u/%u",
+ printf("%s Maximum VPI/VCI: %u/%u",
+ ident,
(EXTRACT_16BITS(obj_tptr+8))&0xfff,
(EXTRACT_16BITS(obj_tptr+10))&0xfff);
obj_tlen-=12;
@@ -832,12 +836,14 @@ rsvp_print(register const u_char *pptr, register u_int len) {
break;
case RSVP_CTYPE_3:
if (obj_tlen < 12)
- return;
- printf("\n\t L3 Protocol ID: %s",
+ return-1;
+ printf("%s L3 Protocol ID: %s",
+ ident,
tok2str(ethertype_values,
"Unknown Protocol (0x%04x)",
EXTRACT_16BITS(obj_tptr+2)));
- printf("\n\t Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
+ printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
+ ident,
(EXTRACT_32BITS(obj_tptr+4))&0x7fffff,
(EXTRACT_32BITS(obj_tptr+8))&0x7fffff,
(((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? "10" : "",
@@ -847,13 +853,15 @@ rsvp_print(register const u_char *pptr, register u_int len) {
break;
case RSVP_CTYPE_4:
if (obj_tlen < 8)
- return;
- printf("\n\t LSP Encoding Type: %s (%u)",
+ return-1;
+ printf("%s LSP Encoding Type: %s (%u)",
+ ident,
tok2str(gmpls_encoding_values,
"Unknown",
*obj_tptr),
*obj_tptr);
- printf("\n\t Switching Type: %s (%u), Payload ID: %s (0x%04x)",
+ printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
+ ident,
tok2str(gmpls_switch_cap_values,
"Unknown",
*(obj_tptr+1)),
@@ -875,7 +883,8 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
while(obj_tlen >= 4 ) {
- printf("\n\t Subobject Type: %s",
+ printf("%s Subobject Type: %s",
+ ident,
tok2str(rsvp_obj_xro_values,
"Unknown %u",
RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)));
@@ -903,8 +912,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
case RSVP_CTYPE_1:
case RSVP_CTYPE_2:
if (obj_tlen < 8)
- return;
- printf("\n\t Source Instance: 0x%08x, Destination Instance: 0x%08x",
+ return-1;
+ printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
+ ident,
EXTRACT_32BITS(obj_tptr),
EXTRACT_32BITS(obj_tptr+4));
obj_tlen-=8;
@@ -919,10 +929,11 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
if (obj_tlen < 8)
- return;
- printf("\n\t Restart Time: %ums, Recovery Time: %ums",
- EXTRACT_16BITS(obj_tptr),
- EXTRACT_16BITS(obj_tptr+4));
+ return-1;
+ printf("%s Restart Time: %ums, Recovery Time: %ums",
+ ident,
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr+4));
obj_tlen-=8;
obj_tptr+=8;
break;
@@ -935,14 +946,15 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_TUNNEL_IPV4:
if (obj_tlen < 4)
- return;
+ return-1;
namelen = *(obj_tptr+3);
if (obj_tlen < 4+namelen)
- return;
- printf("\n\t Session Name: ");
+ return-1;
+ printf("%s Session Name: ", ident);
for (i = 0; i < namelen; i++)
safeputchar(*(obj_tptr+4+i));
- printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
+ printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
+ ident,
(int)*obj_tptr,
(int)*(obj_tptr+1),
tok2str(rsvp_session_attribute_flag_values,
@@ -962,8 +974,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
case RSVP_CTYPE_IPV4:
if (obj_tlen < 8)
- return;
- printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
+ return-1;
+ printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_32BITS(obj_tptr+4));
obj_tlen-=8;
@@ -974,8 +987,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */
case RSVP_CTYPE_IPV6:
if (obj_tlen < 20)
- return;
- printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
+ return-1;
+ printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
+ ident,
ip6addr_string(obj_tptr),
EXTRACT_32BITS(obj_tptr+16));
obj_tlen-=20;
@@ -992,8 +1006,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
if (obj_tlen < 4)
- return;
- printf("\n\t Refresh Period: %ums",
+ return-1;
+ printf("%s Refresh Period: %ums",
+ ident,
EXTRACT_32BITS(obj_tptr));
obj_tlen-=4;
obj_tptr+=4;
@@ -1010,8 +1025,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_2:
if (obj_tlen < 4)
- return;
- printf("\n\t Msg-Version: %u, length: %u",
+ return-1;
+ printf("%s Msg-Version: %u, length: %u",
+ ident,
(*obj_tptr & 0xf0) >> 4,
EXTRACT_16BITS(obj_tptr+2)<<2);
obj_tptr+=4; /* get to the start of the service header */
@@ -1019,7 +1035,8 @@ rsvp_print(register const u_char *pptr, register u_int len) {
while (obj_tlen >= 4) {
intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2;
- printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
+ printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
+ ident,
tok2str(rsvp_intserv_service_type_values,"unknown",*(obj_tptr)),
*(obj_tptr),
(*(obj_tptr+1)&0x80) ? "" : "not",
@@ -1047,8 +1064,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_IPV4:
if (obj_tlen < 8)
- return;
- printf("\n\t Source Address: %s, Source Port: %u",
+ return-1;
+ printf("%s Source Address: %s, Source Port: %u",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+6));
obj_tlen-=8;
@@ -1057,8 +1075,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#ifdef INET6
case RSVP_CTYPE_IPV6:
if (obj_tlen < 20)
- return;
- printf("\n\t Source Address: %s, Source Port: %u",
+ return-1;
+ printf("%s Source Address: %s, Source Port: %u",
+ ident,
ip6addr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+18));
obj_tlen-=20;
@@ -1066,8 +1085,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
break;
case RSVP_CTYPE_3:
if (obj_tlen < 20)
- return;
- printf("\n\t Source Address: %s, Flow Label: %u",
+ return-1;
+ printf("%s Source Address: %s, Flow Label: %u",
+ ident,
ip6addr_string(obj_tptr),
EXTRACT_24BITS(obj_tptr+17));
obj_tlen-=20;
@@ -1075,8 +1095,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
break;
case RSVP_CTYPE_TUNNEL_IPV6:
if (obj_tlen < 20)
- return;
- printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
+ return-1;
+ printf("%s Source Address: %s, LSP-ID: 0x%04x",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+18));
obj_tlen-=20;
@@ -1085,8 +1106,9 @@ rsvp_print(register const u_char *pptr, register u_int len) {
#endif
case RSVP_CTYPE_TUNNEL_IPV4:
if (obj_tlen < 8)
- return;
- printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
+ return-1;
+ printf("%s Source Address: %s, LSP-ID: 0x%04x",
+ ident,
ipaddr_string(obj_tptr),
EXTRACT_16BITS(obj_tptr+6));
obj_tlen-=8;
@@ -1101,14 +1123,16 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_TUNNEL_IPV4:
if (obj_tlen < 16)
- return;
+ return-1;
bw.i = EXTRACT_32BITS(obj_tptr+4);
- printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
+ printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
+ ident,
(int)*obj_tptr,
(int)*(obj_tptr+1),
(int)*(obj_tptr+2),
bw.f*8/1000000);
- printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
+ printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
+ ident,
EXTRACT_32BITS(obj_tptr+8),
EXTRACT_32BITS(obj_tptr+12));
obj_tlen-=16;
@@ -1123,7 +1147,8 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_TUNNEL_IPV4:
while(obj_tlen >= 8) {
- printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
+ printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
+ ident,
ipaddr_string(obj_tptr),
ipaddr_string(obj_tptr+4));
obj_tlen-=8;
@@ -1135,17 +1160,33 @@ rsvp_print(register const u_char *pptr, register u_int len) {
}
break;
+ case RSVP_OBJ_CLASSTYPE:
+ switch(rsvp_obj_ctype) {
+ case RSVP_CTYPE_1:
+ printf("%s Class Type: %u",
+ ident,
+ EXTRACT_32BITS(obj_tptr)&0x7);
+ obj_tlen-=4;
+ obj_tptr+=4;
+ break;
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
case RSVP_OBJ_ERROR_SPEC:
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
case RSVP_CTYPE_IPV4:
if (obj_tlen < 8)
- return;
+ return-1;
error_code=*(obj_tptr+5);
error_value=EXTRACT_16BITS(obj_tptr+6);
- printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
+ printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
+ ident,
ipaddr_string(obj_tptr),
*(obj_tptr+4),
+ ident,
tok2str(rsvp_obj_error_code_values,"unknown",error_code),
error_code);
switch (error_code) {
@@ -1154,6 +1195,11 @@ rsvp_print(register const u_char *pptr, register u_int len) {
tok2str(rsvp_obj_error_code_routing_values,"unknown",error_value),
error_value);
break;
+ case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE:
+ printf(", Error Value: %s (%u)",
+ tok2str(rsvp_obj_error_code_diffserv_te_values,"unknown",error_value),
+ error_value);
+ break;
default:
printf(", Unknown Error Value (%u)", error_value);
break;
@@ -1165,12 +1211,14 @@ rsvp_print(register const u_char *pptr, register u_int len) {
case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */
case RSVP_CTYPE_IPV6:
if (obj_tlen < 20)
- return;
+ return-1;
error_code=*(obj_tptr+17);
error_value=EXTRACT_16BITS(obj_tptr+18);
- printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
+ printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
+ ident,
ip6addr_string(obj_tptr),
*(obj_tptr+16),
+ ident,
tok2str(rsvp_obj_error_code_values,"unknown",error_code),
error_code);
@@ -1196,21 +1244,23 @@ rsvp_print(register const u_char *pptr, register u_int len) {
switch(rsvp_obj_ctype) {
case RSVP_CTYPE_1:
if (obj_tlen < 4)
- return;
+ return-1;
padbytes = EXTRACT_16BITS(obj_tptr+2);
- printf("\n\t TLV count: %u, padding bytes: %u",
+ printf("%s TLV count: %u, padding bytes: %u",
+ ident,
EXTRACT_16BITS(obj_tptr),
padbytes);
obj_tlen-=4;
obj_tptr+=4;
/* loop through as long there is anything longer than the TLV header (2) */
while(obj_tlen >= 2 + padbytes) {
- printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
+ printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
+ ident,
tok2str(rsvp_obj_prop_tlv_values,"unknown",*obj_tptr),
*obj_tptr,
*(obj_tptr+1));
if (obj_tlen < *(obj_tptr+1))
- return;
+ return-1;
print_unknown_data(obj_tptr+2,"\n\t\t",*(obj_tptr+1)-2);
obj_tlen-=*(obj_tptr+1);
obj_tptr+=*(obj_tptr+1);
@@ -1221,6 +1271,34 @@ rsvp_print(register const u_char *pptr, register u_int len) {
}
break;
+ case RSVP_OBJ_MESSAGE_ID: /* fall through */
+ case RSVP_OBJ_MESSAGE_ID_ACK: /* fall through */
+ case RSVP_OBJ_MESSAGE_ID_LIST:
+ switch(rsvp_obj_ctype) {
+ case RSVP_CTYPE_1:
+ if (obj_tlen < 8)
+ return-1;
+ printf("%s Flags [0x%02x], epoch: %u",
+ ident,
+ *obj_tptr,
+ EXTRACT_24BITS(obj_tptr+1));
+ obj_tlen-=4;
+ obj_tptr+=4;
+ /* loop through as long there are no messages left */
+ while(obj_tlen >= 4) {
+ printf("%s Message-ID 0x%08x (%u)",
+ ident,
+ EXTRACT_32BITS(obj_tptr),
+ EXTRACT_32BITS(obj_tptr));
+ obj_tlen-=4;
+ obj_tptr+=4;
+ }
+ break;
+ default:
+ hexdump=TRUE;
+ }
+ break;
+
/*
* FIXME those are the defined objects that lack a decoder
* you are welcome to contribute code ;-)
@@ -1229,25 +1307,146 @@ rsvp_print(register const u_char *pptr, register u_int len) {
case RSVP_OBJ_INTEGRITY:
case RSVP_OBJ_SCOPE:
case RSVP_OBJ_POLICY_DATA:
- case RSVP_OBJ_MESSAGE_ID:
- case RSVP_OBJ_MESSAGE_ID_ACK:
- case RSVP_OBJ_MESSAGE_ID_LIST:
case RSVP_OBJ_LABEL_SET:
case RSVP_OBJ_ACCEPT_LABEL_SET:
case RSVP_OBJ_PROTECTION:
default:
if (vflag <= 1)
- print_unknown_data(obj_tptr,"\n\t ",obj_tlen);
+ print_unknown_data(obj_tptr,"\n\t ",obj_tlen); /* FIXME indentation */
break;
}
- /* do we want to see an additionally hexdump ? */
+ /* do we also want to see a hex dump ? */
if (vflag > 1 || hexdump==TRUE)
- print_unknown_data(tptr+sizeof(sizeof(struct rsvp_object_header)),"\n\t ",
+ print_unknown_data(tptr+sizeof(sizeof(struct rsvp_object_header)),"\n\t ", /* FIXME indentation */
rsvp_obj_len-sizeof(struct rsvp_object_header));
tptr+=rsvp_obj_len;
tlen-=rsvp_obj_len;
}
+ return 0;
+trunc:
+ printf("\n\t\t packet exceeded snapshot");
+ return -1;
+}
+
+
+void
+rsvp_print(register const u_char *pptr, register u_int len) {
+
+ const struct rsvp_common_header *rsvp_com_header;
+ const u_char *tptr,*subtptr;
+ u_short tlen,subtlen;
+
+ tptr=pptr;
+
+ rsvp_com_header = (const struct rsvp_common_header *)pptr;
+ TCHECK(*rsvp_com_header);
+
+ /*
+ * Sanity checking of the header.
+ */
+ if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
+ printf("ERROR: RSVP version %u packet not supported",
+ RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
+ return;
+ }
+
+ /* in non-verbose mode just lets print the basic Message Type*/
+ if (vflag < 1) {
+ printf("RSVPv%u %s Message, length: %u",
+ RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
+ tok2str(rsvp_msg_type_values, "unknown (%u)",rsvp_com_header->msg_type),
+ len);
+ return;
+ }
+
+ /* ok they seem to want to know everything - lets fully decode it */
+
+ tlen=EXTRACT_16BITS(rsvp_com_header->length);
+
+ printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
+ RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
+ tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
+ rsvp_com_header->msg_type,
+ bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
+ tlen,
+ rsvp_com_header->ttl,
+ EXTRACT_16BITS(rsvp_com_header->checksum));
+
+ if (tlen < sizeof(const struct rsvp_common_header)) {
+ printf("ERROR: common header too short %u < %lu", tlen,
+ (unsigned long)sizeof(const struct rsvp_common_header));
+ return;
+ }
+
+ tptr+=sizeof(const struct rsvp_common_header);
+ tlen-=sizeof(const struct rsvp_common_header);
+
+ switch(rsvp_com_header->msg_type) {
+
+ case RSVP_MSGTYPE_AGGREGATE:
+ while(tlen > 0) {
+ subtptr=tptr;
+ rsvp_com_header = (const struct rsvp_common_header *)subtptr;
+ TCHECK(*rsvp_com_header);
+
+ /*
+ * Sanity checking of the header.
+ */
+ if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
+ printf("ERROR: RSVP version %u packet not supported",
+ RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
+ return;
+ }
+ subtlen=EXTRACT_16BITS(rsvp_com_header->length);
+
+ printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
+ RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
+ tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
+ rsvp_com_header->msg_type,
+ bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
+ subtlen,
+ rsvp_com_header->ttl,
+ EXTRACT_16BITS(rsvp_com_header->checksum));
+
+ if (subtlen < sizeof(const struct rsvp_common_header)) {
+ printf("ERROR: common header too short %u < %lu", subtlen,
+ (unsigned long)sizeof(const struct rsvp_common_header));
+ return;
+ }
+
+ subtptr+=sizeof(const struct rsvp_common_header);
+ subtlen-=sizeof(const struct rsvp_common_header);
+
+ if (rsvp_obj_print(subtptr,"\n\t ", subtlen) == -1)
+ return;
+
+ tptr+=subtlen+sizeof(const struct rsvp_common_header);
+ tlen-=subtlen+sizeof(const struct rsvp_common_header);
+ }
+
+ break;
+
+ case RSVP_MSGTYPE_PATH:
+ case RSVP_MSGTYPE_RESV:
+ case RSVP_MSGTYPE_PATHERR:
+ case RSVP_MSGTYPE_RESVERR:
+ case RSVP_MSGTYPE_PATHTEAR:
+ case RSVP_MSGTYPE_RESVTEAR:
+ case RSVP_MSGTYPE_RESVCONF:
+ case RSVP_MSGTYPE_HELLO_OLD:
+ case RSVP_MSGTYPE_HELLO:
+ case RSVP_MSGTYPE_ACK:
+ case RSVP_MSGTYPE_SREFRESH:
+ if (rsvp_obj_print(tptr,"\n\t ", tlen) == -1)
+ return;
+ break;
+
+ default:
+ print_unknown_data(tptr,"\n\t ",tlen);
+ break;
+ }
+
return;
trunc:
printf("\n\t\t packet exceeded snapshot");
diff --git a/contrib/tcpdump/print-rt6.c b/contrib/tcpdump/print-rt6.c
index 6adc009ded14..95de311bcd14 100644
--- a/contrib/tcpdump/print-rt6.c
+++ b/contrib/tcpdump/print-rt6.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.23.2.3 2003/11/19 00:35:45 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.26 2003/11/19 00:36:08 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-rx.c b/contrib/tcpdump/print-rx.c
index 64ec7edaad19..bf7c6bdcc6dd 100644
--- a/contrib/tcpdump/print-rx.c
+++ b/contrib/tcpdump/print-rx.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.35.2.2 2003/11/16 08:51:43 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.37 2003/11/16 09:36:36 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-sctp.c b/contrib/tcpdump/print-sctp.c
index deac2395ff29..b0e0036b8a88 100644
--- a/contrib/tcpdump/print-sctp.c
+++ b/contrib/tcpdump/print-sctp.c
@@ -35,7 +35,7 @@
#ifndef lint
static const char rcsid[] _U_ =
-"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.13.2.2 2003/11/16 08:51:44 guy Exp $ (NETLAB/PEL)";
+"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.16 2004/12/15 08:43:23 guy Exp $ (NETLAB/PEL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -74,6 +74,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
int chunkCount;
const struct sctpChunkDesc *chunkDescPtr;
const void *nextChunk;
+ const char *sep;
sctpPktHdr = (const struct sctpHeader*) bp;
endPacketPtr = (const u_char*)sctpPktHdr+sctpPacketLength;
@@ -125,9 +126,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
}
fflush(stdout);
- if (vflag < 2)
- return;
-
+ if (vflag >= 2)
+ sep = "\n\t";
+ else
+ sep = " (";
/* cycle through all chunks, printing information on each one */
for (chunkCount = 0,
chunkDescPtr = (const struct sctpChunkDesc *)
@@ -150,7 +152,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
nextChunk = (const void *) (chunkEnd + align);
- printf("\n\t%d) ", chunkCount+1);
+ printf("%s%d) ", sep, chunkCount+1);
switch (chunkDescPtr->chunkID)
{
case SCTP_DATA :
@@ -189,7 +191,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
printf("[PPID 0x%x] ", EXTRACT_32BITS(&dataHdrPtr->payloadtype));
fflush(stdout);
- if (vflag) /* if verbose output is specified */
+ if (vflag >= 2) /* if verbose output is specified */
{ /* at the command line */
const u_char *payloadPtr;
@@ -341,5 +343,8 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
printf("[Unknown chunk type: 0x%x]", chunkDescPtr->chunkID);
return;
}
+
+ if (vflag < 2)
+ sep = ", (";
}
}
diff --git a/contrib/tcpdump/print-sip.c b/contrib/tcpdump/print-sip.c
new file mode 100644
index 000000000000..b4d13b132fe8
--- /dev/null
+++ b/contrib/tcpdump/print-sip.c
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ *
+ * Original code by Hannes Gredler (hannes@juniper.net)
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sip.c,v 1.1 2004/07/27 17:04:20 hannes Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "interface.h"
+#include "extract.h"
+
+#include "udp.h"
+
+void
+sip_print(register const u_char *pptr, register u_int len)
+{
+ u_int idx;
+
+ printf("SIP, length: %u%s", len, vflag ? "\n\t" : "");
+
+ /* in non-verbose mode just lets print the protocol and length */
+ if (vflag < 1)
+ return;
+
+ for (idx = 0; idx < len; idx++) {
+ if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */
+ safeputchar(*(pptr+idx));
+ } else {
+ printf("\n\t");
+ idx+=1;
+ }
+ }
+
+ /* do we want to see an additionally hexdump ? */
+ if (vflag> 1)
+ print_unknown_data(pptr,"\n\t",len);
+
+ return;
+}
diff --git a/contrib/tcpdump/print-sl.c b/contrib/tcpdump/print-sl.c
index 9e5cdb1ce399..f28a21a407a3 100644
--- a/contrib/tcpdump/print-sl.c
+++ b/contrib/tcpdump/print-sl.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.62.2.2 2003/11/16 08:51:44 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.65 2005/04/06 21:32:42 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -69,7 +69,7 @@ sl_if_print(const struct pcap_pkthdr *h, const u_char *p)
switch (IP_V(ip)) {
case 4:
- ip_print((u_char *)ip, length);
+ ip_print(gndo, (u_char *)ip, length);
break;
#ifdef INET6
case 6:
@@ -104,7 +104,7 @@ sl_bsdos_if_print(const struct pcap_pkthdr *h, const u_char *p)
sliplink_print(p, ip, length);
#endif
- ip_print((u_char *)ip, length);
+ ip_print(gndo, (u_char *)ip, length);
return (SLIP_HDRLEN);
}
diff --git a/contrib/tcpdump/print-sll.c b/contrib/tcpdump/print-sll.c
index df0ce59272cd..aeb0610c9e6e 100644
--- a/contrib/tcpdump/print-sll.c
+++ b/contrib/tcpdump/print-sll.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.12.2.2 2003/11/16 08:51:44 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.16 2004/10/28 00:34:29 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -36,60 +36,44 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "addrtoname.h"
#include "ethertype.h"
+#include "extract.h"
#include "ether.h"
#include "sll.h"
+const struct tok sll_pkttype_values[] = {
+ { LINUX_SLL_HOST, "In" },
+ { LINUX_SLL_BROADCAST, "B" },
+ { LINUX_SLL_MULTICAST, "M" },
+ { LINUX_SLL_OTHERHOST, "P" },
+ { LINUX_SLL_OUTGOING, "Out" },
+ { 0, NULL}
+};
+
static inline void
sll_print(register const struct sll_header *sllp, u_int length)
{
- u_short halen;
-
- switch (ntohs(sllp->sll_pkttype)) {
-
- case LINUX_SLL_HOST:
- (void)printf("< ");
- break;
-
- case LINUX_SLL_BROADCAST:
- (void)printf("B ");
- break;
-
- case LINUX_SLL_MULTICAST:
- (void)printf("M ");
- break;
-
- case LINUX_SLL_OTHERHOST:
- (void)printf("P ");
- break;
-
- case LINUX_SLL_OUTGOING:
- (void)printf("> ");
- break;
-
- default:
- (void)printf("? ");
- break;
- }
+ printf("%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_16BITS(&sllp->sll_pkttype)));
/*
* XXX - check the link-layer address type value?
* For now, we just assume 6 means Ethernet.
* XXX - print others as strings of hex?
*/
- halen = ntohs(sllp->sll_halen);
- if (halen == 6)
+ if (EXTRACT_16BITS(&sllp->sll_halen) == 6)
(void)printf("%s ", etheraddr_string(sllp->sll_addr));
if (!qflag)
- (void)printf("%s ", etherproto_string(sllp->sll_protocol));
- (void)printf("%d: ", length);
+ (void)printf("ethertype %s (0x%04x), length %u: ",
+ tok2str(ethertype_values,"Unknown", EXTRACT_16BITS(&sllp->sll_protocol)),
+ EXTRACT_16BITS(&sllp->sll_protocol),
+ length);
}
/*
* This is the top level routine of the printer. 'p' points to the
* Linux "cooked capture" header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
diff --git a/contrib/tcpdump/print-smb.c b/contrib/tcpdump/print-smb.c
index 5f683eff5279..fe1b439d6a08 100644
--- a/contrib/tcpdump/print-smb.c
+++ b/contrib/tcpdump/print-smb.c
@@ -12,7 +12,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.27.2.2 2003/11/16 08:51:45 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.41 2004/12/30 03:36:51 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -25,6 +25,7 @@ static const char rcsid[] _U_ =
#include "smb.h"
static int request = 0;
+static int unicodestr = 0;
const u_char *startbuf = NULL;
@@ -94,11 +95,11 @@ trans2_findfirst(const u_char *param, const u_char *data, int pcnt, int dcnt)
const char *fmt;
if (request)
- fmt = "Attribute=[A]\nSearchCount=[d]\nFlags=[w]\nLevel=[dP5]\nFile=[S]\n";
+ fmt = "Attribute=[A]\nSearchCount=[d]\nFlags=[w]\nLevel=[dP4]\nFile=[S]\n";
else
fmt = "Handle=[w]\nCount=[d]\nEOS=[w]\nEoffset=[d]\nLastNameOfs=[w]\n";
- smb_fdata(param, fmt, param + pcnt);
+ smb_fdata(param, fmt, param + pcnt, unicodestr);
if (dcnt) {
printf("data:\n");
print_data(data, dcnt);
@@ -115,23 +116,23 @@ trans2_qfsinfo(const u_char *param, const u_char *data, int pcnt, int dcnt)
TCHECK2(*param, 2);
level = EXTRACT_LE_16BITS(param);
fmt = "InfoLevel=[d]\n";
- smb_fdata(param, fmt, param + pcnt);
+ smb_fdata(param, fmt, param + pcnt, unicodestr);
} else {
switch (level) {
case 1:
fmt = "idFileSystem=[W]\nSectorUnit=[D]\nUnit=[D]\nAvail=[D]\nSectorSize=[d]\n";
break;
case 2:
- fmt = "CreationTime=[T2]VolNameLength=[B]\nVolumeLabel=[s12]\n";
+ fmt = "CreationTime=[T2]VolNameLength=[lb]\nVolumeLabel=[c]\n";
break;
case 0x105:
- fmt = "Capabilities=[W]\nMaxFileLen=[D]\nVolNameLen=[D]\nVolume=[S]\n";
+ fmt = "Capabilities=[W]\nMaxFileLen=[D]\nVolNameLen=[lD]\nVolume=[C]\n";
break;
default:
fmt = "UnknownLevel\n";
break;
}
- smb_fdata(data, fmt, data + dcnt);
+ smb_fdata(data, fmt, data + dcnt, unicodestr);
}
if (dcnt) {
printf("data:\n");
@@ -169,8 +170,9 @@ struct smbfnsint trans2_fns[] = {
static void
-print_trans2(const u_char *words, const u_char *dat _U_, const u_char *buf, const u_char *maxbuf)
+print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_char *maxbuf)
{
+ u_int bcc;
static struct smbfnsint *fn = &trans2_fns[0];
const u_char *data, *param;
const u_char *w = words + 1;
@@ -204,29 +206,31 @@ print_trans2(const u_char *words, const u_char *dat _U_, const u_char *buf, cons
if (words[0] == 8) {
smb_fdata(words + 1,
"Trans2Secondary\nTotParam=[d]\nTotData=[d]\nParamCnt=[d]\nParamOff=[d]\nParamDisp=[d]\nDataCnt=[d]\nDataOff=[d]\nDataDisp=[d]\nHandle=[d]\n",
- maxbuf);
+ maxbuf, unicodestr);
return;
} else {
smb_fdata(words + 1,
- "TotParam=[d]\nTotData=[d]\nMaxParam=[d]\nMaxData=[d]\nMaxSetup=[d]\nFlags=[w]\nTimeOut=[D]\nRes1=[w]\nParamCnt=[d]\nParamOff=[d]\nDataCnt=[d]\nDataOff=[d]\nSetupCnt=[d]\n",
- words + 1 + 14 * 2);
- smb_fdata(data + 1, "TransactionName=[S]\n%", maxbuf);
+ "TotParam=[d]\nTotData=[d]\nMaxParam=[d]\nMaxData=[d]\nMaxSetup=[b][P1]\nFlags=[w]\nTimeOut=[D]\nRes1=[w]\nParamCnt=[d]\nParamOff=[d]\nDataCnt=[d]\nDataOff=[d]\nSetupCnt=[b][P1]\n",
+ words + 1 + 14 * 2, unicodestr);
}
f1 = fn->descript.req_f1;
f2 = fn->descript.req_f2;
} else {
smb_fdata(words + 1,
- "TotParam=[d]\nTotData=[d]\nRes1=[w]\nParamCnt=[d]\nParamOff=[d]\nParamDisp[d]\nDataCnt=[d]\nDataOff=[d]\nDataDisp=[d]\nSetupCnt=[d]\n",
- words + 1 + 10 * 2);
+ "TotParam=[d]\nTotData=[d]\nRes1=[w]\nParamCnt=[d]\nParamOff=[d]\nParamDisp[d]\nDataCnt=[d]\nDataOff=[d]\nDataDisp=[d]\nSetupCnt=[b][P1]\n",
+ words + 1 + 10 * 2, unicodestr);
f1 = fn->descript.rep_f1;
f2 = fn->descript.rep_f2;
}
+ TCHECK2(*dat, 2);
+ bcc = EXTRACT_LE_16BITS(dat);
+ printf("smb_bcc=%u\n", bcc);
if (fn->descript.fn)
(*fn->descript.fn)(param, data, pcnt, dcnt);
else {
- smb_fdata(param, f1 ? f1 : "Parameters=\n", param + pcnt);
- smb_fdata(data, f2 ? f2 : "Data=\n", data + dcnt);
+ smb_fdata(param, f1 ? f1 : "Parameters=\n", param + pcnt, unicodestr);
+ smb_fdata(data, f2 ? f2 : "Data=\n", data + dcnt, unicodestr);
}
return;
trunc:
@@ -244,70 +248,70 @@ print_browse(const u_char *param, int paramlen, const u_char *data, int datalen)
TCHECK(data[0]);
command = data[0];
- smb_fdata(param, "BROWSE PACKET\n|Param ", param+paramlen);
+ smb_fdata(param, "BROWSE PACKET\n|Param ", param+paramlen, unicodestr);
switch (command) {
case 0xF:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (LocalMasterAnnouncement)\nUpdateCount=[w]\nRes1=[B]\nAnnounceInterval=[d]\nName=[n2]\nMajorVersion=[B]\nMinorVersion=[B]\nServerType=[W]\nElectionVersion=[w]\nBrowserConstant=[w]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0x1:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (HostAnnouncement)\nUpdateCount=[w]\nRes1=[B]\nAnnounceInterval=[d]\nName=[n2]\nMajorVersion=[B]\nMinorVersion=[B]\nServerType=[W]\nElectionVersion=[w]\nBrowserConstant=[w]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0x2:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (AnnouncementRequest)\nFlags=[B]\nReplySystemName=[S]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0xc:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (WorkgroupAnnouncement)\nUpdateCount=[w]\nRes1=[B]\nAnnounceInterval=[d]\nName=[n2]\nMajorVersion=[B]\nMinorVersion=[B]\nServerType=[W]\nCommentPointer=[W]\nServerName=[S]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0x8:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (ElectionFrame)\nElectionVersion=[B]\nOSSummary=[W]\nUptime=[(W, W)]\nServerName=[S]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0xb:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (BecomeBackupBrowser)\nName=[S]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0x9:
data = smb_fdata(data,
- "BROWSE PACKET:\nType=[B] (GetBackupList)\nListCount?=[B]\nToken?=[B]\n",
- maxbuf);
+ "BROWSE PACKET:\nType=[B] (GetBackupList)\nListCount?=[B]\nToken=[W]\n",
+ maxbuf, unicodestr);
break;
case 0xa:
data = smb_fdata(data,
- "BROWSE PACKET:\nType=[B] (BackupListResponse)\nServerCount?=[B]\nToken?=[B]*Name=[S]\n",
- maxbuf);
+ "BROWSE PACKET:\nType=[B] (BackupListResponse)\nServerCount?=[B]\nToken=[W]\n*Name=[S]\n",
+ maxbuf, unicodestr);
break;
case 0xd:
data = smb_fdata(data,
"BROWSE PACKET:\nType=[B] (MasterAnnouncement)\nMasterName=[S]\n",
- maxbuf);
+ maxbuf, unicodestr);
break;
case 0xe:
data = smb_fdata(data,
- "BROWSE PACKET:\nType=[B] (ResetBrowser)\nOptions=[B]\n", maxbuf);
+ "BROWSE PACKET:\nType=[B] (ResetBrowser)\nOptions=[B]\n", maxbuf, unicodestr);
break;
default:
- data = smb_fdata(data, "Unknown Browser Frame ", maxbuf);
+ data = smb_fdata(data, "Unknown Browser Frame ", maxbuf, unicodestr);
break;
}
return;
@@ -321,15 +325,17 @@ static void
print_ipc(const u_char *param, int paramlen, const u_char *data, int datalen)
{
if (paramlen)
- smb_fdata(param, "Command=[w]\nStr1=[S]\nStr2=[S]\n", param + paramlen);
+ smb_fdata(param, "Command=[w]\nStr1=[S]\nStr2=[S]\n", param + paramlen,
+ unicodestr);
if (datalen)
- smb_fdata(data, "IPC ", data + datalen);
+ smb_fdata(data, "IPC ", data + datalen, unicodestr);
}
static void
print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u_char *maxbuf)
{
+ u_int bcc;
const char *f1, *f2, *f3, *f4;
const u_char *data, *param;
const u_char *w = words + 1;
@@ -357,23 +363,30 @@ print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u
f4 = "|Data ";
}
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + 2 * words[0], maxbuf));
- smb_fdata(data1 + 2, f2, maxbuf - (paramlen + datalen));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + 2 * words[0], maxbuf),
+ unicodestr);
- if (strcmp((const char *)(data1 + 2), "\\MAILSLOT\\BROWSE") == 0) {
- print_browse(param, paramlen, data, datalen);
- return;
- }
+ TCHECK2(*data1, 2);
+ bcc = EXTRACT_LE_16BITS(data1);
+ printf("smb_bcc=%u\n", bcc);
+ if (bcc > 0) {
+ smb_fdata(data1 + 2, f2, maxbuf - (paramlen + datalen), unicodestr);
- if (strcmp((const char *)(data1 + 2), "\\PIPE\\LANMAN") == 0) {
- print_ipc(param, paramlen, data, datalen);
- return;
- }
+ if (strcmp((const char *)(data1 + 2), "\\MAILSLOT\\BROWSE") == 0) {
+ print_browse(param, paramlen, data, datalen);
+ return;
+ }
- if (paramlen)
- smb_fdata(param, f3, SMBMIN(param + paramlen, maxbuf));
- if (datalen)
- smb_fdata(data, f4, SMBMIN(data + datalen, maxbuf));
+ if (strcmp((const char *)(data1 + 2), "\\PIPE\\LANMAN") == 0) {
+ print_ipc(param, paramlen, data, datalen);
+ return;
+ }
+
+ if (paramlen)
+ smb_fdata(param, f3, SMBMIN(param + paramlen, maxbuf), unicodestr);
+ if (datalen)
+ smb_fdata(data, f4, SMBMIN(data + datalen, maxbuf), unicodestr);
+ }
return;
trunc:
printf("[|SMB]");
@@ -384,32 +397,38 @@ trunc:
static void
print_negprot(const u_char *words, const u_char *data, const u_char *buf _U_, const u_char *maxbuf)
{
- u_int wcnt;
+ u_int wct, bcc;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
- wcnt = words[0];
+ wct = words[0];
if (request)
- f2 = "*|Dialect=[Z]\n";
+ f2 = "*|Dialect=[Y]\n";
else {
- if (wcnt == 1)
+ if (wct == 1)
f1 = "Core Protocol\nDialectIndex=[d]";
- else if (wcnt == 17)
+ else if (wct == 17)
f1 = "NT1 Protocol\nDialectIndex=[d]\nSecMode=[B]\nMaxMux=[d]\nNumVcs=[d]\nMaxBuffer=[D]\nRawSize=[D]\nSessionKey=[W]\nCapabilities=[W]\nServerTime=[T3]TimeZone=[d]\nCryptKey=";
- else if (wcnt == 13)
+ else if (wct == 13)
f1 = "Coreplus/Lanman1/Lanman2 Protocol\nDialectIndex=[d]\nSecMode=[w]\nMaxXMit=[d]\nMaxMux=[d]\nMaxVcs=[d]\nBlkMode=[w]\nSessionKey=[W]\nServerTime=[T1]TimeZone=[d]\nRes=[W]\nCryptKey=";
}
if (f1)
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + wcnt * 2, maxbuf));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + wct * 2, maxbuf),
+ unicodestr);
else
- print_data(words + 1, SMBMIN(wcnt * 2, PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, SMBMIN(wct * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
- if (f2)
- smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data), maxbuf));
- else
- print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ bcc = EXTRACT_LE_16BITS(data);
+ printf("smb_bcc=%u\n", bcc);
+ if (bcc > 0) {
+ if (f2)
+ smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data),
+ maxbuf), unicodestr);
+ else
+ print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ }
return;
trunc:
printf("[|SMB]");
@@ -419,35 +438,81 @@ trunc:
static void
print_sesssetup(const u_char *words, const u_char *data, const u_char *buf _U_, const u_char *maxbuf)
{
- u_int wcnt;
+ u_int wct, bcc;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
- wcnt = words[0];
+ wct = words[0];
if (request) {
- if (wcnt == 10)
+ if (wct == 10)
f1 = "Com2=[w]\nOff2=[d]\nBufSize=[d]\nMpxMax=[d]\nVcNum=[d]\nSessionKey=[W]\nPassLen=[d]\nCryptLen=[d]\nCryptOff=[d]\nPass&Name=\n";
else
f1 = "Com2=[B]\nRes1=[B]\nOff2=[d]\nMaxBuffer=[d]\nMaxMpx=[d]\nVcNumber=[d]\nSessionKey=[W]\nCaseInsensitivePasswordLength=[d]\nCaseSensitivePasswordLength=[d]\nRes=[W]\nCapabilities=[W]\nPass1&Pass2&Account&Domain&OS&LanMan=\n";
} else {
- if (wcnt == 3) {
+ if (wct == 3) {
f1 = "Com2=[w]\nOff2=[d]\nAction=[w]\n";
- } else if (wcnt == 13) {
+ } else if (wct == 13) {
f1 = "Com2=[B]\nRes=[B]\nOff2=[d]\nAction=[w]\n";
f2 = "NativeOS=[S]\nNativeLanMan=[S]\nPrimaryDomain=[S]\n";
}
}
if (f1)
- smb_fdata(words + 1, f1, SMBMIN(words + 1 + wcnt * 2, maxbuf));
+ smb_fdata(words + 1, f1, SMBMIN(words + 1 + wct * 2, maxbuf),
+ unicodestr);
else
- print_data(words + 1, SMBMIN(wcnt * 2, PTR_DIFF(maxbuf, words + 1)));
+ print_data(words + 1, SMBMIN(wct * 2, PTR_DIFF(maxbuf, words + 1)));
TCHECK2(*data, 2);
- if (f2)
- smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data), maxbuf));
- else
- print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ bcc = EXTRACT_LE_16BITS(data);
+ printf("smb_bcc=%u\n", bcc);
+ if (bcc > 0) {
+ if (f2)
+ smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data),
+ maxbuf), unicodestr);
+ else
+ print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ }
+ return;
+trunc:
+ printf("[|SMB]");
+ return;
+}
+
+static void
+print_lockingandx(const u_char *words, const u_char *data, const u_char *buf _U_, const u_char *maxbuf)
+{
+ u_int wct, bcc;
+ const u_char *maxwords;
+ const char *f1 = NULL, *f2 = NULL;
+
+ TCHECK(words[0]);
+ wct = words[0];
+ if (request) {
+ f1 = "Com2=[w]\nOff2=[d]\nHandle=[d]\nLockType=[w]\nTimeOut=[D]\nUnlockCount=[d]\nLockCount=[d]\n";
+ TCHECK(words[7]);
+ if (words[7] & 0x10)
+ f2 = "*Process=[d]\n[P2]Offset=[M]\nLength=[M]\n";
+ else
+ f2 = "*Process=[d]\nOffset=[D]\nLength=[D]\n";
+ } else {
+ f1 = "Com2=[w]\nOff2=[d]\n";
+ }
+
+ maxwords = SMBMIN(words + 1 + wct * 2, maxbuf);
+ if (wct)
+ smb_fdata(words + 1, f1, maxwords, unicodestr);
+
+ TCHECK2(*data, 2);
+ bcc = EXTRACT_LE_16BITS(data);
+ printf("smb_bcc=%u\n", bcc);
+ if (bcc > 0) {
+ if (f2)
+ smb_fdata(data + 2, f2, SMBMIN(data + 2 + EXTRACT_LE_16BITS(data),
+ maxbuf), unicodestr);
+ else
+ print_data(data + 2, SMBMIN(EXTRACT_LE_16BITS(data), PTR_DIFF(maxbuf, data + 2)));
+ }
return;
trunc:
printf("[|SMB]");
@@ -642,11 +707,6 @@ static struct smbfns smb_fns[] = {
"Com2=[w]\nOff2=[d]\nCount=[d]\nRemaining=[d]\nRes=[W]\n",
NULL, NULL } },
- { SMBlockingX, "SMBlockingX", FLG_CHAIN,
- { "Com2=[w]\nOff2=[d]\nHandle=[d]\nLockType=[w]\nTimeOut=[D]\nUnlockCount=[d]\nLockCount=[d]\n",
- "*Process=[d]\nOffset=[D]\nLength=[D]\n",
- "Com2=[w]\nOff2=[d]\n", NULL, NULL } },
-
{ SMBffirst, "SMBffirst", 0,
{ "Count=[d]\nAttrib=[A]\n",
"Path=[Z]\nBlkType=[B]\nBlkLen=[d]\n|Res1=[B]\nMask=[s11]\nSrv1=[B]\nDirIndex=[d]\nSrv2=[w]\n",
@@ -701,7 +761,10 @@ static struct smbfns smb_fns[] = {
{ SMBtconX, "SMBtconX", FLG_CHAIN,
{ "Com2=[w]\nOff2=[d]\nFlags=[w]\nPassLen=[d]\nPasswd&Path&Device=\n",
- NULL, "Com2=[w]\nOff2=[d]\n", "ServiceType=[S]\n", NULL } },
+ NULL, "Com2=[w]\nOff2=[d]\n", "ServiceType=[R]\n", NULL } },
+
+ { SMBlockingX, "SMBlockingX", FLG_CHAIN,
+ { NULL, NULL, NULL, NULL, print_lockingandx } },
{ SMBtrans2, "SMBtrans2", 0, { NULL, NULL, NULL, NULL, print_trans2 } },
@@ -714,8 +777,8 @@ static struct smbfns smb_fns[] = {
{ SMBnttranss, "SMBnttranss", 0, DEFDESCRIPT },
{ SMBntcreateX, "SMBntcreateX", FLG_CHAIN,
- { "Com2=[w]\nOff2=[d]\nRes=[b]\nNameLen=[d]\nFlags=[W]\nRootDirectoryFid=[D]\nAccessMask=[W]\nAllocationSize=[L]\nExtFileAttributes=[W]\nShareAccess=[W]\nCreateDisposition=[W]\nCreateOptions=[W]\nImpersonationLevel=[W]\nSecurityFlags=[b]\n",
- "Path=[S]\n",
+ { "Com2=[w]\nOff2=[d]\nRes=[b]\nNameLen=[ld]\nFlags=[W]\nRootDirectoryFid=[D]\nAccessMask=[W]\nAllocationSize=[L]\nExtFileAttributes=[W]\nShareAccess=[W]\nCreateDisposition=[W]\nCreateOptions=[W]\nImpersonationLevel=[W]\nSecurityFlags=[b]\n",
+ "Path=[C]\n",
"Com2=[w]\nOff2=[d]\nOplockLevel=[b]\nFid=[d]\nCreateAction=[W]\nCreateTime=[T3]LastAccessTime=[T3]LastWriteTime=[T3]ChangeTime=[T3]ExtFileAttributes=[W]\nAllocationSize=[L]\nEndOfFile=[L]\nFileType=[w]\nDeviceState=[w]\nDirectory=[b]\n",
NULL, NULL } },
@@ -731,15 +794,22 @@ static struct smbfns smb_fns[] = {
static void
print_smb(const u_char *buf, const u_char *maxbuf)
{
+ u_int16_t flags2;
+ int nterrcodes;
int command;
- const u_char *words, *data;
+ u_int32_t nterror;
+ const u_char *words, *maxwords, *data;
struct smbfns *fn;
const char *fmt_smbheader =
"[P4]SMB Command = [B]\nError class = [BP1]\nError code = [d]\nFlags1 = [B]\nFlags2 = [B][P13]\nTree ID = [d]\nProc ID = [d]\nUID = [d]\nMID = [d]\nWord Count = [b]\n";
-
+ int smboffset;
TCHECK(buf[9]);
request = (buf[9] & 0x80) ? 0 : 1;
+ flags2 = EXTRACT_LE_16BITS(&buf[10]);
+ unicodestr = flags2 & 0x8000;
+ nterrcodes = flags2 & 0x4000;
+ startbuf = buf;
command = buf[4];
@@ -754,22 +824,30 @@ print_smb(const u_char *buf, const u_char *maxbuf)
return;
/* print out the header */
- smb_fdata(buf, fmt_smbheader, buf + 33);
+ smb_fdata(buf, fmt_smbheader, buf + 33, unicodestr);
- if (buf[5])
- printf("SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(&buf[7])));
+ if (nterrcodes) {
+ nterror = EXTRACT_LE_32BITS(&buf[5]);
+ if (nterror)
+ printf("NTError = %s\n", nt_errstr(nterror));
+ } else {
+ if (buf[5])
+ printf("SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(&buf[7])));
+ }
- words = buf + 32;
- TCHECK(words[0]);
+ smboffset = 32;
for (;;) {
const char *f1, *f2;
int wct;
u_int bcc;
+ int newsmboffset;
+ words = buf + smboffset;
TCHECK(words[0]);
wct = words[0];
data = words + 1 + wct * 2;
+ maxwords = SMBMIN(data, maxbuf);
if (request) {
f1 = fn->descript.req_f1;
@@ -783,14 +861,13 @@ print_smb(const u_char *buf, const u_char *maxbuf)
(*fn->descript.fn)(words, data, buf, maxbuf);
else {
if (wct) {
- printf("smbvwv[]=\n");
if (f1)
- smb_fdata(words + 1, f1, words + 1 + wct * 2);
+ smb_fdata(words + 1, f1, words + 1 + wct * 2, unicodestr);
else {
int i;
int v;
- for (i = 0; i < wct; i++) {
+ for (i = 0; &words[1 + 2 * i] < maxwords; i++) {
TCHECK2(words[1 + 2 * i], 2);
v = EXTRACT_LE_16BITS(words + 1 + 2 * i);
printf("smb_vwv[%d]=%d (0x%X)\n", i, v, v);
@@ -800,13 +877,11 @@ print_smb(const u_char *buf, const u_char *maxbuf)
TCHECK2(*data, 2);
bcc = EXTRACT_LE_16BITS(data);
+ printf("smb_bcc=%u\n", bcc);
if (f2) {
- if (bcc > 0) {
- printf("smbbuf[]=\n");
- smb_fdata(data + 2, f2, data + 2 + bcc);
- }
+ if (bcc > 0)
+ smb_fdata(data + 2, f2, data + 2 + bcc, unicodestr);
} else {
- printf("smb_bcc=%u\n", bcc);
if (bcc > 0) {
printf("smb_buf[]=\n");
print_data(data + 2, SMBMIN(bcc, PTR_DIFF(maxbuf, data + 2)));
@@ -819,16 +894,21 @@ print_smb(const u_char *buf, const u_char *maxbuf)
if (wct == 0)
break;
TCHECK(words[1]);
- command = EXTRACT_LE_16BITS(words + 1);
+ command = words[1];
if (command == 0xFF)
break;
TCHECK2(words[3], 2);
- words = buf + EXTRACT_LE_16BITS(words + 3);
+ newsmboffset = EXTRACT_LE_16BITS(words + 3);
fn = smbfind(command, smb_fns);
printf("\nSMB PACKET: %s (%s) (CHAINED)\n",
fn->name, request ? "REQUEST" : "REPLY");
+ if (newsmboffset < smboffset) {
+ printf("Bad andX offset: %u < %u\n", newsmboffset, smboffset);
+ break;
+ }
+ smboffset = newsmboffset;
}
printf("\n");
@@ -846,52 +926,93 @@ void
nbt_tcp_print(const u_char *data, int length)
{
const u_char *maxbuf = data + length;
- int flags;
+ int type;
u_int nbt_len;
TCHECK2(data[2], 2);
- flags = data[0];
+ type = data[0];
nbt_len = EXTRACT_16BITS(data + 2);
startbuf = data;
if (maxbuf <= data)
return;
- if (vflag > 1)
- printf ("\n>>>");
+ if (vflag < 2) {
+ printf(" NBT Session Packet: ");
+ switch (type) {
+ case 0x00:
+ printf("Session Message");
+ break;
- printf(" NBT Packet");
+ case 0x81:
+ printf("Session Request");
+ break;
- if (vflag < 2)
- return;
+ case 0x82:
+ printf("Session Granted");
+ break;
- printf("\n");
+ case 0x83:
+ {
+ int ecode;
+
+ TCHECK(data[4]);
+ ecode = data[4];
- switch (flags) {
- case 1:
- printf("flags=0x%x\n", flags);
- case 0:
- data = smb_fdata(data, "NBT Session Packet\nFlags=[rw]\nLength=[rd]\n",
- data + 4);
- if (data == NULL)
+ printf("Session Reject, ");
+ switch (ecode) {
+ case 0x80:
+ printf("Not listening on called name");
+ break;
+ case 0x81:
+ printf("Not listening for calling name");
+ break;
+ case 0x82:
+ printf("Called name not present");
+ break;
+ case 0x83:
+ printf("Called name present, but insufficient resources");
+ break;
+ default:
+ printf("Unspecified error 0x%X", ecode);
+ break;
+ }
+ }
+ break;
+
+ case 0x85:
+ printf("Session Keepalive");
+ break;
+
+ default:
+ data = smb_fdata(data, "Unknown packet type [rB]", maxbuf, 0);
+ break;
+ }
+ } else {
+ printf ("\n>>> NBT Session Packet\n");
+ switch (type) {
+ case 0x00:
+ data = smb_fdata(data, "[P1]NBT Session Message\nFlags=[B]\nLength=[rd]\n",
+ data + 4, 0);
+ if (data == NULL)
+ break;
+ if (memcmp(data,"\377SMB",4) == 0) {
+ if (nbt_len > PTR_DIFF(maxbuf, data))
+ printf("WARNING: Short packet. Try increasing the snap length (%lu)\n",
+ (unsigned long)PTR_DIFF(maxbuf, data));
+ print_smb(data, maxbuf > data + nbt_len ? data + nbt_len : maxbuf);
+ } else
+ printf("Session packet:(raw data?)\n");
break;
- if (memcmp(data,"\377SMB",4) == 0) {
- if (nbt_len > PTR_DIFF(maxbuf, data))
- printf("WARNING: Short packet. Try increasing the snap length (%lu)\n",
- (unsigned long)PTR_DIFF(maxbuf, data));
- print_smb(data, maxbuf > data + nbt_len ? data + nbt_len : maxbuf);
- } else
- printf("Session packet:(raw data?)\n");
- break;
case 0x81:
data = smb_fdata(data,
- "NBT Session Request\nFlags=[rW]\nDestination=[n1]\nSource=[n1]\n",
- maxbuf);
+ "[P1]NBT Session Request\nFlags=[B]\nLength=[rd]\nDestination=[n1]\nSource=[n1]\n",
+ maxbuf, 0);
break;
case 0x82:
- data = smb_fdata(data, "NBT Session Granted\nFlags=[rW]\n", maxbuf);
+ data = smb_fdata(data, "[P1]NBT Session Granted\nFlags=[B]\nLength=[rd]\n", maxbuf, 0);
break;
case 0x83:
@@ -901,8 +1022,8 @@ nbt_tcp_print(const u_char *data, int length)
TCHECK(data[4]);
ecode = data[4];
- data = smb_fdata(data, "NBT SessionReject\nFlags=[rW]\nReason=[B]\n",
- maxbuf);
+ data = smb_fdata(data, "[P1]NBT SessionReject\nFlags=[B]\nLength=[rd]\nReason=[B]\n",
+ maxbuf, 0);
switch (ecode) {
case 0x80:
printf("Not listening on called name\n");
@@ -924,15 +1045,16 @@ nbt_tcp_print(const u_char *data, int length)
break;
case 0x85:
- data = smb_fdata(data, "NBT Session Keepalive\nFlags=[rW]\n", maxbuf);
+ data = smb_fdata(data, "[P1]NBT Session Keepalive\nFlags=[B]\nLength=[rd]\n", maxbuf, 0);
break;
default:
- printf("flags=0x%x\n", flags);
- data = smb_fdata(data, "NBT - Unknown packet type\nType=[rW]\n", maxbuf);
+ data = smb_fdata(data, "NBT - Unknown packet type\nType=[B]\n", maxbuf, 0);
+ break;
+ }
+ printf("\n");
+ fflush(stdout);
}
- printf("\n");
- fflush(stdout);
return;
trunc:
printf("[|SMB]");
@@ -1022,7 +1144,7 @@ nbt_udp137_print(const u_char *data, int length)
for (i = 0; i < qdcount; i++)
p = smb_fdata(p,
"|Name=[n1]\nQuestionType=[rw]\nQuestionClass=[rw]\n#",
- maxbuf);
+ maxbuf, 0);
if (p == NULL)
goto out;
}
@@ -1033,18 +1155,18 @@ nbt_udp137_print(const u_char *data, int length)
int rdlen;
int restype;
- p = smb_fdata(p, "Name=[n1]\n#", maxbuf);
+ p = smb_fdata(p, "Name=[n1]\n#", maxbuf, 0);
if (p == NULL)
goto out;
restype = EXTRACT_16BITS(p);
- p = smb_fdata(p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8);
+ p = smb_fdata(p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8, 0);
if (p == NULL)
goto out;
rdlen = EXTRACT_16BITS(p);
printf("ResourceLength=%d\nResourceData=\n", rdlen);
p += 2;
if (rdlen == 6) {
- p = smb_fdata(p, "AddrType=[rw]\nAddress=[b.b.b.b]\n", p + rdlen);
+ p = smb_fdata(p, "AddrType=[rw]\nAddress=[b.b.b.b]\n", p + rdlen, 0);
if (p == NULL)
goto out;
} else {
@@ -1053,11 +1175,11 @@ nbt_udp137_print(const u_char *data, int length)
TCHECK(*p);
numnames = p[0];
- p = smb_fdata(p, "NumNames=[B]\n", p + 1);
+ p = smb_fdata(p, "NumNames=[B]\n", p + 1, 0);
if (p == NULL)
goto out;
while (numnames--) {
- p = smb_fdata(p, "Name=[n2]\t#", maxbuf);
+ p = smb_fdata(p, "Name=[n2]\t#", maxbuf, 0);
TCHECK(*p);
if (p[0] & 0x80)
printf("<GROUP> ");
@@ -1087,7 +1209,7 @@ nbt_udp137_print(const u_char *data, int length)
}
if (p < maxbuf)
- smb_fdata(p, "AdditionalData:\n", maxbuf);
+ smb_fdata(p, "AdditionalData:\n", maxbuf, 0);
out:
printf("\n");
@@ -1121,7 +1243,7 @@ nbt_udp138_print(const u_char *data, int length)
data = smb_fdata(data,
"\n>>> NBT UDP PACKET(138) Res=[rw] ID=[rw] IP=[b.b.b.b] Port=[rd] Length=[rd] Res2=[rw]\nSourceName=[n1]\nDestName=[n1]\n#",
- maxbuf);
+ maxbuf, 0);
if (data != NULL) {
/* If there isn't enough data for "\377SMB", don't check for it. */
@@ -1140,6 +1262,61 @@ out:
/*
print netbeui frames
*/
+struct nbf_strings {
+ const char *name;
+ const char *nonverbose;
+ const char *verbose;
+} nbf_strings[0x20] = {
+ { "Add Group Name Query", ", [P23]Name to add=[n2]#",
+ "[P5]ResponseCorrelator=[w]\n[P16]Name to add=[n2]\n" },
+ { "Add Name Query", ", [P23]Name to add=[n2]#",
+ "[P5]ResponseCorrelator=[w]\n[P16]Name to add=[n2]\n" },
+ { "Name In Conflict", NULL, NULL },
+ { "Status Query", NULL, NULL },
+ { NULL, NULL, NULL }, /* not used */
+ { NULL, NULL, NULL }, /* not used */
+ { NULL, NULL, NULL }, /* not used */
+ { "Terminate Trace", NULL, NULL },
+ { "Datagram", NULL,
+ "[P7]Destination=[n2]\nSource=[n2]\n" },
+ { "Broadcast Datagram", NULL,
+ "[P7]Destination=[n2]\nSource=[n2]\n" },
+ { "Name Query", ", [P7]Name=[n2]#",
+ "[P1]SessionNumber=[B]\nNameType=[B][P2]\nResponseCorrelator=[w]\nName=[n2]\nName of sender=[n2]\n" },
+ { NULL, NULL, NULL }, /* not used */
+ { NULL, NULL, NULL }, /* not used */
+ { "Add Name Response", ", [P1]GroupName=[w] [P4]Destination=[n2] Source=[n2]#",
+ "AddNameInProcess=[B]\nGroupName=[w]\nTransmitCorrelator=[w][P2]\nDestination=[n2]\nSource=[n2]\n" },
+ { "Name Recognized", NULL,
+ "[P1]Data2=[w]\nTransmitCorrelator=[w]\nResponseCorelator=[w]\nDestination=[n2]\nSource=[n2]\n" },
+ { "Status Response", NULL, NULL },
+ { NULL, NULL, NULL }, /* not used */
+ { NULL, NULL, NULL }, /* not used */
+ { NULL, NULL, NULL }, /* not used */
+ { "Terminate Trace", NULL, NULL },
+ { "Data Ack", NULL,
+ "[P3]TransmitCorrelator=[w][P2]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Data First/Middle", NULL,
+ "Flags=[{RECEIVE_CONTINUE|NO_ACK||PIGGYBACK_ACK_INCLUDED|}]\nResyncIndicator=[w][P2]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Data Only/Last", NULL,
+ "Flags=[{|NO_ACK|PIGGYBACK_ACK_ALLOWED|PIGGYBACK_ACK_INCLUDED|}]\nResyncIndicator=[w][P2]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Session Confirm", NULL,
+ "Data1=[B]\nData2=[w]\nTransmitCorrelator=[w]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Session End", NULL,
+ "[P1]Data2=[w][P4]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Session Initialize", NULL,
+ "Data1=[B]\nData2=[w]\nTransmitCorrelator=[w]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "No Receive", NULL,
+ "Flags=[{|SEND_NO_ACK}]\nDataBytesAccepted=[b][P4]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Receive Outstanding", NULL,
+ "[P1]DataBytesAccepted=[b][P4]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { "Receive Continue", NULL,
+ "[P2]TransmitCorrelator=[w]\n[P2]RemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n" },
+ { NULL, NULL, NULL }, /* not used */
+ { NULL, NULL, NULL }, /* not used */
+ { "Session Alive", NULL, NULL }
+};
+
void
netbeui_print(u_short control, const u_char *data, int length)
{
@@ -1163,69 +1340,37 @@ netbeui_print(u_short control, const u_char *data, int length)
startbuf = data;
if (vflag < 2) {
- printf("NetBeui Packet");
- return;
+ printf("NBF Packet: ");
+ data = smb_fdata(data, "[P5]#", maxbuf, 0);
+ } else {
+ printf("\n>>> NBF Packet\nType=0x%X ", control);
+ data = smb_fdata(data, "Length=[d] Signature=[w] Command=[B]\n#", maxbuf, 0);
}
-
- printf("\n>>> NetBeui Packet\nType=0x%X ", control);
- data = smb_fdata(data, "Length=[d] Signature=[w] Command=[B]\n#", maxbuf);
if (data == NULL)
goto out;
- switch (command) {
- case 0xA:
- data = smb_fdata(data, "NameQuery:[P1]\nSessionNumber=[B]\nNameType=[B][P2]\nResponseCorrelator=[w]\nDestination=[n2]\nSource=[n2]\n", data2);
- break;
-
- case 0x8:
- data = smb_fdata(data,
- "NetbiosDataGram:[P7]\nDestination=[n2]\nSource=[n2]\n", data2);
- break;
-
- case 0xE:
- data = smb_fdata(data,
- "NameRecognise:\n[P1]\nData2=[w]\nTransmitCorrelator=[w]\nResponseCorelator=[w]\nDestination=[n2]\nSource=[n2]\n",
- data2);
- break;
-
- case 0x19:
- data = smb_fdata(data,
- "SessionInitialise:\nData1=[B]\nData2=[w]\nTransmitCorrelator=[w]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n",
- data2);
- break;
-
- case 0x17:
- data = smb_fdata(data,
- "SessionConfirm:\nData1=[B]\nData2=[w]\nTransmitCorrelator=[w]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n",
- data2);
- break;
-
- case 0x16:
- data = smb_fdata(data,
- "NetbiosDataOnlyLast:\nFlags=[{|NO_ACK|PIGGYBACK_ACK_ALLOWED|PIGGYBACK_ACK_INCLUDED|}]\nResyncIndicator=[w][P2]\nResponseCorelator=[w]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n",
- data2);
- break;
-
- case 0x14:
- data = smb_fdata(data,
- "NetbiosDataAck:\n[P3]TransmitCorrelator=[w][P2]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n",
- data2);
- break;
-
- case 0x18:
- data = smb_fdata(data,
- "SessionEnd:\n[P1]Data2=[w][P4]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n",
- data2);
- break;
+ if (command > 0x1f || nbf_strings[command].name == NULL) {
+ if (vflag < 2)
+ data = smb_fdata(data, "Unknown NBF Command#", data2, 0);
+ else
+ data = smb_fdata(data, "Unknown NBF Command\n", data2, 0);
+ } else {
+ if (vflag < 2) {
+ printf("%s", nbf_strings[command].name);
+ if (nbf_strings[command].nonverbose != NULL)
+ data = smb_fdata(data, nbf_strings[command].nonverbose, data2, 0);
+ } else {
+ printf("%s:\n", nbf_strings[command].name);
+ if (nbf_strings[command].verbose != NULL)
+ data = smb_fdata(data, nbf_strings[command].verbose, data2, 0);
+ else
+ printf("\n");
+ }
+ }
- case 0x1f:
- data = smb_fdata(data, "SessionAlive\n", data2);
- break;
+ if (vflag < 2)
+ return;
- default:
- data = smb_fdata(data, "Unknown Netbios Command ", data2);
- break;
- }
if (data == NULL)
goto out;
@@ -1234,6 +1379,11 @@ netbeui_print(u_short control, const u_char *data, int length)
goto out;
}
+ /* If this isn't a command that would contain an SMB message, quit. */
+ if (command != 0x08 && command != 0x09 && command != 0x15 &&
+ command != 0x16)
+ goto out;
+
/* If there isn't enough data for "\377SMB", don't look for it. */
if (&data2[3] >= maxbuf)
goto out;
@@ -1284,7 +1434,7 @@ ipx_netbios_print(const u_char *data, u_int length)
if (&data[i + 4] > maxbuf)
break;
if (memcmp(&data[i], "\377SMB", 4) == 0) {
- smb_fdata(data, "\n>>> IPX transport ", &data[i]);
+ smb_fdata(data, "\n>>> IPX transport ", &data[i], 0);
if (data != NULL)
print_smb(&data[i], maxbuf);
printf("\n");
@@ -1293,5 +1443,5 @@ ipx_netbios_print(const u_char *data, u_int length)
}
}
if (i == 128)
- smb_fdata(data, "\n>>> Unknown IPX ", maxbuf);
+ smb_fdata(data, "\n>>> Unknown IPX ", maxbuf, 0);
}
diff --git a/contrib/tcpdump/print-snmp.c b/contrib/tcpdump/print-snmp.c
index e1db2166bc4e..4758ac2b5398 100644
--- a/contrib/tcpdump/print-snmp.c
+++ b/contrib/tcpdump/print-snmp.c
@@ -58,7 +58,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.56.2.3 2004/03/23 06:59:59 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.62 2005/01/05 04:05:04 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -77,6 +77,8 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "addrtoname.h"
+#undef OPAQUE /* defined in <wingdi.h> */
+
/*
* Universal ASN.1 types
* (we only care about the tag values for those allowed in the Internet SMI)
@@ -393,13 +395,6 @@ const char *SnmpVersion[] = {
#define ASN_ID_EXT 0x1f /* extension ID in tag field */
/*
- * truncated==1 means the packet was complete, but we don't have all of
- * it to decode.
- */
-static int truncated;
-#define ifNotTruncated if (truncated) fputs("[|snmp]", stdout); else
-
-/*
* This decodes the next ASN.1 object in the stream pointed to by "p"
* (and of real-length "len") and stores the intermediate data in the
* provided BE object.
@@ -416,9 +411,10 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
elem->asnlen = 0;
elem->type = BE_ANY;
if (len < 1) {
- ifNotTruncated fputs("[nothing to parse]", stdout);
+ fputs("[nothing to parse]", stdout);
return -1;
}
+ TCHECK(*p);
/*
* it would be nice to use a bit field, but you can't depend on them.
@@ -442,52 +438,66 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
p++; len--; hdr = 1;
/* extended tag field */
if (id == ASN_ID_EXT) {
- for (id = 0; *p & ASN_BIT8 && len > 0; len--, hdr++, p++)
+ /*
+ * The ID follows, as a sequence of octets with the
+ * 8th bit set and the remaining 7 bits being
+ * the next 7 bits of the value, terminated with
+ * an octet with the 8th bit not set.
+ *
+ * First, assemble all the octets with the 8th
+ * bit set. XXX - this doesn't handle a value
+ * that won't fit in 32 bits.
+ */
+ for (id = 0; *p & ASN_BIT8; len--, hdr++, p++) {
+ if (len < 1) {
+ fputs("[Xtagfield?]", stdout);
+ return -1;
+ }
+ TCHECK(*p);
id = (id << 7) | (*p & ~ASN_BIT8);
- if (len == 0 && *p & ASN_BIT8) {
- ifNotTruncated fputs("[Xtagfield?]", stdout);
+ }
+ if (len < 1) {
+ fputs("[Xtagfield?]", stdout);
return -1;
}
+ TCHECK(*p);
elem->id = id = (id << 7) | *p;
--len;
++hdr;
++p;
}
if (len < 1) {
- ifNotTruncated fputs("[no asnlen]", stdout);
+ fputs("[no asnlen]", stdout);
return -1;
}
+ TCHECK(*p);
elem->asnlen = *p;
p++; len--; hdr++;
if (elem->asnlen & ASN_BIT8) {
u_int32_t noct = elem->asnlen % ASN_BIT8;
elem->asnlen = 0;
if (len < noct) {
- ifNotTruncated printf("[asnlen? %d<%d]", len, noct);
+ printf("[asnlen? %d<%d]", len, noct);
return -1;
}
+ TCHECK2(*p, noct);
for (; noct-- > 0; len--, hdr++)
elem->asnlen = (elem->asnlen << ASN_SHIFT8) | *p++;
}
if (len < elem->asnlen) {
- if (!truncated) {
- printf("[len%d<asnlen%u]", len, elem->asnlen);
- return -1;
- }
- /* maybe should check at least 4? */
- elem->asnlen = len;
+ printf("[len%d<asnlen%u]", len, elem->asnlen);
+ return -1;
}
if (form >= sizeof(Form)/sizeof(Form[0])) {
- ifNotTruncated printf("[form?%d]", form);
+ printf("[form?%d]", form);
return -1;
}
if (class >= sizeof(Class)/sizeof(Class[0])) {
- ifNotTruncated printf("[class?%c/%d]", *Form[form], class);
+ printf("[class?%c/%d]", *Form[form], class);
return -1;
}
if ((int)id >= Class[class].numIDs) {
- ifNotTruncated printf("[id?%c/%s/%d]", *Form[form],
- Class[class].name, id);
+ printf("[id?%c/%s/%d]", *Form[form], Class[class].name, id);
return -1;
}
@@ -506,6 +516,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
elem->type = BE_INT;
data = 0;
+ TCHECK2(*p, elem->asnlen);
if (*p & ASN_BIT8) /* negative */
data = -1;
for (i = elem->asnlen; i-- > 0; p++)
@@ -544,6 +555,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
case GAUGE:
case TIMETICKS: {
register u_int32_t data;
+ TCHECK2(*p, elem->asnlen);
elem->type = BE_UNS;
data = 0;
for (i = elem->asnlen; i-- > 0; p++)
@@ -554,6 +566,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
case COUNTER64: {
register u_int32_t high, low;
+ TCHECK2(*p, elem->asnlen);
elem->type = BE_UNS64;
high = 0, low = 0;
for (i = elem->asnlen; i-- > 0; p++) {
@@ -595,10 +608,11 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
break;
default:
- elem->type = BE_OCTET;
- elem->data.raw = (caddr_t)p;
printf("[P/%s/%s]",
Class[class].name, Class[class].Id[id]);
+ TCHECK2(*p, elem->asnlen);
+ elem->type = BE_OCTET;
+ elem->data.raw = (caddr_t)p;
break;
}
break;
@@ -637,6 +651,10 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
p += elem->asnlen;
len -= elem->asnlen;
return elem->asnlen + hdr;
+
+trunc:
+ fputs("[|snmp]", stdout);
+ return -1;
}
/*
@@ -644,7 +662,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
* This used to be an integral part of asn1_parse() before the intermediate
* BE form was added.
*/
-static void
+static int
asn1_print(struct be *elem)
{
u_char *p = (u_char *)elem->data.raw;
@@ -654,6 +672,7 @@ asn1_print(struct be *elem)
switch (elem->type) {
case BE_OCTET:
+ TCHECK2(*p, asnlen);
for (i = asnlen; i-- > 0; p++)
printf("_%.2x", *p);
break;
@@ -662,13 +681,14 @@ asn1_print(struct be *elem)
break;
case BE_OID: {
- int o = 0, first = -1, i = asnlen;
+ int o = 0, first = -1, i = asnlen;
if (!sflag && !nflag && asnlen > 2) {
struct obj_abrev *a = &obj_abrev_list[0];
+ size_t a_len = strlen(a->oid);
for (; a->node; a++) {
- if (!memcmp(a->oid, (char *)p,
- strlen(a->oid))) {
+ TCHECK2(*p, a_len);
+ if (memcmp(a->oid, (char *)p, a_len) == 0) {
objp = a->node->child;
i -= strlen(a->oid);
p += strlen(a->oid);
@@ -680,6 +700,7 @@ asn1_print(struct be *elem)
}
for (; !sflag && i-- > 0; p++) {
+ TCHECK(*p);
o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8);
if (*p & ASN_LONGLEN)
continue;
@@ -759,6 +780,7 @@ asn1_print(struct be *elem)
case BE_STR: {
register int printable = 1, first = 1;
const u_char *p = elem->data.str;
+ TCHECK2(*p, asnlen);
for (i = asnlen; printable && i-- > 0; p++)
printable = isprint(*p) || isspace(*p);
p = elem->data.str;
@@ -781,6 +803,7 @@ asn1_print(struct be *elem)
case BE_INETADDR:
if (asnlen != ASNLEN_INETADDR)
printf("[inetaddr len!=%d]", ASNLEN_INETADDR);
+ TCHECK2(*p, asnlen);
for (i = asnlen; i-- != 0; p++) {
printf((i == asnlen-1) ? "%u" : ".%u", *p);
}
@@ -805,6 +828,11 @@ asn1_print(struct be *elem)
fputs("[be!?]", stdout);
break;
}
+ return 0;
+
+trunc:
+ fputs("[|snmp]", stdout);
+ return -1;
}
#ifdef notdef
@@ -827,7 +855,8 @@ asn1_decode(u_char *p, u_int length)
i = asn1_parse(p, length, &elem);
if (i >= 0) {
fputs(" ", stdout);
- asn1_print(&elem);
+ if (asn1_print(&elem) < 0)
+ return;
if (elem.type == BE_SEQ || elem.type == BE_PDU) {
fputs(" {", stdout);
asn1_decode(elem.data.raw, elem.asnlen);
@@ -863,14 +892,16 @@ static struct smi2be smi2betab[] = {
{ SMI_BASETYPE_UNKNOWN, BE_NONE }
};
-static void smi_decode_oid(struct be *elem, unsigned int *oid,
- unsigned int oidsize, unsigned int *oidlen)
+static int
+smi_decode_oid(struct be *elem, unsigned int *oid,
+ unsigned int oidsize, unsigned int *oidlen)
{
u_char *p = (u_char *)elem->data.raw;
u_int32_t asnlen = elem->asnlen;
int o = 0, first = -1, i = asnlen;
for (*oidlen = 0; sflag && i-- > 0; p++) {
+ TCHECK(*p);
o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8);
if (*p & ASN_LONGLEN)
continue;
@@ -893,6 +924,11 @@ static void smi_decode_oid(struct be *elem, unsigned int *oid,
}
o = 0;
}
+ return 0;
+
+trunc:
+ fputs("[|snmp]", stdout);
+ return -1;
}
static int smi_check_type(SmiBasetype basetype, int be)
@@ -949,6 +985,10 @@ static int smi_check_a_range(SmiType *smiType, SmiRange *smiRange,
case SMI_BASETYPE_UNKNOWN:
ok = 1;
break;
+
+ default:
+ ok = 0;
+ break;
}
return ok;
@@ -981,16 +1021,19 @@ static int smi_check_range(SmiType *smiType, struct be *elem)
return ok;
}
-static SmiNode *smi_print_variable(struct be *elem)
+static SmiNode *smi_print_variable(struct be *elem, int *status)
{
unsigned int oid[128], oidlen;
SmiNode *smiNode = NULL;
- int i;
+ unsigned int i;
- smi_decode_oid(elem, oid, sizeof(oid)/sizeof(unsigned int), &oidlen);
+ *status = smi_decode_oid(elem, oid, sizeof(oid)/sizeof(unsigned int),
+ &oidlen);
+ if (*status < 0)
+ return NULL;
smiNode = smiGetNodeByOID(oidlen, oid);
if (! smiNode) {
- asn1_print(elem);
+ *status = asn1_print(elem);
return NULL;
}
if (vflag) {
@@ -1003,27 +1046,27 @@ static SmiNode *smi_print_variable(struct be *elem)
printf(".%u", oid[i]);
}
}
+ *status = 0;
return smiNode;
}
-static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
+static int
+smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
{
- unsigned int oid[128], oidlen;
+ unsigned int i, oid[128], oidlen;
SmiType *smiType;
SmiNamedNumber *nn;
- int i, done = 0;
+ int done = 0;
if (! smiNode || ! (smiNode->nodekind
& (SMI_NODEKIND_SCALAR | SMI_NODEKIND_COLUMN))) {
- asn1_print(elem);
- return;
+ return asn1_print(elem);
}
if (elem->type == BE_NOSUCHOBJECT
|| elem->type == BE_NOSUCHINST
|| elem->type == BE_ENDOFMIBVIEW) {
- asn1_print(elem);
- return;
+ return asn1_print(elem);
}
if (NOTIFY_CLASS(pduid) && smiNode->access < SMI_ACCESS_NOTIFY) {
@@ -1045,8 +1088,7 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
smiType = smiGetNodeType(smiNode);
if (! smiType) {
- asn1_print(elem);
- return;
+ return asn1_print(elem);
}
if (! smi_check_type(smiType->basetype, elem->type)) {
@@ -1109,8 +1151,9 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
}
if (! done) {
- asn1_print(elem);
+ return asn1_print(elem);
}
+ return 0;
}
#endif
@@ -1158,6 +1201,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length)
#ifdef LIBSMI
SmiNode *smiNode = NULL;
#endif
+ int status;
/* Sequence of varBind */
if ((count = asn1_parse(np, length, &elem)) < 0)
@@ -1202,16 +1246,18 @@ varbind_print(u_char pduid, const u_char *np, u_int length)
return;
}
#ifdef LIBSMI
- smiNode = smi_print_variable(&elem);
+ smiNode = smi_print_variable(&elem, &status);
#else
- asn1_print(&elem);
+ status = asn1_print(&elem);
#endif
+ if (status < 0)
+ return;
length -= count;
np += count;
if (pduid != GETREQ && pduid != GETNEXTREQ
&& pduid != GETBULKREQ)
- fputs("=", stdout);
+ fputs("=", stdout);
/* objVal (ANY) */
if ((count = asn1_parse(np, length, &elem)) < 0)
@@ -1220,16 +1266,19 @@ varbind_print(u_char pduid, const u_char *np, u_int length)
|| pduid == GETBULKREQ) {
if (elem.type != BE_NULL) {
fputs("[objVal!=NULL]", stdout);
- asn1_print(&elem);
+ if (asn1_print(&elem) < 0)
+ return;
}
} else {
if (elem.type != BE_NULL) {
#ifdef LIBSMI
- smi_print_value(smiNode, pduid, &elem);
+ status = smi_print_value(smiNode, pduid, &elem);
#else
- asn1_print(&elem);
+ status = asn1_print(&elem);
#endif
}
+ if (status < 0)
+ return;
}
length = vblength;
np = vbend;
@@ -1241,7 +1290,7 @@ varbind_print(u_char pduid, const u_char *np, u_int length)
* GetBulk, Inform, V2Trap, and Report
*/
static void
-snmppdu_print(u_char pduid, const u_char *np, u_int length)
+snmppdu_print(u_short pduid, const u_char *np, u_int length)
{
struct be elem;
int count = 0, error;
@@ -1336,7 +1385,8 @@ trappdu_print(const u_char *np, u_int length)
asn1_print(&elem);
return;
}
- asn1_print(&elem);
+ if (asn1_print(&elem) < 0)
+ return;
length -= count;
np += count;
@@ -1350,7 +1400,8 @@ trappdu_print(const u_char *np, u_int length)
asn1_print(&elem);
return;
}
- asn1_print(&elem);
+ if (asn1_print(&elem) < 0)
+ return;
length -= count;
np += count;
@@ -1396,7 +1447,8 @@ trappdu_print(const u_char *np, u_int length)
asn1_print(&elem);
return;
}
- asn1_print(&elem);
+ if (asn1_print(&elem) < 0)
+ return;
length -= count;
np += count;
@@ -1425,7 +1477,8 @@ pdu_print(const u_char *np, u_int length, int version)
if (vflag) {
fputs("{ ", stdout);
}
- asn1_print(&pdu);
+ if (asn1_print(&pdu) < 0)
+ return;
fputs(" ", stdout);
/* descend into PDU */
length = pdu.asnlen;
@@ -1789,14 +1842,6 @@ snmp_print(const u_char *np, u_int length)
int count = 0;
int version = 0;
- truncated = 0;
-
- /* truncated packet? */
- if (np + length > snapend) {
- truncated = 1;
- length = snapend - np;
- }
-
putchar(' ');
/* initial Sequence */
diff --git a/contrib/tcpdump/print-stp.c b/contrib/tcpdump/print-stp.c
index 7b28070d48eb..a13f24e0de5c 100644
--- a/contrib/tcpdump/print-stp.c
+++ b/contrib/tcpdump/print-stp.c
@@ -11,7 +11,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.11.2.2 2003/11/16 08:51:46 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.13 2003/11/16 09:36:38 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-sunatm.c b/contrib/tcpdump/print-sunatm.c
index 10be48708ede..acd38bf7eeb8 100644
--- a/contrib/tcpdump/print-sunatm.c
+++ b/contrib/tcpdump/print-sunatm.c
@@ -31,7 +31,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sunatm.c,v 1.5.2.2 2003/11/16 08:51:47 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sunatm.c,v 1.8 2004/03/17 23:24:38 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -66,7 +66,7 @@ struct rtentry;
/*
* This is the top level routine of the printer. 'p' points
* to the SunATM pseudo-header for the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
diff --git a/contrib/tcpdump/print-sunrpc.c b/contrib/tcpdump/print-sunrpc.c
index 3ac556a287cb..8fa733c8fceb 100644
--- a/contrib/tcpdump/print-sunrpc.c
+++ b/contrib/tcpdump/print-sunrpc.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.43.2.2 2003/11/16 08:51:47 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.46 2004/12/27 00:41:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,13 +30,12 @@ static const char rcsid[] _U_ =
#include <tcpdump-stdinc.h>
+#ifdef HAVE_GETRPCBYNUMBER
#include <rpc/rpc.h>
#ifdef HAVE_RPC_RPCENT_H
#include <rpc/rpcent.h>
-#endif
-#ifndef WIN32
-#include <rpc/pmap_prot.h>
-#endif /* WIN32 */
+#endif /* HAVE_RPC_RPCENT_H */
+#endif /* HAVE_GETRPCBYNUMBER */
#include <stdio.h>
#include <string.h>
@@ -50,6 +49,10 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
+#include "rpc_auth.h"
+#include "rpc_msg.h"
+#include "pmap_prot.h"
+
static struct tok proc2str[] = {
{ PMAPPROC_NULL, "null" },
{ PMAPPROC_SET, "set" },
@@ -67,7 +70,7 @@ void
sunrpcrequest_print(register const u_char *bp, register u_int length,
register const u_char *bp2)
{
- register const struct rpc_msg *rp;
+ register const struct sunrpc_msg *rp;
register const struct ip *ip;
#ifdef INET6
register const struct ip6_hdr *ip6;
@@ -75,7 +78,7 @@ sunrpcrequest_print(register const u_char *bp, register u_int length,
u_int32_t x;
char srcid[20], dstid[20]; /*fits 32bit*/
- rp = (struct rpc_msg *)bp;
+ rp = (struct sunrpc_msg *)bp;
if (!nflag) {
snprintf(srcid, sizeof(srcid), "0x%x",
@@ -133,7 +136,7 @@ static char *
progstr(prog)
u_int32_t prog;
{
-#ifndef WIN32
+#ifdef HAVE_GETRPCBYNUMBER
register struct rpcent *rp;
#endif
static char buf[32];
@@ -141,12 +144,12 @@ progstr(prog)
if (lastprog != 0 && prog == lastprog)
return (buf);
-#ifndef WIN32
+#ifdef HAVE_GETRPCBYNUMBER
rp = getrpcbynumber(prog);
if (rp == NULL)
-#endif /* WIN32 */
+#endif
(void) snprintf(buf, sizeof(buf), "#%u", prog);
-#ifndef WIN32
+#ifdef HAVE_GETRPCBYNUMBER
else
strlcpy(buf, rp->r_name, sizeof(buf));
#endif
diff --git a/contrib/tcpdump/print-symantec.c b/contrib/tcpdump/print-symantec.c
new file mode 100644
index 000000000000..652bbb65ba75
--- /dev/null
+++ b/contrib/tcpdump/print-symantec.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (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, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-symantec.c,v 1.4 2004/04/05 00:13:59 mcr Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <pcap.h>
+
+#include "interface.h"
+#include "addrtoname.h"
+#include "ethertype.h"
+
+#include "ether.h"
+
+struct symantec_header {
+ u_int8_t stuff1[6];
+ u_int16_t ether_type;
+ u_int8_t stuff2[36];
+};
+
+static inline void
+symantec_hdr_print(register const u_char *bp, u_int length)
+{
+ register const struct symantec_header *sp;
+ u_int16_t etype;
+
+ sp = (const struct symantec_header *)bp;
+
+ etype = ntohs(sp->ether_type);
+ if (!qflag) {
+ if (etype <= ETHERMTU)
+ (void)printf("invalid ethertype %u", etype);
+ else
+ (void)printf("ethertype %s (0x%04x)",
+ tok2str(ethertype_values,"Unknown", etype),
+ etype);
+ } else {
+ if (etype <= ETHERMTU)
+ (void)printf("invalid ethertype %u", etype);
+ else
+ (void)printf("%s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", etype));
+ }
+
+ (void)printf(", length %u: ", length);
+}
+
+/*
+ * This is the top level routine of the printer. 'p' points
+ * to the ether header of the packet, 'h->ts' is the timestamp,
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
+ * is the number of bytes actually captured.
+ */
+u_int
+symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
+{
+ u_int length = h->len;
+ u_int caplen = h->caplen;
+ struct symantec_header *sp;
+ u_short ether_type;
+ u_short extracted_ether_type;
+
+ if (caplen < sizeof (struct symantec_header)) {
+ printf("[|symantec]");
+ return caplen;
+ }
+
+ if (eflag)
+ symantec_hdr_print(p, length);
+
+ length -= sizeof (struct symantec_header);
+ caplen -= sizeof (struct symantec_header);
+ sp = (struct symantec_header *)p;
+ p += sizeof (struct symantec_header);
+
+ ether_type = ntohs(sp->ether_type);
+
+ if (ether_type <= ETHERMTU) {
+ /* ether_type not known, print raw packet */
+ if (!eflag)
+ symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
+
+ if (!xflag && !qflag)
+ default_print(p, caplen);
+ } else if (ether_encap_print(ether_type, p, length, caplen,
+ &extracted_ether_type) == 0) {
+ /* ether_type not known, print raw packet */
+ if (!eflag)
+ symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
+
+ if (!xflag && !qflag)
+ default_print(p, caplen);
+ }
+
+ return (sizeof (struct symantec_header));
+}
diff --git a/contrib/tcpdump/print-syslog.c b/contrib/tcpdump/print-syslog.c
new file mode 100755
index 000000000000..099d027b2580
--- /dev/null
+++ b/contrib/tcpdump/print-syslog.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 1998-2004 Hannes Gredler <hannes@tcpdump.org>
+ * 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.
+ */
+
+#ifndef lint
+static const char rcsid[] _U_ =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-syslog.c,v 1.1 2004/10/29 11:42:53 hannes Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "interface.h"
+#include "extract.h"
+#include "addrtoname.h"
+
+/*
+ * tokenlists and #defines taken from Ethereal - Network traffic analyzer
+ * by Gerald Combs <gerald@ethereal.com>
+ */
+
+#define SYSLOG_SEVERITY_MASK 0x0007 /* 0000 0000 0000 0111 */
+#define SYSLOG_FACILITY_MASK 0x03f8 /* 0000 0011 1111 1000 */
+#define SYSLOG_MAX_DIGITS 3 /* The maximum number if priority digits to read in. */
+
+static const struct tok syslog_severity_values[] = {
+ { 0, "emergency" },
+ { 1, "alert" },
+ { 2, "critical" },
+ { 3, "error" },
+ { 4, "warning" },
+ { 5, "notice" },
+ { 6, "info" },
+ { 7, "debug" },
+ { 0, NULL },
+};
+
+static const struct tok syslog_facility_values[] = {
+ { 0, "kernel" },
+ { 1, "user" },
+ { 2, "mail" },
+ { 3, "daemon" },
+ { 4, "auth" },
+ { 5, "syslog" },
+ { 6, "lpr" },
+ { 7, "news" },
+ { 8, "uucp" },
+ { 9, "cron" },
+ { 10, "authpriv" },
+ { 11, "ftp" },
+ { 12, "ntp" },
+ { 13, "security" },
+ { 14, "console" },
+ { 15, "cron" },
+ { 16, "local0" },
+ { 17, "local1" },
+ { 18, "local2" },
+ { 19, "local3" },
+ { 20, "local4" },
+ { 21, "local5" },
+ { 22, "local6" },
+ { 23, "local7" },
+ { 0, NULL },
+};
+
+void
+syslog_print(register const u_char *pptr, register u_int len)
+{
+ u_int16_t msg_off = 0;
+ u_int16_t pri = 0;
+ u_int16_t facility,severity;
+
+ /* extract decimal figures that are
+ * encapsulated within < > tags
+ * based on this decimal figure extract the
+ * severity and facility values
+ */
+
+ if (!TTEST2(*pptr, 1))
+ goto trunc;
+
+ if (*(pptr+msg_off) == '<') {
+ msg_off++;
+
+ if (!TTEST2(*(pptr+msg_off), 1))
+ goto trunc;
+
+ while ( *(pptr+msg_off) >= '0' &&
+ *(pptr+msg_off) <= '9' &&
+ msg_off <= SYSLOG_MAX_DIGITS) {
+
+ if (!TTEST2(*(pptr+msg_off), 1))
+ goto trunc;
+
+ pri = pri * 10 + (*(pptr+msg_off) - '0');
+ msg_off++;
+
+ if (!TTEST2(*(pptr+msg_off), 1))
+ goto trunc;
+
+ if (*(pptr+msg_off) == '>')
+ msg_off++;
+ }
+ } else {
+ printf("[|syslog]");
+ return;
+ }
+
+ facility = (pri & SYSLOG_FACILITY_MASK) >> 3;
+ severity = pri & SYSLOG_SEVERITY_MASK;
+
+
+ if (vflag < 1 )
+ {
+ printf("SYSLOG %s.%s, length: %u",
+ tok2str(syslog_facility_values, "unknown (%u)", facility),
+ tok2str(syslog_severity_values, "unknown (%u)", severity),
+ len);
+ return;
+ }
+
+ printf("SYSLOG, length: %u\n\tFacility %s (%u), Severity %s (%u)\n\tMsg: ",
+ len,
+ tok2str(syslog_facility_values, "unknown (%u)", facility),
+ facility,
+ tok2str(syslog_severity_values, "unknown (%u)", severity),
+ severity);
+
+ /* print the syslog text in verbose mode */
+ for (; msg_off < len; msg_off++) {
+ if (!TTEST2(*(pptr+msg_off), 1))
+ goto trunc;
+ safeputchar(*(pptr+msg_off));
+ }
+
+ if (vflag > 1) {
+ if(!print_unknown_data(pptr,"\n\t",len))
+ return;
+ }
+
+ return;
+
+trunc:
+ printf("[|syslog]");
+}
diff --git a/contrib/tcpdump/print-tcp.c b/contrib/tcpdump/print-tcp.c
index 5b0b06c901f7..e51f4e9c5c17 100644
--- a/contrib/tcpdump/print-tcp.c
+++ b/contrib/tcpdump/print-tcp.c
@@ -2,6 +2,8 @@
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* The Regents of the University of California. All rights reserved.
*
+ * Copyright (c) 1999-2004 The tcpdump.org 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, (2)
@@ -21,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.107.2.3 2003/11/19 00:17:02 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.120 2005/04/06 18:53:56 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,8 +32,6 @@ static const char rcsid[] _U_ =
#include <tcpdump-stdinc.h>
-#include <rpc/rpc.h>
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -47,9 +47,22 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
#include "ipproto.h"
+#include "rpc_auth.h"
+#include "rpc_msg.h"
#include "nameser.h"
+#ifdef HAVE_LIBCRYPTO
+#include <openssl/md5.h>
+
+#define SIGNATURE_VALID 0
+#define SIGNATURE_INVALID 1
+#define CANT_CHECK_SIGNATURE 2
+
+static int tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
+ const u_char *data, int length, const u_char *rcvsig);
+#endif
+
static void print_tcp_rst_data(register const u_char *sp, u_int length);
#define MAX_RST_DATA_LEN 30
@@ -212,17 +225,18 @@ tcp_print(register const u_char *bp, register u_int length,
hlen = TH_OFF(tp) * 4;
/*
- * If data present and NFS port used, assume NFS.
+ * If data present, header length valid, and NFS port used,
+ * assume NFS.
* Pass offset of data plus 4 bytes for RPC TCP msg length
* to NFS print routines.
*/
- if (!qflag) {
- if ((u_char *)tp + 4 + sizeof(struct rpc_msg) <= snapend &&
+ if (!qflag && hlen >= sizeof(*tp) && hlen <= length) {
+ if ((u_char *)tp + 4 + sizeof(struct sunrpc_msg) <= snapend &&
dport == NFS_PORT) {
nfsreq_print((u_char *)tp + hlen + 4, length - hlen,
(u_char *)ip);
return;
- } else if ((u_char *)tp + 4 + sizeof(struct rpc_msg)
+ } else if ((u_char *)tp + 4 + sizeof(struct sunrpc_msg)
<= snapend &&
sport == NFS_PORT) {
nfsreply_print((u_char *)tp + hlen + 4, length - hlen,
@@ -257,6 +271,12 @@ tcp_print(register const u_char *bp, register u_int length,
}
}
+ if (hlen < sizeof(*tp)) {
+ (void)printf(" tcp %d [bad hdr length %u - too short, < %lu]",
+ length - hlen, hlen, (unsigned long)sizeof(*tp));
+ return;
+ }
+
TCHECK(*tp);
seq = EXTRACT_32BITS(&tp->th_seq);
@@ -265,7 +285,11 @@ tcp_print(register const u_char *bp, register u_int length,
urp = EXTRACT_16BITS(&tp->th_urp);
if (qflag) {
- (void)printf("tcp %d", length - TH_OFF(tp) * 4);
+ (void)printf("tcp %d", length - hlen);
+ if (hlen > length) {
+ (void)printf(" [bad hdr length %u - too long, > %u]",
+ hlen, length);
+ }
return;
}
if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH|
@@ -391,7 +415,8 @@ tcp_print(register const u_char *bp, register u_int length,
thseq = thack = threv = 0;
}
if (hlen > length) {
- (void)printf(" [bad hdr length]");
+ (void)printf(" [bad hdr length %u - too long, > %u]",
+ hlen, length);
return;
}
@@ -399,23 +424,27 @@ tcp_print(register const u_char *bp, register u_int length,
u_int16_t sum, tcp_sum;
if (TTEST2(tp->th_sport, length)) {
sum = tcp_cksum(ip, tp, length);
+
+ (void)printf(", cksum 0x%04x",EXTRACT_16BITS(&tp->th_sum));
if (sum != 0) {
tcp_sum = EXTRACT_16BITS(&tp->th_sum);
- (void)printf(" [bad tcp cksum %x (->%x)!]",
- tcp_sum, in_cksum_shouldbe(tcp_sum, sum));
+ (void)printf(" (incorrect (-> 0x%04x),",in_cksum_shouldbe(tcp_sum, sum));
} else
- (void)printf(" [tcp sum ok]");
+ (void)printf(" (correct),");
}
}
#ifdef INET6
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
- int sum;
+ u_int16_t sum,tcp_sum;
if (TTEST2(tp->th_sport, length)) {
sum = tcp6_cksum(ip6, tp, length);
- if (sum != 0)
- (void)printf(" [bad tcp cksum %x!]", sum);
- else
- (void)printf(" [tcp sum ok]");
+ (void)printf(", cksum 0x%04x",EXTRACT_16BITS(&tp->th_sum));
+ if (sum != 0) {
+ tcp_sum = EXTRACT_16BITS(&tp->th_sum);
+ (void)printf(" (incorrect (-> 0x%04x),",in_cksum_shouldbe(tcp_sum, sum));
+ } else
+ (void)printf(" (correct),");
+
}
}
#endif
@@ -561,6 +590,34 @@ tcp_print(register const u_char *bp, register u_int length,
(void)printf(" %u", EXTRACT_32BITS(cp));
break;
+ case TCPOPT_SIGNATURE:
+ (void)printf("md5:");
+ datalen = TCP_SIGLEN;
+ LENCHECK(datalen);
+#ifdef HAVE_LIBCRYPTO
+ switch (tcp_verify_signature(ip, tp,
+ bp + TH_OFF(tp) * 4, length, cp)) {
+
+ case SIGNATURE_VALID:
+ (void)printf("valid");
+ break;
+
+ case SIGNATURE_INVALID:
+ (void)printf("invalid");
+ break;
+
+ case CANT_CHECK_SIGNATURE:
+ (void)printf("can't check - ");
+ for (i = 0; i < TCP_SIGLEN; ++i)
+ (void)printf("%02x", cp[i]);
+ break;
+ }
+#else
+ for (i = 0; i < TCP_SIGLEN; ++i)
+ (void)printf("%02x", cp[i]);
+#endif
+ break;
+
default:
(void)printf("opt-%u:", opt);
datalen = len - 2;
@@ -623,8 +680,9 @@ tcp_print(register const u_char *bp, register u_int length,
} else if (sport == MSDP_PORT || dport == MSDP_PORT) {
msdp_print(bp, length);
}
- else if (sport == LDP_PORT || dport == LDP_PORT)
- printf(": LDP, length: %u", length);
+ else if (length > 0 && (sport == LDP_PORT || dport == LDP_PORT)) {
+ ldp_print(bp, length);
+ }
}
return;
bad:
@@ -673,3 +731,79 @@ print_tcp_rst_data(register const u_char *sp, u_int length)
}
putchar(']');
}
+
+#ifdef HAVE_LIBCRYPTO
+static int
+tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
+ const u_char *data, int length, const u_char *rcvsig)
+{
+ struct tcphdr tp1;
+ char sig[TCP_SIGLEN];
+ char zero_proto = 0;
+ MD5_CTX ctx;
+ u_int16_t savecsum, tlen;
+#ifdef INET6
+ struct ip6_hdr *ip6;
+#endif
+ u_int32_t len32;
+ u_int8_t nxt;
+
+ tp1 = *tp;
+
+ if (tcpmd5secret == NULL)
+ return (CANT_CHECK_SIGNATURE);
+
+ MD5_Init(&ctx);
+ /*
+ * Step 1: Update MD5 hash with IP pseudo-header.
+ */
+ if (IP_V(ip) == 4) {
+ MD5_Update(&ctx, (char *)&ip->ip_src, sizeof(ip->ip_src));
+ MD5_Update(&ctx, (char *)&ip->ip_dst, sizeof(ip->ip_dst));
+ MD5_Update(&ctx, (char *)&zero_proto, sizeof(zero_proto));
+ MD5_Update(&ctx, (char *)&ip->ip_p, sizeof(ip->ip_p));
+ tlen = EXTRACT_16BITS(&ip->ip_len) - IP_HL(ip) * 4;
+ tlen = htons(tlen);
+ MD5_Update(&ctx, (char *)&tlen, sizeof(tlen));
+#ifdef INET6
+ } else if (IP_V(ip) == 6) {
+ ip6 = (struct ip6_hdr *)ip;
+ MD5_Update(&ctx, (char *)&ip6->ip6_src, sizeof(ip6->ip6_src));
+ MD5_Update(&ctx, (char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst));
+ len32 = htonl(ntohs(ip6->ip6_plen));
+ MD5_Update(&ctx, (char *)&len32, sizeof(len32));
+ nxt = 0;
+ MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
+ MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
+ MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
+ nxt = IPPROTO_TCP;
+ MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
+#endif
+ } else
+ return (CANT_CHECK_SIGNATURE);
+
+ /*
+ * Step 2: Update MD5 hash with TCP header, excluding options.
+ * The TCP checksum must be set to zero.
+ */
+ savecsum = tp1.th_sum;
+ tp1.th_sum = 0;
+ MD5_Update(&ctx, (char *)&tp1, sizeof(struct tcphdr));
+ tp1.th_sum = savecsum;
+ /*
+ * Step 3: Update MD5 hash with TCP segment data, if present.
+ */
+ if (length > 0)
+ MD5_Update(&ctx, data, length);
+ /*
+ * Step 4: Update MD5 hash with shared secret.
+ */
+ MD5_Update(&ctx, tcpmd5secret, strlen(tcpmd5secret));
+ MD5_Final(sig, &ctx);
+
+ if (memcmp(rcvsig, sig, 16))
+ return (SIGNATURE_VALID);
+ else
+ return (SIGNATURE_INVALID);
+}
+#endif /* HAVE_LIBCRYPTO */
diff --git a/contrib/tcpdump/print-telnet.c b/contrib/tcpdump/print-telnet.c
index b420d35b51be..78887278bfa2 100644
--- a/contrib/tcpdump/print-telnet.c
+++ b/contrib/tcpdump/print-telnet.c
@@ -51,7 +51,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.21.2.3 2003/12/29 22:42:23 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.24 2003/12/29 11:05:10 hannes Exp $";
#endif
#include <tcpdump-stdinc.h>
diff --git a/contrib/tcpdump/print-tftp.c b/contrib/tcpdump/print-tftp.c
index 261b59487c9c..9efc0dac0ad5 100644
--- a/contrib/tcpdump/print-tftp.c
+++ b/contrib/tcpdump/print-tftp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.35.2.2 2003/11/16 08:51:50 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.37 2003/11/16 09:36:40 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-timed.c b/contrib/tcpdump/print-timed.c
index 9ad7668aecf6..3df224129f74 100644
--- a/contrib/tcpdump/print-timed.c
+++ b/contrib/tcpdump/print-timed.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-timed.c,v 1.7.2.2 2003/11/16 08:51:51 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-timed.c,v 1.9 2003/11/16 09:36:40 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-token.c b/contrib/tcpdump/print-token.c
index 74f6d8bb6940..0633578ed969 100644
--- a/contrib/tcpdump/print-token.c
+++ b/contrib/tcpdump/print-token.c
@@ -25,7 +25,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.22.2.2 2003/11/16 08:51:51 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.25 2004/03/17 23:24:38 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -185,7 +185,7 @@ token_print(const u_char *p, u_int length, u_int caplen)
/*
* This is the top level routine of the printer. 'p' points
* to the TR header of the packet, 'h->ts' is the timestamp,
- * 'h->length' is the length of the packet off the wire, and 'h->caplen'
+ * 'h->len' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
diff --git a/contrib/tcpdump/print-udp.c b/contrib/tcpdump/print-udp.c
index 6fb83f76842c..87da886c6443 100644
--- a/contrib/tcpdump/print-udp.c
+++ b/contrib/tcpdump/print-udp.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.124.2.5 2003/11/19 00:19:25 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.138 2005/04/07 00:28:17 mcr Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -35,8 +35,6 @@ static const char rcsid[] _U_ =
#endif
#include <arpa/tftp.h>
-#include <rpc/rpc.h>
-
#include <stdio.h>
#include <string.h>
@@ -52,6 +50,8 @@ static const char rcsid[] _U_ =
#include "ip6.h"
#endif
#include "ipproto.h"
+#include "rpc_auth.h"
+#include "rpc_msg.h"
#include "nameser.h"
#include "nfs.h"
@@ -468,8 +468,8 @@ udp_print(register const u_char *bp, u_int length,
return;
}
if (packettype) {
- register struct rpc_msg *rp;
- enum msg_type direction;
+ register struct sunrpc_msg *rp;
+ enum sunrpc_msg_type direction;
switch (packettype) {
@@ -484,9 +484,9 @@ udp_print(register const u_char *bp, u_int length,
break;
case PT_RPC:
- rp = (struct rpc_msg *)(up + 1);
- direction = (enum msg_type)EXTRACT_32BITS(&rp->rm_direction);
- if (direction == CALL)
+ rp = (struct sunrpc_msg *)(up + 1);
+ direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ if (direction == SUNRPC_CALL)
sunrpcrequest_print((u_char *)rp, length,
(u_char *)ip);
else
@@ -526,7 +526,7 @@ udp_print(register const u_char *bp, u_int length,
#ifdef INET6
ip6 != NULL);
#else
- FALSE);
+ 0);
#endif
break;
}
@@ -534,24 +534,24 @@ udp_print(register const u_char *bp, u_int length,
}
if (!qflag) {
- register struct rpc_msg *rp;
- enum msg_type direction;
+ register struct sunrpc_msg *rp;
+ enum sunrpc_msg_type direction;
- rp = (struct rpc_msg *)(up + 1);
+ rp = (struct sunrpc_msg *)(up + 1);
if (TTEST(rp->rm_direction)) {
- direction = (enum msg_type)EXTRACT_32BITS(&rp->rm_direction);
- if (dport == NFS_PORT && direction == CALL) {
+ direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
+ if (dport == NFS_PORT && direction == SUNRPC_CALL) {
nfsreq_print((u_char *)rp, length,
(u_char *)ip);
return;
}
- if (sport == NFS_PORT && direction == REPLY) {
+ if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
nfsreply_print((u_char *)rp, length,
(u_char *)ip);
return;
}
#ifdef notdef
- if (dport == SUNRPC_PORT && direction == CALL) {
+ if (dport == SUNRPC_PORT && direction == SUNRPC_CALL) {
sunrpcrequest_print((u_char *)rp, length, (u_char *)ip);
return;
}
@@ -568,7 +568,7 @@ udp_print(register const u_char *bp, u_int length,
}
udpipaddr_print(ip, sport, dport);
- if (IP_V(ip) == 4 && vflag && !fragmented) {
+ if (IP_V(ip) == 4 && (vflag > 1) && !fragmented) {
int sum = up->uh_sum;
if (sum == 0) {
(void)printf("[no cksum] ");
@@ -613,13 +613,15 @@ udp_print(register const u_char *bp, u_int length,
#ifdef INET6
ip6 != NULL);
#else
- FALSE);
+ 0);
#endif
- else if (ISPORT(ISAKMP_PORT))
- isakmp_print((const u_char *)(up + 1), length, bp2);
+ else if (ISPORT(ISAKMP_PORT))
+ isakmp_print(gndo, (const u_char *)(up + 1), length, bp2);
+ else if (ISPORT(ISAKMP_PORT_NATT))
+ isakmp_rfc3948_print(gndo, (const u_char *)(up + 1), length, bp2);
#if 1 /*???*/
- else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2))
- isakmp_print((const u_char *)(up + 1), length, bp2);
+ else if (ISPORT(ISAKMP_PORT_USER1) || ISPORT(ISAKMP_PORT_USER2))
+ isakmp_print(gndo, (const u_char *)(up + 1), length, bp2);
#endif
else if (ISPORT(SNMP_PORT) || ISPORT(SNMPTRAP_PORT))
snmp_print((const u_char *)(up + 1), length);
@@ -673,14 +675,29 @@ udp_print(register const u_char *bp, u_int length,
else if (ISPORT(LDP_PORT))
ldp_print((const u_char *)(up + 1), length);
else if (ISPORT(MPLS_LSP_PING_PORT))
- mpls_lsp_ping_print((const u_char *)(up + 1), length);
+ lspping_print((const u_char *)(up + 1), length);
else if (dport == BFD_CONTROL_PORT ||
dport == BFD_ECHO_PORT )
bfd_print((const u_char *)(up+1), length, dport);
+ else if (ISPORT(LMP_PORT))
+ lmp_print((const u_char *)(up + 1), length);
+ else if (ISPORT(SIP_PORT))
+ sip_print((const u_char *)(up + 1), length);
+ else if (ISPORT(SYSLOG_PORT))
+ syslog_print((const u_char *)(up + 1), length);
else
- (void)printf("UDP, length: %u",
+ (void)printf("UDP, length %u",
(u_int32_t)(ulen - sizeof(*up)));
#undef ISPORT
} else
- (void)printf("UDP, length: %u", (u_int32_t)(ulen - sizeof(*up)));
+ (void)printf("UDP, length %u", (u_int32_t)(ulen - sizeof(*up)));
}
+
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
+
diff --git a/contrib/tcpdump/print-vjc.c b/contrib/tcpdump/print-vjc.c
index f1877f213933..55b7d08b26f9 100644
--- a/contrib/tcpdump/print-vjc.c
+++ b/contrib/tcpdump/print-vjc.c
@@ -25,7 +25,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.11.2.3 2003/11/19 01:09:12 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.15 2004/03/25 03:31:17 mcr Exp $ (LBL)";
#endif
#include <tcpdump-stdinc.h>
@@ -82,7 +82,7 @@ static const char rcsid[] _U_ =
* unused argument remind us that we should fix this some day.
*/
int
-vjc_print(register const char *bp, u_short proto)
+vjc_print(register const char *bp, u_short proto _U_)
{
int i;
diff --git a/contrib/tcpdump/print-vrrp.c b/contrib/tcpdump/print-vrrp.c
index f615dfd027af..f575e4a3a3b5 100644
--- a/contrib/tcpdump/print-vrrp.c
+++ b/contrib/tcpdump/print-vrrp.c
@@ -25,7 +25,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-vrrp.c,v 1.7.2.2 2003/11/16 08:51:55 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-vrrp.c,v 1.9 2003/11/16 09:36:41 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-wb.c b/contrib/tcpdump/print-wb.c
index 678e325b2d99..e28697a6bb3a 100644
--- a/contrib/tcpdump/print-wb.c
+++ b/contrib/tcpdump/print-wb.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-wb.c,v 1.30.2.3 2004/03/24 04:06:52 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-wb.c,v 1.33 2004/03/24 04:06:28 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/print-zephyr.c b/contrib/tcpdump/print-zephyr.c
index 186960cb0e39..f50e8c92ac6c 100644
--- a/contrib/tcpdump/print-zephyr.c
+++ b/contrib/tcpdump/print-zephyr.c
@@ -20,7 +20,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.6.2.2 2003/11/16 08:51:56 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.8 2003/11/16 09:36:42 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/rpc_auth.h b/contrib/tcpdump/rpc_auth.h
new file mode 100644
index 000000000000..c72b603d1580
--- /dev/null
+++ b/contrib/tcpdump/rpc_auth.h
@@ -0,0 +1,84 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/rpc_auth.h,v 1.1 2004/12/27 00:41:32 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
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * from: @(#)auth.h 1.17 88/02/08 SMI
+ * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
+ * $FreeBSD$
+ */
+
+/*
+ * auth.h, Authentication interface.
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ *
+ * The data structures are completely opaque to the client. The client
+ * is required to pass a AUTH * to routines that create rpc
+ * "sessions".
+ */
+
+#ifndef __RPC_AUTH_H_
+#define __RPC_AUTH_H_
+
+/*
+ * Status returned from authentication check
+ */
+enum sunrpc_auth_stat {
+ SUNRPC_AUTH_OK=0,
+ /*
+ * failed at remote end
+ */
+ SUNRPC_AUTH_BADCRED=1, /* bogus credentials (seal broken) */
+ SUNRPC_AUTH_REJECTEDCRED=2, /* client should begin new session */
+ SUNRPC_AUTH_BADVERF=3, /* bogus verifier (seal broken) */
+ SUNRPC_AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
+ SUNRPC_AUTH_TOOWEAK=5, /* rejected due to security reasons */
+ /*
+ * failed locally
+ */
+ SUNRPC_AUTH_INVALIDRESP=6, /* bogus response verifier */
+ SUNRPC_AUTH_FAILED=7 /* some unknown reason */
+};
+
+/*
+ * Authentication info. Opaque to client.
+ */
+struct sunrpc_opaque_auth {
+ u_int32_t oa_flavor; /* flavor of auth */
+ u_int32_t oa_len; /* length of opaque body */
+ /* zero or more bytes of body */
+};
+
+#define SUNRPC_AUTH_NONE 0 /* no authentication */
+#define SUNRPC_AUTH_NULL 0 /* backward compatibility */
+#define SUNRPC_AUTH_UNIX 1 /* unix style (uid, gids) */
+#define SUNRPC_AUTH_SYS 1 /* forward compatibility */
+#define SUNRPC_AUTH_SHORT 2 /* short hand unix style */
+#define SUNRPC_AUTH_DES 3 /* des style (encrypted timestamps) */
+
+#endif /* !__RPC_AUTH_H_ */
diff --git a/contrib/tcpdump/rpc_msg.h b/contrib/tcpdump/rpc_msg.h
new file mode 100644
index 000000000000..ed281ce1aba2
--- /dev/null
+++ b/contrib/tcpdump/rpc_msg.h
@@ -0,0 +1,133 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/rpc_msg.h,v 1.1 2004/12/27 00:41:32 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
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ *
+ * from: @(#)rpc_msg.h 1.7 86/07/16 SMI
+ * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
+ * $FreeBSD$
+ */
+
+/*
+ * rpc_msg.h
+ * rpc message definition
+ *
+ * Copyright (C) 1984, Sun Microsystems, Inc.
+ */
+
+#ifndef __RPC_MSG_H_
+#define __RPC_MSG_H_
+
+#define SUNRPC_MSG_VERSION ((u_int32_t) 2)
+
+/*
+ * Bottom up definition of an rpc message.
+ * NOTE: call and reply use the same overall stuct but
+ * different parts of unions within it.
+ */
+
+enum sunrpc_msg_type {
+ SUNRPC_CALL=0,
+ SUNRPC_REPLY=1
+};
+
+enum sunrpc_reply_stat {
+ SUNRPC_MSG_ACCEPTED=0,
+ SUNRPC_MSG_DENIED=1
+};
+
+enum sunrpc_accept_stat {
+ SUNRPC_SUCCESS=0,
+ SUNRPC_PROG_UNAVAIL=1,
+ SUNRPC_PROG_MISMATCH=2,
+ SUNRPC_PROC_UNAVAIL=3,
+ SUNRPC_GARBAGE_ARGS=4,
+ SUNRPC_SYSTEM_ERR=5
+};
+
+enum sunrpc_reject_stat {
+ SUNRPC_RPC_MISMATCH=0,
+ SUNRPC_AUTH_ERROR=1
+};
+
+/*
+ * Reply part of an rpc exchange
+ */
+
+/*
+ * Reply to an rpc request that was rejected by the server.
+ */
+struct sunrpc_rejected_reply {
+ u_int32_t rj_stat; /* enum reject_stat */
+ union {
+ struct {
+ u_int32_t low;
+ u_int32_t high;
+ } RJ_versions;
+ u_int32_t RJ_why; /* enum auth_stat - why authentication did not work */
+ } ru;
+#define rj_vers ru.RJ_versions
+#define rj_why ru.RJ_why
+};
+
+/*
+ * Body of a reply to an rpc request.
+ */
+struct sunrpc_reply_body {
+ u_int32_t rp_stat; /* enum reply_stat */
+ struct sunrpc_rejected_reply rp_reject; /* if rejected */
+};
+
+/*
+ * Body of an rpc request call.
+ */
+struct sunrpc_call_body {
+ u_int32_t cb_rpcvers; /* must be equal to two */
+ u_int32_t cb_prog;
+ u_int32_t cb_vers;
+ u_int32_t cb_proc;
+ struct sunrpc_opaque_auth cb_cred;
+ /* followed by opaque verifier */
+};
+
+/*
+ * The rpc message
+ */
+struct sunrpc_msg {
+ u_int32_t rm_xid;
+ u_int32_t rm_direction; /* enum msg_type */
+ union {
+ struct sunrpc_call_body RM_cmb;
+ struct sunrpc_reply_body RM_rmb;
+ } ru;
+#define rm_call ru.RM_cmb
+#define rm_reply ru.RM_rmb
+};
+#define acpted_rply ru.RM_rmb.ru.RP_ar
+#define rjcted_rply ru.RM_rmb.ru.RP_dr
+
+#endif /* !__RPC_MSG_H_ */
diff --git a/contrib/tcpdump/setsignal.c b/contrib/tcpdump/setsignal.c
index b7722648a0e6..dbb8678182fb 100644
--- a/contrib/tcpdump/setsignal.c
+++ b/contrib/tcpdump/setsignal.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/setsignal.c,v 1.9.2.2 2003/11/16 08:51:56 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/setsignal.c,v 1.11 2003/11/16 09:36:42 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
diff --git a/contrib/tcpdump/smb.h b/contrib/tcpdump/smb.h
index 883ba6400902..bb05227f1d52 100644
--- a/contrib/tcpdump/smb.h
+++ b/contrib/tcpdump/smb.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/smb.h,v 1.8 2002/06/11 17:09:00 itojun Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/smb.h,v 1.9 2004/12/28 22:29:44 guy Exp $ (LBL) */
/*
* Copyright (C) Andrew Tridgell 1995-1999
*
@@ -119,4 +119,4 @@
#define PTR_DIFF(p1, p2) ((size_t)(((char *)(p1)) - (char *)(p2)))
/* some protos */
-const u_char *smb_fdata(const u_char *, const char *, const u_char *);
+const u_char *smb_fdata(const u_char *, const char *, const u_char *, int);
diff --git a/contrib/tcpdump/smbutil.c b/contrib/tcpdump/smbutil.c
index 5c1350f8348d..b7875f595a1b 100644
--- a/contrib/tcpdump/smbutil.c
+++ b/contrib/tcpdump/smbutil.c
@@ -12,7 +12,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.26.2.2 2003/11/16 08:51:56 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.36 2005/01/29 10:37:02 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -25,6 +25,7 @@ static const char rcsid[] _U_ =
#include "extract.h"
#include "smb.h"
+static u_int32_t stringlen;
extern const u_char *startbuf;
/*
@@ -106,8 +107,6 @@ interpret_long_date(const u_char *p)
double d;
time_t ret;
- TCHECK2(p[4], 4);
-
/* this gives us seconds since jan 1st 1601 (approx) */
d = (EXTRACT_LE_32BITS(p + 4) * 256.0 + p[3]) * (1.0e-7 * (1 << 24));
@@ -123,8 +122,6 @@ interpret_long_date(const u_char *p)
ret = (time_t)d;
return(ret);
-trunc:
- return(0);
}
/*
@@ -186,7 +183,12 @@ name_ptr(const u_char *buf, int ofs, const u_char *maxbuf)
/* XXX - this should use the same code that the DNS dissector does */
if ((c & 0xC0) == 0xC0) {
- u_int16_t l = EXTRACT_16BITS(buf + ofs) & 0x3FFF;
+ u_int16_t l;
+
+ TCHECK2(*p, 2);
+ if ((p + 1) >= maxbuf)
+ return(NULL); /* name goes past the end of the buffer */
+ l = EXTRACT_16BITS(p) & 0x3FFF;
if (l == 0) {
/* We have a pointer that points to itself. */
return(NULL);
@@ -195,9 +197,8 @@ name_ptr(const u_char *buf, int ofs, const u_char *maxbuf)
if (p >= maxbuf)
return(NULL); /* name goes past the end of the buffer */
TCHECK2(*p, 1);
- return(buf + l);
- } else
- return(buf + ofs);
+ }
+ return(p);
trunc:
return(NULL); /* name goes past the end of the buffer */
@@ -328,47 +329,102 @@ write_bits(unsigned int val, const char *fmt)
}
/* convert a UCS2 string into iso-8859-1 string */
+#define MAX_UNISTR_SIZE 1000
static const char *
-unistr(const u_char *s, int *len)
+unistr(const u_char *s, u_int32_t *len, int use_unicode)
{
- static char buf[1000];
- int l=0;
- static int use_unicode = -1;
-
- if (use_unicode == -1) {
- char *p = getenv("USE_UNICODE");
- if (p && (atoi(p) == 1))
- use_unicode = 1;
- else
- use_unicode = 0;
- }
-
- /* maybe it isn't unicode - a cheap trick */
- if (!use_unicode || (s[0] && s[1])) {
- *len = strlen((const char *)s) + 1;
- return (const char *)s;
+ static char buf[MAX_UNISTR_SIZE+1];
+ size_t l = 0;
+ u_int32_t strsize;
+ const u_char *sp;
+
+ if (use_unicode) {
+ /*
+ * Skip padding that puts the string on an even boundary.
+ */
+ if (((s - startbuf) % 2) != 0) {
+ TCHECK(s[0]);
+ s++;
+ }
}
-
- *len = 0;
-
- if (s[0] == 0 && s[1] != 0) {
- s++;
- *len = 1;
+ if (*len == 0) {
+ /*
+ * Null-terminated string.
+ */
+ strsize = 0;
+ sp = s;
+ if (!use_unicode) {
+ for (;;) {
+ TCHECK(sp[0]);
+ *len += 1;
+ if (sp[0] == 0)
+ break;
+ sp++;
+ }
+ strsize = *len - 1;
+ } else {
+ for (;;) {
+ TCHECK2(sp[0], 2);
+ *len += 2;
+ if (sp[0] == 0 && sp[1] == 0)
+ break;
+ sp += 2;
+ }
+ strsize = *len - 2;
+ }
+ } else {
+ /*
+ * Counted string.
+ */
+ strsize = *len;
}
-
- while (l < (int)(sizeof(buf) - 1) && s[0] && s[1] == 0) {
- buf[l] = s[0];
- s += 2;
- l++;
- *len += 2;
+ if (!use_unicode) {
+ while (strsize != 0) {
+ TCHECK(s[0]);
+ if (l >= MAX_UNISTR_SIZE)
+ break;
+ if (isprint(s[0]))
+ buf[l] = s[0];
+ else {
+ if (s[0] == 0)
+ break;
+ buf[l] = '.';
+ }
+ l++;
+ s++;
+ strsize--;
+ }
+ } else {
+ while (strsize != 0) {
+ TCHECK2(s[0], 2);
+ if (l >= MAX_UNISTR_SIZE)
+ break;
+ if (s[1] == 0 && isprint(s[0])) {
+ /* It's a printable ASCII character */
+ buf[l] = s[0];
+ } else {
+ /* It's a non-ASCII character or a non-printable ASCII character */
+ if (s[0] == 0 && s[1] == 0)
+ break;
+ buf[l] = '.';
+ }
+ l++;
+ s += 2;
+ if (strsize == 1)
+ break;
+ strsize -= 2;
+ }
}
buf[l] = 0;
- *len += 2;
return buf;
+
+trunc:
+ return NULL;
}
static const u_char *
-smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
+smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf,
+ int unicodestr)
{
int reverse = 0;
const char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
@@ -377,12 +433,14 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
while (*fmt && buf<maxbuf) {
switch (*fmt) {
case 'a':
+ TCHECK(buf[0]);
write_bits(buf[0], attrib_fmt);
buf++;
fmt++;
break;
case 'A':
+ TCHECK2(buf[0], 2);
write_bits(EXTRACT_LE_16BITS(buf), attrib_fmt);
buf += 2;
fmt++;
@@ -403,6 +461,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
strncpy(bitfmt, fmt, l);
bitfmt[l] = '\0';
fmt = p + 1;
+ TCHECK(buf[0]);
write_bits(buf[0], bitfmt);
buf++;
break;
@@ -411,6 +470,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
case 'P':
{
int l = atoi(fmt + 1);
+ TCHECK2(buf[0], l);
buf += l;
fmt++;
while (isdigit((unsigned char)*fmt))
@@ -421,31 +481,13 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
reverse = !reverse;
fmt++;
break;
- case 'D':
+ case 'b':
{
unsigned int x;
-
- TCHECK2(buf[0], 4);
- x = reverse ? EXTRACT_32BITS(buf) : EXTRACT_LE_32BITS(buf);
- printf("%d (0x%x)", x, x);
- buf += 4;
- fmt++;
- break;
- }
- case 'L':
- {
- unsigned int x1, x2;
-
- TCHECK2(buf[4], 4);
- x1 = reverse ? EXTRACT_32BITS(buf) :
- EXTRACT_LE_32BITS(buf);
- x2 = reverse ? EXTRACT_32BITS(buf + 4) :
- EXTRACT_LE_32BITS(buf + 4);
- if (x2)
- printf("0x%08x:%08x", x2, x1);
- else
- printf("%d (0x%08x%08x)", x1, x2, x1);
- buf += 8;
+ TCHECK(buf[0]);
+ x = buf[0];
+ printf("%u (0x%x)", x, x);
+ buf += 1;
fmt++;
break;
}
@@ -460,17 +502,54 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
fmt++;
break;
}
- case 'W':
+ case 'D':
{
unsigned int x;
TCHECK2(buf[0], 4);
x = reverse ? EXTRACT_32BITS(buf) :
EXTRACT_LE_32BITS(buf);
- printf("0x%X", x);
+ printf("%d (0x%x)", x, x);
buf += 4;
fmt++;
break;
}
+ case 'L':
+ {
+ u_int64_t x;
+ TCHECK2(buf[0], 8);
+ x = reverse ? EXTRACT_64BITS(buf) :
+ EXTRACT_LE_64BITS(buf);
+ printf("%" PRIu64 " (0x%" PRIx64 ")", x, x);
+ buf += 8;
+ fmt++;
+ break;
+ }
+ case 'M':
+ {
+ /* Weird mixed-endian length values in 64-bit locks */
+ u_int32_t x1, x2;
+ u_int64_t x;
+ TCHECK2(buf[0], 8);
+ x1 = reverse ? EXTRACT_32BITS(buf) :
+ EXTRACT_LE_32BITS(buf);
+ x2 = reverse ? EXTRACT_32BITS(buf + 4) :
+ EXTRACT_LE_32BITS(buf + 4);
+ x = (((u_int64_t)x1) << 32) | x2;
+ printf("%" PRIu64 " (0x%" PRIx64 ")", x, x);
+ buf += 8;
+ fmt++;
+ break;
+ }
+ case 'B':
+ {
+ unsigned int x;
+ TCHECK(buf[0]);
+ x = buf[0];
+ printf("0x%X", x);
+ buf += 1;
+ fmt++;
+ break;
+ }
case 'w':
{
unsigned int x;
@@ -482,41 +561,76 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
fmt++;
break;
}
- case 'B':
+ case 'W':
{
unsigned int x;
- TCHECK(buf[0]);
- x = buf[0];
+ TCHECK2(buf[0], 4);
+ x = reverse ? EXTRACT_32BITS(buf) :
+ EXTRACT_LE_32BITS(buf);
printf("0x%X", x);
- buf += 1;
+ buf += 4;
fmt++;
break;
}
- case 'b':
+ case 'l':
{
- unsigned int x;
- TCHECK(buf[0]);
- x = buf[0];
- printf("%u (0x%x)", x, x);
- buf += 1;
+ fmt++;
+ switch (*fmt) {
+
+ case 'b':
+ TCHECK(buf[0]);
+ stringlen = buf[0];
+ printf("%u", stringlen);
+ buf += 1;
+ break;
+
+ case 'd':
+ TCHECK2(buf[0], 2);
+ stringlen = reverse ? EXTRACT_16BITS(buf) :
+ EXTRACT_LE_16BITS(buf);
+ printf("%u", stringlen);
+ buf += 2;
+ break;
+
+ case 'D':
+ TCHECK2(buf[0], 4);
+ stringlen = reverse ? EXTRACT_32BITS(buf) :
+ EXTRACT_LE_32BITS(buf);
+ printf("%u", stringlen);
+ buf += 4;
+ break;
+ }
fmt++;
break;
}
case 'S':
+ case 'R': /* like 'S', but always ASCII */
{
/*XXX unistr() */
- printf("%.*s", (int)PTR_DIFF(maxbuf, buf), unistr(buf, &len));
+ const char *s;
+ len = 0;
+ s = unistr(buf, &len, (*fmt == 'R') ? 0 : unicodestr);
+ if (s == NULL)
+ goto trunc;
+ printf("%s", s);
buf += len;
fmt++;
break;
}
case 'Z':
+ case 'Y': /* like 'Z', but always ASCII */
{
- if (*buf != 4 && *buf != 2)
- printf("Error! ASCIIZ buffer of type %u (safety=%lu)\n", *buf,
- (unsigned long)PTR_DIFF(maxbuf, buf));
- printf("%.*s", (int)PTR_DIFF(maxbuf, buf + 1),
- unistr(buf + 1, &len));
+ const char *s;
+ TCHECK(*buf);
+ if (*buf != 4 && *buf != 2) {
+ printf("Error! ASCIIZ buffer of type %u", *buf);
+ return maxbuf; /* give up */
+ }
+ len = 0;
+ s = unistr(buf + 1, &len, (*fmt == 'Y') ? 0 : unicodestr);
+ if (s == NULL)
+ goto trunc;
+ printf("%s", s);
buf += len + 1;
fmt++;
break;
@@ -524,6 +638,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
case 's':
{
int l = atoi(fmt + 1);
+ TCHECK2(*buf, l);
printf("%-*.*s", l, l, buf);
buf += l;
fmt++;
@@ -531,9 +646,31 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
fmt++;
break;
}
+ case 'c':
+ {
+ TCHECK2(*buf, stringlen);
+ printf("%-*.*s", (int)stringlen, (int)stringlen, buf);
+ buf += stringlen;
+ fmt++;
+ while (isdigit((unsigned char)*fmt))
+ fmt++;
+ break;
+ }
+ case 'C':
+ {
+ const char *s;
+ s = unistr(buf, &stringlen, unicodestr);
+ if (s == NULL)
+ goto trunc;
+ printf("%s", s);
+ buf += stringlen;
+ fmt++;
+ break;
+ }
case 'h':
{
int l = atoi(fmt + 1);
+ TCHECK2(*buf, l);
while (l--)
printf("%02x", *buf++);
fmt++;
@@ -562,6 +699,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
name_type_str(name_type));
break;
case 2:
+ TCHECK(buf[15]);
name_type = buf[15];
printf("%-15.15s NameType=0x%02X (%s)", buf, name_type,
name_type_str(name_type));
@@ -579,10 +717,11 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
struct tm *lt;
const char *tstring;
u_int32_t x;
- x = EXTRACT_LE_32BITS(buf);
switch (atoi(fmt + 1)) {
case 1:
+ TCHECK2(buf[0], 4);
+ x = EXTRACT_LE_32BITS(buf);
if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
@@ -590,6 +729,8 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
buf += 4;
break;
case 2:
+ TCHECK2(buf[0], 4);
+ x = EXTRACT_LE_32BITS(buf);
if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
@@ -597,6 +738,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
buf += 4;
break;
case 3:
+ TCHECK2(buf[0], 8);
t = interpret_long_date(buf);
buf += 8;
break;
@@ -634,7 +776,8 @@ trunc:
}
const u_char *
-smb_fdata(const u_char *buf, const char *fmt, const u_char *maxbuf)
+smb_fdata(const u_char *buf, const char *fmt, const u_char *maxbuf,
+ int unicodestr)
{
static int depth = 0;
char s[128];
@@ -647,7 +790,7 @@ smb_fdata(const u_char *buf, const char *fmt, const u_char *maxbuf)
while (buf < maxbuf) {
const u_char *buf2;
depth++;
- buf2 = smb_fdata(buf, fmt, maxbuf);
+ buf2 = smb_fdata(buf, fmt, maxbuf, unicodestr);
depth--;
if (buf2 == NULL)
return(NULL);
@@ -686,7 +829,7 @@ smb_fdata(const u_char *buf, const char *fmt, const u_char *maxbuf)
strncpy(s, fmt, p - fmt);
s[p - fmt] = '\0';
fmt = p + 1;
- buf = smb_fdata1(buf, s, maxbuf);
+ buf = smb_fdata1(buf, s, maxbuf, unicodestr);
if (buf == NULL)
return(NULL);
break;
@@ -713,8 +856,8 @@ typedef struct {
const char *message;
} err_code_struct;
-/* Dos Error Messages */
-static err_code_struct dos_msgs[] = {
+/* DOS Error Messages */
+static const err_code_struct dos_msgs[] = {
{ "ERRbadfunc", 1, "Invalid function." },
{ "ERRbadfile", 2, "File not found." },
{ "ERRbadpath", 3, "Directory invalid." },
@@ -730,12 +873,12 @@ static err_code_struct dos_msgs[] = {
{ "ERRbaddata", 13, "Invalid data." },
{ "ERR", 14, "reserved." },
{ "ERRbaddrive", 15, "Invalid drive specified." },
- { "ERRremcd", 16, "A Delete Directory request attempted to remove the server's current directory." },
+ { "ERRremcd", 16, "A Delete Directory request attempted to remove the server's current directory." },
{ "ERRdiffdevice", 17, "Not same device." },
{ "ERRnofiles", 18, "A File Search command can find no more files matching the specified criteria." },
- { "ERRbadshare", 32, "The sharing mode specified for an Open conflicts with existing FIDs on the file." },
- { "ERRlock", 33, "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process." },
- { "ERRfilexists", 80, "The file named in a Create Directory, Make New File or Link request already exists." },
+ { "ERRbadshare", 32, "The sharing mode specified for an Open conflicts with existing FIDs on the file." },
+ { "ERRlock", 33, "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process." },
+ { "ERRfilexists", 80, "The file named in a Create Directory, Make New File or Link request already exists." },
{ "ERRbadpipe", 230, "Pipe invalid." },
{ "ERRpipebusy", 231, "All instances of the requested pipe are busy." },
{ "ERRpipeclosing", 232, "Pipe close in progress." },
@@ -749,17 +892,17 @@ err_code_struct server_msgs[] = {
{ "ERRerror", 1, "Non-specific error code." },
{ "ERRbadpw", 2, "Bad password - name/password pair in a Tree Connect or Session Setup are invalid." },
{ "ERRbadtype", 3, "reserved." },
- { "ERRaccess", 4, "The requester does not have the necessary access rights within the specified context for the requested function. The context is defined by the TID or the UID." },
+ { "ERRaccess", 4, "The requester does not have the necessary access rights within the specified context for the requested function. The context is defined by the TID or the UID." },
{ "ERRinvnid", 5, "The tree ID (TID) specified in a command was invalid." },
{ "ERRinvnetname", 6, "Invalid network name in tree connect." },
- { "ERRinvdevice", 7, "Invalid device - printer request made to non-printer connection or non-printer request made to printer connection." },
+ { "ERRinvdevice", 7, "Invalid device - printer request made to non-printer connection or non-printer request made to printer connection." },
{ "ERRqfull", 49, "Print queue full (files) -- returned by open print file." },
{ "ERRqtoobig", 50, "Print queue full -- no space." },
{ "ERRqeof", 51, "EOF on print queue dump." },
{ "ERRinvpfid", 52, "Invalid print file FID." },
{ "ERRsmbcmd", 64, "The server did not recognize the command received." },
- { "ERRsrverror", 65, "The server encountered an internal error, e.g., system file unavailable." },
- { "ERRfilespecs", 67, "The file handle (FID) and pathname parameters contained an invalid combination of values." },
+ { "ERRsrverror", 65, "The server encountered an internal error, e.g., system file unavailable." },
+ { "ERRfilespecs", 67, "The file handle (FID) and pathname parameters contained an invalid combination of values." },
{ "ERRreserved", 68, "reserved." },
{ "ERRbadpermits", 69, "The access permissions specified for a file or directory are not a valid combination. The server cannot set the requested attribute." },
{ "ERRreserved", 70, "reserved." },
@@ -772,8 +915,8 @@ err_code_struct server_msgs[] = {
{ "ERRnoresource", 89, "No resources currently available for request." },
{ "ERRtoomanyuids", 90, "Too many UIDs active on this session." },
{ "ERRbaduid", 91, "The UID is not known as a valid ID on this session." },
- { "ERRusempx", 250, "Temp unable to support Raw, use MPX mode." },
- { "ERRusestd", 251, "Temp unable to support Raw, use standard read/write." },
+ { "ERRusempx", 250, "Temp unable to support Raw, use MPX mode." },
+ { "ERRusestd", 251, "Temp unable to support Raw, use standard read/write." },
{ "ERRcontmpx", 252, "Continue in MPX mode." },
{ "ERRreserved", 253, "reserved." },
{ "ERRreserved", 254, "reserved." },
@@ -797,17 +940,17 @@ err_code_struct hard_msgs[] = {
{ "ERRread", 30, "Read fault." },
{ "ERRgeneral", 31, "General failure." },
{ "ERRbadshare", 32, "A open conflicts with an existing open." },
- { "ERRlock", 33, "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process." },
+ { "ERRlock", 33, "A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process." },
{ "ERRwrongdisk", 34, "The wrong disk was found in a drive." },
{ "ERRFCBUnavail", 35, "No FCBs are available to process request." },
{ "ERRsharebufexc", 36, "A sharing buffer has been exceeded." },
{ NULL, -1, NULL }
};
-static struct {
+static const struct {
int code;
const char *class;
- err_code_struct *err_msgs;
+ const err_code_struct *err_msgs;
} err_classes[] = {
{ 0, "SUCCESS", NULL },
{ 0x01, "ERRDOS", dos_msgs },
@@ -835,7 +978,7 @@ smb_errstr(int class, int num)
for (i = 0; err_classes[i].class; i++)
if (err_classes[i].code == class) {
if (err_classes[i].err_msgs) {
- err_code_struct *err = err_classes[i].err_msgs;
+ const err_code_struct *err = err_classes[i].err_msgs;
for (j = 0; err[j].name; j++)
if (num == err[j].code) {
snprintf(ret, sizeof(ret), "%s - %s (%s)",
@@ -851,3 +994,884 @@ smb_errstr(int class, int num)
snprintf(ret, sizeof(ret), "ERROR: Unknown error (%d,%d)", class, num);
return(ret);
}
+
+typedef struct {
+ u_int32_t code;
+ const char *name;
+} nt_err_code_struct;
+
+/*
+ * NT Error codes
+ */
+static const nt_err_code_struct nt_errors[] = {
+ { 0x00000000, "STATUS_SUCCESS" },
+ { 0x00000000, "STATUS_WAIT_0" },
+ { 0x00000001, "STATUS_WAIT_1" },
+ { 0x00000002, "STATUS_WAIT_2" },
+ { 0x00000003, "STATUS_WAIT_3" },
+ { 0x0000003F, "STATUS_WAIT_63" },
+ { 0x00000080, "STATUS_ABANDONED" },
+ { 0x00000080, "STATUS_ABANDONED_WAIT_0" },
+ { 0x000000BF, "STATUS_ABANDONED_WAIT_63" },
+ { 0x000000C0, "STATUS_USER_APC" },
+ { 0x00000100, "STATUS_KERNEL_APC" },
+ { 0x00000101, "STATUS_ALERTED" },
+ { 0x00000102, "STATUS_TIMEOUT" },
+ { 0x00000103, "STATUS_PENDING" },
+ { 0x00000104, "STATUS_REPARSE" },
+ { 0x00000105, "STATUS_MORE_ENTRIES" },
+ { 0x00000106, "STATUS_NOT_ALL_ASSIGNED" },
+ { 0x00000107, "STATUS_SOME_NOT_MAPPED" },
+ { 0x00000108, "STATUS_OPLOCK_BREAK_IN_PROGRESS" },
+ { 0x00000109, "STATUS_VOLUME_MOUNTED" },
+ { 0x0000010A, "STATUS_RXACT_COMMITTED" },
+ { 0x0000010B, "STATUS_NOTIFY_CLEANUP" },
+ { 0x0000010C, "STATUS_NOTIFY_ENUM_DIR" },
+ { 0x0000010D, "STATUS_NO_QUOTAS_FOR_ACCOUNT" },
+ { 0x0000010E, "STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED" },
+ { 0x00000110, "STATUS_PAGE_FAULT_TRANSITION" },
+ { 0x00000111, "STATUS_PAGE_FAULT_DEMAND_ZERO" },
+ { 0x00000112, "STATUS_PAGE_FAULT_COPY_ON_WRITE" },
+ { 0x00000113, "STATUS_PAGE_FAULT_GUARD_PAGE" },
+ { 0x00000114, "STATUS_PAGE_FAULT_PAGING_FILE" },
+ { 0x00000115, "STATUS_CACHE_PAGE_LOCKED" },
+ { 0x00000116, "STATUS_CRASH_DUMP" },
+ { 0x00000117, "STATUS_BUFFER_ALL_ZEROS" },
+ { 0x00000118, "STATUS_REPARSE_OBJECT" },
+ { 0x0000045C, "STATUS_NO_SHUTDOWN_IN_PROGRESS" },
+ { 0x40000000, "STATUS_OBJECT_NAME_EXISTS" },
+ { 0x40000001, "STATUS_THREAD_WAS_SUSPENDED" },
+ { 0x40000002, "STATUS_WORKING_SET_LIMIT_RANGE" },
+ { 0x40000003, "STATUS_IMAGE_NOT_AT_BASE" },
+ { 0x40000004, "STATUS_RXACT_STATE_CREATED" },
+ { 0x40000005, "STATUS_SEGMENT_NOTIFICATION" },
+ { 0x40000006, "STATUS_LOCAL_USER_SESSION_KEY" },
+ { 0x40000007, "STATUS_BAD_CURRENT_DIRECTORY" },
+ { 0x40000008, "STATUS_SERIAL_MORE_WRITES" },
+ { 0x40000009, "STATUS_REGISTRY_RECOVERED" },
+ { 0x4000000A, "STATUS_FT_READ_RECOVERY_FROM_BACKUP" },
+ { 0x4000000B, "STATUS_FT_WRITE_RECOVERY" },
+ { 0x4000000C, "STATUS_SERIAL_COUNTER_TIMEOUT" },
+ { 0x4000000D, "STATUS_NULL_LM_PASSWORD" },
+ { 0x4000000E, "STATUS_IMAGE_MACHINE_TYPE_MISMATCH" },
+ { 0x4000000F, "STATUS_RECEIVE_PARTIAL" },
+ { 0x40000010, "STATUS_RECEIVE_EXPEDITED" },
+ { 0x40000011, "STATUS_RECEIVE_PARTIAL_EXPEDITED" },
+ { 0x40000012, "STATUS_EVENT_DONE" },
+ { 0x40000013, "STATUS_EVENT_PENDING" },
+ { 0x40000014, "STATUS_CHECKING_FILE_SYSTEM" },
+ { 0x40000015, "STATUS_FATAL_APP_EXIT" },
+ { 0x40000016, "STATUS_PREDEFINED_HANDLE" },
+ { 0x40000017, "STATUS_WAS_UNLOCKED" },
+ { 0x40000018, "STATUS_SERVICE_NOTIFICATION" },
+ { 0x40000019, "STATUS_WAS_LOCKED" },
+ { 0x4000001A, "STATUS_LOG_HARD_ERROR" },
+ { 0x4000001B, "STATUS_ALREADY_WIN32" },
+ { 0x4000001C, "STATUS_WX86_UNSIMULATE" },
+ { 0x4000001D, "STATUS_WX86_CONTINUE" },
+ { 0x4000001E, "STATUS_WX86_SINGLE_STEP" },
+ { 0x4000001F, "STATUS_WX86_BREAKPOINT" },
+ { 0x40000020, "STATUS_WX86_EXCEPTION_CONTINUE" },
+ { 0x40000021, "STATUS_WX86_EXCEPTION_LASTCHANCE" },
+ { 0x40000022, "STATUS_WX86_EXCEPTION_CHAIN" },
+ { 0x40000023, "STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE" },
+ { 0x40000024, "STATUS_NO_YIELD_PERFORMED" },
+ { 0x40000025, "STATUS_TIMER_RESUME_IGNORED" },
+ { 0x80000001, "STATUS_GUARD_PAGE_VIOLATION" },
+ { 0x80000002, "STATUS_DATATYPE_MISALIGNMENT" },
+ { 0x80000003, "STATUS_BREAKPOINT" },
+ { 0x80000004, "STATUS_SINGLE_STEP" },
+ { 0x80000005, "STATUS_BUFFER_OVERFLOW" },
+ { 0x80000006, "STATUS_NO_MORE_FILES" },
+ { 0x80000007, "STATUS_WAKE_SYSTEM_DEBUGGER" },
+ { 0x8000000A, "STATUS_HANDLES_CLOSED" },
+ { 0x8000000B, "STATUS_NO_INHERITANCE" },
+ { 0x8000000C, "STATUS_GUID_SUBSTITUTION_MADE" },
+ { 0x8000000D, "STATUS_PARTIAL_COPY" },
+ { 0x8000000E, "STATUS_DEVICE_PAPER_EMPTY" },
+ { 0x8000000F, "STATUS_DEVICE_POWERED_OFF" },
+ { 0x80000010, "STATUS_DEVICE_OFF_LINE" },
+ { 0x80000011, "STATUS_DEVICE_BUSY" },
+ { 0x80000012, "STATUS_NO_MORE_EAS" },
+ { 0x80000013, "STATUS_INVALID_EA_NAME" },
+ { 0x80000014, "STATUS_EA_LIST_INCONSISTENT" },
+ { 0x80000015, "STATUS_INVALID_EA_FLAG" },
+ { 0x80000016, "STATUS_VERIFY_REQUIRED" },
+ { 0x80000017, "STATUS_EXTRANEOUS_INFORMATION" },
+ { 0x80000018, "STATUS_RXACT_COMMIT_NECESSARY" },
+ { 0x8000001A, "STATUS_NO_MORE_ENTRIES" },
+ { 0x8000001B, "STATUS_FILEMARK_DETECTED" },
+ { 0x8000001C, "STATUS_MEDIA_CHANGED" },
+ { 0x8000001D, "STATUS_BUS_RESET" },
+ { 0x8000001E, "STATUS_END_OF_MEDIA" },
+ { 0x8000001F, "STATUS_BEGINNING_OF_MEDIA" },
+ { 0x80000020, "STATUS_MEDIA_CHECK" },
+ { 0x80000021, "STATUS_SETMARK_DETECTED" },
+ { 0x80000022, "STATUS_NO_DATA_DETECTED" },
+ { 0x80000023, "STATUS_REDIRECTOR_HAS_OPEN_HANDLES" },
+ { 0x80000024, "STATUS_SERVER_HAS_OPEN_HANDLES" },
+ { 0x80000025, "STATUS_ALREADY_DISCONNECTED" },
+ { 0x80000026, "STATUS_LONGJUMP" },
+ { 0x80040111, "MAPI_E_LOGON_FAILED" },
+ { 0x80090300, "SEC_E_INSUFFICIENT_MEMORY" },
+ { 0x80090301, "SEC_E_INVALID_HANDLE" },
+ { 0x80090302, "SEC_E_UNSUPPORTED_FUNCTION" },
+ { 0x8009030B, "SEC_E_NO_IMPERSONATION" },
+ { 0x8009030D, "SEC_E_UNKNOWN_CREDENTIALS" },
+ { 0x8009030E, "SEC_E_NO_CREDENTIALS" },
+ { 0x8009030F, "SEC_E_MESSAGE_ALTERED" },
+ { 0x80090310, "SEC_E_OUT_OF_SEQUENCE" },
+ { 0x80090311, "SEC_E_NO_AUTHENTICATING_AUTHORITY" },
+ { 0xC0000001, "STATUS_UNSUCCESSFUL" },
+ { 0xC0000002, "STATUS_NOT_IMPLEMENTED" },
+ { 0xC0000003, "STATUS_INVALID_INFO_CLASS" },
+ { 0xC0000004, "STATUS_INFO_LENGTH_MISMATCH" },
+ { 0xC0000005, "STATUS_ACCESS_VIOLATION" },
+ { 0xC0000006, "STATUS_IN_PAGE_ERROR" },
+ { 0xC0000007, "STATUS_PAGEFILE_QUOTA" },
+ { 0xC0000008, "STATUS_INVALID_HANDLE" },
+ { 0xC0000009, "STATUS_BAD_INITIAL_STACK" },
+ { 0xC000000A, "STATUS_BAD_INITIAL_PC" },
+ { 0xC000000B, "STATUS_INVALID_CID" },
+ { 0xC000000C, "STATUS_TIMER_NOT_CANCELED" },
+ { 0xC000000D, "STATUS_INVALID_PARAMETER" },
+ { 0xC000000E, "STATUS_NO_SUCH_DEVICE" },
+ { 0xC000000F, "STATUS_NO_SUCH_FILE" },
+ { 0xC0000010, "STATUS_INVALID_DEVICE_REQUEST" },
+ { 0xC0000011, "STATUS_END_OF_FILE" },
+ { 0xC0000012, "STATUS_WRONG_VOLUME" },
+ { 0xC0000013, "STATUS_NO_MEDIA_IN_DEVICE" },
+ { 0xC0000014, "STATUS_UNRECOGNIZED_MEDIA" },
+ { 0xC0000015, "STATUS_NONEXISTENT_SECTOR" },
+ { 0xC0000016, "STATUS_MORE_PROCESSING_REQUIRED" },
+ { 0xC0000017, "STATUS_NO_MEMORY" },
+ { 0xC0000018, "STATUS_CONFLICTING_ADDRESSES" },
+ { 0xC0000019, "STATUS_NOT_MAPPED_VIEW" },
+ { 0xC000001A, "STATUS_UNABLE_TO_FREE_VM" },
+ { 0xC000001B, "STATUS_UNABLE_TO_DELETE_SECTION" },
+ { 0xC000001C, "STATUS_INVALID_SYSTEM_SERVICE" },
+ { 0xC000001D, "STATUS_ILLEGAL_INSTRUCTION" },
+ { 0xC000001E, "STATUS_INVALID_LOCK_SEQUENCE" },
+ { 0xC000001F, "STATUS_INVALID_VIEW_SIZE" },
+ { 0xC0000020, "STATUS_INVALID_FILE_FOR_SECTION" },
+ { 0xC0000021, "STATUS_ALREADY_COMMITTED" },
+ { 0xC0000022, "STATUS_ACCESS_DENIED" },
+ { 0xC0000023, "STATUS_BUFFER_TOO_SMALL" },
+ { 0xC0000024, "STATUS_OBJECT_TYPE_MISMATCH" },
+ { 0xC0000025, "STATUS_NONCONTINUABLE_EXCEPTION" },
+ { 0xC0000026, "STATUS_INVALID_DISPOSITION" },
+ { 0xC0000027, "STATUS_UNWIND" },
+ { 0xC0000028, "STATUS_BAD_STACK" },
+ { 0xC0000029, "STATUS_INVALID_UNWIND_TARGET" },
+ { 0xC000002A, "STATUS_NOT_LOCKED" },
+ { 0xC000002B, "STATUS_PARITY_ERROR" },
+ { 0xC000002C, "STATUS_UNABLE_TO_DECOMMIT_VM" },
+ { 0xC000002D, "STATUS_NOT_COMMITTED" },
+ { 0xC000002E, "STATUS_INVALID_PORT_ATTRIBUTES" },
+ { 0xC000002F, "STATUS_PORT_MESSAGE_TOO_LONG" },
+ { 0xC0000030, "STATUS_INVALID_PARAMETER_MIX" },
+ { 0xC0000031, "STATUS_INVALID_QUOTA_LOWER" },
+ { 0xC0000032, "STATUS_DISK_CORRUPT_ERROR" },
+ { 0xC0000033, "STATUS_OBJECT_NAME_INVALID" },
+ { 0xC0000034, "STATUS_OBJECT_NAME_NOT_FOUND" },
+ { 0xC0000035, "STATUS_OBJECT_NAME_COLLISION" },
+ { 0xC0000037, "STATUS_PORT_DISCONNECTED" },
+ { 0xC0000038, "STATUS_DEVICE_ALREADY_ATTACHED" },
+ { 0xC0000039, "STATUS_OBJECT_PATH_INVALID" },
+ { 0xC000003A, "STATUS_OBJECT_PATH_NOT_FOUND" },
+ { 0xC000003B, "STATUS_OBJECT_PATH_SYNTAX_BAD" },
+ { 0xC000003C, "STATUS_DATA_OVERRUN" },
+ { 0xC000003D, "STATUS_DATA_LATE_ERROR" },
+ { 0xC000003E, "STATUS_DATA_ERROR" },
+ { 0xC000003F, "STATUS_CRC_ERROR" },
+ { 0xC0000040, "STATUS_SECTION_TOO_BIG" },
+ { 0xC0000041, "STATUS_PORT_CONNECTION_REFUSED" },
+ { 0xC0000042, "STATUS_INVALID_PORT_HANDLE" },
+ { 0xC0000043, "STATUS_SHARING_VIOLATION" },
+ { 0xC0000044, "STATUS_QUOTA_EXCEEDED" },
+ { 0xC0000045, "STATUS_INVALID_PAGE_PROTECTION" },
+ { 0xC0000046, "STATUS_MUTANT_NOT_OWNED" },
+ { 0xC0000047, "STATUS_SEMAPHORE_LIMIT_EXCEEDED" },
+ { 0xC0000048, "STATUS_PORT_ALREADY_SET" },
+ { 0xC0000049, "STATUS_SECTION_NOT_IMAGE" },
+ { 0xC000004A, "STATUS_SUSPEND_COUNT_EXCEEDED" },
+ { 0xC000004B, "STATUS_THREAD_IS_TERMINATING" },
+ { 0xC000004C, "STATUS_BAD_WORKING_SET_LIMIT" },
+ { 0xC000004D, "STATUS_INCOMPATIBLE_FILE_MAP" },
+ { 0xC000004E, "STATUS_SECTION_PROTECTION" },
+ { 0xC000004F, "STATUS_EAS_NOT_SUPPORTED" },
+ { 0xC0000050, "STATUS_EA_TOO_LARGE" },
+ { 0xC0000051, "STATUS_NONEXISTENT_EA_ENTRY" },
+ { 0xC0000052, "STATUS_NO_EAS_ON_FILE" },
+ { 0xC0000053, "STATUS_EA_CORRUPT_ERROR" },
+ { 0xC0000054, "STATUS_FILE_LOCK_CONFLICT" },
+ { 0xC0000055, "STATUS_LOCK_NOT_GRANTED" },
+ { 0xC0000056, "STATUS_DELETE_PENDING" },
+ { 0xC0000057, "STATUS_CTL_FILE_NOT_SUPPORTED" },
+ { 0xC0000058, "STATUS_UNKNOWN_REVISION" },
+ { 0xC0000059, "STATUS_REVISION_MISMATCH" },
+ { 0xC000005A, "STATUS_INVALID_OWNER" },
+ { 0xC000005B, "STATUS_INVALID_PRIMARY_GROUP" },
+ { 0xC000005C, "STATUS_NO_IMPERSONATION_TOKEN" },
+ { 0xC000005D, "STATUS_CANT_DISABLE_MANDATORY" },
+ { 0xC000005E, "STATUS_NO_LOGON_SERVERS" },
+ { 0xC000005F, "STATUS_NO_SUCH_LOGON_SESSION" },
+ { 0xC0000060, "STATUS_NO_SUCH_PRIVILEGE" },
+ { 0xC0000061, "STATUS_PRIVILEGE_NOT_HELD" },
+ { 0xC0000062, "STATUS_INVALID_ACCOUNT_NAME" },
+ { 0xC0000063, "STATUS_USER_EXISTS" },
+ { 0xC0000064, "STATUS_NO_SUCH_USER" },
+ { 0xC0000065, "STATUS_GROUP_EXISTS" },
+ { 0xC0000066, "STATUS_NO_SUCH_GROUP" },
+ { 0xC0000067, "STATUS_MEMBER_IN_GROUP" },
+ { 0xC0000068, "STATUS_MEMBER_NOT_IN_GROUP" },
+ { 0xC0000069, "STATUS_LAST_ADMIN" },
+ { 0xC000006A, "STATUS_WRONG_PASSWORD" },
+ { 0xC000006B, "STATUS_ILL_FORMED_PASSWORD" },
+ { 0xC000006C, "STATUS_PASSWORD_RESTRICTION" },
+ { 0xC000006D, "STATUS_LOGON_FAILURE" },
+ { 0xC000006E, "STATUS_ACCOUNT_RESTRICTION" },
+ { 0xC000006F, "STATUS_INVALID_LOGON_HOURS" },
+ { 0xC0000070, "STATUS_INVALID_WORKSTATION" },
+ { 0xC0000071, "STATUS_PASSWORD_EXPIRED" },
+ { 0xC0000072, "STATUS_ACCOUNT_DISABLED" },
+ { 0xC0000073, "STATUS_NONE_MAPPED" },
+ { 0xC0000074, "STATUS_TOO_MANY_LUIDS_REQUESTED" },
+ { 0xC0000075, "STATUS_LUIDS_EXHAUSTED" },
+ { 0xC0000076, "STATUS_INVALID_SUB_AUTHORITY" },
+ { 0xC0000077, "STATUS_INVALID_ACL" },
+ { 0xC0000078, "STATUS_INVALID_SID" },
+ { 0xC0000079, "STATUS_INVALID_SECURITY_DESCR" },
+ { 0xC000007A, "STATUS_PROCEDURE_NOT_FOUND" },
+ { 0xC000007B, "STATUS_INVALID_IMAGE_FORMAT" },
+ { 0xC000007C, "STATUS_NO_TOKEN" },
+ { 0xC000007D, "STATUS_BAD_INHERITANCE_ACL" },
+ { 0xC000007E, "STATUS_RANGE_NOT_LOCKED" },
+ { 0xC000007F, "STATUS_DISK_FULL" },
+ { 0xC0000080, "STATUS_SERVER_DISABLED" },
+ { 0xC0000081, "STATUS_SERVER_NOT_DISABLED" },
+ { 0xC0000082, "STATUS_TOO_MANY_GUIDS_REQUESTED" },
+ { 0xC0000083, "STATUS_GUIDS_EXHAUSTED" },
+ { 0xC0000084, "STATUS_INVALID_ID_AUTHORITY" },
+ { 0xC0000085, "STATUS_AGENTS_EXHAUSTED" },
+ { 0xC0000086, "STATUS_INVALID_VOLUME_LABEL" },
+ { 0xC0000087, "STATUS_SECTION_NOT_EXTENDED" },
+ { 0xC0000088, "STATUS_NOT_MAPPED_DATA" },
+ { 0xC0000089, "STATUS_RESOURCE_DATA_NOT_FOUND" },
+ { 0xC000008A, "STATUS_RESOURCE_TYPE_NOT_FOUND" },
+ { 0xC000008B, "STATUS_RESOURCE_NAME_NOT_FOUND" },
+ { 0xC000008C, "STATUS_ARRAY_BOUNDS_EXCEEDED" },
+ { 0xC000008D, "STATUS_FLOAT_DENORMAL_OPERAND" },
+ { 0xC000008E, "STATUS_FLOAT_DIVIDE_BY_ZERO" },
+ { 0xC000008F, "STATUS_FLOAT_INEXACT_RESULT" },
+ { 0xC0000090, "STATUS_FLOAT_INVALID_OPERATION" },
+ { 0xC0000091, "STATUS_FLOAT_OVERFLOW" },
+ { 0xC0000092, "STATUS_FLOAT_STACK_CHECK" },
+ { 0xC0000093, "STATUS_FLOAT_UNDERFLOW" },
+ { 0xC0000094, "STATUS_INTEGER_DIVIDE_BY_ZERO" },
+ { 0xC0000095, "STATUS_INTEGER_OVERFLOW" },
+ { 0xC0000096, "STATUS_PRIVILEGED_INSTRUCTION" },
+ { 0xC0000097, "STATUS_TOO_MANY_PAGING_FILES" },
+ { 0xC0000098, "STATUS_FILE_INVALID" },
+ { 0xC0000099, "STATUS_ALLOTTED_SPACE_EXCEEDED" },
+ { 0xC000009A, "STATUS_INSUFFICIENT_RESOURCES" },
+ { 0xC000009B, "STATUS_DFS_EXIT_PATH_FOUND" },
+ { 0xC000009C, "STATUS_DEVICE_DATA_ERROR" },
+ { 0xC000009D, "STATUS_DEVICE_NOT_CONNECTED" },
+ { 0xC000009E, "STATUS_DEVICE_POWER_FAILURE" },
+ { 0xC000009F, "STATUS_FREE_VM_NOT_AT_BASE" },
+ { 0xC00000A0, "STATUS_MEMORY_NOT_ALLOCATED" },
+ { 0xC00000A1, "STATUS_WORKING_SET_QUOTA" },
+ { 0xC00000A2, "STATUS_MEDIA_WRITE_PROTECTED" },
+ { 0xC00000A3, "STATUS_DEVICE_NOT_READY" },
+ { 0xC00000A4, "STATUS_INVALID_GROUP_ATTRIBUTES" },
+ { 0xC00000A5, "STATUS_BAD_IMPERSONATION_LEVEL" },
+ { 0xC00000A6, "STATUS_CANT_OPEN_ANONYMOUS" },
+ { 0xC00000A7, "STATUS_BAD_VALIDATION_CLASS" },
+ { 0xC00000A8, "STATUS_BAD_TOKEN_TYPE" },
+ { 0xC00000A9, "STATUS_BAD_MASTER_BOOT_RECORD" },
+ { 0xC00000AA, "STATUS_INSTRUCTION_MISALIGNMENT" },
+ { 0xC00000AB, "STATUS_INSTANCE_NOT_AVAILABLE" },
+ { 0xC00000AC, "STATUS_PIPE_NOT_AVAILABLE" },
+ { 0xC00000AD, "STATUS_INVALID_PIPE_STATE" },
+ { 0xC00000AE, "STATUS_PIPE_BUSY" },
+ { 0xC00000AF, "STATUS_ILLEGAL_FUNCTION" },
+ { 0xC00000B0, "STATUS_PIPE_DISCONNECTED" },
+ { 0xC00000B1, "STATUS_PIPE_CLOSING" },
+ { 0xC00000B2, "STATUS_PIPE_CONNECTED" },
+ { 0xC00000B3, "STATUS_PIPE_LISTENING" },
+ { 0xC00000B4, "STATUS_INVALID_READ_MODE" },
+ { 0xC00000B5, "STATUS_IO_TIMEOUT" },
+ { 0xC00000B6, "STATUS_FILE_FORCED_CLOSED" },
+ { 0xC00000B7, "STATUS_PROFILING_NOT_STARTED" },
+ { 0xC00000B8, "STATUS_PROFILING_NOT_STOPPED" },
+ { 0xC00000B9, "STATUS_COULD_NOT_INTERPRET" },
+ { 0xC00000BA, "STATUS_FILE_IS_A_DIRECTORY" },
+ { 0xC00000BB, "STATUS_NOT_SUPPORTED" },
+ { 0xC00000BC, "STATUS_REMOTE_NOT_LISTENING" },
+ { 0xC00000BD, "STATUS_DUPLICATE_NAME" },
+ { 0xC00000BE, "STATUS_BAD_NETWORK_PATH" },
+ { 0xC00000BF, "STATUS_NETWORK_BUSY" },
+ { 0xC00000C0, "STATUS_DEVICE_DOES_NOT_EXIST" },
+ { 0xC00000C1, "STATUS_TOO_MANY_COMMANDS" },
+ { 0xC00000C2, "STATUS_ADAPTER_HARDWARE_ERROR" },
+ { 0xC00000C3, "STATUS_INVALID_NETWORK_RESPONSE" },
+ { 0xC00000C4, "STATUS_UNEXPECTED_NETWORK_ERROR" },
+ { 0xC00000C5, "STATUS_BAD_REMOTE_ADAPTER" },
+ { 0xC00000C6, "STATUS_PRINT_QUEUE_FULL" },
+ { 0xC00000C7, "STATUS_NO_SPOOL_SPACE" },
+ { 0xC00000C8, "STATUS_PRINT_CANCELLED" },
+ { 0xC00000C9, "STATUS_NETWORK_NAME_DELETED" },
+ { 0xC00000CA, "STATUS_NETWORK_ACCESS_DENIED" },
+ { 0xC00000CB, "STATUS_BAD_DEVICE_TYPE" },
+ { 0xC00000CC, "STATUS_BAD_NETWORK_NAME" },
+ { 0xC00000CD, "STATUS_TOO_MANY_NAMES" },
+ { 0xC00000CE, "STATUS_TOO_MANY_SESSIONS" },
+ { 0xC00000CF, "STATUS_SHARING_PAUSED" },
+ { 0xC00000D0, "STATUS_REQUEST_NOT_ACCEPTED" },
+ { 0xC00000D1, "STATUS_REDIRECTOR_PAUSED" },
+ { 0xC00000D2, "STATUS_NET_WRITE_FAULT" },
+ { 0xC00000D3, "STATUS_PROFILING_AT_LIMIT" },
+ { 0xC00000D4, "STATUS_NOT_SAME_DEVICE" },
+ { 0xC00000D5, "STATUS_FILE_RENAMED" },
+ { 0xC00000D6, "STATUS_VIRTUAL_CIRCUIT_CLOSED" },
+ { 0xC00000D7, "STATUS_NO_SECURITY_ON_OBJECT" },
+ { 0xC00000D8, "STATUS_CANT_WAIT" },
+ { 0xC00000D9, "STATUS_PIPE_EMPTY" },
+ { 0xC00000DA, "STATUS_CANT_ACCESS_DOMAIN_INFO" },
+ { 0xC00000DB, "STATUS_CANT_TERMINATE_SELF" },
+ { 0xC00000DC, "STATUS_INVALID_SERVER_STATE" },
+ { 0xC00000DD, "STATUS_INVALID_DOMAIN_STATE" },
+ { 0xC00000DE, "STATUS_INVALID_DOMAIN_ROLE" },
+ { 0xC00000DF, "STATUS_NO_SUCH_DOMAIN" },
+ { 0xC00000E0, "STATUS_DOMAIN_EXISTS" },
+ { 0xC00000E1, "STATUS_DOMAIN_LIMIT_EXCEEDED" },
+ { 0xC00000E2, "STATUS_OPLOCK_NOT_GRANTED" },
+ { 0xC00000E3, "STATUS_INVALID_OPLOCK_PROTOCOL" },
+ { 0xC00000E4, "STATUS_INTERNAL_DB_CORRUPTION" },
+ { 0xC00000E5, "STATUS_INTERNAL_ERROR" },
+ { 0xC00000E6, "STATUS_GENERIC_NOT_MAPPED" },
+ { 0xC00000E7, "STATUS_BAD_DESCRIPTOR_FORMAT" },
+ { 0xC00000E8, "STATUS_INVALID_USER_BUFFER" },
+ { 0xC00000E9, "STATUS_UNEXPECTED_IO_ERROR" },
+ { 0xC00000EA, "STATUS_UNEXPECTED_MM_CREATE_ERR" },
+ { 0xC00000EB, "STATUS_UNEXPECTED_MM_MAP_ERROR" },
+ { 0xC00000EC, "STATUS_UNEXPECTED_MM_EXTEND_ERR" },
+ { 0xC00000ED, "STATUS_NOT_LOGON_PROCESS" },
+ { 0xC00000EE, "STATUS_LOGON_SESSION_EXISTS" },
+ { 0xC00000EF, "STATUS_INVALID_PARAMETER_1" },
+ { 0xC00000F0, "STATUS_INVALID_PARAMETER_2" },
+ { 0xC00000F1, "STATUS_INVALID_PARAMETER_3" },
+ { 0xC00000F2, "STATUS_INVALID_PARAMETER_4" },
+ { 0xC00000F3, "STATUS_INVALID_PARAMETER_5" },
+ { 0xC00000F4, "STATUS_INVALID_PARAMETER_6" },
+ { 0xC00000F5, "STATUS_INVALID_PARAMETER_7" },
+ { 0xC00000F6, "STATUS_INVALID_PARAMETER_8" },
+ { 0xC00000F7, "STATUS_INVALID_PARAMETER_9" },
+ { 0xC00000F8, "STATUS_INVALID_PARAMETER_10" },
+ { 0xC00000F9, "STATUS_INVALID_PARAMETER_11" },
+ { 0xC00000FA, "STATUS_INVALID_PARAMETER_12" },
+ { 0xC00000FB, "STATUS_REDIRECTOR_NOT_STARTED" },
+ { 0xC00000FC, "STATUS_REDIRECTOR_STARTED" },
+ { 0xC00000FD, "STATUS_STACK_OVERFLOW" },
+ { 0xC00000FE, "STATUS_NO_SUCH_PACKAGE" },
+ { 0xC00000FF, "STATUS_BAD_FUNCTION_TABLE" },
+ { 0xC0000100, "STATUS_VARIABLE_NOT_FOUND" },
+ { 0xC0000101, "STATUS_DIRECTORY_NOT_EMPTY" },
+ { 0xC0000102, "STATUS_FILE_CORRUPT_ERROR" },
+ { 0xC0000103, "STATUS_NOT_A_DIRECTORY" },
+ { 0xC0000104, "STATUS_BAD_LOGON_SESSION_STATE" },
+ { 0xC0000105, "STATUS_LOGON_SESSION_COLLISION" },
+ { 0xC0000106, "STATUS_NAME_TOO_LONG" },
+ { 0xC0000107, "STATUS_FILES_OPEN" },
+ { 0xC0000108, "STATUS_CONNECTION_IN_USE" },
+ { 0xC0000109, "STATUS_MESSAGE_NOT_FOUND" },
+ { 0xC000010A, "STATUS_PROCESS_IS_TERMINATING" },
+ { 0xC000010B, "STATUS_INVALID_LOGON_TYPE" },
+ { 0xC000010C, "STATUS_NO_GUID_TRANSLATION" },
+ { 0xC000010D, "STATUS_CANNOT_IMPERSONATE" },
+ { 0xC000010E, "STATUS_IMAGE_ALREADY_LOADED" },
+ { 0xC000010F, "STATUS_ABIOS_NOT_PRESENT" },
+ { 0xC0000110, "STATUS_ABIOS_LID_NOT_EXIST" },
+ { 0xC0000111, "STATUS_ABIOS_LID_ALREADY_OWNED" },
+ { 0xC0000112, "STATUS_ABIOS_NOT_LID_OWNER" },
+ { 0xC0000113, "STATUS_ABIOS_INVALID_COMMAND" },
+ { 0xC0000114, "STATUS_ABIOS_INVALID_LID" },
+ { 0xC0000115, "STATUS_ABIOS_SELECTOR_NOT_AVAILABLE" },
+ { 0xC0000116, "STATUS_ABIOS_INVALID_SELECTOR" },
+ { 0xC0000117, "STATUS_NO_LDT" },
+ { 0xC0000118, "STATUS_INVALID_LDT_SIZE" },
+ { 0xC0000119, "STATUS_INVALID_LDT_OFFSET" },
+ { 0xC000011A, "STATUS_INVALID_LDT_DESCRIPTOR" },
+ { 0xC000011B, "STATUS_INVALID_IMAGE_NE_FORMAT" },
+ { 0xC000011C, "STATUS_RXACT_INVALID_STATE" },
+ { 0xC000011D, "STATUS_RXACT_COMMIT_FAILURE" },
+ { 0xC000011E, "STATUS_MAPPED_FILE_SIZE_ZERO" },
+ { 0xC000011F, "STATUS_TOO_MANY_OPENED_FILES" },
+ { 0xC0000120, "STATUS_CANCELLED" },
+ { 0xC0000121, "STATUS_CANNOT_DELETE" },
+ { 0xC0000122, "STATUS_INVALID_COMPUTER_NAME" },
+ { 0xC0000123, "STATUS_FILE_DELETED" },
+ { 0xC0000124, "STATUS_SPECIAL_ACCOUNT" },
+ { 0xC0000125, "STATUS_SPECIAL_GROUP" },
+ { 0xC0000126, "STATUS_SPECIAL_USER" },
+ { 0xC0000127, "STATUS_MEMBERS_PRIMARY_GROUP" },
+ { 0xC0000128, "STATUS_FILE_CLOSED" },
+ { 0xC0000129, "STATUS_TOO_MANY_THREADS" },
+ { 0xC000012A, "STATUS_THREAD_NOT_IN_PROCESS" },
+ { 0xC000012B, "STATUS_TOKEN_ALREADY_IN_USE" },
+ { 0xC000012C, "STATUS_PAGEFILE_QUOTA_EXCEEDED" },
+ { 0xC000012D, "STATUS_COMMITMENT_LIMIT" },
+ { 0xC000012E, "STATUS_INVALID_IMAGE_LE_FORMAT" },
+ { 0xC000012F, "STATUS_INVALID_IMAGE_NOT_MZ" },
+ { 0xC0000130, "STATUS_INVALID_IMAGE_PROTECT" },
+ { 0xC0000131, "STATUS_INVALID_IMAGE_WIN_16" },
+ { 0xC0000132, "STATUS_LOGON_SERVER_CONFLICT" },
+ { 0xC0000133, "STATUS_TIME_DIFFERENCE_AT_DC" },
+ { 0xC0000134, "STATUS_SYNCHRONIZATION_REQUIRED" },
+ { 0xC0000135, "STATUS_DLL_NOT_FOUND" },
+ { 0xC0000136, "STATUS_OPEN_FAILED" },
+ { 0xC0000137, "STATUS_IO_PRIVILEGE_FAILED" },
+ { 0xC0000138, "STATUS_ORDINAL_NOT_FOUND" },
+ { 0xC0000139, "STATUS_ENTRYPOINT_NOT_FOUND" },
+ { 0xC000013A, "STATUS_CONTROL_C_EXIT" },
+ { 0xC000013B, "STATUS_LOCAL_DISCONNECT" },
+ { 0xC000013C, "STATUS_REMOTE_DISCONNECT" },
+ { 0xC000013D, "STATUS_REMOTE_RESOURCES" },
+ { 0xC000013E, "STATUS_LINK_FAILED" },
+ { 0xC000013F, "STATUS_LINK_TIMEOUT" },
+ { 0xC0000140, "STATUS_INVALID_CONNECTION" },
+ { 0xC0000141, "STATUS_INVALID_ADDRESS" },
+ { 0xC0000142, "STATUS_DLL_INIT_FAILED" },
+ { 0xC0000143, "STATUS_MISSING_SYSTEMFILE" },
+ { 0xC0000144, "STATUS_UNHANDLED_EXCEPTION" },
+ { 0xC0000145, "STATUS_APP_INIT_FAILURE" },
+ { 0xC0000146, "STATUS_PAGEFILE_CREATE_FAILED" },
+ { 0xC0000147, "STATUS_NO_PAGEFILE" },
+ { 0xC0000148, "STATUS_INVALID_LEVEL" },
+ { 0xC0000149, "STATUS_WRONG_PASSWORD_CORE" },
+ { 0xC000014A, "STATUS_ILLEGAL_FLOAT_CONTEXT" },
+ { 0xC000014B, "STATUS_PIPE_BROKEN" },
+ { 0xC000014C, "STATUS_REGISTRY_CORRUPT" },
+ { 0xC000014D, "STATUS_REGISTRY_IO_FAILED" },
+ { 0xC000014E, "STATUS_NO_EVENT_PAIR" },
+ { 0xC000014F, "STATUS_UNRECOGNIZED_VOLUME" },
+ { 0xC0000150, "STATUS_SERIAL_NO_DEVICE_INITED" },
+ { 0xC0000151, "STATUS_NO_SUCH_ALIAS" },
+ { 0xC0000152, "STATUS_MEMBER_NOT_IN_ALIAS" },
+ { 0xC0000153, "STATUS_MEMBER_IN_ALIAS" },
+ { 0xC0000154, "STATUS_ALIAS_EXISTS" },
+ { 0xC0000155, "STATUS_LOGON_NOT_GRANTED" },
+ { 0xC0000156, "STATUS_TOO_MANY_SECRETS" },
+ { 0xC0000157, "STATUS_SECRET_TOO_LONG" },
+ { 0xC0000158, "STATUS_INTERNAL_DB_ERROR" },
+ { 0xC0000159, "STATUS_FULLSCREEN_MODE" },
+ { 0xC000015A, "STATUS_TOO_MANY_CONTEXT_IDS" },
+ { 0xC000015B, "STATUS_LOGON_TYPE_NOT_GRANTED" },
+ { 0xC000015C, "STATUS_NOT_REGISTRY_FILE" },
+ { 0xC000015D, "STATUS_NT_CROSS_ENCRYPTION_REQUIRED" },
+ { 0xC000015E, "STATUS_DOMAIN_CTRLR_CONFIG_ERROR" },
+ { 0xC000015F, "STATUS_FT_MISSING_MEMBER" },
+ { 0xC0000160, "STATUS_ILL_FORMED_SERVICE_ENTRY" },
+ { 0xC0000161, "STATUS_ILLEGAL_CHARACTER" },
+ { 0xC0000162, "STATUS_UNMAPPABLE_CHARACTER" },
+ { 0xC0000163, "STATUS_UNDEFINED_CHARACTER" },
+ { 0xC0000164, "STATUS_FLOPPY_VOLUME" },
+ { 0xC0000165, "STATUS_FLOPPY_ID_MARK_NOT_FOUND" },
+ { 0xC0000166, "STATUS_FLOPPY_WRONG_CYLINDER" },
+ { 0xC0000167, "STATUS_FLOPPY_UNKNOWN_ERROR" },
+ { 0xC0000168, "STATUS_FLOPPY_BAD_REGISTERS" },
+ { 0xC0000169, "STATUS_DISK_RECALIBRATE_FAILED" },
+ { 0xC000016A, "STATUS_DISK_OPERATION_FAILED" },
+ { 0xC000016B, "STATUS_DISK_RESET_FAILED" },
+ { 0xC000016C, "STATUS_SHARED_IRQ_BUSY" },
+ { 0xC000016D, "STATUS_FT_ORPHANING" },
+ { 0xC000016E, "STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT" },
+ { 0xC0000172, "STATUS_PARTITION_FAILURE" },
+ { 0xC0000173, "STATUS_INVALID_BLOCK_LENGTH" },
+ { 0xC0000174, "STATUS_DEVICE_NOT_PARTITIONED" },
+ { 0xC0000175, "STATUS_UNABLE_TO_LOCK_MEDIA" },
+ { 0xC0000176, "STATUS_UNABLE_TO_UNLOAD_MEDIA" },
+ { 0xC0000177, "STATUS_EOM_OVERFLOW" },
+ { 0xC0000178, "STATUS_NO_MEDIA" },
+ { 0xC000017A, "STATUS_NO_SUCH_MEMBER" },
+ { 0xC000017B, "STATUS_INVALID_MEMBER" },
+ { 0xC000017C, "STATUS_KEY_DELETED" },
+ { 0xC000017D, "STATUS_NO_LOG_SPACE" },
+ { 0xC000017E, "STATUS_TOO_MANY_SIDS" },
+ { 0xC000017F, "STATUS_LM_CROSS_ENCRYPTION_REQUIRED" },
+ { 0xC0000180, "STATUS_KEY_HAS_CHILDREN" },
+ { 0xC0000181, "STATUS_CHILD_MUST_BE_VOLATILE" },
+ { 0xC0000182, "STATUS_DEVICE_CONFIGURATION_ERROR" },
+ { 0xC0000183, "STATUS_DRIVER_INTERNAL_ERROR" },
+ { 0xC0000184, "STATUS_INVALID_DEVICE_STATE" },
+ { 0xC0000185, "STATUS_IO_DEVICE_ERROR" },
+ { 0xC0000186, "STATUS_DEVICE_PROTOCOL_ERROR" },
+ { 0xC0000187, "STATUS_BACKUP_CONTROLLER" },
+ { 0xC0000188, "STATUS_LOG_FILE_FULL" },
+ { 0xC0000189, "STATUS_TOO_LATE" },
+ { 0xC000018A, "STATUS_NO_TRUST_LSA_SECRET" },
+ { 0xC000018B, "STATUS_NO_TRUST_SAM_ACCOUNT" },
+ { 0xC000018C, "STATUS_TRUSTED_DOMAIN_FAILURE" },
+ { 0xC000018D, "STATUS_TRUSTED_RELATIONSHIP_FAILURE" },
+ { 0xC000018E, "STATUS_EVENTLOG_FILE_CORRUPT" },
+ { 0xC000018F, "STATUS_EVENTLOG_CANT_START" },
+ { 0xC0000190, "STATUS_TRUST_FAILURE" },
+ { 0xC0000191, "STATUS_MUTANT_LIMIT_EXCEEDED" },
+ { 0xC0000192, "STATUS_NETLOGON_NOT_STARTED" },
+ { 0xC0000193, "STATUS_ACCOUNT_EXPIRED" },
+ { 0xC0000194, "STATUS_POSSIBLE_DEADLOCK" },
+ { 0xC0000195, "STATUS_NETWORK_CREDENTIAL_CONFLICT" },
+ { 0xC0000196, "STATUS_REMOTE_SESSION_LIMIT" },
+ { 0xC0000197, "STATUS_EVENTLOG_FILE_CHANGED" },
+ { 0xC0000198, "STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT" },
+ { 0xC0000199, "STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT" },
+ { 0xC000019A, "STATUS_NOLOGON_SERVER_TRUST_ACCOUNT" },
+ { 0xC000019B, "STATUS_DOMAIN_TRUST_INCONSISTENT" },
+ { 0xC000019C, "STATUS_FS_DRIVER_REQUIRED" },
+ { 0xC0000202, "STATUS_NO_USER_SESSION_KEY" },
+ { 0xC0000203, "STATUS_USER_SESSION_DELETED" },
+ { 0xC0000204, "STATUS_RESOURCE_LANG_NOT_FOUND" },
+ { 0xC0000205, "STATUS_INSUFF_SERVER_RESOURCES" },
+ { 0xC0000206, "STATUS_INVALID_BUFFER_SIZE" },
+ { 0xC0000207, "STATUS_INVALID_ADDRESS_COMPONENT" },
+ { 0xC0000208, "STATUS_INVALID_ADDRESS_WILDCARD" },
+ { 0xC0000209, "STATUS_TOO_MANY_ADDRESSES" },
+ { 0xC000020A, "STATUS_ADDRESS_ALREADY_EXISTS" },
+ { 0xC000020B, "STATUS_ADDRESS_CLOSED" },
+ { 0xC000020C, "STATUS_CONNECTION_DISCONNECTED" },
+ { 0xC000020D, "STATUS_CONNECTION_RESET" },
+ { 0xC000020E, "STATUS_TOO_MANY_NODES" },
+ { 0xC000020F, "STATUS_TRANSACTION_ABORTED" },
+ { 0xC0000210, "STATUS_TRANSACTION_TIMED_OUT" },
+ { 0xC0000211, "STATUS_TRANSACTION_NO_RELEASE" },
+ { 0xC0000212, "STATUS_TRANSACTION_NO_MATCH" },
+ { 0xC0000213, "STATUS_TRANSACTION_RESPONDED" },
+ { 0xC0000214, "STATUS_TRANSACTION_INVALID_ID" },
+ { 0xC0000215, "STATUS_TRANSACTION_INVALID_TYPE" },
+ { 0xC0000216, "STATUS_NOT_SERVER_SESSION" },
+ { 0xC0000217, "STATUS_NOT_CLIENT_SESSION" },
+ { 0xC0000218, "STATUS_CANNOT_LOAD_REGISTRY_FILE" },
+ { 0xC0000219, "STATUS_DEBUG_ATTACH_FAILED" },
+ { 0xC000021A, "STATUS_SYSTEM_PROCESS_TERMINATED" },
+ { 0xC000021B, "STATUS_DATA_NOT_ACCEPTED" },
+ { 0xC000021C, "STATUS_NO_BROWSER_SERVERS_FOUND" },
+ { 0xC000021D, "STATUS_VDM_HARD_ERROR" },
+ { 0xC000021E, "STATUS_DRIVER_CANCEL_TIMEOUT" },
+ { 0xC000021F, "STATUS_REPLY_MESSAGE_MISMATCH" },
+ { 0xC0000220, "STATUS_MAPPED_ALIGNMENT" },
+ { 0xC0000221, "STATUS_IMAGE_CHECKSUM_MISMATCH" },
+ { 0xC0000222, "STATUS_LOST_WRITEBEHIND_DATA" },
+ { 0xC0000223, "STATUS_CLIENT_SERVER_PARAMETERS_INVALID" },
+ { 0xC0000224, "STATUS_PASSWORD_MUST_CHANGE" },
+ { 0xC0000225, "STATUS_NOT_FOUND" },
+ { 0xC0000226, "STATUS_NOT_TINY_STREAM" },
+ { 0xC0000227, "STATUS_RECOVERY_FAILURE" },
+ { 0xC0000228, "STATUS_STACK_OVERFLOW_READ" },
+ { 0xC0000229, "STATUS_FAIL_CHECK" },
+ { 0xC000022A, "STATUS_DUPLICATE_OBJECTID" },
+ { 0xC000022B, "STATUS_OBJECTID_EXISTS" },
+ { 0xC000022C, "STATUS_CONVERT_TO_LARGE" },
+ { 0xC000022D, "STATUS_RETRY" },
+ { 0xC000022E, "STATUS_FOUND_OUT_OF_SCOPE" },
+ { 0xC000022F, "STATUS_ALLOCATE_BUCKET" },
+ { 0xC0000230, "STATUS_PROPSET_NOT_FOUND" },
+ { 0xC0000231, "STATUS_MARSHALL_OVERFLOW" },
+ { 0xC0000232, "STATUS_INVALID_VARIANT" },
+ { 0xC0000233, "STATUS_DOMAIN_CONTROLLER_NOT_FOUND" },
+ { 0xC0000234, "STATUS_ACCOUNT_LOCKED_OUT" },
+ { 0xC0000235, "STATUS_HANDLE_NOT_CLOSABLE" },
+ { 0xC0000236, "STATUS_CONNECTION_REFUSED" },
+ { 0xC0000237, "STATUS_GRACEFUL_DISCONNECT" },
+ { 0xC0000238, "STATUS_ADDRESS_ALREADY_ASSOCIATED" },
+ { 0xC0000239, "STATUS_ADDRESS_NOT_ASSOCIATED" },
+ { 0xC000023A, "STATUS_CONNECTION_INVALID" },
+ { 0xC000023B, "STATUS_CONNECTION_ACTIVE" },
+ { 0xC000023C, "STATUS_NETWORK_UNREACHABLE" },
+ { 0xC000023D, "STATUS_HOST_UNREACHABLE" },
+ { 0xC000023E, "STATUS_PROTOCOL_UNREACHABLE" },
+ { 0xC000023F, "STATUS_PORT_UNREACHABLE" },
+ { 0xC0000240, "STATUS_REQUEST_ABORTED" },
+ { 0xC0000241, "STATUS_CONNECTION_ABORTED" },
+ { 0xC0000242, "STATUS_BAD_COMPRESSION_BUFFER" },
+ { 0xC0000243, "STATUS_USER_MAPPED_FILE" },
+ { 0xC0000244, "STATUS_AUDIT_FAILED" },
+ { 0xC0000245, "STATUS_TIMER_RESOLUTION_NOT_SET" },
+ { 0xC0000246, "STATUS_CONNECTION_COUNT_LIMIT" },
+ { 0xC0000247, "STATUS_LOGIN_TIME_RESTRICTION" },
+ { 0xC0000248, "STATUS_LOGIN_WKSTA_RESTRICTION" },
+ { 0xC0000249, "STATUS_IMAGE_MP_UP_MISMATCH" },
+ { 0xC0000250, "STATUS_INSUFFICIENT_LOGON_INFO" },
+ { 0xC0000251, "STATUS_BAD_DLL_ENTRYPOINT" },
+ { 0xC0000252, "STATUS_BAD_SERVICE_ENTRYPOINT" },
+ { 0xC0000253, "STATUS_LPC_REPLY_LOST" },
+ { 0xC0000254, "STATUS_IP_ADDRESS_CONFLICT1" },
+ { 0xC0000255, "STATUS_IP_ADDRESS_CONFLICT2" },
+ { 0xC0000256, "STATUS_REGISTRY_QUOTA_LIMIT" },
+ { 0xC0000257, "STATUS_PATH_NOT_COVERED" },
+ { 0xC0000258, "STATUS_NO_CALLBACK_ACTIVE" },
+ { 0xC0000259, "STATUS_LICENSE_QUOTA_EXCEEDED" },
+ { 0xC000025A, "STATUS_PWD_TOO_SHORT" },
+ { 0xC000025B, "STATUS_PWD_TOO_RECENT" },
+ { 0xC000025C, "STATUS_PWD_HISTORY_CONFLICT" },
+ { 0xC000025E, "STATUS_PLUGPLAY_NO_DEVICE" },
+ { 0xC000025F, "STATUS_UNSUPPORTED_COMPRESSION" },
+ { 0xC0000260, "STATUS_INVALID_HW_PROFILE" },
+ { 0xC0000261, "STATUS_INVALID_PLUGPLAY_DEVICE_PATH" },
+ { 0xC0000262, "STATUS_DRIVER_ORDINAL_NOT_FOUND" },
+ { 0xC0000263, "STATUS_DRIVER_ENTRYPOINT_NOT_FOUND" },
+ { 0xC0000264, "STATUS_RESOURCE_NOT_OWNED" },
+ { 0xC0000265, "STATUS_TOO_MANY_LINKS" },
+ { 0xC0000266, "STATUS_QUOTA_LIST_INCONSISTENT" },
+ { 0xC0000267, "STATUS_FILE_IS_OFFLINE" },
+ { 0xC0000268, "STATUS_EVALUATION_EXPIRATION" },
+ { 0xC0000269, "STATUS_ILLEGAL_DLL_RELOCATION" },
+ { 0xC000026A, "STATUS_LICENSE_VIOLATION" },
+ { 0xC000026B, "STATUS_DLL_INIT_FAILED_LOGOFF" },
+ { 0xC000026C, "STATUS_DRIVER_UNABLE_TO_LOAD" },
+ { 0xC000026D, "STATUS_DFS_UNAVAILABLE" },
+ { 0xC000026E, "STATUS_VOLUME_DISMOUNTED" },
+ { 0xC000026F, "STATUS_WX86_INTERNAL_ERROR" },
+ { 0xC0000270, "STATUS_WX86_FLOAT_STACK_CHECK" },
+ { 0xC0000271, "STATUS_VALIDATE_CONTINUE" },
+ { 0xC0000272, "STATUS_NO_MATCH" },
+ { 0xC0000273, "STATUS_NO_MORE_MATCHES" },
+ { 0xC0000275, "STATUS_NOT_A_REPARSE_POINT" },
+ { 0xC0000276, "STATUS_IO_REPARSE_TAG_INVALID" },
+ { 0xC0000277, "STATUS_IO_REPARSE_TAG_MISMATCH" },
+ { 0xC0000278, "STATUS_IO_REPARSE_DATA_INVALID" },
+ { 0xC0000279, "STATUS_IO_REPARSE_TAG_NOT_HANDLED" },
+ { 0xC0000280, "STATUS_REPARSE_POINT_NOT_RESOLVED" },
+ { 0xC0000281, "STATUS_DIRECTORY_IS_A_REPARSE_POINT" },
+ { 0xC0000282, "STATUS_RANGE_LIST_CONFLICT" },
+ { 0xC0000283, "STATUS_SOURCE_ELEMENT_EMPTY" },
+ { 0xC0000284, "STATUS_DESTINATION_ELEMENT_FULL" },
+ { 0xC0000285, "STATUS_ILLEGAL_ELEMENT_ADDRESS" },
+ { 0xC0000286, "STATUS_MAGAZINE_NOT_PRESENT" },
+ { 0xC0000287, "STATUS_REINITIALIZATION_NEEDED" },
+ { 0x80000288, "STATUS_DEVICE_REQUIRES_CLEANING" },
+ { 0x80000289, "STATUS_DEVICE_DOOR_OPEN" },
+ { 0xC000028A, "STATUS_ENCRYPTION_FAILED" },
+ { 0xC000028B, "STATUS_DECRYPTION_FAILED" },
+ { 0xC000028C, "STATUS_RANGE_NOT_FOUND" },
+ { 0xC000028D, "STATUS_NO_RECOVERY_POLICY" },
+ { 0xC000028E, "STATUS_NO_EFS" },
+ { 0xC000028F, "STATUS_WRONG_EFS" },
+ { 0xC0000290, "STATUS_NO_USER_KEYS" },
+ { 0xC0000291, "STATUS_FILE_NOT_ENCRYPTED" },
+ { 0xC0000292, "STATUS_NOT_EXPORT_FORMAT" },
+ { 0xC0000293, "STATUS_FILE_ENCRYPTED" },
+ { 0x40000294, "STATUS_WAKE_SYSTEM" },
+ { 0xC0000295, "STATUS_WMI_GUID_NOT_FOUND" },
+ { 0xC0000296, "STATUS_WMI_INSTANCE_NOT_FOUND" },
+ { 0xC0000297, "STATUS_WMI_ITEMID_NOT_FOUND" },
+ { 0xC0000298, "STATUS_WMI_TRY_AGAIN" },
+ { 0xC0000299, "STATUS_SHARED_POLICY" },
+ { 0xC000029A, "STATUS_POLICY_OBJECT_NOT_FOUND" },
+ { 0xC000029B, "STATUS_POLICY_ONLY_IN_DS" },
+ { 0xC000029C, "STATUS_VOLUME_NOT_UPGRADED" },
+ { 0xC000029D, "STATUS_REMOTE_STORAGE_NOT_ACTIVE" },
+ { 0xC000029E, "STATUS_REMOTE_STORAGE_MEDIA_ERROR" },
+ { 0xC000029F, "STATUS_NO_TRACKING_SERVICE" },
+ { 0xC00002A0, "STATUS_SERVER_SID_MISMATCH" },
+ { 0xC00002A1, "STATUS_DS_NO_ATTRIBUTE_OR_VALUE" },
+ { 0xC00002A2, "STATUS_DS_INVALID_ATTRIBUTE_SYNTAX" },
+ { 0xC00002A3, "STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED" },
+ { 0xC00002A4, "STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS" },
+ { 0xC00002A5, "STATUS_DS_BUSY" },
+ { 0xC00002A6, "STATUS_DS_UNAVAILABLE" },
+ { 0xC00002A7, "STATUS_DS_NO_RIDS_ALLOCATED" },
+ { 0xC00002A8, "STATUS_DS_NO_MORE_RIDS" },
+ { 0xC00002A9, "STATUS_DS_INCORRECT_ROLE_OWNER" },
+ { 0xC00002AA, "STATUS_DS_RIDMGR_INIT_ERROR" },
+ { 0xC00002AB, "STATUS_DS_OBJ_CLASS_VIOLATION" },
+ { 0xC00002AC, "STATUS_DS_CANT_ON_NON_LEAF" },
+ { 0xC00002AD, "STATUS_DS_CANT_ON_RDN" },
+ { 0xC00002AE, "STATUS_DS_CANT_MOD_OBJ_CLASS" },
+ { 0xC00002AF, "STATUS_DS_CROSS_DOM_MOVE_FAILED" },
+ { 0xC00002B0, "STATUS_DS_GC_NOT_AVAILABLE" },
+ { 0xC00002B1, "STATUS_DIRECTORY_SERVICE_REQUIRED" },
+ { 0xC00002B2, "STATUS_REPARSE_ATTRIBUTE_CONFLICT" },
+ { 0xC00002B3, "STATUS_CANT_ENABLE_DENY_ONLY" },
+ { 0xC00002B4, "STATUS_FLOAT_MULTIPLE_FAULTS" },
+ { 0xC00002B5, "STATUS_FLOAT_MULTIPLE_TRAPS" },
+ { 0xC00002B6, "STATUS_DEVICE_REMOVED" },
+ { 0xC00002B7, "STATUS_JOURNAL_DELETE_IN_PROGRESS" },
+ { 0xC00002B8, "STATUS_JOURNAL_NOT_ACTIVE" },
+ { 0xC00002B9, "STATUS_NOINTERFACE" },
+ { 0xC00002C1, "STATUS_DS_ADMIN_LIMIT_EXCEEDED" },
+ { 0xC00002C2, "STATUS_DRIVER_FAILED_SLEEP" },
+ { 0xC00002C3, "STATUS_MUTUAL_AUTHENTICATION_FAILED" },
+ { 0xC00002C4, "STATUS_CORRUPT_SYSTEM_FILE" },
+ { 0xC00002C5, "STATUS_DATATYPE_MISALIGNMENT_ERROR" },
+ { 0xC00002C6, "STATUS_WMI_READ_ONLY" },
+ { 0xC00002C7, "STATUS_WMI_SET_FAILURE" },
+ { 0xC00002C8, "STATUS_COMMITMENT_MINIMUM" },
+ { 0xC00002C9, "STATUS_REG_NAT_CONSUMPTION" },
+ { 0xC00002CA, "STATUS_TRANSPORT_FULL" },
+ { 0xC00002CB, "STATUS_DS_SAM_INIT_FAILURE" },
+ { 0xC00002CC, "STATUS_ONLY_IF_CONNECTED" },
+ { 0xC00002CD, "STATUS_DS_SENSITIVE_GROUP_VIOLATION" },
+ { 0xC00002CE, "STATUS_PNP_RESTART_ENUMERATION" },
+ { 0xC00002CF, "STATUS_JOURNAL_ENTRY_DELETED" },
+ { 0xC00002D0, "STATUS_DS_CANT_MOD_PRIMARYGROUPID" },
+ { 0xC00002D1, "STATUS_SYSTEM_IMAGE_BAD_SIGNATURE" },
+ { 0xC00002D2, "STATUS_PNP_REBOOT_REQUIRED" },
+ { 0xC00002D3, "STATUS_POWER_STATE_INVALID" },
+ { 0xC00002D4, "STATUS_DS_INVALID_GROUP_TYPE" },
+ { 0xC00002D5, "STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN" },
+ { 0xC00002D6, "STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN" },
+ { 0xC00002D7, "STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER" },
+ { 0xC00002D8, "STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER" },
+ { 0xC00002D9, "STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER" },
+ { 0xC00002DA, "STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER" },
+ { 0xC00002DB, "STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER" },
+ { 0xC00002DC, "STATUS_DS_HAVE_PRIMARY_MEMBERS" },
+ { 0xC00002DD, "STATUS_WMI_NOT_SUPPORTED" },
+ { 0xC00002DE, "STATUS_INSUFFICIENT_POWER" },
+ { 0xC00002DF, "STATUS_SAM_NEED_BOOTKEY_PASSWORD" },
+ { 0xC00002E0, "STATUS_SAM_NEED_BOOTKEY_FLOPPY" },
+ { 0xC00002E1, "STATUS_DS_CANT_START" },
+ { 0xC00002E2, "STATUS_DS_INIT_FAILURE" },
+ { 0xC00002E3, "STATUS_SAM_INIT_FAILURE" },
+ { 0xC00002E4, "STATUS_DS_GC_REQUIRED" },
+ { 0xC00002E5, "STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY" },
+ { 0xC00002E6, "STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS" },
+ { 0xC00002E7, "STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED" },
+ { 0xC00002E8, "STATUS_MULTIPLE_FAULT_VIOLATION" },
+ { 0xC0000300, "STATUS_NOT_SUPPORTED_ON_SBS" },
+ { 0xC0009898, "STATUS_WOW_ASSERTION" },
+ { 0xC0020001, "RPC_NT_INVALID_STRING_BINDING" },
+ { 0xC0020002, "RPC_NT_WRONG_KIND_OF_BINDING" },
+ { 0xC0020003, "RPC_NT_INVALID_BINDING" },
+ { 0xC0020004, "RPC_NT_PROTSEQ_NOT_SUPPORTED" },
+ { 0xC0020005, "RPC_NT_INVALID_RPC_PROTSEQ" },
+ { 0xC0020006, "RPC_NT_INVALID_STRING_UUID" },
+ { 0xC0020007, "RPC_NT_INVALID_ENDPOINT_FORMAT" },
+ { 0xC0020008, "RPC_NT_INVALID_NET_ADDR" },
+ { 0xC0020009, "RPC_NT_NO_ENDPOINT_FOUND" },
+ { 0xC002000A, "RPC_NT_INVALID_TIMEOUT" },
+ { 0xC002000B, "RPC_NT_OBJECT_NOT_FOUND" },
+ { 0xC002000C, "RPC_NT_ALREADY_REGISTERED" },
+ { 0xC002000D, "RPC_NT_TYPE_ALREADY_REGISTERED" },
+ { 0xC002000E, "RPC_NT_ALREADY_LISTENING" },
+ { 0xC002000F, "RPC_NT_NO_PROTSEQS_REGISTERED" },
+ { 0xC0020010, "RPC_NT_NOT_LISTENING" },
+ { 0xC0020011, "RPC_NT_UNKNOWN_MGR_TYPE" },
+ { 0xC0020012, "RPC_NT_UNKNOWN_IF" },
+ { 0xC0020013, "RPC_NT_NO_BINDINGS" },
+ { 0xC0020014, "RPC_NT_NO_PROTSEQS" },
+ { 0xC0020015, "RPC_NT_CANT_CREATE_ENDPOINT" },
+ { 0xC0020016, "RPC_NT_OUT_OF_RESOURCES" },
+ { 0xC0020017, "RPC_NT_SERVER_UNAVAILABLE" },
+ { 0xC0020018, "RPC_NT_SERVER_TOO_BUSY" },
+ { 0xC0020019, "RPC_NT_INVALID_NETWORK_OPTIONS" },
+ { 0xC002001A, "RPC_NT_NO_CALL_ACTIVE" },
+ { 0xC002001B, "RPC_NT_CALL_FAILED" },
+ { 0xC002001C, "RPC_NT_CALL_FAILED_DNE" },
+ { 0xC002001D, "RPC_NT_PROTOCOL_ERROR" },
+ { 0xC002001F, "RPC_NT_UNSUPPORTED_TRANS_SYN" },
+ { 0xC0020021, "RPC_NT_UNSUPPORTED_TYPE" },
+ { 0xC0020022, "RPC_NT_INVALID_TAG" },
+ { 0xC0020023, "RPC_NT_INVALID_BOUND" },
+ { 0xC0020024, "RPC_NT_NO_ENTRY_NAME" },
+ { 0xC0020025, "RPC_NT_INVALID_NAME_SYNTAX" },
+ { 0xC0020026, "RPC_NT_UNSUPPORTED_NAME_SYNTAX" },
+ { 0xC0020028, "RPC_NT_UUID_NO_ADDRESS" },
+ { 0xC0020029, "RPC_NT_DUPLICATE_ENDPOINT" },
+ { 0xC002002A, "RPC_NT_UNKNOWN_AUTHN_TYPE" },
+ { 0xC002002B, "RPC_NT_MAX_CALLS_TOO_SMALL" },
+ { 0xC002002C, "RPC_NT_STRING_TOO_LONG" },
+ { 0xC002002D, "RPC_NT_PROTSEQ_NOT_FOUND" },
+ { 0xC002002E, "RPC_NT_PROCNUM_OUT_OF_RANGE" },
+ { 0xC002002F, "RPC_NT_BINDING_HAS_NO_AUTH" },
+ { 0xC0020030, "RPC_NT_UNKNOWN_AUTHN_SERVICE" },
+ { 0xC0020031, "RPC_NT_UNKNOWN_AUTHN_LEVEL" },
+ { 0xC0020032, "RPC_NT_INVALID_AUTH_IDENTITY" },
+ { 0xC0020033, "RPC_NT_UNKNOWN_AUTHZ_SERVICE" },
+ { 0xC0020034, "EPT_NT_INVALID_ENTRY" },
+ { 0xC0020035, "EPT_NT_CANT_PERFORM_OP" },
+ { 0xC0020036, "EPT_NT_NOT_REGISTERED" },
+ { 0xC0020037, "RPC_NT_NOTHING_TO_EXPORT" },
+ { 0xC0020038, "RPC_NT_INCOMPLETE_NAME" },
+ { 0xC0020039, "RPC_NT_INVALID_VERS_OPTION" },
+ { 0xC002003A, "RPC_NT_NO_MORE_MEMBERS" },
+ { 0xC002003B, "RPC_NT_NOT_ALL_OBJS_UNEXPORTED" },
+ { 0xC002003C, "RPC_NT_INTERFACE_NOT_FOUND" },
+ { 0xC002003D, "RPC_NT_ENTRY_ALREADY_EXISTS" },
+ { 0xC002003E, "RPC_NT_ENTRY_NOT_FOUND" },
+ { 0xC002003F, "RPC_NT_NAME_SERVICE_UNAVAILABLE" },
+ { 0xC0020040, "RPC_NT_INVALID_NAF_ID" },
+ { 0xC0020041, "RPC_NT_CANNOT_SUPPORT" },
+ { 0xC0020042, "RPC_NT_NO_CONTEXT_AVAILABLE" },
+ { 0xC0020043, "RPC_NT_INTERNAL_ERROR" },
+ { 0xC0020044, "RPC_NT_ZERO_DIVIDE" },
+ { 0xC0020045, "RPC_NT_ADDRESS_ERROR" },
+ { 0xC0020046, "RPC_NT_FP_DIV_ZERO" },
+ { 0xC0020047, "RPC_NT_FP_UNDERFLOW" },
+ { 0xC0020048, "RPC_NT_FP_OVERFLOW" },
+ { 0xC0021007, "RPC_P_RECEIVE_ALERTED" },
+ { 0xC0021008, "RPC_P_CONNECTION_CLOSED" },
+ { 0xC0021009, "RPC_P_RECEIVE_FAILED" },
+ { 0xC002100A, "RPC_P_SEND_FAILED" },
+ { 0xC002100B, "RPC_P_TIMEOUT" },
+ { 0xC002100C, "RPC_P_SERVER_TRANSPORT_ERROR" },
+ { 0xC002100E, "RPC_P_EXCEPTION_OCCURED" },
+ { 0xC0021012, "RPC_P_CONNECTION_SHUTDOWN" },
+ { 0xC0021015, "RPC_P_THREAD_LISTENING" },
+ { 0xC0030001, "RPC_NT_NO_MORE_ENTRIES" },
+ { 0xC0030002, "RPC_NT_SS_CHAR_TRANS_OPEN_FAIL" },
+ { 0xC0030003, "RPC_NT_SS_CHAR_TRANS_SHORT_FILE" },
+ { 0xC0030004, "RPC_NT_SS_IN_NULL_CONTEXT" },
+ { 0xC0030005, "RPC_NT_SS_CONTEXT_MISMATCH" },
+ { 0xC0030006, "RPC_NT_SS_CONTEXT_DAMAGED" },
+ { 0xC0030007, "RPC_NT_SS_HANDLES_MISMATCH" },
+ { 0xC0030008, "RPC_NT_SS_CANNOT_GET_CALL_HANDLE" },
+ { 0xC0030009, "RPC_NT_NULL_REF_POINTER" },
+ { 0xC003000A, "RPC_NT_ENUM_VALUE_OUT_OF_RANGE" },
+ { 0xC003000B, "RPC_NT_BYTE_COUNT_TOO_SMALL" },
+ { 0xC003000C, "RPC_NT_BAD_STUB_DATA" },
+ { 0xC0020049, "RPC_NT_CALL_IN_PROGRESS" },
+ { 0xC002004A, "RPC_NT_NO_MORE_BINDINGS" },
+ { 0xC002004B, "RPC_NT_GROUP_MEMBER_NOT_FOUND" },
+ { 0xC002004C, "EPT_NT_CANT_CREATE" },
+ { 0xC002004D, "RPC_NT_INVALID_OBJECT" },
+ { 0xC002004F, "RPC_NT_NO_INTERFACES" },
+ { 0xC0020050, "RPC_NT_CALL_CANCELLED" },
+ { 0xC0020051, "RPC_NT_BINDING_INCOMPLETE" },
+ { 0xC0020052, "RPC_NT_COMM_FAILURE" },
+ { 0xC0020053, "RPC_NT_UNSUPPORTED_AUTHN_LEVEL" },
+ { 0xC0020054, "RPC_NT_NO_PRINC_NAME" },
+ { 0xC0020055, "RPC_NT_NOT_RPC_ERROR" },
+ { 0x40020056, "RPC_NT_UUID_LOCAL_ONLY" },
+ { 0xC0020057, "RPC_NT_SEC_PKG_ERROR" },
+ { 0xC0020058, "RPC_NT_NOT_CANCELLED" },
+ { 0xC0030059, "RPC_NT_INVALID_ES_ACTION" },
+ { 0xC003005A, "RPC_NT_WRONG_ES_VERSION" },
+ { 0xC003005B, "RPC_NT_WRONG_STUB_VERSION" },
+ { 0xC003005C, "RPC_NT_INVALID_PIPE_OBJECT" },
+ { 0xC003005D, "RPC_NT_INVALID_PIPE_OPERATION" },
+ { 0xC003005E, "RPC_NT_WRONG_PIPE_VERSION" },
+ { 0x400200AF, "RPC_NT_SEND_INCOMPLETE" },
+ { 0, NULL }
+};
+
+/*
+ * return an NT error string from a SMB buffer
+ */
+const char *
+nt_errstr(u_int32_t err)
+{
+ static char ret[128];
+ int i;
+
+ ret[0] = 0;
+
+ for (i = 0; nt_errors[i].name; i++) {
+ if (err == nt_errors[i].code)
+ return nt_errors[i].name;
+ }
+
+ snprintf(ret, sizeof(ret), "0x%08x", err);
+ return ret;
+}
diff --git a/contrib/tcpdump/strcasecmp.c b/contrib/tcpdump/strcasecmp.c
index 7f087a47f1ca..aa6d0074219b 100644
--- a/contrib/tcpdump/strcasecmp.c
+++ b/contrib/tcpdump/strcasecmp.c
@@ -16,7 +16,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/strcasecmp.c,v 1.4.2.2 2003/11/16 08:51:57 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/strcasecmp.c,v 1.6 2003/11/16 09:36:43 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
diff --git a/contrib/tcpdump/tcp.h b/contrib/tcpdump/tcp.h
index 414b48198902..b7eef8f26d85 100644
--- a/contrib/tcpdump/tcp.h
+++ b/contrib/tcpdump/tcp.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.10 2002/12/11 07:14:11 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.11 2004/03/23 07:15:37 guy Exp $ (LBL) */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -75,6 +75,10 @@ struct tcphdr {
#define TCPOPT_CC 11 /* T/TCP CC options (rfc1644) */
#define TCPOPT_CCNEW 12 /* T/TCP CC options (rfc1644) */
#define TCPOPT_CCECHO 13 /* T/TCP CC options (rfc1644) */
+#define TCPOPT_SIGNATURE 19 /* Keyed MD5 (rfc2385) */
+#define TCPOLEN_SIGNATURE 18
+
+#define TCP_SIGLEN 16 /* length of an option 19 digest */
#define TCPOPT_TSTAMP_HDR \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
diff --git a/contrib/tcpdump/tcpdump-stdinc.h b/contrib/tcpdump/tcpdump-stdinc.h
index 00e6abea9354..0f3ae99ed5f9 100644
--- a/contrib/tcpdump/tcpdump-stdinc.h
+++ b/contrib/tcpdump/tcpdump-stdinc.h
@@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
- * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.7.2.1 2003/11/16 09:57:50 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12 2005/03/27 01:35:45 guy Exp $ (LBL)
*/
/*
@@ -52,16 +52,23 @@
#include <io.h>
#include "IP6_misc.h"
#include <fcntl.h>
+#include <sys/types.h>
+#include <net/netdb.h> /* in wpcap's Win32/include */
#ifdef __MINGW32__
#include <stdint.h>
-int* _errno();
-#define errno (*_errno())
+#endif
-#define INET_ADDRSTRLEN 16
-#define INET6_ADDRSTRLEN 46
+/* Protos for missing/x.c functions (ideally <missing/addrinfo.h>
+ * should be used, but it clashes with <ws2tcpip.h>).
+ */
+extern const char *inet_ntop (int, const void *, char *, size_t);
+extern int inet_pton (int, const char *, void *);
+extern int inet_aton (const char *cp, struct in_addr *addr);
-#endif /* __MINGW32__ */
+#ifndef INET6_ADDRSTRLEN
+#define INET6_ADDRSTRLEN 46
+#endif
#ifndef toascii
#define toascii(c) ((c) & 0x7f)
@@ -77,24 +84,14 @@ typedef char* caddr_t;
#define vsnprintf _vsnprintf
#define RETSIGTYPE void
-#if !defined(__MINGW32__) && !defined(__WATCOMC__)
-#undef toascii
-#define isascii __isascii
-#define toascii __toascii
-#define stat _stat
-#define open _open
-#define fstat _fstat
-#define read _read
-#define O_RDONLY _O_RDONLY
-
-typedef short ino_t;
-#endif /* __MINGW32__ */
-
#else /* WIN32 */
#include <ctype.h>
#include <unistd.h>
#include <netdb.h>
+#ifdef INTTYPES_H_DEFINES_FORMATS
+#include <inttypes.h>
+#endif
#include <sys/param.h>
#include <sys/types.h> /* concession to AIX */
#include <sys/time.h>
@@ -125,4 +122,39 @@ typedef short ino_t;
#define FOPEN_WRITE_BIN FOPEN_WRITE_TXT
#endif
+#if defined(__GNUC__) && defined(__i386__)
+ #undef ntohl
+ #undef ntohs
+ #undef htonl
+ #undef htons
+
+ extern __inline__ unsigned long __ntohl (unsigned long x);
+ extern __inline__ unsigned short __ntohs (unsigned short x);
+
+ #define ntohl(x) __ntohl(x)
+ #define ntohs(x) __ntohs(x)
+ #define htonl(x) __ntohl(x)
+ #define htons(x) __ntohs(x)
+
+ extern __inline__ unsigned long __ntohl (unsigned long x)
+ {
+ __asm__ ("xchgb %b0, %h0\n\t" /* swap lower bytes */
+ "rorl $16, %0\n\t" /* swap words */
+ "xchgb %b0, %h0" /* swap higher bytes */
+ : "=q" (x) : "0" (x));
+ return (x);
+ }
+
+ extern __inline__ unsigned short __ntohs (unsigned short x)
+ {
+ __asm__ ("xchgb %b0, %h0" /* swap bytes */
+ : "=q" (x) : "0" (x));
+ return (x);
+ }
+#endif
+
+#ifndef INET_ADDRSTRLEN
+#define INET_ADDRSTRLEN 16
+#endif
+
#endif /* tcpdump_stdinc_h */
diff --git a/contrib/tcpdump/tcpdump.1 b/contrib/tcpdump/tcpdump.1
index 2cbc6b2923c1..708ab025a68e 100644
--- a/contrib/tcpdump/tcpdump.1
+++ b/contrib/tcpdump/tcpdump.1
@@ -1,4 +1,4 @@
-.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.148.2.6 2004/03/28 21:25:03 fenner Exp $ (LBL)
+.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167 2004/12/28 22:31:25 guy Exp $ (LBL)
.\"
.\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $
.\"
@@ -22,7 +22,7 @@
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.TH TCPDUMP 1 "7 January 2004"
+.TH TCPDUMP 1 "22 March 2004"
.SH NAME
tcpdump \- dump traffic on a network
.SH SYNOPSIS
@@ -54,12 +54,16 @@ tcpdump \- dump traffic on a network
.I module
]
[
-.B \-r
-.I file
+.B \-M
+.I secret
]
.br
.ti +8
[
+.B \-r
+.I file
+]
+[
.B \-s
.I snaplen
]
@@ -74,6 +78,12 @@ tcpdump \- dump traffic on a network
.br
.ti +8
[
+.B \-W
+.I filecount
+]
+.br
+.ti +8
+[
.B \-E
.I spi@ipaddr algo:secret,...
]
@@ -83,6 +93,10 @@ tcpdump \- dump traffic on a network
.B \-y
.I datalinktype
]
+[
+.B \-Z
+.I user
+]
.ti +8
[
.I expression
@@ -243,7 +257,7 @@ currently larger than \fIfile_size\fP and, if so, close the current
savefile and open a new one. Savefiles after the first savefile will
have the name specified with the
.B \-w
-flag, with a number after it, starting at 2 and continuing upward.
+flag, with a number after it, starting at 1 and continuing upward.
The units of \fIfile_size\fP are millions of bytes (1,000,000 bytes,
not 1,048,576 bytes).
.TP
@@ -377,6 +391,10 @@ Load SMI MIB module definitions from file \fImodule\fR.
This option
can be used several times to load several MIB modules into \fItcpdump\fP.
.TP
+.B \-M
+Use \fIsecret\fP as a shared secret for validating the digests found in
+TCP segments with the TCP-MD5 option (RFC 2385), if present.
+.TP
.B \-n
Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.
.TP
@@ -486,11 +504,15 @@ that lacks the
function.
.TP
.B \-v
-(Slightly more) verbose output.
+When parsing and printing, produce (slightly more) verbose output.
For example, the time to live,
identification, total length and options in an IP packet are printed.
Also enables additional packet integrity checks such as verifying the
IP and ICMP header checksum.
+.IP
+When writing to a file with the
+.B \-w
+option, report, every 10 seconds, the number of packets captured.
.TP
.B \-vv
Even more verbose output.
@@ -512,6 +534,16 @@ them out.
They can later be printed with the \-r option.
Standard output is used if \fIfile\fR is ``-''.
.TP
+.B \-W
+Used in conjunction with the
+.I \-C
+option, this will limit the number
+of files created to the specified number, and begin overwriting files
+from the beginning, thus creating a 'rotating' buffer.
+In addition, it will name
+the files with enough leading 0s to support the maximum number of
+files, allowing them to sort correctly.
+.TP
.B \-x
Print each packet (minus its link level header) in hex.
The smaller of the entire packet or
@@ -537,6 +569,14 @@ its link level header, in hex and ASCII.
.TP
.B \-y
Set the data link type to use while capturing packets to \fIdatalinktype\fP.
+.TP
+.B \-Z
+Drops privileges (if root) and changes user ID to
+.I user
+and the group ID to the primary group of
+.IR user .
+.IP
+This behavior can also be enabled by default at compile time.
.IP "\fI expression\fP"
.RS
selects which packets will be dumped.
@@ -669,18 +709,18 @@ which is equivalent to:
If \fIhost\fR is a name with multiple IP addresses, each address will
be checked for a match.
.IP "\fBether dst \fIehost\fP
-True if the ethernet destination address is \fIehost\fP.
+True if the Ethernet destination address is \fIehost\fP.
\fIEhost\fP
may be either a name from /etc/ethers or a number (see
.IR ethers (3N)
for numeric format).
.IP "\fBether src \fIehost\fP
-True if the ethernet source address is \fIehost\fP.
+True if the Ethernet source address is \fIehost\fP.
.IP "\fBether host \fIehost\fP
-True if either the ethernet source or destination address is \fIehost\fP.
+True if either the Ethernet source or destination address is \fIehost\fP.
.IP "\fBgateway\fP \fIhost\fP
True if the packet used \fIhost\fP as a gateway.
-I.e., the ethernet
+I.e., the Ethernet
source or destination address was \fIhost\fP but neither the IP source
nor the IP destination was \fIhost\fP.
\fIHost\fP must be a name and
@@ -760,9 +800,9 @@ True if the packet is an IP packet (see
.IR ip (4P))
of protocol type \fIprotocol\fP.
\fIProtocol\fP can be a number or one of the names
-\fIicmp\fP, \fIicmp6\fP, \fIigmp\fP, \fIigrp\fP, \fIpim\fP, \fIah\fP,
-\fIesp\fP, \fIvrrp\fP, \fIudp\fP, or \fItcp\fP.
-Note that the identifiers \fItcp\fP, \fIudp\fP, and \fIicmp\fP are also
+\fBicmp\fP, \fBicmp6\fP, \fBigmp\fP, \fBigrp\fP, \fBpim\fP, \fBah\fP,
+\fBesp\fP, \fBvrrp\fP, \fBudp\fP, or \fBtcp\fP.
+Note that the identifiers \fBtcp\fP, \fBudp\fP, and \fBicmp\fP are also
keywords and must be escaped via backslash (\\), which is \\\\ in the C-shell.
Note that this primitive does not chase the protocol header chain.
.IP "\fBip6 proto \fIprotocol\fR"
@@ -788,7 +828,7 @@ so this can be somewhat slow.
.IP "\fBip protochain \fIprotocol\fR"
Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4.
.IP "\fBether broadcast\fR"
-True if the packet is an ethernet broadcast packet.
+True if the packet is an Ethernet broadcast packet.
The \fIether\fP
keyword is optional.
.IP "\fBip broadcast\fR"
@@ -803,8 +843,8 @@ done has no netmask or because the capture is being done on the Linux
"any" interface, which can capture on more than one interface, this
check will not work correctly.
.IP "\fBether multicast\fR"
-True if the packet is an ethernet multicast packet.
-The \fIether\fP
+True if the packet is an Ethernet multicast packet.
+The \fBether\fP
keyword is optional.
This is shorthand for `\fBether[0] & 1 != 0\fP'.
.IP "\fBip multicast\fR"
@@ -814,9 +854,9 @@ True if the packet is an IPv6 multicast packet.
.IP "\fBether proto \fIprotocol\fR"
True if the packet is of ether type \fIprotocol\fR.
\fIProtocol\fP can be a number or one of the names
-\fIip\fP, \fIip6\fP, \fIarp\fP, \fIrarp\fP, \fIatalk\fP, \fIaarp\fP,
-\fIdecnet\fP, \fIsca\fP, \fIlat\fP, \fImopdl\fP, \fImoprc\fP,
-\fIiso\fP, \fIstp\fP, \fIipx\fP, or \fInetbeui\fP.
+\fBip\fP, \fBip6\fP, \fBarp\fP, \fBrarp\fP, \fBatalk\fP, \fBaarp\fP,
+\fBdecnet\fP, \fBsca\fP, \fBlat\fP, \fBmopdl\fP, \fBmoprc\fP,
+\fBiso\fP, \fBstp\fP, \fBipx\fP, or \fBnetbeui\fP.
Note these identifiers are also keywords
and must be escaped via backslash (\\).
.IP
@@ -839,10 +879,10 @@ The exceptions are:
\fItcpdump\fR checks the DSAP (Destination Service Access Point) and
SSAP (Source Service Access Point) fields of the LLC header;
.TP
-\fBstp\fP and \fInetbeui\fP
+\fBstp\fP and \fBnetbeui\fP
\fItcpdump\fR checks the DSAP of the LLC header;
.TP
-\fIatalk\fP
+\fBatalk\fP
\fItcpdump\fR checks for a SNAP-format packet with an OUI of 0x080007
and the AppleTalk etype.
.RE
@@ -851,7 +891,7 @@ In the case of Ethernet, \fItcpdump\fR checks the Ethernet type field
for most of those protocols. The exceptions are:
.RS
.TP
-\fBiso\fP, \fBsap\fP, and \fBnetbeui\fP
+\fBiso\fP, \fBstp\fP, and \fBnetbeui\fP
\fItcpdump\fR checks for an 802.3 frame and then checks the LLC header as
it does for FDDI, Token Ring, and 802.11;
.TP
@@ -969,7 +1009,7 @@ where \fIp\fR is one of the above protocols.
.IP "\fBiso proto \fIprotocol\fR"
True if the packet is an OSI packet of protocol type \fIprotocol\fP.
\fIProtocol\fP can be a number or one of the names
-\fIclnp\fP, \fIesis\fP, or \fIisis\fP.
+\fBclnp\fP, \fBesis\fP, or \fBisis\fP.
.IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"
Abbreviations for:
.in +.5i
@@ -1037,7 +1077,8 @@ True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =,
!=, and \fIexpr\fR is an arithmetic expression composed of integer
constants (expressed in standard C syntax), the normal binary operators
[+, -, *, /, &, |, <<, >>], a length operator, and special packet data
-accessors.
+accessors. Note that all comparisons are unsigned, so that, for example,
+0x80000000 and 0xffffffff are > 0.
To access
data inside the packet, use the following syntax:
.in +.5i
@@ -1191,6 +1232,16 @@ tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocal
.fi
.RE
.LP
+To print all IPv4 HTTP packets to and from port 80, i.e. print only
+packets that contain data, not, for example, SYN and FIN packets and
+ACK-only packets. (IPv6 is left as an exercise for the reader.)
+.RS
+.nf
+.B
+tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
+.fi
+.RE
+.LP
To print IP packets longer than 576 bytes sent through gateway \fIsnup\fP:
.RS
.nf
@@ -1201,7 +1252,7 @@ tcpdump 'gateway snup and ip[2:2] > 576'
.LP
To print IP broadcast or multicast packets that were
.I not
-sent via ethernet broadcast or multicast:
+sent via Ethernet broadcast or multicast:
.RS
.nf
.B
@@ -1230,7 +1281,7 @@ gives a brief description and examples of most of the formats.
Link Level Headers
.LP
If the '-e' option is given, the link level header is printed out.
-On ethernets, the source and destination addresses, protocol,
+On Ethernets, the source and destination addresses, protocol,
and packet length are printed.
.LP
On FDDI networks, the '-e' option causes \fItcpdump\fP to print
@@ -1308,9 +1359,9 @@ arp reply csam is-at CSAM\fR
.fi
.RE
The first line says that rtsg sent an arp packet asking
-for the ethernet address of internet host csam.
+for the Ethernet address of internet host csam.
Csam
-replies with its ethernet address (in this example, ethernet addresses
+replies with its Ethernet address (in this example, Ethernet addresses
are in caps and internet addresses in lower case).
.LP
This would look less redundant if we had done \fItcpdump \-n\fP:
@@ -1332,8 +1383,8 @@ CSAM RTSG 0806 64: arp reply csam is-at CSAM\fR
.sp .5
.fi
.RE
-For the first packet this says the ethernet source address is RTSG, the
-destination is the ethernet broadcast address, the type field
+For the first packet this says the Ethernet source address is RTSG, the
+destination is the Ethernet broadcast address, the type field
contained hex 0806 (type ETHER_ARP) and the total length was 64 bytes.
.HD
TCP Packets
@@ -1761,11 +1812,6 @@ Be warned that with -v a single SMB packet
may take up a page or more, so only use -v if you really want all the
gory details.
-If you are decoding SMB sessions containing unicode strings then you
-may wish to set the environment variable USE_UNICODE to 1.
-A patch to
-auto-detect unicode strings would be welcome.
-
For information on SMB packet formats and what all te fields mean see
www.cifs.org or the pub/samba/specs/ directory on your favorite
samba.org mirror site.
@@ -2120,7 +2166,7 @@ and is as accurate as the kernel's clock.
The timestamp reflects the time the kernel first saw the packet.
No attempt
is made to account for the time lag between when the
-ethernet interface removed the packet from the wire and when the kernel
+Ethernet interface removed the packet from the wire and when the kernel
serviced the `new packet' interrupt.
.SH "SEE ALSO"
stty(1), pcap(3), bpf(4), nit(4P), pfconfig(8)
diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c
index 9b8ff306877d..82bf74664557 100644
--- a/contrib/tcpdump/tcpdump.c
+++ b/contrib/tcpdump/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] _U_ =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.216.2.10 2004/03/17 19:47:48 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253 2005/01/27 18:30:36 hannes Exp $ (LBL)";
#endif
/*
@@ -56,12 +56,22 @@ extern int SIZE_BUF;
#define uint UINT
#endif /* WIN32 */
+#ifdef HAVE_SMI_H
+#include <smi.h>
+#endif
+
#include <pcap.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef WIN32
+#include <pwd.h>
+#include <grp.h>
+#include <errno.h>
+#endif /* WIN32 */
+#include "netdissect.h"
#include "interface.h"
#include "addrtoname.h"
#include "machdep.h"
@@ -69,33 +79,19 @@ extern int SIZE_BUF;
#include "gmt2local.h"
#include "pcap-missing.h"
+netdissect_options Gndo;
+netdissect_options *gndo = &Gndo;
+
+/*
+ * Define the maximum number of files for the -C flag, and how many
+ * characters can be added to a filename for the -C flag (which
+ * should be enough to handle MAX_CFLAG - 1).
+ */
+#define MAX_CFLAG 1000000
+#define MAX_CFLAG_CHARS 6
+
int dflag; /* print filter code */
-int eflag; /* print ethernet header */
-int fflag; /* don't translate "foreign" IP address */
int Lflag; /* list available data link types and exit */
-int nflag; /* leave addresses as numbers */
-int Nflag; /* remove domains from printed host names */
-int Oflag = 1; /* run filter code optimizer */
-int pflag; /* don't go promiscuous */
-int qflag; /* quick (shorter) output */
-int Rflag = 1; /* print sequence # field in AH/ESP*/
-int sflag = 0; /* use the libsmi to translate OIDs */
-int Sflag; /* print raw TCP sequence numbers */
-int tflag = 1; /* print packet arrival time */
-int Uflag = 0; /* "unbuffered" output of dump files */
-int uflag = 0; /* Print undecoded NFS handles */
-int vflag; /* verbose */
-int xflag; /* print packet in hex */
-int Xflag; /* print packet in ascii as well as hex */
-off_t Cflag = 0; /* rotate dump files after this many bytes */
-int Aflag = 0; /* print packet only in ascii observing LF, CR, TAB, SPACE */
-int dlt = -1; /* if != -1, ask libpcap for the DLT it names */
-
-const char *dlt_name = NULL;
-
-char *espsecret = NULL; /* ESP secret key */
-
-int packettype;
static int infodelay;
static int infoprint;
@@ -110,19 +106,28 @@ static void usage(void) __attribute__((noreturn));
static void show_dlts_and_exit(pcap_t *pd) __attribute__((noreturn));
static void print_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
+static void ndo_default_print(netdissect_options *, const u_char *, u_int);
static void dump_packet_and_trunc(u_char *, const struct pcap_pkthdr *, const u_char *);
static void dump_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
+static void droproot(const char *, const char *);
+static void ndo_error(netdissect_options *ndo, const char *fmt, ...);
+static void ndo_warning(netdissect_options *ndo, const char *fmt, ...);
#ifdef SIGINFO
RETSIGTYPE requestinfo(int);
#endif
+#if defined(USE_WIN32_MM_TIMER)
+ #include <MMsystem.h>
+ static UINT timer_id;
+ static void CALLBACK verbose_stats_dump(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR);
+#elif defined(HAVE_ALARM)
+ static void verbose_stats_dump(int sig);
+#endif
+
static void info(int);
static u_int packets_captured;
-/* Length of saved portion of packet. */
-int snaplen = DEFAULT_SNAPLEN;
-
typedef u_int (*if_printer)(const struct pcap_pkthdr *, const u_char *);
struct printer {
@@ -151,6 +156,9 @@ static struct printer printers[] = {
{ sl_bsdos_if_print, DLT_SLIP_BSDOS },
#endif
{ ppp_if_print, DLT_PPP },
+#ifdef DLT_PPP_WITHDIRECTION
+ { ppp_if_print, DLT_PPP_WITHDIRECTION },
+#endif
#ifdef DLT_PPP_BSDOS
{ ppp_bsdos_if_print, DLT_PPP_BSDOS },
#endif
@@ -206,9 +214,24 @@ static struct printer printers[] = {
#ifdef DLT_ENC
{ enc_if_print, DLT_ENC },
#endif
+#ifdef DLT_SYMANTEC_FIREWALL
+ { symantec_if_print, DLT_SYMANTEC_FIREWALL },
+#endif
#ifdef DLT_APPLE_IP_OVER_IEEE1394
{ ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 },
#endif
+#ifdef DLT_JUNIPER_ATM1
+ { juniper_atm1_print, DLT_JUNIPER_ATM1 },
+#endif
+#ifdef DLT_JUNIPER_ATM2
+ { juniper_atm2_print, DLT_JUNIPER_ATM2 },
+#endif
+#ifdef DLT_JUNIPER_MLFR
+ { juniper_mlfr_print, DLT_JUNIPER_MLFR },
+#endif
+#ifdef DLT_JUNIPER_MLPPP
+ { juniper_mlppp_print, DLT_JUNIPER_MLPPP },
+#endif
{ NULL, 0 },
};
@@ -290,6 +313,12 @@ show_dlts_and_exit(pcap_t *pd)
#endif /* WIN32 */
#ifdef HAVE_PCAP_FINDALLDEVS
+#ifndef HAVE_PCAP_IF_T
+#undef HAVE_PCAP_FINDALLDEVS
+#endif
+#endif
+
+#ifdef HAVE_PCAP_FINDALLDEVS
#define D_FLAG "D"
#else
#define D_FLAG
@@ -301,12 +330,89 @@ show_dlts_and_exit(pcap_t *pd)
#define U_FLAG
#endif
+#ifndef WIN32
+/* Drop root privileges and chroot if necessary */
+static void
+droproot(const char *username, const char *chroot_dir)
+{
+ struct passwd *pw = NULL;
+
+ if (chroot_dir && !username) {
+ fprintf(stderr, "tcpdump: Chroot without dropping root is insecure\n");
+ exit(1);
+ }
+
+ pw = getpwnam(username);
+ if (pw) {
+ if (chroot_dir) {
+ if (chroot(chroot_dir) != 0 || chdir ("/") != 0) {
+ fprintf(stderr, "tcpdump: Couldn't chroot/chdir to '%.64s': %s\n",
+ chroot_dir, pcap_strerror(errno));
+ exit(1);
+ }
+ }
+ if (initgroups(pw->pw_name, pw->pw_gid) != 0 ||
+ setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) {
+ fprintf(stderr, "tcpdump: Couldn't change to '%.32s' uid=%lu gid=%lu: %s\n",
+ username,
+ (unsigned long)pw->pw_uid,
+ (unsigned long)pw->pw_gid,
+ pcap_strerror(errno));
+ exit(1);
+ }
+ }
+ else {
+ fprintf(stderr, "tcpdump: Couldn't find user '%.32s'\n",
+ username);
+ exit(1);
+ }
+}
+#endif /* WIN32 */
+
+static int
+getWflagChars(int x)
+{
+ int c = 0;
+
+ x -= 1;
+ while (x > 0) {
+ c += 1;
+ x /= 10;
+ }
+
+ return c;
+}
+
+
+static void
+MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
+{
+ if (cnt == 0 && max_chars == 0)
+ strcpy(buffer, orig_name);
+ else
+ sprintf(buffer, "%s%0*d", orig_name, max_chars, cnt);
+}
+
+static int tcpdump_printf(netdissect_options *ndo _U_,
+ const char *fmt, ...)
+{
+
+ va_list args;
+ int ret;
+
+ va_start(args, fmt);
+ ret=vfprintf(stdout, fmt, args);
+ va_end(args);
+
+ return ret;
+}
+
int
main(int argc, char **argv)
{
register int cnt, op, i;
bpf_u_int32 localnet, netmask;
- register char *cp, *infile, *cmdbuf, *device, *RFileName, *WFileName;
+ register char *cp, *infile, *cmdbuf, *device, *RFileName, *WFileName, *WFileNameAlt;
pcap_handler callback;
int type;
struct bpf_program fcode;
@@ -317,6 +423,8 @@ main(int argc, char **argv)
struct dump_info dumpinfo;
u_char *pcap_userdata;
char ebuf[PCAP_ERRBUF_SIZE];
+ char *username = NULL;
+ char *chroot_dir = NULL;
#ifdef HAVE_PCAP_FINDALLDEVS
pcap_if_t *devpointer;
int devnum;
@@ -327,6 +435,15 @@ main(int argc, char **argv)
if(wsockinit() != 0) return 1;
#endif /* WIN32 */
+ gndo->ndo_Oflag=1;
+ gndo->ndo_Rflag=1;
+ gndo->ndo_dlt=-1;
+ gndo->ndo_default_print=ndo_default_print;
+ gndo->ndo_printf=tcpdump_printf;
+ gndo->ndo_error=ndo_error;
+ gndo->ndo_warning=ndo_warning;
+ gndo->ndo_snaplen = DEFAULT_SNAPLEN;
+
cnt = -1;
device = NULL;
infile = NULL;
@@ -346,7 +463,7 @@ main(int argc, char **argv)
opterr = 0;
while (
- (op = getopt(argc, argv, "aA" B_FLAG "c:C:d" D_FLAG "eE:fF:i:lLm:nNOpqr:Rs:StT:u" U_FLAG "vw:xXy:Y")) != -1)
+ (op = getopt(argc, argv, "aA" B_FLAG "c:C:d" D_FLAG "eE:fF:i:lLm:M:nNOpqr:Rs:StT:u" U_FLAG "vw:W:xXy:YZ:")) != -1)
switch (op) {
case 'a':
@@ -411,7 +528,7 @@ main(int argc, char **argv)
#ifndef HAVE_LIBCRYPTO
warning("crypto code not compiled in");
#endif
- espsecret = optarg;
+ gndo->ndo_espsecret = optarg;
break;
case 'f':
@@ -499,6 +616,14 @@ main(int argc, char **argv)
#endif
break;
+ case 'M':
+ /* TCP-MD5 shared secret */
+#ifndef HAVE_LIBCRYPTO
+ warning("crypto code not compiled in");
+#endif
+ tcpmd5secret = optarg;
+ break;
+
case 'O':
Oflag = 0;
break;
@@ -536,7 +661,7 @@ main(int argc, char **argv)
break;
case 't':
- --tflag;
+ ++tflag;
break;
case 'T':
@@ -580,20 +705,27 @@ main(int argc, char **argv)
WFileName = optarg;
break;
+ case 'W':
+ Wflag = atoi(optarg);
+ if (Wflag < 0)
+ error("invalid number of output files %s", optarg);
+ WflagChars = getWflagChars(Wflag);
+ break;
+
case 'x':
++xflag;
break;
case 'X':
- ++xflag;
++Xflag;
break;
case 'y':
- dlt_name = optarg;
- dlt = pcap_datalink_name_to_val(dlt_name);
- if (dlt < 0)
- error("invalid data link type %s", dlt_name);
+ gndo->ndo_dltname = optarg;
+ gndo->ndo_dlt =
+ pcap_datalink_name_to_val(gndo->ndo_dltname);
+ if (gndo->ndo_dlt < 0)
+ error("invalid data link type %s", gndo->ndo_dltname);
break;
#if defined(HAVE_PCAP_DEBUG) || defined(HAVE_YYDEBUG)
@@ -610,13 +742,55 @@ main(int argc, char **argv)
}
break;
#endif
+ case 'Z':
+ if (optarg) {
+ username = strdup(optarg);
+ }
+ else {
+ usage();
+ /* NOTREACHED */
+ }
+ break;
+
default:
usage();
/* NOTREACHED */
}
- if (tflag > 0)
+ switch (tflag) {
+
+ case 0: /* Default */
+ case 4: /* Default + Date*/
thiszone = gmt2local(0);
+ break;
+
+ case 1: /* No time stamp */
+ case 2: /* Unix timeval style */
+ case 3: /* Microseconds since previous packet */
+ break;
+
+ default: /* Not supported */
+ error("only -t, -tt, -ttt, and -tttt are supported");
+ break;
+ }
+
+#ifdef WITH_CHROOT
+ /* if run as root, prepare for chrooting */
+ if (getuid() == 0 || geteuid() == 0) {
+ /* future extensibility for cmd-line arguments */
+ if (!chroot_dir)
+ chroot_dir = WITH_CHROOT;
+ }
+#endif
+
+#ifdef WITH_USER
+ /* if run as root, prepare for dropping root privileges */
+ if (getuid() == 0 || geteuid() == 0) {
+ /* Run with '-Z root' to restore old behaviour */
+ if (!username)
+ username = WITH_USER;
+ }
+#endif
if (RFileName != NULL) {
int dlt;
@@ -632,7 +806,8 @@ main(int argc, char **argv)
* people's trace files (especially if we're set-UID
* root).
*/
- setuid(getuid());
+ if (setgid(getgid()) != 0 || setuid(getuid()) != 0 )
+ fprintf(stderr, "Warning: setgid/setuid failed !\n");
#endif /* WIN32 */
pd = pcap_open_offline(RFileName, ebuf);
if (pd == NULL)
@@ -659,11 +834,8 @@ main(int argc, char **argv)
error("%s", ebuf);
}
#ifdef WIN32
- if(IsTextUnicode(device,
- wcslen((short*)device), // Device always ends with a double \0, so this way to determine its
- // length should be always valid
- NULL))
- {
+ if(strlen(device) == 1) //we assume that an ASCII string is always longer than 1 char
+ { //a Unicode string has a \0 as second byte (so strlen() is 1)
fprintf(stderr, "%s: listening on %ws\n", program_name, device);
}
else
@@ -679,6 +851,13 @@ main(int argc, char **argv)
error("%s", ebuf);
else if (*ebuf)
warning("%s", ebuf);
+ /*
+ * Let user own process after socket has been opened.
+ */
+#ifndef WIN32
+ if (setgid(getgid()) != 0 || setuid(getuid()) != 0)
+ fprintf(stderr, "Warning: setgid/setuid failed !\n");
+#endif /* WIN32 */
#ifdef WIN32
if(UserBufferSize != 1000000)
if(pcap_setbuff(pd, UserBufferSize)==-1){
@@ -687,9 +866,9 @@ main(int argc, char **argv)
#endif /* WIN32 */
if (Lflag)
show_dlts_and_exit(pd);
- if (dlt >= 0) {
+ if (gndo->ndo_dlt >= 0) {
#ifdef HAVE_PCAP_SET_DATALINK
- if (pcap_set_datalink(pd, dlt) < 0)
+ if (pcap_set_datalink(pd, gndo->ndo_dlt) < 0)
error("%s", pcap_geterr(pd));
#else
/*
@@ -697,13 +876,13 @@ main(int argc, char **argv)
* data link type, so we only let them
* set it to what it already is.
*/
- if (dlt != pcap_datalink(pd)) {
+ if (gndo->ndo_dlt != pcap_datalink(pd)) {
error("%s is not one of the DLTs supported by this device\n",
- dlt_name);
+ gndo->ndo_dltname);
}
#endif
(void)fprintf(stderr, "%s: data link type %s\n",
- program_name, dlt_name);
+ program_name, gndo->ndo_dltname);
(void)fflush(stderr);
}
i = pcap_snapshot(pd);
@@ -716,12 +895,6 @@ main(int argc, char **argv)
netmask = 0;
warning("%s", ebuf);
}
- /*
- * Let user own process after socket has been opened.
- */
-#ifndef WIN32
- setuid(getuid());
-#endif /* WIN32 */
}
if (infile)
cmdbuf = read_infile(infile);
@@ -751,7 +924,13 @@ main(int argc, char **argv)
if (pcap_setfilter(pd, &fcode) < 0)
error("%s", pcap_geterr(pd));
if (WFileName) {
- pcap_dumper_t *p = pcap_dump_open(pd, WFileName);
+ pcap_dumper_t *p;
+
+ WFileNameAlt = (char *)malloc(strlen(WFileName) + MAX_CFLAG_CHARS + 1);
+ if (WFileNameAlt == NULL)
+ error("malloc of WFileNameAlt");
+ MakeFilename(WFileNameAlt, WFileName, 0, WflagChars);
+ p = pcap_dump_open(pd, WFileNameAlt);
if (p == NULL)
error("%s", pcap_geterr(pd));
if (Cflag != 0) {
@@ -768,18 +947,46 @@ main(int argc, char **argv)
type = pcap_datalink(pd);
printinfo.printer = lookup_printer(type);
if (printinfo.printer == NULL) {
- dlt_name = pcap_datalink_val_to_name(type);
- if (dlt_name != NULL)
- error("unsupported data link type %s", dlt_name);
+ gndo->ndo_dltname = pcap_datalink_val_to_name(type);
+ if (gndo->ndo_dltname != NULL)
+ error("unsupported data link type %s",
+ gndo->ndo_dltname);
else
error("unsupported data link type %d", type);
}
callback = print_packet;
pcap_userdata = (u_char *)&printinfo;
}
+#ifndef WIN32
+ /*
+ * We cannot do this earlier, because we want to be able to open
+ * the file (if done) for writing before giving up permissions.
+ */
+ if (getuid() == 0 || geteuid() == 0) {
+ if (username || chroot_dir)
+ droproot(username, chroot_dir);
+ }
+#endif /* WIN32 */
#ifdef SIGINFO
(void)setsignal(SIGINFO, requestinfo);
#endif
+
+ if (vflag > 0 && WFileName) {
+ /*
+ * When capturing to a file, "-v" means tcpdump should,
+ * every 10 secodns, "v"erbosely report the number of
+ * packets captured.
+ */
+#ifdef USE_WIN32_MM_TIMER
+ /* call verbose_stats_dump() each 1000 +/-100msec */
+ timer_id = timeSetEvent(1000, 100, verbose_stats_dump, 0, TIME_PERIODIC);
+ setvbuf(stderr, NULL, _IONBF, 0);
+#elif defined(HAVE_ALARM)
+ (void)setsignal(SIGALRM, verbose_stats_dump);
+ alarm(1);
+#endif
+ }
+
#ifndef WIN32
if (RFileName == NULL) {
int dlt;
@@ -842,6 +1049,14 @@ main(int argc, char **argv)
static RETSIGTYPE
cleanup(int signo _U_)
{
+#ifdef USE_WIN32_MM_TIMER
+ if (timer_id)
+ timeKillEvent(timer_id);
+ timer_id = 0;
+#elif defined(HAVE_ALARM)
+ alarm(0);
+#endif
+
#ifdef HAVE_PCAP_BREAKLOOP
/*
* We have "pcap_breakloop()"; use it, so that we do as little
@@ -899,37 +1114,9 @@ info(register int verbose)
}
static void
-reverse(char *s)
-{
- int i, j, c;
-
- for (i = 0, j = strlen(s) - 1; i < j; i++, j--) {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
-}
-
-
-static void
-swebitoa(unsigned int n, char *s)
-{
- unsigned int i;
-
- i = 0;
- do {
- s[i++] = n % 10 + '0';
- } while ((n /= 10) > 0);
-
- s[i] = '\0';
- reverse(s);
-}
-
-static void
dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
{
struct dump_info *dump_info;
- static uint cnt = 2;
char *name;
++packets_captured;
@@ -948,14 +1135,18 @@ dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *s
* Close the current file and open a new one.
*/
pcap_dump_close(dump_info->p);
- if (cnt >= 1000)
- error("too many output files");
- name = (char *) malloc(strlen(dump_info->WFileName) + 4);
+ Cflag_count++;
+ if (Wflag > 0) {
+ if (Cflag_count >= Wflag)
+ Cflag_count = 0;
+ } else {
+ if (Cflag_count >= MAX_CFLAG)
+ error("too many output files");
+ }
+ name = (char *)malloc(strlen(dump_info->WFileName) + MAX_CFLAG_CHARS + 1);
if (name == NULL)
error("dump_packet_and_trunc: malloc");
- strcpy(name, dump_info->WFileName);
- swebitoa(cnt, name + strlen(dump_info->WFileName));
- cnt++;
+ MakeFilename(name, dump_info->WFileName, Cflag_count, WflagChars);
dump_info->p = pcap_dump_open(dump_info->pd, name);
free(name);
if (dump_info->p == NULL)
@@ -1020,7 +1211,26 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
/*
* Include the link-layer header.
*/
- default_print(sp, h->caplen);
+ hex_print("\n\t", sp, h->caplen);
+ } else {
+ /*
+ * Don't include the link-layer header - and if
+ * we have nothing past the link-layer header,
+ * print nothing.
+ */
+ if (h->caplen > hdrlen)
+ hex_print("\n\t", sp + hdrlen,
+ h->caplen - hdrlen);
+ }
+ } else if (Xflag) {
+ /*
+ * Print the raw packet data.
+ */
+ if (Xflag > 1) {
+ /*
+ * Include the link-layer header.
+ */
+ ascii_print("\n\t", sp, h->caplen);
} else {
/*
* Don't include the link-layer header - and if
@@ -1028,7 +1238,7 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
* print nothing.
*/
if (h->caplen > hdrlen)
- default_print(sp + hdrlen,
+ ascii_print("\n\t", sp + hdrlen,
h->caplen - hdrlen);
}
}
@@ -1060,18 +1270,26 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
* "Wpcap_version" information on Windows.
*/
char WDversion[]="current-cvs.tcpdump.org";
+#if !defined(HAVE_GENERATED_VERSION)
char version[]="current-cvs.tcpdump.org";
+#endif
char pcap_version[]="current-cvs.tcpdump.org";
- char Wpcap_version[]="3.0 alpha";
+ char Wpcap_version[]="3.1";
#endif
/*
* By default, print the specified data out in hex.
*/
+static void
+ndo_default_print(netdissect_options *ndo _U_, const u_char *bp, u_int length)
+{
+ ascii_print("\n\t", bp, length); /* pass on lf and identation string */
+}
+
void
-default_print(register const u_char *bp, register u_int length)
+default_print(const u_char *bp, u_int length)
{
- ascii_print("\n\t", bp, length); /* pass on lf and identation string */
+ ndo_default_print(gndo, bp, length);
}
#ifdef SIGINFO
@@ -1084,6 +1302,29 @@ RETSIGTYPE requestinfo(int signo _U_)
}
#endif
+/*
+ * Called once each second in verbose mode while dumping to file
+ */
+#ifdef USE_WIN32_MM_TIMER
+void CALLBACK verbose_stats_dump (UINT timer_id _U_, UINT msg _U_, DWORD_PTR arg _U_,
+ DWORD_PTR dw1 _U_, DWORD_PTR dw2 _U_)
+{
+ struct pcap_stat stat;
+
+ if (infodelay == 0 && pcap_stats(pd, &stat) >= 0)
+ fprintf(stderr, "Got %u\r", packets_captured);
+}
+#elif defined(HAVE_ALARM)
+static void verbose_stats_dump(int sig _U_)
+{
+ struct pcap_stat stat;
+
+ if (infodelay == 0 && pcap_stats(pd, &stat) >= 0)
+ fprintf(stderr, "Got %u\r", packets_captured);
+ alarm(1);
+}
+#endif
+
static void
usage(void)
{
@@ -1097,8 +1338,12 @@ usage(void)
#endif /* HAVE_PCAP_LIB_VERSION */
#ifdef HAVE_PCAP_LIB_VERSION
+#ifdef WIN32
+ (void)fprintf(stderr, "%s version %s, based on tcpdump version %s\n", program_name, WDversion, version);
+#else /* WIN32 */
(void)fprintf(stderr, "%s version %s\n", program_name, version);
- (void)fprintf(stderr, "%s\n", pcap_lib_version());
+#endif /* WIN32 */
+ (void)fprintf(stderr, "%s\n",pcap_lib_version());
#else /* HAVE_PCAP_LIB_VERSION */
#ifdef WIN32
(void)fprintf(stderr, "%s version %s, based on tcpdump version %s\n", program_name, WDversion, version);
@@ -1111,10 +1356,51 @@ usage(void)
(void)fprintf(stderr,
"Usage: %s [-aAd" D_FLAG "eflLnNOpqRStu" U_FLAG "vxX]" B_FLAG_USAGE " [-c count] [ -C file_size ]\n", program_name);
(void)fprintf(stderr,
-"\t\t[ -E algo:secret ] [ -F file ] [ -i interface ] [ -r file ]\n");
+"\t\t[ -E algo:secret ] [ -F file ] [ -i interface ] [ -M secret ]\n");
+ (void)fprintf(stderr,
+"\t\t[ -r file ] [ -s snaplen ] [ -T type ] [ -w file ]\n");
(void)fprintf(stderr,
-"\t\t[ -s snaplen ] [ -T type ] [ -w file ] [ -y datalinktype ]\n");
+"\t\t[ -W filecount ] [ -y datalinktype ] [ -Z user ]\n");
(void)fprintf(stderr,
"\t\t[ expression ]\n");
exit(1);
}
+
+
+
+/* VARARGS */
+static void
+ndo_error(netdissect_options *ndo _U_, const char *fmt, ...)
+{
+ va_list ap;
+
+ (void)fprintf(stderr, "%s: ", program_name);
+ va_start(ap, fmt);
+ (void)vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (*fmt) {
+ fmt += strlen(fmt);
+ if (fmt[-1] != '\n')
+ (void)fputc('\n', stderr);
+ }
+ exit(1);
+ /* NOTREACHED */
+}
+
+/* VARARGS */
+static void
+ndo_warning(netdissect_options *ndo _U_, const char *fmt, ...)
+{
+ va_list ap;
+
+ (void)fprintf(stderr, "%s: WARNING: ", program_name);
+ va_start(ap, fmt);
+ (void)vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (*fmt) {
+ fmt += strlen(fmt);
+ if (fmt[-1] != '\n')
+ (void)fputc('\n', stderr);
+ }
+}
+
diff --git a/contrib/tcpdump/udp.h b/contrib/tcpdump/udp.h
index eb6c20bc0b3a..001b05972f9b 100644
--- a/contrib/tcpdump/udp.h
+++ b/contrib/tcpdump/udp.h
@@ -1,4 +1,4 @@
-/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.5 2003/10/27 22:44:37 hannes Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.8 2005/04/06 21:33:28 mcr Exp $ (LBL) */
/*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
@@ -52,12 +52,15 @@ struct udphdr {
#define NTP_PORT 123 /*XXX*/
#define SNMPTRAP_PORT 162 /*XXX*/
#define ISAKMP_PORT 500 /*XXX*/
+#define SYSLOG_PORT 514 /* rfc3164 */
#define TIMED_PORT 525 /*XXX*/
#define RIP_PORT 520 /*XXX*/
#define LDP_PORT 646
#define AODV_PORT 654 /*XXX*/
#define KERBEROS_SEC_PORT 750 /*XXX*/
#define L2TP_PORT 1701 /*XXX*/
+#define SIP_PORT 5060
+#define ISAKMP_PORT_NATT 4500 /* rfc3948 */
#define ISAKMP_PORT_USER1 7500 /*XXX - nonstandard*/
#define ISAKMP_PORT_USER2 8500 /*XXX - nonstandard*/
#define RX_PORT_LOW 7000 /*XXX*/
@@ -76,6 +79,7 @@ struct udphdr {
#define MPLS_LSP_PING_PORT 3503 /* draft-ietf-mpls-lsp-ping-02.txt */
#define BFD_CONTROL_PORT 3784 /* draft-katz-ward-bfd-v4v6-1hop-00.txt */
#define BFD_ECHO_PORT 3785 /* draft-katz-ward-bfd-v4v6-1hop-00.txt */
+#define LMP_PORT 49998 /* unofficial - no IANA assignment yet */
#ifdef INET6
#define RIPNG_PORT 521 /*XXX*/
diff --git a/contrib/tcpdump/util.c b/contrib/tcpdump/util.c
index f7df263de5dd..f34250652480 100644
--- a/contrib/tcpdump/util.c
+++ b/contrib/tcpdump/util.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.87.2.3 2003/12/29 22:42:23 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.95 2005/03/21 11:35:55 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -116,19 +116,25 @@ ts_print(register const struct timeval *tvp)
static unsigned b_sec;
static unsigned b_usec;
- switch(tflag) {
- case 1: /* Default */
+ switch (tflag) {
+
+ case 0: /* Default */
s = (tvp->tv_sec + thiszone) % 86400;
(void)printf("%02d:%02d:%02d.%06u ",
s / 3600, (s % 3600) / 60, s % 60,
(unsigned)tvp->tv_usec);
break;
- case -1: /* Unix timeval style */
+
+ case 1: /* No time stamp */
+ break;
+
+ case 2: /* Unix timeval style */
(void)printf("%u.%06u ",
(unsigned)tvp->tv_sec,
(unsigned)tvp->tv_usec);
break;
- case -2:
+
+ case 3: /* Microseconds since previous packet */
if (b_sec == 0) {
printf("000000 ");
} else {
@@ -146,7 +152,8 @@ ts_print(register const struct timeval *tvp)
b_sec = tvp->tv_sec;
b_usec = tvp->tv_usec;
break;
- case -3: /* Default + Date*/
+
+ case 4: /* Default + Date*/
s = (tvp->tv_sec + thiszone) % 86400;
Time = (tvp->tv_sec + thiszone) - s;
tm = gmtime (&Time);
@@ -209,20 +216,35 @@ print_unknown_data(const u_char *cp,const char *ident,int len)
* Convert a token value to a string; use "fmt" if not found.
*/
const char *
-tok2str(register const struct tok *lp, register const char *fmt,
- register int v)
+tok2strbuf(register const struct tok *lp, register const char *fmt,
+ register int v, char *buf, size_t bufsize)
{
- static char buf[128];
-
- while (lp->s != NULL) {
+ while (lp->s != NULL && lp != NULL) {
if (lp->v == v)
return (lp->s);
++lp;
}
if (fmt == NULL)
fmt = "#%d";
- (void)snprintf(buf, sizeof(buf), fmt, v);
- return (buf);
+
+ (void)snprintf(buf, bufsize, fmt, v);
+ return (const char *)buf;
+}
+
+/*
+ * Convert a token value to a string; use "fmt" if not found.
+ */
+const char *
+tok2str(register const struct tok *lp, register const char *fmt,
+ register int v)
+{
+ static char buf[4][128];
+ static int idx = 0;
+ char *ret;
+
+ ret = buf[idx];
+ idx = (idx+1) & 3;
+ return tok2strbuf(lp, fmt, v, ret, sizeof(buf[0]));
}
/*
@@ -231,14 +253,14 @@ tok2str(register const struct tok *lp, register const char *fmt,
*/
char *
bittok2str(register const struct tok *lp, register const char *fmt,
- register int v)
+ register int v)
{
static char buf[256]; /* our stringbuffer */
int buflen=0;
register int rotbit; /* this is the bit we rotate through all bitpositions */
register int tokval;
- while (lp->s != NULL) {
+ while (lp->s != NULL && lp != NULL) {
tokval=lp->v; /* load our first value */
rotbit=1;
while (rotbit != 0) {
diff --git a/contrib/tcpdump/vfprintf.c b/contrib/tcpdump/vfprintf.c
index 0a9e2356de60..354406ce2c43 100644
--- a/contrib/tcpdump/vfprintf.c
+++ b/contrib/tcpdump/vfprintf.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/vfprintf.c,v 1.4.8.2 2003/11/16 08:51:58 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/vfprintf.c,v 1.6 2003/11/16 09:36:45 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H