import tcpdump-3.9.7 (after running the tcpdump2netbsd script and
defusing NetBSD id strings used as reference)
This commit is contained in:
parent
9b435895e8
commit
57e6a30fe7
164
dist/tcpdump/CHANGES
vendored
164
dist/tcpdump/CHANGES
vendored
@ -1,4 +1,134 @@
|
||||
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.2.14 2007/07/24 02:17:13 mcr Exp
|
||||
|
||||
Wed. July 23, 2007. mcr@xelerance.com. Summary for 0.9.7 libpcap release
|
||||
|
||||
NFS: Print unsigned values as such.
|
||||
RX: parse safely.
|
||||
BGP: fixes for IPv6-less builds.
|
||||
801.1ag: use standard codepoint.
|
||||
use /dev/bpf on systems with such a device.
|
||||
802.11: print QoS data, avoid dissect of no-data frame, ignore padding.
|
||||
smb: make sure that we haven't gone past the end of the captured data.
|
||||
smb: squelch an uninitialized complaint from coverity.
|
||||
NFS: from NetBSD; don't interpret the reply as a possible NFS reply
|
||||
if it got MSG_DENIED.
|
||||
BGP: don't print TLV values that didn't fit, from www.digit-labs.org.
|
||||
revised INSTALL.txt about libpcap dependancy.
|
||||
|
||||
Wed. April 25, 2007. ken@xelerance.com. Summary for 3.9.6 tcpdump release
|
||||
Update man page to reflect changes to libpcap
|
||||
Changes to both TCP and IP Printer Output
|
||||
Fix a potential buffer overflow in the 802.11 printer
|
||||
Print basic info about a few more Cisco LAN protocols.
|
||||
mDNS cleanup
|
||||
ICMP MPLS rework of the extension code
|
||||
bugfix: use the correct codepoint for the OSPF simple text auth token
|
||||
entry, and use safeputs to print the password.
|
||||
Add support in pflog for additional values
|
||||
Add support for OIF RSVP Extensions UNI 1.0 Rev. 2 and additional RSVP objects
|
||||
Add support for the Message-id NACK c-type.
|
||||
Add support for 802.3ah loopback ctrl msg
|
||||
Add support for Multiple-STP as per 802.1s
|
||||
Add support for rapid-SPT as per 802.1w
|
||||
Add support for CFM Link-trace msg, Link-trace-Reply msg,
|
||||
Sender-ID tlv, private tlv, port, interface status
|
||||
Add support for unidirectional link detection as per
|
||||
http://www.ietf.org/internet-drafts/draft-foschiano-udld-02.txt
|
||||
Add support for the olsr protocol as per RFC 3626 plus the LQ
|
||||
extensions from olsr.org
|
||||
Add support for variable-length checksum in DCCP, as per section 9 of
|
||||
RFC 4340.
|
||||
Add support for per-VLAN spanning tree and per-VLAN rapid spanning tree
|
||||
Add support for Multiple-STP as per 802.1s
|
||||
Add support for the cisco propriatry 'dynamic trunking protocol'
|
||||
Add support for the cisco proprietary VTP protocol
|
||||
Update dhcp6 options table as per IETF standardization activities
|
||||
|
||||
|
||||
Tue. September 19, 2006. ken@xelerance.com. Summary for 3.9.5 tcpdump release
|
||||
|
||||
Fix compiling on AIX (, at end of ENUM)
|
||||
Updated list of DNS RR typecodes
|
||||
Use local Ethernet defs on WIN32
|
||||
Add support for Frame-Relay ARP
|
||||
Fixes for compiling under MSVC++
|
||||
Add support for parsing Juniper .pcap files
|
||||
Add support for FRF.16 Multilink Frame-Relay (DLT_MFR)
|
||||
Rework the OSPFv3 printer
|
||||
Fix printing for 4.4BSD/NetBSD NFS Filehandles
|
||||
Add support for Cisco style NLPID encapsulation
|
||||
Add cisco prop. eigrp related, extended communities
|
||||
Add support for BGP signaled VPLS
|
||||
Cleanup the bootp printer
|
||||
Add support for PPP over Frame-Relay
|
||||
Add some bounds checking to the IP options code, and clean up
|
||||
the options output a bit.
|
||||
Add additional modp groups to ISAKMP printer
|
||||
Add support for Address-Withdraw and Label-Withdraw Msgs
|
||||
Add support for the BFD Discriminator TLV
|
||||
Fixes for 64bit compiling
|
||||
Add support for PIMv2 checksum verification
|
||||
Add support for further dissection of the IPCP Compression Option
|
||||
Add support for Cisco's proposed VQP protocol
|
||||
Add basic support for keyed authentication TCP option
|
||||
Lots of minor cosmetic changes to output printers
|
||||
|
||||
|
||||
Mon. September 19, 2005. ken@xelerance.com. Summary for 3.9.4 tcpdump release
|
||||
Decoder support for more Juniper link-layer types
|
||||
Fix a potential buffer overflow (although it can't occur in
|
||||
practice).
|
||||
Fix the handling of unknown management frame types in the 802.11
|
||||
printer.
|
||||
Add FRF.16 support, fix various Frame Relay bugs.
|
||||
Add support for RSVP integrity objects, update fast-reroute
|
||||
object printer to latest spec.
|
||||
Clean up documentation of vlan filter expression, document mpls
|
||||
filter expression.
|
||||
Document new pppoed and pppoes filter expressions.
|
||||
Update diffserver-TE codepoints as per RFC 4124.
|
||||
Spelling fixes in ICMPv6.
|
||||
Don't require any fields other than flags to be present in IS-IS
|
||||
restart signaling TLVs, and only print the system ID in
|
||||
those TLVs as system IDs, not as node IDs.
|
||||
Support for DCCP.
|
||||
|
||||
Tue. July 5, 2005. ken@xelerance.com. Summary for 3.9.3 tcpdump release
|
||||
|
||||
Option to chroot() when dropping privs
|
||||
Fixes for compiling on nearly every platform,
|
||||
including improved 64bit support
|
||||
Many new testcases
|
||||
Support for sending packets
|
||||
Many compliation fixes on most platforms
|
||||
Fixes for recent version of GCC to eliminate warnings
|
||||
Improved Unicode support
|
||||
|
||||
Decoders & DLT Changes, Updates and New:
|
||||
AES ESP support
|
||||
Juniper ATM, FRF.15, FRF.16, PPPoE,
|
||||
ML-FR, ML-PIC, ML-PPP, PL-PPP, LS-PIC
|
||||
GGSN,ES,MONITOR,SERVICES
|
||||
L2VPN
|
||||
Axent Raptor/Symantec Firewall
|
||||
TCP-MD5 (RFC 2385)
|
||||
ESP-in-UDP (RFC 3948)
|
||||
ATM OAM
|
||||
LMP, LMP Service Discovery
|
||||
IP over FC
|
||||
IP over IEEE 1394
|
||||
BACnet MS/TP
|
||||
SS7
|
||||
LDP over TCP
|
||||
LACP, MARKER as per 802.3ad
|
||||
PGM (RFC 3208)
|
||||
LSP-PING
|
||||
G.7041/Y.1303 Generic Framing Procedure
|
||||
EIGRP-IP, EIGRP-IPX
|
||||
ICMP6
|
||||
Radio - via radiotap
|
||||
DHCPv6
|
||||
HDLC over PPP
|
||||
|
||||
Tue. March 30, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.3 release
|
||||
|
||||
@ -29,25 +159,25 @@ Wed. November 12, 2003. mcr@sandelman.ottawa.on.ca. Summary for 3.8 release
|
||||
changed syntax of -E argument so that multiple SAs can be decrypted
|
||||
fixes for Digital Unix headers and Documentation
|
||||
__attribute__ fixes
|
||||
CDP changes from Terry Kennedy <terry@tmk.com>.
|
||||
IPv6 mobility updates from Kazushi Sugyo <sugyo@pb.jp.nec.com>
|
||||
CDP changes from Terry Kennedy <terry@tmk.com>.
|
||||
IPv6 mobility updates from Kazushi Sugyo <sugyo@pb.jp.nec.com>
|
||||
Fixes for ASN.1 decoder for 2.100.3 forms.
|
||||
Added a count of packets received and processed to clarify numbers.
|
||||
Incorporated WinDUMP patches for Win32 builds.
|
||||
PPPoE payload length headers.
|
||||
Fixes for HP C compiler builds.
|
||||
Use new pcap_breakloop() and pcap_findalldevs() if we can.
|
||||
BGP output split into multiple lines.
|
||||
BGP output split into multiple lines.
|
||||
Fixes to 802.11 decoding.
|
||||
Fixes to PIM decoder.
|
||||
SuperH is a CPU that can't handle unaligned access. Many fixes for
|
||||
unaligned access work.
|
||||
Fixes to Frame-Relay decoder for Q.933/922 frames.
|
||||
Clarified when Solaris can do captures as non-root.
|
||||
Added tests/ subdir for examples/regression tests.
|
||||
Added tests/ subdir for examples/regression tests.
|
||||
New -U flag. -flush stdout after every packet
|
||||
New -A flag -print ascii only
|
||||
support for decoding IS-IS inside Cisco HDLC Frames
|
||||
support for decoding IS-IS inside Cisco HDLC Frames
|
||||
more verbosity for tftp decoder
|
||||
mDNS decoder
|
||||
new BFD decoder
|
||||
@ -55,7 +185,7 @@ Wed. November 12, 2003. mcr@sandelman.ottawa.on.ca. Summary for 3.8 release
|
||||
RFC 3561 AODV support.
|
||||
UDP/TCP pseudo-checksum properly for source-route options.
|
||||
sanitized all files to modified BSD license
|
||||
Add support for RFC 2625 IP-over-Fibre Channel.
|
||||
Add support for RFC 2625 IP-over-Fibre Channel.
|
||||
fixes for DECnet support.
|
||||
Support RFC 2684 bridging of Ethernet, 802.5 Token Ring, and FDDI.
|
||||
RFC 2684 encapsulation of BPDUs.
|
||||
@ -86,18 +216,18 @@ see http://www.tcpdump.org/cvs-log/2002-01-21.10:16:48.html for commit log.
|
||||
Better OSI/802.2 support on Linux.
|
||||
IEEE 802.11 support, from clenahan@fortresstech.com, achirica@ttd.net.
|
||||
LLC SAP support for FDDI/token ring/RFC-1483 style ATM
|
||||
BXXP protocol was replaced by the BEEP protocol;
|
||||
BXXP protocol was replaced by the BEEP protocol;
|
||||
improvements to SNAP demux.
|
||||
Changes to "any" interface documentation.
|
||||
Documentation on pcap_stats() counters.
|
||||
Fix a memory leak found by Miklos Szeredi - pcap_ether_aton().
|
||||
Added MPLS encapsulation decoding per RFC3032.
|
||||
DNS dissector handles TKEY, TSIG and IXFR.
|
||||
adaptive SLIP interface patch from Igor Khristophorov <igor@atdot.org>
|
||||
SMB printing has much improved bounds checks
|
||||
adaptive SLIP interface patch from Igor Khristophorov <igor@atdot.org>
|
||||
SMB printing has much improved bounds checks
|
||||
OUI 0x0000f8 decoded as encapsulated ethernet for Cisco-custom bridging
|
||||
Zephyr support, from Nickolai Zeldovich <kolya@MIT.EDU>.
|
||||
Solaris - devices with digits in them. Stefan Hudson <hudson@mbay.net>
|
||||
Solaris - devices with digits in them. Stefan Hudson <hudson@mbay.net>
|
||||
IPX socket 0x85be is for Cisco EIGRP over IPX.
|
||||
Improvements to fragmented ESP handling.
|
||||
SCTP support from Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
|
||||
@ -105,7 +235,7 @@ see http://www.tcpdump.org/cvs-log/2002-01-21.10:16:48.html for commit log.
|
||||
Added a "netbeui" keyword, which selects NetBEUI packets.
|
||||
IPv6 ND improvements, MobileIP dissector, 2292bis-02 for RA option.
|
||||
Handle ARPHDR_HDLC from Marcus Felipe Pereira <marcus@task.com.br>.
|
||||
Handle IPX socket 0x553 -> NetBIOS-over-IPX socket, "nwlink-dgm"
|
||||
Handle IPX socket 0x553 -> NetBIOS-over-IPX socket, "nwlink-dgm"
|
||||
Better Linux libc5 compat.
|
||||
BIND9 lwres dissector added.
|
||||
MIPS and SPARC get strict alignment macros (affects print-bgp.c)
|
||||
@ -123,8 +253,8 @@ see http://www.tcpdump.org/cvs-log/2002-01-21.10:16:48.html for commit log.
|
||||
cjclark@alum.mit.edu: print the IP proto for non-initial fragments.
|
||||
LLC frames with a DSAP and LSAP of 0xe0 are IPX frames.
|
||||
Linux cooked frames with a type value of LINUX_SLL_P_802_3 are IPX.
|
||||
captures on the "any" device won't be done in promiscuous mode
|
||||
Token Ring support on DLPI - Onno van der Linden <onno@simplex.nl>
|
||||
captures on the "any" device won't be done in promiscuous mode
|
||||
Token Ring support on DLPI - Onno van der Linden <onno@simplex.nl>
|
||||
ARCNet support, from NetBSD.
|
||||
HSRP dissector, from Julian Cowley <julian@lava.net>.
|
||||
Handle (GRE-encapsulated) PPTP
|
||||
@ -155,7 +285,7 @@ Tuesday January 9, 2001. mcr@sandelman.ottawa.on.ca. Summary for 3.6 release
|
||||
|
||||
Updated autoconf stock files.
|
||||
|
||||
IPv6 improvements: dhcp (draft-15), mobile-ip6, ppp, ospf6,
|
||||
IPv6 improvements: dhcp (draft-15), mobile-ip6, ppp, ospf6,
|
||||
|
||||
Added dissector support for: ISOCLNS, Token Ring, IGMPv3, bxxp,
|
||||
timed, vrrp, radius, chdlc, cnfp, cdp, IEEE802.1d, raw-AppleTalk
|
||||
@ -168,7 +298,7 @@ Tuesday January 9, 2001. mcr@sandelman.ottawa.on.ca. Summary for 3.6 release
|
||||
HP-UX 11.0 -- find the right dlpi device.
|
||||
Solaris 8 - IPv6 works
|
||||
Linux - Added support for an "any" device to capture on all interfaces
|
||||
|
||||
|
||||
Security fixes: buffer overrun audit done. Strcpy replaced with
|
||||
strlcpy, sprintf replaced with snprintf.
|
||||
Look for lex problems, and warn about them.
|
||||
@ -483,7 +613,7 @@ v3.1 Thu Jun 13 20:59:32 PDT 1996
|
||||
|
||||
- Don't checksum ip header if we don't have all of it. Thanks to John
|
||||
Hawkinson (jhawk@mit.edu).
|
||||
|
||||
|
||||
- Print out hostnames if possible in egp printer. Thanks to Jeffrey
|
||||
Honig (jhc@bsdi.com)
|
||||
|
||||
|
30
dist/tcpdump/CREDITS
vendored
30
dist/tcpdump/CREDITS
vendored
@ -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,12 +11,17 @@ The current maintainers:
|
||||
|
||||
Additional people who have contributed patches:
|
||||
|
||||
Andrew Brown <atatat@atatdot.net>
|
||||
Aaron Campbell <aaron@arbor.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>
|
||||
Andy Heffernan <ahh@juniper.net>
|
||||
Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
||||
Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
|
||||
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
|
||||
Atsushi Onoe <onoe@netbsd.org>
|
||||
Ben Smithurst <ben@scientia.demon.co.uk>
|
||||
Brent L. Bates <blbates@vigyan.com>
|
||||
@ -32,7 +38,11 @@ Additional people who have contributed patches:
|
||||
Daniel Hagerty <hag@ai.mit.edu>
|
||||
Darren Reed <darrenr@reed.wattle.id.au>
|
||||
David Binderman <d.binderman@virgin.net>
|
||||
David Smith <dsmith@redhat.com>
|
||||
David Young <dyoung@ojctech.com>
|
||||
Don Ebright <Don.Ebright@compuware.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,10 +52,13 @@ 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>
|
||||
Hendrik Scholz <hendrik@scholz.net>
|
||||
Ian McDonald <imcdnzl@gmail.com>
|
||||
Jacek Tobiasz <Jacek.Tobiasz@atm.com.pl>
|
||||
Jakob Schlyter <jakob@openbsd.org>
|
||||
Jan Oravec <wsx@wsx6.net>
|
||||
Jason R. Thorpe <thorpej@netbsd.org>
|
||||
@ -70,13 +83,16 @@ Additional people who have contributed patches:
|
||||
Loris Degioanni <loris@netgroup-serv.polito.it>
|
||||
Love Hörnquist-Åstrand <lha@stacken.kth.se>
|
||||
Maciej W. Rozycki <macro@ds2.pg.gda.pl>
|
||||
Manu Pathak <mapathak@cisco.com>
|
||||
Marc A. Lehmann <pcg@goof.com>
|
||||
Mark Ellzey Thomas <mark@ackers.net>
|
||||
Marko Kiiskila <carnil@cs.tut.fi>
|
||||
Markus Schöpflin <schoepflin@sourceforge.net>
|
||||
Marshall Rose <mrose@dbc.mtview.ca.us>
|
||||
Martin Husemann <martin@netbsd.org>
|
||||
Michael Madore <mmadore@turbolinux.com>
|
||||
Michael Shalayeff <mickey@openbsd.org>
|
||||
Michael Shields <shields@msrl.com>
|
||||
Michael T. Stolarchuk <mts@off.to>
|
||||
Michele "mydecay" Marchetto <smarchetto1@tin.it>
|
||||
Monroe Williams <monroe@pobox.com>
|
||||
@ -86,6 +102,8 @@ 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>
|
||||
Noritoshi Demizu <demizu@users.sourceforge.net>
|
||||
Olaf Kirch <okir@caldera.de>
|
||||
Onno van der Linden <onno@simplex.nl>
|
||||
Pascal Hennequin <pascal.hennequin@int-evry.fr>
|
||||
@ -98,21 +116,29 @@ 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 Cheng <rcheng@juniper.net>
|
||||
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>
|
||||
Swaminathan Chandrasekaran <chander@juniper.net>
|
||||
Takashi Yamamoto <yamt@mwd.biglobe.ne.jp>
|
||||
Terry Kennedy <terry@tmk.com>
|
||||
Timo Koskiahde
|
||||
Tony Li <tli@procket.com>
|
||||
Uns Lider <unslider@miranda.org>
|
||||
Wesley Griffin <wgriffin@users.sourceforge.net>
|
||||
Wilbert de Graaf <wilbertdg@hetnet.nl>
|
||||
Yen Yen Lim
|
||||
Yoshifumi Nishida
|
||||
|
||||
The original LBL crew:
|
||||
Steve McCanne
|
||||
|
37
dist/tcpdump/FILES
vendored
37
dist/tcpdump/FILES
vendored
@ -11,6 +11,8 @@ acconfig.h
|
||||
aclocal.m4
|
||||
addrtoname.c
|
||||
addrtoname.h
|
||||
af.c
|
||||
af.h
|
||||
ah.h
|
||||
aodv.h
|
||||
appletalk.h
|
||||
@ -20,13 +22,18 @@ 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
|
||||
dccp.h
|
||||
decnet.h
|
||||
decode_prefix.h
|
||||
enc.h
|
||||
esp.h
|
||||
ether.h
|
||||
@ -39,17 +46,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 +90,31 @@ 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_dump_ftell.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
|
||||
@ -108,13 +128,16 @@ print-cdp.c
|
||||
print-chdlc.c
|
||||
print-cip.c
|
||||
print-cnfp.c
|
||||
print-dccp.c
|
||||
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 +156,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
|
||||
@ -147,9 +173,11 @@ print-netbios.c
|
||||
print-nfs.c
|
||||
print-ntp.c
|
||||
print-null.c
|
||||
print-olsr.c
|
||||
print-ospf.c
|
||||
print-ospf6.c
|
||||
print-pflog.c
|
||||
print-pgm.c
|
||||
print-pim.c
|
||||
print-ppp.c
|
||||
print-pppoe.c
|
||||
@ -162,13 +190,17 @@ print-rsvp.c
|
||||
print-rt6.c
|
||||
print-rx.c
|
||||
print-sctp.c
|
||||
print-sip.c
|
||||
print-sl.c
|
||||
print-sll.c
|
||||
print-slow.c
|
||||
print-smb.c
|
||||
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 +212,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 +245,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
|
||||
|
42
dist/tcpdump/Makefile.in
vendored
42
dist/tcpdump/Makefile.in
vendored
@ -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.2.6 2007/07/24 02:39:55 mcr 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 af.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-chdlc.c print-cip.c print-cnfp.c print-dccp.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-nfs.c print-ntp.c print-null.c print-olsr.c print-ospf.c \
|
||||
print-pflog.c print-pgm.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-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-rsvp.c print-rx.c print-sctp.c print-sip.c print-sl.c print-sll.c \
|
||||
print-slow.c 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 \
|
||||
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 dccp.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 \
|
||||
@ -180,19 +183,10 @@ distclean:
|
||||
tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
||||
tar:
|
||||
releasetar:
|
||||
@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
|
||||
list="" ; tar="tar chf" ; \
|
||||
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
|
||||
echo \
|
||||
"rm -f ../$$name; ln -s $$dir ../$$name" ; \
|
||||
rm -f ../$$name; ln -s $$dir ../$$name ; \
|
||||
echo \
|
||||
"(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
|
||||
(cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
|
||||
echo \
|
||||
"rm -f ../$$name" ; \
|
||||
rm -f ../$$name
|
||||
list="" ; make distclean; cd ..; mkdir -p n; cd n; ln -s ../$$dir $$name; \
|
||||
tar -c -z -f $$name.tar.gz $$name/. ;
|
||||
|
||||
depend: $(GENSRC)
|
||||
${srcdir}/mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
|
||||
|
8
dist/tcpdump/README
vendored
8
dist/tcpdump/README
vendored
@ -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.
|
||||
|
||||
|
24
dist/tcpdump/Readme.Win32
vendored
Normal file
24
dist/tcpdump/Readme.Win32
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
To build tcpdump under Windows, you need:
|
||||
|
||||
- version 6 (or higher) of Microsoft Visual Studio or the Cygnus gnu
|
||||
C compiler.
|
||||
- The November 2001 (or later) edition of Microsoft Platform
|
||||
Software Development Kit (SDK), that contains some necessary includes
|
||||
for IPv6 support. You can download it from http://www.microsoft.com/sdk
|
||||
- the WinPcap source code, that includes libpcap for win32. Download it
|
||||
from http://winpcap.polito.it or download libpcap sources from
|
||||
http://www.tcpdump.org and follow the instructions in the README.Win32
|
||||
file.
|
||||
|
||||
First, extract tcpdump and WinPcap in the same folder, and build WinPcap.
|
||||
|
||||
The Visual Studio project and the cygwin makefile are in the Win32\prj
|
||||
folder.
|
||||
|
||||
From Visual Studio, open windump.dsw and build the program. The release
|
||||
version of the WinDump.exe executable file will be created in the
|
||||
windump\win32\prj\release directory . The debug version will be generated
|
||||
in windump\win32\prj\debug.
|
||||
|
||||
From cygnus, go to windump\win32\prj\ and type "make". WinDump.exe will be
|
||||
created in the same directory.
|
2
dist/tcpdump/VERSION
vendored
2
dist/tcpdump/VERSION
vendored
@ -1 +1 @@
|
||||
3.8.3
|
||||
3.9.7
|
||||
|
28
dist/tcpdump/acconfig.h
vendored
28
dist/tcpdump/acconfig.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: acconfig.h,v 1.1.1.4 2004/09/27 17:06:29 dyoung Exp $ */
|
||||
/* $NetBSD: acconfig.h,v 1.1.1.5 2007/07/24 11:42:59 drochner Exp $ */
|
||||
|
||||
/* "generated automatically" means DO NOT MAKE CHANGES TO config.h.in --
|
||||
* make them to acconfig.h and rerun autoheader */
|
||||
@ -22,7 +22,6 @@
|
||||
/* define if your struct __res_state has the nsort member */
|
||||
#undef HAVE_NEW_RES_STATE
|
||||
|
||||
|
||||
/*
|
||||
* define if struct ether_header.ether_dhost is a struct with ether_addr_octet
|
||||
*/
|
||||
@ -88,6 +87,12 @@
|
||||
/* define if libpcap has pcap_datalink_val_to_description() */
|
||||
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
|
||||
/* define if libpcap has pcap_dump_ftell() */
|
||||
#undef HAVE_PCAP_DUMP_FTELL
|
||||
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
@ -103,14 +108,11 @@
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
/* Workaround for missing sized types */
|
||||
/* XXX this should move to the more standard uint*_t */
|
||||
#undef int8_t
|
||||
#undef int16_t
|
||||
#undef int32_t
|
||||
#undef u_int16_t
|
||||
#undef u_int32_t
|
||||
#undef u_int8_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
|
||||
@ -128,3 +130,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
|
||||
|
124
dist/tcpdump/aclocal.m4
vendored
124
dist/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.2.7 2005/11/08 03:00:52 guy Exp (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1995, 1996, 1997, 1998
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -157,6 +157,7 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# Try compiling a sample of the type of code that appears in
|
||||
# gencode.c with "inline", "__inline__", and "__inline".
|
||||
@ -323,11 +324,13 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
dnl
|
||||
dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
|
||||
dnl and "pcap_datalink_name_to_val()", and use substitute versions
|
||||
dnl if they're not present
|
||||
dnl if they're not present.
|
||||
dnl
|
||||
AC_CHECK_FUNC(pcap_list_datalinks,
|
||||
AC_DEFINE(HAVE_PCAP_LIST_DATALINKS),
|
||||
AC_LIBOBJ(datalinks))
|
||||
[
|
||||
AC_LIBOBJ(datalinks)
|
||||
])
|
||||
AC_CHECK_FUNC(pcap_set_datalink,
|
||||
AC_DEFINE(HAVE_PCAP_SET_DATALINK))
|
||||
AC_CHECK_FUNC(pcap_datalink_name_to_val,
|
||||
@ -335,9 +338,13 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL)
|
||||
AC_CHECK_FUNC(pcap_datalink_val_to_description,
|
||||
AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION),
|
||||
AC_LIBOBJ(dlnames))
|
||||
[
|
||||
AC_LIBOBJ(dlnames)
|
||||
])
|
||||
],
|
||||
AC_LIBOBJ(dlnames))
|
||||
[
|
||||
AC_LIBOBJ(dlnames)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for "pcap_breakloop()"; you can't substitute for it if
|
||||
@ -345,6 +352,15 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
dnl so just define the HAVE_ value if it's there.
|
||||
dnl
|
||||
AC_CHECK_FUNCS(pcap_breakloop)
|
||||
|
||||
dnl
|
||||
dnl Check for "pcap_dump_ftell()" and use a substitute version
|
||||
dnl if it's not present.
|
||||
AC_CHECK_FUNC(pcap_dump_ftell,
|
||||
AC_DEFINE(HAVE_PCAP_DUMP_FTELL),
|
||||
[
|
||||
AC_LIBOBJ(pcap_dump_ftell)
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
@ -557,34 +573,48 @@ AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
|
||||
dnl Check whether a given format can be used to print 64-bit integers
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_CHECK_TYPE
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl int32_t (defined)
|
||||
dnl u_int32_t (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_CHECK_TYPE,
|
||||
[AC_MSG_CHECKING(for $1 using $CC)
|
||||
AC_CACHE_VAL(ac_cv_lbl_have_$1,
|
||||
AC_TRY_COMPILE([
|
||||
# include "confdefs.h"
|
||||
# include <sys/types.h>
|
||||
# if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
# endif],
|
||||
[$1 i],
|
||||
ac_cv_lbl_have_$1=yes,
|
||||
ac_cv_lbl_have_$1=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_$1)
|
||||
if test $ac_cv_lbl_have_$1 = no ; then
|
||||
AC_DEFINE($1, $2)
|
||||
fi])
|
||||
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
|
||||
# ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.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
|
||||
@ -716,7 +746,7 @@ AC_DEFUN(AC_LBL_DEVEL,
|
||||
fi
|
||||
$1="$$1 -Wall"
|
||||
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
|
||||
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -W"
|
||||
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wpointer-arith -W"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@ -980,6 +1010,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
|
||||
@ -1182,10 +1226,10 @@ dnl
|
||||
AC_DEFUN(AC_C___ATTRIBUTE__, [
|
||||
AC_MSG_CHECKING(for __attribute__)
|
||||
AC_CACHE_VAL(ac_cv___attribute__, [
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE(
|
||||
AC_LANG_SOURCE([[
|
||||
#include <stdlib.h>
|
||||
],
|
||||
[
|
||||
|
||||
static void foo(void) __attribute__ ((noreturn));
|
||||
|
||||
static void
|
||||
@ -1193,7 +1237,13 @@ foo(void)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
],
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
foo();
|
||||
}
|
||||
]]),
|
||||
ac_cv___attribute__=yes,
|
||||
ac_cv___attribute__=no)])
|
||||
if test "$ac_cv___attribute__" = "yes"; then
|
||||
|
65
dist/tcpdump/af.c
vendored
Normal file
65
dist/tcpdump/af.c
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
/* $NetBSD: af.c,v 1.1.1.1 2007/07/24 11:43:01 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2006 The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/af.c,v 1.3.2.1 2007/02/26 13:33:17 hannes Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include "interface.h"
|
||||
#include "af.h"
|
||||
|
||||
struct tok af_values[] = {
|
||||
{ 0, "Reserved"},
|
||||
{ AFNUM_INET, "IPv4"},
|
||||
{ AFNUM_INET6, "IPv6"},
|
||||
{ AFNUM_NSAP, "NSAP"},
|
||||
{ AFNUM_HDLC, "HDLC"},
|
||||
{ AFNUM_BBN1822, "BBN 1822"},
|
||||
{ AFNUM_802, "802"},
|
||||
{ AFNUM_E163, "E.163"},
|
||||
{ AFNUM_E164, "E.164"},
|
||||
{ AFNUM_F69, "F.69"},
|
||||
{ AFNUM_X121, "X.121"},
|
||||
{ AFNUM_IPX, "Novell IPX"},
|
||||
{ AFNUM_ATALK, "Appletalk"},
|
||||
{ AFNUM_DECNET, "Decnet IV"},
|
||||
{ AFNUM_BANYAN, "Banyan Vines"},
|
||||
{ AFNUM_E164NSAP, "E.164 with NSAP subaddress"},
|
||||
{ AFNUM_L2VPN, "Layer-2 VPN"},
|
||||
{ AFNUM_VPLS, "VPLS"},
|
||||
{ 0, NULL},
|
||||
};
|
||||
|
||||
struct tok bsd_af_values[] = {
|
||||
{ BSD_AFNUM_INET, "IPv4" },
|
||||
{ BSD_AFNUM_NS, "NS" },
|
||||
{ BSD_AFNUM_ISO, "ISO" },
|
||||
{ BSD_AFNUM_APPLETALK, "Appletalk" },
|
||||
{ BSD_AFNUM_IPX, "IPX" },
|
||||
{ BSD_AFNUM_INET6_BSD, "IPv6" },
|
||||
{ BSD_AFNUM_INET6_FREEBSD, "IPv6" },
|
||||
{ BSD_AFNUM_INET6_DARWIN, "IPv6" },
|
||||
{ 0, NULL}
|
||||
};
|
59
dist/tcpdump/af.h
vendored
Normal file
59
dist/tcpdump/af.h
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
/* $NetBSD: af.h,v 1.1.1.1 2007/07/24 11:42:54 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/af.h,v 1.3.2.1 2007/02/26 13:33:17 hannes Exp (LBL) */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2006 The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
extern struct tok af_values[];
|
||||
extern struct tok bsd_af_values[];
|
||||
|
||||
/* RFC1700 address family numbers */
|
||||
#define AFNUM_INET 1
|
||||
#define AFNUM_INET6 2
|
||||
#define AFNUM_NSAP 3
|
||||
#define AFNUM_HDLC 4
|
||||
#define AFNUM_BBN1822 5
|
||||
#define AFNUM_802 6
|
||||
#define AFNUM_E163 7
|
||||
#define AFNUM_E164 8
|
||||
#define AFNUM_F69 9
|
||||
#define AFNUM_X121 10
|
||||
#define AFNUM_IPX 11
|
||||
#define AFNUM_ATALK 12
|
||||
#define AFNUM_DECNET 13
|
||||
#define AFNUM_BANYAN 14
|
||||
#define AFNUM_E164NSAP 15
|
||||
#define AFNUM_VPLS 25
|
||||
/* draft-kompella-ppvpn-l2vpn */
|
||||
#define AFNUM_L2VPN 196 /* still to be approved by IANA */
|
||||
|
||||
/*
|
||||
* BSD AF_ values.
|
||||
*
|
||||
* Unfortunately, the BSDs don't all use the same value for AF_INET6,
|
||||
* so, because we want to be able to read captures from all of the BSDs,
|
||||
* we check for all of them.
|
||||
*/
|
||||
#define BSD_AFNUM_INET 2
|
||||
#define BSD_AFNUM_NS 6 /* XEROX NS protocols */
|
||||
#define BSD_AFNUM_ISO 7
|
||||
#define BSD_AFNUM_APPLETALK 16
|
||||
#define BSD_AFNUM_IPX 23
|
||||
#define BSD_AFNUM_INET6_BSD 24 /* OpenBSD (and probably NetBSD), BSD/OS */
|
||||
#define BSD_AFNUM_INET6_FREEBSD 28
|
||||
#define BSD_AFNUM_INET6_DARWIN 30
|
5
dist/tcpdump/appletalk.h
vendored
5
dist/tcpdump/appletalk.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: appletalk.h,v 1.1.1.2 2004/09/27 17:06:30 dyoung Exp $ */
|
||||
/* $NetBSD: appletalk.h,v 1.1.1.3 2007/07/24 11:43:00 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993, 1994, 1995, 1996
|
||||
@ -22,7 +22,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 {
|
||||
@ -69,6 +69,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 */
|
||||
|
||||
|
||||
|
11
dist/tcpdump/atm.h
vendored
11
dist/tcpdump/atm.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: atm.h,v 1.1.1.1 2004/09/27 17:06:30 dyoung Exp $ */
|
||||
/* $NetBSD: atm.h,v 1.1.1.2 2007/07/24 11:42:59 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Guy Harris.
|
||||
@ -16,7 +16,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) Header: /tcpdump/master/tcpdump/atm.h,v 1.1 2002/07/11 09:17:22 guy Exp
|
||||
* @(#) Header: /tcpdump/master/tcpdump/atm.h,v 1.1.4.1 2005/06/20 07:45:05 hannes Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -25,3 +25,10 @@
|
||||
#define ATM_UNKNOWN 0 /* Unknown */
|
||||
#define ATM_LANE 1 /* LANE */
|
||||
#define ATM_LLC 2 /* LLC encapsulation */
|
||||
|
||||
/*
|
||||
* some OAM cell captures (most notably Juniper's)
|
||||
* do not deliver a heading HEC byte
|
||||
*/
|
||||
#define ATM_OAM_NOHEC 0
|
||||
#define ATM_OAM_HEC 1
|
||||
|
19
dist/tcpdump/bgp.h
vendored
Normal file
19
dist/tcpdump/bgp.h
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/* $NetBSD: bgp.h,v 1.1.1.1 2007/07/24 11:43:16 drochner Exp $ */
|
||||
|
||||
/* @(#) 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 *);
|
11
dist/tcpdump/bootp.h
vendored
11
dist/tcpdump/bootp.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: bootp.h,v 1.1.1.2 2004/09/27 17:06:30 dyoung Exp $ */
|
||||
/* $NetBSD: bootp.h,v 1.1.1.3 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/bootp.h,v 1.15 2003/07/01 19:16:06 guy Exp (LBL) */
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/bootp.h,v 1.15.4.1 2007/01/29 20:56:00 guy Exp (LBL) */
|
||||
/*
|
||||
* Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
|
||||
*
|
||||
@ -220,3 +220,10 @@ struct cmu_vend {
|
||||
|
||||
/* v_flags values */
|
||||
#define VF_SMASK 1 /* Subnet mask field contains valid data */
|
||||
|
||||
/* RFC 4702 DHCP Client FQDN Option */
|
||||
|
||||
#define CLIENT_FQDN_FLAGS_S 0x01
|
||||
#define CLIENT_FQDN_FLAGS_O 0x02
|
||||
#define CLIENT_FQDN_FLAGS_E 0x04
|
||||
#define CLIENT_FQDN_FLAGS_N 0x08
|
||||
|
72
dist/tcpdump/config.h.in
vendored
72
dist/tcpdump/config.h.in
vendored
@ -20,7 +20,6 @@
|
||||
/* define if your struct __res_state has the nsort member */
|
||||
#undef HAVE_NEW_RES_STATE
|
||||
|
||||
|
||||
/*
|
||||
* define if struct ether_header.ether_dhost is a struct with ether_addr_octet
|
||||
*/
|
||||
@ -86,6 +85,12 @@
|
||||
/* define if libpcap has pcap_datalink_val_to_description() */
|
||||
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
|
||||
/* define if libpcap has pcap_dump_ftell() */
|
||||
#undef HAVE_PCAP_DUMP_FTELL
|
||||
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
@ -101,14 +106,11 @@
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
/* Workaround for missing sized types */
|
||||
/* XXX this should move to the more standard uint*_t */
|
||||
#undef int8_t
|
||||
#undef int16_t
|
||||
#undef int32_t
|
||||
#undef u_int16_t
|
||||
#undef u_int32_t
|
||||
#undef u_int8_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 +129,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
|
||||
|
||||
@ -235,6 +250,12 @@
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define to 1 if the system has the type `struct ether_addr'. */
|
||||
#undef HAVE_STRUCT_ETHER_ADDR
|
||||
|
||||
/* Define to 1 if you have the <sys/bitypes.h> header file. */
|
||||
#undef HAVE_SYS_BITYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
@ -253,6 +274,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 +307,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
|
||||
|
||||
@ -291,3 +321,27 @@
|
||||
|
||||
/* Define as token for inline if inlining supported */
|
||||
#undef inline
|
||||
|
||||
/* Define to `short' if int16_t not defined. */
|
||||
#undef int16_t
|
||||
|
||||
/* Define to `int' if int32_t not defined. */
|
||||
#undef int32_t
|
||||
|
||||
/* Define to `long long' if int64_t not defined. */
|
||||
#undef int64_t
|
||||
|
||||
/* Define to `signed char' if int8_t not defined. */
|
||||
#undef int8_t
|
||||
|
||||
/* Define to `unsigned short' if u_int16_t not defined. */
|
||||
#undef u_int16_t
|
||||
|
||||
/* Define to `unsigned int' if u_int32_t not defined. */
|
||||
#undef u_int32_t
|
||||
|
||||
/* Define to `unsigned long long' if u_int64_t not defined. */
|
||||
#undef u_int64_t
|
||||
|
||||
/* Define to `unsigned char' if u_int8_t not defined. */
|
||||
#undef u_int8_t
|
||||
|
2
dist/tcpdump/cpack.c
vendored
2
dist/tcpdump/cpack.c
vendored
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: cpack.c,v 1.1.1.1 2007/07/24 11:43:13 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 David Young. All rights reserved.
|
||||
*
|
||||
|
2
dist/tcpdump/cpack.h
vendored
2
dist/tcpdump/cpack.h
vendored
@ -1,3 +1,5 @@
|
||||
/* $NetBSD: cpack.h,v 1.1.1.1 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003, 2004 David Young. All rights reserved.
|
||||
*
|
||||
|
141
dist/tcpdump/dccp.h
vendored
Normal file
141
dist/tcpdump/dccp.h
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
/* $NetBSD: dccp.h,v 1.1.1.1 2007/07/24 11:43:03 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/dccp.h,v 1.1.2.4 2006/05/12 01:46:17 guy Exp (LBL) */
|
||||
/*
|
||||
* Copyright (C) Arnaldo Carvalho de Melo 2004
|
||||
* Copyright (C) Ian McDonald 2005 <iam4@cs.waikato.ac.nz>
|
||||
* Copyright (C) Yoshifumi Nishida 2005
|
||||
*
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style license that accompanies tcpdump or the GNU GPL version 2
|
||||
*/
|
||||
|
||||
#ifndef __DCCP_HDR__
|
||||
#define __DCCP_HDR__
|
||||
|
||||
/**
|
||||
* struct dccp_hdr - generic part of DCCP packet header
|
||||
*
|
||||
* @dccph_sport - Relevant port on the endpoint that sent this packet
|
||||
* @dccph_dport - Relevant port on the other endpoint
|
||||
* @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
|
||||
* @dccph_ccval - Used by the HC-Sender CCID
|
||||
* @dccph_cscov - Parts of the packet that are covered by the Checksum field
|
||||
* @dccph_checksum - Internet checksum, depends on dccph_cscov
|
||||
* @dccph_x - 0 = 24 bit sequence number, 1 = 48
|
||||
* @dccph_type - packet type, see DCCP_PKT_ prefixed macros
|
||||
* @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
|
||||
*/
|
||||
struct dccp_hdr {
|
||||
u_int16_t dccph_sport,
|
||||
dccph_dport;
|
||||
u_int8_t dccph_doff;
|
||||
u_int8_t dccph_ccval_cscov;
|
||||
u_int16_t dccph_checksum;
|
||||
union {
|
||||
u_int8_t dccph_xtr;
|
||||
u_int32_t dccph_seq;
|
||||
} dccph_xtrs;
|
||||
};
|
||||
|
||||
#define DCCPH_CCVAL(dh) (((dh)->dccph_ccval_cscov) & 0x0F)
|
||||
#define DCCPH_CSCOV(dh) (((dh)->dccph_ccval_cscov >> 4) & 0x0F)
|
||||
|
||||
#define DCCPH_X(dh) ((dh)->dccph_xtrs.dccph_xtr & 1)
|
||||
#define DCCPH_TYPE(dh) (((dh)->dccph_xtrs.dccph_xtr >> 1) & 0xF)
|
||||
#define DCCPH_SEQ(dh) (((dh)->dccph_xtrs.dccph_seq) >> 8)
|
||||
|
||||
/**
|
||||
* struct dccp_hdr_ext - the low bits of a 48 bit seq packet
|
||||
*
|
||||
* @dccph_seq_low - low 24 bits of a 48 bit seq packet
|
||||
*/
|
||||
struct dccp_hdr_ext {
|
||||
u_int32_t dccph_seq_low;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dccp_hdr_request - Conection initiation request header
|
||||
*
|
||||
* @dccph_req_service - Service to which the client app wants to connect
|
||||
*/
|
||||
struct dccp_hdr_request {
|
||||
u_int32_t dccph_req_service;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
|
||||
*
|
||||
* @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
|
||||
* @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
|
||||
*/
|
||||
struct dccp_hdr_ack_bits {
|
||||
u_int32_t dccph_ra;
|
||||
u_int32_t dccph_ack_nr_low;
|
||||
};
|
||||
|
||||
#define DCCPH_ACK(dh_ack) ((dh_ack)->dccph_ra >> 8)
|
||||
|
||||
/**
|
||||
* struct dccp_hdr_response - Conection initiation response header
|
||||
*
|
||||
* @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
|
||||
* @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
|
||||
* @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
|
||||
*/
|
||||
struct dccp_hdr_response {
|
||||
struct dccp_hdr_ack_bits dccph_resp_ack;
|
||||
u_int32_t dccph_resp_service;
|
||||
};
|
||||
|
||||
#if 0
|
||||
static inline struct dccp_hdr_data *dccp_hdr_data(struct dccp_hdr *hdrg)
|
||||
{
|
||||
const int ext = DCCPH_X(hdrg) ? sizeof(struct dccp_hdr_ext) : 0;
|
||||
|
||||
return (struct dccp_hdr_data *)(((u_char *)hdrg) + sizeof(hdrg) + ext);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct dccp_hdr_reset - Unconditionally shut down a connection
|
||||
*
|
||||
* @dccph_reset_service - Echoes the Service Code on a received DCCP-Request
|
||||
*/
|
||||
struct dccp_hdr_reset {
|
||||
struct dccp_hdr_ack_bits dccph_reset_ack;
|
||||
u_int8_t dccph_reset_code,
|
||||
dccph_reset_data[3];
|
||||
};
|
||||
|
||||
enum dccp_pkt_type {
|
||||
DCCP_PKT_REQUEST = 0,
|
||||
DCCP_PKT_RESPONSE,
|
||||
DCCP_PKT_DATA,
|
||||
DCCP_PKT_ACK,
|
||||
DCCP_PKT_DATAACK,
|
||||
DCCP_PKT_CLOSEREQ,
|
||||
DCCP_PKT_CLOSE,
|
||||
DCCP_PKT_RESET,
|
||||
DCCP_PKT_SYNC,
|
||||
DCCP_PKT_SYNCACK,
|
||||
DCCP_PKT_INVALID
|
||||
};
|
||||
|
||||
enum dccp_reset_codes {
|
||||
DCCP_RESET_CODE_UNSPECIFIED = 0,
|
||||
DCCP_RESET_CODE_CLOSED,
|
||||
DCCP_RESET_CODE_ABORTED,
|
||||
DCCP_RESET_CODE_NO_CONNECTION,
|
||||
DCCP_RESET_CODE_PACKET_ERROR,
|
||||
DCCP_RESET_CODE_OPTION_ERROR,
|
||||
DCCP_RESET_CODE_MANDATORY_ERROR,
|
||||
DCCP_RESET_CODE_CONNECTION_REFUSED,
|
||||
DCCP_RESET_CODE_BAD_SERVICE_CODE,
|
||||
DCCP_RESET_CODE_TOO_BUSY,
|
||||
DCCP_RESET_CODE_BAD_INIT_COOKIE,
|
||||
DCCP_RESET_CODE_AGGRESSION_PENALTY,
|
||||
__DCCP_RESET_CODE_LAST
|
||||
};
|
||||
|
||||
#endif /* __DCCP_HDR__ */
|
43
dist/tcpdump/decode_prefix.h
vendored
Normal file
43
dist/tcpdump/decode_prefix.h
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
/* $NetBSD: decode_prefix.h,v 1.1.1.1 2007/07/24 11:43:20 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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
|
20
dist/tcpdump/ethertype.h
vendored
20
dist/tcpdump/ethertype.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ethertype.h,v 1.1.1.2 2004/09/27 17:06:44 dyoung Exp $ */
|
||||
/* $NetBSD: ethertype.h,v 1.1.1.3 2007/07/24 11:43:05 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1996
|
||||
@ -20,7 +20,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.2.1 2005/07/10 14:51:10 hannes Exp (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -35,6 +35,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
|
||||
@ -104,6 +111,9 @@
|
||||
#ifndef ETHERTYPE_PPP
|
||||
#define ETHERTYPE_PPP 0x880b
|
||||
#endif
|
||||
#ifndef ETHERTYPE_SLOW
|
||||
#define ETHERTYPE_SLOW 0x8809
|
||||
#endif
|
||||
#ifndef ETHERTYPE_MPLS
|
||||
#define ETHERTYPE_MPLS 0x8847
|
||||
#endif
|
||||
@ -116,6 +126,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
|
||||
|
59
dist/tcpdump/gmpls.c
vendored
59
dist/tcpdump/gmpls.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gmpls.c,v 1.1.1.1 2004/09/27 17:06:46 dyoung Exp $ */
|
||||
/* $NetBSD: gmpls.c,v 1.1.1.2 2007/07/24 11:43:00 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -17,7 +17,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.2.1 2005/05/19 06:44:02 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -134,3 +134,58 @@ struct tok gmpls_payload_values[] = {
|
||||
{ 58, "Fiber Channel"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Link Type values used by LMP Service Discovery (specifically, the Client
|
||||
* Port Service Attributes Object). See UNI 1.0 section 9.4.2 for details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
|
||||
{ 5, "SDH ITU-T G.707"},
|
||||
{ 6, "SONET ANSI T1.105"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Signal Type values for SDH links used by LMP Service Discovery (specifically,
|
||||
* the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
|
||||
* details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
|
||||
{ 5, "VC-3"},
|
||||
{ 6, "VC-4"},
|
||||
{ 7, "STM-0"},
|
||||
{ 8, "STM-1"},
|
||||
{ 9, "STM-4"},
|
||||
{ 10, "STM-16"},
|
||||
{ 11, "STM-64"},
|
||||
{ 12, "STM-256"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Signal Type values for SONET links used by LMP Service Discovery (specifically,
|
||||
* the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
|
||||
* details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
|
||||
{ 5, "STS-1 SPE"},
|
||||
{ 6, "STS-3c SPE"},
|
||||
{ 7, "STS-1"},
|
||||
{ 8, "STM-3"},
|
||||
{ 9, "STM-12"},
|
||||
{ 10, "STM-48"},
|
||||
{ 11, "STM-192"},
|
||||
{ 12, "STM-768"},
|
||||
{ 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 }
|
||||
};
|
||||
|
8
dist/tcpdump/gmpls.h
vendored
8
dist/tcpdump/gmpls.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: gmpls.h,v 1.1.1.1 2004/09/27 17:06:46 dyoung Exp $ */
|
||||
/* $NetBSD: gmpls.h,v 1.1.1.2 2007/07/24 11:43:14 drochner Exp $ */
|
||||
|
||||
/* @(#) 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.2.1 2005/05/19 06:44:03 guy Exp (LBL) */
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
@ -20,3 +20,7 @@ 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[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_link_type_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[];
|
||||
|
58
dist/tcpdump/ieee802_11.h
vendored
58
dist/tcpdump/ieee802_11.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: ieee802_11.h,v 1.1.1.2 2004/09/27 17:06:46 dyoung Exp $ */
|
||||
/* $NetBSD: ieee802_11.h,v 1.1.1.3 2007/07/24 11:42:52 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.9 2003/07/22 17:36:57 guy Exp (LBL) */
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.9.4.3 2007/07/22 20:01:16 guy Exp (LBL) */
|
||||
/*
|
||||
* Copyright (c) 2001
|
||||
* Fortress Technologies
|
||||
@ -81,14 +81,32 @@
|
||||
#define CTRL_CF_END 0xE
|
||||
#define CTRL_END_ACK 0xF
|
||||
|
||||
#define DATA_DATA 0x0
|
||||
#define DATA_DATA_CF_ACK 0x1
|
||||
#define DATA_DATA_CF_POLL 0x2
|
||||
#define DATA_DATA_CF_ACK_POLL 0x3
|
||||
#define DATA_NODATA 0x4
|
||||
#define DATA_NODATA_CF_ACK 0x5
|
||||
#define DATA_NODATA_CF_POLL 0x6
|
||||
#define DATA_NODATA_CF_ACK_POLL 0x7
|
||||
#define DATA_DATA 0x0
|
||||
#define DATA_DATA_CF_ACK 0x1
|
||||
#define DATA_DATA_CF_POLL 0x2
|
||||
#define DATA_DATA_CF_ACK_POLL 0x3
|
||||
#define DATA_NODATA 0x4
|
||||
#define DATA_NODATA_CF_ACK 0x5
|
||||
#define DATA_NODATA_CF_POLL 0x6
|
||||
#define DATA_NODATA_CF_ACK_POLL 0x7
|
||||
|
||||
#define DATA_QOS_DATA 0x8
|
||||
#define DATA_QOS_DATA_CF_ACK 0x9
|
||||
#define DATA_QOS_DATA_CF_POLL 0xA
|
||||
#define DATA_QOS_DATA_CF_ACK_POLL 0xB
|
||||
#define DATA_QOS_NODATA 0xC
|
||||
#define DATA_QOS_CF_POLL_NODATA 0xE
|
||||
#define DATA_QOS_CF_ACK_POLL_NODATA 0xF
|
||||
|
||||
/*
|
||||
* The subtype field of a data frame is, in effect, composed of 4 flag
|
||||
* bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
|
||||
* any data), and QoS.
|
||||
*/
|
||||
#define DATA_FRAME_IS_CF_ACK(x) ((x) & 0x01)
|
||||
#define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
|
||||
#define DATA_FRAME_IS_NULL(x) ((x) & 0x04)
|
||||
#define DATA_FRAME_IS_QOS(x) ((x) & 0x08)
|
||||
|
||||
/*
|
||||
* Bits in the frame control field.
|
||||
@ -124,6 +142,12 @@ struct mgmt_header_t {
|
||||
#define CAPABILITY_CFP_REQ(cap) ((cap) & 0x0008)
|
||||
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
|
||||
|
||||
typedef enum {
|
||||
NOT_PRESENT,
|
||||
PRESENT,
|
||||
TRUNCATED
|
||||
} elem_status_t;
|
||||
|
||||
struct ssid_t {
|
||||
u_int8_t element_id;
|
||||
u_int8_t length;
|
||||
@ -133,7 +157,7 @@ struct ssid_t {
|
||||
struct rates_t {
|
||||
u_int8_t element_id;
|
||||
u_int8_t length;
|
||||
u_int8_t rate[8];
|
||||
u_int8_t rate[16];
|
||||
};
|
||||
|
||||
struct challenge_t {
|
||||
@ -141,6 +165,7 @@ struct challenge_t {
|
||||
u_int8_t length;
|
||||
u_int8_t text[254]; /* 1-253 + 1 for null */
|
||||
};
|
||||
|
||||
struct fh_t {
|
||||
u_int8_t element_id;
|
||||
u_int8_t length;
|
||||
@ -201,22 +226,29 @@ struct tim_t {
|
||||
|
||||
|
||||
struct mgmt_body_t {
|
||||
u_int8_t timestamp[8];
|
||||
u_int8_t timestamp[IEEE802_11_TSTAMP_LEN];
|
||||
u_int16_t beacon_interval;
|
||||
u_int16_t listen_interval;
|
||||
u_int16_t status_code;
|
||||
u_int16_t aid;
|
||||
u_char ap[6];
|
||||
u_char ap[IEEE802_11_AP_LEN];
|
||||
u_int16_t reason_code;
|
||||
u_int16_t auth_alg;
|
||||
u_int16_t auth_trans_seq_num;
|
||||
elem_status_t challenge_status;
|
||||
struct challenge_t challenge;
|
||||
u_int16_t capability_info;
|
||||
elem_status_t ssid_status;
|
||||
struct ssid_t ssid;
|
||||
elem_status_t rates_status;
|
||||
struct rates_t rates;
|
||||
elem_status_t ds_status;
|
||||
struct ds_t ds;
|
||||
elem_status_t cf_status;
|
||||
struct cf_t cf;
|
||||
elem_status_t fh_status;
|
||||
struct fh_t fh;
|
||||
elem_status_t tim_status;
|
||||
struct tim_t tim;
|
||||
};
|
||||
|
||||
|
62
dist/tcpdump/ipproto.c
vendored
Normal file
62
dist/tcpdump/ipproto.c
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/* $NetBSD: ipproto.c,v 1.1.1.1 2007/07/24 11:43:13 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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.2.3 2005/09/20 06:05:37 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "ipproto.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_DCCP, "DCCP" },
|
||||
{ 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_PGM, "PGM" },
|
||||
{ IPPROTO_SCTP, "SCTP" },
|
||||
{ IPPROTO_MOBILITY, "Mobility" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
20
dist/tcpdump/ipproto.h
vendored
20
dist/tcpdump/ipproto.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ipproto.h,v 1.1.1.1 2004/09/27 17:06:28 dyoung Exp $ */
|
||||
/* $NetBSD: ipproto.h,v 1.1.1.2 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
@ -32,13 +32,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.2.2 2005/09/20 06:05:37 guy Exp (LBL)
|
||||
*
|
||||
* From:
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
* $FreeBSD: src/sys/netinet/in.h,v 1.38.2.3 1999/08/29 16:29:34 peter Exp $
|
||||
*/
|
||||
|
||||
extern struct tok ipproto_values[];
|
||||
|
||||
#ifndef IPPROTO_IP
|
||||
#define IPPROTO_IP 0 /* dummy for IP */
|
||||
#endif
|
||||
@ -60,12 +62,15 @@
|
||||
#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 */
|
||||
#endif
|
||||
#ifndef IPPROTO_DCCP
|
||||
#define IPPROTO_DCCP 33 /* datagram congestion control protocol */
|
||||
#endif
|
||||
#ifndef IPPROTO_IPV6
|
||||
#define IPPROTO_IPV6 41
|
||||
#endif
|
||||
@ -115,8 +120,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
|
||||
@ -130,6 +135,9 @@
|
||||
#ifndef IPPROTO_VRRP
|
||||
#define IPPROTO_VRRP 112
|
||||
#endif
|
||||
#ifndef IPPROTO_PGM
|
||||
#define IPPROTO_PGM 113
|
||||
#endif
|
||||
#ifndef IPPROTO_SCTP
|
||||
#define IPPROTO_SCTP 132
|
||||
#endif
|
||||
|
60
dist/tcpdump/l2vpn.c
vendored
Normal file
60
dist/tcpdump/l2vpn.c
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
/* $NetBSD: l2vpn.c,v 1.1.1.1 2007/07/24 11:42:52 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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}
|
||||
};
|
19
dist/tcpdump/l2vpn.h
vendored
Normal file
19
dist/tcpdump/l2vpn.h
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/* $NetBSD: l2vpn.h,v 1.1.1.1 2007/07/24 11:42:58 drochner Exp $ */
|
||||
|
||||
/* @(#) 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[];
|
52
dist/tcpdump/llc.h
vendored
52
dist/tcpdump/llc.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: llc.h,v 1.1.1.3 2004/09/27 17:06:49 dyoung Exp $ */
|
||||
/* $NetBSD: llc.h,v 1.1.1.4 2007/07/24 11:42:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1997
|
||||
@ -20,46 +20,16 @@
|
||||
* 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.2.4 2007/02/08 07:07:51 guy Exp (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
* This stuff should come from a system header file, but there's no
|
||||
* obviously portable way to do that and it's not really going
|
||||
* to change from system to system.
|
||||
* Definitions for information in the LLC header.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A somewhat abstracted view of the LLC header
|
||||
*/
|
||||
|
||||
struct llc {
|
||||
u_int8_t dsap;
|
||||
u_int8_t ssap;
|
||||
union {
|
||||
u_int8_t u_ctl;
|
||||
u_int16_t is_ctl;
|
||||
struct {
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_pi[5];
|
||||
} snap;
|
||||
struct {
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_orgcode[3];
|
||||
u_int8_t snap_ethertype[2];
|
||||
} snap_ether;
|
||||
} ctl;
|
||||
};
|
||||
|
||||
#define llcui ctl.snap.snap_ui
|
||||
#define llcpi ctl.snap.snap_pi
|
||||
#define llc_orgcode ctl.snap_ether.snap_orgcode
|
||||
#define llc_ethertype ctl.snap_ether.snap_ethertype
|
||||
#define llcis ctl.is_ctl
|
||||
#define llcu ctl.u_ctl
|
||||
|
||||
#define LLC_U_FMT 3
|
||||
#define LLC_GSAP 1
|
||||
#define LLC_IG 1 /* Individual / Group */
|
||||
#define LLC_S_FMT 1
|
||||
|
||||
#define LLC_U_POLL 0x10
|
||||
@ -76,7 +46,7 @@ struct llc {
|
||||
#define LLC_XID 0xaf
|
||||
#define LLC_FRMR 0x87
|
||||
|
||||
#define LLC_S_CMD(is) (((is) >> 1) & 0x03)
|
||||
#define LLC_S_CMD(is) (((is) >> 2) & 0x03)
|
||||
#define LLC_RR 0x0001
|
||||
#define LLC_RNR 0x0005
|
||||
#define LLC_REJ 0x0009
|
||||
@ -96,6 +66,9 @@ struct llc {
|
||||
#ifndef LLCSAP_8021B_G
|
||||
#define LLCSAP_8021B_G 0x03
|
||||
#endif
|
||||
#ifndef LLCSAP_SNA
|
||||
#define LLCSAP_SNA 0x04
|
||||
#endif
|
||||
#ifndef LLCSAP_IP
|
||||
#define LLCSAP_IP 0x06
|
||||
#endif
|
||||
@ -127,16 +100,12 @@ 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.
|
||||
*/
|
||||
#define PID_CISCO_CDP 0x2000 /* Cisco Discovery Protocol */
|
||||
#define PID_CISCO_VTP 0x2003 /* Cisco VLAN Trunk Protocol */
|
||||
#define PID_CISCO_DTP 0x2004 /* Cisco Dynamic Trunk Protocol */
|
||||
|
||||
/*
|
||||
* PIDs for use with OUI_RFC2684.
|
||||
@ -152,4 +121,3 @@ struct llc {
|
||||
#define PID_RFC2684_802_6_FCS 0x0005 /* 802.6, with FCS */
|
||||
#define PID_RFC2684_802_6_NOFCS 0x000b /* 802.6, without FCS */
|
||||
#define PID_RFC2684_BPDU 0x000e /* BPDUs */
|
||||
|
||||
|
43
dist/tcpdump/mpls.h
vendored
Normal file
43
dist/tcpdump/mpls.h
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
/* $NetBSD: mpls.h,v 1.1.1.1 2007/07/24 11:43:10 drochner Exp $ */
|
||||
|
||||
/* @(#) 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)
|
438
dist/tcpdump/netdissect.h
vendored
Normal file
438
dist/tcpdump/netdissect.h
vendored
Normal file
@ -0,0 +1,438 @@
|
||||
/* $NetBSD: netdissect.h,v 1.1.1.1 2007/07/24 11:42:56 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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.2.4 2006/02/08 01:40:09 hannes 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;
|
||||
int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */
|
||||
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 *, int);
|
||||
|
||||
#if 0
|
||||
extern const char *isonsap_string(netdissect_options *, const 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(netdissect_options *,u_int);
|
||||
extern void hex_and_ascii_print_with_offset(netdissect_options *,const char *,
|
||||
u_int, u_int);
|
||||
extern void hex_and_ascii_print(netdissect_options *,const char *, u_int);
|
||||
extern void hex_print_with_offset(netdissect_options *,const char *,
|
||||
u_int, u_int);
|
||||
extern void hex_print(netdissect_options *,const char *, u_int);
|
||||
extern void telnet_print(netdissect_options *,const u_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 */
|
47
dist/tcpdump/nlpid.c
vendored
Normal file
47
dist/tcpdump/nlpid.c
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
/* $NetBSD: nlpid.c,v 1.1.1.1 2007/07/24 11:42:59 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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 }
|
||||
};
|
34
dist/tcpdump/nlpid.h
vendored
Normal file
34
dist/tcpdump/nlpid.h
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/* $NetBSD: nlpid.h,v 1.1.1.1 2007/07/24 11:42:51 drochner Exp $ */
|
||||
|
||||
/* @(#) 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
|
86
dist/tcpdump/ntp.h
vendored
86
dist/tcpdump/ntp.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: ntp.h,v 1.1.1.2 2004/09/27 17:06:51 dyoung Exp $ */
|
||||
/* $NetBSD: ntp.h,v 1.1.1.3 2007/07/24 11:43:20 drochner Exp $ */
|
||||
|
||||
/* 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
|
||||
@ -39,48 +39,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)
|
||||
|
37
dist/tcpdump/ospf.h
vendored
37
dist/tcpdump/ospf.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: ospf.h,v 1.1.1.2 2004/09/27 17:06:52 dyoung Exp $ */
|
||||
/* $NetBSD: ospf.h,v 1.1.1.3 2007/07/24 11:42:53 drochner Exp $ */
|
||||
|
||||
/* @(#) 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.2.2 2006/12/13 08:24:27 hannes Exp (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -45,10 +45,12 @@
|
||||
#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 */
|
||||
#define OSPF_AUTH_SIMPLE 1 /* Simple password */
|
||||
#define OSPF_AUTH_SIMPLE_LEN 8 /* max length of simple authentication */
|
||||
#define OSPF_AUTH_MD5 2 /* MD5 authentication */
|
||||
#define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
|
||||
|
||||
@ -65,13 +67,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 */
|
||||
@ -89,10 +92,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_BW_CONSTRAINTS 17 /* rfc4124 */
|
||||
|
||||
#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?
|
||||
@ -200,6 +215,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 */
|
||||
|
49
dist/tcpdump/oui.c
vendored
49
dist/tcpdump/oui.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: oui.c,v 1.1.1.1 2004/09/27 17:06:52 dyoung Exp $ */
|
||||
/* $NetBSD: oui.c,v 1.1.1.2 2007/07/24 11:42:51 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -17,7 +17,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.2.1 2005/04/17 01:20:56 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,18 +31,41 @@ 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_NORTEL, "Nortel Networks SONMP" },
|
||||
{ OUI_CISCO_90, "Cisco bridged" },
|
||||
{ OUI_RFC2684, "Ethernet bridged" },
|
||||
{ OUI_ATM_FORUM, "ATM Forum" },
|
||||
{ OUI_CABLE_BPDU, "DOCSIS Spanning Tree" },
|
||||
{ OUI_APPLETALK, "Appletalk" },
|
||||
{ OUI_JUNIPER, "Juniper" },
|
||||
{ OUI_HP, "Hewlett-Packard" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* list taken from ethereal/packet-radius.c */
|
||||
|
||||
/*
|
||||
* SMI Network Management Private Enterprise Codes for organizations.
|
||||
*
|
||||
* XXX - these also appear in FreeRadius dictionary files, with items such
|
||||
* as
|
||||
*
|
||||
* VENDOR Cisco 9
|
||||
*
|
||||
* List taken from Ethereal's epan/sminmpec.c.
|
||||
*/
|
||||
struct tok smi_values[] = {
|
||||
{ SMI_IETF, "IETF (reserved)"},
|
||||
{ SMI_ACC, "ACC"},
|
||||
{ SMI_CISCO, "Cisco"},
|
||||
{ SMI_HEWLETT_PACKARD, "Hewlett Packard"},
|
||||
{ SMI_SUN_MICROSYSTEMS, "Sun Microsystems"},
|
||||
{ SMI_MERIT, "Merit"},
|
||||
{ SMI_SHIVA, "Shiva"},
|
||||
{ SMI_MICROSOFT, "Microsoft"},
|
||||
{ SMI_ERICSSON, "Ericsson AB"},
|
||||
{ SMI_CISCO_VPN5000, "Cisco VPN 5000"},
|
||||
{ SMI_LIVINGSTON, "Livingston"},
|
||||
{ SMI_MICROSOFT, "Microsoft"},
|
||||
{ SMI_3COM, "3Com"},
|
||||
{ SMI_ASCEND, "Ascend"},
|
||||
{ SMI_BAY, "Bay Networks"},
|
||||
@ -51,14 +74,24 @@ struct tok smi_values[] = {
|
||||
{ SMI_REDBACK, "Redback"},
|
||||
{ SMI_JUNIPER, "Juniper Networks"},
|
||||
{ SMI_APTIS, "Aptis"},
|
||||
{ SMI_CISCO_VPN3000, "Cisco VPN 3000"},
|
||||
{ SMI_COSINE, "CoSine Communications"},
|
||||
{ SMI_NETSCREEN, "Netscreen"},
|
||||
{ SMI_SHASTA, "Shasta"},
|
||||
{ SMI_NOMADIX, "Nomadix"},
|
||||
{ SMI_SIEMENS, "Siemens"},
|
||||
{ SMI_CABLELABS, "CableLabs"},
|
||||
{ SMI_UNISPHERE, "Unisphere Networks"},
|
||||
{ SMI_CISCO_BBSM, "Cisco BBSM"},
|
||||
{ SMI_THE3GPP2, "3rd Generation Partnership Project 2 (3GPP2)"},
|
||||
{ SMI_IP_UNPLUGGED, "ipUnplugged"},
|
||||
{ SMI_ISSANNI, "Issanni Communications"},
|
||||
{ SMI_QUINTUM, "Quintum"},
|
||||
{ SMI_INTERLINK, "Interlink"},
|
||||
{ SMI_COLUBRIS, "Colubris"},
|
||||
{ SMI_COLUMBIA_UNIVERSITY, "Columbia University"},
|
||||
{ SMI_THE3GPP, "3GPP"},
|
||||
{ 0, NULL }
|
||||
{ SMI_GEMTEK_SYSTEMS, "Gemtek-Systems"},
|
||||
{ SMI_WIFI_ALLIANCE, "Wi-Fi Alliance"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
41
dist/tcpdump/oui.h
vendored
41
dist/tcpdump/oui.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: oui.h,v 1.1.1.1 2004/09/27 17:06:52 dyoung Exp $ */
|
||||
/* $NetBSD: oui.h,v 1.1.1.2 2007/07/24 11:43:00 drochner Exp $ */
|
||||
|
||||
/* @(#) 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.2.1 2005/04/17 01:20:56 guy Exp (LBL) */
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
@ -19,9 +19,36 @@
|
||||
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_NORTEL 0x000081 /* Nortel SONMP */
|
||||
#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
|
||||
#define OUI_RFC2684 0x0080c2 /* RFC 2427/2684 bridged Ethernet */
|
||||
#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */
|
||||
#define OUI_CABLE_BPDU 0x00E02F /* DOCSIS spanning tree BPDU */
|
||||
#define OUI_APPLETALK 0x080007 /* Appletalk */
|
||||
#define OUI_JUNIPER 0x009069 /* Juniper */
|
||||
#define OUI_HP 0x080009 /* Hewlett-Packard */
|
||||
|
||||
/*
|
||||
* These are SMI Network Management Private Enterprise Codes for
|
||||
* organizations; see
|
||||
*
|
||||
* http://www.iana.org/assignments/enterprise-numbers
|
||||
*
|
||||
* for a list.
|
||||
*
|
||||
* List taken from Ethereal's epan/sminmpec.h.
|
||||
*/
|
||||
#define SMI_IETF 0 /* reserved - used by the IETF in L2TP? */
|
||||
#define SMI_ACC 5
|
||||
#define SMI_CISCO 9
|
||||
#define SMI_HEWLETT_PACKARD 11
|
||||
#define SMI_SUN_MICROSYSTEMS 42
|
||||
#define SMI_MERIT 61
|
||||
#define SMI_SHIVA 166
|
||||
#define SMI_ERICSSON 193
|
||||
#define SMI_CISCO_VPN5000 255
|
||||
#define SMI_LIVINGSTON 307
|
||||
#define SMI_MICROSOFT 311
|
||||
#define SMI_3COM 429
|
||||
@ -32,12 +59,22 @@ extern struct tok smi_values[];
|
||||
#define SMI_REDBACK 2352
|
||||
#define SMI_JUNIPER 2636
|
||||
#define SMI_APTIS 2637
|
||||
#define SMI_CISCO_VPN3000 3076
|
||||
#define SMI_COSINE 3085
|
||||
#define SMI_SHASTA 3199
|
||||
#define SMI_NETSCREEN 3224
|
||||
#define SMI_NOMADIX 3309
|
||||
#define SMI_SIEMENS 4329
|
||||
#define SMI_CABLELABS 4491
|
||||
#define SMI_UNISPHERE 4874
|
||||
#define SMI_CISCO_BBSM 5263
|
||||
#define SMI_THE3GPP2 5535
|
||||
#define SMI_IP_UNPLUGGED 5925
|
||||
#define SMI_ISSANNI 5948
|
||||
#define SMI_QUINTUM 6618
|
||||
#define SMI_INTERLINK 6728
|
||||
#define SMI_COLUBRIS 8744
|
||||
#define SMI_COLUMBIA_UNIVERSITY 11862
|
||||
#define SMI_THE3GPP 10415
|
||||
#define SMI_GEMTEK_SYSTEMS 10529
|
||||
#define SMI_WIFI_ALLIANCE 14122
|
||||
|
8
dist/tcpdump/pcap-missing.h
vendored
8
dist/tcpdump/pcap-missing.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcap-missing.h,v 1.1.1.1 2004/09/27 17:06:52 dyoung Exp $ */
|
||||
/* $NetBSD: pcap-missing.h,v 1.1.1.2 2007/07/24 11:42:57 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-2002
|
||||
@ -20,7 +20,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.2.1 2005/06/03 22:10:16 guy Exp (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_pcap_missing_h
|
||||
@ -46,6 +46,10 @@ extern const char *pcap_datalink_val_to_name(int);
|
||||
extern const char *pcap_datalink_val_to_description(int);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PCAP_DUMP_FTELL
|
||||
extern long pcap_dump_ftell(pcap_dumper_t *);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
38
dist/tcpdump/pcap_dump_ftell.c
vendored
Normal file
38
dist/tcpdump/pcap_dump_ftell.c
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
/* $NetBSD: pcap_dump_ftell.c,v 1.1.1.1 2007/07/24 11:42:54 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/pcap_dump_ftell.c,v 1.1.2.1 2005/06/03 22:10:17 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "pcap-missing.h"
|
||||
|
||||
long
|
||||
pcap_dump_ftell(pcap_dumper_t *p)
|
||||
{
|
||||
return (ftell((FILE *)p));
|
||||
}
|
6
dist/tcpdump/pf.h
vendored
6
dist/tcpdump/pf.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pf.h,v 1.1.1.1 2004/09/27 17:06:52 dyoung Exp $ */
|
||||
/* $NetBSD: pf.h,v 1.1.1.2 2007/07/24 11:43:05 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Daniel Hartmeier
|
||||
@ -28,7 +28,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 $ */
|
||||
@ -66,7 +66,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];
|
||||
|
91
dist/tcpdump/pmap_prot.h
vendored
Normal file
91
dist/tcpdump/pmap_prot.h
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
/* $NetBSD: pmap_prot.h,v 1.1.1.1 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.1.2.2 2005/04/27 21:44:06 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: src/include/rpc/pmap_prot.h,v 1.9.2.1 1999/08/29 14:39:05 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define SUNRPC_PMAPPORT ((u_int16_t)111)
|
||||
#define SUNRPC_PMAPPROG ((u_int32_t)100000)
|
||||
#define SUNRPC_PMAPVERS ((u_int32_t)2)
|
||||
#define SUNRPC_PMAPVERS_PROTO ((u_int32_t)2)
|
||||
#define SUNRPC_PMAPVERS_ORIG ((u_int32_t)1)
|
||||
#define SUNRPC_PMAPPROC_NULL ((u_int32_t)0)
|
||||
#define SUNRPC_PMAPPROC_SET ((u_int32_t)1)
|
||||
#define SUNRPC_PMAPPROC_UNSET ((u_int32_t)2)
|
||||
#define SUNRPC_PMAPPROC_GETPORT ((u_int32_t)3)
|
||||
#define SUNRPC_PMAPPROC_DUMP ((u_int32_t)4)
|
||||
#define SUNRPC_PMAPPROC_CALLIT ((u_int32_t)5)
|
||||
|
||||
struct sunrpc_pmap {
|
||||
u_int32_t pm_prog;
|
||||
u_int32_t pm_vers;
|
||||
u_int32_t pm_prot;
|
||||
u_int32_t pm_port;
|
||||
};
|
10
dist/tcpdump/ppp.h
vendored
10
dist/tcpdump/ppp.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: ppp.h,v 1.1.1.2 2004/09/27 17:06:52 dyoung Exp $ */
|
||||
/* $NetBSD: ppp.h,v 1.1.1.3 2007/07/24 11:42:58 drochner Exp $ */
|
||||
|
||||
/* @(#) 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
|
||||
*
|
||||
@ -22,6 +22,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 */
|
||||
@ -34,6 +37,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 */
|
||||
|
||||
@ -62,7 +66,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
|
||||
|
||||
|
4
dist/tcpdump/print-aodv.c
vendored
4
dist/tcpdump/print-aodv.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-aodv.c,v 1.1.1.1 2004/09/27 17:06:54 dyoung Exp $ */
|
||||
/* $NetBSD: print-aodv.c,v 1.1.1.2 2007/07/24 11:42:53 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Bruce M. Simpson <bms@spc.org>
|
||||
@ -34,7 +34,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
|
||||
|
8
dist/tcpdump/print-ap1394.c
vendored
8
dist/tcpdump/print-ap1394.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-ap1394.c,v 1.1.1.1 2004/09/27 17:06:54 dyoung Exp $ */
|
||||
/* $NetBSD: print-ap1394.c,v 1.1.1.2 2007/07/24 11:42:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
|
||||
@ -22,7 +22,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.2.1 2005/07/07 01:24:33 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -79,7 +79,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
|
||||
@ -113,7 +113,7 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (!eflag)
|
||||
ap1394_hdr_print((u_char *)fp, length + FIREWIRE_HDRLEN);
|
||||
|
||||
if (!xflag && !qflag)
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
|
||||
|
143
dist/tcpdump/print-bfd.c
vendored
143
dist/tcpdump/print-bfd.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-bfd.c,v 1.1.1.1 2004/09/27 17:06:57 dyoung Exp $ */
|
||||
/* $NetBSD: print-bfd.c,v 1.1.1.2 2007/07/24 11:43:01 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -17,7 +17,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.2.5 2006/02/02 06:36:37 hannes Exp";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -36,7 +36,7 @@ static const char rcsid[] _U_ =
|
||||
#include "udp.h"
|
||||
|
||||
/*
|
||||
* Control packet, draft-katz-ward-bfd-01.txt
|
||||
* Control packet, BFDv0, draft-katz-ward-bfd-01.txt
|
||||
*
|
||||
* 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
|
||||
@ -55,6 +55,26 @@ static const char rcsid[] _U_ =
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
/*
|
||||
* Control packet, BFDv1, draft-ietf-bfd-base-02.txt
|
||||
*
|
||||
* 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 | Diag |Sta|P|F|C|A|D|R| Detect Mult | Length |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | My Discriminator |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Your Discriminator |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Desired Min TX Interval |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Required Min RX Interval |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Required Min Echo RX Interval |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
struct bfd_header_t {
|
||||
u_int8_t version_diag;
|
||||
u_int8_t flags;
|
||||
@ -67,6 +87,32 @@ struct bfd_header_t {
|
||||
u_int8_t required_min_echo_interval[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* An optional Authentication Header may be present
|
||||
*
|
||||
* 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
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Type | Auth Len | Authentication Data... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
struct bfd_auth_header_t {
|
||||
u_int8_t auth_type;
|
||||
u_int8_t auth_len;
|
||||
u_int8_t auth_data;
|
||||
};
|
||||
|
||||
static const struct tok bfd_v1_authentication_values[] = {
|
||||
{ 0, "Reserved" },
|
||||
{ 1, "Simple Password" },
|
||||
{ 2, "Keyed MD5" },
|
||||
{ 3, "Meticulous Keyed MD5" },
|
||||
{ 4, "Keyed SHA1" },
|
||||
{ 5, "Meticulous Keyed SHA1" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define BFD_EXTRACT_VERSION(x) (((x)&0xe0)>>5)
|
||||
#define BFD_EXTRACT_DIAG(x) ((x)&0x1f)
|
||||
|
||||
@ -86,10 +132,11 @@ static const struct tok bfd_diag_values[] = {
|
||||
{ 5, "Path Down" },
|
||||
{ 6, "Concatenated Path Down" },
|
||||
{ 7, "Administratively Down" },
|
||||
{ 8, "Reverse Concatenated Path Down" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok bfd_flag_values[] = {
|
||||
static const struct tok bfd_v0_flag_values[] = {
|
||||
{ 0x80, "I Hear You" },
|
||||
{ 0x40, "Demand" },
|
||||
{ 0x20, "Poll" },
|
||||
@ -101,34 +148,58 @@ static const struct tok bfd_flag_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define BFD_FLAG_AUTH 0x04
|
||||
|
||||
static const struct tok bfd_v1_flag_values[] = {
|
||||
{ 0x20, "Poll" },
|
||||
{ 0x10, "Final" },
|
||||
{ 0x08, "Control Plane Independent" },
|
||||
{ BFD_FLAG_AUTH, "Authentication Present" },
|
||||
{ 0x02, "Demand" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok bfd_v1_state_values[] = {
|
||||
{ 0, "AdminDown" },
|
||||
{ 1, "Down" },
|
||||
{ 2, "Init" },
|
||||
{ 3, "Up" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
void
|
||||
bfd_print(register const u_char *pptr, register u_int len, register u_int port)
|
||||
{
|
||||
const struct bfd_header_t *bfd_header;
|
||||
const struct bfd_auth_header_t *bfd_auth_header;
|
||||
u_int8_t version;
|
||||
|
||||
bfd_header = (const struct bfd_header_t *)pptr;
|
||||
TCHECK(*bfd_header);
|
||||
version = BFD_EXTRACT_VERSION(bfd_header->version_diag);
|
||||
|
||||
switch (port) {
|
||||
switch (port << 8 | version) {
|
||||
|
||||
case BFD_CONTROL_PORT:
|
||||
/* BFDv0 */
|
||||
case (BFD_CONTROL_PORT << 8):
|
||||
if (vflag < 1 )
|
||||
{
|
||||
printf("BFDv%u, %s, Flags: [%s], length: %u",
|
||||
BFD_EXTRACT_VERSION(bfd_header->version_diag),
|
||||
version,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
bittok2str(bfd_flag_values, "none", bfd_header->flags),
|
||||
bittok2str(bfd_v0_flag_values, "none", bfd_header->flags),
|
||||
len);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("BFDv%u, length: %u\n\t%s, Flags: [%s], Diagnostic: %s (0x%02x)",
|
||||
BFD_EXTRACT_VERSION(bfd_header->version_diag),
|
||||
version,
|
||||
len,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
bittok2str(bfd_flag_values, "none", bfd_header->flags),
|
||||
bittok2str(bfd_v0_flag_values, "none", bfd_header->flags),
|
||||
tok2str(bfd_diag_values,"unknown",BFD_EXTRACT_DIAG(bfd_header->version_diag)),
|
||||
BFD_EXTRACT_DIAG(bfd_header->version_diag));
|
||||
BFD_EXTRACT_DIAG(bfd_header->version_diag));
|
||||
|
||||
printf("\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
|
||||
bfd_header->detect_time_multiplier,
|
||||
@ -143,7 +214,55 @@ bfd_print(register const u_char *pptr, register u_int len, register u_int port)
|
||||
printf("\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000);
|
||||
break;
|
||||
|
||||
case BFD_ECHO_PORT: /* not yet supported - fall through */
|
||||
/* BFDv1 */
|
||||
case (BFD_CONTROL_PORT << 8 | 1):
|
||||
if (vflag < 1 )
|
||||
{
|
||||
printf("BFDv%u, %s, State %s, Flags: [%s], length: %u",
|
||||
version,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
tok2str(bfd_v1_state_values, "unknown (%u)", (bfd_header->flags & 0xc0) >> 6),
|
||||
bittok2str(bfd_v1_flag_values, "none", bfd_header->flags & 0x3f),
|
||||
len);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("BFDv%u, length: %u\n\t%s, State %s, Flags: [%s], Diagnostic: %s (0x%02x)",
|
||||
version,
|
||||
len,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
tok2str(bfd_v1_state_values, "unknown (%u)", (bfd_header->flags & 0xc0) >> 6),
|
||||
bittok2str(bfd_v1_flag_values, "none", bfd_header->flags & 0x3f),
|
||||
tok2str(bfd_diag_values,"unknown",BFD_EXTRACT_DIAG(bfd_header->version_diag)),
|
||||
BFD_EXTRACT_DIAG(bfd_header->version_diag));
|
||||
|
||||
printf("\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
|
||||
bfd_header->detect_time_multiplier,
|
||||
bfd_header->detect_time_multiplier * EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000,
|
||||
bfd_header->length);
|
||||
|
||||
|
||||
printf("\n\tMy Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->my_discriminator));
|
||||
printf(", Your Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->your_discriminator));
|
||||
printf("\n\t Desired min Tx Interval: %4u ms", EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000);
|
||||
printf("\n\t Required min Rx Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_rx_interval)/1000);
|
||||
printf("\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000);
|
||||
|
||||
if (bfd_header->flags & BFD_FLAG_AUTH) {
|
||||
pptr += sizeof (const struct bfd_header_t);
|
||||
bfd_auth_header = (const struct bfd_auth_header_t *)pptr;
|
||||
TCHECK2(*bfd_auth_header, sizeof(const struct bfd_auth_header_t));
|
||||
printf("\n\t%s (%u) Authentication, length %u present",
|
||||
tok2str(bfd_v1_authentication_values,"Unknown",bfd_auth_header->auth_type),
|
||||
bfd_auth_header->auth_type,
|
||||
bfd_auth_header->auth_len);
|
||||
}
|
||||
break;
|
||||
|
||||
/* BFDv0 */
|
||||
case (BFD_ECHO_PORT << 8): /* not yet supported - fall through */
|
||||
/* BFDv1 */
|
||||
case (BFD_ECHO_PORT << 8 | 1):
|
||||
|
||||
default:
|
||||
printf("BFD, %s, length: %u",
|
||||
|
535
dist/tcpdump/print-dccp.c
vendored
Normal file
535
dist/tcpdump/print-dccp.c
vendored
Normal file
@ -0,0 +1,535 @@
|
||||
/* $NetBSD: print-dccp.c,v 1.1.1.1 2007/07/24 11:43:03 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) Arnaldo Carvalho de Melo 2004
|
||||
* Copyright (C) Ian McDonald 2005
|
||||
* Copyright (C) Yoshifumi Nishida 2005
|
||||
*
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style license that accompanies tcpdump or the GNU GPL version 2
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-dccp.c,v 1.1.2.6 2006/02/19 05:08:44 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include "dccp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "ip.h"
|
||||
#ifdef INET6
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
#include "ipproto.h"
|
||||
|
||||
static const char *dccp_reset_codes[] = {
|
||||
"unspecified",
|
||||
"closed",
|
||||
"aborted",
|
||||
"no_connection",
|
||||
"packet_error",
|
||||
"option_error",
|
||||
"mandatory_error",
|
||||
"connection_refused",
|
||||
"bad_service_code",
|
||||
"too_busy",
|
||||
"bad_init_cookie",
|
||||
"aggression_penalty",
|
||||
};
|
||||
|
||||
static const char *dccp_feature_nums[] = {
|
||||
"reserved",
|
||||
"ccid",
|
||||
"allow_short_seqno",
|
||||
"sequence_window",
|
||||
"ecn_incapable",
|
||||
"ack_ratio",
|
||||
"send_ack_vector",
|
||||
"send_ndp_count",
|
||||
"minimum checksum coverage",
|
||||
"check data checksum",
|
||||
};
|
||||
|
||||
static int dccp_cksum(const struct ip *ip,
|
||||
const struct dccp_hdr *dh, u_int len)
|
||||
{
|
||||
union phu {
|
||||
struct phdr {
|
||||
u_int32_t src;
|
||||
u_int32_t dst;
|
||||
u_char mbz;
|
||||
u_char proto;
|
||||
u_int16_t len;
|
||||
} ph;
|
||||
u_int16_t pa[6];
|
||||
} phu;
|
||||
const u_int16_t *sp;
|
||||
|
||||
/* pseudo-header.. */
|
||||
phu.ph.mbz = 0;
|
||||
phu.ph.len = htons(len);
|
||||
phu.ph.proto = IPPROTO_DCCP;
|
||||
memcpy(&phu.ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t));
|
||||
if (IP_HL(ip) == 5)
|
||||
memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t));
|
||||
else
|
||||
phu.ph.dst = ip_finddst(ip);
|
||||
|
||||
sp = &phu.pa[0];
|
||||
return in_cksum((u_short *)dh, len, sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5]);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
static int dccp6_cksum(const struct ip6_hdr *ip6, const struct dccp_hdr *dh, u_int len)
|
||||
{
|
||||
size_t i;
|
||||
const u_int16_t *sp;
|
||||
u_int32_t sum;
|
||||
union {
|
||||
struct {
|
||||
struct in6_addr ph_src;
|
||||
struct in6_addr ph_dst;
|
||||
u_int32_t ph_len;
|
||||
u_int8_t ph_zero[3];
|
||||
u_int8_t ph_nxt;
|
||||
} ph;
|
||||
u_int16_t pa[20];
|
||||
} phu;
|
||||
|
||||
/* pseudo-header */
|
||||
memset(&phu, 0, sizeof(phu));
|
||||
phu.ph.ph_src = ip6->ip6_src;
|
||||
phu.ph.ph_dst = ip6->ip6_dst;
|
||||
phu.ph.ph_len = htonl(len);
|
||||
phu.ph.ph_nxt = IPPROTO_DCCP;
|
||||
|
||||
sum = 0;
|
||||
for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
|
||||
sum += phu.pa[i];
|
||||
|
||||
sp = (const u_int16_t *)dh;
|
||||
|
||||
for (i = 0; i < (len & ~1); i += 2)
|
||||
sum += *sp++;
|
||||
|
||||
if (len & 1)
|
||||
sum += htons((*(const u_int8_t *)sp) << 8);
|
||||
|
||||
while (sum > 0xffff)
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
sum = ~sum & 0xffff;
|
||||
|
||||
return (sum);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const char *dccp_reset_code(u_int8_t code)
|
||||
{
|
||||
if (code >= __DCCP_RESET_CODE_LAST)
|
||||
return "invalid";
|
||||
return dccp_reset_codes[code];
|
||||
}
|
||||
|
||||
static u_int64_t dccp_seqno(const struct dccp_hdr *dh)
|
||||
{
|
||||
u_int32_t seq_high = DCCPH_SEQ(dh);
|
||||
u_int64_t seqno = EXTRACT_24BITS(&seq_high) & 0xFFFFFF;
|
||||
|
||||
if (DCCPH_X(dh) != 0) {
|
||||
const struct dccp_hdr_ext *dhx = (void *)(dh + 1);
|
||||
u_int32_t seq_low = dhx->dccph_seq_low;
|
||||
seqno &= 0x00FFFF; /* clear reserved field */
|
||||
seqno = (seqno << 32) + EXTRACT_32BITS(&seq_low);
|
||||
}
|
||||
|
||||
return seqno;
|
||||
}
|
||||
|
||||
static inline unsigned int dccp_basic_hdr_len(const struct dccp_hdr *dh)
|
||||
{
|
||||
return sizeof(*dh) + (DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : 0);
|
||||
}
|
||||
|
||||
static void dccp_print_ack_no(const u_char *bp)
|
||||
{
|
||||
const struct dccp_hdr *dh = (const struct dccp_hdr *)bp;
|
||||
const struct dccp_hdr_ack_bits *dh_ack =
|
||||
(struct dccp_hdr_ack_bits *)(bp + dccp_basic_hdr_len(dh));
|
||||
u_int32_t ack_high;
|
||||
u_int64_t ackno;
|
||||
|
||||
TCHECK2(*dh_ack,4);
|
||||
ack_high = DCCPH_ACK(dh_ack);
|
||||
ackno = EXTRACT_24BITS(&ack_high) & 0xFFFFFF;
|
||||
|
||||
if (DCCPH_X(dh) != 0) {
|
||||
u_int32_t ack_low;
|
||||
|
||||
TCHECK2(*dh_ack,8);
|
||||
ack_low = dh_ack->dccph_ack_nr_low;
|
||||
|
||||
ackno &= 0x00FFFF; /* clear reserved field */
|
||||
ackno = (ackno << 32) + EXTRACT_32BITS(&ack_low);
|
||||
}
|
||||
|
||||
(void)printf("(ack=%" PRIu64 ") ", ackno);
|
||||
trunc:
|
||||
return;
|
||||
}
|
||||
|
||||
static inline unsigned int dccp_packet_hdr_len(const u_int8_t type)
|
||||
{
|
||||
if (type == DCCP_PKT_DATA)
|
||||
return 0;
|
||||
if (type == DCCP_PKT_DATAACK ||
|
||||
type == DCCP_PKT_ACK ||
|
||||
type == DCCP_PKT_SYNC ||
|
||||
type == DCCP_PKT_SYNCACK ||
|
||||
type == DCCP_PKT_CLOSE ||
|
||||
type == DCCP_PKT_CLOSEREQ)
|
||||
return sizeof(struct dccp_hdr_ack_bits);
|
||||
if (type == DCCP_PKT_REQUEST)
|
||||
return sizeof(struct dccp_hdr_request);
|
||||
if (type == DCCP_PKT_RESPONSE)
|
||||
return sizeof(struct dccp_hdr_response);
|
||||
return sizeof(struct dccp_hdr_reset);
|
||||
}
|
||||
|
||||
static int dccp_print_option(const u_char *option);
|
||||
|
||||
/**
|
||||
* dccp_print - show dccp packet
|
||||
* @bp - beginning of dccp packet
|
||||
* @data2 - beginning of enclosing
|
||||
* @len - lenght of ip packet
|
||||
*/
|
||||
void dccp_print(const u_char *bp, const u_char *data2, u_int len)
|
||||
{
|
||||
const struct dccp_hdr *dh;
|
||||
const struct ip *ip;
|
||||
#ifdef INET6
|
||||
const struct ip6_hdr *ip6;
|
||||
#endif
|
||||
const u_char *cp;
|
||||
u_short sport, dport;
|
||||
u_int hlen;
|
||||
u_int extlen = 0;
|
||||
|
||||
dh = (const struct dccp_hdr *)bp;
|
||||
|
||||
ip = (struct ip *)data2;
|
||||
#ifdef INET6
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (const struct ip6_hdr *)data2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
#endif /*INET6*/
|
||||
cp = (const u_char *)(dh + 1);
|
||||
if (cp > snapend) {
|
||||
printf("[Invalid packet|dccp]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (len < sizeof(struct dccp_hdr)) {
|
||||
printf("truncated-dccp - %ld bytes missing!",
|
||||
(long)len - sizeof(struct dccp_hdr));
|
||||
return;
|
||||
}
|
||||
|
||||
sport = EXTRACT_16BITS(&dh->dccph_sport);
|
||||
dport = EXTRACT_16BITS(&dh->dccph_dport);
|
||||
hlen = dh->dccph_doff * 4;
|
||||
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
(void)printf("%s.%d > %s.%d: ",
|
||||
ip6addr_string(&ip6->ip6_src), sport,
|
||||
ip6addr_string(&ip6->ip6_dst), dport);
|
||||
} else
|
||||
#endif /*INET6*/
|
||||
{
|
||||
(void)printf("%s.%d > %s.%d: ",
|
||||
ipaddr_string(&ip->ip_src), sport,
|
||||
ipaddr_string(&ip->ip_dst), dport);
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
if (qflag) {
|
||||
(void)printf(" %d", len - hlen);
|
||||
if (hlen > len) {
|
||||
(void)printf("dccp [bad hdr length %u - too long, > %u]",
|
||||
hlen, len);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* other variables in generic header */
|
||||
if (vflag) {
|
||||
(void)printf("CCVal %d, CsCov %d, ", DCCPH_CCVAL(dh), DCCPH_CSCOV(dh));
|
||||
}
|
||||
|
||||
/* checksum calculation */
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
if (ip6->ip6_plen && vflag) {
|
||||
u_int16_t sum, dccp_sum;
|
||||
|
||||
sum = dccp6_cksum(ip6, dh, len);
|
||||
dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);
|
||||
printf("cksum 0x%04x", dccp_sum);
|
||||
if (sum != 0) {
|
||||
(void)printf(" (incorrect (-> 0x%04x), ",in_cksum_shouldbe(dccp_sum, sum));
|
||||
} else
|
||||
(void)printf(" (correct), ");
|
||||
}
|
||||
} else
|
||||
#endif /* INET6 */
|
||||
if (vflag)
|
||||
{
|
||||
u_int16_t sum, dccp_sum;
|
||||
|
||||
sum = dccp_cksum(ip, dh, len);
|
||||
dccp_sum = EXTRACT_16BITS(&dh->dccph_checksum);
|
||||
printf("cksum 0x%04x", dccp_sum);
|
||||
if (sum != 0) {
|
||||
(void)printf(" (incorrect (-> 0x%04x), ",in_cksum_shouldbe(dccp_sum, sum));
|
||||
} else
|
||||
(void)printf(" (correct), ");
|
||||
}
|
||||
|
||||
switch (DCCPH_TYPE(dh)) {
|
||||
case DCCP_PKT_REQUEST: {
|
||||
struct dccp_hdr_request *dhr =
|
||||
(struct dccp_hdr_request *)(bp + dccp_basic_hdr_len(dh));
|
||||
TCHECK(*dhr);
|
||||
(void)printf("request (service=%d) ",
|
||||
EXTRACT_32BITS(&dhr->dccph_req_service));
|
||||
extlen += 4;
|
||||
break;
|
||||
}
|
||||
case DCCP_PKT_RESPONSE: {
|
||||
struct dccp_hdr_response *dhr =
|
||||
(struct dccp_hdr_response *)(bp + dccp_basic_hdr_len(dh));
|
||||
TCHECK(*dhr);
|
||||
(void)printf("response (service=%d) ",
|
||||
EXTRACT_32BITS(&dhr->dccph_resp_service));
|
||||
extlen += 12;
|
||||
break;
|
||||
}
|
||||
case DCCP_PKT_DATA:
|
||||
(void)printf("data ");
|
||||
break;
|
||||
case DCCP_PKT_ACK: {
|
||||
(void)printf("ack ");
|
||||
extlen += 8;
|
||||
break;
|
||||
}
|
||||
case DCCP_PKT_DATAACK: {
|
||||
(void)printf("dataack ");
|
||||
extlen += 8;
|
||||
break;
|
||||
}
|
||||
case DCCP_PKT_CLOSEREQ:
|
||||
(void)printf("closereq ");
|
||||
extlen += 8;
|
||||
break;
|
||||
case DCCP_PKT_CLOSE:
|
||||
(void)printf("close ");
|
||||
extlen += 8;
|
||||
break;
|
||||
case DCCP_PKT_RESET: {
|
||||
struct dccp_hdr_reset *dhr =
|
||||
(struct dccp_hdr_reset *)(bp + dccp_basic_hdr_len(dh));
|
||||
TCHECK(*dhr);
|
||||
(void)printf("reset (code=%s) ",
|
||||
dccp_reset_code(dhr->dccph_reset_code));
|
||||
extlen += 12;
|
||||
break;
|
||||
}
|
||||
case DCCP_PKT_SYNC:
|
||||
(void)printf("sync ");
|
||||
extlen += 8;
|
||||
break;
|
||||
case DCCP_PKT_SYNCACK:
|
||||
(void)printf("syncack ");
|
||||
extlen += 8;
|
||||
break;
|
||||
default:
|
||||
(void)printf("invalid ");
|
||||
break;
|
||||
}
|
||||
|
||||
if ((DCCPH_TYPE(dh) != DCCP_PKT_DATA) &&
|
||||
(DCCPH_TYPE(dh) != DCCP_PKT_REQUEST))
|
||||
dccp_print_ack_no(bp);
|
||||
|
||||
if (vflag < 2)
|
||||
return;
|
||||
|
||||
(void)printf("seq %" PRIu64, dccp_seqno(dh));
|
||||
|
||||
/* process options */
|
||||
if (hlen > dccp_basic_hdr_len(dh) + extlen){
|
||||
const u_char *cp;
|
||||
u_int optlen;
|
||||
cp = bp + dccp_basic_hdr_len(dh) + extlen;
|
||||
printf(" <");
|
||||
|
||||
hlen -= dccp_basic_hdr_len(dh) + extlen;
|
||||
while(1){
|
||||
TCHECK(*cp);
|
||||
optlen = dccp_print_option(cp);
|
||||
if (!optlen) goto trunc2;
|
||||
if (hlen <= optlen) break;
|
||||
hlen -= optlen;
|
||||
cp += optlen;
|
||||
printf(", ");
|
||||
}
|
||||
printf(">");
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
printf("[|dccp]");
|
||||
trunc2:
|
||||
return;
|
||||
}
|
||||
|
||||
static int dccp_print_option(const u_char *option)
|
||||
{
|
||||
u_int8_t optlen, i;
|
||||
u_int32_t *ts;
|
||||
u_int16_t *var16;
|
||||
u_int32_t *var32;
|
||||
|
||||
TCHECK(*option);
|
||||
|
||||
if (*option >= 32) {
|
||||
TCHECK(*(option+1));
|
||||
optlen = *(option +1);
|
||||
if (optlen < 2) {
|
||||
printf("Option %d optlen too short",*option);
|
||||
return 1;
|
||||
}
|
||||
} else optlen = 1;
|
||||
|
||||
TCHECK2(*option,optlen);
|
||||
|
||||
switch (*option){
|
||||
case 0:
|
||||
printf("nop");
|
||||
break;
|
||||
case 1:
|
||||
printf("mandatory");
|
||||
break;
|
||||
case 2:
|
||||
printf("slowreceiver");
|
||||
break;
|
||||
case 32:
|
||||
printf("change_l");
|
||||
if (*(option +2) < 10){
|
||||
printf(" %s", dccp_feature_nums[*(option +2)]);
|
||||
for (i = 0; i < optlen -3; i ++) printf(" %d", *(option +3 + i));
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
printf("confirm_l");
|
||||
if (*(option +2) < 10){
|
||||
printf(" %s", dccp_feature_nums[*(option +2)]);
|
||||
for (i = 0; i < optlen -3; i ++) printf(" %d", *(option +3 + i));
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
printf("change_r");
|
||||
if (*(option +2) < 10){
|
||||
printf(" %s", dccp_feature_nums[*(option +2)]);
|
||||
for (i = 0; i < optlen -3; i ++) printf(" %d", *(option +3 + i));
|
||||
}
|
||||
break;
|
||||
case 35:
|
||||
printf("confirm_r");
|
||||
if (*(option +2) < 10){
|
||||
printf(" %s", dccp_feature_nums[*(option +2)]);
|
||||
for (i = 0; i < optlen -3; i ++) printf(" %d", *(option +3 + i));
|
||||
}
|
||||
break;
|
||||
case 36:
|
||||
printf("initcookie 0x");
|
||||
for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
|
||||
break;
|
||||
case 37:
|
||||
printf("ndp_count");
|
||||
for (i = 0; i < optlen -2; i ++) printf(" %d", *(option +2 + i));
|
||||
break;
|
||||
case 38:
|
||||
printf("ack_vector0 0x");
|
||||
for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
|
||||
break;
|
||||
case 39:
|
||||
printf("ack_vector1 0x");
|
||||
for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
|
||||
break;
|
||||
case 40:
|
||||
printf("data_dropped 0x");
|
||||
for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
|
||||
break;
|
||||
case 41:
|
||||
ts = (u_int32_t *)(option + 2);
|
||||
printf("timestamp %u", (u_int32_t)ntohl(*ts));
|
||||
break;
|
||||
case 42:
|
||||
ts = (u_int32_t *)(option + 2);
|
||||
printf("timestamp_echo %u", (u_int32_t)ntohl(*ts));
|
||||
break;
|
||||
case 43:
|
||||
printf("elapsed_time ");
|
||||
if (optlen == 6){
|
||||
ts = (u_int32_t *)(option + 2);
|
||||
printf("%u", (u_int32_t)ntohl(*ts));
|
||||
} else {
|
||||
var16 = (u_int16_t *)(option + 2);
|
||||
printf("%u", ntohs(*var16));
|
||||
}
|
||||
break;
|
||||
case 44:
|
||||
printf("data_checksum ");
|
||||
for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
|
||||
break;
|
||||
default :
|
||||
if (*option >= 128) {
|
||||
printf("CCID option %d",*option);
|
||||
switch (optlen) {
|
||||
case 4:
|
||||
var16 = (u_int16_t *)(option + 2);
|
||||
printf(" %u",ntohs(*var16));
|
||||
break;
|
||||
case 6:
|
||||
var32 = (u_int32_t *)(option + 2);
|
||||
printf(" %u",(u_int32_t)ntohl(*var32));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
printf("unknown_opt %d", *option);
|
||||
break;
|
||||
}
|
||||
|
||||
return optlen;
|
||||
trunc:
|
||||
printf("[|dccp]");
|
||||
return 0;
|
||||
}
|
73
dist/tcpdump/print-eap.c
vendored
Normal file
73
dist/tcpdump/print-eap.c
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
/* $NetBSD: print-eap.c,v 1.1.1.1 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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:
|
||||
;
|
||||
}
|
||||
|
482
dist/tcpdump/print-eigrp.c
vendored
Normal file
482
dist/tcpdump/print-eigrp.c
vendored
Normal file
@ -0,0 +1,482 @@
|
||||
/* $NetBSD: print-eigrp.c,v 1.1.1.1 2007/07/24 11:43:20 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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.2.2 2005/05/06 02:53:41 guy 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;
|
||||
u_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 ? */
|
||||
TCHECK2(*tptr, sizeof(struct eigrp_tlv_header));
|
||||
|
||||
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 < sizeof(struct eigrp_tlv_header) ||
|
||||
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 ? */
|
||||
TCHECK2(*tptr, eigrp_tlv_len);
|
||||
|
||||
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 > 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(&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 > 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(&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");
|
||||
}
|
14
dist/tcpdump/print-enc.c
vendored
14
dist/tcpdump/print-enc.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-enc.c,v 1.1.1.1 2004/09/27 17:07:03 dyoung Exp $ */
|
||||
/* $NetBSD: print-enc.c,v 1.1.1.2 2007/07/24 11:42:59 drochner Exp $ */
|
||||
|
||||
/* $OpenBSD: print-enc.c,v 1.7 2002/02/19 19:39:40 millert Exp $ */
|
||||
|
||||
@ -25,7 +25,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
|
||||
@ -73,8 +73,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:
|
||||
*/
|
||||
|
840
dist/tcpdump/print-fr.c
vendored
840
dist/tcpdump/print-fr.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-fr.c,v 1.1.1.1 2004/09/27 17:07:03 dyoung Exp $ */
|
||||
/* $NetBSD: print-fr.c,v 1.1.1.2 2007/07/24 11:43:04 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
@ -23,7 +23,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.2.15 2006/02/01 14:39:56 hannes Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -39,50 +39,82 @@ 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 }
|
||||
};
|
||||
|
||||
/* FRF.15 / FRF.16 */
|
||||
#define MFR_B_BIT 0x80
|
||||
#define MFR_E_BIT 0x40
|
||||
#define MFR_C_BIT 0x20
|
||||
#define MFR_BEC_MASK (MFR_B_BIT | MFR_E_BIT | MFR_C_BIT)
|
||||
#define MFR_CTRL_FRAME (MFR_B_BIT | MFR_E_BIT | MFR_C_BIT)
|
||||
#define MFR_FRAG_FRAME (MFR_B_BIT | MFR_E_BIT )
|
||||
|
||||
struct tok frf_flag_values[] = {
|
||||
{ MFR_B_BIT, "Begin" },
|
||||
{ MFR_E_BIT, "End" },
|
||||
{ MFR_C_BIT, "Control" },
|
||||
{ 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;
|
||||
flags[2] = 0; /* clear the rest of the flags */
|
||||
flags[3] = 0;
|
||||
|
||||
if (p[1] & FR_EA_BIT)
|
||||
return 0; /* 2-byte Q.922 address */
|
||||
@ -98,42 +130,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
|
||||
|
||||
+---------------------------+
|
||||
@ -161,39 +167,39 @@ init_fr_nlpids(void)
|
||||
*/
|
||||
|
||||
static u_int
|
||||
fr_hdrlen(const u_char *p, u_int addr_len, u_int caplen)
|
||||
fr_hdrlen(const u_char *p, u_int addr_len)
|
||||
{
|
||||
if ((caplen > addr_len + 1 /* UI */ + 1 /* pad */) &&
|
||||
!p[addr_len + 1] /* pad exist */)
|
||||
if (!p[addr_len + 1] /* pad exist */)
|
||||
return addr_len + 1 /* UI */ + 1 /* pad */ + 1 /* NLPID */;
|
||||
else
|
||||
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
|
||||
@ -201,34 +207,56 @@ 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_int32_t orgcode;
|
||||
register u_short et;
|
||||
|
||||
TCHECK2(*p, 4); /* minimum frame header length */
|
||||
|
||||
if ((length = fr_print(p, length)) == 0)
|
||||
return (0);
|
||||
else
|
||||
return length;
|
||||
trunc:
|
||||
printf("[|fr]");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
u_int
|
||||
fr_print(register const u_char *p, u_int length)
|
||||
{
|
||||
u_int16_t extracted_ethertype;
|
||||
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, &sdlcore, &addr_len, flags)) {
|
||||
printf("Q.922, invalid address");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parse_q922_addr(p, &dlci, &addr_len, &flags)) {
|
||||
printf("Invalid Q.922 address");
|
||||
return caplen;
|
||||
}
|
||||
TCHECK2(*p,addr_len+1+1);
|
||||
hdr_len = fr_hdrlen(p, addr_len);
|
||||
TCHECK2(*p,hdr_len);
|
||||
|
||||
hdr_len = fr_hdrlen(p, addr_len, caplen);
|
||||
if (p[addr_len] != 0x03 && dlci != 0) {
|
||||
|
||||
if (caplen < hdr_len) {
|
||||
printf("[|fr]");
|
||||
return caplen;
|
||||
}
|
||||
/* lets figure out if we have cisco style encapsulation: */
|
||||
extracted_ethertype = EXTRACT_16BITS(p+addr_len);
|
||||
|
||||
if (p[addr_len] != 0x03)
|
||||
printf("UI %02x! ", 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,
|
||||
length-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)
|
||||
@ -238,61 +266,309 @@ 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, length+1); /* OSI printers need the NLPID field */
|
||||
break;
|
||||
|
||||
case NLPID_SNAP:
|
||||
orgcode = EXTRACT_24BITS(p);
|
||||
et = EXTRACT_16BITS(p + 3);
|
||||
if (snap_print((const u_char *)(p + 5), length - 5,
|
||||
caplen - 5, &extracted_ethertype, orgcode, et,
|
||||
0) == 0) {
|
||||
if (snap_print(p, length, length, &extracted_ethertype, 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 (!xflag && !qflag)
|
||||
default_print(p - hdr_len, caplen + hdr_len);
|
||||
if (!eflag)
|
||||
fr_hdr_print(length + hdr_len, hdr_len,
|
||||
dlci, flags, nlpid);
|
||||
if (!suppress_default_print)
|
||||
default_print(p - hdr_len, length + 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;
|
||||
|
||||
case NLPID_PPP:
|
||||
ppp_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);
|
||||
default_print(p, length);
|
||||
}
|
||||
|
||||
return hdr_len;
|
||||
|
||||
trunc:
|
||||
printf("[|fr]");
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
u_int
|
||||
mfr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
|
||||
TCHECK2(*p, 2); /* minimum frame header length */
|
||||
|
||||
if ((length = mfr_print(p, length)) == 0)
|
||||
return (0);
|
||||
else
|
||||
return length;
|
||||
trunc:
|
||||
printf("[|mfr]");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
|
||||
#define MFR_CTRL_MSG_ADD_LINK 1
|
||||
#define MFR_CTRL_MSG_ADD_LINK_ACK 2
|
||||
#define MFR_CTRL_MSG_ADD_LINK_REJ 3
|
||||
#define MFR_CTRL_MSG_HELLO 4
|
||||
#define MFR_CTRL_MSG_HELLO_ACK 5
|
||||
#define MFR_CTRL_MSG_REMOVE_LINK 6
|
||||
#define MFR_CTRL_MSG_REMOVE_LINK_ACK 7
|
||||
|
||||
struct tok mfr_ctrl_msg_values[] = {
|
||||
{ MFR_CTRL_MSG_ADD_LINK, "Add Link" },
|
||||
{ MFR_CTRL_MSG_ADD_LINK_ACK, "Add Link ACK" },
|
||||
{ MFR_CTRL_MSG_ADD_LINK_REJ, "Add Link Reject" },
|
||||
{ MFR_CTRL_MSG_HELLO, "Hello" },
|
||||
{ MFR_CTRL_MSG_HELLO_ACK, "Hello ACK" },
|
||||
{ MFR_CTRL_MSG_REMOVE_LINK, "Remove Link" },
|
||||
{ MFR_CTRL_MSG_REMOVE_LINK_ACK, "Remove Link ACK" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define MFR_CTRL_IE_BUNDLE_ID 1
|
||||
#define MFR_CTRL_IE_LINK_ID 2
|
||||
#define MFR_CTRL_IE_MAGIC_NUM 3
|
||||
#define MFR_CTRL_IE_TIMESTAMP 5
|
||||
#define MFR_CTRL_IE_VENDOR_EXT 6
|
||||
#define MFR_CTRL_IE_CAUSE 7
|
||||
|
||||
struct tok mfr_ctrl_ie_values[] = {
|
||||
{ MFR_CTRL_IE_BUNDLE_ID, "Bundle ID"},
|
||||
{ MFR_CTRL_IE_LINK_ID, "Link ID"},
|
||||
{ MFR_CTRL_IE_MAGIC_NUM, "Magic Number"},
|
||||
{ MFR_CTRL_IE_TIMESTAMP, "Timestamp"},
|
||||
{ MFR_CTRL_IE_VENDOR_EXT, "Vendor Extension"},
|
||||
{ MFR_CTRL_IE_CAUSE, "Cause"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define MFR_ID_STRING_MAXLEN 50
|
||||
|
||||
struct ie_tlv_header_t {
|
||||
u_int8_t ie_type;
|
||||
u_int8_t ie_len;
|
||||
};
|
||||
|
||||
u_int
|
||||
mfr_print(register const u_char *p, u_int length)
|
||||
{
|
||||
u_int tlen,idx,hdr_len = 0;
|
||||
u_int16_t sequence_num;
|
||||
u_int8_t ie_type,ie_len;
|
||||
const u_int8_t *tptr;
|
||||
|
||||
|
||||
/*
|
||||
* FRF.16 Link Integrity Control Frame
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | B | E | C=1| 0 0 0 0 | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | 0 0 0 0 0 0 0 0 |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | message type |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
*/
|
||||
|
||||
TCHECK2(*p, 4); /* minimum frame header length */
|
||||
|
||||
if ((p[0] & MFR_BEC_MASK) == MFR_CTRL_FRAME && p[1] == 0) {
|
||||
printf("FRF.16 Control, Flags [%s], %s, length %u",
|
||||
bittok2str(frf_flag_values,"none",(p[0] & MFR_BEC_MASK)),
|
||||
tok2str(mfr_ctrl_msg_values,"Unknown Message (0x%02x)",p[2]),
|
||||
length);
|
||||
tptr = p + 3;
|
||||
tlen = length -3;
|
||||
hdr_len = 3;
|
||||
|
||||
if (!vflag)
|
||||
return hdr_len;
|
||||
|
||||
while (tlen>sizeof(struct ie_tlv_header_t)) {
|
||||
TCHECK2(*tptr, sizeof(struct ie_tlv_header_t));
|
||||
ie_type=tptr[0];
|
||||
ie_len=tptr[1];
|
||||
|
||||
printf("\n\tIE %s (%u), length %u: ",
|
||||
tok2str(mfr_ctrl_ie_values,"Unknown",ie_type),
|
||||
ie_type,
|
||||
ie_len);
|
||||
|
||||
/* infinite loop check */
|
||||
if (ie_type == 0 || ie_len <= sizeof(struct ie_tlv_header_t))
|
||||
return hdr_len;
|
||||
|
||||
TCHECK2(*tptr,ie_len);
|
||||
tptr+=sizeof(struct ie_tlv_header_t);
|
||||
/* tlv len includes header */
|
||||
ie_len-=sizeof(struct ie_tlv_header_t);
|
||||
tlen-=sizeof(struct ie_tlv_header_t);
|
||||
|
||||
switch (ie_type) {
|
||||
|
||||
case MFR_CTRL_IE_MAGIC_NUM:
|
||||
printf("0x%08x",EXTRACT_32BITS(tptr));
|
||||
break;
|
||||
|
||||
case MFR_CTRL_IE_BUNDLE_ID: /* same message format */
|
||||
case MFR_CTRL_IE_LINK_ID:
|
||||
for (idx = 0; idx < ie_len && idx < MFR_ID_STRING_MAXLEN; idx++) {
|
||||
if (*(tptr+idx) != 0) /* don't print null termination */
|
||||
safeputchar(*(tptr+idx));
|
||||
else
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case MFR_CTRL_IE_TIMESTAMP:
|
||||
if (ie_len == sizeof(struct timeval)) {
|
||||
ts_print((const struct timeval *)tptr);
|
||||
break;
|
||||
}
|
||||
/* fall through and hexdump if no unix timestamp */
|
||||
|
||||
/*
|
||||
* FIXME those are the defined IEs that lack a decoder
|
||||
* you are welcome to contribute code ;-)
|
||||
*/
|
||||
|
||||
case MFR_CTRL_IE_VENDOR_EXT:
|
||||
case MFR_CTRL_IE_CAUSE:
|
||||
|
||||
default:
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(tptr,"\n\t ",ie_len);
|
||||
break;
|
||||
}
|
||||
|
||||
/* do we want to see a hexdump of the IE ? */
|
||||
if (vflag > 1 )
|
||||
print_unknown_data(tptr,"\n\t ",ie_len);
|
||||
|
||||
tlen-=ie_len;
|
||||
tptr+=ie_len;
|
||||
}
|
||||
return hdr_len;
|
||||
}
|
||||
/*
|
||||
* FRF.16 Fragmentation Frame
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | B | E | C=0|seq. (high 4 bits) | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | sequence (low 8 bits) |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | DLCI (6 bits) | CR | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
* | DLCI (4 bits) |FECN|BECN| DE | EA |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
*/
|
||||
|
||||
sequence_num = (p[0]&0x1e)<<7 | p[1];
|
||||
/* whole packet or first fragment ? */
|
||||
if ((p[0] & MFR_BEC_MASK) == MFR_FRAG_FRAME ||
|
||||
(p[0] & MFR_BEC_MASK) == MFR_B_BIT) {
|
||||
printf("FRF.16 Frag, seq %u, Flags [%s], ",
|
||||
sequence_num,
|
||||
bittok2str(frf_flag_values,"none",(p[0] & MFR_BEC_MASK)));
|
||||
hdr_len = 2;
|
||||
fr_print(p+hdr_len,length-hdr_len);
|
||||
return hdr_len;
|
||||
}
|
||||
|
||||
/* must be a middle or the last fragment */
|
||||
printf("FRF.16 Frag, seq %u, Flags [%s]",
|
||||
sequence_num,
|
||||
bittok2str(frf_flag_values,"none",(p[0] & MFR_BEC_MASK)));
|
||||
print_unknown_data(p,"\n\t",length);
|
||||
|
||||
return hdr_len;
|
||||
|
||||
trunc:
|
||||
printf("[|mfr]");
|
||||
return length;
|
||||
}
|
||||
|
||||
/* 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) |
|
||||
* +----+----+----+----+----+----+----+----+
|
||||
*/
|
||||
|
||||
#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]&MFR_BEC_MASK;
|
||||
sequence_num = (p[0]&0x1e)<<7 | p[1];
|
||||
|
||||
printf("FRF.15, seq 0x%03x, Flags [%s],%s Fragmentation, length %u",
|
||||
sequence_num,
|
||||
bittok2str(frf_flag_values,"none",flags),
|
||||
p[0]&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
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -342,148 +618,240 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
#define MSG_TYPE_STATUS 0x7D
|
||||
#define MSG_TYPE_STATUS_ENQ 0x75
|
||||
|
||||
#define MSG_ANSI_LOCKING_SHIFT 0x95
|
||||
#define ONE_BYTE_IE_MASK 0xF0 /* details? */
|
||||
|
||||
#define ANSI_REPORT_TYPE_IE 0x01
|
||||
#define ANSI_LINK_VERIFY_IE_91 0x19 /* details? */
|
||||
#define ANSI_LINK_VERIFY_IE 0x03
|
||||
#define ANSI_PVC_STATUS_IE 0x07
|
||||
|
||||
#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;
|
||||
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 FULL_STATUS 0
|
||||
#define LINK_VERIFY 1
|
||||
#define ASYNC_PVC 2
|
||||
#define MSG_ANSI_LOCKING_SHIFT 0x95
|
||||
|
||||
#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
|
||||
|
||||
/* 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;
|
||||
#define FR_LMI_CCITT_REPORT_TYPE_IE 0x51
|
||||
#define FR_LMI_CCITT_LINK_VERIFY_IE 0x53
|
||||
#define FR_LMI_CCITT_PVC_STATUS_IE 0x57
|
||||
|
||||
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";
|
||||
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 }
|
||||
};
|
||||
|
||||
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);
|
||||
#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
|
||||
|
||||
snprintf(buffer, buffer_len, "DLCI %d: status %s%s", dlci,
|
||||
p[ie_len - 1] & 0x8 ? "New, " : "",
|
||||
p[ie_len - 1] & 0x2 ? "Active" : "Inactive");
|
||||
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 }
|
||||
};
|
||||
|
||||
return buffer;
|
||||
}
|
||||
/* array of 16 codepages - currently we only support codepage 1,5 */
|
||||
static struct tok *fr_q933_ie_codesets[] = {
|
||||
NULL,
|
||||
fr_q933_ie_values_codeset5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
fr_q933_ie_values_codeset5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int fr_q933_print_ie_codeset5(const struct ie_tlv_header_t *ie_p,
|
||||
const u_char *p);
|
||||
|
||||
static void
|
||||
lmi_print(const u_char *p, u_int length)
|
||||
typedef int (*codeset_pr_func_t)(const struct ie_tlv_header_t *ie_p,
|
||||
const u_char *p);
|
||||
|
||||
/* array of 16 codepages - currently we only support codepage 1,5 */
|
||||
static codeset_pr_func_t fr_q933_print_ie_codeset[] = {
|
||||
NULL,
|
||||
fr_q933_print_ie_codeset5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
fr_q933_print_ie_codeset5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
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;
|
||||
struct ie_tlv_header_t *ie_p;
|
||||
int olen;
|
||||
int is_ansi = 0;
|
||||
u_int codeset;
|
||||
u_int ie_is_known = 0;
|
||||
|
||||
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("%s, codeset %u", is_ansi ? "ANSI" : "CCITT", codeset);
|
||||
|
||||
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) {
|
||||
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;
|
||||
while (length > sizeof(struct ie_tlv_header_t )) {
|
||||
ie_p = (struct ie_tlv_header_t *)ptemp;
|
||||
if (length < sizeof(struct ie_tlv_header_t ) ||
|
||||
length < sizeof(struct ie_tlv_header_t ) + ie_p->ie_len) {
|
||||
if (vflag) /* not bark if there is just a trailer */
|
||||
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 (0x%02x), length %u: ",
|
||||
tok2str(fr_q933_ie_codesets[codeset],"unknown",ie_p->ie_type),
|
||||
ie_p->ie_type,
|
||||
ie_p->ie_len);
|
||||
|
||||
/* sanity check */
|
||||
if (ie_p->ie_type == 0 || ie_p->ie_len == 0)
|
||||
return;
|
||||
|
||||
case FULL_STATUS:
|
||||
decode_str = "FULL STATUS";
|
||||
break;
|
||||
if (fr_q933_print_ie_codeset[codeset] != NULL)
|
||||
ie_is_known = fr_q933_print_ie_codeset[codeset](ie_p, ptemp);
|
||||
|
||||
if (vflag >= 1 && !ie_is_known)
|
||||
print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len);
|
||||
|
||||
case LINK_VERIFY:
|
||||
decode_str = "LINK VERIFY";
|
||||
break;
|
||||
/* do we want to see a hexdump of the IE ? */
|
||||
if (vflag> 1 && ie_is_known)
|
||||
print_unknown_data(ptemp+2,"\n\t ",ie_p->ie_len);
|
||||
|
||||
case ASYNC_PVC:
|
||||
decode_str = "Async PVC Status";
|
||||
break;
|
||||
|
||||
default:
|
||||
decode_str = "Reserved Value";
|
||||
break;
|
||||
}
|
||||
} else if ((is_ansi && (ie_p->ie_id == ANSI_LINK_VERIFY_IE_91 ||
|
||||
ie_p->ie_id == ANSI_LINK_VERIFY_IE)) ||
|
||||
(!is_ansi && ie_p->ie_id == CCITT_LINK_VERIFY_IE)) {
|
||||
snprintf(temp_str, sizeof(temp_str),
|
||||
"TX Seq: %3d, RX Seq: %3d",
|
||||
ptemp[2], ptemp[3]);
|
||||
decode_str = temp_str;
|
||||
} else if ((is_ansi && ie_p->ie_id == ANSI_PVC_STATUS_IE) ||
|
||||
(!is_ansi && ie_p->ie_id == CCITT_PVC_STATUS_IE)) {
|
||||
decode_str = parse_dlci_ie(ptemp + 2, ie_p->ie_len,
|
||||
temp_str, sizeof(temp_str));
|
||||
} else
|
||||
decode_str = "Non-decoded Value";
|
||||
|
||||
printf("\t\tIE: %02X Len: %d, %s\n",
|
||||
ie_p->ie_id, ie_p->ie_len, decode_str);
|
||||
length = length - ie_p->ie_len - 2;
|
||||
ptemp = ptemp + ie_p->ie_len + 2;
|
||||
}
|
||||
if (!vflag)
|
||||
printf(", length %u",olen);
|
||||
}
|
||||
|
||||
static int
|
||||
fr_q933_print_ie_codeset5(const struct ie_tlv_header_t *ie_p, const u_char *p)
|
||||
{
|
||||
u_int dlci;
|
||||
|
||||
switch (ie_p->ie_type) {
|
||||
|
||||
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",p[2]),
|
||||
p[2]);
|
||||
return 1;
|
||||
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE: /* fall through */
|
||||
case FR_LMI_CCITT_LINK_VERIFY_IE:
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE_91:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
printf("TX Seq: %3d, RX Seq: %3d", p[2], p[3]);
|
||||
return 1;
|
||||
|
||||
case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
|
||||
case FR_LMI_CCITT_PVC_STATUS_IE:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
/* now parse the DLCI information element. */
|
||||
if ((ie_p->ie_len < 3) ||
|
||||
(p[2] & 0x80) ||
|
||||
((ie_p->ie_len == 3) && !(p[3] & 0x80)) ||
|
||||
((ie_p->ie_len == 4) && ((p[3] & 0x80) || !(p[4] & 0x80))) ||
|
||||
((ie_p->ie_len == 5) && ((p[3] & 0x80) || (p[4] & 0x80) ||
|
||||
!(p[5] & 0x80))) ||
|
||||
(ie_p->ie_len > 5) ||
|
||||
!(p[ie_p->ie_len + 1] & 0x80))
|
||||
printf("Invalid DLCI IE");
|
||||
|
||||
dlci = ((p[2] & 0x3F) << 4) | ((p[3] & 0x78) >> 3);
|
||||
if (ie_p->ie_len == 4)
|
||||
dlci = (dlci << 6) | ((p[4] & 0x7E) >> 1);
|
||||
else if (ie_p->ie_len == 5)
|
||||
dlci = (dlci << 13) | (p[4] & 0x7F) | ((p[5] & 0x7E) >> 1);
|
||||
|
||||
printf("DLCI %u: status %s%s", dlci,
|
||||
p[ie_p->ie_len + 1] & 0x8 ? "New, " : "",
|
||||
p[ie_p->ie_len + 1] & 0x2 ? "Active" : "Inactive");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
10
dist/tcpdump/print-ipfc.c
vendored
10
dist/tcpdump/print-ipfc.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-ipfc.c,v 1.1.1.1 2004/09/27 17:07:07 dyoung Exp $ */
|
||||
/* $NetBSD: print-ipfc.c,v 1.1.1.2 2007/07/24 11:42:59 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
@ -23,7 +23,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.2.2 2005/11/13 12:12:59 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -103,8 +103,6 @@ ipfc_print(const u_char *p, u_int length, u_int caplen)
|
||||
p += IPFC_HDRLEN;
|
||||
caplen -= IPFC_HDRLEN;
|
||||
|
||||
/* Frame Control field determines interpretation of packet */
|
||||
extracted_ethertype = 0;
|
||||
/* Try to print the LLC-layer header & higher layers */
|
||||
if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
|
||||
&extracted_ethertype) == 0) {
|
||||
@ -119,7 +117,7 @@ ipfc_print(const u_char *p, u_int length, u_int caplen)
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
}
|
||||
if (!xflag && !qflag)
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
}
|
||||
@ -127,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
|
||||
|
1034
dist/tcpdump/print-juniper.c
vendored
Normal file
1034
dist/tcpdump/print-juniper.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
292
dist/tcpdump/print-ldp.c
vendored
292
dist/tcpdump/print-ldp.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-ldp.c,v 1.1.1.1 2004/09/27 17:07:12 dyoung Exp $ */
|
||||
/* $NetBSD: print-ldp.c,v 1.1.1.2 2007/07/24 11:43:14 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -13,11 +13,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.2.10 2007/02/26 13:31:33 hannes Exp";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,8 +32,12 @@ static const char rcsid[] _U_ =
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "decode_prefix.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "af.h"
|
||||
|
||||
#include "l2vpn.h"
|
||||
|
||||
/*
|
||||
* ldp common header
|
||||
@ -114,7 +119,7 @@ static const struct tok ldp_msg_values[] = {
|
||||
{ LDP_MSG_INIT, "Initialization" },
|
||||
{ LDP_MSG_KEEPALIVE, "Keepalive" },
|
||||
{ LDP_MSG_ADDRESS, "Address" },
|
||||
{ LDP_MSG_ADDRESS_WITHDRAW, "Address Widthdraw" },
|
||||
{ LDP_MSG_ADDRESS_WITHDRAW, "Address Withdraw" },
|
||||
{ LDP_MSG_LABEL_MAPPING, "Label Mapping" },
|
||||
{ LDP_MSG_LABEL_REQUEST, "Label Request" },
|
||||
{ LDP_MSG_LABEL_WITHDRAW, "Label Withdraw" },
|
||||
@ -144,6 +149,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[] = {
|
||||
@ -165,13 +171,55 @@ 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 FALSE 0
|
||||
#define TRUE 1
|
||||
#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}
|
||||
};
|
||||
|
||||
#define LDP_FEC_MARTINI_IFPARM_MTU 0x01
|
||||
#define LDP_FEC_MARTINI_IFPARM_DESC 0x03
|
||||
#define LDP_FEC_MARTINI_IFPARM_VCCV 0x0c
|
||||
|
||||
static const struct tok ldp_fec_martini_ifparm_values[] = {
|
||||
{ LDP_FEC_MARTINI_IFPARM_MTU, "MTU" },
|
||||
{ LDP_FEC_MARTINI_IFPARM_DESC, "Description" },
|
||||
{ LDP_FEC_MARTINI_IFPARM_VCCV, "VCCV" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* draft-ietf-pwe3-vccv-04.txt */
|
||||
static const struct tok ldp_fec_martini_ifparm_vccv_cc_values[] = {
|
||||
{ 0x01, "PWE3 control word" },
|
||||
{ 0x02, "MPLS Router Alert Label" },
|
||||
{ 0x04, "MPLS inner label TTL = 1" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* draft-ietf-pwe3-vccv-04.txt */
|
||||
static const struct tok ldp_fec_martini_ifparm_vccv_cv_values[] = {
|
||||
{ 0x01, "ICMP Ping" },
|
||||
{ 0x02, "LSP Ping" },
|
||||
{ 0x04, "BFD" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
#define AFNUM_LEN 2
|
||||
|
||||
int ldp_msg_print(register const u_char *);
|
||||
int ldp_tlv_print(register const u_char *);
|
||||
|
||||
/*
|
||||
@ -200,7 +248,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,vc_info_len, vc_info_tlv_type, vc_info_tlv_len,idx;
|
||||
char buf[100];
|
||||
int i;
|
||||
|
||||
ldp_tlv_header = (const struct ldp_tlv_header *)tptr;
|
||||
tlv_len=EXTRACT_16BITS(ldp_tlv_header->length);
|
||||
@ -240,23 +292,179 @@ 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+=AFNUM_LEN;
|
||||
tlv_tlen -= AFNUM_LEN;
|
||||
printf("\n\t Address Family: ");
|
||||
if (af == AFNUM_INET) {
|
||||
printf("IPv4, addresses:");
|
||||
while(tlv_tlen >= sizeof(struct in_addr)) {
|
||||
printf(" %s",ipaddr_string(tptr));
|
||||
tlv_tlen-=sizeof(struct in_addr);
|
||||
tptr+=sizeof(struct in_addr);
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (af == AFNUM_INET6) {
|
||||
printf("IPv6, addresses:");
|
||||
while(tlv_tlen >= sizeof(struct in6_addr)) {
|
||||
printf(" %s",ip6addr_string(tptr));
|
||||
tlv_tlen-=sizeof(struct in6_addr);
|
||||
tptr+=sizeof(struct in6_addr);
|
||||
}
|
||||
}
|
||||
#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:
|
||||
if (!TTEST2(*tptr, 11))
|
||||
goto trunc;
|
||||
vc_info_len = *(tptr+2);
|
||||
|
||||
printf(": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u",
|
||||
tok2str(l2vpn_encaps_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
|
||||
EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ",
|
||||
EXTRACT_32BITS(tptr+3),
|
||||
EXTRACT_32BITS(tptr+7),
|
||||
vc_info_len);
|
||||
|
||||
if (vc_info_len == 0) /* infinite loop protection */
|
||||
break;
|
||||
|
||||
tptr+=11;
|
||||
if (!TTEST2(*tptr, vc_info_len))
|
||||
goto trunc;
|
||||
|
||||
while (vc_info_len > 2) {
|
||||
vc_info_tlv_type = *tptr;
|
||||
vc_info_tlv_len = *(tptr+1);
|
||||
if (vc_info_tlv_len < 2)
|
||||
break;
|
||||
if (vc_info_len < vc_info_tlv_len)
|
||||
break;
|
||||
|
||||
printf("\n\t\tInterface Parameter: %s (0x%02x), len %u",
|
||||
tok2str(ldp_fec_martini_ifparm_values,"Unknown",vc_info_tlv_type),
|
||||
vc_info_tlv_type,
|
||||
vc_info_tlv_len);
|
||||
|
||||
switch(vc_info_tlv_type) {
|
||||
case LDP_FEC_MARTINI_IFPARM_MTU:
|
||||
printf(": %u",EXTRACT_16BITS(tptr+2));
|
||||
break;
|
||||
|
||||
case LDP_FEC_MARTINI_IFPARM_DESC:
|
||||
printf(": ");
|
||||
for (idx = 2; idx < vc_info_tlv_len; idx++)
|
||||
safeputchar(*(tptr+idx));
|
||||
break;
|
||||
|
||||
case LDP_FEC_MARTINI_IFPARM_VCCV:
|
||||
printf("\n\t\t Control Channels (0x%02x) = [%s]",
|
||||
*(tptr+2),
|
||||
bittok2str(ldp_fec_martini_ifparm_vccv_cc_values,"none",*(tptr+2)));
|
||||
printf("\n\t\t CV Types (0x%02x) = [%s]",
|
||||
*(tptr+3),
|
||||
bittok2str(ldp_fec_martini_ifparm_vccv_cv_values,"none",*(tptr+3)));
|
||||
break;
|
||||
|
||||
default:
|
||||
print_unknown_data(tptr+2,"\n\t\t ",vc_info_tlv_len-2);
|
||||
break;
|
||||
}
|
||||
|
||||
vc_info_len -= vc_info_tlv_len;
|
||||
tptr += vc_info_tlv_len;
|
||||
}
|
||||
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:
|
||||
@ -267,16 +475,34 @@ ldp_tlv_print(register const u_char *tptr) {
|
||||
break;
|
||||
}
|
||||
return(tlv_len+4); /* Type & Length fields not included */
|
||||
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ldp_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
int processed;
|
||||
while (len > (sizeof(struct ldp_common_header) + sizeof(struct ldp_msg_header))) {
|
||||
processed = ldp_msg_print(pptr);
|
||||
if (processed == 0)
|
||||
return;
|
||||
len -= processed;
|
||||
pptr += processed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ldp_msg_print(register const u_char *pptr) {
|
||||
|
||||
const struct ldp_common_header *ldp_com_header;
|
||||
const struct ldp_msg_header *ldp_msg_header;
|
||||
const u_char *tptr,*msg_tptr;
|
||||
u_short tlen;
|
||||
u_short msg_len,msg_type,msg_tlen;
|
||||
u_short pdu_len,msg_len,msg_type,msg_tlen;
|
||||
int hexdump,processed;
|
||||
|
||||
tptr=pptr;
|
||||
@ -287,27 +513,29 @@ ldp_print(register const u_char *pptr, register u_int len) {
|
||||
* Sanity checking of the header.
|
||||
*/
|
||||
if (EXTRACT_16BITS(&ldp_com_header->version) != LDP_VERSION) {
|
||||
printf("LDP version %u packet not supported",
|
||||
printf("%sLDP version %u packet not supported",
|
||||
(vflag < 1) ? "" : "\n\t",
|
||||
EXTRACT_16BITS(&ldp_com_header->version));
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* print the LSR-ID, label-space & length */
|
||||
printf("%sLDP, Label-Space-ID: %s:%u, length: %u",
|
||||
pdu_len = EXTRACT_16BITS(&ldp_com_header->pdu_length);
|
||||
printf("%sLDP, Label-Space-ID: %s:%u, pdu-length: %u",
|
||||
(vflag < 1) ? "" : "\n\t",
|
||||
ipaddr_string(&ldp_com_header->lsr_id),
|
||||
EXTRACT_16BITS(&ldp_com_header->label_space),
|
||||
len);
|
||||
pdu_len);
|
||||
|
||||
/* bail out if non-verbose */
|
||||
if (vflag < 1)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* ok they seem to want to know everything - lets fully decode it */
|
||||
tlen=EXTRACT_16BITS(ldp_com_header->pdu_length);
|
||||
tlen=pdu_len;
|
||||
|
||||
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 ? */
|
||||
@ -328,6 +556,9 @@ ldp_print(register const u_char *pptr, register u_int len) {
|
||||
EXTRACT_32BITS(&ldp_msg_header->id),
|
||||
LDP_MASK_U_BIT(EXTRACT_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore");
|
||||
|
||||
if (msg_len == 0) /* infinite loop protection */
|
||||
return 0;
|
||||
|
||||
msg_tptr=tptr+sizeof(struct ldp_msg_header);
|
||||
msg_tlen=msg_len-sizeof(struct ldp_msg_header)+4; /* Type & Length fields not included */
|
||||
|
||||
@ -338,7 +569,14 @@ 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:
|
||||
case LDP_MSG_ADDRESS_WITHDRAW:
|
||||
case LDP_MSG_LABEL_WITHDRAW:
|
||||
while(msg_tlen >= 4) {
|
||||
processed = ldp_tlv_print(msg_tptr);
|
||||
if (processed == 0)
|
||||
@ -353,14 +591,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:
|
||||
case LDP_MSG_LABEL_ABORT_REQUEST:
|
||||
|
||||
@ -374,11 +605,12 @@ 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;
|
||||
return pdu_len+4;
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
883
dist/tcpdump/print-lmp.c
vendored
Normal file
883
dist/tcpdump/print-lmp.c
vendored
Normal file
@ -0,0 +1,883 @@
|
||||
/* $NetBSD: print-lmp.c,v 1.1.1.1 2007/07/24 11:43:05 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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)
|
||||
* Support for LMP service discovery extensions (defined by UNI 1.0) added
|
||||
* by Manu Pathak (mapathak@cisco.com), May 2005
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.5.2.4 2006/06/23 02:07:27 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[] = {
|
||||
{ 0x01, "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}
|
||||
};
|
||||
|
||||
/* Service Config Supported Protocols Flags */
|
||||
static const struct tok lmp_obj_service_config_sp_flag_values[] = {
|
||||
{ 0x01, "RSVP Supported"},
|
||||
{ 0x02, "LDP Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Client Port Service Attribute Transparency Flags */
|
||||
static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
|
||||
{ 0x01, "Path/VC Overhead Transparency Supported"},
|
||||
{ 0x02, "Line/MS Overhead Transparency Supported"},
|
||||
{ 0x04, "Section/RS Overhead Transparency Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
|
||||
static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
|
||||
{ 0x01, "Contiguous Concatenation Types Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Network Service Attributes Transparency Flags */
|
||||
static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
|
||||
{ 0x01, "Standard SOH/RSOH Transparency Supported"},
|
||||
{ 0x02, "Standard LOH/MSOH Transparency Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Network Service Attributes TCM Monitoring Flags */
|
||||
static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
|
||||
{ 0x01, "Transparent Tandem Connection Monitoring Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Network Service Attributes Network Diversity Flags */
|
||||
static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
|
||||
{ 0x01, "Node Diversity Supported"},
|
||||
{ 0x02, "Link Diversity Supported"},
|
||||
{ 0x04, "SRLG Diversity Supported"},
|
||||
{ 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
|
||||
/* LMP Service Discovery message types defined by UNI 1.0 */
|
||||
#define LMP_MSGTYPE_SERVICE_CONFIG 50
|
||||
#define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
|
||||
#define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
|
||||
|
||||
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"},
|
||||
{ LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
|
||||
{ LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
|
||||
{ LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
|
||||
{ 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
|
||||
|
||||
#define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
|
||||
|
||||
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" },
|
||||
{ LMP_OBJ_SERVICE_CONFIG, "Service Config" },
|
||||
|
||||
{ 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
|
||||
|
||||
/* C-Types for Service Config Object */
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_SP 1
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
|
||||
|
||||
/*
|
||||
* Different link types allowed in the Client Port Service Attributes
|
||||
* subobject defined for LMP Service Discovery in the UNI 1.0 spec
|
||||
*/
|
||||
#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
|
||||
#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
|
||||
|
||||
/*
|
||||
* 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" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
|
||||
{ 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;
|
||||
int link_type;
|
||||
|
||||
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 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 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 Min Reservable Bandwidth: %.3f Mbps",
|
||||
bw.f*8/1000000);
|
||||
bw.i = EXTRACT_32BITS(obj_tptr+offset+8);
|
||||
printf("\n\t Max Reservable Bandwidth: %.3f Mbps",
|
||||
bw.f*8/1000000);
|
||||
break;
|
||||
case WAVELENGTH_SUBOBJ:
|
||||
printf("\n\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*8/1000000);
|
||||
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;
|
||||
|
||||
case LMP_OBJ_SERVICE_CONFIG:
|
||||
switch (lmp_obj_ctype) {
|
||||
case LMP_CTYPE_SERVICE_CONFIG_SP:
|
||||
|
||||
printf("\n\t Flags: %s",
|
||||
bittok2str(lmp_obj_service_config_sp_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr)>>8));
|
||||
|
||||
printf("\n\t UNI Version: %u",
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF);
|
||||
|
||||
break;
|
||||
|
||||
case LMP_CTYPE_SERVICE_CONFIG_CPSA:
|
||||
|
||||
link_type = EXTRACT_16BITS(obj_tptr)>>8;
|
||||
|
||||
printf("\n\t Link Type: %s (%u)",
|
||||
tok2str(lmp_sd_service_config_cpsa_link_type_values,
|
||||
"Unknown", link_type),
|
||||
link_type);
|
||||
|
||||
if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH) {
|
||||
printf("\n\t Signal Type: %s (%u)",
|
||||
tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
|
||||
"Unknown",
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF),
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF);
|
||||
}
|
||||
|
||||
if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET) {
|
||||
printf("\n\t Signal Type: %s (%u)",
|
||||
tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
|
||||
"Unknown",
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF),
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF);
|
||||
}
|
||||
|
||||
printf("\n\t Transparency: %s",
|
||||
bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+2)>>8));
|
||||
|
||||
printf("\n\t Contiguous Concatenation Types: %s",
|
||||
bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+2)>>8 & 0x00FF));
|
||||
|
||||
printf("\n\t Minimum NCC: %u",
|
||||
EXTRACT_16BITS(obj_tptr+4));
|
||||
|
||||
printf("\n\t Maximum NCC: %u",
|
||||
EXTRACT_16BITS(obj_tptr+6));
|
||||
|
||||
printf("\n\t Minimum NVC:%u",
|
||||
EXTRACT_16BITS(obj_tptr+8));
|
||||
|
||||
printf("\n\t Maximum NVC:%u",
|
||||
EXTRACT_16BITS(obj_tptr+10));
|
||||
|
||||
printf("\n\t Local Interface ID: %s (0x%08x)",
|
||||
ipaddr_string(obj_tptr+12),
|
||||
EXTRACT_32BITS(obj_tptr+12));
|
||||
|
||||
break;
|
||||
|
||||
case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
|
||||
|
||||
printf("\n\t Transparency Flags: %s",
|
||||
bittok2str(
|
||||
lmp_obj_service_config_nsa_transparency_flag_values,
|
||||
"none",
|
||||
EXTRACT_32BITS(obj_tptr)));
|
||||
|
||||
printf("\n\t TCM Monitoring Flags: %s",
|
||||
bittok2str(
|
||||
lmp_obj_service_config_nsa_tcm_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+6) & 0x00FF));
|
||||
|
||||
break;
|
||||
|
||||
case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
|
||||
|
||||
printf("\n\t Diversity: Flags: %s",
|
||||
bittok2str(
|
||||
lmp_obj_service_config_nsa_network_diversity_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+2) & 0x00FF));
|
||||
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");
|
||||
}
|
869
dist/tcpdump/print-lspping.c
vendored
Normal file
869
dist/tcpdump/print-lspping.c
vendored
Normal file
@ -0,0 +1,869 @@
|
||||
/* $NetBSD: print-lspping.c,v 1.1.1.1 2007/07/24 11:43:03 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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.2.6 2006/06/23 02:07:27 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
|
||||
|
||||
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_BFD_DISCRIMINATOR 15 /* draft-ietf-bfd-mpls-02 */
|
||||
#define LSPPING_TLV_BFD_DISCRIMINATOR_LEN 4
|
||||
#define LSPPING_TLV_VENDOR_PRIVATE 0xfc00
|
||||
|
||||
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_BFD_DISCRIMINATOR, "BFD Discriminator" },
|
||||
{ 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), length: %u\n\t 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,
|
||||
len,
|
||||
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)\n\t 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)\n\t 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;
|
||||
|
||||
case LSPPING_TLV_BFD_DISCRIMINATOR:
|
||||
tptr += sizeof(struct lspping_tlv_header);
|
||||
if (!TTEST2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN))
|
||||
goto trunc;
|
||||
printf("\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr));
|
||||
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+sizeof(struct lspping_tlv_header);
|
||||
tlen-=lspping_tlv_len+sizeof(struct lspping_tlv_header);
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
}
|
8
dist/tcpdump/print-mobility.c
vendored
8
dist/tcpdump/print-mobility.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-mobility.c,v 1.1.1.1 2004/09/27 17:07:14 dyoung Exp $ */
|
||||
/* $NetBSD: print-mobility.c,v 1.1.1.2 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 WIDE Project.
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.9.2.2 2003/11/16 08:51:33 guy Exp";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.11.2.1 2005/04/20 22:21:16 guy Exp";
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
@ -170,15 +170,13 @@ trunc:
|
||||
* Mobility Header
|
||||
*/
|
||||
int
|
||||
mobility_print(const u_char *bp, const u_char *bp2)
|
||||
mobility_print(const u_char *bp, const u_char *bp2 _U_)
|
||||
{
|
||||
const struct ip6_mobility *mh;
|
||||
const struct ip6_hdr *ip6;
|
||||
const u_char *ep;
|
||||
int mhlen, hlen, type;
|
||||
|
||||
mh = (struct ip6_mobility *)bp;
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
399
dist/tcpdump/print-olsr.c
vendored
Normal file
399
dist/tcpdump/print-olsr.c
vendored
Normal file
@ -0,0 +1,399 @@
|
||||
/* $NetBSD: print-olsr.c,v 1.1.1.1 2007/07/24 11:42:51 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2007 The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Optimized Link State Protocl (OLSR) as per rfc3626
|
||||
*
|
||||
* Original code by Hannes Gredler <hannes@juniper.net>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
#include "ip.h"
|
||||
|
||||
/*
|
||||
* RFC 3626 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
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Packet Length | Packet Sequence Number |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Message Type | Vtime | Message Size |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Originator Address |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Time To Live | Hop Count | Message Sequence Number |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | |
|
||||
* : MESSAGE :
|
||||
* | |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Message Type | Vtime | Message Size |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Originator Address |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Time To Live | Hop Count | Message Sequence Number |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | |
|
||||
* : MESSAGE :
|
||||
* | |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* : :
|
||||
*/
|
||||
|
||||
struct olsr_common {
|
||||
u_int8_t packet_len[2];
|
||||
u_int8_t packet_seq[2];
|
||||
};
|
||||
|
||||
#define OLSR_HELLO_MSG 1 /* rfc3626 */
|
||||
#define OLSR_TC_MSG 2 /* rfc3626 */
|
||||
#define OLSR_MID_MSG 3 /* rfc3626 */
|
||||
#define OLSR_HNA_MSG 4 /* rfc3626 */
|
||||
#define OLSR_POWERINFO_MSG 128
|
||||
#define OLSR_NAMESERVICE_MSG 130
|
||||
#define OLSR_HELLO_LQ_MSG 201 /* LQ extensions olsr.org */
|
||||
#define OLSR_TC_LQ_MSG 202 /* LQ extensions olsr.org */
|
||||
|
||||
static struct tok olsr_msg_values[] = {
|
||||
{ OLSR_HELLO_MSG, "Hello" },
|
||||
{ OLSR_TC_MSG, "TC" },
|
||||
{ OLSR_MID_MSG, "MID" },
|
||||
{ OLSR_HNA_MSG, "HNA" },
|
||||
{ OLSR_POWERINFO_MSG, "Powerinfo" },
|
||||
{ OLSR_NAMESERVICE_MSG, "Nameservice" },
|
||||
{ OLSR_HELLO_LQ_MSG, "Hello-LQ" },
|
||||
{ OLSR_TC_LQ_MSG, "TC-LQ" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct olsr_msg {
|
||||
u_int8_t msg_type;
|
||||
u_int8_t vtime;
|
||||
u_int8_t msg_len[2];
|
||||
u_int8_t originator[4];
|
||||
u_int8_t ttl;
|
||||
u_int8_t hopcount;
|
||||
u_int8_t msg_seq[2];
|
||||
};
|
||||
|
||||
struct olsr_hello {
|
||||
u_int8_t res[2];
|
||||
u_int8_t htime;
|
||||
u_int8_t will;
|
||||
};
|
||||
|
||||
struct olsr_hello_link {
|
||||
u_int8_t link_code;
|
||||
u_int8_t res;
|
||||
u_int8_t len[2];
|
||||
};
|
||||
|
||||
struct olsr_tc {
|
||||
u_int8_t ans_seq[2];
|
||||
u_int8_t res[2];
|
||||
};
|
||||
|
||||
struct olsr_hna {
|
||||
u_int8_t network[4];
|
||||
u_int8_t mask[4];
|
||||
};
|
||||
|
||||
|
||||
#define OLSR_EXTRACT_LINK_TYPE(link_code) (link_code & 0x3)
|
||||
#define OLSR_EXTRACT_NEIGHBOR_TYPE(link_code) (link_code >> 2)
|
||||
|
||||
static struct tok olsr_link_type_values[] = {
|
||||
{ 0, "Unspecified" },
|
||||
{ 1, "Asymmetric" },
|
||||
{ 2, "Symmetric" },
|
||||
{ 3, "Lost" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
static struct tok olsr_neighbor_type_values[] = {
|
||||
{ 0, "Not-Neighbor" },
|
||||
{ 1, "Symmetric" },
|
||||
{ 2, "Symmetric-MPR" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct olsr_lq_neighbor {
|
||||
u_int8_t neighbor[4];
|
||||
u_int8_t link_quality;
|
||||
u_int8_t neighbor_link_quality;
|
||||
u_int8_t res[2];
|
||||
};
|
||||
|
||||
/*
|
||||
* macro to convert the 8-bit mantissa/exponent to a double float
|
||||
* taken from olsr.org.
|
||||
*/
|
||||
#define VTIME_SCALE_FACTOR 0.0625
|
||||
#define ME_TO_DOUBLE(me) \
|
||||
(double)(VTIME_SCALE_FACTOR*(1+(double)(me>>4)/16)*(double)(1<<(me&0x0F)))
|
||||
|
||||
/*
|
||||
* print a neighbor list with LQ extensions.
|
||||
*/
|
||||
static void
|
||||
olsr_print_lq_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
struct olsr_lq_neighbor *lq_neighbor;
|
||||
|
||||
while (hello_len >= sizeof(struct olsr_lq_neighbor)) {
|
||||
|
||||
lq_neighbor = (struct olsr_lq_neighbor *)msg_data;
|
||||
|
||||
printf("\n\t neighbor %s, link-quality %.2lf%%"
|
||||
", neighbor-link-quality %.2lf%%",
|
||||
ipaddr_string(lq_neighbor->neighbor),
|
||||
((double)lq_neighbor->link_quality/2.55),
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55));
|
||||
|
||||
msg_data += sizeof(struct olsr_lq_neighbor);
|
||||
hello_len -= sizeof(struct olsr_lq_neighbor);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* print a neighbor list.
|
||||
*/
|
||||
static void
|
||||
olsr_print_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
int neighbor;
|
||||
|
||||
printf("\n\t neighbor\n\t\t");
|
||||
neighbor = 1;
|
||||
|
||||
while (hello_len >= sizeof(struct in_addr)) {
|
||||
|
||||
/* print 4 neighbors per line */
|
||||
|
||||
printf("%s%s", ipaddr_string(msg_data),
|
||||
neighbor % 4 == 0 ? "\n\t\t" : " ");
|
||||
|
||||
msg_data += sizeof(struct in_addr);
|
||||
hello_len -= sizeof(struct in_addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
olsr_print (const u_char *pptr, u_int length)
|
||||
{
|
||||
union {
|
||||
const struct olsr_common *common;
|
||||
const struct olsr_msg *msg;
|
||||
const struct olsr_hello *hello;
|
||||
const struct olsr_hello_link *hello_link;
|
||||
const struct olsr_lq_neighbor *lq_neighbor;
|
||||
const struct olsr_tc *tc;
|
||||
const struct olsr_hna *hna;
|
||||
} ptr;
|
||||
|
||||
u_int msg_type, msg_len, msg_tlen, hello_len, prefix;
|
||||
u_int8_t link_type, neighbor_type;
|
||||
const u_char *tptr, *msg_data;
|
||||
|
||||
tptr = pptr;
|
||||
|
||||
if (length < sizeof(struct olsr_common)) {
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_common))) {
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
ptr.common = (struct olsr_common *)tptr;
|
||||
length = MIN(length, EXTRACT_16BITS(ptr.common->packet_len));
|
||||
|
||||
printf("OLSR, seq 0x%04x, length %u",
|
||||
EXTRACT_16BITS(ptr.common->packet_seq),
|
||||
length);
|
||||
|
||||
tptr += sizeof(struct olsr_common);
|
||||
|
||||
/*
|
||||
* In non-verbose mode, just print version.
|
||||
*/
|
||||
if (vflag < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (tptr < (pptr+length)) {
|
||||
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_msg)))
|
||||
goto trunc;
|
||||
|
||||
ptr.msg = (struct olsr_msg *)tptr;
|
||||
|
||||
msg_type = ptr.msg->msg_type;
|
||||
msg_len = EXTRACT_16BITS(ptr.msg->msg_len);
|
||||
|
||||
/* infinite loop check */
|
||||
if (msg_type == 0 || msg_len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n\t%s Message (%u), originator %s, ttl %u, hop %u"
|
||||
"\n\t vtime %.3lfs, msg-seq 0x%04x, length %u",
|
||||
tok2str(olsr_msg_values, "Unknown", msg_type),
|
||||
msg_type, ipaddr_string(ptr.msg->originator),
|
||||
ptr.msg->ttl,
|
||||
ptr.msg->hopcount,
|
||||
ME_TO_DOUBLE(ptr.msg->vtime),
|
||||
EXTRACT_16BITS(ptr.msg->msg_seq),
|
||||
msg_len);
|
||||
|
||||
msg_tlen = msg_len - sizeof(struct olsr_msg);
|
||||
msg_data = tptr + sizeof(struct olsr_msg);
|
||||
|
||||
switch (msg_type) {
|
||||
case OLSR_HELLO_MSG:
|
||||
case OLSR_HELLO_LQ_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hello = (struct olsr_hello *)msg_data;
|
||||
printf("\n\t hello-time %.3lfs, MPR willingness %u",
|
||||
ME_TO_DOUBLE(ptr.hello->htime), ptr.hello->will);
|
||||
msg_data += sizeof(struct olsr_hello);
|
||||
msg_tlen -= sizeof(struct olsr_hello);
|
||||
|
||||
while (msg_tlen >= sizeof(struct olsr_hello_link)) {
|
||||
|
||||
/*
|
||||
* link-type.
|
||||
*/
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello_link)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hello_link = (struct olsr_hello_link *)msg_data;
|
||||
|
||||
hello_len = EXTRACT_16BITS(ptr.hello_link->len);
|
||||
link_type = OLSR_EXTRACT_LINK_TYPE(ptr.hello_link->link_code);
|
||||
neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(ptr.hello_link->link_code);
|
||||
|
||||
printf("\n\t link-type %s, neighbor-type %s, len %u",
|
||||
tok2str(olsr_link_type_values, "Unknown", link_type),
|
||||
tok2str(olsr_neighbor_type_values, "Unknown", neighbor_type),
|
||||
hello_len);
|
||||
|
||||
msg_data += sizeof(struct olsr_hello_link);
|
||||
msg_tlen -= sizeof(struct olsr_hello_link);
|
||||
hello_len -= sizeof(struct olsr_hello_link);
|
||||
|
||||
if (msg_type == OLSR_HELLO_MSG) {
|
||||
olsr_print_neighbor(msg_data, hello_len);
|
||||
} else {
|
||||
olsr_print_lq_neighbor(msg_data, hello_len);
|
||||
}
|
||||
|
||||
msg_data += hello_len;
|
||||
msg_tlen -= hello_len;
|
||||
}
|
||||
break;
|
||||
|
||||
case OLSR_TC_MSG:
|
||||
case OLSR_TC_LQ_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_tc)))
|
||||
goto trunc;
|
||||
|
||||
ptr.tc = (struct olsr_tc *)msg_data;
|
||||
printf("\n\t advertised neighbor seq 0x%04x",
|
||||
EXTRACT_16BITS(ptr.tc->ans_seq));
|
||||
msg_data += sizeof(struct olsr_tc);
|
||||
msg_tlen -= sizeof(struct olsr_tc);
|
||||
|
||||
if (msg_type == OLSR_TC_MSG) {
|
||||
olsr_print_neighbor(msg_data, msg_tlen);
|
||||
} else {
|
||||
olsr_print_lq_neighbor(msg_data, msg_tlen);
|
||||
}
|
||||
break;
|
||||
|
||||
case OLSR_MID_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct in_addr)))
|
||||
goto trunc;
|
||||
|
||||
while (msg_tlen >= sizeof(struct in_addr)) {
|
||||
printf("\n\t interface address %s", ipaddr_string(msg_data));
|
||||
msg_data += sizeof(struct in_addr);
|
||||
msg_tlen -= sizeof(struct in_addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case OLSR_HNA_MSG:
|
||||
prefix = 1;
|
||||
printf("\n\t advertised networks\n\t ");
|
||||
while (msg_tlen >= sizeof(struct olsr_hna)) {
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hna)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hna = (struct olsr_hna *)msg_data;
|
||||
|
||||
/* print 4 prefixes per line */
|
||||
|
||||
printf("%s/%u%s",
|
||||
ipaddr_string(ptr.hna->network),
|
||||
mask2plen(EXTRACT_32BITS(ptr.hna->mask)),
|
||||
prefix % 4 == 0 ? "\n\t " : " ");
|
||||
|
||||
msg_data += sizeof(struct olsr_hna);
|
||||
msg_tlen -= sizeof(struct olsr_hna);
|
||||
prefix ++;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
* FIXME those are the defined messages that lack a decoder
|
||||
* you are welcome to contribute code ;-)
|
||||
*/
|
||||
|
||||
case OLSR_POWERINFO_MSG:
|
||||
case OLSR_NAMESERVICE_MSG:
|
||||
default:
|
||||
print_unknown_data(msg_data, "\n\t ", msg_tlen);
|
||||
break;
|
||||
}
|
||||
tptr += msg_len;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|olsr]");
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: whitesmith
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
761
dist/tcpdump/print-pgm.c
vendored
Normal file
761
dist/tcpdump/print-pgm.c
vendored
Normal file
@ -0,0 +1,761 @@
|
||||
/* $NetBSD: print-pgm.c,v 1.1.1.1 2007/07/24 11:43:01 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* 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 Andy Heffernan (ahh@juniper.net)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-pgm.c,v 1.1.2.5 2005/06/07 22:06:16 guy 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 "ip.h"
|
||||
#ifdef INET6
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
#include "ipproto.h"
|
||||
|
||||
/*
|
||||
* PGM header (RFC 3208)
|
||||
*/
|
||||
struct pgm_header {
|
||||
u_int16_t pgm_sport;
|
||||
u_int16_t pgm_dport;
|
||||
u_int8_t pgm_type;
|
||||
u_int8_t pgm_options;
|
||||
u_int16_t pgm_sum;
|
||||
u_int8_t pgm_gsid[6];
|
||||
u_int16_t pgm_length;
|
||||
};
|
||||
|
||||
struct pgm_spm {
|
||||
u_int32_t pgms_seq;
|
||||
u_int32_t pgms_trailseq;
|
||||
u_int32_t pgms_leadseq;
|
||||
u_int16_t pgms_nla_afi;
|
||||
u_int16_t pgms_reserved;
|
||||
/* ... u_int8_t pgms_nla[0]; */
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_nak {
|
||||
u_int32_t pgmn_seq;
|
||||
u_int16_t pgmn_source_afi;
|
||||
u_int16_t pgmn_reserved;
|
||||
/* ... u_int8_t pgmn_source[0]; */
|
||||
/* ... u_int16_t pgmn_group_afi */
|
||||
/* ... u_int16_t pgmn_reserved2; */
|
||||
/* ... u_int8_t pgmn_group[0]; */
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_poll {
|
||||
u_int32_t pgmp_seq;
|
||||
u_int16_t pgmp_round;
|
||||
u_int16_t pgmp_reserved;
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_polr {
|
||||
u_int32_t pgmp_seq;
|
||||
u_int16_t pgmp_round;
|
||||
u_int16_t pgmp_subtype;
|
||||
u_int16_t pgmp_nla_afi;
|
||||
u_int16_t pgmp_reserved;
|
||||
/* ... u_int8_t pgmp_nla[0]; */
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_data {
|
||||
u_int32_t pgmd_seq;
|
||||
u_int32_t pgmd_trailseq;
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
typedef enum _pgm_type {
|
||||
PGM_SPM = 0, /* source path message */
|
||||
PGM_POLL = 1, /* POLL Request */
|
||||
PGM_POLR = 2, /* POLL Response */
|
||||
PGM_ODATA = 4, /* original data */
|
||||
PGM_RDATA = 5, /* repair data */
|
||||
PGM_NAK = 8, /* NAK */
|
||||
PGM_NULLNAK = 9, /* Null NAK */
|
||||
PGM_NCF = 10, /* NAK Confirmation */
|
||||
PGM_ACK = 11, /* ACK for congestion control */
|
||||
PGM_SPMR = 12, /* SPM request */
|
||||
PGM_MAX = 255
|
||||
} pgm_type;
|
||||
|
||||
#define PGM_OPT_BIT_PRESENT 0x01
|
||||
#define PGM_OPT_BIT_NETWORK 0x02
|
||||
#define PGM_OPT_BIT_VAR_PKTLEN 0x40
|
||||
#define PGM_OPT_BIT_PARITY 0x80
|
||||
|
||||
#define PGM_OPT_LENGTH 0x00
|
||||
#define PGM_OPT_FRAGMENT 0x01
|
||||
#define PGM_OPT_NAK_LIST 0x02
|
||||
#define PGM_OPT_JOIN 0x03
|
||||
#define PGM_OPT_NAK_BO_IVL 0x04
|
||||
#define PGM_OPT_NAK_BO_RNG 0x05
|
||||
|
||||
#define PGM_OPT_REDIRECT 0x07
|
||||
#define PGM_OPT_PARITY_PRM 0x08
|
||||
#define PGM_OPT_PARITY_GRP 0x09
|
||||
#define PGM_OPT_CURR_TGSIZE 0x0A
|
||||
#define PGM_OPT_NBR_UNREACH 0x0B
|
||||
#define PGM_OPT_PATH_NLA 0x0C
|
||||
|
||||
#define PGM_OPT_SYN 0x0D
|
||||
#define PGM_OPT_FIN 0x0E
|
||||
#define PGM_OPT_RST 0x0F
|
||||
#define PGM_OPT_CR 0x10
|
||||
#define PGM_OPT_CRQST 0x11
|
||||
|
||||
#define PGM_OPT_MASK 0x7f
|
||||
|
||||
#define PGM_OPT_END 0x80 /* end of options marker */
|
||||
|
||||
#define PGM_MIN_OPT_LEN 4
|
||||
|
||||
#ifndef AFI_IP
|
||||
#define AFI_IP 1
|
||||
#define AFI_IP6 2
|
||||
#endif
|
||||
|
||||
void
|
||||
pgm_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2)
|
||||
{
|
||||
register const struct pgm_header *pgm;
|
||||
register const struct ip *ip;
|
||||
register char ch;
|
||||
u_int16_t sport, dport;
|
||||
int addr_size;
|
||||
const void *nla;
|
||||
int nla_af;
|
||||
#ifdef INET6
|
||||
char nla_buf[INET6_ADDRSTRLEN];
|
||||
register const struct ip6_hdr *ip6;
|
||||
#else
|
||||
char nla_buf[INET_ADDRSTRLEN];
|
||||
#endif
|
||||
u_int8_t opt_type, opt_len, flags1, flags2;
|
||||
u_int32_t seq, opts_len, len, offset;
|
||||
|
||||
pgm = (struct pgm_header *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
#ifdef INET6
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
#else /* INET6 */
|
||||
if (IP_V(ip) == 6) {
|
||||
(void)printf("Can't handle IPv6");
|
||||
return;
|
||||
}
|
||||
#endif /* INET6 */
|
||||
ch = '\0';
|
||||
if (!TTEST(pgm->pgm_dport)) {
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
(void)printf("%s > %s: [|pgm]",
|
||||
ip6addr_string(&ip6->ip6_src),
|
||||
ip6addr_string(&ip6->ip6_dst));
|
||||
return;
|
||||
} else
|
||||
#endif /* INET6 */
|
||||
{
|
||||
(void)printf("%s > %s: [|pgm]",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sport = EXTRACT_16BITS(&pgm->pgm_sport);
|
||||
dport = EXTRACT_16BITS(&pgm->pgm_dport);
|
||||
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
if (ip6->ip6_nxt == IPPROTO_PGM) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ip6addr_string(&ip6->ip6_src),
|
||||
tcpport_string(sport),
|
||||
ip6addr_string(&ip6->ip6_dst),
|
||||
tcpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
tcpport_string(sport), tcpport_string(dport));
|
||||
}
|
||||
} else
|
||||
#endif /*INET6*/
|
||||
{
|
||||
if (ip->ip_p == IPPROTO_PGM) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
tcpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
tcpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
tcpport_string(sport), tcpport_string(dport));
|
||||
}
|
||||
}
|
||||
|
||||
TCHECK(*pgm);
|
||||
|
||||
(void)printf("PGM, length %u", pgm->pgm_length);
|
||||
|
||||
if (!vflag)
|
||||
return;
|
||||
|
||||
if (length > pgm->pgm_length)
|
||||
length = pgm->pgm_length;
|
||||
|
||||
(void)printf(" 0x%02x%02x%02x%02x%02x%02x ",
|
||||
pgm->pgm_gsid[0],
|
||||
pgm->pgm_gsid[1],
|
||||
pgm->pgm_gsid[2],
|
||||
pgm->pgm_gsid[3],
|
||||
pgm->pgm_gsid[4],
|
||||
pgm->pgm_gsid[5]);
|
||||
switch (pgm->pgm_type) {
|
||||
case PGM_SPM: {
|
||||
struct pgm_spm *spm;
|
||||
|
||||
spm = (struct pgm_spm *)(pgm + 1);
|
||||
TCHECK(*spm);
|
||||
|
||||
switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
nla_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
nla_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp = (u_char *) (spm + 1);
|
||||
TCHECK2(*bp, addr_size);
|
||||
nla = bp;
|
||||
bp += addr_size;
|
||||
|
||||
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
||||
(void)printf("SPM seq %u trail %u lead %u nla %s",
|
||||
EXTRACT_32BITS(&spm->pgms_seq),
|
||||
EXTRACT_32BITS(&spm->pgms_trailseq),
|
||||
EXTRACT_32BITS(&spm->pgms_leadseq),
|
||||
nla_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_POLL: {
|
||||
struct pgm_poll *poll;
|
||||
|
||||
poll = (struct pgm_poll *)(pgm + 1);
|
||||
TCHECK(*poll);
|
||||
(void)printf("POLL seq %u round %u",
|
||||
EXTRACT_32BITS(&poll->pgmp_seq),
|
||||
EXTRACT_16BITS(&poll->pgmp_round));
|
||||
bp = (u_char *) (poll + 1);
|
||||
break;
|
||||
}
|
||||
case PGM_POLR: {
|
||||
struct pgm_polr *polr;
|
||||
u_int32_t ivl, rnd, mask;
|
||||
|
||||
polr = (struct pgm_polr *)(pgm + 1);
|
||||
TCHECK(*polr);
|
||||
|
||||
switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
nla_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
nla_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp = (u_char *) (polr + 1);
|
||||
TCHECK2(*bp, addr_size);
|
||||
nla = bp;
|
||||
bp += addr_size;
|
||||
|
||||
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
||||
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
ivl = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
rnd = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
mask = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
|
||||
(void)printf("POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
|
||||
"mask 0x%08x", EXTRACT_32BITS(&polr->pgmp_seq),
|
||||
EXTRACT_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask);
|
||||
break;
|
||||
}
|
||||
case PGM_ODATA: {
|
||||
struct pgm_data *odata;
|
||||
|
||||
odata = (struct pgm_data *)(pgm + 1);
|
||||
TCHECK(*odata);
|
||||
(void)printf("ODATA trail %u seq %u",
|
||||
EXTRACT_32BITS(&odata->pgmd_trailseq),
|
||||
EXTRACT_32BITS(&odata->pgmd_seq));
|
||||
bp = (u_char *) (odata + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_RDATA: {
|
||||
struct pgm_data *rdata;
|
||||
|
||||
rdata = (struct pgm_data *)(pgm + 1);
|
||||
TCHECK(*rdata);
|
||||
(void)printf("RDATA trail %u seq %u",
|
||||
EXTRACT_32BITS(&rdata->pgmd_trailseq),
|
||||
EXTRACT_32BITS(&rdata->pgmd_seq));
|
||||
bp = (u_char *) (rdata + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_NAK:
|
||||
case PGM_NULLNAK:
|
||||
case PGM_NCF: {
|
||||
struct pgm_nak *nak;
|
||||
const void *source, *group;
|
||||
int source_af, group_af;
|
||||
#ifdef INET6
|
||||
char source_buf[INET6_ADDRSTRLEN], group_buf[INET6_ADDRSTRLEN];
|
||||
#else
|
||||
char source_buf[INET_ADDRSTRLEN], group_buf[INET_ADDRSTRLEN];
|
||||
#endif
|
||||
|
||||
nak = (struct pgm_nak *)(pgm + 1);
|
||||
TCHECK(*nak);
|
||||
|
||||
/*
|
||||
* Skip past the source, saving info along the way
|
||||
* and stopping if we don't have enough.
|
||||
*/
|
||||
switch (EXTRACT_16BITS(&nak->pgmn_source_afi)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
source_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
source_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp = (u_char *) (nak + 1);
|
||||
TCHECK2(*bp, addr_size);
|
||||
source = bp;
|
||||
bp += addr_size;
|
||||
|
||||
/*
|
||||
* Skip past the group, saving info along the way
|
||||
* and stopping if we don't have enough.
|
||||
*/
|
||||
switch (EXTRACT_16BITS(bp)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
group_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
group_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp += (2 * sizeof(u_int16_t));
|
||||
TCHECK2(*bp, addr_size);
|
||||
group = bp;
|
||||
bp += addr_size;
|
||||
|
||||
/*
|
||||
* Options decoding can go here.
|
||||
*/
|
||||
inet_ntop(source_af, source, source_buf, sizeof(source_buf));
|
||||
inet_ntop(group_af, group, group_buf, sizeof(group_buf));
|
||||
switch (pgm->pgm_type) {
|
||||
case PGM_NAK:
|
||||
(void)printf("NAK ");
|
||||
break;
|
||||
case PGM_NULLNAK:
|
||||
(void)printf("NNAK ");
|
||||
break;
|
||||
case PGM_NCF:
|
||||
(void)printf("NCF ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
(void)printf("(%s -> %s), seq %u",
|
||||
source_buf, group_buf, EXTRACT_32BITS(&nak->pgmn_seq));
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_SPMR:
|
||||
(void)printf("SPMR");
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf("UNKNOWN type %0x02x", pgm->pgm_type);
|
||||
break;
|
||||
|
||||
}
|
||||
if (pgm->pgm_options & PGM_OPT_BIT_PRESENT) {
|
||||
|
||||
/*
|
||||
* make sure there's enough for the first option header
|
||||
*/
|
||||
if (!TTEST2(*bp, PGM_MIN_OPT_LEN)) {
|
||||
(void)printf("[|OPT]");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* That option header MUST be an OPT_LENGTH option
|
||||
* (see the first paragraph of section 9.1 in RFC 3208).
|
||||
*/
|
||||
opt_type = *bp++;
|
||||
if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) {
|
||||
(void)printf("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type & PGM_OPT_MASK);
|
||||
return;
|
||||
}
|
||||
opt_len = *bp++;
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_LENGTH option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
opts_len = EXTRACT_16BITS(bp);
|
||||
if (opts_len < 4) {
|
||||
(void)printf("[Bad total option length %u < 4]", opts_len);
|
||||
return;
|
||||
}
|
||||
bp += sizeof(u_int16_t);
|
||||
(void)printf(" OPTS LEN %d", opts_len);
|
||||
opts_len -= 4;
|
||||
|
||||
while (opts_len) {
|
||||
if (opts_len < PGM_MIN_OPT_LEN) {
|
||||
(void)printf("[Total option length leaves no room for final option]");
|
||||
return;
|
||||
}
|
||||
opt_type = *bp++;
|
||||
opt_len = *bp++;
|
||||
if (opt_len < PGM_MIN_OPT_LEN) {
|
||||
(void)printf("[Bad option, length %u < %u]", opt_len,
|
||||
PGM_MIN_OPT_LEN);
|
||||
break;
|
||||
}
|
||||
if (opts_len < opt_len) {
|
||||
(void)printf("[Total option length leaves no room for final option]");
|
||||
return;
|
||||
}
|
||||
if (!TTEST2(*bp, opt_len - 2)) {
|
||||
(void)printf(" [|OPT]");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (opt_type & PGM_OPT_MASK) {
|
||||
case PGM_OPT_LENGTH:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_LENGTH option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
(void)printf(" OPTS LEN (extra?) %d", EXTRACT_16BITS(bp));
|
||||
bp += sizeof(u_int16_t);
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_FRAGMENT:
|
||||
if (opt_len != 16) {
|
||||
(void)printf("[Bad OPT_FRAGMENT option, length %u != 16]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
offset = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
len = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" FRAG seq %u off %u len %u", seq, offset, len);
|
||||
opts_len -= 16;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NAK_LIST:
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
opt_len -= sizeof(u_int32_t); /* option header */
|
||||
(void)printf(" NAK LIST");
|
||||
while (opt_len) {
|
||||
if (opt_len < sizeof(u_int32_t)) {
|
||||
(void)printf("[Option length not a multiple of 4]");
|
||||
return;
|
||||
}
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
(void)printf(" %u", EXTRACT_32BITS(bp));
|
||||
bp += sizeof(u_int32_t);
|
||||
opt_len -= sizeof(u_int32_t);
|
||||
opts_len -= sizeof(u_int32_t);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGM_OPT_JOIN:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_JOIN option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" JOIN %u", seq);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NAK_BO_IVL:
|
||||
if (opt_len != 12) {
|
||||
(void)printf("[Bad OPT_NAK_BO_IVL option, length %u != 12]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
offset = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" BACKOFF ivl %u ivlseq %u", offset, seq);
|
||||
opts_len -= 12;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NAK_BO_RNG:
|
||||
if (opt_len != 12) {
|
||||
(void)printf("[Bad OPT_NAK_BO_RNG option, length %u != 12]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
offset = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" BACKOFF max %u min %u", offset, seq);
|
||||
opts_len -= 12;
|
||||
break;
|
||||
|
||||
case PGM_OPT_REDIRECT:
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
switch (EXTRACT_16BITS(bp)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
nla_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
nla_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp += (2 * sizeof(u_int16_t));
|
||||
if (opt_len != 4 + addr_size) {
|
||||
(void)printf("[Bad OPT_REDIRECT option, length %u != 4 + address size]", opt_len);
|
||||
return;
|
||||
}
|
||||
TCHECK2(*bp, addr_size);
|
||||
nla = bp;
|
||||
bp += addr_size;
|
||||
|
||||
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
||||
(void)printf(" REDIRECT %s", (char *)nla);
|
||||
opts_len -= 4 + addr_size;
|
||||
break;
|
||||
|
||||
case PGM_OPT_PARITY_PRM:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_PARITY_PRM option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
len = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" PARITY MAXTGS %u", len);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_PARITY_GRP:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_PARITY_GRP option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" PARITY GROUP %u", seq);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_CURR_TGSIZE:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_CURR_TGSIZE option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
len = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" PARITY ATGS %u", len);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NBR_UNREACH:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_NBR_UNREACH option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" NBR_UNREACH");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_PATH_NLA:
|
||||
(void)printf(" PATH_NLA [%d]", opt_len);
|
||||
bp += opt_len;
|
||||
opts_len -= opt_len;
|
||||
break;
|
||||
|
||||
case PGM_OPT_SYN:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_SYN option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" SYN");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_FIN:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_FIN option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" FIN");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_RST:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_RST option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" RST");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_CR:
|
||||
(void)printf(" CR");
|
||||
bp += opt_len;
|
||||
opts_len -= opt_len;
|
||||
break;
|
||||
|
||||
case PGM_OPT_CRQST:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_CRQST option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" CRQST");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf(" OPT_%02X [%d] ", opt_type, opt_len);
|
||||
bp += opt_len;
|
||||
opts_len -= opt_len;
|
||||
break;
|
||||
}
|
||||
|
||||
if (opt_type & PGM_OPT_END)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(void)printf(" [%u]", EXTRACT_16BITS(&pgm->pgm_length));
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
fputs("[|pgm]", stdout);
|
||||
if (ch != '\0')
|
||||
putchar('>');
|
||||
}
|
888
dist/tcpdump/print-rsvp.c
vendored
888
dist/tcpdump/print-rsvp.c
vendored
File diff suppressed because it is too large
Load Diff
62
dist/tcpdump/print-sip.c
vendored
Normal file
62
dist/tcpdump/print-sip.c
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
/* $NetBSD: print-sip.c,v 1.1.1.1 2007/07/24 11:42:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-sip.c,v 1.1 2004/07/27 17:04:20 hannes Exp";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "udp.h"
|
||||
|
||||
void
|
||||
sip_print(register const u_char *pptr, register u_int len)
|
||||
{
|
||||
u_int idx;
|
||||
|
||||
printf("SIP, length: %u%s", len, vflag ? "\n\t" : "");
|
||||
|
||||
/* in non-verbose mode just lets print the protocol and length */
|
||||
if (vflag < 1)
|
||||
return;
|
||||
|
||||
for (idx = 0; idx < len; idx++) {
|
||||
if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */
|
||||
safeputchar(*(pptr+idx));
|
||||
} else {
|
||||
printf("\n\t");
|
||||
idx+=1;
|
||||
}
|
||||
}
|
||||
|
||||
/* do we want to see an additionally hexdump ? */
|
||||
if (vflag> 1)
|
||||
print_unknown_data(pptr,"\n\t",len);
|
||||
|
||||
return;
|
||||
}
|
266
dist/tcpdump/print-slow.c
vendored
Normal file
266
dist/tcpdump/print-slow.c
vendored
Normal file
@ -0,0 +1,266 @@
|
||||
/* $NetBSD: print-slow.c,v 1.1.1.1 2007/07/24 11:42:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2005 The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* support for the IEEE "slow protocols" LACP, MARKER as per 802.3ad
|
||||
*
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-slow.c,v 1.1.2.1 2005/07/10 14:47:56 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 "ether.h"
|
||||
|
||||
struct slow_common_header {
|
||||
u_int8_t proto_subtype;
|
||||
u_int8_t version;
|
||||
};
|
||||
|
||||
#define SLOW_PROTO_LACP 1
|
||||
#define SLOW_PROTO_MARKER 2
|
||||
|
||||
#define LACP_VERSION 1
|
||||
#define MARKER_VERSION 1
|
||||
|
||||
static const struct tok slow_proto_values[] = {
|
||||
{ SLOW_PROTO_LACP, "LACP" },
|
||||
{ SLOW_PROTO_MARKER, "MARKER" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct tlv_header_t {
|
||||
u_int8_t type;
|
||||
u_int8_t length;
|
||||
};
|
||||
|
||||
#define LACP_TLV_TERMINATOR 0x00
|
||||
#define LACP_TLV_ACTOR_INFO 0x01
|
||||
#define LACP_TLV_PARTNER_INFO 0x02
|
||||
#define LACP_TLV_COLLECTOR_INFO 0x03
|
||||
|
||||
#define MARKER_TLV_TERMINATOR 0x00
|
||||
#define MARKER_TLV_MARKER_INFO 0x01
|
||||
|
||||
static const struct tok slow_tlv_values[] = {
|
||||
{ (SLOW_PROTO_LACP << 8) + LACP_TLV_TERMINATOR, "Terminator"},
|
||||
{ (SLOW_PROTO_LACP << 8) + LACP_TLV_ACTOR_INFO, "Actor Information"},
|
||||
{ (SLOW_PROTO_LACP << 8) + LACP_TLV_PARTNER_INFO, "Partner Information"},
|
||||
{ (SLOW_PROTO_LACP << 8) + LACP_TLV_COLLECTOR_INFO, "Collector Information"},
|
||||
|
||||
{ (SLOW_PROTO_MARKER << 8) + MARKER_TLV_TERMINATOR, "Terminator"},
|
||||
{ (SLOW_PROTO_MARKER << 8) + MARKER_TLV_MARKER_INFO, "Marker Information"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct lacp_tlv_actor_partner_info_t {
|
||||
u_int8_t sys_pri[2];
|
||||
u_int8_t sys[ETHER_ADDR_LEN];
|
||||
u_int8_t key[2];
|
||||
u_int8_t port_pri[2];
|
||||
u_int8_t port[2];
|
||||
u_int8_t state;
|
||||
u_int8_t pad[3];
|
||||
};
|
||||
|
||||
static const struct tok lacp_tlv_actor_partner_info_state_values[] = {
|
||||
{ 0x01, "Activity"},
|
||||
{ 0x02, "Timeout"},
|
||||
{ 0x04, "Aggregation"},
|
||||
{ 0x08, "Synchronization"},
|
||||
{ 0x10, "Collecting"},
|
||||
{ 0x20, "Distributing"},
|
||||
{ 0x40, "Default"},
|
||||
{ 0x80, "Expired"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct lacp_tlv_collector_info_t {
|
||||
u_int8_t max_delay[2];
|
||||
u_int8_t pad[12];
|
||||
};
|
||||
|
||||
struct marker_tlv_marker_info_t {
|
||||
u_int8_t req_port[2];
|
||||
u_int8_t req_sys[ETHER_ADDR_LEN];
|
||||
u_int8_t req_trans_id[4];
|
||||
u_int8_t pad[2];
|
||||
};
|
||||
|
||||
struct lacp_marker_tlv_terminator_t {
|
||||
u_int8_t pad[50];
|
||||
};
|
||||
|
||||
void
|
||||
slow_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
const struct slow_common_header *slow_com_header;
|
||||
const struct tlv_header_t *tlv_header;
|
||||
const u_char *tptr,*tlv_tptr;
|
||||
u_int tlv_len,tlen,tlv_tlen;
|
||||
|
||||
union {
|
||||
const struct lacp_marker_tlv_terminator_t *lacp_marker_tlv_terminator;
|
||||
const struct lacp_tlv_actor_partner_info_t *lacp_tlv_actor_partner_info;
|
||||
const struct lacp_tlv_collector_info_t *lacp_tlv_collector_info;
|
||||
const struct marker_tlv_marker_info_t *marker_tlv_marker_info;
|
||||
} tlv_ptr;
|
||||
|
||||
tptr=pptr;
|
||||
slow_com_header = (const struct slow_common_header *)pptr;
|
||||
TCHECK(*slow_com_header);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
*/
|
||||
if (slow_com_header->proto_subtype == SLOW_PROTO_LACP &&
|
||||
slow_com_header->version != LACP_VERSION) {
|
||||
printf("LACP version %u packet not supported",slow_com_header->version);
|
||||
return;
|
||||
}
|
||||
if (slow_com_header->proto_subtype == SLOW_PROTO_MARKER &&
|
||||
slow_com_header->version != MARKER_VERSION) {
|
||||
printf("MARKER version %u packet not supported",slow_com_header->version);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%sv%u, length: %u",
|
||||
tok2str(slow_proto_values, "unknown (%u)",slow_com_header->proto_subtype),
|
||||
slow_com_header->version,
|
||||
len);
|
||||
|
||||
if (!vflag)
|
||||
return;
|
||||
|
||||
/* ok they seem to want to know everything - lets fully decode it */
|
||||
tlen=len-sizeof(struct slow_common_header);
|
||||
tptr+=sizeof(const struct slow_common_header);
|
||||
|
||||
while(tlen>0) {
|
||||
/* did we capture enough for fully decoding the tlv header ? */
|
||||
TCHECK2(*tptr, sizeof(struct tlv_header_t));
|
||||
tlv_header = (const struct tlv_header_t *)tptr;
|
||||
tlv_len = tlv_header->length;
|
||||
|
||||
printf("\n\t%s TLV (0x%02x), length: %u",
|
||||
tok2str(slow_tlv_values,
|
||||
"Unknown",
|
||||
(slow_com_header->proto_subtype << 8) + tlv_header->type),
|
||||
tlv_header->type,
|
||||
tlv_len);
|
||||
|
||||
if ((tlv_len < sizeof(struct tlv_header_t) ||
|
||||
tlv_len > tlen) &&
|
||||
tlv_header->type != LACP_TLV_TERMINATOR &&
|
||||
tlv_header->type != MARKER_TLV_TERMINATOR) {
|
||||
printf("\n\t-----trailing data-----");
|
||||
print_unknown_data(tptr+sizeof(sizeof(struct tlv_header_t)),"\n\t ",tlen);
|
||||
return;
|
||||
}
|
||||
|
||||
tlv_tptr=tptr+sizeof(struct tlv_header_t);
|
||||
tlv_tlen=tlv_len-sizeof(struct tlv_header_t);
|
||||
|
||||
/* did we capture enough for fully decoding the tlv ? */
|
||||
TCHECK2(*tptr, tlv_len);
|
||||
|
||||
switch((slow_com_header->proto_subtype << 8) + tlv_header->type) {
|
||||
|
||||
/* those two TLVs have the same structure -> fall through */
|
||||
case ((SLOW_PROTO_LACP << 8) + LACP_TLV_ACTOR_INFO):
|
||||
case ((SLOW_PROTO_LACP << 8) + LACP_TLV_PARTNER_INFO):
|
||||
tlv_ptr.lacp_tlv_actor_partner_info = (const struct lacp_tlv_actor_partner_info_t *)tlv_tptr;
|
||||
|
||||
printf("\n\t System %s, System Priority %u, Key %u" \
|
||||
", Port %u, Port Priority %u\n\t State Flags [%s]",
|
||||
etheraddr_string(tlv_ptr.lacp_tlv_actor_partner_info->sys),
|
||||
EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri),
|
||||
EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key),
|
||||
EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port),
|
||||
EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port_pri),
|
||||
bittok2str(lacp_tlv_actor_partner_info_state_values,
|
||||
"none",
|
||||
tlv_ptr.lacp_tlv_actor_partner_info->state));
|
||||
|
||||
break;
|
||||
|
||||
case ((SLOW_PROTO_LACP << 8) + LACP_TLV_COLLECTOR_INFO):
|
||||
tlv_ptr.lacp_tlv_collector_info = (const struct lacp_tlv_collector_info_t *)tlv_tptr;
|
||||
|
||||
printf("\n\t Max Delay %u",
|
||||
EXTRACT_16BITS(tlv_ptr.lacp_tlv_collector_info->max_delay));
|
||||
|
||||
break;
|
||||
|
||||
case ((SLOW_PROTO_MARKER << 8) + MARKER_TLV_MARKER_INFO):
|
||||
tlv_ptr.marker_tlv_marker_info = (const struct marker_tlv_marker_info_t *)tlv_tptr;
|
||||
|
||||
printf("\n\t Request System %s, Request Port %u, Request Transaction ID 0x%08x",
|
||||
etheraddr_string(tlv_ptr.marker_tlv_marker_info->req_sys),
|
||||
EXTRACT_16BITS(tlv_ptr.marker_tlv_marker_info->req_port),
|
||||
EXTRACT_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id));
|
||||
|
||||
break;
|
||||
|
||||
/* those two TLVs have the same structure -> fall through */
|
||||
case ((SLOW_PROTO_LACP << 8) + LACP_TLV_TERMINATOR):
|
||||
case ((SLOW_PROTO_MARKER << 8) + LACP_TLV_TERMINATOR):
|
||||
tlv_ptr.lacp_marker_tlv_terminator = (const struct lacp_marker_tlv_terminator_t *)tlv_tptr;
|
||||
if (tlv_len == 0) {
|
||||
tlv_len = sizeof(tlv_ptr.lacp_marker_tlv_terminator->pad) +
|
||||
sizeof(struct tlv_header_t);
|
||||
/* tell the user that we modified the length field */
|
||||
if (vflag>1)
|
||||
printf(" (=%u)",tlv_len);
|
||||
/* we have messed around with the length field - now we need to check
|
||||
* again if there are enough bytes on the wire for the hexdump */
|
||||
TCHECK2(tlv_ptr.lacp_marker_tlv_terminator->pad[0],
|
||||
sizeof(tlv_ptr.lacp_marker_tlv_terminator->pad));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
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 tlv_header_t)),"\n\t ",
|
||||
tlv_len-sizeof(struct tlv_header_t));
|
||||
|
||||
tptr+=tlv_len;
|
||||
tlen-=tlv_len;
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
}
|
6
dist/tcpdump/print-sunatm.c
vendored
6
dist/tcpdump/print-sunatm.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print-sunatm.c,v 1.1.1.1 2004/09/27 17:07:30 dyoung Exp $ */
|
||||
/* $NetBSD: print-sunatm.c,v 1.1.1.2 2007/07/24 11:42:54 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Yen Yen Lim and North Dakota State University
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-sunatm.c,v 1.5.2.2 2003/11/16 08:51:47 guy Exp (LBL)";
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-sunatm.c,v 1.8 2004/03/17 23:24:38 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -68,7 +68,7 @@ struct rtentry;
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the SunATM pseudo-header for the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
|
123
dist/tcpdump/print-symantec.c
vendored
Normal file
123
dist/tcpdump/print-symantec.c
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
/* $NetBSD: print-symantec.c,v 1.1.1.1 2007/07/24 11:42:56 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-symantec.c,v 1.4.2.1 2005/07/07 01:24:39 guy Exp (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "ether.h"
|
||||
|
||||
struct symantec_header {
|
||||
u_int8_t stuff1[6];
|
||||
u_int16_t ether_type;
|
||||
u_int8_t stuff2[36];
|
||||
};
|
||||
|
||||
static inline void
|
||||
symantec_hdr_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
register const struct symantec_header *sp;
|
||||
u_int16_t etype;
|
||||
|
||||
sp = (const struct symantec_header *)bp;
|
||||
|
||||
etype = ntohs(sp->ether_type);
|
||||
if (!qflag) {
|
||||
if (etype <= ETHERMTU)
|
||||
(void)printf("invalid ethertype %u", etype);
|
||||
else
|
||||
(void)printf("ethertype %s (0x%04x)",
|
||||
tok2str(ethertype_values,"Unknown", etype),
|
||||
etype);
|
||||
} else {
|
||||
if (etype <= ETHERMTU)
|
||||
(void)printf("invalid ethertype %u", etype);
|
||||
else
|
||||
(void)printf("%s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", etype));
|
||||
}
|
||||
|
||||
(void)printf(", length %u: ", length);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the ether header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int length = h->len;
|
||||
u_int caplen = h->caplen;
|
||||
struct symantec_header *sp;
|
||||
u_short ether_type;
|
||||
u_short extracted_ether_type;
|
||||
|
||||
if (caplen < sizeof (struct symantec_header)) {
|
||||
printf("[|symantec]");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
symantec_hdr_print(p, length);
|
||||
|
||||
length -= sizeof (struct symantec_header);
|
||||
caplen -= sizeof (struct symantec_header);
|
||||
sp = (struct symantec_header *)p;
|
||||
p += sizeof (struct symantec_header);
|
||||
|
||||
ether_type = ntohs(sp->ether_type);
|
||||
|
||||
if (ether_type <= ETHERMTU) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ether_type) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
|
||||
return (sizeof (struct symantec_header));
|
||||
}
|
165
dist/tcpdump/print-syslog.c
vendored
Normal file
165
dist/tcpdump/print-syslog.c
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
/* $NetBSD: print-syslog.c,v 1.1.1.1 2007/07/24 11:43:14 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998-2004 Hannes Gredler <hannes@tcpdump.org>
|
||||
* The TCPDUMP project
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) Header: /tcpdump/master/tcpdump/print-syslog.c,v 1.1 2004/10/29 11:42:53 hannes Exp";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
/*
|
||||
* tokenlists and #defines taken from Ethereal - Network traffic analyzer
|
||||
* by Gerald Combs <gerald@ethereal.com>
|
||||
*/
|
||||
|
||||
#define SYSLOG_SEVERITY_MASK 0x0007 /* 0000 0000 0000 0111 */
|
||||
#define SYSLOG_FACILITY_MASK 0x03f8 /* 0000 0011 1111 1000 */
|
||||
#define SYSLOG_MAX_DIGITS 3 /* The maximum number if priority digits to read in. */
|
||||
|
||||
static const struct tok syslog_severity_values[] = {
|
||||
{ 0, "emergency" },
|
||||
{ 1, "alert" },
|
||||
{ 2, "critical" },
|
||||
{ 3, "error" },
|
||||
{ 4, "warning" },
|
||||
{ 5, "notice" },
|
||||
{ 6, "info" },
|
||||
{ 7, "debug" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
static const struct tok syslog_facility_values[] = {
|
||||
{ 0, "kernel" },
|
||||
{ 1, "user" },
|
||||
{ 2, "mail" },
|
||||
{ 3, "daemon" },
|
||||
{ 4, "auth" },
|
||||
{ 5, "syslog" },
|
||||
{ 6, "lpr" },
|
||||
{ 7, "news" },
|
||||
{ 8, "uucp" },
|
||||
{ 9, "cron" },
|
||||
{ 10, "authpriv" },
|
||||
{ 11, "ftp" },
|
||||
{ 12, "ntp" },
|
||||
{ 13, "security" },
|
||||
{ 14, "console" },
|
||||
{ 15, "cron" },
|
||||
{ 16, "local0" },
|
||||
{ 17, "local1" },
|
||||
{ 18, "local2" },
|
||||
{ 19, "local3" },
|
||||
{ 20, "local4" },
|
||||
{ 21, "local5" },
|
||||
{ 22, "local6" },
|
||||
{ 23, "local7" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
void
|
||||
syslog_print(register const u_char *pptr, register u_int len)
|
||||
{
|
||||
u_int16_t msg_off = 0;
|
||||
u_int16_t pri = 0;
|
||||
u_int16_t facility,severity;
|
||||
|
||||
/* extract decimal figures that are
|
||||
* encapsulated within < > tags
|
||||
* based on this decimal figure extract the
|
||||
* severity and facility values
|
||||
*/
|
||||
|
||||
if (!TTEST2(*pptr, 1))
|
||||
goto trunc;
|
||||
|
||||
if (*(pptr+msg_off) == '<') {
|
||||
msg_off++;
|
||||
|
||||
if (!TTEST2(*(pptr+msg_off), 1))
|
||||
goto trunc;
|
||||
|
||||
while ( *(pptr+msg_off) >= '0' &&
|
||||
*(pptr+msg_off) <= '9' &&
|
||||
msg_off <= SYSLOG_MAX_DIGITS) {
|
||||
|
||||
if (!TTEST2(*(pptr+msg_off), 1))
|
||||
goto trunc;
|
||||
|
||||
pri = pri * 10 + (*(pptr+msg_off) - '0');
|
||||
msg_off++;
|
||||
|
||||
if (!TTEST2(*(pptr+msg_off), 1))
|
||||
goto trunc;
|
||||
|
||||
if (*(pptr+msg_off) == '>')
|
||||
msg_off++;
|
||||
}
|
||||
} else {
|
||||
printf("[|syslog]");
|
||||
return;
|
||||
}
|
||||
|
||||
facility = (pri & SYSLOG_FACILITY_MASK) >> 3;
|
||||
severity = pri & SYSLOG_SEVERITY_MASK;
|
||||
|
||||
|
||||
if (vflag < 1 )
|
||||
{
|
||||
printf("SYSLOG %s.%s, length: %u",
|
||||
tok2str(syslog_facility_values, "unknown (%u)", facility),
|
||||
tok2str(syslog_severity_values, "unknown (%u)", severity),
|
||||
len);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("SYSLOG, length: %u\n\tFacility %s (%u), Severity %s (%u)\n\tMsg: ",
|
||||
len,
|
||||
tok2str(syslog_facility_values, "unknown (%u)", facility),
|
||||
facility,
|
||||
tok2str(syslog_severity_values, "unknown (%u)", severity),
|
||||
severity);
|
||||
|
||||
/* print the syslog text in verbose mode */
|
||||
for (; msg_off < len; msg_off++) {
|
||||
if (!TTEST2(*(pptr+msg_off), 1))
|
||||
goto trunc;
|
||||
safeputchar(*(pptr+msg_off));
|
||||
}
|
||||
|
||||
if (vflag > 1) {
|
||||
if(!print_unknown_data(pptr,"\n\t",len))
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|syslog]");
|
||||
}
|
81
dist/tcpdump/rpc_auth.h
vendored
Normal file
81
dist/tcpdump/rpc_auth.h
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
/* $NetBSD: rpc_auth.h,v 1.1.1.1 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/rpc_auth.h,v 1.1.2.1 2005/04/27 21:44:07 guy Exp (LBL) */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*
|
||||
* from: @(#)auth.h 1.17 88/02/08 SMI
|
||||
* from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/auth.h,v 1.14.2.1 1999/08/29 14:39:02 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* auth.h, Authentication interface.
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*
|
||||
* The data structures are completely opaque to the client. The client
|
||||
* is required to pass a AUTH * to routines that create rpc
|
||||
* "sessions".
|
||||
*/
|
||||
|
||||
/*
|
||||
* Status returned from authentication check
|
||||
*/
|
||||
enum sunrpc_auth_stat {
|
||||
SUNRPC_AUTH_OK=0,
|
||||
/*
|
||||
* failed at remote end
|
||||
*/
|
||||
SUNRPC_AUTH_BADCRED=1, /* bogus credentials (seal broken) */
|
||||
SUNRPC_AUTH_REJECTEDCRED=2, /* client should begin new session */
|
||||
SUNRPC_AUTH_BADVERF=3, /* bogus verifier (seal broken) */
|
||||
SUNRPC_AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
|
||||
SUNRPC_AUTH_TOOWEAK=5, /* rejected due to security reasons */
|
||||
/*
|
||||
* failed locally
|
||||
*/
|
||||
SUNRPC_AUTH_INVALIDRESP=6, /* bogus response verifier */
|
||||
SUNRPC_AUTH_FAILED=7 /* some unknown reason */
|
||||
};
|
||||
|
||||
/*
|
||||
* Authentication info. Opaque to client.
|
||||
*/
|
||||
struct sunrpc_opaque_auth {
|
||||
u_int32_t oa_flavor; /* flavor of auth */
|
||||
u_int32_t oa_len; /* length of opaque body */
|
||||
/* zero or more bytes of body */
|
||||
};
|
||||
|
||||
#define SUNRPC_AUTH_NONE 0 /* no authentication */
|
||||
#define SUNRPC_AUTH_NULL 0 /* backward compatibility */
|
||||
#define SUNRPC_AUTH_UNIX 1 /* unix style (uid, gids) */
|
||||
#define SUNRPC_AUTH_SYS 1 /* forward compatibility */
|
||||
#define SUNRPC_AUTH_SHORT 2 /* short hand unix style */
|
||||
#define SUNRPC_AUTH_DES 3 /* des style (encrypted timestamps) */
|
130
dist/tcpdump/rpc_msg.h
vendored
Normal file
130
dist/tcpdump/rpc_msg.h
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
/* $NetBSD: rpc_msg.h,v 1.1.1.1 2007/07/24 11:42:54 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/rpc_msg.h,v 1.1.2.1 2005/04/27 21:44:07 guy Exp (LBL) */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
* media and as a part of the software program in whole or part. Users
|
||||
* may copy or modify Sun RPC without charge, but are not authorized
|
||||
* to license or distribute it to anyone else except as part of a product or
|
||||
* program developed by the user.
|
||||
*
|
||||
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
|
||||
* WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun RPC is provided with no support and without any obligation on the
|
||||
* part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*
|
||||
* from: @(#)rpc_msg.h 1.7 86/07/16 SMI
|
||||
* from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC
|
||||
* $FreeBSD: src/include/rpc/rpc_msg.h,v 1.11.2.1 1999/08/29 14:39:07 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* rpc_msg.h
|
||||
* rpc message definition
|
||||
*
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#define SUNRPC_MSG_VERSION ((u_int32_t) 2)
|
||||
|
||||
/*
|
||||
* Bottom up definition of an rpc message.
|
||||
* NOTE: call and reply use the same overall stuct but
|
||||
* different parts of unions within it.
|
||||
*/
|
||||
|
||||
enum sunrpc_msg_type {
|
||||
SUNRPC_CALL=0,
|
||||
SUNRPC_REPLY=1
|
||||
};
|
||||
|
||||
enum sunrpc_reply_stat {
|
||||
SUNRPC_MSG_ACCEPTED=0,
|
||||
SUNRPC_MSG_DENIED=1
|
||||
};
|
||||
|
||||
enum sunrpc_accept_stat {
|
||||
SUNRPC_SUCCESS=0,
|
||||
SUNRPC_PROG_UNAVAIL=1,
|
||||
SUNRPC_PROG_MISMATCH=2,
|
||||
SUNRPC_PROC_UNAVAIL=3,
|
||||
SUNRPC_GARBAGE_ARGS=4,
|
||||
SUNRPC_SYSTEM_ERR=5
|
||||
};
|
||||
|
||||
enum sunrpc_reject_stat {
|
||||
SUNRPC_RPC_MISMATCH=0,
|
||||
SUNRPC_AUTH_ERROR=1
|
||||
};
|
||||
|
||||
/*
|
||||
* Reply part of an rpc exchange
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reply to an rpc request that was rejected by the server.
|
||||
*/
|
||||
struct sunrpc_rejected_reply {
|
||||
u_int32_t rj_stat; /* enum reject_stat */
|
||||
union {
|
||||
struct {
|
||||
u_int32_t low;
|
||||
u_int32_t high;
|
||||
} RJ_versions;
|
||||
u_int32_t RJ_why; /* enum auth_stat - why authentication did not work */
|
||||
} ru;
|
||||
#define rj_vers ru.RJ_versions
|
||||
#define rj_why ru.RJ_why
|
||||
};
|
||||
|
||||
/*
|
||||
* Body of a reply to an rpc request.
|
||||
*/
|
||||
struct sunrpc_reply_body {
|
||||
u_int32_t rp_stat; /* enum reply_stat */
|
||||
struct sunrpc_rejected_reply rp_reject; /* if rejected */
|
||||
};
|
||||
|
||||
/*
|
||||
* Body of an rpc request call.
|
||||
*/
|
||||
struct sunrpc_call_body {
|
||||
u_int32_t cb_rpcvers; /* must be equal to two */
|
||||
u_int32_t cb_prog;
|
||||
u_int32_t cb_vers;
|
||||
u_int32_t cb_proc;
|
||||
struct sunrpc_opaque_auth cb_cred;
|
||||
/* followed by opaque verifier */
|
||||
};
|
||||
|
||||
/*
|
||||
* The rpc message
|
||||
*/
|
||||
struct sunrpc_msg {
|
||||
u_int32_t rm_xid;
|
||||
u_int32_t rm_direction; /* enum msg_type */
|
||||
union {
|
||||
struct sunrpc_call_body RM_cmb;
|
||||
struct sunrpc_reply_body RM_rmb;
|
||||
} ru;
|
||||
#define rm_call ru.RM_cmb
|
||||
#define rm_reply ru.RM_rmb
|
||||
};
|
||||
#define acpted_rply ru.RM_rmb.ru.RP_ar
|
||||
#define rjcted_rply ru.RM_rmb.ru.RP_dr
|
6
dist/tcpdump/smb.h
vendored
6
dist/tcpdump/smb.h
vendored
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: smb.h,v 1.1.1.3 2004/09/27 17:07:35 dyoung Exp $ */
|
||||
/* $NetBSD: smb.h,v 1.1.1.4 2007/07/24 11:42:50 drochner Exp $ */
|
||||
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/smb.h,v 1.8 2002/06/11 17:09:00 itojun Exp (LBL) */
|
||||
/* @(#) Header: /tcpdump/master/tcpdump/smb.h,v 1.9 2004/12/28 22:29:44 guy Exp (LBL) */
|
||||
/*
|
||||
* Copyright (C) Andrew Tridgell 1995-1999
|
||||
*
|
||||
@ -121,4 +121,4 @@
|
||||
#define PTR_DIFF(p1, p2) ((size_t)(((char *)(p1)) - (char *)(p2)))
|
||||
|
||||
/* some protos */
|
||||
const u_char *smb_fdata(const u_char *, const char *, const u_char *);
|
||||
const u_char *smb_fdata(const u_char *, const char *, const u_char *, int);
|
||||
|
103
dist/tcpdump/tcpdump-stdinc.h
vendored
103
dist/tcpdump/tcpdump-stdinc.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tcpdump-stdinc.h,v 1.1.1.1 2004/09/27 17:07:36 dyoung Exp $ */
|
||||
/* $NetBSD: tcpdump-stdinc.h,v 1.1.1.2 2007/07/24 11:42:53 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 - 2003
|
||||
@ -31,7 +31,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* @(#) Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.7.2.1 2003/11/16 09:57:50 guy Exp (LBL)
|
||||
* @(#) Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12.2.5 2006/06/23 02:07:27 hannes Exp (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -48,22 +48,43 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <winsock2.h>
|
||||
#include <Ws2tcpip.h>
|
||||
#include "bittypes.h"
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#include "IP6_misc.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <net/netdb.h> /* in wpcap's Win32/include */
|
||||
|
||||
#if !defined(__MINGW32__) && !defined(__WATCOMC__)
|
||||
#undef toascii
|
||||
#define isascii __isascii
|
||||
#define toascii __toascii
|
||||
#define stat _stat
|
||||
#define open _open
|
||||
#define fstat _fstat
|
||||
#define read _read
|
||||
#define close _close
|
||||
#define O_RDONLY _O_RDONLY
|
||||
|
||||
typedef short ino_t;
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <stdint.h>
|
||||
int* _errno();
|
||||
#define errno (*_errno())
|
||||
#endif
|
||||
|
||||
#define INET_ADDRSTRLEN 16
|
||||
/* Protos for missing/x.c functions (ideally <missing/addrinfo.h>
|
||||
* should be used, but it clashes with <ws2tcpip.h>).
|
||||
*/
|
||||
extern const char *inet_ntop (int, const void *, char *, size_t);
|
||||
extern int inet_pton (int, const char *, void *);
|
||||
extern int inet_aton (const char *cp, struct in_addr *addr);
|
||||
|
||||
#ifndef INET6_ADDRSTRLEN
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
#endif /* __MINGW32__ */
|
||||
#endif
|
||||
|
||||
#ifndef toascii
|
||||
#define toascii(c) ((c) & 0x7f)
|
||||
@ -79,24 +100,21 @@ typedef char* caddr_t;
|
||||
#define vsnprintf _vsnprintf
|
||||
#define RETSIGTYPE void
|
||||
|
||||
#if !defined(__MINGW32__) && !defined(__WATCOMC__)
|
||||
#undef toascii
|
||||
#define isascii __isascii
|
||||
#define toascii __toascii
|
||||
#define stat _stat
|
||||
#define open _open
|
||||
#define fstat _fstat
|
||||
#define read _read
|
||||
#define O_RDONLY _O_RDONLY
|
||||
|
||||
typedef short ino_t;
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#if HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h> /* concession to AIX */
|
||||
#include <sys/time.h>
|
||||
@ -127,4 +145,47 @@ typedef short ino_t;
|
||||
#define FOPEN_WRITE_BIN FOPEN_WRITE_TXT
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__) && !defined(__ntohl)
|
||||
#undef ntohl
|
||||
#undef ntohs
|
||||
#undef htonl
|
||||
#undef htons
|
||||
|
||||
extern __inline__ unsigned long __ntohl (unsigned long x);
|
||||
extern __inline__ unsigned short __ntohs (unsigned short x);
|
||||
|
||||
#define ntohl(x) __ntohl(x)
|
||||
#define ntohs(x) __ntohs(x)
|
||||
#define htonl(x) __ntohl(x)
|
||||
#define htons(x) __ntohs(x)
|
||||
|
||||
extern __inline__ unsigned long __ntohl (unsigned long x)
|
||||
{
|
||||
__asm__ ("xchgb %b0, %h0\n\t" /* swap lower bytes */
|
||||
"rorl $16, %0\n\t" /* swap words */
|
||||
"xchgb %b0, %h0" /* swap higher bytes */
|
||||
: "=q" (x) : "0" (x));
|
||||
return (x);
|
||||
}
|
||||
|
||||
extern __inline__ unsigned short __ntohs (unsigned short x)
|
||||
{
|
||||
__asm__ ("xchgb %b0, %h0" /* swap bytes */
|
||||
: "=q" (x) : "0" (x));
|
||||
return (x);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef INET_ADDRSTRLEN
|
||||
#define INET_ADDRSTRLEN 16
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#endif /* tcpdump_stdinc_h */
|
||||
|
Loading…
Reference in New Issue
Block a user