mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
Virgin import of tcpdump v3.9.1 (alpha 096) from tcpdump.org
This commit is contained in:
parent
5b0fe47811
commit
1de50e9f41
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/tcpdump/dist/; revision=146773
@ -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
|
||||
|
63
contrib/tcpdump/aclocal.m4
vendored
63
contrib/tcpdump/aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.98.2.4 2004/03/28 21:04:49 fenner Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106 2005/03/27 03:31:01 guy Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1995, 1996, 1997, 1998
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -166,8 +166,13 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
# at least some versions of HP's C compiler can inline that, but can't
|
||||
# inline a function that returns a struct pointer.
|
||||
#
|
||||
# Make sure we use the V_CCOPT flags, because some of those might
|
||||
# disable inlining.
|
||||
#
|
||||
AC_DEFUN(AC_LBL_C_INLINE,
|
||||
[AC_MSG_CHECKING(for inline)
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$V_CCOPT"
|
||||
AC_CACHE_VAL(ac_cv_lbl_inline, [
|
||||
ac_cv_lbl_inline=""
|
||||
ac_lbl_cc_inline=no
|
||||
@ -195,6 +200,7 @@ AC_DEFUN(AC_LBL_C_INLINE,
|
||||
if test "$ac_lbl_cc_inline" = yes ; then
|
||||
ac_cv_lbl_inline=$ac_lbl_inline
|
||||
fi])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
if test ! -z "$ac_cv_lbl_inline" ; then
|
||||
AC_MSG_RESULT($ac_cv_lbl_inline)
|
||||
else
|
||||
@ -586,6 +592,47 @@ AC_DEFUN(AC_LBL_CHECK_TYPE,
|
||||
AC_DEFINE($1, $2)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Check whether a given format can be used to print 64-bit integers
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_CHECK_64BIT_FORMAT,
|
||||
[
|
||||
AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers])
|
||||
AC_RUN_IFELSE(
|
||||
[
|
||||
AC_LANG_SOURCE(
|
||||
[[
|
||||
# ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
# endif
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
main()
|
||||
{
|
||||
u_int64_t t = 1;
|
||||
char strbuf[16+1];
|
||||
sprintf(strbuf, "%016$1x", t << 32);
|
||||
if (strcmp(strbuf, "0000000100000000") == 0)
|
||||
exit(0);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
]])
|
||||
],
|
||||
[
|
||||
AC_DEFINE(PRId64, "$1d")
|
||||
AC_DEFINE(PRIo64, "$1o")
|
||||
AC_DEFINE(PRIx64, "$1x")
|
||||
AC_DEFINE(PRIu64, "$1u")
|
||||
AC_MSG_RESULT(yes)
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
$2
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if unaligned memory accesses fail
|
||||
dnl
|
||||
@ -980,6 +1027,20 @@ dnl check for u_int32_t
|
||||
else
|
||||
$1=no
|
||||
fi
|
||||
dnl check for u_int64_t
|
||||
AC_MSG_CHECKING(for u_int64_t)
|
||||
AC_CACHE_VAL(ac_cv_u_int64_t,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>],
|
||||
[u_int64_t i],
|
||||
ac_cv_u_int64_t=yes,
|
||||
ac_cv_u_int64_t=no))
|
||||
AC_MSG_RESULT($ac_cv_u_int64_t)
|
||||
if test $ac_cv_u_int64_t = yes; then
|
||||
AC_DEFINE(HAVE_U_INT64_T)
|
||||
else
|
||||
$1=no
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.96.2.6 2004/03/24 04:14:31 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108 2005/03/27 22:38:09 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -39,11 +39,15 @@ struct rtentry; /* declarations in <net/if.h> */
|
||||
#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */
|
||||
#include <netinet/if_ether.h>
|
||||
#endif /* HAVE_NETINET_IF_ETHER_H */
|
||||
#ifdef HAVE_NETINET_ETHER_H
|
||||
#include <netinet/ether.h> /* ether_ntohost on linux */
|
||||
#endif /* HAVE_NETINET_ETHER_H */
|
||||
#ifdef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
|
||||
#include <netinet/ether.h>
|
||||
#endif /* NETINET_ETHER_H_DECLARES_ETHER_NTOHOST */
|
||||
#endif /* USE_ETHER_NTOHOST */
|
||||
|
||||
#if !defined(HAVE_DECL_ETHER_NTOHOST) || !HAVE_DECL_ETHER_NTOHOST
|
||||
extern int ether_ntohost(char *, const struct ether_addr *);
|
||||
#endif
|
||||
|
||||
#include <pcap.h>
|
||||
#include <pcap-namedb.h>
|
||||
#include <signal.h>
|
||||
@ -103,25 +107,20 @@ win32_gethostbyaddr(const char *addr, int len, int type)
|
||||
memset(&addr6, 0, sizeof(addr6));
|
||||
addr6.sin6_family = AF_INET6;
|
||||
memcpy(&addr6.sin6_addr, addr, len);
|
||||
#ifdef __MINGW32__
|
||||
/* MinGW doesn't provide getnameinfo */
|
||||
return NULL;
|
||||
#else
|
||||
if (getnameinfo((struct sockaddr *)&addr6, sizeof(addr6),
|
||||
hname, sizeof(hname), NULL, 0, 0)) {
|
||||
return NULL;
|
||||
hname, sizeof(hname), NULL, 0, 0)) {
|
||||
return NULL;
|
||||
} else {
|
||||
strcpy(host.h_name, hname);
|
||||
return &host;
|
||||
}
|
||||
#endif /* __MINGW32__ */
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#define gethostbyaddr win32_gethostbyaddr
|
||||
#endif /* INET6 & WIN32*/
|
||||
#endif /* INET6 & WIN32 */
|
||||
|
||||
#ifdef INET6
|
||||
struct h6namemem {
|
||||
@ -464,18 +463,25 @@ etheraddr_string(register const u_char *ep)
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
if (!nflag) {
|
||||
char buf2[128];
|
||||
if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) {
|
||||
|
||||
/*
|
||||
* We don't cast it to "const struct ether_addr *"
|
||||
* because some systems don't modify the Ethernet
|
||||
* address but fail to declare the second argument
|
||||
* as a "const" pointer.
|
||||
*/
|
||||
if (ether_ntohost(buf2, (struct ether_addr *)ep) == 0) {
|
||||
tp->e_name = strdup(buf2);
|
||||
return (tp->e_name);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
cp = buf;
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
for (i = 5; (int)--i >= 0;) {
|
||||
*cp++ = ':';
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
}
|
||||
*cp = '\0';
|
||||
@ -486,7 +492,7 @@ etheraddr_string(register const u_char *ep)
|
||||
const char *
|
||||
linkaddr_string(const u_char *ep, const unsigned int len)
|
||||
{
|
||||
register u_int i, j;
|
||||
register u_int i;
|
||||
register char *cp;
|
||||
register struct enamemem *tp;
|
||||
|
||||
@ -500,13 +506,11 @@ linkaddr_string(const u_char *ep, const unsigned int len)
|
||||
tp->e_name = cp = (char *)malloc(len*3);
|
||||
if (tp->e_name == NULL)
|
||||
error("linkaddr_string: malloc");
|
||||
if ((j = *ep >> 4) != 0)
|
||||
*cp++ = hex[j];
|
||||
*cp++ = hex[*ep >> 4];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
for (i = len-1; i > 0 ; --i) {
|
||||
*cp++ = ':';
|
||||
if ((j = *ep >> 4) != 0)
|
||||
*cp++ = hex[j];
|
||||
*cp++ = hex[*ep >> 4];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
}
|
||||
*cp = '\0';
|
||||
@ -585,26 +589,32 @@ llcsap_string(u_char sap)
|
||||
return (tp->name);
|
||||
}
|
||||
|
||||
#define ISONSAP_MAX_LENGTH 20
|
||||
const char *
|
||||
isonsap_string(const u_char *nsap)
|
||||
isonsap_string(const u_char *nsap, register u_int nsap_length)
|
||||
{
|
||||
register u_int i, nlen = nsap[0];
|
||||
register u_int nsap_idx;
|
||||
register char *cp;
|
||||
register struct enamemem *tp;
|
||||
|
||||
if (nsap_length < 1 || nsap_length > ISONSAP_MAX_LENGTH)
|
||||
error("isonsap_string: illegal length");
|
||||
|
||||
tp = lookup_nsap(nsap);
|
||||
if (tp->e_name)
|
||||
return tp->e_name;
|
||||
|
||||
tp->e_name = cp = (char *)malloc(nlen * 2 + 2);
|
||||
tp->e_name = cp = (char *)malloc(sizeof("xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx"));
|
||||
if (cp == NULL)
|
||||
error("isonsap_string: malloc");
|
||||
|
||||
nsap++;
|
||||
*cp++ = '/';
|
||||
for (i = nlen; (int)--i >= 0;) {
|
||||
for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
|
||||
*cp++ = hex[*nsap >> 4];
|
||||
*cp++ = hex[*nsap++ & 0xf];
|
||||
if (((nsap_idx & 1) == 0) &&
|
||||
(nsap_idx + 1 < nsap_length)) {
|
||||
*cp++ = '.';
|
||||
}
|
||||
}
|
||||
*cp = '\0';
|
||||
return (tp->e_name);
|
||||
@ -705,13 +715,14 @@ init_servarray(void)
|
||||
endservent();
|
||||
}
|
||||
|
||||
/*XXX from libbpfc.a */
|
||||
#ifndef WIN32
|
||||
extern struct eproto {
|
||||
/* in libpcap.a (nametoaddr.c) */
|
||||
#if defined(WIN32) && !defined(USE_STATIC_LIBPCAP)
|
||||
__declspec(dllimport)
|
||||
#else
|
||||
__declspec( dllimport) struct eproto {
|
||||
extern
|
||||
#endif
|
||||
char *s;
|
||||
const struct eproto {
|
||||
const char *s;
|
||||
u_short p;
|
||||
} eproto_db[];
|
||||
|
||||
@ -829,9 +840,16 @@ init_etherarray(void)
|
||||
continue;
|
||||
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
/* Use yp/nis version of name if available */
|
||||
if (ether_ntohost(name, (const struct ether_addr *)el->addr) == 0) {
|
||||
tp->e_name = strdup(name);
|
||||
/*
|
||||
* Use YP/NIS version of name if available.
|
||||
*
|
||||
* We don't cast it to "const struct ether_addr *"
|
||||
* because some systems don't modify the Ethernet
|
||||
* address but fail to declare the second argument
|
||||
* as a "const" pointer.
|
||||
*/
|
||||
if (ether_ntohost(name, (struct ether_addr *)el->addr) == 0) {
|
||||
tp->e_name = strdup(name);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
@ -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,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.20 2003/07/01 19:10:26 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.24 2004/10/07 16:04:07 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -33,6 +33,13 @@
|
||||
* <netinet/if_ether.h> if all it needs are ETHERTYPE_ values.
|
||||
*/
|
||||
|
||||
#ifndef ETHERTYPE_LEN
|
||||
#define ETHERTYPE_LEN 2
|
||||
#endif
|
||||
|
||||
#ifndef ETHERTYPE_GRE_ISO
|
||||
#define ETHERTYPE_GRE_ISO 0x00FE /* not really an ethertype only used in GRE */
|
||||
#endif
|
||||
#ifndef ETHERTYPE_PUP
|
||||
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
|
||||
#endif
|
||||
@ -114,6 +121,12 @@
|
||||
#ifndef ETHERTYPE_PPPOES
|
||||
#define ETHERTYPE_PPPOES 0x8864
|
||||
#endif
|
||||
#ifndef ETHERTYPE_JUMBO
|
||||
#define ETHERTYPE_JUMBO 0x8870
|
||||
#endif
|
||||
#ifndef ETHERTYPE_EAPOL
|
||||
#define ETHERTYPE_EAPOL 0x888e
|
||||
#endif
|
||||
#ifndef ETHERTYPE_LOOPBACK
|
||||
#define ETHERTYPE_LOOPBACK 0x9000
|
||||
#endif
|
||||
|
@ -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_ */
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.217.2.5 2004/03/17 19:47:48 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244 2005/04/06 21:33:27 mcr Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -61,30 +61,6 @@ extern char *strdup(const char *);
|
||||
extern char *strsep(char **, const char *);
|
||||
#endif
|
||||
|
||||
struct tok {
|
||||
int v; /* value */
|
||||
const char *s; /* string */
|
||||
};
|
||||
|
||||
extern int aflag; /* translate network and broadcast addresses */
|
||||
extern int dflag; /* print filter code */
|
||||
extern int eflag; /* print ethernet header */
|
||||
extern int fflag; /* don't translate "foreign" IP address */
|
||||
extern int nflag; /* leave addresses as numbers */
|
||||
extern int Nflag; /* remove domains from printed host names */
|
||||
extern int qflag; /* quick (shorter) output */
|
||||
extern int Rflag; /* print sequence # field in AH/ESP*/
|
||||
extern int sflag; /* use the libsmi to translate OIDs */
|
||||
extern int Sflag; /* print raw TCP sequence numbers */
|
||||
extern int tflag; /* print packet arrival time */
|
||||
extern int uflag; /* Print undecoded NFS handles */
|
||||
extern int vflag; /* verbose */
|
||||
extern int xflag; /* print packet in hex */
|
||||
extern int Xflag; /* print packet in hex/ascii */
|
||||
extern int Aflag; /* print packet only in ascii observing TAB, LF, CR and SPACE as graphical chars */
|
||||
extern char *espsecret;
|
||||
|
||||
extern int packettype; /* as specified by -T */
|
||||
#define PT_VAT 1 /* Visual Audio Tool */
|
||||
#define PT_WB 2 /* distributed White Board */
|
||||
#define PT_RPC 3 /* Remote Procedure Call */
|
||||
@ -132,10 +108,6 @@ extern char *program_name; /* used to generate self-identifying messages */
|
||||
|
||||
extern int32_t thiszone; /* seconds offset from gmt to local time */
|
||||
|
||||
extern int snaplen;
|
||||
/* global pointer to end of current packet (during printing) */
|
||||
extern const u_char *snapend;
|
||||
|
||||
/*
|
||||
* True if "l" bytes of "var" were captured.
|
||||
*
|
||||
@ -161,9 +133,7 @@ extern void relts_print(int);
|
||||
|
||||
extern int fn_print(const u_char *, const u_char *);
|
||||
extern int fn_printn(const u_char *, u_int, const u_char *);
|
||||
extern const char *tok2str(const struct tok *, const char *, int);
|
||||
extern int mask2plen(u_int32_t);
|
||||
extern char *bittok2str(const struct tok *, const char *, int);
|
||||
extern const char *tok2strary_internal(const char **, int, const char *, int);
|
||||
#define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
|
||||
|
||||
@ -179,7 +149,7 @@ extern char *copy_argv(char **);
|
||||
extern void safeputchar(int);
|
||||
extern void safeputs(const char *);
|
||||
|
||||
extern const char *isonsap_string(const u_char *);
|
||||
extern const char *isonsap_string(const u_char *, register u_int);
|
||||
extern const char *llcsap_string(u_char);
|
||||
extern const char *protoid_string(const u_char *);
|
||||
extern const char *ipxsap_string(u_short);
|
||||
@ -191,11 +161,11 @@ extern const char *dnnum_string(u_short);
|
||||
#include <pcap.h>
|
||||
|
||||
extern int print_unknown_data(const u_char *, const char *,int);
|
||||
extern void ascii_print_with_offset(const u_char *, const u_char *, u_int, u_int);
|
||||
extern void ascii_print(const u_char *, const u_char *, u_int);
|
||||
extern void hex_print_with_offset(const u_char *, const u_char *, u_int, u_int);
|
||||
extern void ascii_print_with_offset(const char *, const u_char *, u_int, u_int);
|
||||
extern void ascii_print(const char *, const u_char *, u_int);
|
||||
extern void hex_print_with_offset(const char *, const u_char *, u_int, u_int);
|
||||
extern void telnet_print(const u_char *, u_int);
|
||||
extern void hex_print(const u_char *, const u_char *, u_int);
|
||||
extern void hex_print(const char *, const u_char *, u_int);
|
||||
extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
|
||||
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
|
||||
const u_char *, u_short *);
|
||||
@ -203,20 +173,19 @@ extern int snap_print(const u_char *, u_int, u_int, u_short *, u_int32_t,
|
||||
u_short, u_int);
|
||||
extern void aarp_print(const u_char *, u_int);
|
||||
extern void aodv_print(const u_char *, u_int, int);
|
||||
extern void arp_print(const u_char *, u_int, u_int);
|
||||
extern void atalk_print(const u_char *, u_int);
|
||||
extern void atm_print(u_int, u_int, u_int, const u_char *, u_int, u_int);
|
||||
extern u_int atm_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sunatm_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern int oam_print(const u_char *, u_int);
|
||||
extern void bootp_print(const u_char *, u_int);
|
||||
extern void bgp_print(const u_char *, int);
|
||||
extern void beep_print(const u_char *, u_int);
|
||||
extern void cnfp_print(const u_char *, const u_char *);
|
||||
extern void decnet_print(const u_char *, u_int, u_int);
|
||||
extern void default_print(const u_char *, u_int);
|
||||
extern void default_print_unaligned(const u_char *, u_int);
|
||||
extern void dvmrp_print(const u_char *, u_int);
|
||||
extern void egp_print(const u_char *);
|
||||
extern void egp_print(const u_char *, u_int);
|
||||
extern u_int enc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int pflog_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int arcnet_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
@ -236,7 +205,6 @@ extern void gre_print(const u_char *, u_int);
|
||||
extern void icmp_print(const u_char *, u_int, const u_char *, int);
|
||||
extern void igmp_print(const u_char *, u_int);
|
||||
extern void igrp_print(const u_char *, u_int, const u_char *);
|
||||
extern void ip_print(const u_char *, u_int);
|
||||
extern void ipN_print(const u_char *, u_int);
|
||||
extern u_int ipfc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void ipx_print(const u_char *, u_int);
|
||||
@ -255,6 +223,9 @@ extern void pimv1_print(const u_char *, u_int);
|
||||
extern void cisco_autorp_print(const u_char *, u_int);
|
||||
extern void rsvp_print(const u_char *, u_int);
|
||||
extern void ldp_print(const u_char *, u_int);
|
||||
extern void lmp_print(const u_char *, u_int);
|
||||
extern void lspping_print(const u_char *, u_int);
|
||||
extern void eigrp_print(const u_char *, u_int);
|
||||
extern void mobile_print(const u_char *, u_int);
|
||||
extern void pim_print(const u_char *, u_int);
|
||||
extern u_int pppoe_print(const u_char *, u_int);
|
||||
@ -264,6 +235,7 @@ extern u_int ppp_hdlc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ppp_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int pppoe_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int prism_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void q933_print(const u_char *, u_int);
|
||||
extern int vjc_print(register const char *, u_short);
|
||||
extern u_int raw_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void rip_print(const u_char *, u_int);
|
||||
@ -273,17 +245,20 @@ extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mlfr_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mlppp_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void snmp_print(const u_char *, u_int);
|
||||
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
|
||||
extern u_int symantec_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void tcp_print(const u_char *, u_int, const u_char *, int);
|
||||
extern void tftp_print(const u_char *, u_int);
|
||||
extern void timed_print(const u_char *);
|
||||
extern void udp_print(const u_char *, u_int, const u_char *, int);
|
||||
extern void wb_print(const void *, u_int);
|
||||
extern int ah_print(register const u_char *);
|
||||
extern int esp_print(register const u_char *, register const u_char *, int *, int *);
|
||||
extern void isakmp_print(const u_char *, u_int, const u_char *);
|
||||
extern int ipcomp_print(register const u_char *, int *);
|
||||
extern void rx_print(register const u_char *, int, int, int, u_char *);
|
||||
extern void netbeui_print(u_short, const u_char *, int);
|
||||
@ -292,6 +267,7 @@ extern void nbt_tcp_print(const u_char *, int);
|
||||
extern void nbt_udp137_print(const u_char *, int);
|
||||
extern void nbt_udp138_print(const u_char *, int);
|
||||
extern char *smb_errstr(int, int);
|
||||
extern const char *nt_errstr(u_int32_t);
|
||||
extern void print_data(const unsigned char *, int);
|
||||
extern void l2tp_print(const u_char *, u_int);
|
||||
extern void vrrp_print(const u_char *, u_int, int);
|
||||
@ -306,6 +282,8 @@ extern void mpls_lsp_ping_print(const u_char *, u_int);
|
||||
extern void zephyr_print(const u_char *, int);
|
||||
extern void hsrp_print(const u_char *, u_int);
|
||||
extern void bfd_print(const u_char *, u_int, u_int);
|
||||
extern void sip_print(const u_char *, u_int);
|
||||
extern void syslog_print(const u_char *, u_int);
|
||||
|
||||
#ifdef INET6
|
||||
extern void ip6_print(const u_char *, u_int);
|
||||
@ -327,4 +305,38 @@ extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t);
|
||||
struct bpf_program;
|
||||
|
||||
extern void bpf_dump(struct bpf_program *, int);
|
||||
|
||||
#endif
|
||||
|
||||
#include "netdissect.h"
|
||||
|
||||
/* forward compatibility */
|
||||
|
||||
netdissect_options *gndo;
|
||||
|
||||
#define eflag gndo->ndo_eflag
|
||||
#define fflag gndo->ndo_fflag
|
||||
#define nflag gndo->ndo_nflag
|
||||
#define Nflag gndo->ndo_Nflag
|
||||
#define Oflag gndo->ndo_Oflag
|
||||
#define pflag gndo->ndo_pflag
|
||||
#define qflag gndo->ndo_qflag
|
||||
#define Rflag gndo->ndo_Rflag
|
||||
#define sflag gndo->ndo_sflag
|
||||
#define Sflag gndo->ndo_Sflag
|
||||
#define tflag gndo->ndo_tflag
|
||||
#define Uflag gndo->ndo_Uflag
|
||||
#define uflag gndo->ndo_uflag
|
||||
#define vflag gndo->ndo_vflag
|
||||
#define xflag gndo->ndo_xflag
|
||||
#define Xflag gndo->ndo_Xflag
|
||||
#define Cflag gndo->ndo_Cflag
|
||||
#define Aflag gndo->ndo_Aflag
|
||||
#define packettype gndo->ndo_packettype
|
||||
#define tcpmd5secret gndo->ndo_tcpmd5secret
|
||||
#define Wflag gndo->ndo_Wflag
|
||||
#define WflagChars gndo->ndo_WflagChars
|
||||
#define Cflag_count gndo->ndo_Cflag_count
|
||||
#define snaplen gndo->ndo_snaplen
|
||||
#define snapend gndo->ndo_snapend
|
||||
|
||||
|
@ -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
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.25.2.2 2003/11/16 08:51:07 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.28 2004/03/25 03:30:55 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -111,7 +111,7 @@ static int is_UCX(const unsigned char *);
|
||||
void
|
||||
Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
|
||||
register const unsigned char *fh;
|
||||
int len;
|
||||
int len _U_;
|
||||
my_fsid *fsidp;
|
||||
ino_t *inop;
|
||||
const char **osnamep; /* if non-NULL, return OS name here */
|
||||
|
@ -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 */
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.14 2003/05/22 15:29:22 hannes Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.16 2004/10/20 16:14:16 hannes Exp $ (LBL) */
|
||||
/*
|
||||
* Point to Point Protocol (PPP) RFC1331
|
||||
*
|
||||
@ -20,6 +20,9 @@
|
||||
#define PPP_ADDRESS 0xff /* The address byte value */
|
||||
#define PPP_CONTROL 0x03 /* The control byte value */
|
||||
|
||||
#define PPP_WITHDIRECTION_IN 0x00 /* non-standard for DLT_PPP_WITHDIRECTION */
|
||||
#define PPP_WITHDIRECTION_OUT 0x01 /* non-standard for DLT_PPP_WITHDIRECTION */
|
||||
|
||||
/* Protocol numbers */
|
||||
#define PPP_IP 0x0021 /* Raw IP */
|
||||
#define PPP_OSI 0x0023 /* OSI Network Layer */
|
||||
@ -32,6 +35,7 @@
|
||||
#define PPP_BRPDU 0x0031 /* Bridging PDU */
|
||||
#define PPP_STII 0x0033 /* Stream Protocol (ST-II) */
|
||||
#define PPP_VINES 0x0035 /* Banyan Vines */
|
||||
#define PPP_ML 0x003d /* Multi-Link PPP */
|
||||
#define PPP_IPV6 0x0057 /* IPv6 */
|
||||
#define PPP_COMP 0x00fd /* Compressed Datagram */
|
||||
|
||||
@ -60,7 +64,7 @@
|
||||
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */
|
||||
#define PPP_BACP 0xc02b /* Bandwidth Allocation Control Protocol */
|
||||
#define PPP_BAP 0xc02d /* BAP */
|
||||
#define PPP_MP 0xc03d /* Multi-Link */
|
||||
#define PPP_MPCP 0xc03d /* Multi-Link */
|
||||
#define PPP_SPAP_OLD 0xc123
|
||||
#define PPP_EAP 0xc227
|
||||
|
||||
|
@ -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:
|
||||
*/
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.61.2.2 2003/11/16 08:51:10 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.64 2004/04/30 16:42:14 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -33,7 +33,7 @@ static const char rcsid[] _U_ =
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "netdissect.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ether.h"
|
||||
#include "ethertype.h"
|
||||
@ -158,173 +158,184 @@ struct atmarp_pkthdr {
|
||||
static u_char ezero[6];
|
||||
|
||||
static void
|
||||
atmarp_addr_print(const u_char *ha, u_int ha_len, const u_char *srca,
|
||||
atmarp_addr_print(netdissect_options *ndo,
|
||||
const u_char *ha, u_int ha_len, const u_char *srca,
|
||||
u_int srca_len)
|
||||
{
|
||||
if (ha_len == 0)
|
||||
(void)printf("<No address>");
|
||||
ND_PRINT((ndo, "<No address>"));
|
||||
else {
|
||||
(void)printf("%s", linkaddr_string(ha, ha_len));
|
||||
if (srca_len != 0)
|
||||
(void)printf(",%s", linkaddr_string(srca, srca_len));
|
||||
ND_PRINT((ndo, "%s", linkaddr_string(ha, ha_len)));
|
||||
if (srca_len != 0)
|
||||
ND_PRINT((ndo, ",%s",
|
||||
linkaddr_string(srca, srca_len)));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atmarp_print(const u_char *bp, u_int length, u_int caplen)
|
||||
atmarp_print(netdissect_options *ndo,
|
||||
const u_char *bp, u_int length, u_int caplen)
|
||||
{
|
||||
const struct atmarp_pkthdr *ap;
|
||||
u_short pro, hrd, op;
|
||||
|
||||
ap = (const struct atmarp_pkthdr *)bp;
|
||||
TCHECK(*ap);
|
||||
ND_TCHECK(*ap);
|
||||
|
||||
hrd = ATMHRD(ap);
|
||||
pro = ATMPRO(ap);
|
||||
op = ATMOP(ap);
|
||||
|
||||
if (!TTEST2(*aar_tpa(ap), ATMTPLN(ap))) {
|
||||
(void)printf("truncated-atmarp");
|
||||
default_print((const u_char *)ap, length);
|
||||
if (!ND_TTEST2(*aar_tpa(ap), ATMTPLN(ap))) {
|
||||
ND_PRINT((ndo, "truncated-atmarp"));
|
||||
ND_DEFAULTPRINT((const u_char *)ap, length);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
|
||||
ATMSPLN(ap) != 4 || ATMTPLN(ap) != 4) {
|
||||
(void)printf("atmarp-#%d for proto #%d (%d/%d) hardware #%d",
|
||||
op, pro, ATMSPLN(ap), ATMTPLN(ap), hrd);
|
||||
ND_PRINT((ndo, "atmarp-#%d for proto #%d (%d/%d) hardware #%d",
|
||||
op, pro, ATMSPLN(ap), ATMTPLN(ap), hrd));
|
||||
return;
|
||||
}
|
||||
if (pro == ETHERTYPE_TRAIL)
|
||||
(void)printf("trailer-");
|
||||
ND_PRINT((ndo, "trailer-"));
|
||||
switch (op) {
|
||||
|
||||
case ARPOP_REQUEST:
|
||||
(void)printf("arp who-has %s", ipaddr_string(ATMTPA(ap)));
|
||||
ND_PRINT((ndo, "arp who-has %s", ipaddr_string(ATMTPA(ap))));
|
||||
if (ATMTHLN(ap) != 0) {
|
||||
(void)printf(" (");
|
||||
atmarp_addr_print(ATMTHA(ap), ATMTHLN(ap),
|
||||
ND_PRINT((ndo, " ("));
|
||||
atmarp_addr_print(ndo, ATMTHA(ap), ATMTHLN(ap),
|
||||
ATMTSA(ap), ATMTSLN(ap));
|
||||
(void)printf(")");
|
||||
ND_PRINT((ndo, ")"));
|
||||
}
|
||||
(void)printf(" tell %s", ipaddr_string(ATMSPA(ap)));
|
||||
ND_PRINT((ndo, " tell %s", ipaddr_string(ATMSPA(ap))));
|
||||
break;
|
||||
|
||||
case ARPOP_REPLY:
|
||||
(void)printf("arp reply %s", ipaddr_string(ATMSPA(ap)));
|
||||
(void)printf(" is-at ");
|
||||
atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
|
||||
ND_PRINT((ndo, "arp reply %s", ipaddr_string(ATMSPA(ap))));
|
||||
ND_PRINT((ndo, " is-at "));
|
||||
atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
|
||||
ATMSSLN(ap));
|
||||
break;
|
||||
|
||||
case ARPOP_INVREQUEST:
|
||||
(void)printf("invarp who-is ");
|
||||
atmarp_addr_print(ATMTHA(ap), ATMTHLN(ap), ATMTSA(ap),
|
||||
ND_PRINT((ndo, "invarp who-is "));
|
||||
atmarp_addr_print(ndo, ATMTHA(ap), ATMTHLN(ap), ATMTSA(ap),
|
||||
ATMTSLN(ap));
|
||||
(void)printf(" tell ");
|
||||
atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
|
||||
ND_PRINT((ndo, " tell "));
|
||||
atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
|
||||
ATMSSLN(ap));
|
||||
break;
|
||||
|
||||
case ARPOP_INVREPLY:
|
||||
(void)printf("invarp reply ");
|
||||
atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
|
||||
ND_PRINT((ndo, "invarp reply "));
|
||||
atmarp_addr_print(ndo, ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
|
||||
ATMSSLN(ap));
|
||||
(void)printf(" at %s", ipaddr_string(ATMSPA(ap)));
|
||||
ND_PRINT((ndo, " at %s", ipaddr_string(ATMSPA(ap))));
|
||||
break;
|
||||
|
||||
case ATMARPOP_NAK:
|
||||
(void)printf("nak reply for %s",
|
||||
ipaddr_string(ATMSPA(ap)));
|
||||
ND_PRINT((ndo, "nak reply for %s",
|
||||
ipaddr_string(ATMSPA(ap))));
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf("atmarp-#%d", op);
|
||||
default_print((const u_char *)ap, caplen);
|
||||
ND_PRINT((ndo, "atmarp-#%d", op));
|
||||
ND_DEFAULTPRINT((const u_char *)ap, caplen);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|atmarp]");
|
||||
ND_PRINT((ndo, "[|atmarp]"));
|
||||
}
|
||||
|
||||
void
|
||||
arp_print(const u_char *bp, u_int length, u_int caplen)
|
||||
arp_print(netdissect_options *ndo,
|
||||
const u_char *bp, u_int length, u_int caplen)
|
||||
{
|
||||
const struct arp_pkthdr *ap;
|
||||
u_short pro, hrd, op;
|
||||
|
||||
ap = (const struct arp_pkthdr *)bp;
|
||||
TCHECK(*ap);
|
||||
ND_TCHECK(*ap);
|
||||
hrd = HRD(ap);
|
||||
if (hrd == ARPHRD_ATM2225) {
|
||||
atmarp_print(bp, length, caplen);
|
||||
atmarp_print(ndo, bp, length, caplen);
|
||||
return;
|
||||
}
|
||||
pro = PRO(ap);
|
||||
op = OP(ap);
|
||||
|
||||
if (!TTEST2(*ar_tpa(ap), PLN(ap))) {
|
||||
(void)printf("truncated-arp");
|
||||
default_print((const u_char *)ap, length);
|
||||
if (!ND_TTEST2(*ar_tpa(ap), PLN(ap))) {
|
||||
ND_PRINT((ndo, "truncated-arp"));
|
||||
ND_DEFAULTPRINT((const u_char *)ap, length);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
|
||||
PLN(ap) != 4 || HLN(ap) == 0) {
|
||||
(void)printf("arp-#%d for proto #%d (%d) hardware #%d (%d)",
|
||||
op, pro, PLN(ap), hrd, HLN(ap));
|
||||
ND_PRINT((ndo, "arp-#%d for proto #%d (%d) hardware #%d (%d)",
|
||||
op, pro, PLN(ap), hrd, HLN(ap)));
|
||||
return;
|
||||
}
|
||||
if (pro == ETHERTYPE_TRAIL)
|
||||
(void)printf("trailer-");
|
||||
ND_PRINT((ndo, "trailer-"));
|
||||
switch (op) {
|
||||
|
||||
case ARPOP_REQUEST:
|
||||
(void)printf("arp who-has %s", ipaddr_string(TPA(ap)));
|
||||
ND_PRINT((ndo, "arp who-has %s", ipaddr_string(TPA(ap))));
|
||||
if (memcmp((const char *)ezero, (const char *)THA(ap), HLN(ap)) != 0)
|
||||
(void)printf(" (%s)",
|
||||
linkaddr_string(THA(ap), HLN(ap)));
|
||||
(void)printf(" tell %s", ipaddr_string(SPA(ap)));
|
||||
ND_PRINT((ndo, " (%s)",
|
||||
linkaddr_string(THA(ap), HLN(ap))));
|
||||
ND_PRINT((ndo, " tell %s", ipaddr_string(SPA(ap))));
|
||||
break;
|
||||
|
||||
case ARPOP_REPLY:
|
||||
(void)printf("arp reply %s", ipaddr_string(SPA(ap)));
|
||||
(void)printf(" is-at %s", linkaddr_string(SHA(ap), HLN(ap)));
|
||||
ND_PRINT((ndo, "arp reply %s", ipaddr_string(SPA(ap))));
|
||||
ND_PRINT((ndo, " is-at %s", linkaddr_string(SHA(ap), HLN(ap))));
|
||||
break;
|
||||
|
||||
case ARPOP_REVREQUEST:
|
||||
(void)printf("rarp who-is %s tell %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
linkaddr_string(SHA(ap), HLN(ap)));
|
||||
ND_PRINT((ndo, "rarp who-is %s tell %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
linkaddr_string(SHA(ap), HLN(ap))));
|
||||
break;
|
||||
|
||||
case ARPOP_REVREPLY:
|
||||
(void)printf("rarp reply %s at %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
ipaddr_string(TPA(ap)));
|
||||
ND_PRINT((ndo, "rarp reply %s at %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
ipaddr_string(TPA(ap))));
|
||||
break;
|
||||
|
||||
case ARPOP_INVREQUEST:
|
||||
(void)printf("invarp who-is %s tell %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
linkaddr_string(SHA(ap), HLN(ap)));
|
||||
ND_PRINT((ndo, "invarp who-is %s tell %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
linkaddr_string(SHA(ap), HLN(ap))));
|
||||
break;
|
||||
|
||||
case ARPOP_INVREPLY:
|
||||
(void)printf("invarp reply %s at %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
ipaddr_string(TPA(ap)));
|
||||
ND_PRINT((ndo,"invarp reply %s at %s",
|
||||
linkaddr_string(THA(ap), HLN(ap)),
|
||||
ipaddr_string(TPA(ap))));
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf("arp-#%d", op);
|
||||
default_print((const u_char *)ap, caplen);
|
||||
ND_PRINT((ndo, "arp-#%d", op));
|
||||
ND_DEFAULTPRINT((const u_char *)ap, caplen);
|
||||
return;
|
||||
}
|
||||
if (hrd != ARPHRD_ETHER)
|
||||
printf(" hardware #%d", hrd);
|
||||
ND_PRINT((ndo, " hardware #%d", hrd));
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|arp]");
|
||||
ND_PRINT((ndo, "[|arp]"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: bsd
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.78.2.2 2003/11/16 08:51:11 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.81 2004/05/01 09:41:50 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -172,6 +172,9 @@ atalk_print(register const u_char *bp, u_int length)
|
||||
register const struct atDDP *dp;
|
||||
u_short snet;
|
||||
|
||||
if(!eflag)
|
||||
printf("AT ");
|
||||
|
||||
if (length < ddpSize) {
|
||||
(void)printf(" [|ddp %d]", length);
|
||||
return;
|
||||
@ -180,7 +183,7 @@ atalk_print(register const u_char *bp, u_int length)
|
||||
snet = EXTRACT_16BITS(&dp->srcNet);
|
||||
printf("%s.%s", ataddr_string(snet, dp->srcNode),
|
||||
ddpskt_string(dp->srcSkt));
|
||||
printf(" > %s.%s:",
|
||||
printf(" > %s.%s: ",
|
||||
ataddr_string(EXTRACT_16BITS(&dp->dstNet), dp->dstNode),
|
||||
ddpskt_string(dp->dstSkt));
|
||||
bp += ddpSize;
|
||||
@ -241,6 +244,10 @@ ddp_print(register const u_char *bp, register u_int length, register int t,
|
||||
atp_print((const struct atATP *)bp, length);
|
||||
break;
|
||||
|
||||
case ddpEIGRP:
|
||||
eigrp_print(bp, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf(" at-%s %d", tok2str(type2str, NULL, t), length);
|
||||
break;
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.33.2.2 2003/11/16 08:51:11 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38 2005/01/19 16:46:27 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -43,6 +43,54 @@ static const char rcsid[] _U_ =
|
||||
|
||||
#include "ether.h"
|
||||
|
||||
struct tok oam_celltype_values[] = {
|
||||
{ 0x1, "Fault Management" },
|
||||
{ 0x2, "Performance Management" },
|
||||
{ 0x8, "activate/deactivate" },
|
||||
{ 0xf, "System Management" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
struct tok oam_fm_functype_values[] = {
|
||||
{ 0x0, "AIS" },
|
||||
{ 0x1, "RDI" },
|
||||
{ 0x4, "Continuity Check" },
|
||||
{ 0x8, "Loopback" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
struct tok oam_pm_functype_values[] = {
|
||||
{ 0x0, "Forward Monitoring" },
|
||||
{ 0x1, "Backward Reporting" },
|
||||
{ 0x2, "Monitoring and Reporting" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
struct tok oam_ad_functype_values[] = {
|
||||
{ 0x0, "Performance Monitoring" },
|
||||
{ 0x1, "Continuity Check" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok *oam_functype_values[16] = {
|
||||
NULL,
|
||||
oam_fm_functype_values, /* 1 */
|
||||
oam_pm_functype_values, /* 2 */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
oam_ad_functype_values, /* 8 */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* Print an RFC 1483 LLC-encapsulated ATM frame.
|
||||
*/
|
||||
@ -72,7 +120,7 @@ atm_llc_print(const u_char *p, int length, int caplen)
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the LLC/SNAP header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
@ -207,12 +255,9 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
|
||||
printf("broadcast sig: ");
|
||||
return;
|
||||
|
||||
case OAMF4SC:
|
||||
printf("oamF4(segment): ");
|
||||
return;
|
||||
|
||||
case OAMF4SC: /* fall through */
|
||||
case OAMF4EC:
|
||||
printf("oamF4(end): ");
|
||||
oam_print(p, length);
|
||||
return;
|
||||
|
||||
case METAC:
|
||||
@ -241,3 +286,47 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
oam_print (const u_char *p, u_int length) {
|
||||
|
||||
u_int16_t cell_header, cell_type, func_type,vpi,vci,payload,clp;
|
||||
|
||||
cell_header = EXTRACT_32BITS(p);
|
||||
cell_type = ((*(p+4))>>4) & 0x0f;
|
||||
func_type = *(p) & 0x0f;
|
||||
|
||||
vpi = (cell_header>>20)&0xff;
|
||||
vci = (cell_header>>4)&0xffff;
|
||||
payload = (cell_header>>1)&0x7;
|
||||
clp = cell_header&0x1;
|
||||
|
||||
switch (vci) {
|
||||
case OAMF4SC:
|
||||
printf("OAM F4 (segment), ");
|
||||
break;
|
||||
case OAMF4EC:
|
||||
printf("OAM F4 (end), ");
|
||||
break;
|
||||
default:
|
||||
printf("OAM F5, ");
|
||||
break;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
printf("vpi %u, vci %u, payload %u, clp %u, ",vpi,vci,payload,clp);
|
||||
|
||||
printf("cell-type %s (%u)",
|
||||
tok2str(oam_celltype_values, "unknown", cell_type),
|
||||
cell_type);
|
||||
|
||||
if (oam_functype_values[cell_type] == NULL)
|
||||
printf(", func-type unknown (%u)", func_type);
|
||||
else
|
||||
printf(", func-type %s (%u)",
|
||||
bittok2str(oam_functype_values[cell_type],"none",func_type),
|
||||
func_type);
|
||||
|
||||
printf(", length %u",length);
|
||||
return 1;
|
||||
}
|
||||
|
@ -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
@ -22,7 +22,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.75.2.3 2004/03/02 07:45:13 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78 2004/03/02 07:38:10 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -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-domain.c,v 1.86.2.3 2004/03/28 20:54:00 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89 2004/03/23 19:03:03 fenner Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -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 @@ egpnrprint(register const struct egp_packet *egp)
|
||||
}
|
||||
|
||||
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:
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.82.2.3 2003/12/29 22:42:21 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95 2005/04/06 21:32:39 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -37,10 +37,24 @@ static const char rcsid[] _U_ =
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "ether.h"
|
||||
|
||||
const u_char *snapend;
|
||||
#include "llc.h"
|
||||
|
||||
const struct tok ethertype_values[] = {
|
||||
/* not really ethertypes but PIDs that are used
|
||||
in the SNAP printer - its more convenient
|
||||
to put them into a single tokentable */
|
||||
{ PID_RFC2684_ETH_FCS, "Ethernet + FCS" },
|
||||
{ PID_RFC2684_ETH_NOFCS, "Ethernet no FCS" },
|
||||
{ PID_RFC2684_802_4_FCS, "802.4 + FCS" },
|
||||
{ PID_RFC2684_802_4_NOFCS, "w/o FCS" },
|
||||
{ PID_RFC2684_802_5_FCS, "Tokenring + FCS" },
|
||||
{ PID_RFC2684_802_5_NOFCS, "Tokenring no FCS" },
|
||||
{ PID_RFC2684_FDDI_FCS, "FDDI + FCS" },
|
||||
{ PID_RFC2684_FDDI_NOFCS, "FDDI no FCS" },
|
||||
{ PID_RFC2684_802_6_FCS, "802.6 + FCS" },
|
||||
{ PID_RFC2684_802_6_NOFCS, "802.6 no FCS" },
|
||||
{ PID_RFC2684_BPDU, "BPDU" },
|
||||
/* the real Ethertypes */
|
||||
{ ETHERTYPE_IP, "IPv4" },
|
||||
{ ETHERTYPE_MPLS, "MPLS unicast" },
|
||||
{ ETHERTYPE_MPLS_MULTI, "MPLS multicast" },
|
||||
@ -69,7 +83,11 @@ const struct tok ethertype_values[] = {
|
||||
{ ETHERTYPE_PPP, "PPP" },
|
||||
{ ETHERTYPE_PPPOED, "PPPoE D" },
|
||||
{ ETHERTYPE_PPPOES, "PPPoE S" },
|
||||
{ ETHERTYPE_EAPOL, "EAPOL" },
|
||||
{ ETHERTYPE_JUMBO, "Jumbo" },
|
||||
{ ETHERTYPE_LOOPBACK, "Loopback" },
|
||||
{ ETHERTYPE_ISO, "OSI" },
|
||||
{ ETHERTYPE_GRE_ISO, "GRE-OSI" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -151,7 +169,7 @@ ether_print(const u_char *p, u_int length, u_int caplen)
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the ether header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
@ -184,7 +202,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
|
||||
switch (ether_type) {
|
||||
|
||||
case ETHERTYPE_IP:
|
||||
ip_print(p, length);
|
||||
ip_print(gndo, p, length);
|
||||
return (1);
|
||||
|
||||
#ifdef INET6
|
||||
@ -195,7 +213,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
|
||||
|
||||
case ETHERTYPE_ARP:
|
||||
case ETHERTYPE_REVARP:
|
||||
arp_print(p, length, caplen);
|
||||
arp_print(gndo, p, length, caplen);
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_DN:
|
||||
@ -248,11 +266,44 @@ ether_encap_print(u_short ether_type, const u_char *p,
|
||||
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_JUMBO:
|
||||
ether_type = ntohs(*(u_int16_t *)(p));
|
||||
p += 2;
|
||||
length -= 2;
|
||||
caplen -= 2;
|
||||
|
||||
if (ether_type > ETHERMTU) {
|
||||
if (eflag)
|
||||
printf("ethertype %s, ",
|
||||
tok2str(ethertype_values,"0x%04x", ether_type));
|
||||
goto recurse;
|
||||
}
|
||||
|
||||
*extracted_ether_type = 0;
|
||||
|
||||
if (llc_print(p, length, caplen, p - 16, p - 10,
|
||||
extracted_ether_type) == 0) {
|
||||
ether_hdr_print(p - 16, length + 2);
|
||||
}
|
||||
|
||||
if (!xflag && !qflag)
|
||||
default_print(p - 16, caplen + 2);
|
||||
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_ISO:
|
||||
isoclns_print(p+1, length-1, length-1);
|
||||
return(1);
|
||||
|
||||
case ETHERTYPE_PPPOED:
|
||||
case ETHERTYPE_PPPOES:
|
||||
pppoe_print(p, length);
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_EAPOL:
|
||||
eap_print(gndo, p, length);
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_PPP:
|
||||
if (length) {
|
||||
printf(": ");
|
||||
@ -277,3 +328,12 @@ ether_encap_print(u_short ether_type, const u_char *p,
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: whitesmith
|
||||
* c-basic-offset: 8
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.61.2.2 2003/11/16 08:51:20 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64 2004/03/17 23:24:37 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -298,7 +298,7 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the FDDI header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.17.2.3 2003/12/15 03:37:45 guy Exp $ (LBL)";
|
||||
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32 2005/04/06 21:32:39 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -37,50 +37,66 @@ static const char rcsid[] _U_ =
|
||||
#include "addrtoname.h"
|
||||
#include "interface.h"
|
||||
#include "ethertype.h"
|
||||
#include "nlpid.h"
|
||||
#include "extract.h"
|
||||
#include "oui.h"
|
||||
|
||||
static void lmi_print(const u_char *, u_int);
|
||||
static void frf15_print(const u_char *, u_int);
|
||||
|
||||
#define NLPID_LMI 0x08 /* ANSI T1.617 Annex D or ITU-T Q.933 Annex A */
|
||||
#define NLPID_CISCO_LMI 0x09 /* The original, aka Cisco, aka Gang of Four */
|
||||
#define NLPID_SNAP 0x80
|
||||
#define NLPID_CLNP 0x81
|
||||
#define NLPID_ESIS 0x82
|
||||
#define NLPID_ISIS 0x83
|
||||
#define NLPID_CONS 0x84
|
||||
#define NLPID_IDRP 0x85
|
||||
#define NLPID_X25_ESIS 0x8a
|
||||
#define NLPID_IPV6 0x8e
|
||||
#define NLPID_IP 0xcc
|
||||
/*
|
||||
* the frame relay header has a variable length
|
||||
*
|
||||
* the EA bit determines if there is another byte
|
||||
* in the header
|
||||
*
|
||||
* minimum header length is 2 bytes
|
||||
* maximum header length is 4 bytes
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | DLCI (6 bits) | CR | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | DLCI (4 bits) |FECN|BECN| DE | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | DLCI (7 bits) | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | DLCI (6 bits) |SDLC| EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
*/
|
||||
|
||||
#define FR_EA_BIT 0x01
|
||||
|
||||
#define FR_CR_BIT 0x02000000
|
||||
#define FR_DE_BIT 0x00020000
|
||||
#define FR_BECN_BIT 0x00040000
|
||||
#define FR_FECN_BIT 0x00080000
|
||||
#define FR_SDLC_BIT 0x00000002
|
||||
|
||||
/* Finds out Q.922 address length, DLCI and flags. Returns 0 on success */
|
||||
static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *addr_len,
|
||||
char **flags_ptr)
|
||||
|
||||
struct tok fr_header_flag_values[] = {
|
||||
{ FR_CR_BIT, "C!" },
|
||||
{ FR_DE_BIT, "DE" },
|
||||
{ FR_BECN_BIT, "BECN" },
|
||||
{ FR_FECN_BIT, "FECN" },
|
||||
{ FR_SDLC_BIT, "sdlcore" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
/* Finds out Q.922 address length, DLCI and flags. Returns 0 on success
|
||||
* save the flags dep. on address length
|
||||
*/
|
||||
static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *sdlcore,
|
||||
u_int *addr_len, u_int8_t *flags)
|
||||
{
|
||||
static char flags[32];
|
||||
size_t len;
|
||||
|
||||
if ((p[0] & FR_EA_BIT))
|
||||
return -1;
|
||||
|
||||
*flags_ptr = flags;
|
||||
*addr_len = 2;
|
||||
*dlci = ((p[0] & 0xFC) << 2) | ((p[1] & 0xF0) >> 4);
|
||||
|
||||
strcpy(flags, (p[0] & 0x02) ? "C!, " : "");
|
||||
if (p[1] & 0x08)
|
||||
strcat(flags, "FECN, ");
|
||||
if (p[1] & 0x04)
|
||||
strcat(flags, "BECN, ");
|
||||
if (p[1] & 0x02)
|
||||
strcat(flags, "DE, ");
|
||||
|
||||
len = strlen(flags);
|
||||
if (len > 1)
|
||||
flags[len - 2] = '\x0'; /* delete trailing comma and space */
|
||||
flags[0] = p[0] & 0x02; /* populate the first flag fields */
|
||||
flags[1] = p[1] & 0x0c;
|
||||
|
||||
if (p[1] & FR_EA_BIT)
|
||||
return 0; /* 2-byte Q.922 address */
|
||||
@ -96,42 +112,16 @@ static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *addr_len,
|
||||
if ((p[0] & FR_EA_BIT) == 0)
|
||||
return -1; /* more than 4 bytes of Q.922 address? */
|
||||
|
||||
if (p[0] & 0x02) {
|
||||
len = strlen(flags);
|
||||
snprintf(flags + len, sizeof(flags) - len,
|
||||
"%sdlcore %x", len ? ", " : "", p[0] >> 2);
|
||||
} else
|
||||
flags[3] = p[0] & 0x02;
|
||||
|
||||
if (p[0] & 0x02)
|
||||
*sdlcore = p[0] >> 2;
|
||||
else
|
||||
*dlci = (*dlci << 6) | (p[0] >> 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const char *fr_nlpids[256];
|
||||
|
||||
static void
|
||||
init_fr_nlpids(void)
|
||||
{
|
||||
int i;
|
||||
static int fr_nlpid_flag = 0;
|
||||
|
||||
if (!fr_nlpid_flag) {
|
||||
for (i=0; i < 256; i++)
|
||||
fr_nlpids[i] = NULL;
|
||||
fr_nlpids[NLPID_LMI] = "LMI";
|
||||
fr_nlpids[NLPID_CISCO_LMI] = "Cisco LMI";
|
||||
fr_nlpids[NLPID_SNAP] = "SNAP";
|
||||
fr_nlpids[NLPID_CLNP] = "CLNP";
|
||||
fr_nlpids[NLPID_ESIS] = "ESIS";
|
||||
fr_nlpids[NLPID_ISIS] = "ISIS";
|
||||
fr_nlpids[NLPID_CONS] = "CONS";
|
||||
fr_nlpids[NLPID_IDRP] = "IDRP";
|
||||
fr_nlpids[NLPID_X25_ESIS] = "X25_ESIS";
|
||||
fr_nlpids[NLPID_IP] = "IP";
|
||||
}
|
||||
fr_nlpid_flag = 1;
|
||||
}
|
||||
|
||||
/* Frame Relay packet structure, with flags and CRC removed
|
||||
|
||||
+---------------------------+
|
||||
@ -168,30 +158,31 @@ fr_hdrlen(const u_char *p, u_int addr_len, u_int caplen)
|
||||
return addr_len + 1 /* UI */ + 1 /* NLPID */;
|
||||
}
|
||||
|
||||
static const char *
|
||||
fr_protostring(u_int8_t proto)
|
||||
{
|
||||
static char buf[5+1+2+1];
|
||||
|
||||
init_fr_nlpids();
|
||||
|
||||
if (nflag || fr_nlpids[proto] == NULL) {
|
||||
snprintf(buf, sizeof(buf), "proto %02x", proto);
|
||||
return buf;
|
||||
}
|
||||
return fr_nlpids[proto];
|
||||
}
|
||||
|
||||
static void
|
||||
fr_hdr_print(int length, u_int dlci, char *flags, u_char nlpid)
|
||||
fr_hdr_print(int length, u_int addr_len, u_int dlci, u_int8_t *flags, u_int16_t nlpid)
|
||||
{
|
||||
if (qflag)
|
||||
(void)printf("DLCI %u, %s%slength %d: ",
|
||||
dlci, flags, *flags ? ", " : "", length);
|
||||
else
|
||||
(void)printf("DLCI %u, %s%s%s, length %d: ",
|
||||
dlci, flags, *flags ? ", " : "",
|
||||
fr_protostring(nlpid), length);
|
||||
if (qflag) {
|
||||
(void)printf("Q.922, DLCI %u, length %u: ",
|
||||
dlci,
|
||||
length);
|
||||
} else {
|
||||
if (nlpid <= 0xff) /* if its smaller than 256 then its a NLPID */
|
||||
(void)printf("Q.922, hdr-len %u, DLCI %u, Flags [%s], NLPID %s (0x%02x), length %u: ",
|
||||
addr_len,
|
||||
dlci,
|
||||
bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)),
|
||||
tok2str(nlpid_values,"unknown", nlpid),
|
||||
nlpid,
|
||||
length);
|
||||
else /* must be an ethertype */
|
||||
(void)printf("Q.922, hdr-len %u, DLCI %u, Flags [%s], cisco-ethertype %s (0x%04x), length %u: ",
|
||||
addr_len,
|
||||
dlci,
|
||||
bittok2str(fr_header_flag_values, "none", EXTRACT_32BITS(flags)),
|
||||
tok2str(ethertype_values, "unknown", nlpid),
|
||||
nlpid,
|
||||
length);
|
||||
}
|
||||
}
|
||||
|
||||
u_int
|
||||
@ -199,22 +190,23 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_short extracted_ethertype;
|
||||
u_int16_t extracted_ethertype;
|
||||
u_int32_t orgcode;
|
||||
register u_short et;
|
||||
u_int dlci;
|
||||
int addr_len;
|
||||
u_char nlpid;
|
||||
u_int sdlcore;
|
||||
u_int addr_len;
|
||||
u_int16_t nlpid;
|
||||
u_int hdr_len;
|
||||
char *flags;
|
||||
u_int8_t flags[4];
|
||||
|
||||
if (caplen < 4) { /* minimum frame header length */
|
||||
printf("[|fr]");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
if (parse_q922_addr(p, &dlci, &addr_len, &flags)) {
|
||||
printf("Invalid Q.922 address");
|
||||
if (parse_q922_addr(p, &dlci, &sdlcore, &addr_len, flags)) {
|
||||
printf("Q.922, invalid address");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
@ -225,8 +217,24 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
return caplen;
|
||||
}
|
||||
|
||||
if (p[addr_len] != 0x03)
|
||||
printf("UI %02x! ", p[addr_len]);
|
||||
if (p[addr_len] != 0x03 && dlci != 0) {
|
||||
|
||||
/* lets figure out if we have cisco style encapsulation: */
|
||||
extracted_ethertype = EXTRACT_16BITS(p+addr_len);
|
||||
|
||||
if (eflag)
|
||||
fr_hdr_print(length, addr_len, dlci, flags, extracted_ethertype);
|
||||
|
||||
if (ether_encap_print(extracted_ethertype,
|
||||
p+addr_len+ETHERTYPE_LEN,
|
||||
length-addr_len-ETHERTYPE_LEN,
|
||||
caplen-addr_len-ETHERTYPE_LEN,
|
||||
&extracted_ethertype) == 0)
|
||||
/* ether_type not known, probably it wasn't one */
|
||||
printf("UI %02x! ", p[addr_len]);
|
||||
else
|
||||
return hdr_len;
|
||||
}
|
||||
|
||||
if (!p[addr_len + 1]) { /* pad byte should be used with 3-byte Q.922 */
|
||||
if (addr_len != 3)
|
||||
@ -236,55 +244,63 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
|
||||
nlpid = p[hdr_len - 1];
|
||||
|
||||
if (eflag)
|
||||
fr_hdr_print(length, addr_len, dlci, flags, nlpid);
|
||||
|
||||
p += hdr_len;
|
||||
length -= hdr_len;
|
||||
caplen -= hdr_len;
|
||||
|
||||
if (eflag)
|
||||
fr_hdr_print(length, dlci, flags, nlpid);
|
||||
|
||||
switch (nlpid) {
|
||||
case NLPID_IP:
|
||||
ip_print(p, length);
|
||||
ip_print(gndo, p, length);
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case NLPID_IPV6:
|
||||
case NLPID_IP6:
|
||||
ip6_print(p, length);
|
||||
break;
|
||||
#endif
|
||||
case NLPID_CLNP:
|
||||
case NLPID_ESIS:
|
||||
case NLPID_ISIS:
|
||||
isoclns_print(p, length, caplen);
|
||||
isoclns_print(p-1, length+1, caplen+1); /* OSI printers need the NLPID field */
|
||||
break;
|
||||
|
||||
case NLPID_SNAP:
|
||||
orgcode = EXTRACT_24BITS(p);
|
||||
et = EXTRACT_16BITS(p + 3);
|
||||
|
||||
if (eflag)
|
||||
(void)printf("SNAP, oui %s (0x%06x), ethertype %s (0x%04x): ",
|
||||
tok2str(oui_values,"Unknown",orgcode),
|
||||
orgcode,
|
||||
tok2str(ethertype_values,"Unknown", et),
|
||||
et);
|
||||
|
||||
if (snap_print((const u_char *)(p + 5), length - 5,
|
||||
caplen - 5, &extracted_ethertype, orgcode, et,
|
||||
0) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
fr_hdr_print(length + hdr_len,
|
||||
dlci, flags, nlpid);
|
||||
if (extracted_ethertype) {
|
||||
printf("(SNAP %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
}
|
||||
if (!eflag)
|
||||
fr_hdr_print(length + hdr_len, hdr_len,
|
||||
dlci, flags, nlpid);
|
||||
if (!xflag && !qflag)
|
||||
default_print(p - hdr_len, caplen + hdr_len);
|
||||
default_print(p - hdr_len, caplen + hdr_len);
|
||||
}
|
||||
break;
|
||||
|
||||
case NLPID_LMI:
|
||||
lmi_print(p, length);
|
||||
case NLPID_Q933:
|
||||
q933_print(p, length);
|
||||
break;
|
||||
|
||||
case NLPID_MFR:
|
||||
frf15_print(p, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!eflag)
|
||||
fr_hdr_print(length + hdr_len,
|
||||
fr_hdr_print(length + hdr_len, addr_len,
|
||||
dlci, flags, nlpid);
|
||||
if (!xflag)
|
||||
default_print(p, caplen);
|
||||
@ -293,6 +309,55 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
return hdr_len;
|
||||
}
|
||||
|
||||
/* an NLPID of 0xb1 indicates a 2-byte
|
||||
* FRF.15 header
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* ~ Q.922 header ~
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | NLPID (8 bits) | NLPID=0xb1
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | B | E | C |seq. (high 4 bits) | R |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | sequence (low 8 bits) |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
*/
|
||||
|
||||
struct tok frf15_flag_values[] = {
|
||||
{ 0x80, "Begin" },
|
||||
{ 0x40, "End" },
|
||||
{ 0x20, "Control" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define FR_FRF15_FRAGTYPE 0x01
|
||||
|
||||
static void
|
||||
frf15_print (const u_char *p, u_int length) {
|
||||
|
||||
u_int16_t sequence_num, flags;
|
||||
|
||||
flags = p[0]&0xe0;
|
||||
sequence_num = (p[0]&0x1e)<<7 | p[1];
|
||||
|
||||
printf("FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u",
|
||||
sequence_num,
|
||||
bittok2str(frf15_flag_values,"none",flags),
|
||||
flags&FR_FRF15_FRAGTYPE ? "Interface" : "End-to-End",
|
||||
length);
|
||||
|
||||
/* TODO:
|
||||
* depending on all permutations of the B, E and C bit
|
||||
* dig as deep as we can - e.g. on the first (B) fragment
|
||||
* there is enough payload to print the IP header
|
||||
* on non (B) fragments it depends if the fragmentation
|
||||
* model is end-to-end or interface based wether we want to print
|
||||
* another Q.922 header
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Q.933 decoding portion for framerelay specific.
|
||||
*/
|
||||
@ -340,148 +405,205 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
#define MSG_TYPE_STATUS 0x7D
|
||||
#define MSG_TYPE_STATUS_ENQ 0x75
|
||||
|
||||
struct tok fr_q933_msg_values[] = {
|
||||
{ MSG_TYPE_ESC_TO_NATIONAL, "ESC to National" },
|
||||
{ MSG_TYPE_ALERT, "Alert" },
|
||||
{ MSG_TYPE_CALL_PROCEEDING, "Call proceeding" },
|
||||
{ MSG_TYPE_CONNECT, "Connect" },
|
||||
{ MSG_TYPE_CONNECT_ACK, "Connect ACK" },
|
||||
{ MSG_TYPE_PROGRESS, "Progress" },
|
||||
{ MSG_TYPE_SETUP, "Setup" },
|
||||
{ MSG_TYPE_DISCONNECT, "Disconnect" },
|
||||
{ MSG_TYPE_RELEASE, "Release" },
|
||||
{ MSG_TYPE_RELEASE_COMPLETE, "Release Complete" },
|
||||
{ MSG_TYPE_RESTART, "Restart" },
|
||||
{ MSG_TYPE_RESTART_ACK, "Restart ACK" },
|
||||
{ MSG_TYPE_STATUS, "Status Reply" },
|
||||
{ MSG_TYPE_STATUS_ENQ, "Status Enquiry" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define MSG_ANSI_LOCKING_SHIFT 0x95
|
||||
#define ONE_BYTE_IE_MASK 0xF0 /* details? */
|
||||
|
||||
#define ANSI_REPORT_TYPE_IE 0x01
|
||||
#define ANSI_LINK_VERIFY_IE_91 0x19 /* details? */
|
||||
#define ANSI_LINK_VERIFY_IE 0x03
|
||||
#define ANSI_PVC_STATUS_IE 0x07
|
||||
#define FR_LMI_ANSI_REPORT_TYPE_IE 0x01
|
||||
#define FR_LMI_ANSI_LINK_VERIFY_IE_91 0x19 /* details? */
|
||||
#define FR_LMI_ANSI_LINK_VERIFY_IE 0x03
|
||||
#define FR_LMI_ANSI_PVC_STATUS_IE 0x07
|
||||
|
||||
#define FR_LMI_CCITT_REPORT_TYPE_IE 0x51
|
||||
#define FR_LMI_CCITT_LINK_VERIFY_IE 0x53
|
||||
#define FR_LMI_CCITT_PVC_STATUS_IE 0x57
|
||||
|
||||
struct tok fr_q933_ie_values_codeset5[] = {
|
||||
{ FR_LMI_ANSI_REPORT_TYPE_IE, "ANSI Report Type" },
|
||||
{ FR_LMI_ANSI_LINK_VERIFY_IE_91, "ANSI Link Verify" },
|
||||
{ FR_LMI_ANSI_LINK_VERIFY_IE, "ANSI Link Verify" },
|
||||
{ FR_LMI_ANSI_PVC_STATUS_IE, "ANSI PVC Status" },
|
||||
{ FR_LMI_CCITT_REPORT_TYPE_IE, "CCITT Report Type" },
|
||||
{ FR_LMI_CCITT_LINK_VERIFY_IE, "CCITT Link Verify" },
|
||||
{ FR_LMI_CCITT_PVC_STATUS_IE, "CCITT PVC Status" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define FR_LMI_REPORT_TYPE_IE_FULL_STATUS 0
|
||||
#define FR_LMI_REPORT_TYPE_IE_LINK_VERIFY 1
|
||||
#define FR_LMI_REPORT_TYPE_IE_ASYNC_PVC 2
|
||||
|
||||
struct tok fr_lmi_report_type_ie_values[] = {
|
||||
{ FR_LMI_REPORT_TYPE_IE_FULL_STATUS, "Full Status" },
|
||||
{ FR_LMI_REPORT_TYPE_IE_LINK_VERIFY, "Link verify" },
|
||||
{ FR_LMI_REPORT_TYPE_IE_ASYNC_PVC, "Async PVC Status" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* array of 16 codepages - currently we only support codepage 5 */
|
||||
static struct tok *fr_q933_ie_codesets[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
fr_q933_ie_values_codeset5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
#define CCITT_REPORT_TYPE_IE 0x51
|
||||
#define CCITT_LINK_VERIFY_IE 0x53
|
||||
#define CCITT_PVC_STATUS_IE 0x57
|
||||
|
||||
struct common_ie_header {
|
||||
u_int8_t ie_id;
|
||||
u_int8_t ie_len;
|
||||
};
|
||||
|
||||
#define FULL_STATUS 0
|
||||
#define LINK_VERIFY 1
|
||||
#define ASYNC_PVC 2
|
||||
|
||||
|
||||
/* Parses DLCI information element. */
|
||||
static const char * parse_dlci_ie(const u_char *p, u_int ie_len, char *buffer,
|
||||
size_t buffer_len)
|
||||
{
|
||||
u_int dlci;
|
||||
|
||||
if ((ie_len < 3) ||
|
||||
(p[0] & 0x80) ||
|
||||
((ie_len == 3) && !(p[1] & 0x80)) ||
|
||||
((ie_len == 4) && ((p[1] & 0x80) || !(p[2] & 0x80))) ||
|
||||
((ie_len == 5) && ((p[1] & 0x80) || (p[2] & 0x80) ||
|
||||
!(p[3] & 0x80))) ||
|
||||
(ie_len > 5) ||
|
||||
!(p[ie_len - 1] & 0x80))
|
||||
return "Invalid DLCI IE";
|
||||
|
||||
dlci = ((p[0] & 0x3F) << 4) | ((p[1] & 0x78) >> 3);
|
||||
if (ie_len == 4)
|
||||
dlci = (dlci << 6) | ((p[2] & 0x7E) >> 1);
|
||||
else if (ie_len == 5)
|
||||
dlci = (dlci << 13) | (p[2] & 0x7F) | ((p[3] & 0x7E) >> 1);
|
||||
|
||||
snprintf(buffer, buffer_len, "DLCI %d: status %s%s", dlci,
|
||||
p[ie_len - 1] & 0x8 ? "New, " : "",
|
||||
p[ie_len - 1] & 0x2 ? "Active" : "Inactive");
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
lmi_print(const u_char *p, u_int length)
|
||||
void
|
||||
q933_print(const u_char *p, u_int length)
|
||||
{
|
||||
const u_char *ptemp = p;
|
||||
const char *decode_str;
|
||||
char temp_str[255];
|
||||
struct common_ie_header *ie_p;
|
||||
int olen;
|
||||
int is_ansi = 0;
|
||||
u_int dlci,codeset;
|
||||
|
||||
if (length < 9) { /* shortest: Q.933a LINK VERIFY */
|
||||
printf("[|lmi]");
|
||||
printf("[|q.933]");
|
||||
return;
|
||||
}
|
||||
|
||||
codeset = p[2]&0x0f; /* extract the codeset */
|
||||
|
||||
if (p[2] == MSG_ANSI_LOCKING_SHIFT)
|
||||
is_ansi = 1;
|
||||
|
||||
printf("%s", eflag ? "" : "Q.933, ");
|
||||
|
||||
/* printing out header part */
|
||||
printf(is_ansi ? "ANSI" : "CCITT");
|
||||
printf(is_ansi ? "ANSI" : "CCITT ");
|
||||
|
||||
if (p[0])
|
||||
printf(" Call Ref: %02x!", p[0]);
|
||||
printf(", Call Ref: 0x%02x", p[0]);
|
||||
|
||||
switch(p[1]) {
|
||||
if (vflag)
|
||||
printf(", %s (0x%02x), length %u",
|
||||
tok2str(fr_q933_msg_values,"unknown message",p[1]),
|
||||
p[1],
|
||||
length);
|
||||
else
|
||||
printf(", %s",
|
||||
tok2str(fr_q933_msg_values,"unknown message 0x%02x",p[1]));
|
||||
|
||||
case MSG_TYPE_STATUS:
|
||||
printf(" STATUS REPLY\n");
|
||||
break;
|
||||
|
||||
case MSG_TYPE_STATUS_ENQ:
|
||||
printf(" STATUS ENQUIRY\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" UNKNOWN MSG Type %02x\n", p[1]);
|
||||
break;
|
||||
}
|
||||
olen = length; /* preserve the original length for non verbose mode */
|
||||
|
||||
if (length < (u_int)(2 - is_ansi)) {
|
||||
printf("[|lmi]");
|
||||
printf("[|q.933]");
|
||||
return;
|
||||
}
|
||||
length -= 2 - is_ansi;
|
||||
ptemp += 2 + is_ansi;
|
||||
|
||||
/* Loop through the rest of IE */
|
||||
while (length > 0) {
|
||||
while (length > sizeof(struct common_ie_header)) {
|
||||
ie_p = (struct common_ie_header *)ptemp;
|
||||
if (length < sizeof(struct common_ie_header) ||
|
||||
length < sizeof(struct common_ie_header) + ie_p->ie_len) {
|
||||
printf("[|lmi]");
|
||||
return;
|
||||
if (vflag) /* not bark if there is just a trailer */
|
||||
printf("\n[|q.933]");
|
||||
else
|
||||
printf(", length %u",olen);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((is_ansi && ie_p->ie_id == ANSI_REPORT_TYPE_IE) ||
|
||||
(!is_ansi && ie_p->ie_id == CCITT_REPORT_TYPE_IE)) {
|
||||
switch(ptemp[2]) {
|
||||
/* lets do the full IE parsing only in verbose mode
|
||||
* however some IEs (DLCI Status, Link Verify)
|
||||
* are also intereststing in non-verbose mode */
|
||||
if (vflag)
|
||||
printf("\n\t%s IE (%u), length %u: ",
|
||||
tok2str(fr_q933_ie_codesets[codeset],"unknown",ie_p->ie_id),
|
||||
ie_p->ie_id,
|
||||
ie_p->ie_len);
|
||||
|
||||
switch (ie_p->ie_id) {
|
||||
|
||||
case FULL_STATUS:
|
||||
decode_str = "FULL STATUS";
|
||||
break;
|
||||
case FR_LMI_ANSI_REPORT_TYPE_IE: /* fall through */
|
||||
case FR_LMI_CCITT_REPORT_TYPE_IE:
|
||||
if (vflag)
|
||||
printf("%s (%u)",
|
||||
tok2str(fr_lmi_report_type_ie_values,"unknown",ptemp[2]),
|
||||
ptemp[2]);
|
||||
break;
|
||||
|
||||
case LINK_VERIFY:
|
||||
decode_str = "LINK VERIFY";
|
||||
break;
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE: /* fall through */
|
||||
case FR_LMI_CCITT_LINK_VERIFY_IE:
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE_91:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
printf("TX Seq: %3d, RX Seq: %3d", ptemp[2], ptemp[3]);
|
||||
break;
|
||||
case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
|
||||
case FR_LMI_CCITT_PVC_STATUS_IE:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
/* now parse the DLCI information element. */
|
||||
if ((ie_p->ie_len < 3) ||
|
||||
(ptemp[2] & 0x80) ||
|
||||
((ie_p->ie_len == 3) && !(ptemp[3] & 0x80)) ||
|
||||
((ie_p->ie_len == 4) && ((ptemp[3] & 0x80) || !(ptemp[4] & 0x80))) ||
|
||||
((ie_p->ie_len == 5) && ((ptemp[3] & 0x80) || (ptemp[4] & 0x80) ||
|
||||
!(ptemp[5] & 0x80))) ||
|
||||
(ie_p->ie_len > 5) ||
|
||||
!(ptemp[ie_p->ie_len + 1] & 0x80))
|
||||
printf("Invalid DLCI IE");
|
||||
|
||||
dlci = ((ptemp[2] & 0x3F) << 4) | ((ptemp[3] & 0x78) >> 3);
|
||||
if (ie_p->ie_len == 4)
|
||||
dlci = (dlci << 6) | ((ptemp[4] & 0x7E) >> 1);
|
||||
else if (ie_p->ie_len == 5)
|
||||
dlci = (dlci << 13) | (ptemp[4] & 0x7F) | ((ptemp[5] & 0x7E) >> 1);
|
||||
|
||||
case ASYNC_PVC:
|
||||
decode_str = "Async PVC Status";
|
||||
break;
|
||||
printf("DLCI %u: status %s%s", dlci,
|
||||
ptemp[ie_p->ie_len + 1] & 0x8 ? "New, " : "",
|
||||
ptemp[ie_p->ie_len + 1] & 0x2 ? "Active" : "Inactive");
|
||||
break;
|
||||
|
||||
default:
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
decode_str = "Reserved Value";
|
||||
break;
|
||||
}
|
||||
} else if ((is_ansi && (ie_p->ie_id == ANSI_LINK_VERIFY_IE_91 ||
|
||||
ie_p->ie_id == ANSI_LINK_VERIFY_IE)) ||
|
||||
(!is_ansi && ie_p->ie_id == CCITT_LINK_VERIFY_IE)) {
|
||||
snprintf(temp_str, sizeof(temp_str),
|
||||
"TX Seq: %3d, RX Seq: %3d",
|
||||
ptemp[2], ptemp[3]);
|
||||
decode_str = temp_str;
|
||||
} else if ((is_ansi && ie_p->ie_id == ANSI_PVC_STATUS_IE) ||
|
||||
(!is_ansi && ie_p->ie_id == CCITT_PVC_STATUS_IE)) {
|
||||
decode_str = parse_dlci_ie(ptemp + 2, ie_p->ie_len,
|
||||
temp_str, sizeof(temp_str));
|
||||
} else
|
||||
decode_str = "Non-decoded Value";
|
||||
/* do we want to see a hexdump of the IE ? */
|
||||
if (vflag> 1)
|
||||
print_unknown_data(ptemp+2,"\n\t ",ie_p->ie_len);
|
||||
|
||||
printf("\t\tIE: %02X Len: %d, %s\n",
|
||||
ie_p->ie_id, ie_p->ie_len, decode_str);
|
||||
length = length - ie_p->ie_len - 2;
|
||||
ptemp = ptemp + ie_p->ie_len + 2;
|
||||
}
|
||||
if (!vflag)
|
||||
printf(", length %u",olen);
|
||||
}
|
||||
|
@ -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-icmp.c,v 1.73.2.3 2004/03/24 00:56:34 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81 2005/04/06 21:32:40 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -40,6 +40,7 @@ static const char rcsid[] _U_ =
|
||||
#include "ip.h"
|
||||
#include "udp.h"
|
||||
#include "ipproto.h"
|
||||
#include "mpls.h"
|
||||
|
||||
/*
|
||||
* Interface Control Message Protocol Definitions.
|
||||
@ -85,6 +86,12 @@ struct icmp {
|
||||
struct ip idi_ip;
|
||||
/* options and then 64 bits of data */
|
||||
} id_ip;
|
||||
struct mpls_ext {
|
||||
u_int8_t legacy_header[128]; /* extension header starts 128 bytes after ICMP header */
|
||||
u_int8_t version_res[2];
|
||||
u_int8_t checksum[2];
|
||||
u_int8_t data[1];
|
||||
} mpls_ext;
|
||||
u_int32_t id_mask;
|
||||
u_int8_t id_data[1];
|
||||
} icmp_dun;
|
||||
@ -94,8 +101,14 @@ struct icmp {
|
||||
#define icmp_ip icmp_dun.id_ip.idi_ip
|
||||
#define icmp_mask icmp_dun.id_mask
|
||||
#define icmp_data icmp_dun.id_data
|
||||
#define icmp_mpls_ext_version icmp_dun.mpls_ext.version_res
|
||||
#define icmp_mpls_ext_checksum icmp_dun.mpls_ext.checksum
|
||||
#define icmp_mpls_ext_data icmp_dun.mpls_ext.data
|
||||
};
|
||||
|
||||
#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
|
||||
#define ICMP_MPLS_EXT_VERSION 2
|
||||
|
||||
/*
|
||||
* Lower bounds on packet lengths for various types.
|
||||
* For the error advice packets must first insure that the
|
||||
@ -105,6 +118,7 @@ struct icmp {
|
||||
* ip header length.
|
||||
*/
|
||||
#define ICMP_MINLEN 8 /* abs minimum */
|
||||
#define ICMP_EXTD_MINLEN (156 - sizeof (struct ip)) /* draft-bonica-icmp-mpls-02 */
|
||||
#define ICMP_TSLEN (8 + 3 * sizeof (u_int32_t)) /* timestamp */
|
||||
#define ICMP_MASKLEN 12 /* address mask */
|
||||
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
|
||||
@ -158,6 +172,8 @@ struct icmp {
|
||||
(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
|
||||
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
|
||||
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
|
||||
#define ICMP_MPLS_EXT_TYPE(type) \
|
||||
((type) == ICMP_UNREACH || (type) == ICMP_TIMXCEED)
|
||||
/* rfc1700 */
|
||||
#ifndef ICMP_UNREACH_NET_UNKNOWN
|
||||
#define ICMP_UNREACH_NET_UNKNOWN 6 /* destination net unknown */
|
||||
@ -260,6 +276,19 @@ struct id_rdiscovery {
|
||||
u_int32_t ird_pref;
|
||||
};
|
||||
|
||||
/* draft-bonica-icmp-mpls-02 */
|
||||
struct icmp_mpls_ext_object_header_t {
|
||||
u_int8_t length[2];
|
||||
u_int8_t class_num;
|
||||
u_int8_t ctype;
|
||||
};
|
||||
|
||||
static const struct tok icmp_mpls_ext_obj_values[] = {
|
||||
{ 1, "MPLS Stack Entry" },
|
||||
{ 2, "Extended Payload" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
void
|
||||
icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
{
|
||||
@ -269,7 +298,10 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
const char *str, *fmt;
|
||||
const struct ip *oip;
|
||||
const struct udphdr *ouh;
|
||||
u_int hlen, dport, mtu;
|
||||
const u_int8_t *obj_tptr;
|
||||
u_int32_t raw_label;
|
||||
const struct icmp_mpls_ext_object_header_t *icmp_mpls_ext_object_header;
|
||||
u_int hlen, dport, mtu, obj_tlen, obj_class_num, obj_ctype;
|
||||
char buf[MAXHOSTNAMELEN + 100];
|
||||
|
||||
dp = (struct icmp *)bp;
|
||||
@ -477,7 +509,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
str = tok2str(icmp2str, "type-#%d", dp->icmp_type);
|
||||
break;
|
||||
}
|
||||
(void)printf("icmp %d: %s", plen, str);
|
||||
(void)printf("ICMP %s, length %u", str, plen);
|
||||
if (vflag && !fragmented) { /* don't attempt checksumming if this is a frag */
|
||||
u_int16_t sum, icmp_sum;
|
||||
if (TTEST2(*bp, plen)) {
|
||||
@ -490,13 +522,88 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vflag > 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
|
||||
if (vflag >= 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
|
||||
bp += 8;
|
||||
(void)printf(" for ");
|
||||
(void)printf("\n\t");
|
||||
ip = (struct ip *)bp;
|
||||
snaplen = snapend - bp;
|
||||
ip_print(bp, EXTRACT_16BITS(&ip->ip_len));
|
||||
ip_print(gndo, bp, EXTRACT_16BITS(&ip->ip_len));
|
||||
}
|
||||
|
||||
if (vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(dp->icmp_type)) {
|
||||
|
||||
TCHECK(*(dp->icmp_mpls_ext_version));
|
||||
printf("\n\tMPLS extension v%u",ICMP_MPLS_EXT_EXTRACT_VERSION(*(dp->icmp_mpls_ext_version)));
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
*/
|
||||
if (ICMP_MPLS_EXT_EXTRACT_VERSION(*(dp->icmp_mpls_ext_version)) != ICMP_MPLS_EXT_VERSION) {
|
||||
printf(" packet not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
hlen = plen - ICMP_EXTD_MINLEN;
|
||||
TCHECK2(*(dp->icmp_mpls_ext_checksum), 2);
|
||||
printf(", checksum 0x%04x (unverified), length %u", /* FIXME */
|
||||
EXTRACT_16BITS(dp->icmp_mpls_ext_checksum),
|
||||
hlen);
|
||||
|
||||
hlen -= 4; /* subtract common header size */
|
||||
obj_tptr = (u_int8_t *)dp->icmp_mpls_ext_data;
|
||||
|
||||
while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
|
||||
|
||||
icmp_mpls_ext_object_header = (struct icmp_mpls_ext_object_header_t *)obj_tptr;
|
||||
TCHECK(*icmp_mpls_ext_object_header);
|
||||
obj_tlen = EXTRACT_16BITS(icmp_mpls_ext_object_header->length);
|
||||
obj_class_num = icmp_mpls_ext_object_header->class_num;
|
||||
obj_ctype = icmp_mpls_ext_object_header->ctype;
|
||||
obj_tptr += sizeof(struct icmp_mpls_ext_object_header_t);
|
||||
|
||||
printf("\n\t %s Object (%u), Class-Type: %u, length %u",
|
||||
tok2str(icmp_mpls_ext_obj_values,"unknown",obj_class_num),
|
||||
obj_class_num,
|
||||
obj_ctype,
|
||||
obj_tlen);
|
||||
|
||||
hlen-=sizeof(struct icmp_mpls_ext_object_header_t); /* length field includes tlv header */
|
||||
if (obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))
|
||||
break;
|
||||
obj_tlen-=sizeof(struct icmp_mpls_ext_object_header_t);
|
||||
|
||||
switch (obj_class_num) {
|
||||
case 1:
|
||||
switch(obj_ctype) {
|
||||
case 1:
|
||||
TCHECK2(*obj_tptr, 4);
|
||||
raw_label = EXTRACT_32BITS(obj_tptr);
|
||||
printf("\n\t label %u, exp %u", MPLS_LABEL(raw_label), MPLS_EXP(raw_label));
|
||||
if (MPLS_STACK(raw_label))
|
||||
printf(", [S]");
|
||||
printf(", ttl %u", MPLS_TTL(raw_label));
|
||||
break;
|
||||
default:
|
||||
print_unknown_data(obj_tptr, "\n\t ", obj_tlen);
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
* FIXME those are the defined objects that lack a decoder
|
||||
* you are welcome to contribute code ;-)
|
||||
*/
|
||||
case 2:
|
||||
default:
|
||||
print_unknown_data(obj_tptr, "\n\t ", obj_tlen);
|
||||
break;
|
||||
}
|
||||
if (hlen < obj_tlen)
|
||||
break;
|
||||
hlen -= obj_tlen;
|
||||
obj_tptr += obj_tlen;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
trunc:
|
||||
fputs("[|icmp]", stdout);
|
||||
|
@ -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
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.128.2.6 2004/03/24 09:01:39 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149 2005/04/07 00:28:17 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -41,11 +41,23 @@ static const char rcsid[] _U_ =
|
||||
#include "ip.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
struct tok ip_option_values[] = {
|
||||
{ IPOPT_EOL, "EOL" },
|
||||
{ IPOPT_NOP, "NOP" },
|
||||
{ IPOPT_TS, "timestamp" },
|
||||
{ IPOPT_SECURITY, "security" },
|
||||
{ IPOPT_RR, "RR" },
|
||||
{ IPOPT_SSRR, "SSRR" },
|
||||
{ IPOPT_LSRR, "LSRR" },
|
||||
{ IPOPT_RA, "RA" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* print the recorded route in an IP RR, LSRR or SSRR option.
|
||||
*/
|
||||
static void
|
||||
ip_printroute(const char *type, register const u_char *cp, u_int length)
|
||||
ip_printroute(register const u_char *cp, u_int length)
|
||||
{
|
||||
register u_int ptr;
|
||||
register u_int len;
|
||||
@ -54,25 +66,21 @@ ip_printroute(const char *type, register const u_char *cp, u_int length)
|
||||
printf(" [bad length %u]", length);
|
||||
return;
|
||||
}
|
||||
printf(" %s{", type);
|
||||
if ((length + 1) & 3)
|
||||
printf(" [bad length %u]", length);
|
||||
ptr = cp[2] - 1;
|
||||
if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1)
|
||||
printf(" [bad ptr %u]", cp[2]);
|
||||
|
||||
type = "";
|
||||
for (len = 3; len < length; len += 4) {
|
||||
if (ptr == len)
|
||||
type = "#";
|
||||
printf("%s%s", type, ipaddr_string(&cp[len]));
|
||||
type = " ";
|
||||
printf("%s", ipaddr_string(&cp[len]));
|
||||
if (ptr > len)
|
||||
printf (", ");
|
||||
}
|
||||
printf("%s}", ptr == len? "#" : "");
|
||||
}
|
||||
|
||||
/*
|
||||
* If source-routing is present, return the final destination.
|
||||
* If source-routing is present and valid, return the final destination.
|
||||
* Otherwise, return IP destination.
|
||||
*
|
||||
* This is used for UDP and TCP pseudo-header in the checksum
|
||||
@ -94,14 +102,15 @@ ip_finddst(const struct ip *ip)
|
||||
|
||||
TCHECK(*cp);
|
||||
tt = *cp;
|
||||
if (tt == IPOPT_NOP || tt == IPOPT_EOL)
|
||||
if (tt == IPOPT_EOL)
|
||||
break;
|
||||
else if (tt == IPOPT_NOP)
|
||||
len = 1;
|
||||
else {
|
||||
TCHECK(cp[1]);
|
||||
len = cp[1];
|
||||
}
|
||||
if (len < 2) {
|
||||
return 0;
|
||||
if (len < 2)
|
||||
break;
|
||||
}
|
||||
TCHECK2(*cp, len);
|
||||
switch (tt) {
|
||||
@ -109,15 +118,14 @@ ip_finddst(const struct ip *ip)
|
||||
case IPOPT_SSRR:
|
||||
case IPOPT_LSRR:
|
||||
if (len < 7)
|
||||
return 0;
|
||||
break;
|
||||
memcpy(&retval, cp + len - 4, 4);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
return ip->ip_dst.s_addr;
|
||||
|
||||
trunc:
|
||||
return 0;
|
||||
memcpy(&retval, &ip->ip_dst.s_addr, sizeof(u_int32_t));
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -188,75 +196,56 @@ ip_printts(register const u_char *cp, u_int length)
|
||||
static void
|
||||
ip_optprint(register const u_char *cp, u_int length)
|
||||
{
|
||||
register u_int len;
|
||||
register u_int option_len;
|
||||
|
||||
for (; length > 0; cp += len, length -= len) {
|
||||
int tt;
|
||||
for (; length > 0; cp += option_len, length -= option_len) {
|
||||
u_int option_code;
|
||||
|
||||
TCHECK(*cp);
|
||||
tt = *cp;
|
||||
if (tt == IPOPT_NOP || tt == IPOPT_EOL)
|
||||
len = 1;
|
||||
option_code = *cp;
|
||||
|
||||
if (option_code == IPOPT_NOP ||
|
||||
option_code == IPOPT_EOL)
|
||||
option_len = 1;
|
||||
|
||||
else {
|
||||
TCHECK(cp[1]);
|
||||
len = cp[1];
|
||||
if (len < 2) {
|
||||
printf("[|ip op len %d]", len);
|
||||
return;
|
||||
}
|
||||
TCHECK2(*cp, len);
|
||||
option_len = cp[1];
|
||||
}
|
||||
switch (tt) {
|
||||
|
||||
printf("%s (%u) len %u",
|
||||
tok2str(ip_option_values,"unknown",option_code),
|
||||
option_code,
|
||||
option_len);
|
||||
|
||||
if (option_len < 2)
|
||||
return;
|
||||
|
||||
TCHECK2(*cp, option_len);
|
||||
|
||||
switch (option_code) {
|
||||
case IPOPT_EOL:
|
||||
printf(" EOL");
|
||||
if (length > 1)
|
||||
printf("-%d", length - 1);
|
||||
return;
|
||||
|
||||
case IPOPT_NOP:
|
||||
printf(" NOP");
|
||||
break;
|
||||
|
||||
case IPOPT_TS:
|
||||
ip_printts(cp, len);
|
||||
break;
|
||||
|
||||
#ifndef IPOPT_SECURITY
|
||||
#define IPOPT_SECURITY 130
|
||||
#endif /* IPOPT_SECURITY */
|
||||
case IPOPT_SECURITY:
|
||||
printf(" SECURITY{%d}", len);
|
||||
break;
|
||||
|
||||
case IPOPT_RR:
|
||||
ip_printroute("RR", cp, len);
|
||||
ip_printts(cp, option_len);
|
||||
break;
|
||||
|
||||
case IPOPT_RR: /* fall through */
|
||||
case IPOPT_SSRR:
|
||||
ip_printroute("SSRR", cp, len);
|
||||
break;
|
||||
|
||||
case IPOPT_LSRR:
|
||||
ip_printroute("LSRR", cp, len);
|
||||
ip_printroute( cp, option_len);
|
||||
break;
|
||||
|
||||
#ifndef IPOPT_RA
|
||||
#define IPOPT_RA 148 /* router alert */
|
||||
#endif
|
||||
case IPOPT_RA:
|
||||
printf(" RA");
|
||||
if (len != 4)
|
||||
printf("{%d}", len);
|
||||
else {
|
||||
TCHECK(cp[3]);
|
||||
if (cp[2] || cp[3])
|
||||
printf("%d.%d", cp[2], cp[3]);
|
||||
}
|
||||
TCHECK(cp[3]);
|
||||
if (EXTRACT_16BITS(&cp[2]) != 0)
|
||||
printf("value %u", EXTRACT_16BITS(&cp[2]));
|
||||
break;
|
||||
|
||||
case IPOPT_NOP: /* nothing to print - fall through */
|
||||
case IPOPT_SECURITY:
|
||||
default:
|
||||
printf(" IPOPT-%d{%d}", cp[0], len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -367,70 +356,255 @@ static struct tok ip_frag_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
struct ip_print_demux_state {
|
||||
const struct ip *ip;
|
||||
const u_char *cp;
|
||||
u_int len, off;
|
||||
u_char nh;
|
||||
int advance;
|
||||
};
|
||||
|
||||
static void
|
||||
ip_print_demux(netdissect_options *ndo,
|
||||
struct ip_print_demux_state *ipds)
|
||||
{
|
||||
struct protoent *proto;
|
||||
|
||||
again:
|
||||
switch (ipds->nh) {
|
||||
|
||||
case IPPROTO_AH:
|
||||
ipds->nh = *ipds->cp;
|
||||
ipds->advance = ah_print(ipds->cp);
|
||||
if (ipds->advance <= 0)
|
||||
break;
|
||||
ipds->cp += ipds->advance;
|
||||
ipds->len -= ipds->advance;
|
||||
goto again;
|
||||
|
||||
case IPPROTO_ESP:
|
||||
{
|
||||
int enh, padlen;
|
||||
ipds->advance = esp_print(ndo, ipds->cp, ipds->len,
|
||||
(const u_char *)ipds->ip,
|
||||
&enh, &padlen);
|
||||
if (ipds->advance <= 0)
|
||||
break;
|
||||
ipds->cp += ipds->advance;
|
||||
ipds->len -= ipds->advance + padlen;
|
||||
ipds->nh = enh & 0xff;
|
||||
goto again;
|
||||
}
|
||||
|
||||
case IPPROTO_IPCOMP:
|
||||
{
|
||||
int enh;
|
||||
ipds->advance = ipcomp_print(ipds->cp, &enh);
|
||||
if (ipds->advance <= 0)
|
||||
break;
|
||||
ipds->cp += ipds->advance;
|
||||
ipds->len -= ipds->advance;
|
||||
ipds->nh = enh & 0xff;
|
||||
goto again;
|
||||
}
|
||||
|
||||
case IPPROTO_SCTP:
|
||||
sctp_print(ipds->cp, (const u_char *)ipds->ip, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_TCP:
|
||||
tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
|
||||
(ipds->off &~ 0x6000));
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
udp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
|
||||
(ipds->off &~ 0x6000));
|
||||
break;
|
||||
|
||||
case IPPROTO_ICMP:
|
||||
/* pass on the MF bit plus the offset to detect fragments */
|
||||
icmp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
|
||||
(ipds->off & 0x3fff));
|
||||
break;
|
||||
|
||||
case IPPROTO_PIGP:
|
||||
/*
|
||||
* XXX - the current IANA protocol number assignments
|
||||
* page lists 9 as "any private interior gateway
|
||||
* (used by Cisco for their IGRP)" and 88 as
|
||||
* "EIGRP" from Cisco.
|
||||
*
|
||||
* Recent BSD <netinet/in.h> headers define
|
||||
* IP_PROTO_PIGP as 9 and IP_PROTO_IGRP as 88.
|
||||
* We define IP_PROTO_PIGP as 9 and
|
||||
* IP_PROTO_EIGRP as 88; those names better
|
||||
* match was the current protocol number
|
||||
* assignments say.
|
||||
*/
|
||||
igrp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
|
||||
break;
|
||||
|
||||
case IPPROTO_EIGRP:
|
||||
eigrp_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_ND:
|
||||
ND_PRINT((ndo, " nd %d", ipds->len));
|
||||
break;
|
||||
|
||||
case IPPROTO_EGP:
|
||||
egp_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_OSPF:
|
||||
ospf_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
|
||||
break;
|
||||
|
||||
case IPPROTO_IGMP:
|
||||
igmp_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_IPV4:
|
||||
/* DVMRP multicast tunnel (ip-in-ip encapsulation) */
|
||||
ip_print(gndo, ipds->cp, ipds->len);
|
||||
if (! vflag) {
|
||||
ND_PRINT((ndo, " (ipip-proto-4)"));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case IPPROTO_IPV6:
|
||||
/* ip6-in-ip encapsulation */
|
||||
ip6_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
#endif /*INET6*/
|
||||
|
||||
case IPPROTO_RSVP:
|
||||
rsvp_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_GRE:
|
||||
/* do it */
|
||||
gre_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_MOBILE:
|
||||
mobile_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_PIM:
|
||||
pim_print(ipds->cp, ipds->len);
|
||||
break;
|
||||
|
||||
case IPPROTO_VRRP:
|
||||
vrrp_print(ipds->cp, ipds->len, ipds->ip->ip_ttl);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((proto = getprotobynumber(ipds->nh)) != NULL)
|
||||
ND_PRINT((ndo, " %s", proto->p_name));
|
||||
else
|
||||
ND_PRINT((ndo, " ip-proto-%d", ipds->nh));
|
||||
ND_PRINT((ndo, " %d", ipds->len));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ip_print_inner(netdissect_options *ndo,
|
||||
const u_char *bp,
|
||||
u_int length, u_int nh,
|
||||
const u_char *bp2)
|
||||
{
|
||||
struct ip_print_demux_state ipd;
|
||||
|
||||
ipd.ip = (const struct ip *)bp2;
|
||||
ipd.cp = bp;
|
||||
ipd.len = length;
|
||||
ipd.off = 0;
|
||||
ipd.nh = nh;
|
||||
ipd.advance = 0;
|
||||
|
||||
ip_print_demux(ndo, &ipd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* print an IP datagram.
|
||||
*/
|
||||
void
|
||||
ip_print(register const u_char *bp, register u_int length)
|
||||
ip_print(netdissect_options *ndo,
|
||||
const u_char *bp,
|
||||
u_int length)
|
||||
{
|
||||
register const struct ip *ip;
|
||||
register u_int hlen, len, len0, off;
|
||||
struct ip_print_demux_state ipd;
|
||||
struct ip_print_demux_state *ipds=&ipd;
|
||||
const u_char *ipend;
|
||||
register const u_char *cp;
|
||||
u_char nh;
|
||||
int advance;
|
||||
struct protoent *proto;
|
||||
u_int hlen;
|
||||
u_int16_t sum, ip_sum;
|
||||
struct protoent *proto;
|
||||
|
||||
ip = (const struct ip *)bp;
|
||||
if (IP_V(ip) != 4) { /* print version if != 4 */
|
||||
printf("IP%u ", IP_V(ip));
|
||||
if (IP_V(ip) == 6)
|
||||
ipds->ip = (const struct ip *)bp;
|
||||
if (IP_V(ipds->ip) != 4) { /* print version if != 4 */
|
||||
printf("IP%u ", IP_V(ipds->ip));
|
||||
if (IP_V(ipds->ip) == 6)
|
||||
printf(", wrong link-layer encapsulation");
|
||||
}
|
||||
else
|
||||
else if (!eflag)
|
||||
printf("IP ");
|
||||
|
||||
if ((u_char *)(ip + 1) > snapend) {
|
||||
if ((u_char *)(ipds->ip + 1) > snapend) {
|
||||
printf("[|ip]");
|
||||
return;
|
||||
}
|
||||
if (length < sizeof (struct ip)) {
|
||||
(void)printf("truncated-ip %d", length);
|
||||
(void)printf("truncated-ip %u", length);
|
||||
return;
|
||||
}
|
||||
hlen = IP_HL(ip) * 4;
|
||||
hlen = IP_HL(ipds->ip) * 4;
|
||||
if (hlen < sizeof (struct ip)) {
|
||||
(void)printf("bad-hlen %u", hlen);
|
||||
return;
|
||||
}
|
||||
|
||||
len = EXTRACT_16BITS(&ip->ip_len);
|
||||
if (length < len)
|
||||
ipds->len = EXTRACT_16BITS(&ipds->ip->ip_len);
|
||||
if (length < ipds->len)
|
||||
(void)printf("truncated-ip - %u bytes missing! ",
|
||||
len - length);
|
||||
if (len < hlen) {
|
||||
(void)printf("bad-len %u", len);
|
||||
return;
|
||||
ipds->len - length);
|
||||
if (ipds->len < hlen) {
|
||||
#ifdef GUESS_TSO
|
||||
if (ipds->len) {
|
||||
(void)printf("bad-len %u", ipds->len);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/* we guess that it is a TSO send */
|
||||
ipds->len = length;
|
||||
}
|
||||
#else
|
||||
(void)printf("bad-len %u", ipds->len);
|
||||
return;
|
||||
#endif /* GUESS_TSO */
|
||||
}
|
||||
|
||||
/*
|
||||
* Cut off the snapshot length to the end of the IP payload.
|
||||
*/
|
||||
ipend = bp + len;
|
||||
ipend = bp + ipds->len;
|
||||
if (ipend < snapend)
|
||||
snapend = ipend;
|
||||
|
||||
len -= hlen;
|
||||
len0 = len;
|
||||
ipds->len -= hlen;
|
||||
|
||||
off = EXTRACT_16BITS(&ip->ip_off);
|
||||
ipds->off = EXTRACT_16BITS(&ipds->ip->ip_off);
|
||||
|
||||
if (vflag) {
|
||||
(void)printf("(tos 0x%x", (int)ip->ip_tos);
|
||||
(void)printf("(tos 0x%x", (int)ipds->ip->ip_tos);
|
||||
/* ECN bits */
|
||||
if (ip->ip_tos & 0x03) {
|
||||
switch (ip->ip_tos & 0x03) {
|
||||
if (ipds->ip->ip_tos & 0x03) {
|
||||
switch (ipds->ip->ip_tos & 0x03) {
|
||||
case 1:
|
||||
(void)printf(",ECT(1)");
|
||||
break;
|
||||
@ -442,8 +616,8 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
}
|
||||
}
|
||||
|
||||
if (ip->ip_ttl >= 1)
|
||||
(void)printf(", ttl %3u", ip->ip_ttl);
|
||||
if (ipds->ip->ip_ttl >= 1)
|
||||
(void)printf(", ttl %3u", ipds->ip->ip_ttl);
|
||||
|
||||
/*
|
||||
* for the firewall guys, print id, offset.
|
||||
@ -451,23 +625,25 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
* For unfragmented datagrams, note the don't fragment flag.
|
||||
*/
|
||||
|
||||
(void)printf(", id %u, offset %u, flags [%s]",
|
||||
EXTRACT_16BITS(&ip->ip_id),
|
||||
(off & 0x1fff) * 8,
|
||||
bittok2str(ip_frag_values, "none", off & 0xe000 ));
|
||||
(void)printf(", id %u, offset %u, flags [%s], proto: %s (%u)",
|
||||
EXTRACT_16BITS(&ipds->ip->ip_id),
|
||||
(ipds->off & 0x1fff) * 8,
|
||||
bittok2str(ip_frag_values, "none", ipds->off&0xe000 ),
|
||||
tok2str(ipproto_values,"unknown",ipds->ip->ip_p),
|
||||
ipds->ip->ip_p);
|
||||
|
||||
(void)printf(", length: %u", EXTRACT_16BITS(&ip->ip_len));
|
||||
(void)printf(", length: %u", EXTRACT_16BITS(&ipds->ip->ip_len));
|
||||
|
||||
if ((hlen - sizeof(struct ip)) > 0) {
|
||||
(void)printf(", optlength: %u (", hlen - (u_int)sizeof(struct ip));
|
||||
ip_optprint((u_char *)(ip + 1), hlen - sizeof(struct ip));
|
||||
printf(", options ( ");
|
||||
ip_optprint((u_char *)(ipds->ip + 1), hlen - sizeof(struct ip));
|
||||
printf(" )");
|
||||
}
|
||||
|
||||
if ((u_char *)ip + hlen <= snapend) {
|
||||
sum = in_cksum((const u_short *)ip, hlen, 0);
|
||||
if ((u_char *)ipds->ip + hlen <= snapend) {
|
||||
sum = in_cksum((const u_short *)ipds->ip, hlen, 0);
|
||||
if (sum != 0) {
|
||||
ip_sum = EXTRACT_16BITS(&ip->ip_sum);
|
||||
ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum);
|
||||
(void)printf(", bad cksum %x (->%x)!", ip_sum,
|
||||
in_cksum_shouldbe(ip_sum, sum));
|
||||
}
|
||||
@ -480,133 +656,17 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
* If this is fragment zero, hand it to the next higher
|
||||
* level protocol.
|
||||
*/
|
||||
if ((off & 0x1fff) == 0) {
|
||||
cp = (const u_char *)ip + hlen;
|
||||
nh = ip->ip_p;
|
||||
if ((ipds->off & 0x1fff) == 0) {
|
||||
ipds->cp = (const u_char *)ipds->ip + hlen;
|
||||
ipds->nh = ipds->ip->ip_p;
|
||||
|
||||
if (nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
|
||||
nh != IPPROTO_SCTP) {
|
||||
(void)printf("%s > %s: ", ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
}
|
||||
again:
|
||||
switch (nh) {
|
||||
|
||||
case IPPROTO_AH:
|
||||
nh = *cp;
|
||||
advance = ah_print(cp);
|
||||
if (advance <= 0)
|
||||
break;
|
||||
cp += advance;
|
||||
len -= advance;
|
||||
goto again;
|
||||
|
||||
case IPPROTO_ESP:
|
||||
{
|
||||
int enh, padlen;
|
||||
advance = esp_print(cp, (const u_char *)ip, &enh, &padlen);
|
||||
if (advance <= 0)
|
||||
break;
|
||||
cp += advance;
|
||||
len -= advance + padlen;
|
||||
nh = enh & 0xff;
|
||||
goto again;
|
||||
}
|
||||
|
||||
case IPPROTO_IPCOMP:
|
||||
{
|
||||
int enh;
|
||||
advance = ipcomp_print(cp, &enh);
|
||||
if (advance <= 0)
|
||||
break;
|
||||
cp += advance;
|
||||
len -= advance;
|
||||
nh = enh & 0xff;
|
||||
goto again;
|
||||
}
|
||||
|
||||
case IPPROTO_SCTP:
|
||||
sctp_print(cp, (const u_char *)ip, len);
|
||||
break;
|
||||
|
||||
case IPPROTO_TCP:
|
||||
tcp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
|
||||
break;
|
||||
|
||||
case IPPROTO_UDP:
|
||||
udp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
|
||||
break;
|
||||
|
||||
case IPPROTO_ICMP:
|
||||
/* pass on the MF bit plus the offset to detect fragments */
|
||||
icmp_print(cp, len, (const u_char *)ip, (off & 0x3fff));
|
||||
break;
|
||||
|
||||
case IPPROTO_IGRP:
|
||||
igrp_print(cp, len, (const u_char *)ip);
|
||||
break;
|
||||
|
||||
case IPPROTO_ND:
|
||||
(void)printf(" nd %d", len);
|
||||
break;
|
||||
|
||||
case IPPROTO_EGP:
|
||||
egp_print(cp);
|
||||
break;
|
||||
|
||||
case IPPROTO_OSPF:
|
||||
ospf_print(cp, len, (const u_char *)ip);
|
||||
break;
|
||||
|
||||
case IPPROTO_IGMP:
|
||||
igmp_print(cp, len);
|
||||
break;
|
||||
|
||||
case IPPROTO_IPV4:
|
||||
/* DVMRP multicast tunnel (ip-in-ip encapsulation) */
|
||||
ip_print(cp, len);
|
||||
if (! vflag) {
|
||||
printf(" (ipip-proto-4)");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case IPPROTO_IPV6:
|
||||
/* ip6-in-ip encapsulation */
|
||||
ip6_print(cp, len);
|
||||
break;
|
||||
#endif /*INET6*/
|
||||
|
||||
case IPPROTO_RSVP:
|
||||
rsvp_print(cp, len);
|
||||
break;
|
||||
|
||||
case IPPROTO_GRE:
|
||||
/* do it */
|
||||
gre_print(cp, len);
|
||||
break;
|
||||
|
||||
case IPPROTO_MOBILE:
|
||||
mobile_print(cp, len);
|
||||
break;
|
||||
|
||||
case IPPROTO_PIM:
|
||||
pim_print(cp, len);
|
||||
break;
|
||||
|
||||
case IPPROTO_VRRP:
|
||||
vrrp_print(cp, len, ip->ip_ttl);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((proto = getprotobynumber(nh)) != NULL)
|
||||
(void)printf(" %s", proto->p_name);
|
||||
else
|
||||
(void)printf(" ip-proto-%d", nh);
|
||||
printf(" %d", len);
|
||||
break;
|
||||
if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP &&
|
||||
ipds->nh != IPPROTO_SCTP) {
|
||||
(void)printf("%s > %s: ",
|
||||
ipaddr_string(&ipds->ip->ip_src),
|
||||
ipaddr_string(&ipds->ip->ip_dst));
|
||||
}
|
||||
ip_print_demux(ndo, ipds);
|
||||
} else {
|
||||
/* Ultra quiet now means that all this stuff should be suppressed */
|
||||
if (qflag > 1) return;
|
||||
@ -616,13 +676,13 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
* next level protocol header. print the ip addr
|
||||
* and the protocol.
|
||||
*/
|
||||
if (off & 0x1fff) {
|
||||
(void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
if ((proto = getprotobynumber(ip->ip_p)) != NULL)
|
||||
if (ipds->off & 0x1fff) {
|
||||
(void)printf("%s > %s:", ipaddr_string(&ipds->ip->ip_src),
|
||||
ipaddr_string(&ipds->ip->ip_dst));
|
||||
if ((proto = getprotobynumber(ipds->ip->ip_p)) != NULL)
|
||||
(void)printf(" %s", proto->p_name);
|
||||
else
|
||||
(void)printf(" ip-proto-%d", ip->ip_p);
|
||||
(void)printf(" ip-proto-%d", ipds->ip->ip_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -640,7 +700,7 @@ ipN_print(register const u_char *bp, register u_int length)
|
||||
memcpy (&hdr, (char *)ip, 4);
|
||||
switch (IP_V(&hdr)) {
|
||||
case 4:
|
||||
ip_print (bp, length);
|
||||
ip_print (gndo, bp, length);
|
||||
return;
|
||||
#ifdef INET6
|
||||
case 6:
|
||||
@ -653,5 +713,11 @@ ipN_print(register const u_char *bp, register u_int length)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: whitesmith
|
||||
* c-basic-offset: 8
|
||||
* End:
|
||||
*/
|
||||
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.32.2.8 2003/11/24 20:31:22 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47 2005/04/06 21:32:40 mcr Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -63,16 +63,43 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
|
||||
TCHECK(*ip6);
|
||||
if (length < sizeof (struct ip6_hdr)) {
|
||||
(void)printf("truncated-ip6 %d", length);
|
||||
(void)printf("truncated-ip6 %u", length);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!eflag)
|
||||
printf("IP6 ");
|
||||
|
||||
payload_len = EXTRACT_16BITS(&ip6->ip6_plen);
|
||||
len = payload_len + sizeof(struct ip6_hdr);
|
||||
if (length < len)
|
||||
(void)printf("truncated-ip6 - %d bytes missing!",
|
||||
(void)printf("truncated-ip6 - %u bytes missing!",
|
||||
len - length);
|
||||
|
||||
if (vflag) {
|
||||
flow = EXTRACT_32BITS(&ip6->ip6_flow);
|
||||
printf("(");
|
||||
#if 0
|
||||
/* rfc1883 */
|
||||
if (flow & 0x0f000000)
|
||||
(void)printf("pri 0x%02x, ", (flow & 0x0f000000) >> 24);
|
||||
if (flow & 0x00ffffff)
|
||||
(void)printf("flowlabel 0x%06x, ", flow & 0x00ffffff);
|
||||
#else
|
||||
/* RFC 2460 */
|
||||
if (flow & 0x0ff00000)
|
||||
(void)printf("class 0x%02x, ", (flow & 0x0ff00000) >> 20);
|
||||
if (flow & 0x000fffff)
|
||||
(void)printf("flowlabel 0x%05x, ", flow & 0x000fffff);
|
||||
#endif
|
||||
|
||||
(void)printf("hlim %u, next-header: %s (%u), length: %u) ",
|
||||
ip6->ip6_hlim,
|
||||
tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
|
||||
ip6->ip6_nxt,
|
||||
payload_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Cut off the snapshot length to the end of the IP payload.
|
||||
*/
|
||||
@ -106,7 +133,7 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
case IPPROTO_FRAGMENT:
|
||||
advance = frag6_print(cp, (const u_char *)ip6);
|
||||
if (snapend <= cp + advance)
|
||||
goto end;
|
||||
return;
|
||||
nh = *cp;
|
||||
fragmented = 1;
|
||||
break;
|
||||
@ -125,23 +152,23 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
*/
|
||||
advance = mobility_print(cp, (const u_char *)ip6);
|
||||
nh = *cp;
|
||||
goto end;
|
||||
return;
|
||||
case IPPROTO_ROUTING:
|
||||
advance = rt6_print(cp, (const u_char *)ip6);
|
||||
nh = *cp;
|
||||
break;
|
||||
case IPPROTO_SCTP:
|
||||
sctp_print(cp, (const u_char *)ip6, len);
|
||||
goto end;
|
||||
return;
|
||||
case IPPROTO_TCP:
|
||||
tcp_print(cp, len, (const u_char *)ip6, fragmented);
|
||||
goto end;
|
||||
return;
|
||||
case IPPROTO_UDP:
|
||||
udp_print(cp, len, (const u_char *)ip6, fragmented);
|
||||
goto end;
|
||||
return;
|
||||
case IPPROTO_ICMPV6:
|
||||
icmp6_print(cp, len, (const u_char *)ip6, fragmented);
|
||||
goto end;
|
||||
return;
|
||||
case IPPROTO_AH:
|
||||
advance = ah_print(cp);
|
||||
nh = *cp;
|
||||
@ -149,7 +176,7 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
case IPPROTO_ESP:
|
||||
{
|
||||
int enh, padlen;
|
||||
advance = esp_print(cp, (const u_char *)ip6, &enh, &padlen);
|
||||
advance = esp_print(gndo, cp, len, (const u_char *)ip6, &enh, &padlen);
|
||||
nh = enh & 0xff;
|
||||
len -= padlen;
|
||||
break;
|
||||
@ -164,56 +191,29 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
|
||||
case IPPROTO_PIM:
|
||||
pim_print(cp, len);
|
||||
goto end;
|
||||
return;
|
||||
case IPPROTO_OSPF:
|
||||
ospf6_print(cp, len);
|
||||
goto end;
|
||||
return;
|
||||
|
||||
case IPPROTO_IPV6:
|
||||
ip6_print(cp, len);
|
||||
goto end;
|
||||
return;
|
||||
|
||||
case IPPROTO_IPV4:
|
||||
ip_print(cp, len);
|
||||
goto end;
|
||||
ip_print(gndo, cp, len);
|
||||
return;
|
||||
|
||||
case IPPROTO_NONE:
|
||||
(void)printf("no next header");
|
||||
goto end;
|
||||
return;
|
||||
|
||||
default:
|
||||
(void)printf("ip-proto-%d %d", ip6->ip6_nxt, len);
|
||||
goto end;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
flow = EXTRACT_32BITS(&ip6->ip6_flow);
|
||||
#if 0
|
||||
/* rfc1883 */
|
||||
if (flow & 0x0f000000)
|
||||
(void)printf(" [pri 0x%x]", (flow & 0x0f000000) >> 24);
|
||||
if (flow & 0x00ffffff)
|
||||
(void)printf(" [flowlabel 0x%x]", flow & 0x00ffffff);
|
||||
#else
|
||||
/* RFC 2460 */
|
||||
if (flow & 0x0ff00000)
|
||||
(void)printf(" [class 0x%x]", (flow & 0x0ff00000) >> 20);
|
||||
if (flow & 0x000fffff)
|
||||
(void)printf(" [flowlabel 0x%x]", flow & 0x000fffff);
|
||||
#endif
|
||||
|
||||
if (ip6->ip6_hlim <= 1)
|
||||
(void)printf(" [hlim %u]", ip6->ip6_hlim);
|
||||
|
||||
if (vflag) {
|
||||
printf(" (");
|
||||
(void)printf("len %u", payload_len);
|
||||
if (ip6->ip6_hlim > 1)
|
||||
(void)printf(", hlim %d", (int)ip6->ip6_hlim);
|
||||
printf(")");
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|ip6]");
|
||||
|
@ -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
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.34.2.2 2003/11/16 08:51:28 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.40 2004/05/26 19:57:57 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -56,12 +56,15 @@ ipx_print(const u_char *p, u_int length)
|
||||
{
|
||||
const struct ipxHdr *ipx = (const struct ipxHdr *)p;
|
||||
|
||||
if (!eflag)
|
||||
printf("IPX ");
|
||||
|
||||
TCHECK(ipx->srcSkt);
|
||||
(void)printf("%s.%04x > ",
|
||||
ipxaddr_string(EXTRACT_32BITS(ipx->srcNet), ipx->srcNode),
|
||||
EXTRACT_16BITS(&ipx->srcSkt));
|
||||
|
||||
(void)printf("%s.%04x:",
|
||||
(void)printf("%s.%04x: ",
|
||||
ipxaddr_string(EXTRACT_32BITS(ipx->dstNet), ipx->dstNode),
|
||||
EXTRACT_16BITS(&ipx->dstSkt));
|
||||
|
||||
@ -94,7 +97,7 @@ ipx_decode(const struct ipxHdr *ipx, const u_char *datap, u_int length)
|
||||
dstSkt = EXTRACT_16BITS(&ipx->dstSkt);
|
||||
switch (dstSkt) {
|
||||
case IPX_SKT_NCP:
|
||||
(void)printf(" ipx-ncp %d", length);
|
||||
(void)printf("ipx-ncp %d", length);
|
||||
break;
|
||||
case IPX_SKT_SAP:
|
||||
ipx_sap_print((u_short *)datap, length);
|
||||
@ -103,25 +106,25 @@ ipx_decode(const struct ipxHdr *ipx, const u_char *datap, u_int length)
|
||||
ipx_rip_print((u_short *)datap, length);
|
||||
break;
|
||||
case IPX_SKT_NETBIOS:
|
||||
(void)printf(" ipx-netbios %d", length);
|
||||
(void)printf("ipx-netbios %d", length);
|
||||
#ifdef TCPDUMP_DO_SMB
|
||||
ipx_netbios_print(datap, length);
|
||||
#endif
|
||||
break;
|
||||
case IPX_SKT_DIAGNOSTICS:
|
||||
(void)printf(" ipx-diags %d", length);
|
||||
(void)printf("ipx-diags %d", length);
|
||||
break;
|
||||
case IPX_SKT_NWLINK_DGM:
|
||||
(void)printf(" ipx-nwlink-dgm %d", length);
|
||||
(void)printf("ipx-nwlink-dgm %d", length);
|
||||
#ifdef TCPDUMP_DO_SMB
|
||||
ipx_netbios_print(datap, length);
|
||||
#endif
|
||||
break;
|
||||
case IPX_SKT_EIGRP:
|
||||
(void)printf(" ipx-eigrp %d", length);
|
||||
eigrp_print(datap, length);
|
||||
break;
|
||||
default:
|
||||
(void)printf(" ipx-#%x %d", dstSkt, length);
|
||||
(void)printf("ipx-#%x %d", dstSkt, length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ isakmp_sa_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_t_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_ke_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_id_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_cert_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_cr_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_hash_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_sig_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_n_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_d_print(const struct isakmp_gen *ext, u_int item_len,
|
||||
}
|
||||
|
||||
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 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
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:
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.53.2.3 2003/12/29 22:33:18 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61 2005/04/06 21:32:41 mcr Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -42,6 +42,7 @@ static const char rcsid[] _U_ =
|
||||
|
||||
#include "llc.h"
|
||||
#include "ethertype.h"
|
||||
#include "oui.h"
|
||||
|
||||
static struct tok llc_values[] = {
|
||||
{ LLCSAP_NULL, "Null" },
|
||||
@ -94,7 +95,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
memcpy((char *)&llc, (char *)p, min(caplen, sizeof(llc)));
|
||||
|
||||
if (eflag)
|
||||
printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x, ",
|
||||
printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x: ",
|
||||
tok2str(llc_values,"Unknown",llc.dsap),
|
||||
llc.dsap,
|
||||
tok2str(llc_values,"Unknown",llc.ssap),
|
||||
@ -116,9 +117,12 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
* such as an 802.11 network; this has appeared in at
|
||||
* least one capture file.)
|
||||
*/
|
||||
printf("(NOV-802.3) ");
|
||||
ipx_print(p, length);
|
||||
return (1);
|
||||
|
||||
if (eflag)
|
||||
printf("IPX-802.3: ");
|
||||
|
||||
ipx_print(p, length);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_8021D && llc.dsap == LLCSAP_8021D) {
|
||||
@ -127,7 +131,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_IP && llc.dsap == LLCSAP_IP) {
|
||||
ip_print(p+4, length-4);
|
||||
ip_print(gndo, p+4, length-4);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -216,6 +220,14 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
|
||||
orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
|
||||
et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
|
||||
|
||||
if (eflag)
|
||||
(void)printf("oui %s (0x%06x), ethertype %s (0x%04x): ",
|
||||
tok2str(oui_values,"Unknown",orgcode),
|
||||
orgcode,
|
||||
tok2str(ethertype_values,"Unknown", et),
|
||||
et);
|
||||
|
||||
/*
|
||||
* XXX - what *is* the right bridge pad value here?
|
||||
* Does anybody ever bridge one form of LAN traffic
|
||||
@ -308,7 +320,6 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
length -= 4;
|
||||
caplen -= 4;
|
||||
}
|
||||
(void)printf(" len=%d", length);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -427,3 +438,11 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: whitesmith
|
||||
* c-basic-offset: 8
|
||||
* End:
|
||||
*/
|
||||
|
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");
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user