mirror of
https://github.com/opnsense/src.git
synced 2026-07-15 04:01:09 -04:00
This commit was generated by cvs2svn to compensate for changes in r146773,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
233f3abd96
126 changed files with 10708 additions and 1946 deletions
|
|
@ -9,3 +9,4 @@ config.h
|
|||
stamp-h
|
||||
stamp-h.in
|
||||
tcpdump
|
||||
autom4te.cache
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.8.3
|
||||
3.9-PRE-CVS
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
|
|||
17
contrib/tcpdump/bgp.h
Executable file
17
contrib/tcpdump/bgp.h
Executable file
|
|
@ -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 *);
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
1770
contrib/tcpdump/configure
vendored
1770
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -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)
|
||||
|
|
|
|||
144
contrib/tcpdump/cpack.c
Normal file
144
contrib/tcpdump/cpack.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
51
contrib/tcpdump/cpack.h
Normal file
51
contrib/tcpdump/cpack.h
Normal file
|
|
@ -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 */
|
||||
41
contrib/tcpdump/decode_prefix.h
Normal file
41
contrib/tcpdump/decode_prefix.h
Normal file
|
|
@ -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
|
||||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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[];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
201
contrib/tcpdump/ieee802_11_radio.h
Normal file
201
contrib/tcpdump/ieee802_11_radio.h
Normal file
|
|
@ -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_ */
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
58
contrib/tcpdump/ipproto.c
Executable file
58
contrib/tcpdump/ipproto.c
Executable file
|
|
@ -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 }
|
||||
};
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
58
contrib/tcpdump/l2vpn.c
Executable file
58
contrib/tcpdump/l2vpn.c
Executable file
|
|
@ -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}
|
||||
};
|
||||
17
contrib/tcpdump/l2vpn.h
Executable file
17
contrib/tcpdump/l2vpn.h
Executable file
|
|
@ -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[];
|
||||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
41
contrib/tcpdump/mpls.h
Normal file
41
contrib/tcpdump/mpls.h
Normal file
|
|
@ -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)
|
||||
435
contrib/tcpdump/netdissect.h
Normal file
435
contrib/tcpdump/netdissect.h
Normal file
|
|
@ -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 */
|
||||
45
contrib/tcpdump/nlpid.c
Executable file
45
contrib/tcpdump/nlpid.c
Executable file
|
|
@ -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 }
|
||||
};
|
||||
32
contrib/tcpdump/nlpid.h
Normal file
32
contrib/tcpdump/nlpid.h
Normal file
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
94
contrib/tcpdump/pmap_prot.h
Normal file
94
contrib/tcpdump/pmap_prot.h
Normal file
|
|
@ -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 */
|
||||
|
|
@ -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 "ieee802_11.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,8 +924,200 @@ 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;
|
||||
|
||||
|
|
@ -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]");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -372,6 +402,97 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
|||
case DH6OPT_RELAY_MSG:
|
||||
printf(" (");
|
||||
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 */
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
71
contrib/tcpdump/print-eap.c
Normal file
71
contrib/tcpdump/print-eap.c
Normal file
|
|
@ -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:
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
481
contrib/tcpdump/print-eigrp.c
Normal file
481
contrib/tcpdump/print-eigrp.c
Normal file
|
|
@ -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");
|
||||
}
|
||||
|
|
@ -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:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
vers = EXTRACT_16BITS(bp) & GRE_VERS_MASK;
|
||||
printf("GREv%u",vers);
|
||||
|
||||
if (vers == 0)
|
||||
gre_print_0(bp, len);
|
||||
else if (vers == 1)
|
||||
gre_print_1(bp, len);
|
||||
else
|
||||
printf("gre-unknown-version=%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;
|
||||
case GREPROTO_ISO:
|
||||
#ifdef INET6
|
||||
case ETHERTYPE_IPV6:
|
||||
ip6_print(bp, len);
|
||||
break;
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
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));
|
||||
|
||||
if ((p->nd_ra_flags_reserved & ~ND_RA_FLAG_RTPREF_MASK)
|
||||
!= 0)
|
||||
printf(" ");
|
||||
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
409
contrib/tcpdump/print-juniper.c
Normal file
409
contrib/tcpdump/print-juniper.c
Normal file
|
|
@ -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:
|
||||
*/
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
713
contrib/tcpdump/print-lmp.c
Normal file
713
contrib/tcpdump/print-lmp.c
Normal file
|
|
@ -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");
|
||||
}
|
||||
859
contrib/tcpdump/print-lspping.c
Normal file
859
contrib/tcpdump/print-lspping.c
Normal file
|
|
@ -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(×tamp);
|
||||
|
||||
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(×tamp);
|
||||
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");
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = ", (";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
60
contrib/tcpdump/print-sip.c
Normal file
60
contrib/tcpdump/print-sip.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue