summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-05-29 18:17:16 +0000
committersam <sam@FreeBSD.org>2005-05-29 18:17:16 +0000
commit777fc78fe5d7142db2a7e4b9fc3ad2f082e02446 (patch)
tree00ad2d6dd16ad34ea9cdf4e6521ac3fe7179a0f3 /contrib/tcpdump
parent8c6500f369940b5e6f664368df8ecb0ac8e346d7 (diff)
parent88a191f109e4bbf287e317e4115185aa904a7757 (diff)
downloadFreeBSD-src-777fc78fe5d7142db2a7e4b9fc3ad2f082e02446.zip
FreeBSD-src-777fc78fe5d7142db2a7e4b9fc3ad2f082e02446.tar.gz
This commit was generated by cvs2svn to compensate for changes in r146773,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/tcpdump')
-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/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/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/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/pcap-missing.h2
-rw-r--r--contrib/tcpdump/pf.h4
-rw-r--r--contrib/tcpdump/pmap_prot.h94
-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-ascii.c10
-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-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-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-frag6.c2
-rw-r--r--contrib/tcpdump/print-gre.c169
-rw-r--r--contrib/tcpdump/print-hsrp.c2
-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-ip6opts.c2
-rw-r--r--contrib/tcpdump/print-ipcomp.c2
-rw-r--r--contrib/tcpdump/print-ipfc.c4
-rw-r--r--contrib/tcpdump/print-isakmp.c147
-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-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-ospf.c169
-rw-r--r--contrib/tcpdump/print-ospf6.c2
-rw-r--r--contrib/tcpdump/print-pflog.c22
-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-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-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-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/udp.h6
-rw-r--r--contrib/tcpdump/util.c52
-rw-r--r--contrib/tcpdump/vfprintf.c2
126 files changed, 10689 insertions, 1927 deletions
diff --git a/contrib/tcpdump/.cvsignore b/contrib/tcpdump/.cvsignore
index f07c8e4..791f14c 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 e69ba22..db20780 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 b5c286c..0370e07 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 0b86817..2479f27 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 3593973..8ffb9f8 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 38fe874..c7ead57 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 f1e0267..17df49d 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 269aa9c..b233a76 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 09e8351..4a743b8 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/appletalk.h b/contrib/tcpdump/appletalk.h
index 83e6f70..67e62ef 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 0000000..06be3ea
--- /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 4f289a1..0cad4d9 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 a8d564d..a02d6b7 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 7907b87..3af0745 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 3479473..1bb29bb 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 0000000..14c0a9e
--- /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 0000000..14ed376
--- /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 0000000..b738471
--- /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/extract.h b/contrib/tcpdump/extract.h
index 25980e4..f3db250 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 325b53a..0716e26 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 f35211f..76ddc2f 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 978e583..926e86c 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 931de2f..c000855 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 0000000..c56be01
--- /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/ip.h b/contrib/tcpdump/ip.h
index 37ef774..6dbd9de 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 0000000..f3fe741
--- /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 b73cc20..b2159d6 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 0000000..d98e69a
--- /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 0000000..64eb024
--- /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 c114326..9da9a39 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 6c73ee7..5b04503 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 0000000..69fc9c9
--- /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 0000000..83114b2
--- /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 0000000..7dfd6a6
--- /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 0000000..fdca446
--- /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 f195d6d..df85669 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 40c75c9..5fa008c 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 3348bd2..c2bb2be 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 39df977..4dcaf3e 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/pcap-missing.h b/contrib/tcpdump/pcap-missing.h
index adf24d8..7739c1e 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 314802c..c2d332a 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 0000000..fdc4831
--- /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/print-802_11.c b/contrib/tcpdump/print-802_11.c
index 56462c9..c4c0ac8 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 4094c25..92ed909 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 099e355..80a547d 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 8c07456..8cfbba6 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 32bb161..63f9c21 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-ascii.c b/contrib/tcpdump/print-ascii.c
index b7f868d..02be8e0 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-beep.c b/contrib/tcpdump/print-beep.c
index b566254..db40d611 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 2c6aec4..485dde8 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 bfa472a..135ffe3 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-cdp.c b/contrib/tcpdump/print-cdp.c
index c69d962..4398fbe 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 583b0ba..730d1aa 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 17dd308..b877788 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 0179ba7..2c1043f 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 f84b080..43fe71d 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 1193e37..b304f87 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-dvmrp.c b/contrib/tcpdump/print-dvmrp.c
index 5e45d55..2c159bf 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 0000000..fb39e76
--- /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 6cfaa30..e5a811d 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 0000000..f4db8ed
--- /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 c7196e7..f9b871b 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 0ca0cfa..bf125eb 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-frag6.c b/contrib/tcpdump/print-frag6.c
index 2356efb..534c5c1 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 8657b58..d739356 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 9205038..03dace7 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-icmp6.c b/contrib/tcpdump/print-icmp6.c
index 88580b2..4cf7deb 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 717ae16..c310d55 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 4622a93..b166690 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-ip6opts.c b/contrib/tcpdump/print-ip6opts.c
index a6960b8..dc63da8 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 7a3c1ba..099e5ad 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 1262ecf..6fa4fe1 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-isakmp.c b/contrib/tcpdump/print-isakmp.c
index d5caa739..09972f0 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-juniper.c b/contrib/tcpdump/print-juniper.c
new file mode 100644
index 0000000..5d48bf7
--- /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 1d3a6d7..d6c8e14 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 a8f0568..a4036d1 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 3cdee5a..93ef256 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 1162ac3..61d2a54 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-lmp.c b/contrib/tcpdump/print-lmp.c
new file mode 100644
index 0000000..d2089fe
--- /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 0000000..34e433c
--- /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 5272d439..d0d6fe1 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 5815102..fe6f013 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 f5a1a4c..a1a24a9 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 6e936c8..3cb3504 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 0606574..3f79b68 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 c25f343..419953c 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-ospf.c b/contrib/tcpdump/print-ospf.c
index d239caf..5a217fe 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 5e6e69a..6325a21 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 24634b2..f8b18a9 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-pppoe.c b/contrib/tcpdump/print-pppoe.c
index 69179c6..8835e1e 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 11e8330..c4c8300 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 b3f790e..0f8eaf5 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 00153e5..0fe6dd1 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 8c4301f..772a2e0 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 3432207..5e7a02e 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 534878e..959a620 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 6adc009..95de311 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 64ec7ed..bf7c6bd 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 deac239..b0e0036 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 0000000..b4d13b1
--- /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-sll.c b/contrib/tcpdump/print-sll.c
index df0ce59..aeb0610 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 5f683ef..fe1b439 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 e1db216..4758ac2 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 7b28070..a13f24e 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 10be487..acd38bf 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-symantec.c b/contrib/tcpdump/print-symantec.c
new file mode 100644
index 0000000..652bbb6
--- /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 0000000..099d027
--- /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 5b0b06c..e51f4e9 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 b420d35..7888727 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 261b594..9efc0da 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 9ad7668..3df2241 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-vjc.c b/contrib/tcpdump/print-vjc.c
index f1877f2..55b7d08 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 f615dfd..f575e4a 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 678e325..e28697a 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 186960c..f50e8c9 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 0000000..c72b603
--- /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 0000000..ed281ce
--- /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 b772264..dbb8678 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 883ba64..bb05227 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 5c1350f..b7875f5 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 7f087a4..aa6d007 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 414b481..b7eef8f 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 00e6abe..0f3ae99 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/udp.h b/contrib/tcpdump/udp.h
index eb6c20b..001b059 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 f7df263..f342506 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 0a9e235..354406c 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
OpenPOWER on IntegriCloud