This commit was generated by cvs2svn to compensate for changes in r127668,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
68fb152d91
@ -1,4 +1,64 @@
|
||||
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.81.2.1 2003/02/26 07:08:58 fenner Exp $
|
||||
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.84.2.3 2004/03/30 14:36:24 mcr Exp $
|
||||
|
||||
Tue. March 30, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.3 release
|
||||
|
||||
No changes from 3.8.2. Version bumped only to maintain consistency
|
||||
with libpcap 0.8.3.
|
||||
|
||||
Mon. March 29, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.2 release
|
||||
|
||||
Fixes for print-isakmp.c CVE: CAN-2004-0183, CAN-2004-0184
|
||||
http://www.rapid7.com/advisories/R7-0017.html
|
||||
IP-over-IEEE1394 printing.
|
||||
some MINGW32 changes.
|
||||
updates for autoconf 2.5
|
||||
fixes for print-aodv.c - check for too short packets
|
||||
formatting changes to print-ascii for hex output.
|
||||
check for too short packets: print-bgp.c, print-bootp.c, print-cdp.c,
|
||||
print-chdlc.c, print-domain.c, print-icmp.c, print-icmp6.c,
|
||||
print-ip.c, print-lwres.c, print-ospf.c, print-pim.c,
|
||||
print-ppp.c,print-pppoe.c, print-rsvp.c, print-wb.c
|
||||
print-ether.c - better handling of unknown types.
|
||||
print-isoclns.c - additional decoding of types.
|
||||
print-llc.c - strings for LLC names added.
|
||||
print-pfloc.c - various enhancements
|
||||
print-radius.c - better decoding to strings.
|
||||
|
||||
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>
|
||||
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.
|
||||
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.
|
||||
New -U flag. -flush stdout after every packet
|
||||
New -A flag -print ascii only
|
||||
support for decoding IS-IS inside Cisco HDLC Frames
|
||||
more verbosity for tftp decoder
|
||||
mDNS decoder
|
||||
new BFD decoder
|
||||
cross compilation patches
|
||||
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.
|
||||
fixes for DECnet support.
|
||||
Support RFC 2684 bridging of Ethernet, 802.5 Token Ring, and FDDI.
|
||||
RFC 2684 encapsulation of BPDUs.
|
||||
|
||||
Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release
|
||||
|
||||
@ -672,5 +732,3 @@ v2.0.1 Sun Jan 26 21:10:10 PDT
|
||||
v2.0 Sun Jan 13 12:20:40 PST 1991
|
||||
|
||||
- Initial public release.
|
||||
|
||||
@(#) $Header: /tcpdump/master/tcpdump/CHANGES,v 1.81.2.1 2003/02/26 07:08:58 fenner Exp $ (LBL)
|
||||
|
@ -2,46 +2,60 @@ This file lists people who have contributed to tcpdump:
|
||||
|
||||
The current maintainers:
|
||||
Bill Fenner <fenner@research.att.com>
|
||||
Assar Westerlund <assar@sics.se>
|
||||
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
|
||||
Fulvio Risso <risso@polito.it>
|
||||
Guy Harris <guy@alum.mit.edu>
|
||||
Hannes Gredler <hannes@juniper.net>
|
||||
Jun-ichiro itojun Hagino <itojun@iijlab.net>
|
||||
Guy Harris <guy@alum.mit.edu>
|
||||
Torsten Landschoff <t.landschoff@gmx.net>
|
||||
Michael Richardson <mcr@sandelman.ottawa.on.ca>
|
||||
Ken Hornstein <kenh@cmf.nrl.navy.mil>
|
||||
Michael Richardson <mcr@sandelman.ottawa.on.ca>
|
||||
|
||||
Additional people who have contributed patches:
|
||||
|
||||
Andrew Brown <atatat@atatdot.net>
|
||||
Alfredo Andres <aandres@s21sec.com>
|
||||
Andrew Hintz <adhintz@users.sourceforge.net>
|
||||
Andrew Tridgell <tridge@linuxcare.com>
|
||||
Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
||||
Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
|
||||
Atsushi Onoe <onoe@netbsd.org>
|
||||
Ben Smithurst <ben@scientia.demon.co.uk>
|
||||
Brent L. Bates <blbates@vigyan.com>
|
||||
Brian Ginsbach <ginsbach@cray.com>
|
||||
Bruce M. Simpson <bms@spc.org>
|
||||
Carles Kishimoto Bisbe <ckishimo@ac.upc.es>
|
||||
Charlie Lenahan <clenahan@fortresstech.com>
|
||||
Charles M. Hannum <mycroft@netbsd.org>
|
||||
Chris Cogdon <chris@cogdon.org>
|
||||
Chris G. Demetriou <cgd@netbsd.org>
|
||||
Chris Jepeway <jepeway@blasted-heath.com>
|
||||
Craig Rodrigues <rodrigc@mediaone.net>
|
||||
Crist J. Clark <cjclark@alum.mit.edu>
|
||||
Daniel Hagerty <hag@ai.mit.edu>
|
||||
Darren Reed <darrenr@reed.wattle.id.au>
|
||||
David Binderman <d.binderman@virgin.net>
|
||||
David Young <dyoung@ojctech.com>
|
||||
Francisco Matias Cuenca-Acuna <mcuenca@george.rutgers.edu>
|
||||
Frank Volf <volf@oasis.IAEhv.nl>
|
||||
Fulvio Risso <risso@polito.it>
|
||||
George Bakos <gbakos@ists.dartmouth.edu>
|
||||
Gerald Combs <gerald@ethereal.com>
|
||||
Gert Doering <gert@greenie.muc.de>
|
||||
Greg Stark <gsstark@mit.edu>
|
||||
Gilbert Ramirez Jr. <gram@xiexie.org>
|
||||
Gisle Vanem <gvanem@eunet.no>
|
||||
Hannes Gredler <hannes@juniper.net>
|
||||
Gisle Vanem <giva@bgnett.no>
|
||||
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>
|
||||
Jakob Schlyter <jakob@openbsd.org>
|
||||
Jan Oravec <wsx@wsx6.net>
|
||||
Jason R. Thorpe <thorpej@zembu.com>
|
||||
Jason R. Thorpe <thorpej@netbsd.org>
|
||||
Jefferson Ogata <jogata@nodc.noaa.gov>
|
||||
Jeffrey Hutzelman <jhutz@cmu.edu>
|
||||
Jesper Peterson <jesper@endace.com>
|
||||
Jim Hutchins <jim@ca.sandia.gov>
|
||||
JINMEI Tatuya <jinmei@kame.net>
|
||||
Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
|
||||
Jonathan Heusser <jonny@drugphish.ch>
|
||||
Tatuya Jinmei <jinmei@kame.net>
|
||||
Jørgen Thomsen <jth@jth.net>
|
||||
Julian Cowley <julian@lava.net>
|
||||
Kaarthik Sivakumar <kaarthik@torrentnet.com>
|
||||
Kazushi Sugyo <sugyo@pb.jp.nec.com>
|
||||
@ -50,38 +64,55 @@ Additional people who have contributed patches:
|
||||
Kevin Steves <stevesk@pobox.com>
|
||||
Klaus Klein <kleink@reziprozitaet.de>
|
||||
Kris Kennaway <kris@freebsd.org>
|
||||
Krzysztof Halasa <khc@pm.waw.pl>
|
||||
Larry Lile <lile@stdio.com>
|
||||
Lennert Buytenhek <buytenh@gnu.org>
|
||||
Loris Degioanni <loris@netgroup-serv.polito.it>
|
||||
Love Hörnquist-Åstrand <lha@stacken.kth.se>
|
||||
Maciej W. Rozycki <macro@ds2.pg.gda.pl>
|
||||
Marc A. Lehmann <pcg@goof.com>
|
||||
Mark Ellzey Thomas <mark@ackers.net>
|
||||
Marko Kiiskila <carnil@cs.tut.fi>
|
||||
Marshall Rose <mrose@dbc.mtview.ca.us>
|
||||
Martin Husemann <martin@netbsd.org>
|
||||
Michael Madore <mmadore@turbolinux.com>
|
||||
Michael Shalayeff <mickey@openbsd.org>
|
||||
Michael T. Stolarchuk <mts@off.to>
|
||||
Michele "mydecay" Marchetto <smarchetto1@tin.it>
|
||||
Monroe Williams <monroe@pobox.com>
|
||||
Motonori Shindo <mshindo@mshindo.net>
|
||||
Nathan J. Williams <nathanw@MIT.EDU>
|
||||
Nathaniel Couper-Noles <Nathaniel@isi1.tccisi.com>
|
||||
Neil T. Spring <bluehal@users.sourceforge.net>
|
||||
Niels Provos <provos@openbsd.org>
|
||||
Nickolai Zeldovich <kolya@MIT.EDU>
|
||||
Olaf Kirch <okir@caldera.de>
|
||||
Onno van der Linden <onno@simplex.nl>
|
||||
Pascal Hennequin <pascal.hennequin@int-evry.fr>
|
||||
Pasvorn Boonmark <boonmark@juniper.net>
|
||||
Paul Mundt <lethal@linux-sh.org>
|
||||
Paul S. Traina <pst@freebsd.org>
|
||||
Pavlin Radoslavov <pavlin@icir.org>
|
||||
Pekka Savola <pekkas@netcore.fi>
|
||||
Peter Fales <peter@fales-lorenz.net>
|
||||
Peter Jeremy <peter.jeremy@alcatel.com.au>
|
||||
Phil Wood <cpw@lanl.gov>
|
||||
Rafal Maszkowski <rzm@icm.edu.pl>
|
||||
Rick Jones <raj@cup.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>
|
||||
Seth Webster <swebster@sst.ll.mit.edu>
|
||||
Takashi Yamamoto <yamt@mwd.biglobe.ne.jp>
|
||||
Terry Kennedy <terry@tmk.com>
|
||||
Timo Koskiahde
|
||||
Tony Li <tli@procket.com>
|
||||
Uns Lider <unslider@miranda.org>
|
||||
Wilbert de Graaf <wilbertdg@hetnet.nl>
|
||||
Yen Yen Lim
|
||||
|
||||
The original LBL crew:
|
||||
Steve McCanne
|
||||
|
@ -5,15 +5,19 @@ INSTALL
|
||||
LICENSE
|
||||
Makefile.in
|
||||
README
|
||||
Readme.Win32
|
||||
VERSION
|
||||
acconfig.h
|
||||
aclocal.m4
|
||||
addrtoname.c
|
||||
addrtoname.h
|
||||
ah.h
|
||||
aodv.h
|
||||
appletalk.h
|
||||
arcnet.h
|
||||
atime.awk
|
||||
atm.h
|
||||
atmuni31.h
|
||||
bootp.h
|
||||
bpf_dump.c
|
||||
chdlc.h
|
||||
@ -23,11 +27,14 @@ config.sub
|
||||
configure
|
||||
configure.in
|
||||
decnet.h
|
||||
enc.h
|
||||
esp.h
|
||||
ether.h
|
||||
ethertype.h
|
||||
extract.h
|
||||
fddi.h
|
||||
gmpls.c
|
||||
gmpls.h
|
||||
gmt2local.c
|
||||
gmt2local.h
|
||||
icmp6.h
|
||||
@ -37,11 +44,14 @@ install-sh
|
||||
interface.h
|
||||
ip.h
|
||||
ip6.h
|
||||
ipfc.h
|
||||
ipproto.h
|
||||
ipsec_doi.h
|
||||
ipx.h
|
||||
isakmp.h
|
||||
l2tp.h
|
||||
lane.h
|
||||
lbl/os-osf4.h
|
||||
lbl/os-solaris2.h
|
||||
lbl/os-sunos4.h
|
||||
lbl/os-ultrix4.h
|
||||
@ -53,6 +63,8 @@ mib.h
|
||||
missing/addrinfo.h
|
||||
missing/addrsize.h
|
||||
missing/bittypes.h
|
||||
missing/dlnames.c
|
||||
missing/datalinks.c
|
||||
missing/getaddrinfo.c
|
||||
missing/getnameinfo.c
|
||||
missing/inet_aton.c
|
||||
@ -65,6 +77,7 @@ missing/sockstorage.h
|
||||
missing/strdup.c
|
||||
missing/strlcat.c
|
||||
missing/strlcpy.c
|
||||
missing/strsep.c
|
||||
mkdep
|
||||
nameser.h
|
||||
netbios.h
|
||||
@ -76,17 +89,21 @@ ospf.h
|
||||
ospf6.h
|
||||
packetdat.awk
|
||||
parsenfsfh.c
|
||||
pcap-missing.h
|
||||
ppp.h
|
||||
print-802_11.c
|
||||
print-ap1394.c
|
||||
print-ah.c
|
||||
print-aodv.c
|
||||
print-arcnet.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-beep.c
|
||||
print-cdp.c
|
||||
print-chdlc.c
|
||||
print-cip.c
|
||||
@ -96,9 +113,11 @@ print-dhcp6.c
|
||||
print-domain.c
|
||||
print-dvmrp.c
|
||||
print-egp.c
|
||||
print-enc.c
|
||||
print-esp.c
|
||||
print-ether.c
|
||||
print-fddi.c
|
||||
print-fr.c
|
||||
print-frag6.c
|
||||
print-gre.c
|
||||
print-hsrp.c
|
||||
@ -110,16 +129,18 @@ print-ip.c
|
||||
print-ip6.c
|
||||
print-ip6opts.c
|
||||
print-ipcomp.c
|
||||
print-ipfc.c
|
||||
print-ipx.c
|
||||
print-isakmp.c
|
||||
print-isoclns.c
|
||||
print-krb.c
|
||||
print-l2tp.c
|
||||
print-lane.c
|
||||
print-lcp.c
|
||||
print-ldp.c
|
||||
print-llc.c
|
||||
print-lwres.c
|
||||
print-mobile.c
|
||||
print-mobility.c
|
||||
print-mpls.c
|
||||
print-msdp.c
|
||||
print-netbios.c
|
||||
@ -128,6 +149,7 @@ print-ntp.c
|
||||
print-null.c
|
||||
print-ospf.c
|
||||
print-ospf6.c
|
||||
print-pflog.c
|
||||
print-pim.c
|
||||
print-ppp.c
|
||||
print-pppoe.c
|
||||
@ -136,6 +158,7 @@ print-radius.c
|
||||
print-raw.c
|
||||
print-rip.c
|
||||
print-ripng.c
|
||||
print-rsvp.c
|
||||
print-rt6.c
|
||||
print-rx.c
|
||||
print-sctp.c
|
||||
@ -144,6 +167,7 @@ print-sll.c
|
||||
print-smb.c
|
||||
print-snmp.c
|
||||
print-stp.c
|
||||
print-sunatm.c
|
||||
print-sunrpc.c
|
||||
print-tcp.c
|
||||
print-telnet.c
|
||||
@ -172,9 +196,23 @@ strcasecmp.c
|
||||
tcp.h
|
||||
tcpdump.1
|
||||
tcpdump.c
|
||||
tcpdump-stdinc.h
|
||||
telnet.h
|
||||
timed.h
|
||||
token.h
|
||||
udp.h
|
||||
util.c
|
||||
vfprintf.c
|
||||
win32/Include/Arpa/tftp.h
|
||||
win32/Include/errno.h
|
||||
win32/Include/getopt.h
|
||||
win32/Include/inetprivate.h
|
||||
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
|
||||
win32/prj/WinDump.dsw
|
||||
|
@ -1,4 +1,4 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.47.6.1 2002/07/16 04:41:57 guy Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.56.2.3 2004/03/17 19:47:47 guy Exp $ (LBL)
|
||||
|
||||
If you have not built libpcap, do so first. See the README
|
||||
file in this directory for the ftp location.
|
||||
@ -39,22 +39,26 @@ Please see "PLATFORMS" for notes about tested platforms.
|
||||
|
||||
FILES
|
||||
-----
|
||||
CHANGES - description of differences between releases
|
||||
CHANGES - description of differences between releases
|
||||
CREDITS - people that have helped tcpdump along
|
||||
FILES - list of files exported as part of the distribution
|
||||
INSTALL - this file
|
||||
INSTALL - this file
|
||||
LICENSE - the license under which tcpdump is distributed
|
||||
Makefile.in - compilation rules (input to the configure script)
|
||||
README - description of distribution
|
||||
Readme.Win32 - notes on building tcpdump on Win32 systems (with WinPcap)
|
||||
VERSION - version of this release
|
||||
acconfig.h - autoconf input
|
||||
aclocal.m4 - autoconf macros
|
||||
addrtoname.c - address to hostname routines
|
||||
addrtoname.h - address to hostname definitions
|
||||
ah.h - IPSEC Authentication Header definitions
|
||||
aodv.h - AODV definitions
|
||||
appletalk.h - AppleTalk definitions
|
||||
arcnet.h - ARCNET definitions
|
||||
atime.awk - TCP ack awk script
|
||||
atm.h - ATM traffic type definitions
|
||||
atmuni31.h - ATM Q.2931 definitions
|
||||
bootp.h - BOOTP definitions
|
||||
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
|
||||
have them
|
||||
@ -65,11 +69,14 @@ config.sub - autoconf support
|
||||
configure - configure script (run this first)
|
||||
configure.in - configure script source
|
||||
decnet.h - DECnet definitions
|
||||
enc.h - OpenBSD IPsec encapsulation BPF layer definitions
|
||||
esp.h - IPSEC Encapsulating Security Payload definitions
|
||||
ether.h - Ethernet definitions
|
||||
ethertype.h - Ethernet type value definitions
|
||||
extract.h - alignment definitions
|
||||
fddi.h - Fiber Distributed Data Interface definitions
|
||||
gmpls.c - GMPLS definitions
|
||||
gmpls.h - GMPLS declarations
|
||||
gmt2local.c - time conversion routines
|
||||
gmt2local.h - time conversion prototypes
|
||||
icmp6.h - ICMPv6 definitiions
|
||||
@ -79,6 +86,8 @@ install-sh - BSD style install script
|
||||
interface.h - globals, prototypes and definitions
|
||||
ip.h - IP definitions
|
||||
ip6.h - IPv6 definitions
|
||||
ipfc.h - IP-over-Fibre Channel definitions
|
||||
ipproto.h - IP protocol type value definitions
|
||||
ipsec_doi.h - ISAKMP packet definitions - RFC2407
|
||||
ipx.h - IPX definitions
|
||||
isakmp.h - ISAKMP packet definitions - RFC2408
|
||||
@ -102,9 +111,12 @@ ospf.h - Open Shortest Path First definitions
|
||||
ospf6.h - IPv6 Open Shortest Path First definitions
|
||||
packetdat.awk - TCP chunk summary awk script
|
||||
parsenfsfh.c - Network File System file parser routines
|
||||
pcap-missing.h - declarations of functions possibly missing from libpcap
|
||||
ppp.h - Point to Point Protocol definitions
|
||||
print-802_11.c - IEEE 802.11 printer routines
|
||||
print-ap1394.c - Apple IP-over-IEEE 1394 printer routines
|
||||
print-ah.c - IPSEC Authentication Header printer routines
|
||||
print-aodv.c - AODV printer routines
|
||||
print-arcnet.c - ARCNET printer routines
|
||||
print-arp.c - Address Resolution Protocol printer routines
|
||||
print-ascii.c - ASCII packet dump routines
|
||||
@ -121,10 +133,12 @@ print-decnet.c - DECnet printer routines
|
||||
print-dhcp6.c - IPv6 DHCP printer routines
|
||||
print-domain.c - Domain Name System printer routines
|
||||
print-dvmrp.c - Distance Vector Multicast Routing Protocol printer routines
|
||||
print-enc.c - OpenBSD IPsec encapsulation BPF layer printer routines
|
||||
print-egp.c - External Gateway Protocol printer routines
|
||||
print-esp.c - IPSEC Encapsulating Security Payload printer routines
|
||||
print-ether.c - Ethernet printer routines
|
||||
print-fddi.c - Fiber Distributed Data Interface printer routines
|
||||
print-fr.c - Frame Relay printer routines
|
||||
print-frag6.c - IPv6 fragmentation header printer routines
|
||||
print-gre.c - Generic Routing Encapsulation printer routines
|
||||
print-hsrp.c - Cisco Hot Standby Router Protocol printer routines
|
||||
@ -142,10 +156,10 @@ print-isoclns.c - ISO CLNS, ESIS, and ISIS printer routines
|
||||
print-krb.c - Kerberos printer routines
|
||||
print-l2tp.c - Layer Two Tunneling Protocol printer routines
|
||||
print-lane.c - ATM LANE printer routines
|
||||
print-lcp.c - PPP Link Control Protocol printer routines
|
||||
print-llc.c - IEEE 802.2 LLC printer routines
|
||||
print-lwres.c - Lightweight Resolver protocol printer routines
|
||||
print-mobile.c - IPv4 mobility printer routines
|
||||
print-mobility.c - IPv6 mobility printer routines
|
||||
print-mpls.c - Multi-Protocol Label Switching printer routines
|
||||
print-msdp.c - Multicast Source Discovery Protocol printer routines
|
||||
print-netbios.c - NetBIOS frame protocol printer routines
|
||||
@ -154,6 +168,7 @@ print-ntp.c - Network Time Protocol printer routines
|
||||
print-null.c - BSD loopback device printer routines
|
||||
print-ospf.c - Open Shortest Path First printer routines
|
||||
print-ospf6.c - IPv6 Open Shortest Path First printer routines
|
||||
print-pflog.c - OpenBSD packet filter log file printer routines
|
||||
print-pim.c - Protocol Independent Multicast printer routines
|
||||
print-ppp.c - Point to Point Protocol printer routines
|
||||
print-pppoe.c - PPP-over-Ethernet printer routines
|
||||
@ -162,6 +177,7 @@ print-radius.c - Radius protocol printer routines
|
||||
print-raw.c - Raw IP printer routines
|
||||
print-rip.c - Routing Information Protocol printer routines
|
||||
print-ripng.c - IPv6 Routing Information Protocol printer routines
|
||||
print-rsvp.c - Resource reSerVation Protocol (RSVP) printer routines
|
||||
print-rt6.c - IPv6 routing header printer routines
|
||||
print-rx.c - AFS RX printer routines
|
||||
print-sctp.c - Stream Control Transmission Protocol printer routines
|
||||
@ -170,6 +186,7 @@ print-sll.c - Linux "cooked" capture printer routines
|
||||
print-smb.c - SMB/CIFS printer routines
|
||||
print-snmp.c - Simple Network Management Protocol printer routines
|
||||
print-stp.c - IEEE 802.1d spanning tree protocol printer routines
|
||||
print-sunatm.c - SunATM DLPI capture printer routines
|
||||
print-sunrpc.c - Sun Remote Procedure Call printer routines
|
||||
print-tcp.c - TCP printer routines
|
||||
print-telnet.c - Telnet option printer routines
|
||||
@ -204,3 +221,4 @@ token.h - Token Ring definitions
|
||||
udp.h - UDP definitions
|
||||
util.c - utility routines
|
||||
vfprintf.c - emulation routine
|
||||
win32 - headers and routines for building on Win32 systems
|
||||
|
@ -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.260 2001/12/10 08:21:23 guy Exp $ (LBL)
|
||||
# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.276.2.4 2004/03/28 21:25:02 fenner 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@
|
||||
DEFS = @DEFS@ @V_DEFS@
|
||||
|
||||
# Standard CFLAGS
|
||||
CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
|
||||
@ -65,25 +65,26 @@ INSTALL_DATA = @INSTALL_DATA@
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
|
||||
|
||||
CSRC = addrtoname.c gmt2local.c machdep.c parsenfsfh.c \
|
||||
print-802_11.c print-ah.c print-arcnet.c print-arp.c \
|
||||
print-ascii.c print-atalk.c print-atm.c print-bgp.c \
|
||||
print-bootp.c print-beep.c print-cdp.c print-chdlc.c \
|
||||
print-cip.c print-cnfp.c print-decnet.c print-domain.c \
|
||||
print-dvmrp.c print-egp.c print-esp.c print-ether.c \
|
||||
print-fddi.c print-gre.c print-hsrp.c print-icmp.c \
|
||||
print-igmp.c print-igrp.c print-ip.c print-ipcomp.c \
|
||||
CSRC = addrtoname.c gmpls.c gmt2local.c machdep.c oui.c parsenfsfh.c \
|
||||
print-802_11.c print-ap1394.c print-ah.c print-arcnet.c \
|
||||
print-aodv.c print-arp.c print-ascii.c print-atalk.c print-atm.c \
|
||||
print-beep.c print-bfd.c print-bgp.c print-bootp.c print-cdp.c \
|
||||
print-chdlc.c print-cip.c print-cnfp.c print-decnet.c \
|
||||
print-domain.c print-dvmrp.c print-enc.c print-egp.c \
|
||||
print-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-l2tp.c print-lane.c print-lcp.c print-llc.c print-lwres.c \
|
||||
print-msdp.c print-mobile.c print-mpls.c print-nfs.c \
|
||||
print-ntp.c print-null.c print-ospf.c print-pim.c \
|
||||
print-ppp.c print-pppoe.c print-pptp.c print-radius.c \
|
||||
print-raw.c print-rip.c print-rx.c print-sctp.c \
|
||||
print-sl.c print-sll.c print-snmp.c \
|
||||
print-stp.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-wb.c print-zephyr.c \
|
||||
setsignal.c tcpdump.c util.c
|
||||
print-l2tp.c print-lane.c print-ldp.c print-llc.c \
|
||||
print-lwres.c print-mobile.c print-mpls.c print-msdp.c \
|
||||
print-nfs.c print-ntp.c print-null.c print-ospf.c \
|
||||
print-pflog.c print-pim.c print-ppp.c print-pppoe.c \
|
||||
print-pptp.c print-radius.c print-raw.c print-rip.c \
|
||||
print-rsvp.c print-rx.c print-sctp.c print-sl.c print-sll.c \
|
||||
print-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-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
|
||||
|
||||
LOCALSRC = @LOCALSRC@
|
||||
GENSRC = version.c
|
||||
@ -99,7 +100,7 @@ HDR = addrtoname.h appletalk.h bootp.h decnet.h \
|
||||
ipx.h llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h \
|
||||
setsignal.h \
|
||||
gnuc.h ipsec_doi.h isakmp.h l2tp.h nameser.h \
|
||||
netbios.h oakley.h ospf6.h ppp.h route6d.h
|
||||
netbios.h oakley.h ospf6.h pf.h ppp.h route6d.h
|
||||
|
||||
TAGHDR = \
|
||||
/usr/include/arpa/tftp.h \
|
||||
@ -122,6 +123,10 @@ $(PROG): $(OBJ) @V_PCAPDEP@
|
||||
@rm -f $@
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||
|
||||
datalinks.o: $(srcdir)/missing/datalinks.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/datalinks.c
|
||||
dlnames.o: $(srcdir)/missing/dlnames.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/dlnames.c
|
||||
getnameinfo.o: $(srcdir)/missing/getnameinfo.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/getnameinfo.c
|
||||
getaddrinfo.o: $(srcdir)/missing/getaddrinfo.c
|
||||
@ -138,6 +143,8 @@ strlcat.o: $(srcdir)/missing/strlcat.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
|
||||
strlcpy.o: $(srcdir)/missing/strlcpy.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
|
||||
strsep.o: $(srcdir)/missing/strsep.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
|
||||
|
||||
version.o: version.c
|
||||
$(CC) $(CFLAGS) -c version.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.60.2.3 2003/02/26 07:08:58 fenner Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.63.2.1 2003/11/16 10:17:30 guy Exp $ (LBL)
|
||||
|
||||
TCPDUMP 3.7.2
|
||||
TCPDUMP 3.8
|
||||
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.7.2 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_7rel2":
|
||||
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_7rel2 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
|
||||
|
||||
Please send patches against the master copy to patches@tcpdump.org.
|
||||
|
||||
|
24
contrib/tcpdump/Readme.Win32
Normal file
24
contrib/tcpdump/Readme.Win32
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.
|
@ -1 +1 @@
|
||||
3.7.2+multidlt
|
||||
3.8.3
|
||||
|
@ -65,6 +65,27 @@
|
||||
/* define if you have ether_ntohost() and it works */
|
||||
#undef USE_ETHER_NTOHOST
|
||||
|
||||
/* define if libpcap has pcap_version */
|
||||
#undef HAVE_PCAP_VERSION
|
||||
|
||||
/* define if libpcap has pcap_debug */
|
||||
#undef HAVE_PCAP_DEBUG
|
||||
|
||||
/* define if libpcap has yydebug */
|
||||
#undef HAVE_YYDEBUG
|
||||
|
||||
/* define if libpcap has pcap_list_datalinks() */
|
||||
#undef HAVE_PCAP_LIST_DATALINKS
|
||||
|
||||
/* define if libpcap has pcap_set_datalink() */
|
||||
#undef HAVE_PCAP_SET_DATALINK
|
||||
|
||||
/* define if libpcap has pcap_datalink_name_to_val() */
|
||||
#undef HAVE_PCAP_DATALINK_NAME_TO_VAL
|
||||
|
||||
/* define if libpcap has pcap_datalink_val_to_description() */
|
||||
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
@ -82,6 +103,7 @@
|
||||
|
||||
/* 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
|
||||
@ -98,3 +120,9 @@
|
||||
* in config.h but that should be OK since they're the same.
|
||||
*/
|
||||
#undef const
|
||||
|
||||
/* Define if you have the dnet_htoa function. */
|
||||
#undef HAVE_DNET_HTOA
|
||||
|
||||
/* Define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>. */
|
||||
#undef HAVE_NETDNET_DNETDB_H_DNET_HTOA
|
||||
|
190
contrib/tcpdump/aodv.h
Normal file
190
contrib/tcpdump/aodv.h
Normal file
@ -0,0 +1,190 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/aodv.h,v 1.3 2003/09/13 01:34:42 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 2003 Bruce M. Simpson <bms@spc.org>
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Bruce M. Simpson.
|
||||
* 4. Neither the name of Bruce M. Simpson nor the names of co-
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Bruce M. Simpson 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 Bruce M. Simpson 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.
|
||||
*/
|
||||
#ifndef _AODV_H_
|
||||
#define _AODV_H_
|
||||
|
||||
struct aodv_rreq {
|
||||
u_int8_t rreq_type; /* AODV message type (1) */
|
||||
u_int8_t rreq_flags; /* various flags */
|
||||
u_int8_t rreq_zero0; /* reserved, set to zero */
|
||||
u_int8_t rreq_hops; /* number of hops from originator */
|
||||
u_int32_t rreq_id; /* request ID */
|
||||
u_int32_t rreq_da; /* destination IPv4 address */
|
||||
u_int32_t rreq_ds; /* destination sequence number */
|
||||
u_int32_t rreq_oa; /* originator IPv4 address */
|
||||
u_int32_t rreq_os; /* originator sequence number */
|
||||
};
|
||||
#ifdef INET6
|
||||
struct aodv_rreq6 {
|
||||
u_int8_t rreq_type; /* AODV message type (1) */
|
||||
u_int8_t rreq_flags; /* various flags */
|
||||
u_int8_t rreq_zero0; /* reserved, set to zero */
|
||||
u_int8_t rreq_hops; /* number of hops from originator */
|
||||
u_int32_t rreq_id; /* request ID */
|
||||
struct in6_addr rreq_da; /* destination IPv6 address */
|
||||
u_int32_t rreq_ds; /* destination sequence number */
|
||||
struct in6_addr rreq_oa; /* originator IPv6 address */
|
||||
u_int32_t rreq_os; /* originator sequence number */
|
||||
};
|
||||
struct aodv_rreq6_draft_01 {
|
||||
u_int8_t rreq_type; /* AODV message type (16) */
|
||||
u_int8_t rreq_flags; /* various flags */
|
||||
u_int8_t rreq_zero0; /* reserved, set to zero */
|
||||
u_int8_t rreq_hops; /* number of hops from originator */
|
||||
u_int32_t rreq_id; /* request ID */
|
||||
u_int32_t rreq_ds; /* destination sequence number */
|
||||
u_int32_t rreq_os; /* originator sequence number */
|
||||
struct in6_addr rreq_da; /* destination IPv6 address */
|
||||
struct in6_addr rreq_oa; /* originator IPv6 address */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define RREQ_JOIN 0x80 /* join (reserved for multicast */
|
||||
#define RREQ_REPAIR 0x40 /* repair (reserved for multicast */
|
||||
#define RREQ_GRAT 0x20 /* gratuitous RREP */
|
||||
#define RREQ_DEST 0x10 /* destination only */
|
||||
#define RREQ_UNKNOWN 0x08 /* unknown destination sequence num */
|
||||
#define RREQ_FLAGS_MASK 0xF8 /* mask for rreq_flags */
|
||||
|
||||
struct aodv_rrep {
|
||||
u_int8_t rrep_type; /* AODV message type (2) */
|
||||
u_int8_t rrep_flags; /* various flags */
|
||||
u_int8_t rrep_ps; /* prefix size */
|
||||
u_int8_t rrep_hops; /* number of hops from o to d */
|
||||
u_int32_t rrep_da; /* destination IPv4 address */
|
||||
u_int32_t rrep_ds; /* destination sequence number */
|
||||
u_int32_t rrep_oa; /* originator IPv4 address */
|
||||
u_int32_t rrep_life; /* lifetime of this route */
|
||||
};
|
||||
#ifdef INET6
|
||||
struct aodv_rrep6 {
|
||||
u_int8_t rrep_type; /* AODV message type (2) */
|
||||
u_int8_t rrep_flags; /* various flags */
|
||||
u_int8_t rrep_ps; /* prefix size */
|
||||
u_int8_t rrep_hops; /* number of hops from o to d */
|
||||
struct in6_addr rrep_da; /* destination IPv6 address */
|
||||
u_int32_t rrep_ds; /* destination sequence number */
|
||||
struct in6_addr rrep_oa; /* originator IPv6 address */
|
||||
u_int32_t rrep_life; /* lifetime of this route */
|
||||
};
|
||||
struct aodv_rrep6_draft_01 {
|
||||
u_int8_t rrep_type; /* AODV message type (17) */
|
||||
u_int8_t rrep_flags; /* various flags */
|
||||
u_int8_t rrep_ps; /* prefix size */
|
||||
u_int8_t rrep_hops; /* number of hops from o to d */
|
||||
u_int32_t rrep_ds; /* destination sequence number */
|
||||
struct in6_addr rrep_da; /* destination IPv6 address */
|
||||
struct in6_addr rrep_oa; /* originator IPv6 address */
|
||||
u_int32_t rrep_life; /* lifetime of this route */
|
||||
};
|
||||
#endif
|
||||
|
||||
#define RREP_REPAIR 0x80 /* repair (reserved for multicast */
|
||||
#define RREP_ACK 0x40 /* acknowledgement required */
|
||||
#define RREP_FLAGS_MASK 0xC0 /* mask for rrep_flags */
|
||||
#define RREP_PREFIX_MASK 0x1F /* mask for prefix size */
|
||||
|
||||
struct rerr_unreach {
|
||||
u_int32_t u_da; /* IPv4 address */
|
||||
u_int32_t u_ds; /* sequence number */
|
||||
};
|
||||
#ifdef INET6
|
||||
struct rerr_unreach6 {
|
||||
struct in6_addr u_da; /* IPv6 address */
|
||||
u_int32_t u_ds; /* sequence number */
|
||||
};
|
||||
struct rerr_unreach6_draft_01 {
|
||||
struct in6_addr u_da; /* IPv6 address */
|
||||
u_int32_t u_ds; /* sequence number */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct aodv_rerr {
|
||||
u_int8_t rerr_type; /* AODV message type (3 or 18) */
|
||||
u_int8_t rerr_flags; /* various flags */
|
||||
u_int8_t rerr_zero0; /* reserved, set to zero */
|
||||
u_int8_t rerr_dc; /* destination count */
|
||||
union {
|
||||
struct rerr_unreach dest[1];
|
||||
#ifdef INET6
|
||||
struct rerr_unreach6 dest6[1];
|
||||
struct rerr_unreach6_draft_01 dest6_draft_01[1];
|
||||
#endif
|
||||
} r;
|
||||
};
|
||||
|
||||
#define RERR_NODELETE 0x80 /* don't delete the link */
|
||||
#define RERR_FLAGS_MASK 0x80 /* mask for rerr_flags */
|
||||
|
||||
struct aodv_rrep_ack {
|
||||
u_int8_t ra_type;
|
||||
u_int8_t ra_zero0;
|
||||
};
|
||||
|
||||
union aodv {
|
||||
struct aodv_rreq rreq;
|
||||
struct aodv_rrep rrep;
|
||||
struct aodv_rerr rerr;
|
||||
struct aodv_rrep_ack rrep_ack;
|
||||
#ifdef INET6
|
||||
struct aodv_rreq6 rreq6;
|
||||
struct aodv_rreq6_draft_01 rreq6_draft_01;
|
||||
struct aodv_rrep6 rrep6;
|
||||
struct aodv_rrep6_draft_01 rrep6_draft_01;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define AODV_RREQ 1 /* route request */
|
||||
#define AODV_RREP 2 /* route response */
|
||||
#define AODV_RERR 3 /* error report */
|
||||
#define AODV_RREP_ACK 4 /* route response acknowledgement */
|
||||
|
||||
#define AODV_V6_DRAFT_01_RREQ 16 /* IPv6 route request */
|
||||
#define AODV_V6_DRAFT_01_RREP 17 /* IPv6 route response */
|
||||
#define AODV_V6_DRAFT_01_RERR 18 /* IPv6 error report */
|
||||
#define AODV_V6_DRAFT_01_RREP_ACK 19 /* IPV6 route response acknowledgment */
|
||||
|
||||
struct aodv_ext {
|
||||
u_int8_t type; /* extension type */
|
||||
u_int8_t length; /* extension length */
|
||||
};
|
||||
|
||||
struct aodv_hello {
|
||||
struct aodv_ext eh; /* extension header */
|
||||
u_int32_t interval; /* expect my next hello in
|
||||
* (n) ms */
|
||||
};
|
||||
|
||||
#define AODV_EXT_HELLO 1
|
||||
|
||||
#endif /* _AODV_H_ */
|
@ -20,7 +20,7 @@
|
||||
*
|
||||
* AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.13 2000/10/03 02:54:54 itojun Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.15 2002/12/11 07:13:49 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
struct LAP {
|
||||
|
@ -30,13 +30,13 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Id: arcnet.h,v 1.1 2001/04/17 08:39:18 guy Exp $ (LBL)
|
||||
* @(#) $Id: arcnet.h,v 1.3 2003/01/23 09:05:37 guy Exp $ (LBL)
|
||||
*
|
||||
* from: NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure of a 2.5MB/s Arcnet header.
|
||||
* Structure of a 2.5MB/s Arcnet header on the BSDs,
|
||||
* as given to interface code.
|
||||
*/
|
||||
struct arc_header {
|
||||
@ -56,7 +56,7 @@ struct arc_header {
|
||||
u_int8_t arc_type2; /* same as arc_type */
|
||||
u_int8_t arc_flag2; /* real flag value */
|
||||
u_int16_t arc_seqid2; /* real seqid value */
|
||||
} __attribute__((__packed__));
|
||||
};
|
||||
|
||||
#define ARC_HDRLEN 3
|
||||
#define ARC_HDRNEWLEN 6
|
||||
@ -77,3 +77,25 @@ struct arc_header {
|
||||
|
||||
#define ARCTYPE_INET6 0xc4 /* IPng */
|
||||
#define ARCTYPE_DIAGNOSE 0x80 /* as per ANSI/ATA 878.1 */
|
||||
|
||||
/*
|
||||
* Structure of a 2.5MB/s Arcnet header on Linux. Linux has
|
||||
* an extra "offset" field when given to interface code, and
|
||||
* never presents packets that look like exception frames.
|
||||
*/
|
||||
struct arc_linux_header {
|
||||
u_int8_t arc_shost;
|
||||
u_int8_t arc_dhost;
|
||||
u_int16_t arc_offset;
|
||||
u_int8_t arc_type;
|
||||
/*
|
||||
* only present for newstyle encoding with LL fragmentation.
|
||||
* Don't use sizeof(anything), use ARC_LINUX_HDR{,NEW}LEN
|
||||
* instead.
|
||||
*/
|
||||
u_int8_t arc_flag;
|
||||
u_int16_t arc_seqid;
|
||||
};
|
||||
|
||||
#define ARC_LINUX_HDRLEN 5
|
||||
#define ARC_LINUX_HDRNEWLEN 8
|
||||
|
25
contrib/tcpdump/atm.h
Normal file
25
contrib/tcpdump/atm.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2002 Guy Harris.
|
||||
* 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, 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.
|
||||
* The name of Guy Harris may not 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/atm.h,v 1.1 2002/07/11 09:17:22 guy Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Traffic types for ATM.
|
||||
*/
|
||||
#define ATM_UNKNOWN 0 /* Unknown */
|
||||
#define ATM_LANE 1 /* LANE */
|
||||
#define ATM_LLC 2 /* LLC encapsulation */
|
87
contrib/tcpdump/atmuni31.h
Normal file
87
contrib/tcpdump/atmuni31.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 1997 Yen Yen Lim and North Dakota State University
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Yen Yen Lim and
|
||||
North Dakota State University
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/atmuni31.h,v 1.2 2002/08/05 07:47:23 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Based on UNI3.1 standard by ATM Forum */
|
||||
|
||||
/* ATM traffic types based on VPI=0 and (the following VCI */
|
||||
#define PPC 0x05 /* Point-to-point signal msg */
|
||||
#define BCC 0x02 /* Broadcast signal msg */
|
||||
#define OAMF4SC 0x03 /* Segment OAM F4 flow cell */
|
||||
#define OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
|
||||
#define METAC 0x01 /* Meta signal msg */
|
||||
#define ILMIC 0x10 /* ILMI msg */
|
||||
|
||||
/* Q.2931 signalling messages */
|
||||
#define CALL_PROCEED 0x02 /* call proceeding */
|
||||
#define CONNECT 0x07 /* connect */
|
||||
#define CONNECT_ACK 0x0f /* connect_ack */
|
||||
#define SETUP 0x05 /* setup */
|
||||
#define RELEASE 0x4d /* release */
|
||||
#define RELEASE_DONE 0x5a /* release_done */
|
||||
#define RESTART 0x46 /* restart */
|
||||
#define RESTART_ACK 0x4e /* restart ack */
|
||||
#define STATUS 0x7d /* status */
|
||||
#define STATUS_ENQ 0x75 /* status ack */
|
||||
#define ADD_PARTY 0x80 /* add party */
|
||||
#define ADD_PARTY_ACK 0x81 /* add party ack */
|
||||
#define ADD_PARTY_REJ 0x82 /* add party rej */
|
||||
#define DROP_PARTY 0x83 /* drop party */
|
||||
#define DROP_PARTY_ACK 0x84 /* drop party ack */
|
||||
|
||||
/* Information Element Parameters in the signalling messages */
|
||||
#define CAUSE 0x08 /* cause */
|
||||
#define ENDPT_REF 0x54 /* endpoint reference */
|
||||
#define AAL_PARA 0x58 /* ATM adaptation layer parameters */
|
||||
#define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
|
||||
#define CONNECT_ID 0x5a /* connection identifier */
|
||||
#define QOS_PARA 0x5c /* quality of service parameters */
|
||||
#define B_HIGHER 0x5d /* broadband higher layer information */
|
||||
#define B_BEARER 0x5e /* broadband bearer capability */
|
||||
#define B_LOWER 0x5f /* broadband lower information */
|
||||
#define CALLING_PARTY 0x6c /* calling party number */
|
||||
#define CALLED_PARTY 0x70 /* called party nmber */
|
||||
|
||||
#define Q2931 0x09
|
||||
|
||||
/* Q.2931 signalling general messages format */
|
||||
#define PROTO_POS 0 /* offset of protocol discriminator */
|
||||
#define CALL_REF_POS 2 /* offset of call reference value */
|
||||
#define MSG_TYPE_POS 5 /* offset of message type */
|
||||
#define MSG_LEN_POS 7 /* offset of mesage length */
|
||||
#define IE_BEGIN_POS 9 /* offset of first information element */
|
||||
|
||||
/* format of signalling messages */
|
||||
#define TYPE_POS 0
|
||||
#define LEN_POS 2
|
||||
#define FIELD_BEGIN_POS 4
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.11 2001/01/09 07:39:13 fenner Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.15 2003/07/01 19:16:06 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
|
||||
*
|
||||
@ -27,7 +27,7 @@ struct bootp {
|
||||
u_int8_t bp_hops; /* gateway hops */
|
||||
u_int32_t bp_xid; /* transaction ID */
|
||||
u_int16_t bp_secs; /* seconds since boot began */
|
||||
u_int16_t bp_flags; /* flags: 0x8000 is broadcast */
|
||||
u_int16_t bp_flags; /* flags - see bootp_flag_values[] in print-bootp.c */
|
||||
struct in_addr bp_ciaddr; /* client IP address */
|
||||
struct in_addr bp_yiaddr; /* 'your' IP address */
|
||||
struct in_addr bp_siaddr; /* server IP address */
|
||||
@ -44,9 +44,8 @@ struct bootp {
|
||||
#define IPPORT_BOOTPS 67
|
||||
#define IPPORT_BOOTPC 68
|
||||
|
||||
#define BOOTREPLY 2
|
||||
#define BOOTREQUEST 1
|
||||
|
||||
#define BOOTPREPLY 2
|
||||
#define BOOTPREQUEST 1
|
||||
|
||||
/*
|
||||
* Vendor magic cookie (v_magic) for CMU
|
||||
|
@ -19,16 +19,15 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.13 2000/12/09 02:58:45 fenner Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.14.2.2 2003/11/16 08:51:04 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
|
730
contrib/tcpdump/config.guess
vendored
730
contrib/tcpdump/config.guess
vendored
File diff suppressed because it is too large
Load Diff
@ -1,16 +1,7 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
/* "generated automatically" means DO NOT MAKE CHANGES TO config.h.in --
|
||||
* make them to acconfig.h and rerun autoheader */
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if you have SSLeay 0.9.0b with the buggy cast128. */
|
||||
#undef HAVE_BUGGY_CAST128
|
||||
|
||||
@ -20,12 +11,24 @@
|
||||
/* Define if you enable support for the libsmi. */
|
||||
#undef LIBSMI
|
||||
|
||||
/* Define if you have the <smi.h> header file. */
|
||||
#undef HAVE_SMI_H
|
||||
|
||||
/* define if you have struct __res_state_ext */
|
||||
#undef HAVE_RES_STATE_EXT
|
||||
|
||||
/* 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
|
||||
*/
|
||||
#undef ETHER_HEADER_HAS_EA
|
||||
|
||||
/* define if struct ether_arp contains arp_xsha */
|
||||
#undef ETHER_ARP_HAS_X
|
||||
|
||||
/* define if you have the addrinfo function. */
|
||||
#undef HAVE_ADDRINFO
|
||||
|
||||
@ -44,6 +47,9 @@
|
||||
/* define if this is a development version, to use additional prototypes. */
|
||||
#undef HAVE_OS_PROTO_H
|
||||
|
||||
/* define if <unistd.h> defines __P() */
|
||||
#undef HAVE_PORTABLE_PROTOTYPE
|
||||
|
||||
/* define if RES_USE_INET6 is defined */
|
||||
#undef HAVE_RES_USE_INET6
|
||||
|
||||
@ -53,9 +59,33 @@
|
||||
/* define if you have struct sockaddr_storage */
|
||||
#undef HAVE_SOCKADDR_STORAGE
|
||||
|
||||
/* define if you have both getipnodebyname() and getipnodebyaddr() */
|
||||
#undef USE_GETIPNODEBY
|
||||
|
||||
/* define if you have ether_ntohost() and it works */
|
||||
#undef USE_ETHER_NTOHOST
|
||||
|
||||
/* define if libpcap has pcap_version */
|
||||
#undef HAVE_PCAP_VERSION
|
||||
|
||||
/* define if libpcap has pcap_debug */
|
||||
#undef HAVE_PCAP_DEBUG
|
||||
|
||||
/* define if libpcap has yydebug */
|
||||
#undef HAVE_YYDEBUG
|
||||
|
||||
/* define if libpcap has pcap_list_datalinks() */
|
||||
#undef HAVE_PCAP_LIST_DATALINKS
|
||||
|
||||
/* define if libpcap has pcap_set_datalink() */
|
||||
#undef HAVE_PCAP_SET_DATALINK
|
||||
|
||||
/* define if libpcap has pcap_datalink_name_to_val() */
|
||||
#undef HAVE_PCAP_DATALINK_NAME_TO_VAL
|
||||
|
||||
/* define if libpcap has pcap_datalink_val_to_description() */
|
||||
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
@ -73,6 +103,7 @@
|
||||
|
||||
/* 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
|
||||
@ -90,105 +121,173 @@
|
||||
*/
|
||||
#undef const
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#undef SIZEOF_CHAR
|
||||
/* Define if you have the dnet_htoa function. */
|
||||
#undef HAVE_DNET_HTOA
|
||||
|
||||
/* The number of bytes in a int. */
|
||||
#undef SIZEOF_INT
|
||||
/* Define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>. */
|
||||
#undef HAVE_NETDNET_DNETDB_H_DNET_HTOA
|
||||
|
||||
/* The number of bytes in a long. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The number of bytes in a short. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* Define if you have the bpf_dump function. */
|
||||
/* Define to 1 if you have the `bpf_dump' function. */
|
||||
#undef HAVE_BPF_DUMP
|
||||
|
||||
/* Define if you have the ether_ntohost function. */
|
||||
/* Define to 1 if you have the `ether_ntohost' function. */
|
||||
#undef HAVE_ETHER_NTOHOST
|
||||
|
||||
/* Define if you have the getaddrinfo function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the getnameinfo function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
/* Define if you have the inet_aton function. */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
/* Define if you have the inet_ntop function. */
|
||||
#undef HAVE_INET_NTOP
|
||||
|
||||
/* Define if you have the inet_pton function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define if you have the pfopen function. */
|
||||
#undef HAVE_PFOPEN
|
||||
|
||||
/* Define if you have the setlinebuf function. */
|
||||
#undef HAVE_SETLINEBUF
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define if you have the sigset function. */
|
||||
#undef HAVE_SIGSET
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define if you have the strlcat function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcpy function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the vfprintf function. */
|
||||
#undef HAVE_VFPRINTF
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define if you have the <cast.h> header file. */
|
||||
#undef HAVE_CAST_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||
#undef HAVE_NETINET_IF_ETHER_H
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the <rc5.h> header file. */
|
||||
#undef HAVE_RC5_H
|
||||
/* Define to 1 if you have the `getnameinfo' function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
/* Define if you have the <rpc/rpcent.h> header file. */
|
||||
#undef HAVE_RPC_RPCENT_H
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have the <smi.h> header file. */
|
||||
#undef HAVE_SMI_H
|
||||
|
||||
/* Define if you have the crypto library (-lcrypto). */
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define if you have the dnet library (-ldnet). */
|
||||
#undef HAVE_LIBDNET
|
||||
|
||||
/* Define if you have the rpc library (-lrpc). */
|
||||
/* Define to 1 if you have the `rpc' library (-lrpc). */
|
||||
#undef HAVE_LIBRPC
|
||||
|
||||
/* Define if you have the smi library (-lsmi). */
|
||||
/* Define to 1 if you have the `smi' library (-lsmi). */
|
||||
#undef HAVE_LIBSMI
|
||||
|
||||
/* Define as token for inline if inlining supported */
|
||||
#undef inline
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <netdnet/dnetdb.h> header file. */
|
||||
#undef HAVE_NETDNET_DNETDB_H
|
||||
|
||||
/* Define to 1 if you have the <netinet/ether.h> header file. */
|
||||
#undef HAVE_NETINET_ETHER_H
|
||||
|
||||
/* Define to 1 if you have the <netinet/if_ether.h> header file. */
|
||||
#undef HAVE_NETINET_IF_ETHER_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/evp.h> header file. */
|
||||
#undef HAVE_OPENSSL_EVP_H
|
||||
|
||||
/* Define to 1 if you have the `pcap_breakloop' function. */
|
||||
#undef HAVE_PCAP_BREAKLOOP
|
||||
|
||||
/* Define to 1 if you have the `pcap_dump_flush' function. */
|
||||
#undef HAVE_PCAP_DUMP_FLUSH
|
||||
|
||||
/* Define to 1 if you have the `pcap_findalldevs' function. */
|
||||
#undef HAVE_PCAP_FINDALLDEVS
|
||||
|
||||
/* Define to 1 if the system has the type `pcap_if_t'. */
|
||||
#undef HAVE_PCAP_IF_T
|
||||
|
||||
/* Define to 1 if you have the `pcap_lib_version' function. */
|
||||
#undef HAVE_PCAP_LIB_VERSION
|
||||
|
||||
/* Define to 1 if you have the `pfopen' function. */
|
||||
#undef HAVE_PFOPEN
|
||||
|
||||
/* Define to 1 if you have the <rpc/rpcent.h> header file. */
|
||||
#undef HAVE_RPC_RPCENT_H
|
||||
|
||||
/* Define to 1 if you have the `setlinebuf' function. */
|
||||
#undef HAVE_SETLINEBUF
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define to 1 if you have the `sigset' function. */
|
||||
#undef HAVE_SIGSET
|
||||
|
||||
/* Define to 1 if you have the <smi.h> header file. */
|
||||
#undef HAVE_SMI_H
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the `strftime' function. */
|
||||
#undef HAVE_STRFTIME
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strlcat' function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfprintf' function. */
|
||||
#undef HAVE_VFPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* define if your compiler has __attribute__ */
|
||||
#undef HAVE___ATTRIBUTE__
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* The size of a `char', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of a `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define as token for inline if inlining supported */
|
||||
#undef inline
|
||||
|
395
contrib/tcpdump/config.sub
vendored
395
contrib/tcpdump/config.sub
vendored
@ -1,9 +1,9 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-04-20'
|
||||
timestamp='2003-11-03'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -29,7 +29,8 @@ timestamp='2001-04-20'
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
@ -117,7 +118,8 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
|
||||
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@ -157,6 +159,14 @@ case $os in
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusos*)
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
@ -215,26 +225,50 @@ esac
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
|
||||
| arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
|
||||
| pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 \
|
||||
| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
| hppa64 \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
|
||||
| alphaev6[78] \
|
||||
| we32k | ns16k | clipper | i370 | sh | sh[34] \
|
||||
| powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp10 | pdp11 \
|
||||
| mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
|
||||
| v850 | c4x \
|
||||
| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
|
||||
| pj | pjl | h8500)
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
| mips64vr | mips64vrel \
|
||||
| mips64orion | mips64orionel \
|
||||
| mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr4300 | mips64vr4300el \
|
||||
| mips64vr5000 | mips64vr5000el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| msp430 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
@ -242,7 +276,7 @@ case $basic_machine in
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
@ -257,31 +291,61 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
| xmp-* | ymp-* \
|
||||
| x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
|
||||
| hppa2.0n-* | hppa64-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| alphaev6[78]-* \
|
||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||
| clipper-* | orion-* \
|
||||
| sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \
|
||||
| mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
|
||||
| [cjt]90-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
|
||||
| bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
| mips64vr-* | mips64vrel-* \
|
||||
| mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* \
|
||||
| mips64vr5000-* | mips64vr5000el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| msp430-* \
|
||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| xtensa-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
@ -313,6 +377,9 @@ case $basic_machine in
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@ -344,6 +411,10 @@ case $basic_machine in
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
@ -364,16 +435,8 @@ case $basic_machine in
|
||||
basic_machine=c38-convex
|
||||
os=-bsd
|
||||
;;
|
||||
cray | ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cray2)
|
||||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[cjt]90)
|
||||
basic_machine=${basic_machine}-cray
|
||||
cray | j90)
|
||||
basic_machine=j90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
@ -388,6 +451,14 @@ case $basic_machine in
|
||||
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||
basic_machine=mips-dec
|
||||
;;
|
||||
decsystem10* | dec10*)
|
||||
basic_machine=pdp10-dec
|
||||
os=-tops10
|
||||
;;
|
||||
decsystem20* | dec20*)
|
||||
basic_machine=pdp10-dec
|
||||
os=-tops20
|
||||
;;
|
||||
delta | 3300 | motorola-3300 | motorola-delta \
|
||||
| 3300-motorola | delta-motorola)
|
||||
basic_machine=m68k-motorola
|
||||
@ -568,14 +639,6 @@ case $basic_machine in
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
@ -590,6 +653,10 @@ case $basic_machine in
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
morphos)
|
||||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
@ -662,6 +729,10 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@ -669,6 +740,14 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
or32 | or32-*)
|
||||
basic_machine=or32-unknown
|
||||
os=-coff
|
||||
;;
|
||||
os400)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-os400
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
@ -691,42 +770,58 @@ case $basic_machine in
|
||||
pbb)
|
||||
basic_machine=m68k-tti
|
||||
;;
|
||||
pc532 | pc532-*)
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
pentiumpro | p6 | 6x86 | athlon | athlon_*)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
pentiumii | pentium2 | pentiumiii | pentium3)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
pentium4)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium4-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
;;
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
;;
|
||||
;;
|
||||
ppcle-* | powerpclittle-*)
|
||||
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64) basic_machine=powerpc64-unknown
|
||||
;;
|
||||
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
|
||||
basic_machine=powerpc64le-unknown
|
||||
;;
|
||||
ppc64le-* | powerpc64little-*)
|
||||
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
@ -744,10 +839,26 @@ case $basic_machine in
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
s390 | s390-*)
|
||||
basic_machine=s390-ibm
|
||||
;;
|
||||
s390x | s390x-*)
|
||||
basic_machine=s390x-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
sb1)
|
||||
basic_machine=mipsisa64sb1-unknown
|
||||
;;
|
||||
sb1el)
|
||||
basic_machine=mipsisa64sb1el-unknown
|
||||
;;
|
||||
sei)
|
||||
basic_machine=mips-sei
|
||||
os=-seiux
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@ -755,7 +866,10 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs)
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparclite-wrs | simso-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
@ -822,22 +936,42 @@ case $basic_machine in
|
||||
os=-dynix
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=t3e-cray
|
||||
basic_machine=alphaev5-cray
|
||||
os=-unicos
|
||||
;;
|
||||
t90)
|
||||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
toad1)
|
||||
basic_machine=pdp10-xkl
|
||||
os=-tops20
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
tpf)
|
||||
basic_machine=s390x-ibm
|
||||
os=-tpf
|
||||
;;
|
||||
udi29k)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
@ -859,8 +993,8 @@ case $basic_machine in
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
basic_machine=i960-wrs
|
||||
os=-vxworks
|
||||
@ -881,13 +1015,13 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
xps | xps100)
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
@ -908,13 +1042,6 @@ case $basic_machine in
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
@ -934,13 +1061,16 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4)
|
||||
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
cydra)
|
||||
basic_machine=cydra-cydrome
|
||||
;;
|
||||
orion)
|
||||
@ -955,10 +1085,6 @@ case $basic_machine in
|
||||
pmac | pmac-mpw)
|
||||
basic_machine=powerpc-apple
|
||||
;;
|
||||
c4x*)
|
||||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*-unknown)
|
||||
# Make sure to match an already-canonicalized machine name.
|
||||
;;
|
||||
@ -1014,15 +1140,19 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1034,8 +1164,10 @@ case $os in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto-qnx*)
|
||||
;;
|
||||
-nto*)
|
||||
os=-nto-qnx
|
||||
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
@ -1044,6 +1176,9 @@ case $os in
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux-dietlibc)
|
||||
os=-linux-dietlibc
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@ -1056,6 +1191,9 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
@ -1074,14 +1212,20 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-nova*)
|
||||
os=-rtmk-nova
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
os=-nsk
|
||||
@ -1093,6 +1237,9 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
os=-sysv3
|
||||
;;
|
||||
@ -1120,8 +1267,14 @@ case $os in
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
;;
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
@ -1154,10 +1307,14 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
;;
|
||||
pdp11-*)
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
*-dec | vax-*)
|
||||
@ -1184,6 +1341,9 @@ case $basic_machine in
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
or32-*)
|
||||
os=-coff
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
@ -1247,19 +1407,19 @@ case $basic_machine in
|
||||
*-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
*-gould)
|
||||
*-gould)
|
||||
os=-sysv
|
||||
;;
|
||||
*-highlevel)
|
||||
*-highlevel)
|
||||
os=-bsd
|
||||
;;
|
||||
*-encore)
|
||||
os=-bsd
|
||||
;;
|
||||
*-sgi)
|
||||
*-sgi)
|
||||
os=-irix
|
||||
;;
|
||||
*-siemens)
|
||||
*-siemens)
|
||||
os=-sysv4
|
||||
;;
|
||||
*-masscomp)
|
||||
@ -1328,10 +1488,16 @@ case $basic_machine in
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-os400*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
vendor=sequent
|
||||
;;
|
||||
-vxsim* | -vxworks*)
|
||||
-tpf*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-vxsim* | -vxworks* | -windiss*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
@ -1346,6 +1512,9 @@ case $basic_machine in
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
vendor=atari
|
||||
;;
|
||||
-vos*)
|
||||
vendor=stratus
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
|
12140
contrib/tcpdump/configure
vendored
12140
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.145.2.1 2002/06/28 10:48:31 guy Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.169.2.3 2004/03/28 21:04:48 fenner Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1994, 1995, 1996, 1997
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -6,8 +6,8 @@ dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_REVISION($Revision: 1.145.2.1 $)
|
||||
AC_PREREQ(2.13)
|
||||
AC_REVISION($Revision: 1.169.2.3 $)
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(tcpdump.c)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
@ -16,7 +16,9 @@ AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
||||
AC_LBL_C_INLINE
|
||||
AC_C___ATTRIBUTE__
|
||||
|
||||
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netinet/if_ether.h)
|
||||
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h)
|
||||
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
AC_HEADER_TIME
|
||||
|
||||
case "$host_os" in
|
||||
@ -102,14 +104,13 @@ yes) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac
|
||||
|
||||
CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
|
||||
AC_MSG_CHECKING([whether to enable ipv6])
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
[ --enable-ipv6 enable ipv6 (with ipv4) support
|
||||
--disable-ipv6 disable ipv6 support],
|
||||
[ case "$enableval" in
|
||||
yes) AC_MSG_RESULT(yes)
|
||||
LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
|
||||
LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
|
||||
AC_DEFINE(INET6)
|
||||
ipv6=yes
|
||||
;;
|
||||
@ -131,7 +132,7 @@ main()
|
||||
}
|
||||
],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
|
||||
LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
|
||||
AC_DEFINE(INET6)
|
||||
ipv6=yes],
|
||||
[ AC_MSG_RESULT(no)
|
||||
@ -150,8 +151,8 @@ if test "$ipv6" = "yes"; then
|
||||
case $i in
|
||||
inria)
|
||||
dnl http://www.kame.net/
|
||||
AC_EGREP_CPP(yes, [dnl
|
||||
#include <netinet/in.h>
|
||||
AC_EGREP_CPP(yes,
|
||||
[#include <netinet/in.h>
|
||||
#ifdef IPV6_INRIA_VERSION
|
||||
yes
|
||||
#endif],
|
||||
@ -160,8 +161,8 @@ yes
|
||||
;;
|
||||
kame)
|
||||
dnl http://www.kame.net/
|
||||
AC_EGREP_CPP(yes, [dnl
|
||||
#include <netinet/in.h>
|
||||
AC_EGREP_CPP(yes,
|
||||
[#include <netinet/in.h>
|
||||
#ifdef __KAME__
|
||||
yes
|
||||
#endif],
|
||||
@ -173,8 +174,8 @@ yes
|
||||
;;
|
||||
linux-glibc)
|
||||
dnl http://www.v6.linux.or.jp/
|
||||
AC_EGREP_CPP(yes, [dnl
|
||||
#include <features.h>
|
||||
AC_EGREP_CPP(yes,
|
||||
[#include <features.h>
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
|
||||
yes
|
||||
#endif],
|
||||
@ -183,6 +184,10 @@ yes
|
||||
;;
|
||||
linux-libinet6)
|
||||
dnl http://www.v6.linux.or.jp/
|
||||
dnl
|
||||
dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
|
||||
dnl and possibly other versions of those OSes
|
||||
dnl
|
||||
if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
|
||||
ipv6type=$i
|
||||
ipv6lib=inet6
|
||||
@ -192,8 +197,8 @@ yes
|
||||
fi
|
||||
;;
|
||||
toshiba)
|
||||
AC_EGREP_CPP(yes, [dnl
|
||||
#include <sys/param.h>
|
||||
AC_EGREP_CPP(yes,
|
||||
[#include <sys/param.h>
|
||||
#ifdef _TOSHIBA_INET6
|
||||
yes
|
||||
#endif],
|
||||
@ -203,8 +208,8 @@ yes
|
||||
CFLAGS="-DINET6 $CFLAGS"])
|
||||
;;
|
||||
v6d)
|
||||
AC_EGREP_CPP(yes, [dnl
|
||||
#include </usr/local/v6/include/sys/v6config.h>
|
||||
AC_EGREP_CPP(yes,
|
||||
[#include </usr/local/v6/include/sys/v6config.h>
|
||||
#ifdef __V6D__
|
||||
yes
|
||||
#endif],
|
||||
@ -214,8 +219,8 @@ yes
|
||||
CFLAGS="-I/usr/local/v6/include $CFLAGS"])
|
||||
;;
|
||||
zeta)
|
||||
AC_EGREP_CPP(yes, [dnl
|
||||
#include <sys/param.h>
|
||||
AC_EGREP_CPP(yes,
|
||||
[#include <sys/param.h>
|
||||
#ifdef _ZETA_MINAMI_INET6
|
||||
yes
|
||||
#endif],
|
||||
@ -250,9 +255,22 @@ fi
|
||||
|
||||
|
||||
if test "$ipv6" = "yes"; then
|
||||
#
|
||||
# XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
|
||||
# function in libc; there are "ngetaddrinfo()" and
|
||||
# "ogetaddrinfo()" functions, and <netdb.h> #defines
|
||||
# "getaddrinfo" to be either "ngetaddrinfo" or
|
||||
# "ogetaddrinfo", depending on whether _SOCKADDR_LEN
|
||||
# or _XOPEN_SOURCE_EXTENDED are defined or not.
|
||||
#
|
||||
# So this test doesn't work on Tru64 5.1, and possibly
|
||||
# on other 5.x releases. This causes the configure
|
||||
# script to become confused, and results in libpcap
|
||||
# being unbuildable.
|
||||
#
|
||||
AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
|
||||
AC_MSG_CHECKING(getaddrinfo bug)
|
||||
AC_TRY_RUN([
|
||||
AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
@ -270,6 +288,7 @@ main()
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_flags = passive ? AI_PASSIVE : 0;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
|
||||
(void)gai_strerror(gaierr);
|
||||
goto bad;
|
||||
@ -346,58 +365,44 @@ main()
|
||||
exit(1);
|
||||
}
|
||||
],
|
||||
AC_MSG_RESULT(good)
|
||||
buggygetaddrinfo=no,
|
||||
AC_MSG_RESULT(buggy)
|
||||
buggygetaddrinfo=yes,
|
||||
AC_MSG_RESULT(buggy)
|
||||
buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
|
||||
td_cv_buggygetaddrinfo=no,
|
||||
td_cv_buggygetaddrinfo=yes,
|
||||
td_cv_buggygetaddrinfo=yes)])
|
||||
if test "$td_cv_buggygetaddrinfo" = no; then
|
||||
AC_MSG_RESULT(good)
|
||||
else
|
||||
AC_MSG_RESULT(buggy)
|
||||
fi
|
||||
|
||||
if test "$buggygetaddrinfo" = "yes"; then
|
||||
if test "$td_cv_buggygetaddrinfo" = "yes"; then
|
||||
#
|
||||
# XXX - it doesn't appear that "ipv6type" can ever be
|
||||
# set to "linux". Should this be testing for
|
||||
# "linux-glibc", or for that *or* "linux-libinet6"?
|
||||
# If the latter, note that "linux-libinet6" is also
|
||||
# the type given to some non-Linux OSes.
|
||||
#
|
||||
if test "$ipv6type" != "linux"; then
|
||||
echo 'Fatal: You must get working getaddrinfo() function.'
|
||||
echo ' or you can specify "--disable-ipv6"'.
|
||||
exit 1
|
||||
else
|
||||
echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
|
||||
echo ' Better upgreade your system library to newest version'
|
||||
echo ' Better upgrade your system library to newest version'
|
||||
echo ' of GNU C library (aka glibc).'
|
||||
fi
|
||||
fi
|
||||
])
|
||||
AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
|
||||
fi
|
||||
dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
|
||||
AC_MSG_CHECKING(for inet_ntop)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[4], dst[128];
|
||||
inet_ntop(AF_INET, src, dst, sizeof(dst));],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_REPLACE_FUNCS(inet_ntop)])
|
||||
AC_MSG_CHECKING(for inet_pton)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128], dst[4];
|
||||
inet_pton(AF_INET, src, dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_REPLACE_FUNCS(inet_pton)])
|
||||
AC_MSG_CHECKING(for inet_aton)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128];
|
||||
struct in_addr dst;
|
||||
inet_aton(src, &dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_REPLACE_FUNCS(inet_aton)])
|
||||
|
||||
dnl portability macros for getaddrinfo/getnameinfo
|
||||
dnl
|
||||
dnl Check for sa_len
|
||||
AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
|
||||
if test "$ac_cv_sockaddr_has_sa_len" = no; then
|
||||
missing_includes=yes
|
||||
AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
|
||||
[td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
|
||||
[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
|
||||
td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
|
||||
td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
|
||||
if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
|
||||
AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA)
|
||||
fi
|
||||
|
||||
dnl
|
||||
@ -476,7 +481,8 @@ if test "$missing_includes" = "yes"; then
|
||||
fi
|
||||
|
||||
|
||||
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup)
|
||||
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
|
||||
AC_CHECK_FUNCS(strftime)
|
||||
AC_CHECK_FUNCS(ether_ntohost, [
|
||||
AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
|
||||
AC_TRY_RUN([
|
||||
@ -496,7 +502,7 @@ AC_CHECK_FUNCS(ether_ntohost, [
|
||||
}
|
||||
], [ac_cv_buggy_ether_ntohost=no],
|
||||
[ac_cv_buggy_ether_ntohost=yes],
|
||||
[ac_cv_buggy_ether_ntohost=not while cross-compiling])])
|
||||
[ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
|
||||
if test "$ac_cv_buggy_ether_ntohost" = "no"; then
|
||||
AC_DEFINE(USE_ETHER_NTOHOST)
|
||||
fi
|
||||
@ -507,12 +513,12 @@ needsnprintf=no
|
||||
AC_CHECK_FUNCS(vsnprintf snprintf,,
|
||||
[needsnprintf=yes])
|
||||
if test $needsnprintf = yes; then
|
||||
LIBOBJS="$LIBOBJS snprintf.o"
|
||||
AC_LIBOBJ(snprintf.o)
|
||||
fi
|
||||
|
||||
AC_LBL_TYPE_SIGNAL
|
||||
|
||||
AC_CHECK_LIB(dnet, dnet_htoa)
|
||||
AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
|
||||
|
||||
AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
|
||||
|
||||
@ -524,6 +530,121 @@ dnl AC_CHECK_HEADERS(zlib.h)
|
||||
|
||||
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
|
||||
|
||||
#
|
||||
# Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
|
||||
# libraries (e.g., "-lsocket -lnsl" on Solaris).
|
||||
#
|
||||
# We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
|
||||
# use AC_CHECK_FUNC which doesn't let us specify the right #includes
|
||||
# to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
|
||||
# resolver, and the way it defines inet_{ntop,pton} is rather strange;
|
||||
# it does not ship with a libc symbol "inet_ntop()", it ships with
|
||||
# "_inet_ntop()", and has a #define macro in one of the system headers
|
||||
# to rename it.
|
||||
#
|
||||
dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
|
||||
AC_MSG_CHECKING(for inet_ntop)
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[4], dst[128];
|
||||
inet_ntop(AF_INET, src, dst, sizeof(dst));],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_LIBOBJ(inet_ntop.o)])
|
||||
AC_MSG_CHECKING(for inet_pton)
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128], dst[4];
|
||||
inet_pton(AF_INET, src, dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_LIBOBJ(inet_pton.o)])
|
||||
AC_MSG_CHECKING(for inet_aton)
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128];
|
||||
struct in_addr dst;
|
||||
inet_aton(src, &dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_LIBOBJ(inet_aton.o)])
|
||||
|
||||
dnl portability macros for getaddrinfo/getnameinfo
|
||||
dnl
|
||||
dnl Check for sa_len
|
||||
AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
|
||||
if test "$ac_cv_sockaddr_has_sa_len" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
|
||||
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
|
||||
dnl Check for MacOS X, which may ship pcap.h from 0.6 but libpcap may
|
||||
dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
|
||||
dnl have pcap_if_t.
|
||||
AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
|
||||
fi
|
||||
if test $ac_cv_func_pcap_lib_version = "no" ; then
|
||||
AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
char *
|
||||
return_pcap_version(void)
|
||||
{
|
||||
extern char pcap_version[];
|
||||
|
||||
return pcap_version;
|
||||
}
|
||||
],
|
||||
ac_lbl_cv_pcap_version_defined=yes,
|
||||
ac_lbl_cv_pcap_version_defined=no)
|
||||
if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PCAP_VERSION)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
int
|
||||
return_pcap_debug(void)
|
||||
{
|
||||
extern int pcap_debug;
|
||||
|
||||
return pcap_debug;
|
||||
}
|
||||
],
|
||||
ac_lbl_cv_pcap_debug_defined=yes,
|
||||
ac_lbl_cv_pcap_debug_defined=no)
|
||||
if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_PCAP_DEBUG)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
#
|
||||
# OK, what about "yydebug"?
|
||||
#
|
||||
AC_MSG_CHECKING(whether yydebug is defined by libpcap)
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
int
|
||||
return_yydebug(void)
|
||||
{
|
||||
extern int yydebug;
|
||||
|
||||
return yydebug;
|
||||
}
|
||||
],
|
||||
ac_lbl_cv_yydebug_defined=yes,
|
||||
ac_lbl_cv_yydebug_defined=no)
|
||||
if test "$ac_lbl_cv_yydebug_defined" = yes ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_YYDEBUG)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
|
||||
|
||||
V_GROUP=0
|
||||
@ -554,6 +675,7 @@ if test -f /dev/bpf0 ; then
|
||||
V_GROUP=bpf
|
||||
fi
|
||||
|
||||
AC_LBL_CHECK_TYPE(int8_t, signed char)
|
||||
AC_LBL_CHECK_TYPE(u_int8_t, u_char)
|
||||
AC_LBL_CHECK_TYPE(int16_t, short)
|
||||
AC_LBL_CHECK_TYPE(u_int16_t, u_short)
|
||||
@ -573,8 +695,21 @@ AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
|
||||
AC_MSG_CHECKING(for SSLeay)
|
||||
ac_cv_ssleay_path=no
|
||||
incdir=no
|
||||
for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
|
||||
if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
|
||||
for dir in /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
|
||||
#
|
||||
# XXX - is there a better way to check if a given library is
|
||||
# in a given directory than checking each of the possible
|
||||
# shared library suffixes?
|
||||
#
|
||||
# Are there any other suffixes we need to look for? Do we have to
|
||||
# worry about ".so.{version}"?
|
||||
#
|
||||
# Or should we just look for "libcrypto.*"?
|
||||
#
|
||||
if test -d $dir/lib -a \( -f $dir/lib/libcrypto.a -o \
|
||||
-f $dir/lib/libcrypto.so -o \
|
||||
-f $dir/lib/libcrypto.sl -o \
|
||||
-f $dir/lib/libcrypto.dylib \); then
|
||||
ac_cv_ssleay_path=$dir
|
||||
fi
|
||||
if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
|
||||
@ -599,46 +734,13 @@ if test "$ac_cv_ssleay_path" != no; then
|
||||
fi
|
||||
AC_CHECK_LIB(crypto, des_cbc_encrypt)
|
||||
|
||||
bak_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
AC_CHECK_HEADERS(cast.h)
|
||||
|
||||
if test "$ac_cv_header_cast_h" = "yes"; then
|
||||
AC_MSG_CHECKING(for buggy CAST128)
|
||||
AC_TRY_RUN(dnl
|
||||
[
|
||||
#include <cast.h>
|
||||
main()
|
||||
{
|
||||
unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
|
||||
unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
|
||||
unsigned char out[sizeof(in)];
|
||||
unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
|
||||
CAST_KEY ks;
|
||||
CAST_set_key(&ks, sizeof(key), key);
|
||||
CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
|
||||
if (memcmp(out, ok, sizeof(ok)) != 0)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}],
|
||||
[buggy_cast128=yes],
|
||||
[buggy_cast128=no],
|
||||
[buggy_cast128="cross-compiling, assume yes"])
|
||||
AC_MSG_RESULT($buggy_cast128)
|
||||
if test "$buggy_cast128" != no; then
|
||||
echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
|
||||
echo "disabling CAST128 support."
|
||||
AC_DEFINE(HAVE_BUGGY_CAST128)
|
||||
fi
|
||||
fi
|
||||
|
||||
CPPFLAGS=$bak_CPPFLAGS
|
||||
AC_CHECK_HEADERS(openssl/evp.h)
|
||||
fi
|
||||
])
|
||||
AC_CHECK_HEADERS(rc5.h)
|
||||
|
||||
AC_SUBST(V_CCOPT)
|
||||
AC_SUBST(V_DEFS)
|
||||
AC_SUBST(V_GROUP)
|
||||
AC_SUBST(V_INCLS)
|
||||
AC_SUBST(V_PCAPDEP)
|
||||
|
@ -18,10 +18,18 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.7 2000/10/03 02:54:55 itojun Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.11 2002/12/11 07:13:50 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
typedef u_int8_t byte[1]; /* single byte field */
|
||||
#else
|
||||
/*
|
||||
* the keyword 'byte' generates conflicts in Windows
|
||||
*/
|
||||
typedef unsigned char Byte[1]; /* single byte field */
|
||||
#define byte Byte
|
||||
#endif /* WIN32 */
|
||||
typedef u_int8_t word[2]; /* 2 byte field */
|
||||
typedef u_int8_t longword[4]; /* 4 bytes field */
|
||||
|
||||
|
47
contrib/tcpdump/enc.h
Normal file
47
contrib/tcpdump/enc.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/enc.h,v 1.1 2003/03/08 08:55:33 guy Exp $ (LBL) */
|
||||
/* From $OpenBSD: if_enc.h,v 1.8 2001/06/25 05:14:00 angelos Exp $ */
|
||||
/*
|
||||
* The authors of this code are John Ioannidis (ji@tla.org),
|
||||
* Angelos D. Keromytis (kermit@csd.uch.gr) and
|
||||
* Niels Provos (provos@physnet.uni-hamburg.de).
|
||||
*
|
||||
* This code was written by John Ioannidis for BSD/OS in Athens, Greece,
|
||||
* in November 1995.
|
||||
*
|
||||
* Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
|
||||
* by Angelos D. Keromytis.
|
||||
*
|
||||
* Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
|
||||
* and Niels Provos.
|
||||
*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998 by John Ioannidis, Angelos D. Keromytis
|
||||
* and Niels Provos.
|
||||
* Copyright (c) 2001, Angelos D. Keromytis.
|
||||
*
|
||||
* Permission to use, copy, and modify this software with or without fee
|
||||
* is hereby granted, provided that this entire notice is included in
|
||||
* all copies of any software which is or includes a copy or
|
||||
* modification of this software.
|
||||
* You may use this code under the GNU public license if you so wish. Please
|
||||
* contribute changes back to the authors under this freer than GPL license
|
||||
* so that we may further the use of strong encryption without limitations to
|
||||
* all.
|
||||
*
|
||||
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
|
||||
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
|
||||
* MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
|
||||
* PURPOSE.
|
||||
*/
|
||||
|
||||
#define ENC_HDRLEN 12
|
||||
|
||||
/* From $OpenBSD: mbuf.h,v 1.56 2002/01/25 15:50:23 art Exp $ */
|
||||
#define M_CONF 0x0400 /* packet was encrypted (ESP-transport) */
|
||||
#define M_AUTH 0x0800 /* packet was authenticated (AH) */
|
||||
|
||||
struct enchdr {
|
||||
u_int32_t af;
|
||||
u_int32_t spi;
|
||||
u_int32_t flags;
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.6 2000/10/09 03:24:24 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.8 2002/12/11 07:13:51 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -18,40 +18,81 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.17 2001/09/17 21:57:52 fenner Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.19 2002/12/11 07:13:51 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Network to host order macros */
|
||||
|
||||
#ifdef LBL_ALIGN
|
||||
/*
|
||||
* The processor doesn't natively handle unaligned loads.
|
||||
*/
|
||||
#ifdef HAVE___ATTRIBUTE__
|
||||
/*
|
||||
* We have __attribute__; we assume that means we have __attribute__((packed)).
|
||||
* Declare packed structures containing a u_int16_t and a u_int32_t,
|
||||
* cast the pointer to point to one of those, and fetch through it;
|
||||
* the GCC manual doesn't appear to explicitly say that
|
||||
* __attribute__((packed)) causes the compiler to generate unaligned-safe
|
||||
* code, but it apppears to do so.
|
||||
*
|
||||
* We do this in case the compiler can generate, for this instruction set,
|
||||
* better code to do an unaligned load and pass stuff to "ntohs()" or
|
||||
* "ntohl()" than the code to fetch the bytes one at a time and
|
||||
* assemble them. (That might not be the case on a little-endian platform,
|
||||
* where "ntohs()" and "ntohl()" might not be done inline.)
|
||||
*/
|
||||
typedef struct {
|
||||
u_int16_t val;
|
||||
} __attribute__((packed)) unaligned_u_int16_t;
|
||||
|
||||
typedef struct {
|
||||
u_int32_t val;
|
||||
} __attribute__((packed)) unaligned_u_int32_t;
|
||||
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
|
||||
(u_int16_t)*((const u_int8_t *)(p) + 1))
|
||||
((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 3))
|
||||
#else
|
||||
((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val))
|
||||
#else /* HAVE___ATTRIBUTE__ */
|
||||
/*
|
||||
* We don't have __attribute__, so do unaligned loads of big-endian
|
||||
* quantities the hard way - fetch the bytes one at a time and
|
||||
* assemble them.
|
||||
*/
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \
|
||||
(u_int16_t)*((const u_int8_t *)(p) + 1)))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 3)))
|
||||
#endif /* HAVE___ATTRIBUTE__ */
|
||||
#else /* LBL_ALIGN */
|
||||
/*
|
||||
* The processor natively handles unaligned loads, so we can just
|
||||
* cast the pointer and fetch through it.
|
||||
*/
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_int16_t)ntohs(*(const u_int16_t *)(p)))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)ntohl(*(const u_int32_t *)(p)))
|
||||
#endif
|
||||
#endif /* LBL_ALIGN */
|
||||
|
||||
#define EXTRACT_24BITS(p) \
|
||||
((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 2))
|
||||
((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 2)))
|
||||
|
||||
/* Little endian protocol host order macros */
|
||||
|
||||
#define EXTRACT_LE_8BITS(p) (*(p))
|
||||
#define EXTRACT_LE_16BITS(p) \
|
||||
((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int16_t)*((const u_int8_t *)(p) + 0))
|
||||
((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int16_t)*((const u_int8_t *)(p) + 0)))
|
||||
#define EXTRACT_LE_32BITS(p) \
|
||||
((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 0))
|
||||
((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((const u_int8_t *)(p) + 0)))
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.9 2000/10/09 02:59:39 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.11 2002/12/11 07:13:51 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
|
134
contrib/tcpdump/gmpls.c
Normal file
134
contrib/tcpdump/gmpls.c
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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/gmpls.c,v 1.2.2.2 2003/11/16 08:51:05 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_link_prot_values[] = {
|
||||
{ 0x01, "Extra Traffic"},
|
||||
{ 0x02, "Unprotected"},
|
||||
{ 0x04, "Shared"},
|
||||
{ 0x08, "Dedicated 1:1"},
|
||||
{ 0x10, "Dedicated 1+1"},
|
||||
{ 0x20, "Enhanced"},
|
||||
{ 0x40, "Reserved"},
|
||||
{ 0x80, "Reserved"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_switch_cap_values[] = {
|
||||
{ 1, "Packet-Switch Capable-1"},
|
||||
{ 2, "Packet-Switch Capable-2"},
|
||||
{ 3, "Packet-Switch Capable-3"},
|
||||
{ 4, "Packet-Switch Capable-4"},
|
||||
{ 51, "Layer-2 Switch Capable"},
|
||||
{ 100, "Time-Division-Multiplex"},
|
||||
{ 150, "Lambda-Switch Capable"},
|
||||
{ 200, "Fiber-Switch Capable"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_encoding_values[] = {
|
||||
{ 1, "Packet"},
|
||||
{ 2, "Ethernet V2/DIX"},
|
||||
{ 3, "ANSI/ETSI PDH"},
|
||||
{ 4, "Reserved"},
|
||||
{ 5, "SDH ITU-T G.707/SONET ANSI T1.105"},
|
||||
{ 6, "Reserved"},
|
||||
{ 7, "Digital Wrapper"},
|
||||
{ 8, "Lambda (photonic)"},
|
||||
{ 9, "Fiber"},
|
||||
{ 10, "Reserved"},
|
||||
{ 11, "FiberChannel"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_payload_values[] = {
|
||||
{ 0, "Unknown"},
|
||||
{ 1, "Reserved"},
|
||||
{ 2, "Reserved"},
|
||||
{ 3, "Reserved"},
|
||||
{ 4, "Reserved"},
|
||||
{ 5, "Asynchronous mapping of E4"},
|
||||
{ 6, "Asynchronous mapping of DS3/T3"},
|
||||
{ 7, "Asynchronous mapping of E3"},
|
||||
{ 8, "Bit synchronous mapping of E3"},
|
||||
{ 9, "Byte synchronous mapping of E3"},
|
||||
{ 10, "Asynchronous mapping of DS2/T2"},
|
||||
{ 11, "Bit synchronous mapping of DS2/T2"},
|
||||
{ 12, "Reserved"},
|
||||
{ 13, "Asynchronous mapping of E1"},
|
||||
{ 14, "Byte synchronous mapping of E1"},
|
||||
{ 15, "Byte synchronous mapping of 31 * DS0"},
|
||||
{ 16, "Asynchronous mapping of DS1/T1"},
|
||||
{ 17, "Bit synchronous mapping of DS1/T1"},
|
||||
{ 18, "Byte synchronous mapping of DS1/T1"},
|
||||
{ 19, "VC-11 in VC-12"},
|
||||
{ 20, "Reserved"},
|
||||
{ 21, "Reserved"},
|
||||
{ 22, "DS1 SF Asynchronous"},
|
||||
{ 23, "DS1 ESF Asynchronous"},
|
||||
{ 24, "DS3 M23 Asynchronous"},
|
||||
{ 25, "DS3 C-Bit Parity Asynchronous"},
|
||||
{ 26, "VT/LOVC"},
|
||||
{ 27, "STS SPE/HOVC"},
|
||||
{ 28, "POS - No Scrambling, 16 bit CRC"},
|
||||
{ 29, "POS - No Scrambling, 32 bit CRC"},
|
||||
{ 30, "POS - Scrambling, 16 bit CRC"},
|
||||
{ 31, "POS - Scrambling, 32 bit CRC"},
|
||||
{ 32, "ATM mapping"},
|
||||
{ 33, "Ethernet PHY"},
|
||||
{ 34, "SONET/SDH"},
|
||||
{ 35, "Reserved (SONET deprecated)"},
|
||||
{ 36, "Digital Wrapper"},
|
||||
{ 37, "Lambda"},
|
||||
{ 38, "ANSI/ETSI PDH"},
|
||||
{ 39, "Reserved"},
|
||||
{ 40, "Link Access Protocol SDH (X.85 and X.86)"},
|
||||
{ 41, "FDDI"},
|
||||
{ 42, "DQDB (ETSI ETS 300 216)"},
|
||||
{ 43, "FiberChannel-3 (Services)"},
|
||||
{ 44, "HDLC"},
|
||||
{ 45, "Ethernet V2/DIX (only)"},
|
||||
{ 46, "Ethernet 802.3 (only)"},
|
||||
/* draft-ietf-ccamp-gmpls-g709-04.txt */
|
||||
{ 47, "G.709 ODUj"},
|
||||
{ 48, "G.709 OTUk(v)"},
|
||||
{ 49, "CBR/CBRa"},
|
||||
{ 50, "CBRb"},
|
||||
{ 51, "BSOT"},
|
||||
{ 52, "BSNT"},
|
||||
{ 53, "IP/PPP (GFP)"},
|
||||
{ 54, "Ethernet MAC (framed GFP)"},
|
||||
{ 55, "Ethernet PHY (transparent GFP)"},
|
||||
{ 56, "ESCON"},
|
||||
{ 57, "FICON"},
|
||||
{ 58, "Fiber Channel"},
|
||||
{ 0, NULL }
|
||||
};
|
20
contrib/tcpdump/gmpls.h
Normal file
20
contrib/tcpdump/gmpls.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.2 2003/06/09 23:28:09 guy 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 gmpls_link_prot_values[];
|
||||
extern struct tok gmpls_switch_cap_values[];
|
||||
extern struct tok gmpls_encoding_values[];
|
||||
extern struct tok gmpls_payload_values[];
|
@ -20,18 +20,17 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.4.6.1 2002/06/01 23:43:53 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.7.2.2 2003/11/16 08:51:06 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.11 2001/06/01 23:01:04 itojun Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.14 2002/12/11 07:13:52 guy Exp $ (LBL) */
|
||||
/* $NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp $ */
|
||||
/* $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $ */
|
||||
|
||||
@ -122,7 +122,13 @@ struct icmp6_hdr {
|
||||
#define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
|
||||
#define MLD6_MTRACE 142 /* mtrace messages */
|
||||
|
||||
#define ICMP6_MAXTYPE 142
|
||||
/* Folloing numbers are defined in the mobile-ip draft. */
|
||||
#define ICMP6_HADISCOV_REQUEST 150 /* XXX To be authorized */
|
||||
#define ICMP6_HADISCOV_REPLY 151 /* XXX To be authorized */
|
||||
#define ICMP6_MOBILEPREFIX_SOLICIT 152 /* XXX To be authorized */
|
||||
#define ICMP6_MOBILEPREFIX_ADVERT 153 /* XXX To be authorized */
|
||||
|
||||
#define ICMP6_MAXTYPE 153
|
||||
|
||||
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
|
||||
#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.3 2001/06/14 09:50:01 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.9 2003/07/22 17:36:57 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 2001
|
||||
* Fortress Technologies
|
||||
@ -21,52 +21,87 @@
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define IEEE802_11_FC_LEN 2
|
||||
/* Lengths of 802.11 header components. */
|
||||
#define IEEE802_11_FC_LEN 2
|
||||
#define IEEE802_11_DUR_LEN 2
|
||||
#define IEEE802_11_DA_LEN 6
|
||||
#define IEEE802_11_SA_LEN 6
|
||||
#define IEEE802_11_BSSID_LEN 6
|
||||
#define IEEE802_11_RA_LEN 6
|
||||
#define IEEE802_11_TA_LEN 6
|
||||
#define IEEE802_11_SEQ_LEN 2
|
||||
#define IEEE802_11_IV_LEN 3
|
||||
#define IEEE802_11_KID_LEN 1
|
||||
|
||||
#define T_MGMT 0x0 /* management */
|
||||
#define T_CTRL 0x1 /* control */
|
||||
#define T_DATA 0x2 /* data */
|
||||
#define T_RESV 0x3 /* reserved */
|
||||
/* Frame check sequence length. */
|
||||
#define IEEE802_11_FCS_LEN 4
|
||||
|
||||
#define ST_ASSOC_REQUEST 0x0
|
||||
#define ST_ASSOC_RESPONSE 0x1
|
||||
#define ST_REASSOC_REQUEST 0x2
|
||||
#define ST_REASSOC_RESPONSE 0x3
|
||||
#define ST_PROBE_REQUEST 0x4
|
||||
#define ST_PROBE_RESPONSE 0x5
|
||||
/* Lengths of beacon components. */
|
||||
#define IEEE802_11_TSTAMP_LEN 8
|
||||
#define IEEE802_11_BCNINT_LEN 2
|
||||
#define IEEE802_11_CAPINFO_LEN 2
|
||||
#define IEEE802_11_LISTENINT_LEN 2
|
||||
|
||||
#define IEEE802_11_AID_LEN 2
|
||||
#define IEEE802_11_STATUS_LEN 2
|
||||
#define IEEE802_11_REASON_LEN 2
|
||||
|
||||
/* Length of previous AP in reassocation frame */
|
||||
#define IEEE802_11_AP_LEN 6
|
||||
|
||||
#define T_MGMT 0x0 /* management */
|
||||
#define T_CTRL 0x1 /* control */
|
||||
#define T_DATA 0x2 /* data */
|
||||
#define T_RESV 0x3 /* reserved */
|
||||
|
||||
#define ST_ASSOC_REQUEST 0x0
|
||||
#define ST_ASSOC_RESPONSE 0x1
|
||||
#define ST_REASSOC_REQUEST 0x2
|
||||
#define ST_REASSOC_RESPONSE 0x3
|
||||
#define ST_PROBE_REQUEST 0x4
|
||||
#define ST_PROBE_RESPONSE 0x5
|
||||
/* RESERVED 0x6 */
|
||||
/* RESERVED 0x7 */
|
||||
#define ST_BEACON 0x8
|
||||
#define ST_ATIM 0x9
|
||||
#define ST_DISASSOC 0xA
|
||||
#define ST_AUTH 0xB
|
||||
#define ST_DEAUTH 0xC
|
||||
#define ST_BEACON 0x8
|
||||
#define ST_ATIM 0x9
|
||||
#define ST_DISASSOC 0xA
|
||||
#define ST_AUTH 0xB
|
||||
#define ST_DEAUTH 0xC
|
||||
/* RESERVED 0xD */
|
||||
/* RESERVED 0xE */
|
||||
/* RESERVED 0xF */
|
||||
|
||||
|
||||
#define CTRL_PS_POLL 0xA
|
||||
#define CTRL_RTS 0xB
|
||||
#define CTRL_CTS 0xC
|
||||
#define CTRL_ACK 0xD
|
||||
#define CTRL_CF_END 0xE
|
||||
#define CTRL_END_ACK 0xF
|
||||
#define CTRL_PS_POLL 0xA
|
||||
#define CTRL_RTS 0xB
|
||||
#define CTRL_CTS 0xC
|
||||
#define CTRL_ACK 0xD
|
||||
#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
|
||||
|
||||
/*
|
||||
* Bits in the frame control field.
|
||||
*/
|
||||
#define FC_VERSION(fc) ((fc) & 0x3)
|
||||
#define FC_TYPE(fc) (((fc) >> 2) & 0x3)
|
||||
#define FC_SUBTYPE(fc) (((fc) >> 4) & 0xF)
|
||||
#define FC_TO_DS(fc) ((fc) & 0x0100)
|
||||
#define FC_FROM_DS(fc) ((fc) & 0x0200)
|
||||
#define FC_MORE_FLAG(fc) ((fc) & 0x0400)
|
||||
#define FC_RETRY(fc) ((fc) & 0x0800)
|
||||
#define FC_POWER_MGMT(fc) ((fc) & 0x1000)
|
||||
#define FC_MORE_DATA(fc) ((fc) & 0x2000)
|
||||
#define FC_WEP(fc) ((fc) & 0x4000)
|
||||
#define FC_ORDER(fc) ((fc) & 0x8000)
|
||||
#define FC_VERSION(fc) ((fc) & 0x3)
|
||||
#define FC_TYPE(fc) (((fc) >> 2) & 0x3)
|
||||
#define FC_SUBTYPE(fc) (((fc) >> 4) & 0xF)
|
||||
#define FC_TO_DS(fc) ((fc) & 0x0100)
|
||||
#define FC_FROM_DS(fc) ((fc) & 0x0200)
|
||||
#define FC_MORE_FLAG(fc) ((fc) & 0x0400)
|
||||
#define FC_RETRY(fc) ((fc) & 0x0800)
|
||||
#define FC_POWER_MGMT(fc) ((fc) & 0x1000)
|
||||
#define FC_MORE_DATA(fc) ((fc) & 0x2000)
|
||||
#define FC_WEP(fc) ((fc) & 0x4000)
|
||||
#define FC_ORDER(fc) ((fc) & 0x8000)
|
||||
|
||||
struct mgmt_header_t {
|
||||
u_int16_t fc;
|
||||
@ -77,19 +112,21 @@ struct mgmt_header_t {
|
||||
u_int16_t seq_ctrl;
|
||||
};
|
||||
|
||||
#define MGMT_HEADER_LEN (2+2+6+6+6+2)
|
||||
#define MGMT_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_DA_LEN+IEEE802_11_SA_LEN+\
|
||||
IEEE802_11_BSSID_LEN+IEEE802_11_SEQ_LEN)
|
||||
|
||||
#define CAPABILITY_ESS(cap) ((cap) & 0x0001)
|
||||
#define CAPABILITY_IBSS(cap) ((cap) & 0x0002)
|
||||
#define CAPABILITY_CFP(cap) ((cap) & 0x0004)
|
||||
#define CAPABILITY_CFP_REQ(cap) ((cap) & 0x0008)
|
||||
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
|
||||
#define CAPABILITY_ESS(cap) ((cap) & 0x0001)
|
||||
#define CAPABILITY_IBSS(cap) ((cap) & 0x0002)
|
||||
#define CAPABILITY_CFP(cap) ((cap) & 0x0004)
|
||||
#define CAPABILITY_CFP_REQ(cap) ((cap) & 0x0008)
|
||||
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
|
||||
|
||||
struct ssid_t {
|
||||
u_int8_t element_id;
|
||||
u_int8_t length;
|
||||
u_char ssid[33]; /* 32 + 1 for null */
|
||||
} ;
|
||||
};
|
||||
|
||||
struct rates_t {
|
||||
u_int8_t element_id;
|
||||
@ -135,13 +172,13 @@ struct tim_t {
|
||||
u_int8_t bitmap[251];
|
||||
};
|
||||
|
||||
#define E_SSID 0
|
||||
#define E_RATES 1
|
||||
#define E_FH 2
|
||||
#define E_DS 3
|
||||
#define E_CF 4
|
||||
#define E_TIM 5
|
||||
#define E_IBSS 6
|
||||
#define E_SSID 0
|
||||
#define E_RATES 1
|
||||
#define E_FH 2
|
||||
#define E_DS 3
|
||||
#define E_CF 4
|
||||
#define E_TIM 5
|
||||
#define E_IBSS 6
|
||||
/* reserved 7 */
|
||||
/* reserved 8 */
|
||||
/* reserved 9 */
|
||||
@ -153,7 +190,7 @@ struct tim_t {
|
||||
/* reserved 15 */
|
||||
/* reserved 16 */
|
||||
|
||||
#define E_CHALLENGE 16
|
||||
#define E_CHALLENGE 16
|
||||
/* reserved 17 */
|
||||
/* reserved 18 */
|
||||
/* reserved 19 */
|
||||
@ -189,7 +226,8 @@ struct ctrl_rts_t {
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_RTS_LEN (2+2+6+6+4)
|
||||
#define CTRL_RTS_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_RA_LEN+IEEE802_11_TA_LEN)
|
||||
|
||||
struct ctrl_cts_t {
|
||||
u_int16_t fc;
|
||||
@ -198,7 +236,7 @@ struct ctrl_cts_t {
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_CTS_LEN (2+2+6+4)
|
||||
#define CTRL_CTS_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
|
||||
|
||||
struct ctrl_ack_t {
|
||||
u_int16_t fc;
|
||||
@ -207,7 +245,7 @@ struct ctrl_ack_t {
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_ACK_LEN (2+2+6+4)
|
||||
#define CTRL_ACK_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
|
||||
|
||||
struct ctrl_ps_poll_t {
|
||||
u_int16_t fc;
|
||||
@ -217,7 +255,8 @@ struct ctrl_ps_poll_t {
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_PS_POLL_LEN (2+2+6+6+4)
|
||||
#define CTRL_PS_POLL_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_AID_LEN+\
|
||||
IEEE802_11_BSSID_LEN+IEEE802_11_TA_LEN)
|
||||
|
||||
struct ctrl_end_t {
|
||||
u_int16_t fc;
|
||||
@ -227,7 +266,8 @@ struct ctrl_end_t {
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_END_LEN (2+2+6+6+4)
|
||||
#define CTRL_END_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_RA_LEN+IEEE802_11_BSSID_LEN)
|
||||
|
||||
struct ctrl_end_ack_t {
|
||||
u_int16_t fc;
|
||||
@ -237,8 +277,9 @@ struct ctrl_end_ack_t {
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_END_ACK_LEN (2+2+6+6+4)
|
||||
#define CTRL_END_ACK_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_RA_LEN+IEEE802_11_BSSID_LEN)
|
||||
|
||||
#define IV_IV(iv) ((iv) & 0xFFFFFF)
|
||||
#define IV_PAD(iv) (((iv) >> 24) & 0x3F)
|
||||
#define IV_KEYID(iv) (((iv) >> 30) & 0x03)
|
||||
#define IV_IV(iv) ((iv) & 0xFFFFFF)
|
||||
#define IV_PAD(iv) (((iv) >> 24) & 0x3F)
|
||||
#define IV_KEYID(iv) (((iv) >> 30) & 0x03)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/igrp.h,v 1.4 2000/12/17 23:07:49 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/igrp.h,v 1.6 2002/12/11 07:13:52 guy Exp $ (LBL) */
|
||||
/* Cisco IGRP definitions */
|
||||
|
||||
/* IGRP Header */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.7 2000/10/03 09:17:40 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.10 2002/12/11 07:13:53 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -157,3 +157,6 @@ struct ip_timestamp {
|
||||
#define IPTTLDEC 1 /* subtracted when forwarding */
|
||||
|
||||
#define IP_MSS 576 /* default maximum segment size */
|
||||
|
||||
/* in print-ip.c */
|
||||
extern u_int32_t ip_finddst(const struct ip *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.3 2000/12/17 23:07:48 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.6 2002/12/11 22:29:21 guy Exp $ (LBL) */
|
||||
/* $NetBSD: ip6.h,v 1.9 2000/07/13 05:34:21 itojun Exp $ */
|
||||
/* $KAME: ip6.h,v 1.9 2000/07/02 21:01:32 itojun Exp $ */
|
||||
|
||||
@ -187,9 +187,8 @@ struct ip6_frag {
|
||||
u_int32_t ip6f_ident; /* identification */
|
||||
};
|
||||
|
||||
/* network endian */
|
||||
#define IP6F_OFF_MASK ((u_int16_t)htons(0xfff8)) /* mask out offset from _offlg */
|
||||
#define IP6F_RESERVED_MASK ((u_int16_t)htons(0x0006)) /* reserved bits in ip6f_offlg */
|
||||
#define IP6F_MORE_FRAG ((u_int16_t)htons(0x0001)) /* more-fragments flag */
|
||||
#define IP6F_OFF_MASK 0xfff8 /* mask out offset from ip6f_offlg */
|
||||
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
|
||||
#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
|
||||
|
||||
#endif /* not _NETINET_IP6_H_ */
|
||||
|
29
contrib/tcpdump/ipfc.h
Normal file
29
contrib/tcpdump/ipfc.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996
|
||||
* 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.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipfc.h,v 1.4 2002/12/11 07:13:53 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
struct ipfc_header {
|
||||
u_char ipfc_dhost[8];
|
||||
u_char ipfc_shost[8];
|
||||
};
|
||||
|
||||
#define IPFC_HDRLEN 16
|
136
contrib/tcpdump/ipproto.h
Normal file
136
contrib/tcpdump/ipproto.h
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* 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 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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 BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.1.2.1 2003/11/24 20:31:22 guy Exp $ (LBL)
|
||||
*
|
||||
* From:
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef IPPROTO_IP
|
||||
#define IPPROTO_IP 0 /* dummy for IP */
|
||||
#endif
|
||||
#ifndef IPPROTO_HOPOPTS
|
||||
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
|
||||
#endif
|
||||
#ifndef IPPROTO_ICMP
|
||||
#define IPPROTO_ICMP 1 /* control message protocol */
|
||||
#endif
|
||||
#ifndef IPPROTO_IGMP
|
||||
#define IPPROTO_IGMP 2 /* group mgmt protocol */
|
||||
#endif
|
||||
#ifndef IPPROTO_IPV4
|
||||
#define IPPROTO_IPV4 4
|
||||
#endif
|
||||
#ifndef IPPROTO_TCP
|
||||
#define IPPROTO_TCP 6 /* tcp */
|
||||
#endif
|
||||
#ifndef IPPROTO_EGP
|
||||
#define IPPROTO_EGP 8 /* exterior gateway protocol */
|
||||
#endif
|
||||
#ifndef IPPROTO_IGRP
|
||||
#define IPPROTO_IGRP 9
|
||||
#endif
|
||||
#ifndef IPPROTO_UDP
|
||||
#define IPPROTO_UDP 17 /* user datagram protocol */
|
||||
#endif
|
||||
#ifndef IPPROTO_IPV6
|
||||
#define IPPROTO_IPV6 41
|
||||
#endif
|
||||
#ifndef IPPROTO_ROUTING
|
||||
#define IPPROTO_ROUTING 43 /* IPv6 routing header */
|
||||
#endif
|
||||
#ifndef IPPROTO_FRAGMENT
|
||||
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
|
||||
#endif
|
||||
#ifndef IPPROTO_RSVP
|
||||
#define IPPROTO_RSVP 46 /* resource reservation */
|
||||
#endif
|
||||
#ifndef IPPROTO_GRE
|
||||
#define IPPROTO_GRE 47 /* General Routing Encap. */
|
||||
#endif
|
||||
#ifndef IPPROTO_ESP
|
||||
#define IPPROTO_ESP 50 /* SIPP Encap Sec. Payload */
|
||||
#endif
|
||||
#ifndef IPPROTO_AH
|
||||
#define IPPROTO_AH 51 /* SIPP Auth Header */
|
||||
#endif
|
||||
#ifndef IPPROTO_MOBILE
|
||||
#define IPPROTO_MOBILE 55
|
||||
#endif
|
||||
#ifndef IPPROTO_ICMPV6
|
||||
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
|
||||
#endif
|
||||
#ifndef IPPROTO_NONE
|
||||
#define IPPROTO_NONE 59 /* IPv6 no next header */
|
||||
#endif
|
||||
#ifndef IPPROTO_DSTOPTS
|
||||
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
|
||||
#endif
|
||||
#ifndef IPPROTO_MOBILITY_OLD
|
||||
/*
|
||||
* The current Protocol Numbers list says that the IP protocol number for
|
||||
* mobility headers is 135; it cites draft-ietf-mobileip-ipv6-24, but
|
||||
* that draft doesn't actually give a number.
|
||||
*
|
||||
* It appears that 62 used to be used, even though that's assigned to
|
||||
* a protocol called CFTP; however, the only reference for CFTP is a
|
||||
* Network Message from BBN back in 1982, so, for now, we support 62,
|
||||
* aas well as 135, as a protocol number for mobility headers.
|
||||
*/
|
||||
#define IPPROTO_MOBILITY_OLD 62
|
||||
#endif
|
||||
#ifndef IPPROTO_ND
|
||||
#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
|
||||
#endif
|
||||
#ifndef IPPROTO_IGRP
|
||||
#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
|
||||
#endif
|
||||
#ifndef IPPROTO_OSPF
|
||||
#define IPPROTO_OSPF 89
|
||||
#endif
|
||||
#ifndef IPPROTO_PIM
|
||||
#define IPPROTO_PIM 103
|
||||
#endif
|
||||
#ifndef IPPROTO_IPCOMP
|
||||
#define IPPROTO_IPCOMP 108
|
||||
#endif
|
||||
#ifndef IPPROTO_VRRP
|
||||
#define IPPROTO_VRRP 112
|
||||
#endif
|
||||
#ifndef IPPROTO_SCTP
|
||||
#define IPPROTO_SCTP 132
|
||||
#endif
|
||||
#ifndef IPPROTO_MOBILITY
|
||||
#define IPPROTO_MOBILITY 135
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* YIPS @(#)$Id: ipsec_doi.h,v 1.4 2000/10/04 03:00:29 itojun Exp $ */
|
||||
/* YIPS @(#)$Id: ipsec_doi.h,v 1.7 2002/12/11 07:13:53 guy Exp $ */
|
||||
|
||||
/* refer to RFC 2407 */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IPX protocol formats
|
||||
* IPX protocol formats
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.4 2001/01/15 03:23:59 guy Exp $
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.8 2002/12/11 07:13:54 guy Exp $
|
||||
*/
|
||||
|
||||
/* well-known sockets */
|
||||
@ -25,7 +25,7 @@ struct ipxHdr {
|
||||
u_int16_t srcNet[2]; /* source net */
|
||||
u_int8_t srcNode[6]; /* source node */
|
||||
u_int16_t srcSkt; /* source socket */
|
||||
} ipx_hdr_t;
|
||||
};
|
||||
|
||||
#define ipxSize 30
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* YIPS @(#)$Id: isakmp.h,v 1.7 2000/10/03 05:16:38 itojun Exp $ */
|
||||
/* YIPS @(#)$Id: isakmp.h,v 1.10 2002/12/11 07:13:54 guy Exp $ */
|
||||
|
||||
/* refer to RFC 2408 */
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Marko Kiiskila carnil@cs.tut.fi
|
||||
*
|
||||
* Marko Kiiskila carnil@cs.tut.fi
|
||||
*
|
||||
* Tampere University of Technology - Telecommunications Laboratory
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this
|
||||
@ -12,15 +12,15 @@
|
||||
* documentation, and that the use of this software is
|
||||
* acknowledged in any publications resulting from using
|
||||
* the software.
|
||||
*
|
||||
*
|
||||
* TUT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Id: lane.h,v 1.3 2000/10/03 02:54:56 itojun Exp $ */
|
||||
/* $Id: lane.h,v 1.7 2002/12/11 07:13:54 guy Exp $ */
|
||||
|
||||
#ifndef ETHER_ADDR_LEN
|
||||
#define ETHER_ADDR_LEN 6
|
||||
@ -32,3 +32,10 @@ struct lecdatahdr_8023 {
|
||||
u_int8_t h_source[ETHER_ADDR_LEN];
|
||||
u_int16_t h_type;
|
||||
};
|
||||
|
||||
struct lane_controlhdr {
|
||||
u_int16_t lec_header;
|
||||
u_int8_t lec_proto;
|
||||
u_int8_t lec_vers;
|
||||
u_int16_t lec_opcode;
|
||||
};
|
||||
|
26
contrib/tcpdump/lbl/os-osf4.h
Normal file
26
contrib/tcpdump/lbl/os-osf4.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-osf4.h,v 1.1 2002/12/11 05:03:13 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Prototypes missing in Digital UNIX 4.x */
|
||||
int snprintf(char *, size_t, const char *, ...);
|
||||
int vsnprintf(char *, size_t, const char *, va_list);
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.13 2001/06/04 05:47:13 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.16 2002/12/11 07:13:54 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -127,6 +127,27 @@ struct llc {
|
||||
|
||||
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
|
||||
#define OUI_CISCO 0x00000c /* Cisco protocols */
|
||||
#define ETHERTYPE_CISCO_CDP 0x2000 /* Cisco Discovery Protocol */
|
||||
#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 */
|
||||
|
||||
/*
|
||||
* PIDs for use with OUI_RFC2684.
|
||||
*/
|
||||
#define PID_RFC2684_ETH_FCS 0x0001 /* Ethernet, with FCS */
|
||||
#define PID_RFC2684_ETH_NOFCS 0x0007 /* Ethernet, without FCS */
|
||||
#define PID_RFC2684_802_4_FCS 0x0002 /* 802.4, with FCS */
|
||||
#define PID_RFC2684_802_4_NOFCS 0x0008 /* 802.4, without FCS */
|
||||
#define PID_RFC2684_802_5_FCS 0x0003 /* 802.5, with FCS */
|
||||
#define PID_RFC2684_802_5_NOFCS 0x0009 /* 802.5, without FCS */
|
||||
#define PID_RFC2684_FDDI_FCS 0x0004 /* FDDI, with FCS */
|
||||
#define PID_RFC2684_FDDI_NOFCS 0x000a /* FDDI, without FCS */
|
||||
#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 */
|
||||
|
||||
|
@ -20,24 +20,31 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.7 2001/06/27 05:42:04 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.10.2.3 2003/12/15 03:53:42 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
/*
|
||||
* XXX - all we need, on platforms other than DEC OSF/1 (a/k/a Digital UNIX,
|
||||
* a/k/a Tru64 UNIX), is "size_t", which is a standard C type; what do we
|
||||
* need to do to get it defined? This is clearly wrong, as we shouldn't
|
||||
* have to include UNIX or Windows system header files to get it.
|
||||
*/
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#ifndef HAVE___ATTRIBUTE__
|
||||
#define __attribute__(x)
|
||||
#endif /* HAVE___ATTRIBUTE__ */
|
||||
|
||||
#ifdef __osf__
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#if !defined(HAVE_SNPRINTF)
|
||||
#ifndef HAVE___ATTRIBUTE__
|
||||
#define __attribute__(x)
|
||||
#endif /* HAVE___ATTRIBUTE__ */
|
||||
|
||||
int snprintf(char *, size_t, const char *, ...)
|
||||
__attribute__((format(printf, 3, 4)));
|
||||
#endif /* !defined(HAVE_SNPRINTF) */
|
||||
@ -46,7 +53,7 @@ int snprintf(char *, size_t, const char *, ...)
|
||||
#include "machdep.h"
|
||||
|
||||
int
|
||||
abort_on_misalignment(char *ebuf, size_t ebufsiz)
|
||||
abort_on_misalignment(char *ebuf _U_, size_t ebufsiz _U_)
|
||||
{
|
||||
#ifdef __osf__
|
||||
static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, and 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -27,7 +27,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: addrinfo.h,v 1.3 2000/10/24 00:56:52 fenner Exp $ */
|
||||
/* $Id: addrinfo.h,v 1.4 2002/06/11 17:13:36 itojun Exp $ */
|
||||
|
||||
#ifndef HAVE_ADDRINFO
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -26,11 +26,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef INADDRSZ
|
||||
#ifndef INADDRSZ
|
||||
#define INADDRSZ 4 /* IPv4 T_A */
|
||||
#endif
|
||||
|
||||
#ifndef IN6ADDRSZ
|
||||
#define IN6ADDRSZ 16 /* IPv6 T_AAAA */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -38,7 +38,7 @@ typedef unsigned int u_int8_t;
|
||||
|
||||
#endif /* HAVE_U_INT8_T */
|
||||
|
||||
#ifndef HAVE_U_INT16_T
|
||||
#ifndef HAVE_U_INT16_T
|
||||
|
||||
#if SIZEOF_SHORT == 2
|
||||
typedef unsigned short u_int16_t;
|
||||
|
67
contrib/tcpdump/missing/datalinks.c
Normal file
67
contrib/tcpdump/missing/datalinks.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
|
||||
* 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 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/datalinks.c,v 1.1.2.3 2003/11/16 09:29:48 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "pcap-missing.h"
|
||||
|
||||
/*
|
||||
* Stub versions for platforms that don't support them.
|
||||
*/
|
||||
int
|
||||
pcap_list_datalinks(pcap_t *p, int **dlt_buffer)
|
||||
{
|
||||
/*
|
||||
* This platform doesn't support changing the DLT for an
|
||||
* interface. Return a list of DLTs containing only the
|
||||
* DLT this device supports.
|
||||
*/
|
||||
*dlt_buffer = (int*)malloc(sizeof(**dlt_buffer));
|
||||
if (*dlt_buffer == NULL)
|
||||
return (-1);
|
||||
**dlt_buffer = pcap_datalink(p);
|
||||
return (1);
|
||||
}
|
175
contrib/tcpdump/missing/dlnames.c
Normal file
175
contrib/tcpdump/missing/dlnames.c
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
|
||||
* 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 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/dlnames.c,v 1.2.2.3 2003/11/18 23:12:12 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "pcap-missing.h"
|
||||
|
||||
struct dlt_choice {
|
||||
const char *name;
|
||||
const char *description;
|
||||
int dlt;
|
||||
};
|
||||
|
||||
#define DLT_CHOICE(code, description) { #code, description, code }
|
||||
#define DLT_CHOICE_SENTINEL { NULL, NULL, 0 }
|
||||
|
||||
static struct dlt_choice dlt_choices[] = {
|
||||
DLT_CHOICE(DLT_NULL, "BSD loopback"),
|
||||
DLT_CHOICE(DLT_EN10MB, "Ethernet"),
|
||||
DLT_CHOICE(DLT_IEEE802, "Token ring"),
|
||||
DLT_CHOICE(DLT_ARCNET, "ARCNET"),
|
||||
DLT_CHOICE(DLT_SLIP, "SLIP"),
|
||||
DLT_CHOICE(DLT_PPP, "PPP"),
|
||||
DLT_CHOICE(DLT_FDDI, "FDDI"),
|
||||
DLT_CHOICE(DLT_ATM_RFC1483, "RFC 1483 IP-over-ATM"),
|
||||
DLT_CHOICE(DLT_RAW, "Raw IP"),
|
||||
#ifdef DLT_SLIP_BSDOS
|
||||
DLT_CHOICE(DLT_SLIP_BSDOS, "BSD/OS SLIP"),
|
||||
#endif
|
||||
#ifdef DLT_PPP_BSDOS
|
||||
DLT_CHOICE(DLT_PPP_BSDOS, "BSD/OS PPP"),
|
||||
#endif
|
||||
#ifdef DLT_ATM_CLIP
|
||||
DLT_CHOICE(DLT_ATM_CLIP, "Linux Classical IP-over-ATM"),
|
||||
#endif
|
||||
#ifdef DLT_PPP_SERIAL
|
||||
DLT_CHOICE(DLT_PPP_SERIAL, "PPP over serial"),
|
||||
#endif
|
||||
#ifdef DLT_PPP_ETHER
|
||||
DLT_CHOICE(DLT_PPP_ETHER, "PPPoE"),
|
||||
#endif
|
||||
#ifdef DLT_C_HDLC
|
||||
DLT_CHOICE(DLT_C_HDLC, "Cisco HDLC"),
|
||||
#endif
|
||||
#ifdef DLT_IEEE802_11
|
||||
DLT_CHOICE(DLT_IEEE802_11, "802.11"),
|
||||
#endif
|
||||
#ifdef DLT_FRELAY
|
||||
DLT_CHOICE(DLT_FRELAY, "Frame Relay"),
|
||||
#endif
|
||||
#ifdef DLT_LOOP
|
||||
DLT_CHOICE(DLT_LOOP, "OpenBSD loopback"),
|
||||
#endif
|
||||
#ifdef DLT_ENC
|
||||
DLT_CHOICE(DLT_ENC, "OpenBSD encapsulated IP"),
|
||||
#endif
|
||||
#ifdef DLT_LINUX_SLL
|
||||
DLT_CHOICE(DLT_LINUX_SLL, "Linux cooked"),
|
||||
#endif
|
||||
#ifdef DLT_LTALK
|
||||
DLT_CHOICE(DLT_LTALK, "Localtalk"),
|
||||
#endif
|
||||
#ifdef DLT_PFLOG
|
||||
DLT_CHOICE(DLT_PFLOG, "OpenBSD pflog file"),
|
||||
#endif
|
||||
#ifdef DLT_PRISM_HEADER
|
||||
DLT_CHOICE(DLT_PRISM_HEADER, "802.11 plus Prism header"),
|
||||
#endif
|
||||
#ifdef DLT_IP_OVER_FC
|
||||
DLT_CHOICE(DLT_IP_OVER_FC, "RFC 2625 IP-over-Fibre Channel"),
|
||||
#endif
|
||||
#ifdef DLT_SUNATM
|
||||
DLT_CHOICE(DLT_SUNATM, "Sun raw ATM"),
|
||||
#endif
|
||||
#ifdef DLT_IEEE802_11_RADIO
|
||||
DLT_CHOICE(DLT_IEEE802_11_RADIO, "802.11 plus radio information header"),
|
||||
#endif
|
||||
#ifdef DLT_ARCNET_LINUX
|
||||
DLT_CHOICE(DLT_ARCNET_LINUX, "Linux ARCNET"),
|
||||
#endif
|
||||
#ifdef DLT_LINUX_IRDA
|
||||
DLT_CHOICE(DLT_LINUX_IRDA, "Linux IrDA"),
|
||||
#endif
|
||||
#ifdef DLT_LANE8023
|
||||
DLT_CHOICE(DLT_LANE8023, "Linux 802.3 LANE"),
|
||||
#endif
|
||||
#ifdef DLT_CIP
|
||||
DLT_CHOICE(DLT_CIP, "Linux Classical IP-over-ATM"),
|
||||
#endif
|
||||
#ifdef DLT_HDLC
|
||||
DLT_CHOICE(DLT_HDLC, "Cisco HDLC"),
|
||||
#endif
|
||||
DLT_CHOICE_SENTINEL
|
||||
};
|
||||
|
||||
#ifndef HAVE_PCAP_DATALINK_NAME_TO_VAL
|
||||
int
|
||||
pcap_datalink_name_to_val(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; dlt_choices[i].name != NULL; i++) {
|
||||
if (strcasecmp(dlt_choices[i].name + sizeof("DLT_") - 1,
|
||||
name) == 0)
|
||||
return (dlt_choices[i].dlt);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
const char *
|
||||
pcap_datalink_val_to_name(int dlt)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; dlt_choices[i].name != NULL; i++) {
|
||||
if (dlt_choices[i].dlt == dlt)
|
||||
return (dlt_choices[i].name + sizeof("DLT_") - 1);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *
|
||||
pcap_datalink_val_to_description(int dlt)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; dlt_choices[i].name != NULL; i++) {
|
||||
if (dlt_choices[i].dlt == dlt)
|
||||
return (dlt_choices[i].description);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -47,11 +47,11 @@
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.10 2000/10/24 00:56:53 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.11.2.2 2003/11/16 08:52:00 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -76,11 +76,11 @@ static const char rcsid[] =
|
||||
|
||||
#ifndef HAVE_U_INT32_T
|
||||
#include "bittypes.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKADDR_STORAGE
|
||||
#include "sockstorage.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NEED_ADDRINFO_H
|
||||
#include "addrinfo.h"
|
||||
@ -104,7 +104,7 @@ static const char in_addrany[] = { 0, 0, 0, 0 };
|
||||
static const char in6_addrany[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
static const char in_loopback[] = { 127, 0, 0, 1 };
|
||||
static const char in_loopback[] = { 127, 0, 0, 1 };
|
||||
static const char in6_loopback[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
|
||||
};
|
||||
@ -122,7 +122,7 @@ static const struct afd {
|
||||
int a_socklen;
|
||||
int a_off;
|
||||
const char *a_addrany;
|
||||
const char *a_loopback;
|
||||
const char *a_loopback;
|
||||
int a_scoped;
|
||||
} afdl [] = {
|
||||
#ifdef INET6
|
||||
@ -323,7 +323,7 @@ getaddrinfo(hostname, servname, hints, res)
|
||||
pai->ai_canonname = NULL;
|
||||
pai->ai_addr = NULL;
|
||||
pai->ai_next = NULL;
|
||||
|
||||
|
||||
if (hostname == NULL && servname == NULL)
|
||||
return EAI_NONAME;
|
||||
if (hints) {
|
||||
@ -813,7 +813,7 @@ explore_numeric(pai, hostname, servname, res)
|
||||
}
|
||||
while (cur && cur->ai_next)
|
||||
cur = cur->ai_next;
|
||||
} else
|
||||
} else
|
||||
ERR(EAI_FAMILY); /*xxx*/
|
||||
}
|
||||
|
||||
@ -948,7 +948,7 @@ get_name(addr, afd, res, numaddr, pai, servname)
|
||||
GET_AI(cur, afd, numaddr);
|
||||
GET_PORT(cur, servname);
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_GETIPNODEBY
|
||||
if (hp)
|
||||
freehostent(hp);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -39,11 +39,11 @@
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getnameinfo.c,v 1.8 2000/10/24 00:56:53 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getnameinfo.c,v 1.9.2.2 2003/11/16 08:52:00 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -124,7 +124,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
if (sa->sa_len != salen)
|
||||
return ENI_SALEN;
|
||||
#endif
|
||||
|
||||
|
||||
family = sa->sa_family;
|
||||
for (i = 0; afdl[i].a_af; i++)
|
||||
if (afdl[i].a_af == family) {
|
||||
@ -132,11 +132,11 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
goto found;
|
||||
}
|
||||
return ENI_FAMILY;
|
||||
|
||||
|
||||
found:
|
||||
if (salen != afd->a_socklen)
|
||||
return ENI_SALEN;
|
||||
|
||||
|
||||
port = ((struct sockinet *)sa)->si_port; /* network byte order */
|
||||
addr = (char *)sa + afd->a_off;
|
||||
|
||||
@ -174,7 +174,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
flags |= NI_NUMERICHOST;
|
||||
v4a >>= IN_CLASSA_NSHIFT;
|
||||
if (v4a == 0)
|
||||
flags |= NI_NUMERICHOST;
|
||||
flags |= NI_NUMERICHOST;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
|
@ -2,27 +2,27 @@
|
||||
* Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Kungliga Tekniska
|
||||
* Högskolan and its contributors.
|
||||
*
|
||||
*
|
||||
* 4. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@ -36,17 +36,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: inet_aton.c,v 1.2 2000/01/09 21:35:45 fenner Exp $ */
|
||||
/* $Id: inet_aton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.2 2000/01/09 21:35:45 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
/* Minimal implementation of inet_aton.
|
||||
* Cannot distinguish between failure and a local broadcast address. */
|
||||
|
@ -2,27 +2,27 @@
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Kungliga Tekniska
|
||||
* Högskolan and its contributors.
|
||||
*
|
||||
*
|
||||
* 4. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@ -36,18 +36,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: inet_ntop.c,v 1.3 2000/01/09 21:35:45 fenner Exp $ */
|
||||
/* $Id: inet_ntop.c,v 1.5.2.2 2003/11/16 08:52:01 guy Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_ntop.c,v 1.3 2000/01/09 21:35:45 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_ntop.c,v 1.5.2.2 2003/11/16 08:52:01 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -2,27 +2,27 @@
|
||||
* Copyright (c) 1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Kungliga Tekniska
|
||||
* Högskolan and its contributors.
|
||||
*
|
||||
*
|
||||
* 4. Neither the name of the Institute 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 INSTITUTE 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
|
||||
@ -36,17 +36,16 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: inet_pton.c,v 1.2 2000/01/09 21:35:46 fenner Exp $ */
|
||||
/* $Id: inet_pton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_pton.c,v 1.2 2000/01/09 21:35:46 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_pton.c,v 1.4.2.2 2003/11/16 08:52:01 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
int
|
||||
inet_pton(int af, const char *src, void *dst)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -33,4 +33,4 @@
|
||||
*/
|
||||
#ifndef HAVE_RES_USE_INET6
|
||||
#define RES_USE_INET6 0x80000000 /* use/map IPv6 in gethostbyname() */
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
#ifndef MAXRESOLVSORT /* XXX */
|
||||
#define MAXRESOLVSORT 10 /* number of net to sort on */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_RES_STATE_EXT
|
||||
struct __res_state_ext {
|
||||
@ -40,10 +40,10 @@ struct __res_state_ext {
|
||||
struct in_addr ina;
|
||||
#ifdef INET6
|
||||
struct in6_addr in6a;
|
||||
#endif
|
||||
#endif
|
||||
} addr, mask;
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern struct __res_state_ext _res_ext;
|
||||
|
@ -2,22 +2,22 @@
|
||||
* Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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 Institute 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 INSTITUTE 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
|
||||
@ -31,15 +31,15 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: snprintf.c,v 1.5 2001/01/12 10:14:40 guy Exp $ */
|
||||
/* $Id: snprintf.c,v 1.6.2.2 2003/11/16 08:52:02 guy Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.5 2001/01/12 10:14:40 guy Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.6.2.2 2003/11/16 08:52:02 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -214,7 +214,7 @@ append_number(struct state *state,
|
||||
state->s[-i-1] = state->s[-len+i];
|
||||
state->s[-len+i] = c;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -258,13 +258,13 @@ append_char(struct state *state,
|
||||
while(!(flags & minus_flag) && --width > 0)
|
||||
if((*state->append_char) (state, ' '))
|
||||
return 1;
|
||||
|
||||
|
||||
if((*state->append_char) (state, arg))
|
||||
return 1;
|
||||
while((flags & minus_flag) && --width > 0)
|
||||
if((*state->append_char) (state, ' '))
|
||||
return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ xyzprintf (struct state *state, const char *char_format, va_list ap)
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if((flags & space_flag) && (flags & plus_flag))
|
||||
flags ^= space_flag;
|
||||
|
||||
@ -365,7 +365,7 @@ xyzprintf (struct state *state, const char *char_format, va_list ap)
|
||||
if (append_string(state,
|
||||
va_arg(ap, unsigned char*),
|
||||
width,
|
||||
prec,
|
||||
prec,
|
||||
flags))
|
||||
return -1;
|
||||
break;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -28,11 +28,11 @@
|
||||
*/
|
||||
struct sockaddr_storage {
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
u_int8_t __ss_len;
|
||||
u_int8_t __ss_family;
|
||||
u_int8_t ss_len;
|
||||
u_int8_t ss_family;
|
||||
u_int8_t fill[126];
|
||||
#else
|
||||
u_int8_t __ss_family;
|
||||
u_int8_t ss_family;
|
||||
u_int8_t fill[127];
|
||||
#endif /* HAVE_SOCKADDR_SA_LEN */
|
||||
};
|
||||
|
@ -29,17 +29,18 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strlcat.c,v 1.1 2000/01/19 05:34:19 itojun Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strlcat.c,v 1.3.2.2 2003/11/16 08:52:03 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
@ -47,10 +48,7 @@ static const char rcsid[] =
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcat(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
strlcat(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
|
@ -29,27 +29,25 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strlcpy.c,v 1.1 2000/01/19 05:34:19 itojun Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strlcpy.c,v 1.3.2.2 2003/11/16 08:52:03 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcpy(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
strlcpy(char *dst, const char *src, size_t siz)
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
|
83
contrib/tcpdump/missing/strsep.c
Normal file
83
contrib/tcpdump/missing/strsep.c
Normal file
@ -0,0 +1,83 @@
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* 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 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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 BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strsep.c,v 1.3 2003/03/25 08:33:48 guy Exp $ (LBL)";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* Get next token from string *stringp, where tokens are possibly-empty
|
||||
* strings separated by characters from delim.
|
||||
*
|
||||
* Writes NULs into the string at *stringp to end tokens.
|
||||
* delim need not remain constant from call to call.
|
||||
* On return, *stringp points past the last NUL written (if there might
|
||||
* be further tokens), or is NULL (if there are definitely no more tokens).
|
||||
*
|
||||
* If *stringp is NULL, strsep returns NULL.
|
||||
*/
|
||||
char *
|
||||
strsep(char **stringp, const char *delim)
|
||||
{
|
||||
register char *s;
|
||||
register const char *spanp;
|
||||
register int c, sc;
|
||||
char *tok;
|
||||
|
||||
if ((s = *stringp) == NULL)
|
||||
return (NULL);
|
||||
for (tok = s;;) {
|
||||
c = *s++;
|
||||
spanp = delim;
|
||||
do {
|
||||
if ((sc = *spanp++) == c) {
|
||||
if (c == 0)
|
||||
s = NULL;
|
||||
else
|
||||
s[-1] = 0;
|
||||
*stringp = s;
|
||||
return (tok);
|
||||
}
|
||||
} while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/nameser.h,v 1.9 2001/06/27 05:40:16 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/nameser.h,v 1.14 2003/11/05 06:02:59 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -34,14 +34,14 @@
|
||||
* @(#)nameser.h 8.2 (Berkeley) 2/16/94
|
||||
* -
|
||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies, and that
|
||||
* the name of Digital Equipment Corporation not be used in advertising or
|
||||
* publicity pertaining to distribution of the document or software without
|
||||
* specific, written prior permission.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
||||
@ -75,6 +75,7 @@
|
||||
* Internet nameserver port number
|
||||
*/
|
||||
#define NAMESERVER_PORT 53
|
||||
#define MULTICASTDNS_PORT 5353
|
||||
|
||||
/*
|
||||
* Currently defined opcodes
|
||||
@ -189,6 +190,7 @@
|
||||
#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
|
||||
/* Query class values which do not appear in resource records */
|
||||
#define C_ANY 255 /* wildcard match */
|
||||
#define C_CACHE_FLUSH 0x8000 /* mDNS cache flush flag */
|
||||
|
||||
/*
|
||||
* Status return codes for T_UNSPEC conversion routines
|
||||
@ -231,7 +233,7 @@ typedef struct {
|
||||
*/
|
||||
#define INDIR_MASK 0xc0 /* 11.... */
|
||||
#define EDNS0_MASK 0x40 /* 01.... */
|
||||
# define EDNS0_ELT_BITLABEL 0x01
|
||||
# define EDNS0_ELT_BITLABEL 0x01
|
||||
|
||||
/*
|
||||
* Structure for passing resource records around.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* NETBIOS protocol formats
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/netbios.h,v 1.1.1.1 1999/10/07 23:47:10 mcr Exp $
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/netbios.h,v 1.3 2002/12/11 07:13:55 guy Exp $
|
||||
*/
|
||||
|
||||
struct p8022Hdr {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.4 2000/10/03 02:54:57 itojun Exp $ */
|
||||
/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.7 2003/08/06 04:58:21 guy Exp $ */
|
||||
|
||||
/*
|
||||
* Based on ntp.h from the U of MD implementation
|
||||
@ -8,7 +8,7 @@
|
||||
/*
|
||||
* Definitions for the masses
|
||||
*/
|
||||
#define JAN_1970 2208988800 /* 1970 - 1900 in seconds */
|
||||
#define JAN_1970 2208988800U /* 1970 - 1900 in seconds */
|
||||
|
||||
/*
|
||||
* Structure definitions for NTP fixed point values
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* YIPS @(#)$Id: oakley.h,v 1.1 1999/10/30 05:11:10 itojun Exp $ */
|
||||
/* YIPS @(#)$Id: oakley.h,v 1.4 2002/12/11 07:13:56 guy Exp $ */
|
||||
|
||||
/* refer to RFC 2409 */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.3 2000/12/17 23:07:50 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.11 2003/10/22 17:08:46 hannes Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -21,25 +21,34 @@
|
||||
*
|
||||
* OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
|
||||
*/
|
||||
#define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
|
||||
#define OSPF_TYPE_HELLO 1 /* Hello */
|
||||
#define OSPF_TYPE_DB 2 /* Database Description */
|
||||
#define OSPF_TYPE_LSR 3 /* Link State Request */
|
||||
#define OSPF_TYPE_LSU 4 /* Link State Update */
|
||||
#define OSPF_TYPE_LSA 5 /* Link State Ack */
|
||||
#define OSPF_TYPE_MAX 6
|
||||
#define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
|
||||
#define OSPF_TYPE_HELLO 1 /* Hello */
|
||||
#define OSPF_TYPE_DD 2 /* Database Description */
|
||||
#define OSPF_TYPE_LS_REQ 3 /* Link State Request */
|
||||
#define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */
|
||||
#define OSPF_TYPE_LS_ACK 5 /* Link State Ack */
|
||||
|
||||
/* Options *_options */
|
||||
/* Options field
|
||||
*
|
||||
* +------------------------------------+
|
||||
* | * | O | DC | EA | N/P | MC | E | T |
|
||||
* +------------------------------------+
|
||||
*
|
||||
*/
|
||||
|
||||
#define OSPF_OPTION_T 0x01 /* T bit: TOS support */
|
||||
#define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
|
||||
#define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
|
||||
#define OSPF_OPTION_NP 0x08 /* N/P bit: NSSA capable */
|
||||
#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 */
|
||||
|
||||
/* ospf_authtype */
|
||||
#define OSPF_AUTH_NONE 0 /* No auth-data */
|
||||
#define OSPF_AUTH_SIMPLE 1 /* Simple password */
|
||||
#define OSPF_AUTH_MD5 2 /* MD5 authentication */
|
||||
#define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
|
||||
|
||||
#define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
|
||||
|
||||
/* db_flags */
|
||||
#define OSPF_DB_INIT 0x04 /* */
|
||||
@ -54,7 +63,33 @@
|
||||
#define LS_TYPE_ASE 5 /* ASE */
|
||||
#define LS_TYPE_GROUP 6 /* Group membership (multicast */
|
||||
/* extensions 23 July 1991) */
|
||||
#define LS_TYPE_MAX 7
|
||||
#define LS_TYPE_NSSA 7 /* rfc1587 - 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_TE_TLV_ROUTER 1 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_TLV_LINK 2 /* rfc3630 */
|
||||
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE 1 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID 2 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP 3 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP 4 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC 5 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW 6 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW 7 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW 8 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP 9 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* draft-ietf-ccamp-ospf-gmpls-extensions */
|
||||
#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_LINK_TYPE_PTP 1 /* rfc3630 */
|
||||
#define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */
|
||||
|
||||
/*************************************************
|
||||
*
|
||||
@ -95,12 +130,18 @@ struct lsa_hdr {
|
||||
u_int16_t ls_age;
|
||||
u_int8_t ls_options;
|
||||
u_int8_t ls_type;
|
||||
struct in_addr ls_stateid;
|
||||
union {
|
||||
struct in_addr lsa_id;
|
||||
struct { /* opaque LSAs change the LSA-ID field */
|
||||
u_int8_t opaque_type;
|
||||
u_int8_t opaque_id[3];
|
||||
} opaque_field;
|
||||
} un_lsa_id;
|
||||
struct in_addr ls_router;
|
||||
u_int32_t ls_seq;
|
||||
u_int16_t ls_chksum;
|
||||
u_int16_t ls_length;
|
||||
} ;
|
||||
};
|
||||
|
||||
/* link state advertisement */
|
||||
struct lsa {
|
||||
@ -149,8 +190,21 @@ struct lsa {
|
||||
u_int32_t mcla_vtype;
|
||||
struct in_addr mcla_vid;
|
||||
} un_mcla[1];
|
||||
|
||||
/* Opaque TE LSA */
|
||||
struct {
|
||||
u_int16_t type;
|
||||
u_int16_t length;
|
||||
u_int8_t data[1]; /* may repeat */
|
||||
} un_te_lsa_tlv;
|
||||
|
||||
/* Unknown LSA */
|
||||
struct unknown {
|
||||
u_int8_t data[1]; /* may repeat */
|
||||
} un_unknown[1];
|
||||
|
||||
} lsa_un;
|
||||
} ;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@ -160,7 +214,7 @@ struct tos_metric {
|
||||
u_int8_t tos_type;
|
||||
u_int8_t tos_zero;
|
||||
u_int16_t tos_metric;
|
||||
} ;
|
||||
};
|
||||
|
||||
#define OSPF_AUTH_SIZE 8
|
||||
|
||||
@ -201,8 +255,14 @@ struct ospfhdr {
|
||||
|
||||
/* Link State Request */
|
||||
struct lsr {
|
||||
u_int32_t ls_type;
|
||||
struct in_addr ls_stateid;
|
||||
u_int8_t ls_type[4];
|
||||
union {
|
||||
struct in_addr ls_stateid;
|
||||
struct { /* opaque LSAs change the LSA-ID field */
|
||||
u_int8_t opaque_type;
|
||||
u_int8_t opaque_id[3];
|
||||
} opaque_field;
|
||||
} un_ls_stateid;
|
||||
struct in_addr ls_router;
|
||||
} un_lsr[1]; /* may repeat */
|
||||
|
||||
@ -217,7 +277,7 @@ struct ospfhdr {
|
||||
struct lsa_hdr lsa_lshdr[1]; /* may repeat */
|
||||
} un_lsa ;
|
||||
} ospf_un ;
|
||||
} ;
|
||||
};
|
||||
|
||||
#define ospf_hello ospf_un.un_hello
|
||||
#define ospf_db ospf_un.un_db
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.3 2000/12/17 23:07:50 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.6 2002/12/11 07:13:56 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -105,7 +105,7 @@ struct lsa_hdr {
|
||||
u_int32_t ls_seq;
|
||||
u_int16_t ls_chksum;
|
||||
u_int16_t ls_length;
|
||||
} ;
|
||||
};
|
||||
|
||||
struct lsa_prefix {
|
||||
u_int8_t lsa_p_len;
|
||||
@ -153,7 +153,7 @@ struct lsa {
|
||||
/* AS external links advertisements */
|
||||
struct {
|
||||
u_int32_t asla_metric;
|
||||
struct lsa_prefix asla_prefix[1];
|
||||
struct lsa_prefix asla_prefix[1];
|
||||
/* some optional fields follow */
|
||||
} un_asla;
|
||||
|
||||
@ -195,7 +195,7 @@ struct lsa {
|
||||
struct lsa_prefix intra_ap_prefix[1];
|
||||
} un_intra_ap;
|
||||
} lsa_un;
|
||||
} ;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@ -205,7 +205,7 @@ struct tos_metric {
|
||||
u_int8_t tos_type;
|
||||
u_int8_t tos_zero;
|
||||
u_int16_t tos_metric;
|
||||
} ;
|
||||
};
|
||||
|
||||
#define OSPF_AUTH_SIZE 8
|
||||
|
||||
@ -268,7 +268,7 @@ struct ospf6hdr {
|
||||
struct lsa_hdr lsa_lshdr[1]; /* may repeat */
|
||||
} un_lsa ;
|
||||
} ospf6_un ;
|
||||
} ;
|
||||
};
|
||||
|
||||
#define ospf6_hello ospf6_un.un_hello
|
||||
#define ospf6_db ospf6_un.un_db
|
||||
|
62
contrib/tcpdump/oui.c
Normal file
62
contrib/tcpdump/oui.c
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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/oui.c,v 1.2.2.1 2004/02/06 14:38:51 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include "interface.h"
|
||||
#include "oui.h"
|
||||
|
||||
/* FIXME complete OUI list using a script */
|
||||
|
||||
struct tok oui_values[] = {
|
||||
{ 0x009069, "Juniper"},
|
||||
{ 0x00000c, "Cisco"},
|
||||
};
|
||||
|
||||
/* list taken from ethereal/packet-radius.c */
|
||||
|
||||
struct tok smi_values[] = {
|
||||
{ SMI_ACC, "ACC"},
|
||||
{ SMI_CISCO, "Cisco"},
|
||||
{ SMI_SHIVA, "Shiva"},
|
||||
{ SMI_MICROSOFT, "Microsoft"},
|
||||
{ SMI_LIVINGSTON, "Livingston"},
|
||||
{ SMI_3COM, "3Com"},
|
||||
{ SMI_ASCEND, "Ascend"},
|
||||
{ SMI_BAY, "Bay Networks"},
|
||||
{ SMI_FOUNDRY, "Foundry"},
|
||||
{ SMI_VERSANET, "Versanet"},
|
||||
{ SMI_REDBACK, "Redback"},
|
||||
{ SMI_JUNIPER, "Juniper Networks"},
|
||||
{ SMI_APTIS, "Aptis"},
|
||||
{ SMI_COSINE, "CoSine Communications"},
|
||||
{ SMI_SHASTA, "Shasta"},
|
||||
{ SMI_NOMADIX, "Nomadix"},
|
||||
{ SMI_UNISPHERE, "Unisphere Networks"},
|
||||
{ SMI_ISSANNI, "Issanni Communications"},
|
||||
{ SMI_QUINTUM, "Quintum"},
|
||||
{ SMI_COLUBRIS, "Colubris"},
|
||||
{ SMI_COLUMBIA_UNIVERSITY, "Columbia University"},
|
||||
{ SMI_THE3GPP, "3GPP"},
|
||||
{ 0, NULL }
|
||||
};
|
41
contrib/tcpdump/oui.h
Normal file
41
contrib/tcpdump/oui.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.2.2.1 2004/02/06 14:38:50 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 oui_values[];
|
||||
extern struct tok smi_values[];
|
||||
|
||||
#define SMI_ACC 5
|
||||
#define SMI_CISCO 9
|
||||
#define SMI_SHIVA 166
|
||||
#define SMI_LIVINGSTON 307
|
||||
#define SMI_MICROSOFT 311
|
||||
#define SMI_3COM 429
|
||||
#define SMI_ASCEND 529
|
||||
#define SMI_BAY 1584
|
||||
#define SMI_FOUNDRY 1991
|
||||
#define SMI_VERSANET 2180
|
||||
#define SMI_REDBACK 2352
|
||||
#define SMI_JUNIPER 2636
|
||||
#define SMI_APTIS 2637
|
||||
#define SMI_COSINE 3085
|
||||
#define SMI_SHASTA 3199
|
||||
#define SMI_NOMADIX 3309
|
||||
#define SMI_UNISPHERE 4874
|
||||
#define SMI_ISSANNI 5948
|
||||
#define SMI_QUINTUM 6618
|
||||
#define SMI_COLUBRIS 8744
|
||||
#define SMI_COLUMBIA_UNIVERSITY 11862
|
||||
#define SMI_THE3GPP 10415
|
56
contrib/tcpdump/pcap-missing.h
Normal file
56
contrib/tcpdump/pcap-missing.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 1988-2002
|
||||
* 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.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.1.2.1 2003/11/18 23:12:11 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_pcap_missing_h
|
||||
#define tcpdump_pcap_missing_h
|
||||
|
||||
/*
|
||||
* Declarations of functions that might be missing from libpcap.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_PCAP_LIST_DATALINKS
|
||||
extern int pcap_list_datalinks(pcap_t *, int **);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PCAP_DATALINK_NAME_TO_VAL
|
||||
/*
|
||||
* We assume no platform has one but not the other.
|
||||
*/
|
||||
extern int pcap_datalink_name_to_val(const char *);
|
||||
extern const char *pcap_datalink_val_to_name(int);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
extern const char *pcap_datalink_val_to_description(int);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
77
contrib/tcpdump/pf.h
Normal file
77
contrib/tcpdump/pf.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Daniel Hartmeier
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* - 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
|
||||
* COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/pf.h,v 1.1.2.1 2004/03/28 21:25:03 fenner Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* from $OpenBSD: pfvar.h,v 1.170 2003/08/22 21:50:34 david Exp $ */
|
||||
|
||||
enum { PF_INOUT=0, PF_IN=1, PF_OUT=2 };
|
||||
enum { PF_PASS=0, PF_DROP=1, PF_SCRUB=2, PF_NAT=3, PF_NONAT=4,
|
||||
PF_BINAT=5, PF_NOBINAT=6, PF_RDR=7, PF_NORDR=8, PF_SYNPROXY_DROP=9 };
|
||||
|
||||
/* Reasons code for passing/dropping a packet */
|
||||
#define PFRES_MATCH 0 /* Explicit match of a rule */
|
||||
#define PFRES_BADOFF 1 /* Bad offset for pull_hdr */
|
||||
#define PFRES_FRAG 2 /* Dropping following fragment */
|
||||
#define PFRES_SHORT 3 /* Dropping short packet */
|
||||
#define PFRES_NORM 4 /* Dropping by normalizer */
|
||||
#define PFRES_MEMORY 5 /* Dropped due to lacking mem */
|
||||
#define PFRES_MAX 6 /* total+1 */
|
||||
|
||||
#define PFRES_NAMES { \
|
||||
"match", \
|
||||
"bad-offset", \
|
||||
"fragment", \
|
||||
"short", \
|
||||
"normalize", \
|
||||
"memory", \
|
||||
NULL \
|
||||
}
|
||||
|
||||
#define PF_RULESET_NAME_SIZE 16
|
||||
|
||||
/* from $OpenBSD: if_pflog.h,v 1.9 2003/07/15 20:27:27 dhartmei Exp $ */
|
||||
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ 16
|
||||
#endif
|
||||
|
||||
struct pfloghdr {
|
||||
u_int8_t length;
|
||||
sa_family_t af;
|
||||
u_int8_t action;
|
||||
u_int8_t reason;
|
||||
char ifname[IFNAMSIZ];
|
||||
char ruleset[PF_RULESET_NAME_SIZE];
|
||||
u_int32_t rulenr;
|
||||
u_int32_t subrulenr;
|
||||
u_int8_t dir;
|
||||
u_int8_t pad[3];
|
||||
};
|
||||
#define PFLOG_HDRLEN sizeof(struct pfloghdr)
|
File diff suppressed because it is too large
Load Diff
@ -22,20 +22,15 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.15 2001/09/17 21:57:54 fenner Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.19.2.3 2003/11/19 00:35:43 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -43,9 +38,10 @@ static const char rcsid[] =
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
int
|
||||
ah_print(register const u_char *bp, register const u_char *bp2)
|
||||
ah_print(register const u_char *bp)
|
||||
{
|
||||
register const struct ah *ah;
|
||||
register const u_char *ep;
|
||||
@ -58,18 +54,18 @@ ah_print(register const u_char *bp, register const u_char *bp2)
|
||||
TCHECK(*ah);
|
||||
|
||||
sumlen = ah->ah_len << 2;
|
||||
spi = (u_int32_t)ntohl(ah->ah_spi);
|
||||
spi = EXTRACT_32BITS(&ah->ah_spi);
|
||||
|
||||
printf("AH(spi=0x%08x", spi);
|
||||
if (vflag)
|
||||
printf(",sumlen=%d", sumlen);
|
||||
printf(",seq=0x%x", (u_int32_t)ntohl(*(const u_int32_t *)(ah + 1)));
|
||||
printf(",seq=0x%x", EXTRACT_32BITS(ah + 1));
|
||||
if (bp + sizeof(struct ah) + sumlen > ep)
|
||||
fputs("[truncated]", stdout);
|
||||
fputs("): ", stdout);
|
||||
|
||||
|
||||
return sizeof(struct ah) + sumlen;
|
||||
trunc:
|
||||
fputs("[|AH]", stdout);
|
||||
return 65535;
|
||||
return -1;
|
||||
}
|
||||
|
455
contrib/tcpdump/print-aodv.c
Normal file
455
contrib/tcpdump/print-aodv.c
Normal file
@ -0,0 +1,455 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Bruce M. Simpson <bms@spc.org>
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Bruce M. Simpson.
|
||||
* 4. Neither the name of Bruce M. Simpson nor the names of co-
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Bruce M. Simpson 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 Bruce M. Simpson 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.
|
||||
*/
|
||||
|
||||
#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)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
#include "aodv.h"
|
||||
|
||||
static void
|
||||
aodv_extension(const struct aodv_ext *ep, u_int length)
|
||||
{
|
||||
u_int i;
|
||||
const struct aodv_hello *ah;
|
||||
|
||||
switch (ep->type) {
|
||||
case AODV_EXT_HELLO:
|
||||
if (snapend < (u_char *) ep) {
|
||||
printf(" [|hello]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - (u_char *)ep));
|
||||
if (i < sizeof(struct aodv_hello)) {
|
||||
printf(" [|hello]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(struct aodv_hello);
|
||||
ah = (void *)ep;
|
||||
printf("\n\text HELLO %ld ms",
|
||||
(unsigned long)EXTRACT_32BITS(&ah->interval));
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("\n\text %u %u", ep->type, ep->length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
aodv_rreq(const union aodv *ap, const u_char *dat, u_int length)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < sizeof(ap->rreq)) {
|
||||
printf(" [|rreq]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(ap->rreq);
|
||||
printf(" rreq %u %s%s%s%s%shops %u id 0x%08lx\n"
|
||||
"\tdst %s seq %lu src %s seq %lu", length,
|
||||
ap->rreq.rreq_type & RREQ_JOIN ? "[J]" : "",
|
||||
ap->rreq.rreq_type & RREQ_REPAIR ? "[R]" : "",
|
||||
ap->rreq.rreq_type & RREQ_GRAT ? "[G]" : "",
|
||||
ap->rreq.rreq_type & RREQ_DEST ? "[D]" : "",
|
||||
ap->rreq.rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
|
||||
ap->rreq.rreq_hops,
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_id),
|
||||
ipaddr_string(&ap->rreq.rreq_da),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_ds),
|
||||
ipaddr_string(&ap->rreq.rreq_oa),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_os));
|
||||
if (i >= sizeof(struct aodv_ext))
|
||||
aodv_extension((void *)(&ap->rreq + 1), i);
|
||||
}
|
||||
|
||||
static void
|
||||
aodv_rrep(const union aodv *ap, const u_char *dat, u_int length)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < sizeof(ap->rrep)) {
|
||||
printf(" [|rrep]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(ap->rrep);
|
||||
printf(" rrep %u %s%sprefix %u hops %u\n"
|
||||
"\tdst %s dseq %lu src %s %lu ms", length,
|
||||
ap->rrep.rrep_type & RREP_REPAIR ? "[R]" : "",
|
||||
ap->rrep.rrep_type & RREP_ACK ? "[A] " : " ",
|
||||
ap->rrep.rrep_ps & RREP_PREFIX_MASK,
|
||||
ap->rrep.rrep_hops,
|
||||
ipaddr_string(&ap->rrep.rrep_da),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rrep.rrep_ds),
|
||||
ipaddr_string(&ap->rrep.rrep_oa),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rrep.rrep_life));
|
||||
if (i >= sizeof(struct aodv_ext))
|
||||
aodv_extension((void *)(&ap->rrep + 1), i);
|
||||
}
|
||||
|
||||
static void
|
||||
aodv_rerr(const union aodv *ap, const u_char *dat, u_int length)
|
||||
{
|
||||
u_int i;
|
||||
const struct rerr_unreach *dp = NULL;
|
||||
int n, trunc;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < offsetof(struct aodv_rerr, r)) {
|
||||
printf(" [|rerr]");
|
||||
return;
|
||||
}
|
||||
i -= offsetof(struct aodv_rerr, r);
|
||||
dp = &ap->rerr.r.dest[0];
|
||||
n = ap->rerr.rerr_dc * sizeof(ap->rerr.r.dest[0]);
|
||||
printf(" rerr %s [items %u] [%u]:",
|
||||
ap->rerr.rerr_flags & RERR_NODELETE ? "[D]" : "",
|
||||
ap->rerr.rerr_dc, length);
|
||||
trunc = n - (i/sizeof(ap->rerr.r.dest[0]));
|
||||
for (; i >= sizeof(ap->rerr.r.dest[0]);
|
||||
++dp, i -= sizeof(ap->rerr.r.dest[0])) {
|
||||
printf(" {%s}(%ld)", ipaddr_string(&dp->u_da),
|
||||
(unsigned long)EXTRACT_32BITS(&dp->u_ds));
|
||||
}
|
||||
if (trunc)
|
||||
printf("[|rerr]");
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_rreq(const union aodv *ap, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_rreq(const union aodv *ap _U_, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < sizeof(ap->rreq6)) {
|
||||
printf(" [|rreq6]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(ap->rreq6);
|
||||
printf(" v6 rreq %u %s%s%s%s%shops %u id 0x%08lx\n"
|
||||
"\tdst %s seq %lu src %s seq %lu", length,
|
||||
ap->rreq6.rreq_type & RREQ_JOIN ? "[J]" : "",
|
||||
ap->rreq6.rreq_type & RREQ_REPAIR ? "[R]" : "",
|
||||
ap->rreq6.rreq_type & RREQ_GRAT ? "[G]" : "",
|
||||
ap->rreq6.rreq_type & RREQ_DEST ? "[D]" : "",
|
||||
ap->rreq6.rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
|
||||
ap->rreq6.rreq_hops,
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq6.rreq_id),
|
||||
ip6addr_string(&ap->rreq6.rreq_da),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq6.rreq_ds),
|
||||
ip6addr_string(&ap->rreq6.rreq_oa),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq6.rreq_os));
|
||||
if (i >= sizeof(struct aodv_ext))
|
||||
aodv_extension((void *)(&ap->rreq6 + 1), i);
|
||||
#else
|
||||
printf(" v6 rreq %u", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_rrep(const union aodv *ap, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_rrep(const union aodv *ap _U_, const u_char *dat _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < sizeof(ap->rrep6)) {
|
||||
printf(" [|rrep6]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(ap->rrep6);
|
||||
printf(" rrep %u %s%sprefix %u hops %u\n"
|
||||
"\tdst %s dseq %lu src %s %lu ms", length,
|
||||
ap->rrep6.rrep_type & RREP_REPAIR ? "[R]" : "",
|
||||
ap->rrep6.rrep_type & RREP_ACK ? "[A] " : " ",
|
||||
ap->rrep6.rrep_ps & RREP_PREFIX_MASK,
|
||||
ap->rrep6.rrep_hops,
|
||||
ip6addr_string(&ap->rrep6.rrep_da),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rrep6.rrep_ds),
|
||||
ip6addr_string(&ap->rrep6.rrep_oa),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rrep6.rrep_life));
|
||||
if (i >= sizeof(struct aodv_ext))
|
||||
aodv_extension((void *)(&ap->rrep6 + 1), i);
|
||||
#else
|
||||
printf(" rrep %u", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_rerr(const union aodv *ap, u_int length)
|
||||
#else
|
||||
aodv_v6_rerr(const union aodv *ap _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
const struct rerr_unreach6 *dp6 = NULL;
|
||||
int i, j, n, trunc;
|
||||
|
||||
i = length - offsetof(struct aodv_rerr, r);
|
||||
j = sizeof(ap->rerr.r.dest6[0]);
|
||||
dp6 = &ap->rerr.r.dest6[0];
|
||||
n = ap->rerr.rerr_dc * j;
|
||||
printf(" rerr %s [items %u] [%u]:",
|
||||
ap->rerr.rerr_flags & RERR_NODELETE ? "[D]" : "",
|
||||
ap->rerr.rerr_dc, length);
|
||||
trunc = n - (i/j);
|
||||
for (; i -= j >= 0; ++dp6) {
|
||||
printf(" {%s}(%ld)", ip6addr_string(&dp6->u_da),
|
||||
(unsigned long)EXTRACT_32BITS(&dp6->u_ds));
|
||||
}
|
||||
if (trunc)
|
||||
printf("[|rerr]");
|
||||
#else
|
||||
printf(" rerr %u", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_draft_01_rreq(const union aodv *ap, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_draft_01_rreq(const union aodv *ap _U_, const u_char *dat _U_,
|
||||
u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < sizeof(ap->rreq6_draft_01)) {
|
||||
printf(" [|rreq6]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(ap->rreq6_draft_01);
|
||||
printf(" rreq %u %s%s%s%s%shops %u id 0x%08lx\n"
|
||||
"\tdst %s seq %lu src %s seq %lu", length,
|
||||
ap->rreq6_draft_01.rreq_type & RREQ_JOIN ? "[J]" : "",
|
||||
ap->rreq6_draft_01.rreq_type & RREQ_REPAIR ? "[R]" : "",
|
||||
ap->rreq6_draft_01.rreq_type & RREQ_GRAT ? "[G]" : "",
|
||||
ap->rreq6_draft_01.rreq_type & RREQ_DEST ? "[D]" : "",
|
||||
ap->rreq6_draft_01.rreq_type & RREQ_UNKNOWN ? "[U] " : " ",
|
||||
ap->rreq6_draft_01.rreq_hops,
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq6_draft_01.rreq_id),
|
||||
ip6addr_string(&ap->rreq6_draft_01.rreq_da),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq6_draft_01.rreq_ds),
|
||||
ip6addr_string(&ap->rreq6_draft_01.rreq_oa),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rreq6_draft_01.rreq_os));
|
||||
if (i >= sizeof(struct aodv_ext))
|
||||
aodv_extension((void *)(&ap->rreq6_draft_01 + 1), i);
|
||||
#else
|
||||
printf(" rreq %u", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_draft_01_rrep(const union aodv *ap, const u_char *dat, u_int length)
|
||||
#else
|
||||
aodv_v6_draft_01_rrep(const union aodv *ap _U_, const u_char *dat _U_,
|
||||
u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
u_int i;
|
||||
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
i = min(length, (u_int)(snapend - dat));
|
||||
if (i < sizeof(ap->rrep6_draft_01)) {
|
||||
printf(" [|rrep6]");
|
||||
return;
|
||||
}
|
||||
i -= sizeof(ap->rrep6_draft_01);
|
||||
printf(" rrep %u %s%sprefix %u hops %u\n"
|
||||
"\tdst %s dseq %lu src %s %lu ms", length,
|
||||
ap->rrep6_draft_01.rrep_type & RREP_REPAIR ? "[R]" : "",
|
||||
ap->rrep6_draft_01.rrep_type & RREP_ACK ? "[A] " : " ",
|
||||
ap->rrep6_draft_01.rrep_ps & RREP_PREFIX_MASK,
|
||||
ap->rrep6_draft_01.rrep_hops,
|
||||
ip6addr_string(&ap->rrep6_draft_01.rrep_da),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rrep6_draft_01.rrep_ds),
|
||||
ip6addr_string(&ap->rrep6_draft_01.rrep_oa),
|
||||
(unsigned long)EXTRACT_32BITS(&ap->rrep6_draft_01.rrep_life));
|
||||
if (i >= sizeof(struct aodv_ext))
|
||||
aodv_extension((void *)(&ap->rrep6_draft_01 + 1), i);
|
||||
#else
|
||||
printf(" rrep %u", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef INET6
|
||||
aodv_v6_draft_01_rerr(const union aodv *ap, u_int length)
|
||||
#else
|
||||
aodv_v6_draft_01_rerr(const union aodv *ap _U_, u_int length)
|
||||
#endif
|
||||
{
|
||||
#ifdef INET6
|
||||
const struct rerr_unreach6_draft_01 *dp6 = NULL;
|
||||
int i, j, n, trunc;
|
||||
|
||||
i = length - offsetof(struct aodv_rerr, r);
|
||||
j = sizeof(ap->rerr.r.dest6_draft_01[0]);
|
||||
dp6 = &ap->rerr.r.dest6_draft_01[0];
|
||||
n = ap->rerr.rerr_dc * j;
|
||||
printf(" rerr %s [items %u] [%u]:",
|
||||
ap->rerr.rerr_flags & RERR_NODELETE ? "[D]" : "",
|
||||
ap->rerr.rerr_dc, length);
|
||||
trunc = n - (i/j);
|
||||
for (; i -= j >= 0; ++dp6) {
|
||||
printf(" {%s}(%ld)", ip6addr_string(&dp6->u_da),
|
||||
(unsigned long)EXTRACT_32BITS(&dp6->u_ds));
|
||||
}
|
||||
if (trunc)
|
||||
printf("[|rerr]");
|
||||
#else
|
||||
printf(" rerr %u", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
aodv_print(const u_char *dat, u_int length, int is_ip6)
|
||||
{
|
||||
const union aodv *ap;
|
||||
|
||||
ap = (union aodv *)dat;
|
||||
if (snapend < dat) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
if (min(length, (u_int)(snapend - dat)) < sizeof(ap->rrep_ack)) {
|
||||
printf(" [|aodv]");
|
||||
return;
|
||||
}
|
||||
printf(" aodv");
|
||||
|
||||
switch (ap->rerr.rerr_type) {
|
||||
|
||||
case AODV_RREQ:
|
||||
if (is_ip6)
|
||||
aodv_v6_rreq(ap, dat, length);
|
||||
else
|
||||
aodv_rreq(ap, dat, length);
|
||||
break;
|
||||
|
||||
case AODV_RREP:
|
||||
if (is_ip6)
|
||||
aodv_v6_rrep(ap, dat, length);
|
||||
else
|
||||
aodv_rrep(ap, dat, length);
|
||||
break;
|
||||
|
||||
case AODV_RERR:
|
||||
if (is_ip6)
|
||||
aodv_v6_rerr(ap, length);
|
||||
else
|
||||
aodv_rerr(ap, dat, length);
|
||||
break;
|
||||
|
||||
case AODV_RREP_ACK:
|
||||
printf(" rrep-ack %u", length);
|
||||
break;
|
||||
|
||||
case AODV_V6_DRAFT_01_RREQ:
|
||||
aodv_v6_draft_01_rreq(ap, dat, length);
|
||||
break;
|
||||
|
||||
case AODV_V6_DRAFT_01_RREP:
|
||||
aodv_v6_draft_01_rrep(ap, dat, length);
|
||||
break;
|
||||
|
||||
case AODV_V6_DRAFT_01_RERR:
|
||||
aodv_v6_draft_01_rerr(ap, length);
|
||||
break;
|
||||
|
||||
case AODV_V6_DRAFT_01_RREP_ACK:
|
||||
printf(" rrep-ack %u", length);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" %u %u", ap->rreq.rreq_type, length);
|
||||
}
|
||||
}
|
119
contrib/tcpdump/print-ap1394.c
Normal file
119
contrib/tcpdump/print-ap1394.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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-ap1394.c,v 1.1.2.1 2004/03/17 22:15:53 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"
|
||||
|
||||
/*
|
||||
* Structure of a header for Apple's IP-over-IEEE 1384 BPF header.
|
||||
*/
|
||||
#define FIREWIRE_EUI64_LEN 8
|
||||
struct firewire_header {
|
||||
u_char firewire_dhost[FIREWIRE_EUI64_LEN];
|
||||
u_char firewire_shost[FIREWIRE_EUI64_LEN];
|
||||
u_short firewire_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* Length of that header; note that some compilers may pad
|
||||
* "struct firewire_header" to a multiple of 4 bytes, for example, so
|
||||
* "sizeof (struct firewire_header)" may not give the right answer.
|
||||
*/
|
||||
#define FIREWIRE_HDRLEN 18
|
||||
|
||||
static inline void
|
||||
ap1394_hdr_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
register const struct firewire_header *fp;
|
||||
fp = (const struct firewire_header *)bp;
|
||||
|
||||
(void)printf("%s > %s",
|
||||
linkaddr_string(fp->firewire_dhost, FIREWIRE_EUI64_LEN),
|
||||
linkaddr_string(fp->firewire_shost, FIREWIRE_EUI64_LEN));
|
||||
|
||||
if (!qflag) {
|
||||
(void)printf(", ethertype %s (0x%04x)",
|
||||
tok2str(ethertype_values,"Unknown", ntohs(fp->firewire_type)),
|
||||
ntohs(fp->firewire_type));
|
||||
} else {
|
||||
(void)printf(", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ntohs(fp->firewire_type)));
|
||||
}
|
||||
|
||||
(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->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int length = h->len;
|
||||
u_int caplen = h->caplen;
|
||||
struct firewire_header *fp;
|
||||
u_short ether_type;
|
||||
u_short extracted_ether_type;
|
||||
|
||||
if (caplen < FIREWIRE_HDRLEN) {
|
||||
printf("[|ap1394]");
|
||||
return FIREWIRE_HDRLEN;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
ap1394_hdr_print(p, length);
|
||||
|
||||
length -= FIREWIRE_HDRLEN;
|
||||
caplen -= FIREWIRE_HDRLEN;
|
||||
fp = (struct firewire_header *)p;
|
||||
p += FIREWIRE_HDRLEN;
|
||||
|
||||
ether_type = ntohs(fp->firewire_type);
|
||||
|
||||
extracted_ether_type = 0;
|
||||
if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ether_type) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ap1394_hdr_print((u_char *)fp, length + FIREWIRE_HDRLEN);
|
||||
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
|
||||
return FIREWIRE_HDRLEN;
|
||||
}
|
@ -17,23 +17,19 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* From: NetBSD: print-arcnet.c,v 1.2 2000/04/24 13:02:28 itojun Exp
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.6.4.1 2002/06/01 23:51:11 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.15.2.2 2003/11/16 08:51:09 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
@ -41,7 +37,7 @@ static const char rcsid[] =
|
||||
#include "interface.h"
|
||||
#include "arcnet.h"
|
||||
|
||||
int arcnet_encap_print(u_char arctype, const u_char *p,
|
||||
static int arcnet_encap_print(u_char arctype, const u_char *p,
|
||||
u_int length, u_int caplen);
|
||||
|
||||
struct tok arctypemap[] = {
|
||||
@ -105,13 +101,13 @@ arcnet_print(const u_char *bp, u_int length, int phds, int flag, u_int seqid)
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the ether header of the packet, 'tvp' is the timestamp,
|
||||
* 'length' is the length of the packet off the wire, and 'caplen'
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the ARCNET header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
u_int
|
||||
arcnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
@ -121,12 +117,9 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
u_int seqid = 0;
|
||||
u_char arc_type;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < ARC_HDRLEN) {
|
||||
printf("[|arcnet]");
|
||||
goto out;
|
||||
return (caplen);
|
||||
}
|
||||
|
||||
ap = (const struct arc_header *)p;
|
||||
@ -148,21 +141,21 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (caplen < ARC_HDRNEWLEN) {
|
||||
arcnet_print(p, length, 0, 0, 0);
|
||||
printf("[|phds]");
|
||||
goto out;
|
||||
return (caplen);
|
||||
}
|
||||
|
||||
if (ap->arc_flag == 0xff) {
|
||||
if (caplen < ARC_HDRNEWLEN_EXC) {
|
||||
arcnet_print(p, length, 0, 0, 0);
|
||||
printf("[|phds extended]");
|
||||
goto out;
|
||||
return (caplen);
|
||||
}
|
||||
flag = ap->arc_flag2;
|
||||
seqid = ap->arc_seqid2;
|
||||
seqid = ntohs(ap->arc_seqid2);
|
||||
archdrlen = ARC_HDRNEWLEN_EXC;
|
||||
} else {
|
||||
flag = ap->arc_flag;
|
||||
seqid = ap->arc_seqid;
|
||||
seqid = ntohs(ap->arc_seqid);
|
||||
archdrlen = ARC_HDRNEWLEN;
|
||||
}
|
||||
}
|
||||
@ -172,34 +165,82 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
arcnet_print(p, length, phds, flag, seqid);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
* Go past the ARCNET header.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
length -= archdrlen;
|
||||
caplen -= archdrlen;
|
||||
p += archdrlen;
|
||||
|
||||
if (phds && flag && (flag & 1) == 0)
|
||||
goto out2;
|
||||
|
||||
if (!arcnet_encap_print(arc_type, p, length, caplen)) {
|
||||
default_print(p, caplen);
|
||||
goto out;
|
||||
if (phds && flag && (flag & 1) == 0) {
|
||||
/*
|
||||
* This is a middle fragment.
|
||||
*/
|
||||
return (archdrlen);
|
||||
}
|
||||
|
||||
out2:
|
||||
if (xflag)
|
||||
if (!arcnet_encap_print(arc_type, p, length, caplen))
|
||||
default_print(p, caplen);
|
||||
|
||||
out:
|
||||
putchar('\n');
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
return (archdrlen);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the ARCNET header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured. It is quite similar
|
||||
* to the non-Linux style printer except that Linux doesn't ever
|
||||
* supply packets that look like exception frames, it always supplies
|
||||
* reassembled packets rather than raw frames, and headers have an
|
||||
* extra "offset" field between the src/dest and packet type.
|
||||
*/
|
||||
u_int
|
||||
arcnet_linux_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
const struct arc_linux_header *ap;
|
||||
|
||||
int archdrlen = 0;
|
||||
u_char arc_type;
|
||||
|
||||
if (caplen < ARC_LINUX_HDRLEN) {
|
||||
printf("[|arcnet]");
|
||||
return (caplen);
|
||||
}
|
||||
|
||||
ap = (const struct arc_linux_header *)p;
|
||||
arc_type = ap->arc_type;
|
||||
|
||||
switch (arc_type) {
|
||||
default:
|
||||
archdrlen = ARC_LINUX_HDRNEWLEN;
|
||||
if (caplen < ARC_LINUX_HDRNEWLEN) {
|
||||
printf("[|arcnet]");
|
||||
return (caplen);
|
||||
}
|
||||
break;
|
||||
case ARCTYPE_IP_OLD:
|
||||
case ARCTYPE_ARP_OLD:
|
||||
case ARCTYPE_DIAGNOSE:
|
||||
archdrlen = ARC_LINUX_HDRLEN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
arcnet_print(p, length, 0, 0, 0);
|
||||
|
||||
/*
|
||||
* Go past the ARCNET header.
|
||||
*/
|
||||
length -= archdrlen;
|
||||
caplen -= archdrlen;
|
||||
p += archdrlen;
|
||||
|
||||
if (!arcnet_encap_print(arc_type, p, length, caplen))
|
||||
default_print(p, caplen);
|
||||
|
||||
return (archdrlen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -210,7 +251,7 @@ arcnet_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
arcnet_encap_print(u_char arctype, const u_char *p,
|
||||
u_int length, u_int caplen)
|
||||
{
|
||||
@ -239,6 +280,10 @@ arcnet_encap_print(u_char arctype, const u_char *p,
|
||||
atalk_print(p, length);
|
||||
return (1);
|
||||
|
||||
case ARCTYPE_IPX:
|
||||
ipx_print(p, length);
|
||||
return (1);
|
||||
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
|
@ -41,78 +41,101 @@
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.6 2000/01/29 16:47:46 itojun Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.10.2.3 2003/12/29 22:42:20 hannes Exp $";
|
||||
#endif
|
||||
#include <tcpdump-stdinc.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
#define ASCII_LINELENGTH 300
|
||||
#define HEXDUMP_BYTES_PER_LINE 16
|
||||
#define HEXDUMP_SHORTS_PER_LINE (HEXDUMP_BYTES_PER_LINE / 2)
|
||||
#define HEXDUMP_HEXSTUFF_PER_SHORT 5 /* 4 hex digits and a space */
|
||||
#define HEXDUMP_HEXSTUFF_PER_LINE \
|
||||
(HEXDUMP_HEXSTUFF_PER_SHORT * HEXDUMP_SHORTS_PER_LINE)
|
||||
|
||||
|
||||
void
|
||||
ascii_print_with_offset(register const u_char *cp, register u_int length,
|
||||
ascii_print_with_offset(register const u_char *ident, register const u_char *cp, register u_int length,
|
||||
register u_int oset)
|
||||
{
|
||||
register u_int i;
|
||||
register int s1, s2;
|
||||
register int nshorts;
|
||||
char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp;
|
||||
char asciistuff[HEXDUMP_BYTES_PER_LINE+1], *asp;
|
||||
char asciistuff[ASCII_LINELENGTH+1], *asp;
|
||||
u_int maxlength = (Aflag ? ASCII_LINELENGTH : HEXDUMP_SHORTS_PER_LINE);
|
||||
|
||||
nshorts = length / sizeof(u_short);
|
||||
i = 0;
|
||||
hsp = hexstuff; asp = asciistuff;
|
||||
if (Aflag) *(asp++) = '\n';
|
||||
while (--nshorts >= 0) {
|
||||
s1 = *cp++;
|
||||
s2 = *cp++;
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x%02x", s1, s2);
|
||||
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
*(asp++) = (isgraph(s2) ? s2 : '.');
|
||||
if (++i >= HEXDUMP_SHORTS_PER_LINE) {
|
||||
*hsp = *asp = '\0';
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
i = 0; hsp = hexstuff; asp = asciistuff;
|
||||
oset += HEXDUMP_BYTES_PER_LINE;
|
||||
if (Aflag) {
|
||||
i += 2;
|
||||
*(asp++) = (isgraph(s1) ? s1 : (s1 != '\t' && s1 != ' ' && s1 != '\n' && s1 != '\r' ? '.' : s1) );
|
||||
*(asp++) = (isgraph(s2) ? s2 : (s2 != '\t' && s2 != ' ' && s2 != '\n' && s2 != '\r' ? '.' : s2) );
|
||||
if (s1 == '\n' || s2 == '\n') i = maxlength;
|
||||
|
||||
} else {
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x%02x", s1, s2);
|
||||
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
*(asp++) = (isgraph(s2) ? s2 : '.');
|
||||
i++;
|
||||
}
|
||||
if (i >= maxlength) {
|
||||
*hsp = *asp = '\0';
|
||||
if (Aflag) {
|
||||
(void)printf("%s", asciistuff);
|
||||
} else {
|
||||
(void)printf("%s0x%04x: %-*s %s",
|
||||
ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
}
|
||||
i = 0; hsp = hexstuff; asp = asciistuff;
|
||||
oset += HEXDUMP_BYTES_PER_LINE;
|
||||
}
|
||||
}
|
||||
if (length & 1) {
|
||||
s1 = *cp++;
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x", s1);
|
||||
hsp += 3;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
if (Aflag) {
|
||||
*(asp++) = (isgraph(s1) ? s1 : (s1 != '\t' && s1 != ' ' && s1 != '\n' && s1 != '\r' ? '.' : s1) );
|
||||
} else {
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x", s1);
|
||||
hsp += 3;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
}
|
||||
++i;
|
||||
}
|
||||
if (i > 0) {
|
||||
*hsp = *asp = '\0';
|
||||
(void)printf("\n0x%04x\t%-*s\t%s",
|
||||
oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
if (Aflag) {
|
||||
(void)printf("%s%s", ident, asciistuff);
|
||||
} else {
|
||||
(void)printf("%s0x%04x: %-*s %s",
|
||||
ident, oset, HEXDUMP_HEXSTUFF_PER_LINE,
|
||||
hexstuff, asciistuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ascii_print(register const u_char *cp, register u_int length)
|
||||
ascii_print(register const u_char *ident, register const u_char *cp, register u_int length)
|
||||
{
|
||||
ascii_print_with_offset(cp, length, 0);
|
||||
ascii_print_with_offset(ident, cp, length, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* telnet_print() wants this. It is essentially default_print_unaligned()
|
||||
*/
|
||||
void
|
||||
hex_print_with_offset(register const u_char *cp, register u_int length,
|
||||
hex_print_with_offset(register const u_char *ident, register const u_char *cp, register u_int length,
|
||||
register u_int oset)
|
||||
{
|
||||
register u_int i, s;
|
||||
@ -122,7 +145,7 @@ hex_print_with_offset(register const u_char *cp, register u_int length,
|
||||
i = 0;
|
||||
while (--nshorts >= 0) {
|
||||
if ((i++ % 8) == 0) {
|
||||
(void)printf("\n0x%04x\t", oset);
|
||||
(void)printf("%s0x%04x: ", ident, oset);
|
||||
oset += HEXDUMP_BYTES_PER_LINE;
|
||||
}
|
||||
s = *cp++;
|
||||
@ -130,7 +153,7 @@ hex_print_with_offset(register const u_char *cp, register u_int length,
|
||||
}
|
||||
if (length & 1) {
|
||||
if ((i % 8) == 0)
|
||||
(void)printf("\n0x%04x\t", oset);
|
||||
(void)printf("%s0x%04x: ", ident, oset);
|
||||
(void)printf(" %02x", *cp);
|
||||
}
|
||||
}
|
||||
@ -139,9 +162,9 @@ hex_print_with_offset(register const u_char *cp, register u_int length,
|
||||
* just for completeness
|
||||
*/
|
||||
void
|
||||
hex_print(register const u_char *cp, register u_int length)
|
||||
hex_print(register const u_char *ident, register const u_char *cp, register u_int length)
|
||||
{
|
||||
hex_print_with_offset(cp, length, 0);
|
||||
hex_print_with_offset(ident, cp, length, 0);
|
||||
}
|
||||
|
||||
#ifdef MAIN
|
||||
@ -158,3 +181,5 @@ main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
#endif /* MAIN */
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright (C) 2000, Richard Sharpe
|
||||
*
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style licence that accompanies tcpdump or under the GNU GPL
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style licence that accompanies tcpdump or under the GNU GPL
|
||||
* version 2 or later.
|
||||
*
|
||||
* print-beep.c
|
||||
@ -10,16 +10,15 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.1.2.1 2002/07/11 07:47:01 guy Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.4.2.2 2003/11/16 08:51:12 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
@ -27,14 +26,13 @@ static const char rcsid[] =
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
|
||||
/* Check for a string but not go beyond length
|
||||
* Return TRUE on match, FALSE otherwise
|
||||
*
|
||||
*
|
||||
* Looks at the first few chars up to tl1 ...
|
||||
*/
|
||||
|
||||
@ -68,6 +66,6 @@ beep_print(const u_char *bp, u_int length)
|
||||
printf(" BEEP SEQ");
|
||||
else if (l_strnstart("END", 4, (const char *)bp, length))
|
||||
printf(" BEEP END");
|
||||
else
|
||||
else
|
||||
printf(" BEEP (payload or undecoded)");
|
||||
}
|
||||
|
160
contrib/tcpdump/print-bfd.c
Normal file
160
contrib/tcpdump/print-bfd.c
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* 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-bfd.c,v 1.3.2.2 2003/11/16 08:51:12 guy 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"
|
||||
|
||||
#include "udp.h"
|
||||
|
||||
/*
|
||||
* Control packet, 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
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* |Vers | Diag |H|D|P|F| Rsvd | 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;
|
||||
u_int8_t detect_time_multiplier;
|
||||
u_int8_t length;
|
||||
u_int8_t my_discriminator[4];
|
||||
u_int8_t your_discriminator[4];
|
||||
u_int8_t desired_min_tx_interval[4];
|
||||
u_int8_t required_min_rx_interval[4];
|
||||
u_int8_t required_min_echo_interval[4];
|
||||
};
|
||||
|
||||
#define BFD_EXTRACT_VERSION(x) (((x)&0xe0)>>5)
|
||||
#define BFD_EXTRACT_DIAG(x) ((x)&0x1f)
|
||||
|
||||
static const struct tok bfd_port_values[] = {
|
||||
{ BFD_CONTROL_PORT, "Control" },
|
||||
{ BFD_ECHO_PORT, "Echo" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
static const struct tok bfd_diag_values[] = {
|
||||
{ 0, "No Diagnostic" },
|
||||
{ 1, "Control Detection Time Expired" },
|
||||
{ 2, "Echo Function Failed" },
|
||||
{ 3, "Neighbor Signaled Session Down" },
|
||||
{ 4, "Forwarding Plane Reset" },
|
||||
{ 5, "Path Down" },
|
||||
{ 6, "Concatenated Path Down" },
|
||||
{ 7, "Administratively Down" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok bfd_flag_values[] = {
|
||||
{ 0x80, "I Hear You" },
|
||||
{ 0x40, "Demand" },
|
||||
{ 0x20, "Poll" },
|
||||
{ 0x10, "Final" },
|
||||
{ 0x08, "Reserved" },
|
||||
{ 0x04, "Reserved" },
|
||||
{ 0x02, "Reserved" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 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;
|
||||
|
||||
bfd_header = (const struct bfd_header_t *)pptr;
|
||||
TCHECK(*bfd_header);
|
||||
|
||||
switch (port) {
|
||||
|
||||
case BFD_CONTROL_PORT:
|
||||
if (vflag < 1 )
|
||||
{
|
||||
printf("BFDv%u, %s, Flags: [%s], length: %u",
|
||||
BFD_EXTRACT_VERSION(bfd_header->version_diag),
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
bittok2str(bfd_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),
|
||||
len,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
bittok2str(bfd_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));
|
||||
|
||||
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);
|
||||
break;
|
||||
|
||||
case BFD_ECHO_PORT: /* not yet supported - fall through */
|
||||
|
||||
default:
|
||||
printf("BFD, %s, length: %u",
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
len);
|
||||
if (vflag >= 1) {
|
||||
if(!print_unknown_data(pptr,"\n\t",len))
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|BFD]");
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -25,21 +25,16 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.11 2001/09/17 21:57:56 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.19.2.5 2004/03/24 06:00:51 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -47,97 +42,181 @@ static const char rcsid[] =
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
#define CDP_HEADER_LEN 4
|
||||
|
||||
static struct tok cdp_tlv_values[] = {
|
||||
{ 0x01, "Device-ID"},
|
||||
{ 0x02, "Address"},
|
||||
{ 0x03, "Port-ID"},
|
||||
{ 0x04, "Capability"},
|
||||
{ 0x05, "Version String"},
|
||||
{ 0x06, "Platform"},
|
||||
{ 0x07, "Prefixes"},
|
||||
{ 0x08, "Protocol-Hello option"},
|
||||
{ 0x09, "VTP Management Domain"},
|
||||
{ 0x0a, "Native VLAN ID"},
|
||||
{ 0x0b, "Duplex"},
|
||||
{ 0x0e, "ATA-186 VoIP VLAN request"},
|
||||
{ 0x0f, "ATA-186 VoIP VLAN assignment"},
|
||||
{ 0x10, "power consumption"},
|
||||
{ 0x11, "MTU"},
|
||||
{ 0x12, "AVVID trust bitmap"},
|
||||
{ 0x13, "AVVID untrusted ports CoS"},
|
||||
{ 0x14, "System Name"},
|
||||
{ 0x15, "System Object ID (not decoded)"},
|
||||
{ 0x16, "Management Addresses"},
|
||||
{ 0x17, "Physical Location"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
static struct tok cdp_capability_values[] = {
|
||||
{ 0x01, "Router" },
|
||||
{ 0x02, "Transparent Bridge" },
|
||||
{ 0x04, "Source Route Bridge" },
|
||||
{ 0x08, "L2 Switch" },
|
||||
{ 0x10, "L3 capable" },
|
||||
{ 0x20, "IGMP snooping" },
|
||||
{ 0x40, "L1 capable" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static int cdp_print_addr(const u_char *, int);
|
||||
static int cdp_print_prefixes(const u_char *, int);
|
||||
static unsigned long cdp_get_number(const u_char *, int);
|
||||
|
||||
void
|
||||
cdp_print(const u_char *p, u_int length, u_int caplen,
|
||||
const u_char *esrc, const u_char *edst)
|
||||
cdp_print(const u_char *pptr, u_int length, u_int caplen)
|
||||
{
|
||||
u_int i;
|
||||
int type, len;
|
||||
int type, len, i, j;
|
||||
const u_char *tptr;
|
||||
|
||||
/* Cisco Discovery Protocol */
|
||||
|
||||
if (caplen < 4) {
|
||||
if (caplen < CDP_HEADER_LEN) {
|
||||
(void)printf("[|cdp]");
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0; /* CDP data starts at offset 0 */
|
||||
printf("CDP v%u, ttl=%us", p[i], p[i + 1]);
|
||||
i += 4; /* skip version, TTL and chksum */
|
||||
tptr = pptr; /* temporary pointer */
|
||||
|
||||
while (i < length) {
|
||||
if (i + 4 > caplen)
|
||||
goto trunc;
|
||||
type = (p[i] << 8) + p[i + 1];
|
||||
len = (p[i + 2] << 8) + p[i + 3];
|
||||
if (!TTEST2(*tptr, CDP_HEADER_LEN))
|
||||
goto trunc;
|
||||
printf("CDPv%u, ttl: %us", *tptr, *(tptr+1));
|
||||
if (vflag)
|
||||
printf(", checksum: %u (unverified), length %u", EXTRACT_16BITS(tptr), length);
|
||||
tptr += CDP_HEADER_LEN;
|
||||
|
||||
if (vflag > 1)
|
||||
printf("\n\t");
|
||||
while (tptr < (pptr+length)) {
|
||||
|
||||
if (vflag)
|
||||
printf(" %02x/%02x", type, len);
|
||||
if (!TTEST2(*tptr, 4)) /* read out Type and Length */
|
||||
goto trunc;
|
||||
type = EXTRACT_16BITS(tptr);
|
||||
len = EXTRACT_16BITS(tptr+2); /* object length includes the 4 bytes header length */
|
||||
tptr += 4;
|
||||
len -= 4;
|
||||
|
||||
if (i + len > caplen)
|
||||
if (!TTEST2(*tptr, len))
|
||||
goto trunc;
|
||||
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
printf(" Goodbye");
|
||||
break;
|
||||
case 0x01:
|
||||
printf(" DevID '%.*s'", len - 4, p + i + 4);
|
||||
break;
|
||||
case 0x02:
|
||||
printf(" Addr");
|
||||
if (cdp_print_addr(p + i + 4, len - 4) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x03:
|
||||
printf(" PortID '%.*s'", len - 4, p + i + 4);
|
||||
break;
|
||||
case 0x04:
|
||||
printf(" CAP 0x%02x", (unsigned) p[i + 7]);
|
||||
break;
|
||||
case 0x05:
|
||||
if (vflag > 1)
|
||||
printf(" Version:\n%.*s", len - 4, p + i + 4);
|
||||
else
|
||||
printf(" Version: (suppressed)");
|
||||
break;
|
||||
case 0x06:
|
||||
printf(" Platform: '%.*s'", len - 4, p + i + 4);
|
||||
break;
|
||||
case 0x07:
|
||||
if (cdp_print_prefixes(p + i + 4, len - 4) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x09: /* guess - not documented */
|
||||
printf(" VTP Management Domain: '%.*s'", len - 4,
|
||||
p + i + 4);
|
||||
break;
|
||||
case 0x0a: /* guess - not documented */
|
||||
printf(" Native VLAN ID: %d",
|
||||
(p[i + 4] << 8) + p[i + 4 + 1] - 1);
|
||||
break;
|
||||
case 0x0b: /* guess - not documented */
|
||||
printf(" Duplex: %s", p[i + 4] ? "full": "half");
|
||||
break;
|
||||
default:
|
||||
printf(" unknown field type %02x, len %d", type, len);
|
||||
break;
|
||||
}
|
||||
if (vflag || type == 1) { /* in non-verbose mode just print Device-ID */
|
||||
|
||||
if (vflag)
|
||||
printf("\n\t%s (0x%02x), length: %u byte%s: ",
|
||||
tok2str(cdp_tlv_values,"unknown field type", type),
|
||||
type,
|
||||
len,
|
||||
len>1 ? "s" : ""); /* plural */
|
||||
|
||||
switch (type) {
|
||||
|
||||
case 0x01: /* Device-ID */
|
||||
if (!vflag)
|
||||
printf(", Device-ID '%.*s'", len, tptr);
|
||||
else
|
||||
printf("'%.*s'", len, tptr);
|
||||
break;
|
||||
case 0x02: /* Address */
|
||||
if (cdp_print_addr(tptr, len) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x03: /* Port-ID */
|
||||
printf("'%.*s'", len, tptr);
|
||||
break;
|
||||
case 0x04: /* Capabilities */
|
||||
printf("(0x%08x): %s",
|
||||
EXTRACT_32BITS(tptr),
|
||||
bittok2str(cdp_capability_values, "none",EXTRACT_32BITS(tptr)));
|
||||
break;
|
||||
case 0x05: /* Version */
|
||||
printf("\n\t ");
|
||||
for (i=0;i<len;i++) {
|
||||
j = *(tptr+i);
|
||||
putchar(j);
|
||||
if (j == 0x0a) /* lets rework the version string to get a nice identation */
|
||||
printf("\t ");
|
||||
}
|
||||
break;
|
||||
case 0x06: /* Platform */
|
||||
printf("'%.*s'", len, tptr);
|
||||
break;
|
||||
case 0x07: /* Prefixes */
|
||||
if (cdp_print_prefixes(tptr, len) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x08: /* Protocol Hello Option - not documented */
|
||||
break;
|
||||
case 0x09: /* VTP Mgmt Domain - not documented */
|
||||
printf("'%.*s'", len,tptr);
|
||||
break;
|
||||
case 0x0a: /* Native VLAN ID - not documented */
|
||||
printf("%d",EXTRACT_16BITS(tptr));
|
||||
break;
|
||||
case 0x0b: /* Duplex - not documented */
|
||||
printf("%s", *(tptr) ? "full": "half");
|
||||
break;
|
||||
|
||||
/* http://www.cisco.com/univercd/cc/td/doc/product/voice/ata/atarn/186rn21m.htm
|
||||
* plus more details from other sources
|
||||
*/
|
||||
case 0x0e: /* ATA-186 VoIP VLAN request - incomplete doc. */
|
||||
printf("app %d, vlan %d",
|
||||
*(tptr), EXTRACT_16BITS(tptr+1));
|
||||
break;
|
||||
case 0x10: /* ATA-186 VoIP VLAN assignment - incomplete doc. */
|
||||
printf("%1.2fW",
|
||||
cdp_get_number(tptr, len)/1000.0 );
|
||||
break;
|
||||
case 0x11: /* MTU - not documented */
|
||||
printf("%u bytes", EXTRACT_32BITS(tptr));
|
||||
break;
|
||||
case 0x12: /* AVVID trust bitmap - not documented */
|
||||
printf("0x%02x", *(tptr) );
|
||||
break;
|
||||
case 0x13: /* AVVID untrusted port CoS - not documented */
|
||||
printf("0x%02x", *(tptr));
|
||||
break;
|
||||
case 0x14: /* System Name - not documented */
|
||||
printf("'%.*s'", len, tptr);
|
||||
break;
|
||||
case 0x16: /* System Object ID - not documented */
|
||||
if (cdp_print_addr(tptr, len) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x17: /* Physical Location - not documented */
|
||||
printf("0x%02x/%.*s", *(tptr), len - 1, tptr + 1 );
|
||||
break;
|
||||
default:
|
||||
print_unknown_data(tptr,"\n\t ",len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* avoid infinite loop */
|
||||
if (len == 0)
|
||||
break;
|
||||
i += len;
|
||||
tptr = tptr+len;
|
||||
}
|
||||
if (vflag < 1)
|
||||
printf(", length %u",caplen);
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|cdp]");
|
||||
}
|
||||
@ -164,18 +243,19 @@ cdp_print_addr(const u_char * p, int l)
|
||||
};
|
||||
#endif
|
||||
|
||||
TCHECK2(*p, 2);
|
||||
num = EXTRACT_32BITS(p);
|
||||
p += 4;
|
||||
|
||||
printf(" (%d): ", num);
|
||||
|
||||
while (p < endp && num >= 0) {
|
||||
TCHECK2(*p, 2);
|
||||
if (p + 2 > endp)
|
||||
goto trunc;
|
||||
pt = p[0]; /* type of "protocol" field */
|
||||
pl = p[1]; /* length of "protocol" field */
|
||||
p += 2;
|
||||
|
||||
TCHECK2(p[pl], 2);
|
||||
if (p + pl + 2 > endp)
|
||||
goto trunc;
|
||||
al = EXTRACT_16BITS(&p[pl]); /* address length */
|
||||
@ -188,9 +268,12 @@ cdp_print_addr(const u_char * p, int l)
|
||||
*/
|
||||
p += 3;
|
||||
|
||||
TCHECK2(*p, 4);
|
||||
if (p + 4 > endp)
|
||||
goto trunc;
|
||||
printf("IPv4 %u.%u.%u.%u", p[0], p[1], p[2], p[3]);
|
||||
printf("IPv4 (%u) %s",
|
||||
num,
|
||||
ipaddr_string(p));
|
||||
p += 4;
|
||||
}
|
||||
#ifdef INET6
|
||||
@ -202,11 +285,14 @@ cdp_print_addr(const u_char * p, int l)
|
||||
* protocol = LLC+SNAP header with the IPv6
|
||||
* Ethertype, address length = 16
|
||||
*/
|
||||
p += 10;
|
||||
p += 10;
|
||||
TCHECK2(*p, al);
|
||||
if (p + al > endp)
|
||||
goto trunc;
|
||||
|
||||
printf("IPv6 %s", ip6addr_string(p));
|
||||
printf("IPv6 (%u) %s",
|
||||
num,
|
||||
ip6addr_string(p));
|
||||
p += al;
|
||||
}
|
||||
#endif
|
||||
@ -214,16 +300,19 @@ cdp_print_addr(const u_char * p, int l)
|
||||
/*
|
||||
* Generic case: just print raw data
|
||||
*/
|
||||
TCHECK2(*p, pl);
|
||||
if (p + pl > endp)
|
||||
goto trunc;
|
||||
printf("pt=0x%02x, pl=%d, pb=", *(p - 2), pl);
|
||||
while (pl-- > 0)
|
||||
printf(" %02x", *p++);
|
||||
TCHECK2(*p, 2);
|
||||
if (p + 2 > endp)
|
||||
goto trunc;
|
||||
al = (*p << 8) + *(p + 1);
|
||||
printf(", al=%d, a=", al);
|
||||
p += 2;
|
||||
TCHECK2(*p, al);
|
||||
if (p + al > endp)
|
||||
goto trunc;
|
||||
while (al-- > 0)
|
||||
@ -260,3 +349,17 @@ cdp_print_prefixes(const u_char * p, int l)
|
||||
trunc:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* read in a <n>-byte number, MSB first
|
||||
* (of course this can handle max sizeof(long))
|
||||
*/
|
||||
static unsigned long cdp_get_number(const u_char * p, int l)
|
||||
{
|
||||
unsigned long res=0;
|
||||
while( l>0 )
|
||||
{
|
||||
res = (res<<8) + *p;
|
||||
p++; l--;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* maybe it should be merged into print-ppp.c */
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -21,21 +20,16 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.13 2001/09/17 21:57:57 fenner Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.28.2.3 2004/03/24 00:46:03 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -49,41 +43,17 @@ static const char rcsid[] =
|
||||
static void chdlc_slarp_print(const u_char *, u_int);
|
||||
|
||||
/* Standard CHDLC printer */
|
||||
void
|
||||
chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
register const u_char *p)
|
||||
u_int
|
||||
chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the link level addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
|
||||
chdlc_print(p, length, caplen);
|
||||
|
||||
putchar('\n');
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
}
|
||||
|
||||
void
|
||||
chdlc_print(register const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
const struct ip *ip;
|
||||
u_int proto;
|
||||
|
||||
if (caplen < CHDLC_HDRLEN) {
|
||||
printf("[|chdlc]");
|
||||
return;
|
||||
return (caplen);
|
||||
}
|
||||
|
||||
proto = EXTRACT_16BITS(&p[2]);
|
||||
@ -121,9 +91,25 @@ chdlc_print(register const u_char *p, u_int length, u_int caplen)
|
||||
chdlc_cdp_print((const u_char *)ip, length);
|
||||
break;
|
||||
#endif
|
||||
case ETHERTYPE_MPLS:
|
||||
case ETHERTYPE_MPLS_MULTI:
|
||||
mpls_print((const u_char *)(ip), length);
|
||||
break;
|
||||
case ETHERTYPE_ISO:
|
||||
/* is the fudge byte set ? lets verify by spotting ISO headers */
|
||||
if (*(p+CHDLC_HDRLEN+1) == 0x81 ||
|
||||
*(p+CHDLC_HDRLEN+1) == 0x82 ||
|
||||
*(p+CHDLC_HDRLEN+1) == 0x83)
|
||||
isoclns_print(p+CHDLC_HDRLEN+1, length-1, length-1);
|
||||
else
|
||||
isoclns_print(p+CHDLC_HDRLEN, length, length);
|
||||
break;
|
||||
default:
|
||||
printf("unknown CHDLC protocol (0x%04x)", proto);
|
||||
break;
|
||||
}
|
||||
if (xflag)
|
||||
default_print((const u_char *)ip, caplen - CHDLC_HDRLEN);
|
||||
|
||||
return (CHDLC_HDRLEN);
|
||||
}
|
||||
|
||||
struct cisco_slarp {
|
||||
@ -154,34 +140,45 @@ chdlc_slarp_print(const u_char *cp, u_int length)
|
||||
{
|
||||
const struct cisco_slarp *slarp;
|
||||
|
||||
if (length < SLARP_LEN) {
|
||||
printf("[|slarp]");
|
||||
return;
|
||||
}
|
||||
if (length < SLARP_LEN)
|
||||
goto trunc;
|
||||
|
||||
slarp = (const struct cisco_slarp *)cp;
|
||||
switch (ntohl(slarp->code)) {
|
||||
TCHECK(*slarp);
|
||||
printf("SLARP (length: %u), ",length);
|
||||
switch (EXTRACT_32BITS(&slarp->code)) {
|
||||
case SLARP_REQUEST:
|
||||
printf("slarp-request");
|
||||
printf("request");
|
||||
/* ok we do not know it - but lets at least dump it */
|
||||
print_unknown_data(cp+4,"\n\t",length-4);
|
||||
break;
|
||||
case SLARP_REPLY:
|
||||
printf("slarp-reply %s/%s",
|
||||
printf("reply %s/%s",
|
||||
ipaddr_string(&slarp->un.addr.addr),
|
||||
ipaddr_string(&slarp->un.addr.mask));
|
||||
break;
|
||||
case SLARP_KEEPALIVE:
|
||||
printf("slarp-keepalive my=0x%x your=0x%x ",
|
||||
(u_int32_t)ntohl(slarp->un.keep.myseq),
|
||||
(u_int32_t)ntohl(slarp->un.keep.yourseq));
|
||||
printf("reliability=0x%04x t1=%d.%d",
|
||||
ntohs(slarp->un.keep.rel), ntohs(slarp->un.keep.t1),
|
||||
ntohs(slarp->un.keep.t2));
|
||||
printf("keepalive: mineseen=0x%08x, yourseen=0x%08x",
|
||||
EXTRACT_32BITS(&slarp->un.keep.myseq),
|
||||
EXTRACT_32BITS(&slarp->un.keep.yourseq));
|
||||
printf(", reliability=0x%04x, t1=%d.%d",
|
||||
EXTRACT_16BITS(&slarp->un.keep.rel),
|
||||
EXTRACT_16BITS(&slarp->un.keep.t1),
|
||||
EXTRACT_16BITS(&slarp->un.keep.t2));
|
||||
break;
|
||||
default:
|
||||
printf("slarp-0x%x unknown", (u_int32_t)ntohl(slarp->code));
|
||||
printf("0x%02x unknown", EXTRACT_32BITS(&slarp->code));
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(cp+4,"\n\t",length-4);
|
||||
break;
|
||||
}
|
||||
|
||||
if (SLARP_LEN < length && vflag)
|
||||
printf("(trailing junk: %d bytes)", length - SLARP_LEN);
|
||||
printf(", (trailing junk: %d bytes)", length - SLARP_LEN);
|
||||
if (vflag > 1)
|
||||
print_unknown_data(cp+4,"\n\t",length-4);
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|slarp]");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Marko Kiiskila carnil@cs.tut.fi
|
||||
*
|
||||
* Marko Kiiskila carnil@cs.tut.fi
|
||||
*
|
||||
* Tampere University of Technology - Telecommunications Laboratory
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this
|
||||
@ -12,17 +12,17 @@
|
||||
* documentation, and that the use of this software is
|
||||
* acknowledged in any publications resulting from using
|
||||
* the software.
|
||||
*
|
||||
*
|
||||
* TUT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.16 2001/09/23 21:52:38 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.21.2.2 2003/11/16 08:51:15 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,13 +31,7 @@ static const char rcsid[] =
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
@ -47,7 +41,7 @@ static const char rcsid[] =
|
||||
#include "ethertype.h"
|
||||
#include "ether.h"
|
||||
|
||||
#define RFC1483LLC_LEN 8
|
||||
#define RFC1483LLC_LEN 8
|
||||
|
||||
static unsigned char rfcllc[] = {
|
||||
0xaa, /* DSAP: non-ISO */
|
||||
@ -58,7 +52,7 @@ static unsigned char rfcllc[] = {
|
||||
0x00 };
|
||||
|
||||
static inline void
|
||||
cip_print(register const u_char *bp, int length)
|
||||
cip_print(int length)
|
||||
{
|
||||
/*
|
||||
* There is no MAC-layer header, so just print the length.
|
||||
@ -67,36 +61,25 @@ cip_print(register const u_char *bp, int length)
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the raw header of the packet, 'tvp' is the timestamp,
|
||||
* 'length' is the length of the packet off the wire, and 'caplen'
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the LLC/SNAP or raw header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
u_int
|
||||
cip_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
++infodelay;
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
|
||||
printf("[|cip]");
|
||||
goto out;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
cip_print(p, length);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
packetp = p;
|
||||
snapend = p + caplen;
|
||||
cip_print(length);
|
||||
|
||||
if (memcmp(rfcllc, p, sizeof(rfcllc)) == 0) {
|
||||
/*
|
||||
@ -106,7 +89,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
cip_print(p, length);
|
||||
cip_print(length);
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
@ -121,11 +104,5 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
ip_print(p, length);
|
||||
}
|
||||
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
out:
|
||||
putchar('\n');
|
||||
--infodelay;
|
||||
if (infoprint)
|
||||
info(0);
|
||||
return (0);
|
||||
}
|
||||
|
@ -33,29 +33,25 @@
|
||||
/* Cisco NetFlow protocol */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.8 2001/09/17 21:57:58 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.14.2.2 2003/11/16 08:51:15 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "tcp.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
struct nfhdr {
|
||||
u_int32_t ver_cnt; /* version [15], and # of records */
|
||||
@ -83,7 +79,7 @@ struct nfrec {
|
||||
};
|
||||
|
||||
void
|
||||
cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
cnfp_print(const u_char *cp, const u_char *bp)
|
||||
{
|
||||
register const struct nfhdr *nh;
|
||||
register const struct nfrec *nr;
|
||||
@ -98,18 +94,18 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
if ((const u_char *)(nh + 1) > snapend)
|
||||
return;
|
||||
|
||||
nrecs = ntohl(nh->ver_cnt) & 0xffff;
|
||||
ver = (ntohl(nh->ver_cnt) & 0xffff0000) >> 16;
|
||||
t = ntohl(nh->utc_sec);
|
||||
nrecs = EXTRACT_32BITS(&nh->ver_cnt) & 0xffff;
|
||||
ver = (EXTRACT_32BITS(&nh->ver_cnt) & 0xffff0000) >> 16;
|
||||
t = EXTRACT_32BITS(&nh->utc_sec);
|
||||
/* (p = ctime(&t))[24] = '\0'; */
|
||||
|
||||
printf("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
|
||||
(unsigned)ntohl(nh->msys_uptime)/1000,
|
||||
(unsigned)ntohl(nh->msys_uptime)%1000,
|
||||
(unsigned)ntohl(nh->utc_sec), (unsigned)ntohl(nh->utc_nsec));
|
||||
EXTRACT_32BITS(&nh->msys_uptime)/1000,
|
||||
EXTRACT_32BITS(&nh->msys_uptime)%1000,
|
||||
EXTRACT_32BITS(&nh->utc_sec), EXTRACT_32BITS(&nh->utc_nsec));
|
||||
|
||||
if (ver == 5 || ver == 6) {
|
||||
printf("#%u, ", (unsigned)htonl(nh->sequence));
|
||||
printf("#%u, ", EXTRACT_32BITS(&nh->sequence));
|
||||
nr = (const struct nfrec *)&nh[1];
|
||||
snaplen -= 24;
|
||||
} else {
|
||||
@ -124,36 +120,36 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
char asbuf[20];
|
||||
|
||||
printf("\n started %u.%03u, last %u.%03u",
|
||||
(unsigned)ntohl(nr->start_time)/1000,
|
||||
(unsigned)ntohl(nr->start_time)%1000,
|
||||
(unsigned)ntohl(nr->last_time)/1000,
|
||||
(unsigned)ntohl(nr->last_time)%1000);
|
||||
EXTRACT_32BITS(&nr->start_time)/1000,
|
||||
EXTRACT_32BITS(&nr->start_time)%1000,
|
||||
EXTRACT_32BITS(&nr->last_time)/1000,
|
||||
EXTRACT_32BITS(&nr->last_time)%1000);
|
||||
|
||||
asbuf[0] = buf[0] = '\0';
|
||||
if (ver == 5 || ver == 6) {
|
||||
snprintf(buf, sizeof(buf), "/%u",
|
||||
(unsigned)(ntohl(nr->masks) >> 24) & 0xff);
|
||||
(EXTRACT_32BITS(&nr->masks) >> 24) & 0xff);
|
||||
snprintf(asbuf, sizeof(asbuf), ":%u",
|
||||
(unsigned)(ntohl(nr->asses) >> 16) & 0xffff);
|
||||
(EXTRACT_32BITS(&nr->asses) >> 16) & 0xffff);
|
||||
}
|
||||
printf("\n %s%s%s:%u ", inet_ntoa(nr->src_ina), buf, asbuf,
|
||||
(unsigned)ntohl(nr->ports) >> 16);
|
||||
printf("\n %s%s%s:%u ", intoa(nr->src_ina.s_addr), buf, asbuf,
|
||||
EXTRACT_32BITS(&nr->ports) >> 16);
|
||||
|
||||
if (ver == 5 || ver ==6) {
|
||||
snprintf(buf, sizeof(buf), "/%d",
|
||||
(unsigned)(ntohl(nr->masks) >> 16) & 0xff);
|
||||
(EXTRACT_32BITS(&nr->masks) >> 16) & 0xff);
|
||||
snprintf(asbuf, sizeof(asbuf), ":%u",
|
||||
(unsigned)ntohl(nr->asses) & 0xffff);
|
||||
EXTRACT_32BITS(&nr->asses) & 0xffff);
|
||||
}
|
||||
printf("> %s%s%s:%u ", inet_ntoa(nr->dst_ina), buf, asbuf,
|
||||
(unsigned)ntohl(nr->ports) & 0xffff);
|
||||
printf("> %s%s%s:%u ", intoa(nr->dst_ina.s_addr), buf, asbuf,
|
||||
EXTRACT_32BITS(&nr->ports) & 0xffff);
|
||||
|
||||
printf(">> %s\n ", inet_ntoa(nr->nhop_ina));
|
||||
printf(">> %s\n ", intoa(nr->nhop_ina.s_addr));
|
||||
|
||||
pent = getprotobynumber((ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
pent = getprotobynumber((EXTRACT_32BITS(&nr->proto_tos) >> 8) & 0xff);
|
||||
if (!pent || nflag)
|
||||
printf("%u ",
|
||||
(unsigned)(ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
(EXTRACT_32BITS(&nr->proto_tos) >> 8) & 0xff);
|
||||
else
|
||||
printf("%s ", pent->p_name);
|
||||
|
||||
@ -161,9 +157,9 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
if (pent && pent->p_proto == IPPROTO_TCP) {
|
||||
int flags;
|
||||
if (ver == 1)
|
||||
flags = (ntohl(nr->asses) >> 24) & 0xff;
|
||||
flags = (EXTRACT_32BITS(&nr->asses) >> 24) & 0xff;
|
||||
else
|
||||
flags = (ntohl(nr->proto_tos) >> 16) & 0xff;
|
||||
flags = (EXTRACT_32BITS(&nr->proto_tos) >> 16) & 0xff;
|
||||
if (flags & TH_FIN) putchar('F');
|
||||
if (flags & TH_SYN) putchar('S');
|
||||
if (flags & TH_RST) putchar('R');
|
||||
@ -177,12 +173,12 @@ cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
buf[0]='\0';
|
||||
if (ver == 6) {
|
||||
snprintf(buf, sizeof(buf), "(%u<>%u encaps)",
|
||||
(unsigned)(ntohl(nr->masks) >> 8) & 0xff,
|
||||
(unsigned)(ntohl(nr->masks)) & 0xff);
|
||||
(EXTRACT_32BITS(&nr->masks) >> 8) & 0xff,
|
||||
(EXTRACT_32BITS(&nr->masks)) & 0xff);
|
||||
}
|
||||
printf("tos %u, %u (%u octets) %s",
|
||||
(unsigned)ntohl(nr->proto_tos) & 0xff,
|
||||
(unsigned)ntohl(nr->packets),
|
||||
(unsigned)ntohl(nr->octets), buf);
|
||||
EXTRACT_32BITS(&nr->proto_tos) & 0xff,
|
||||
EXTRACT_32BITS(&nr->packets),
|
||||
EXTRACT_32BITS(&nr->octets), buf);
|
||||
}
|
||||
}
|
||||
|
@ -20,30 +20,26 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.33 2001/09/17 21:57:59 fenner Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.36.2.2 2003/11/16 08:51:16 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
|
||||
#ifdef HAVE_LIBDNET
|
||||
#ifdef HAVE_NETDNET_DNETDB_H
|
||||
#include <netdnet/dnetdb.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "decnet.h"
|
||||
#include "extract.h"
|
||||
@ -63,7 +59,7 @@ static void print_reason(int);
|
||||
static void pdata(u_char *, int);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBDNET
|
||||
#ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA
|
||||
extern char *dnet_htoa(struct dn_naddr *);
|
||||
#endif
|
||||
|
||||
@ -344,13 +340,13 @@ print_i_info(int info)
|
||||
}
|
||||
|
||||
static void
|
||||
print_elist(const char *elp, u_int len)
|
||||
print_elist(const char *elp _U_, u_int len _U_)
|
||||
{
|
||||
/* Not enough examples available for me to debug this */
|
||||
}
|
||||
|
||||
static void
|
||||
print_nsp(const u_char *nspp, u_int nsplen)
|
||||
print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
{
|
||||
const struct nsphdr *nsphp = (struct nsphdr *)nspp;
|
||||
int dst, src, flags;
|
||||
@ -748,7 +744,7 @@ dnnum_string(u_short dnaddr)
|
||||
const char *
|
||||
dnname_string(u_short dnaddr)
|
||||
{
|
||||
#ifdef HAVE_LIBDNET
|
||||
#ifdef HAVE_DNET_HTOA
|
||||
struct dn_naddr dna;
|
||||
|
||||
dna.a_len = sizeof(short);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1998 and 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -27,31 +27,34 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* draft-ietf-dhc-dhcpv6-22.txt
|
||||
* RFC3315: DHCPv6
|
||||
* supported DHCPv6 options:
|
||||
* RFC3319,
|
||||
* draft-ietf-dhc-dhcpv6-opt-dnsconfig-04.txt,
|
||||
* draft-ietf-dhc-dhcpv6-opt-prefix-delegation-05.txt
|
||||
* draft-ietf-dhc-dhcpv6-opt-timeconfig-02.txt,
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.14.4.2 2002/06/01 23:51:12 guy Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.27.2.4 2003/11/18 23:26:14 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
/* lease duration */
|
||||
#define DHCP6_DURATITION_INFINITE 0xffffffff
|
||||
|
||||
/* Error Values */
|
||||
#define DH6ERR_FAILURE 16
|
||||
@ -61,8 +64,19 @@ static const char rcsid[] =
|
||||
#define DH6ERR_OPTUNAVAIL 20
|
||||
|
||||
/* Message type */
|
||||
#define DH6_SOLICIT 1
|
||||
#define DH6_ADVERTISE 2
|
||||
#define DH6_REQUEST 3
|
||||
#define DH6_CONFIRM 4
|
||||
#define DH6_RENEW 5
|
||||
#define DH6_REBIND 6
|
||||
#define DH6_REPLY 7
|
||||
#define DH6_RELEASE 8
|
||||
#define DH6_DECLINE 9
|
||||
#define DH6_RECONFIGURE 10
|
||||
#define DH6_INFORM_REQ 11
|
||||
#define DH6_RELAY_FORW 12
|
||||
#define DH6_RELAY_REPLY 13
|
||||
|
||||
/* DHCP6 base packet format */
|
||||
struct dhcp6 {
|
||||
@ -70,61 +84,229 @@ struct dhcp6 {
|
||||
u_int8_t m;
|
||||
u_int32_t x;
|
||||
} dh6_msgtypexid;
|
||||
struct in6_addr dh6_servaddr;
|
||||
/* options follow */
|
||||
} __attribute__ ((__packed__));
|
||||
};
|
||||
#define dh6_msgtype dh6_msgtypexid.m
|
||||
#define dh6_xid dh6_msgtypexid.x
|
||||
#define DH6_XIDMASK 0x00ffffff
|
||||
|
||||
/* option */
|
||||
#define DH6OPT_DUID 1 /* TBD */
|
||||
#define DH6OPT_DNS 11 /* TBD */
|
||||
/* DHCPv6 relay messages */
|
||||
struct dhcp6_relay {
|
||||
u_int8_t dh6relay_msgtype;
|
||||
u_int8_t dh6relay_hcnt;
|
||||
u_int8_t dh6relay_linkaddr[16]; /* XXX: badly aligned */
|
||||
u_int8_t dh6relay_peeraddr[16];
|
||||
/* options follow */
|
||||
};
|
||||
|
||||
/* options */
|
||||
#define DH6OPT_CLIENTID 1
|
||||
#define DH6OPT_SERVERID 2
|
||||
#define DH6OPT_IA_NA 3
|
||||
#define DH6OPT_IA_TMP 4
|
||||
#define DH6OPT_IADDR 5
|
||||
#define DH6OPT_ORO 6
|
||||
#define DH6OPT_PREFERENCE 7
|
||||
# define DH6OPT_PREF_UNDEF -1
|
||||
# define DH6OPT_PREF_MAX 255
|
||||
#define DH6OPT_ELAPSED_TIME 8
|
||||
#define DH6OPT_RELAY_MSG 9
|
||||
/*#define DH6OPT_SERVER_MSG 10 deprecated */
|
||||
#define DH6OPT_AUTH 11
|
||||
#define DH6OPT_UNICAST 12
|
||||
#define DH6OPT_STATUS_CODE 13
|
||||
# define DH6OPT_STCODE_SUCCESS 0
|
||||
# define DH6OPT_STCODE_UNSPECFAIL 1
|
||||
# define DH6OPT_STCODE_NOADDRAVAIL 2
|
||||
# define DH6OPT_STCODE_NOBINDING 3
|
||||
# define DH6OPT_STCODE_NOTONLINK 4
|
||||
# define DH6OPT_STCODE_USEMULTICAST 5
|
||||
# define DH6OPT_STCODE_NOPREFIXAVAIL 6
|
||||
#define DH6OPT_RAPID_COMMIT 14
|
||||
#define DH6OPT_USER_CLASS 15
|
||||
#define DH6OPT_VENDOR_CLASS 16
|
||||
#define DH6OPT_VENDOR_OPTS 17
|
||||
#define DH6OPT_INTERFACE_ID 18
|
||||
#define DH6OPT_RECONF_MSG 19
|
||||
#define DH6OPT_RECONF_ACCEPT 20
|
||||
#define DH6OPT_SIP_SERVER_D 21
|
||||
#define DH6OPT_SIP_SERVER_A 22
|
||||
#define DH6OPT_DNS 23
|
||||
#define DH6OPT_DNSNAME 24
|
||||
|
||||
/*
|
||||
* The option type has not been assigned for the following options.
|
||||
* We temporarily adopt values used in the service specification document
|
||||
* (200206xx version) by NTT Communications.
|
||||
* Note that we'll change the following definitions if different type values
|
||||
* are officially assigned.
|
||||
*/
|
||||
#define DH6OPT_PREFIX_DELEGATION 30
|
||||
#define DH6OPT_PREFIX_INFORMATION 31
|
||||
#define DH6OPT_PREFIX_REQUEST 32
|
||||
|
||||
/*
|
||||
* The followings are also unassigned numbers.
|
||||
* We temporarily use values as of KAME snap 20031013.
|
||||
*/
|
||||
#define DH6OPT_IA_PD 33
|
||||
#define DH6OPT_IA_PD_PREFIX 34
|
||||
#define DH6OPT_NTP_SERVERS 35
|
||||
|
||||
struct dhcp6opt {
|
||||
u_int16_t dh6opt_type;
|
||||
u_int16_t dh6opt_len;
|
||||
/* type-dependent data follows */
|
||||
} __attribute__ ((__packed__));
|
||||
};
|
||||
|
||||
struct dhcp6_ia {
|
||||
u_int16_t dh6opt_ia_type;
|
||||
u_int16_t dh6opt_ia_len;
|
||||
u_int32_t dh6opt_ia_iaid;
|
||||
u_int32_t dh6opt_ia_t1;
|
||||
u_int32_t dh6opt_ia_t2;
|
||||
};
|
||||
|
||||
struct dhcp6_ia_prefix {
|
||||
u_int16_t dh6opt_ia_prefix_type;
|
||||
u_int16_t dh6opt_ia_prefix_len;
|
||||
u_int32_t dh6opt_ia_prefix_pltime;
|
||||
u_int32_t dh6opt_ia_prefix_vltime;
|
||||
u_int8_t dh6opt_ia_prefix_plen;
|
||||
struct in6_addr dh6opt_ia_prefix_addr;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
static const char *
|
||||
dhcp6opt_name(int type)
|
||||
{
|
||||
static char genstr[sizeof("opt_65535") + 1]; /* XXX thread unsafe */
|
||||
|
||||
if (type > 65535)
|
||||
return "INVALID option";
|
||||
|
||||
switch(type) {
|
||||
case DH6OPT_CLIENTID:
|
||||
return "client ID";
|
||||
case DH6OPT_SERVERID:
|
||||
return "server ID";
|
||||
case DH6OPT_IA_NA:
|
||||
return "IA_NA";
|
||||
case DH6OPT_ORO:
|
||||
return "option request";
|
||||
case DH6OPT_PREFERENCE:
|
||||
return "preference";
|
||||
case DH6OPT_ELAPSED_TIME:
|
||||
return "elapsed time";
|
||||
case DH6OPT_RELAY_MSG:
|
||||
return "relay message";
|
||||
case DH6OPT_STATUS_CODE:
|
||||
return "status code";
|
||||
case DH6OPT_RAPID_COMMIT:
|
||||
return "rapid commit";
|
||||
case DH6OPT_INTERFACE_ID:
|
||||
return "interface ID";
|
||||
case DH6OPT_RECONF_MSG:
|
||||
return "reconfigure message";
|
||||
case DH6OPT_RECONF_ACCEPT:
|
||||
return "reconfigure accept";
|
||||
case DH6OPT_SIP_SERVER_D:
|
||||
return "SIP Servers Domain";
|
||||
case DH6OPT_SIP_SERVER_A:
|
||||
return "SIP Servers Address";
|
||||
case DH6OPT_DNS:
|
||||
return "DNS";
|
||||
case DH6OPT_PREFIX_DELEGATION:
|
||||
return "prefix delegation";
|
||||
case DH6OPT_PREFIX_INFORMATION:
|
||||
return "prefix information";
|
||||
case DH6OPT_IA_PD:
|
||||
return "IA_PD";
|
||||
case DH6OPT_IA_PD_PREFIX:
|
||||
return "IA_PD prefix";
|
||||
case DH6OPT_NTP_SERVERS:
|
||||
return "NTP Server";
|
||||
default:
|
||||
snprintf(genstr, sizeof(genstr), "opt_%d", type);
|
||||
return(genstr);
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
dhcp6stcode(int code)
|
||||
{
|
||||
static char genstr[sizeof("code255") + 1]; /* XXX thread unsafe */
|
||||
|
||||
if (code > 255)
|
||||
return "INVALID code";
|
||||
|
||||
switch(code) {
|
||||
case DH6OPT_STCODE_SUCCESS:
|
||||
return "success";
|
||||
case DH6OPT_STCODE_UNSPECFAIL:
|
||||
return "unspec failure";
|
||||
case DH6OPT_STCODE_NOADDRAVAIL:
|
||||
return "no addresses";
|
||||
case DH6OPT_STCODE_NOBINDING:
|
||||
return "no binding";
|
||||
case DH6OPT_STCODE_NOTONLINK:
|
||||
return "not on-link";
|
||||
case DH6OPT_STCODE_USEMULTICAST:
|
||||
return "use multicast";
|
||||
case DH6OPT_STCODE_NOPREFIXAVAIL:
|
||||
return "no prefixes";
|
||||
default:
|
||||
snprintf(genstr, sizeof(genstr), "code%d", code);
|
||||
return(genstr);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dhcp6opt_print(u_char *cp, u_char *ep)
|
||||
dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
{
|
||||
struct dhcp6opt *dh6o;
|
||||
u_char *tp;
|
||||
int i;
|
||||
size_t i;
|
||||
u_int16_t opttype;
|
||||
size_t optlen;
|
||||
u_int16_t val16;
|
||||
u_int32_t val32;
|
||||
struct in6_addr addr6;
|
||||
struct dhcp6_ia ia;
|
||||
struct dhcp6_ia_prefix ia_prefix;
|
||||
|
||||
if (cp == ep)
|
||||
return;
|
||||
while (cp < ep) {
|
||||
if (ep - cp < sizeof(*dh6o))
|
||||
if (ep < cp + sizeof(*dh6o))
|
||||
goto trunc;
|
||||
dh6o = (struct dhcp6opt *)cp;
|
||||
optlen = ntohs(dh6o->dh6opt_len);
|
||||
if (ep - cp < sizeof(*dh6o) + optlen)
|
||||
optlen = EXTRACT_16BITS(&dh6o->dh6opt_len);
|
||||
if (ep < cp + sizeof(*dh6o) + optlen)
|
||||
goto trunc;
|
||||
switch (ntohs(dh6o->dh6opt_type)) {
|
||||
case DH6OPT_DUID:
|
||||
printf(" (duid"); /*)*/
|
||||
opttype = EXTRACT_16BITS(&dh6o->dh6opt_type);
|
||||
printf(" (%s", dhcp6opt_name(opttype));
|
||||
switch (opttype) {
|
||||
case DH6OPT_CLIENTID:
|
||||
case DH6OPT_SERVERID:
|
||||
if (optlen < 2) {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
switch (ntohs(*(u_int16_t *)tp)) {
|
||||
switch (EXTRACT_16BITS(tp)) {
|
||||
case 1:
|
||||
if (optlen >= 2 + 6) {
|
||||
printf(" hwaddr/time time %u type %u ",
|
||||
ntohl(*(u_int32_t *)&tp[2]),
|
||||
ntohs(*(u_int16_t *)&tp[6]));
|
||||
printf(" hwaddr/time type %u time %u ",
|
||||
EXTRACT_16BITS(&tp[2]),
|
||||
EXTRACT_32BITS(&tp[4]));
|
||||
for (i = 8; i < optlen; i++)
|
||||
printf("%02x", tp[i]);
|
||||
/*(*/
|
||||
printf(")");
|
||||
} else {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
printf(" ?)");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -136,37 +318,177 @@ dhcp6opt_print(u_char *cp, u_char *ep)
|
||||
printf(")");
|
||||
} else {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
printf(" ?)");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (optlen >= 2 + 2) {
|
||||
printf(" hwaddr type %u ",
|
||||
ntohs(*(u_int16_t *)&tp[2]));
|
||||
EXTRACT_16BITS(&tp[2]));
|
||||
for (i = 4; i < optlen; i++)
|
||||
printf("%02x", tp[i]);
|
||||
/*(*/
|
||||
printf(")");
|
||||
} else {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
printf(" ?)");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf(" type %d)", EXTRACT_16BITS(tp));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DH6OPT_ORO:
|
||||
if (optlen % 2) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
for (i = 0; i < optlen; i += 2) {
|
||||
u_int16_t opt;
|
||||
|
||||
memcpy(&opt, &tp[i], sizeof(opt));
|
||||
printf(" %s", dhcp6opt_name(ntohs(opt)));
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_PREFERENCE:
|
||||
if (optlen != 1) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
printf(" %d)", *((u_char *)(dh6o + 1) + 1));
|
||||
break;
|
||||
case DH6OPT_ELAPSED_TIME:
|
||||
if (optlen != 2) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&val16, dh6o + 1, sizeof(val16));
|
||||
val16 = ntohs(val16);
|
||||
printf(" %d)", (int)val16);
|
||||
break;
|
||||
case DH6OPT_RELAY_MSG:
|
||||
printf(" (");
|
||||
dhcp6_print((const u_char *)(dh6o + 1), optlen);
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_RAPID_COMMIT: /* nothing todo */
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_INTERFACE_ID:
|
||||
/*
|
||||
* Since we cannot predict the encoding, print hex dump
|
||||
* at most 10 characters.
|
||||
*/
|
||||
for (i = 0; i < optlen && i < 10; i++)
|
||||
printf("%02x", ((u_char *)(dh6o + 1))[i]);
|
||||
break;
|
||||
case DH6OPT_RECONF_MSG:
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
switch (*tp) {
|
||||
case DH6_RENEW:
|
||||
printf(" for renew)");
|
||||
break;
|
||||
case DH6_INFORM_REQ:
|
||||
printf(" for inf-req)");
|
||||
break;
|
||||
default:
|
||||
printf(" for ?\?\?(%02x))", *tp);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DH6OPT_RECONF_ACCEPT: /* nothing todo */
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_SIP_SERVER_A:
|
||||
case DH6OPT_DNS:
|
||||
printf(" (dnsserver"); /*)*/
|
||||
case DH6OPT_NTP_SERVERS:
|
||||
if (optlen % 16) {
|
||||
/*(*/
|
||||
printf(" ??)");
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
for (i = 0; i < optlen; i += 16)
|
||||
printf(" %s", ip6addr_string(&tp[i]));
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_PREFIX_DELEGATION:
|
||||
dhcp6opt_print((u_char *)(dh6o + 1),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_PREFIX_INFORMATION:
|
||||
if (optlen % 21)
|
||||
printf(" ?)");
|
||||
memcpy(&addr6, (u_char *)(dh6o + 1) + 5,
|
||||
sizeof(addr6));
|
||||
printf(" %s/%d", ip6addr_string(&addr6),
|
||||
(int)*((u_char *)(dh6o + 1) + 4));
|
||||
memcpy(&val32, dh6o + 1, sizeof(val32));
|
||||
val32 = ntohl(val32);
|
||||
if (val32 == DHCP6_DURATITION_INFINITE)
|
||||
printf(" lease-duration: infinite)");
|
||||
else
|
||||
printf(" lease-duration: %u)", val32);
|
||||
break;
|
||||
case DH6OPT_STATUS_CODE:
|
||||
if (optlen < 2) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&val16, (u_char *)(dh6o + 1), sizeof(val16));
|
||||
val16 = ntohs(val16);
|
||||
printf(" %s)", dhcp6stcode(val16));
|
||||
break;
|
||||
case DH6OPT_IA_NA:
|
||||
case DH6OPT_IA_PD:
|
||||
if (optlen < sizeof(ia) - 4) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&ia, (u_char *)dh6o, sizeof(ia));
|
||||
ia.dh6opt_ia_iaid = ntohl(ia.dh6opt_ia_iaid);
|
||||
ia.dh6opt_ia_t1 = ntohl(ia.dh6opt_ia_t1);
|
||||
ia.dh6opt_ia_t2 = ntohl(ia.dh6opt_ia_t2);
|
||||
printf(" IAID:%lu T1:%lu T2:%lu",
|
||||
(unsigned long)ia.dh6opt_ia_iaid,
|
||||
(unsigned long)ia.dh6opt_ia_t1,
|
||||
(unsigned long)ia.dh6opt_ia_t2);
|
||||
if (optlen > sizeof(ia) - 4) {
|
||||
/* there are sub-options */
|
||||
dhcp6opt_print((u_char *)dh6o + sizeof(ia),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_IA_PD_PREFIX:
|
||||
if (optlen < sizeof(ia_prefix) - 4) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&ia_prefix, (u_char *)dh6o, sizeof(ia_prefix));
|
||||
printf(" %s/%d",
|
||||
ip6addr_string(&ia_prefix.dh6opt_ia_prefix_addr),
|
||||
ia_prefix.dh6opt_ia_prefix_plen);
|
||||
ia_prefix.dh6opt_ia_prefix_pltime =
|
||||
ntohl(ia_prefix.dh6opt_ia_prefix_pltime);
|
||||
ia_prefix.dh6opt_ia_prefix_vltime =
|
||||
ntohl(ia_prefix.dh6opt_ia_prefix_vltime);
|
||||
printf(" pltime:%lu vltime:%lu",
|
||||
(unsigned long)ia_prefix.dh6opt_ia_prefix_pltime,
|
||||
(unsigned long)ia_prefix.dh6opt_ia_prefix_vltime);
|
||||
if (optlen > sizeof(ia_prefix) - 4) {
|
||||
/* there are sub-options */
|
||||
dhcp6opt_print((u_char *)dh6o +
|
||||
sizeof(ia_prefix),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
default:
|
||||
printf(" (opt-%u)", ntohs(dh6o->dh6opt_type));
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -182,27 +504,63 @@ dhcp6opt_print(u_char *cp, u_char *ep)
|
||||
* Print dhcp6 packets
|
||||
*/
|
||||
void
|
||||
dhcp6_print(register const u_char *cp, u_int length,
|
||||
u_int16_t sport, u_int16_t dport)
|
||||
dhcp6_print(const u_char *cp, u_int length)
|
||||
{
|
||||
struct dhcp6 *dh6;
|
||||
u_char *ep;
|
||||
struct dhcp6_relay *dh6relay;
|
||||
const u_char *ep;
|
||||
u_char *extp;
|
||||
const char *name;
|
||||
|
||||
printf("dhcp6");
|
||||
|
||||
ep = (u_char *)snapend;
|
||||
if (cp + length < ep)
|
||||
ep = cp + length;
|
||||
|
||||
dh6 = (struct dhcp6 *)cp;
|
||||
TCHECK(dh6->dh6_servaddr);
|
||||
dh6relay = (struct dhcp6_relay *)cp;
|
||||
TCHECK(dh6->dh6_xid);
|
||||
switch (dh6->dh6_msgtype) {
|
||||
case DH6_SOLICIT:
|
||||
name = "solicit";
|
||||
break;
|
||||
case DH6_ADVERTISE:
|
||||
name = "advertise";
|
||||
break;
|
||||
case DH6_REQUEST:
|
||||
name = "request";
|
||||
break;
|
||||
case DH6_CONFIRM:
|
||||
name = "confirm";
|
||||
break;
|
||||
case DH6_RENEW:
|
||||
name = "renew";
|
||||
break;
|
||||
case DH6_REBIND:
|
||||
name = "rebind";
|
||||
break;
|
||||
case DH6_REPLY:
|
||||
name = "reply";
|
||||
break;
|
||||
case DH6_RELEASE:
|
||||
name = "release";
|
||||
break;
|
||||
case DH6_DECLINE:
|
||||
name = "decline";
|
||||
break;
|
||||
case DH6_RECONFIGURE:
|
||||
name = "reconfigure";
|
||||
break;
|
||||
case DH6_INFORM_REQ:
|
||||
name= "inf-req";
|
||||
break;
|
||||
case DH6_RELAY_FORW:
|
||||
name= "relay-fwd";
|
||||
break;
|
||||
case DH6_RELAY_REPLY:
|
||||
name= "relay-reply";
|
||||
break;
|
||||
default:
|
||||
name = NULL;
|
||||
break;
|
||||
@ -211,8 +569,10 @@ dhcp6_print(register const u_char *cp, u_int length,
|
||||
if (!vflag) {
|
||||
if (name)
|
||||
printf(" %s", name);
|
||||
else
|
||||
else if (dh6->dh6_msgtype != DH6_RELAY_FORW &&
|
||||
dh6->dh6_msgtype != DH6_RELAY_REPLY) {
|
||||
printf(" msgtype-%u", dh6->dh6_msgtype);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -222,10 +582,24 @@ dhcp6_print(register const u_char *cp, u_int length,
|
||||
printf(" %s (", name); /*)*/
|
||||
else
|
||||
printf(" msgtype-%u (", dh6->dh6_msgtype); /*)*/
|
||||
printf("xid=%x", ntohl(dh6->dh6_xid) & DH6_XIDMASK);
|
||||
printf(" server=%s", ip6addr_string(&dh6->dh6_servaddr));
|
||||
extp = (u_char *)(dh6 + 1);
|
||||
dhcp6opt_print(extp, ep);
|
||||
if (dh6->dh6_msgtype != DH6_RELAY_FORW &&
|
||||
dh6->dh6_msgtype != DH6_RELAY_REPLY) {
|
||||
printf("xid=%x", EXTRACT_32BITS(&dh6->dh6_xid) & DH6_XIDMASK);
|
||||
extp = (u_char *)(dh6 + 1);
|
||||
dhcp6opt_print(extp, ep);
|
||||
} else { /* relay messages */
|
||||
struct in6_addr addr6;
|
||||
|
||||
TCHECK(dh6relay->dh6relay_peeraddr);
|
||||
|
||||
memcpy(&addr6, dh6relay->dh6relay_linkaddr, sizeof (addr6));
|
||||
printf("linkaddr=%s", ip6addr_string(&addr6));
|
||||
|
||||
memcpy(&addr6, dh6relay->dh6relay_peeraddr, sizeof (addr6));
|
||||
printf(" peeraddr=%s", ip6addr_string(&addr6));
|
||||
|
||||
dhcp6opt_print((u_char *)(dh6relay + 1), ep);
|
||||
}
|
||||
/*(*/
|
||||
printf(")");
|
||||
return;
|
||||
|
@ -20,24 +20,19 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.21 2001/05/10 05:30:20 fenner Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.24.2.3 2003/11/19 09:41:28 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
@ -67,13 +62,13 @@ static const char rcsid[] =
|
||||
#define DVMRP_NF_DISABLED 0x20 /* administratively disabled */
|
||||
#define DVMRP_NF_QUERIER 0x40 /* I am the subnet's querier */
|
||||
|
||||
static void print_probe(const u_char *, const u_char *, u_int);
|
||||
static void print_report(const u_char *, const u_char *, u_int);
|
||||
static void print_neighbors(const u_char *, const u_char *, u_int);
|
||||
static void print_neighbors2(const u_char *, const u_char *, u_int);
|
||||
static void print_prune(const u_char *, const u_char *, u_int);
|
||||
static void print_graft(const u_char *, const u_char *, u_int);
|
||||
static void print_graft_ack(const u_char *, const u_char *, u_int);
|
||||
static int print_probe(const u_char *, const u_char *, u_int);
|
||||
static int print_report(const u_char *, const u_char *, u_int);
|
||||
static int print_neighbors(const u_char *, const u_char *, u_int);
|
||||
static int print_neighbors2(const u_char *, const u_char *, u_int);
|
||||
static int print_prune(const u_char *);
|
||||
static int print_graft(const u_char *);
|
||||
static int print_graft_ack(const u_char *);
|
||||
|
||||
static u_int32_t target_level;
|
||||
|
||||
@ -87,6 +82,7 @@ dvmrp_print(register const u_char *bp, register u_int len)
|
||||
if (bp >= ep)
|
||||
return;
|
||||
|
||||
TCHECK(bp[1]);
|
||||
type = bp[1];
|
||||
|
||||
/* Skip IGMP header */
|
||||
@ -97,14 +93,18 @@ dvmrp_print(register const u_char *bp, register u_int len)
|
||||
|
||||
case DVMRP_PROBE:
|
||||
printf(" Probe");
|
||||
if (vflag)
|
||||
print_probe(bp, ep, len);
|
||||
if (vflag) {
|
||||
if (print_probe(bp, ep, len) < 0)
|
||||
goto trunc;
|
||||
}
|
||||
break;
|
||||
|
||||
case DVMRP_REPORT:
|
||||
printf(" Report");
|
||||
if (vflag > 1)
|
||||
print_report(bp, ep, len);
|
||||
if (vflag > 1) {
|
||||
if (print_report(bp, ep, len) < 0)
|
||||
goto trunc;
|
||||
}
|
||||
break;
|
||||
|
||||
case DVMRP_ASK_NEIGHBORS:
|
||||
@ -113,7 +113,8 @@ dvmrp_print(register const u_char *bp, register u_int len)
|
||||
|
||||
case DVMRP_NEIGHBORS:
|
||||
printf(" Neighbors(old)");
|
||||
print_neighbors(bp, ep, len);
|
||||
if (print_neighbors(bp, ep, len) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
case DVMRP_ASK_NEIGHBORS2:
|
||||
@ -127,45 +128,57 @@ dvmrp_print(register const u_char *bp, register u_int len)
|
||||
* address field
|
||||
*/
|
||||
bp -= 4;
|
||||
TCHECK2(bp[0], 4);
|
||||
target_level = (bp[0] << 24) | (bp[1] << 16) |
|
||||
(bp[2] << 8) | bp[3];
|
||||
bp += 4;
|
||||
print_neighbors2(bp, ep, len);
|
||||
if (print_neighbors2(bp, ep, len) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
case DVMRP_PRUNE:
|
||||
printf(" Prune");
|
||||
print_prune(bp, ep, len);
|
||||
if (print_prune(bp) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
case DVMRP_GRAFT:
|
||||
printf(" Graft");
|
||||
print_graft(bp, ep, len);
|
||||
if (print_graft(bp) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
case DVMRP_GRAFT_ACK:
|
||||
printf(" Graft-ACK");
|
||||
print_graft_ack(bp, ep, len);
|
||||
if (print_graft_ack(bp) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" [type %d]", type);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|dvmrp]");
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_report(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
{
|
||||
register u_int32_t mask, origin;
|
||||
register int metric, i, width, done;
|
||||
register int metric, done;
|
||||
register u_int i, width;
|
||||
|
||||
while (len > 0) {
|
||||
if (len < 3) {
|
||||
printf(" [|]");
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
TCHECK2(bp[0], 3);
|
||||
mask = (u_int32_t)0xff << 24 | bp[0] << 16 | bp[1] << 8 | bp[2];
|
||||
width = 1;
|
||||
if (bp[0])
|
||||
@ -181,18 +194,21 @@ print_report(register const u_char *bp, register const u_char *ep,
|
||||
do {
|
||||
if (bp + width + 1 > ep) {
|
||||
printf(" [|]");
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
if (len < width + 1) {
|
||||
printf("\n\t [Truncated Report]");
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
origin = 0;
|
||||
for (i = 0; i < width; ++i)
|
||||
for (i = 0; i < width; ++i) {
|
||||
TCHECK(*bp);
|
||||
origin = origin << 8 | *bp++;
|
||||
}
|
||||
for ( ; i < 4; ++i)
|
||||
origin <<= 8;
|
||||
|
||||
TCHECK(*bp);
|
||||
metric = *bp++;
|
||||
done = metric & 0x80;
|
||||
metric &= 0x7f;
|
||||
@ -201,9 +217,12 @@ print_report(register const u_char *bp, register const u_char *ep,
|
||||
len -= width + 1;
|
||||
} while (!done);
|
||||
}
|
||||
return (0);
|
||||
trunc:
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_probe(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
{
|
||||
@ -213,7 +232,7 @@ print_probe(register const u_char *bp, register const u_char *ep,
|
||||
if ((len < 4) || ((bp + 4) > ep)) {
|
||||
/* { (ctags) */
|
||||
printf(" [|}");
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
genid = (bp[0] << 24) | (bp[1] << 16) | (bp[2] << 8) | bp[3];
|
||||
bp += 4;
|
||||
@ -224,19 +243,19 @@ print_probe(register const u_char *bp, register const u_char *ep,
|
||||
printf(" ");
|
||||
printf("genid %u", genid);
|
||||
if (vflag < 2)
|
||||
return;
|
||||
return (0);
|
||||
|
||||
while ((len > 0) && (bp < ep)) {
|
||||
TCHECK2(bp[0], 4);
|
||||
printf("\n\tneighbor %s", ipaddr_string(bp));
|
||||
bp += 4; len -= 4;
|
||||
}
|
||||
return;
|
||||
return (0);
|
||||
trunc:
|
||||
(void)printf("[|dvmrp]");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_neighbors(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
{
|
||||
@ -262,12 +281,12 @@ print_neighbors(register const u_char *bp, register const u_char *ep,
|
||||
len -= 4;
|
||||
}
|
||||
}
|
||||
return;
|
||||
return (0);
|
||||
trunc:
|
||||
(void)printf("[|dvmrp]");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_neighbors2(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
{
|
||||
@ -308,46 +327,43 @@ print_neighbors2(register const u_char *bp, register const u_char *ep,
|
||||
}
|
||||
if (ncount != -1) {
|
||||
printf(" [|]");
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return;
|
||||
return (0);
|
||||
trunc:
|
||||
(void)printf("[|dvmrp]");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
print_prune(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
static int
|
||||
print_prune(register const u_char *bp)
|
||||
{
|
||||
TCHECK2(bp[0], 12);
|
||||
printf(" src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4));
|
||||
bp += 8;
|
||||
(void)printf(" timer ");
|
||||
relts_print(EXTRACT_32BITS(bp));
|
||||
return;
|
||||
return (0);
|
||||
trunc:
|
||||
(void)printf("[|dvmrp]");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
print_graft(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
static int
|
||||
print_graft(register const u_char *bp)
|
||||
{
|
||||
TCHECK2(bp[0], 8);
|
||||
printf(" src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4));
|
||||
return;
|
||||
return (0);
|
||||
trunc:
|
||||
(void)printf("[|dvmrp]");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static void
|
||||
print_graft_ack(register const u_char *bp, register const u_char *ep,
|
||||
register u_int len)
|
||||
static int
|
||||
print_graft_ack(register const u_char *bp)
|
||||
{
|
||||
TCHECK2(bp[0], 8);
|
||||
printf(" src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4));
|
||||
return;
|
||||
return (0);
|
||||
trunc:
|
||||
(void)printf("[|dvmrp]");
|
||||
return (-1);
|
||||
}
|
||||
|
@ -19,38 +19,34 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.28.4.1 2002/06/01 23:51:12 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.34.2.2 2003/11/16 08:51:18 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "ip.h"
|
||||
|
||||
struct egp_packet {
|
||||
u_char egp_version;
|
||||
u_int8_t egp_version;
|
||||
#define EGP_VERSION 2
|
||||
u_char egp_type;
|
||||
u_int8_t egp_type;
|
||||
#define EGPT_ACQUIRE 3
|
||||
#define EGPT_REACH 5
|
||||
#define EGPT_POLL 2
|
||||
#define EGPT_UPDATE 1
|
||||
#define EGPT_ERROR 8
|
||||
u_char egp_code;
|
||||
u_int8_t egp_code;
|
||||
#define EGPC_REQUEST 0
|
||||
#define EGPC_CONFIRM 1
|
||||
#define EGPC_REFUSE 2
|
||||
@ -58,7 +54,7 @@ struct egp_packet {
|
||||
#define EGPC_CEASEACK 4
|
||||
#define EGPC_HELLO 0
|
||||
#define EGPC_HEARDU 1
|
||||
u_char egp_status;
|
||||
u_int8_t egp_status;
|
||||
#define EGPS_UNSPEC 0
|
||||
#define EGPS_ACTIVE 1
|
||||
#define EGPS_PASSIVE 2
|
||||
@ -71,13 +67,13 @@ struct egp_packet {
|
||||
#define EGPS_UP 1
|
||||
#define EGPS_DOWN 2
|
||||
#define EGPS_UNSOL 0x80
|
||||
u_short egp_checksum;
|
||||
u_short egp_as;
|
||||
u_short egp_sequence;
|
||||
u_int16_t egp_checksum;
|
||||
u_int16_t egp_as;
|
||||
u_int16_t egp_sequence;
|
||||
union {
|
||||
u_short egpu_hello;
|
||||
u_char egpu_gws[2];
|
||||
u_short egpu_reason;
|
||||
u_int16_t egpu_hello;
|
||||
u_int8_t egpu_gws[2];
|
||||
u_int16_t egpu_reason;
|
||||
#define EGPR_UNSPEC 0
|
||||
#define EGPR_BADHEAD 1
|
||||
#define EGPR_BADDATA 2
|
||||
@ -91,7 +87,7 @@ struct egp_packet {
|
||||
#define egp_extgw egp_handg.egpu_gws[1]
|
||||
#define egp_reason egp_handg.egpu_reason
|
||||
union {
|
||||
u_short egpu_poll;
|
||||
u_int16_t egpu_poll;
|
||||
u_int32_t egpu_sourcenet;
|
||||
} egp_pands;
|
||||
#define egp_poll egp_pands.egpu_poll
|
||||
@ -139,15 +135,15 @@ const char *egp_reasons[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
egpnrprint(register const struct egp_packet *egp, register u_int length)
|
||||
egpnrprint(register const struct egp_packet *egp)
|
||||
{
|
||||
register const u_char *cp;
|
||||
register const u_int8_t *cp;
|
||||
u_int32_t addr;
|
||||
register u_int32_t net;
|
||||
register u_int netlen;
|
||||
int gateways, distances, networks;
|
||||
int t_gateways;
|
||||
char *comma;
|
||||
const char *comma;
|
||||
|
||||
addr = egp->egp_sourcenet;
|
||||
if (IN_CLASSA(addr)) {
|
||||
@ -163,7 +159,7 @@ egpnrprint(register const struct egp_packet *egp, register u_int length)
|
||||
net = 0;
|
||||
netlen = 0;
|
||||
}
|
||||
cp = (u_char *)(egp + 1);
|
||||
cp = (u_int8_t *)(egp + 1);
|
||||
|
||||
t_gateways = egp->egp_intgw + egp->egp_extgw;
|
||||
for (gateways = 0; gateways < t_gateways; ++gateways) {
|
||||
@ -218,24 +214,25 @@ egpnrprint(register const struct egp_packet *egp, register u_int length)
|
||||
}
|
||||
|
||||
void
|
||||
egp_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2)
|
||||
egp_print(register const u_int8_t *bp)
|
||||
{
|
||||
register const struct egp_packet *egp;
|
||||
register const struct ip *ip;
|
||||
register int status;
|
||||
register int code;
|
||||
register int type;
|
||||
|
||||
egp = (struct egp_packet *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
if (!TTEST(*egp)) {
|
||||
printf("[|egp]");
|
||||
return;
|
||||
}
|
||||
(void)printf("egp: ");
|
||||
|
||||
if (egp->egp_version != EGP_VERSION) {
|
||||
printf("[version %d]", egp->egp_version);
|
||||
return;
|
||||
}
|
||||
printf("as:%d seq:%d", ntohs(egp->egp_as), ntohs(egp->egp_sequence));
|
||||
printf("as:%d seq:%d", EXTRACT_16BITS(&egp->egp_as), EXTRACT_16BITS(&egp->egp_sequence));
|
||||
|
||||
type = egp->egp_type;
|
||||
code = egp->egp_code;
|
||||
@ -260,8 +257,8 @@ egp_print(register const u_char *bp, register u_int length,
|
||||
break;
|
||||
}
|
||||
printf(" hello:%d poll:%d",
|
||||
ntohs(egp->egp_hello),
|
||||
ntohs(egp->egp_poll));
|
||||
EXTRACT_16BITS(&egp->egp_hello),
|
||||
EXTRACT_16BITS(&egp->egp_poll));
|
||||
break;
|
||||
|
||||
case EGPC_REFUSE:
|
||||
@ -332,7 +329,7 @@ egp_print(register const u_char *bp, register u_int length,
|
||||
egp->egp_intgw,
|
||||
egp->egp_extgw);
|
||||
if (vflag)
|
||||
egpnrprint(egp, length);
|
||||
egpnrprint(egp);
|
||||
break;
|
||||
|
||||
case EGPT_ERROR:
|
||||
@ -342,10 +339,10 @@ egp_print(register const u_char *bp, register u_int length,
|
||||
else
|
||||
printf(" [status %d]", status);
|
||||
|
||||
if (ntohs(egp->egp_reason) <= EGPR_UVERSION)
|
||||
printf(" %s", egp_reasons[ntohs(egp->egp_reason)]);
|
||||
if (EXTRACT_16BITS(&egp->egp_reason) <= EGPR_UVERSION)
|
||||
printf(" %s", egp_reasons[EXTRACT_16BITS(&egp->egp_reason)]);
|
||||
else
|
||||
printf(" [reason %d]", ntohs(egp->egp_reason));
|
||||
printf(" [reason %d]", EXTRACT_16BITS(&egp->egp_reason));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
78
contrib/tcpdump/print-enc.c
Normal file
78
contrib/tcpdump/print-enc.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* $OpenBSD: print-enc.c,v 1.7 2002/02/19 19:39:40 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* 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-enc.c,v 1.1.2.2 2003/11/16 08:51:19 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#include "enc.h"
|
||||
|
||||
#define ENC_PRINT_TYPE(wh, xf, nam) \
|
||||
if ((wh) & (xf)) { \
|
||||
printf("%s%s", nam, (wh) == (xf) ? "): " : ","); \
|
||||
(wh) &= ~(xf); \
|
||||
}
|
||||
|
||||
u_int
|
||||
enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
int flags;
|
||||
const struct enchdr *hdr;
|
||||
|
||||
if (caplen < ENC_HDRLEN) {
|
||||
printf("[|enc]");
|
||||
goto out;
|
||||
}
|
||||
|
||||
hdr = (struct enchdr *)p;
|
||||
flags = hdr->flags;
|
||||
if (flags == 0)
|
||||
printf("(unprotected): ");
|
||||
else
|
||||
printf("(");
|
||||
ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
|
||||
ENC_PRINT_TYPE(flags, M_CONF, "confidential");
|
||||
/* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
|
||||
printf("SPI 0x%08x: ", (u_int32_t)ntohl(hdr->spi));
|
||||
|
||||
length -= ENC_HDRLEN;
|
||||
/* XXX - use the address family */
|
||||
ip_print(p + ENC_HDRLEN, length);
|
||||
|
||||
out:
|
||||
return (ENC_HDRLEN);
|
||||
}
|
@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.20.4.2 2002/02/22 09:26:27 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.44.2.4 2003/11/19 05:36:40 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,22 +31,14 @@ static const char rcsid[] =
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/blowfish.h>
|
||||
#ifdef HAVE_RC5_H
|
||||
#include <openssl/rc5.h>
|
||||
#endif
|
||||
#ifdef HAVE_CAST_H
|
||||
#include <openssl/cast.h>
|
||||
#ifdef HAVE_OPENSSL_EVP_H
|
||||
#include <openssl/evp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -58,53 +50,71 @@ static const char rcsid[] =
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
|
||||
#define AVOID_CHURN 1
|
||||
#if defined(__MINGW32__) || defined(__WATCOMC__)
|
||||
extern char *strsep(char **stringp, const char *delim); /* Missing/strsep.c */
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
static struct esp_algorithm *espsecret_xform=NULL; /* cache of decoded alg. */
|
||||
static char *espsecret_key=NULL;
|
||||
#ifndef HAVE_SOCKADDR_STORAGE
|
||||
#ifdef INET6
|
||||
struct sockaddr_storage {
|
||||
union {
|
||||
struct sockaddr_in sin;
|
||||
struct sockaddr_in6 sin6;
|
||||
} un;
|
||||
};
|
||||
#else
|
||||
#define sockaddr_storage sockaddr
|
||||
#endif
|
||||
#endif /* HAVE_SOCKADDR_STORAGE */
|
||||
|
||||
|
||||
enum cipher { NONE,
|
||||
DESCBC,
|
||||
BLOWFISH,
|
||||
RC5,
|
||||
CAST128,
|
||||
DES3CBC};
|
||||
|
||||
|
||||
|
||||
struct esp_algorithm {
|
||||
char *name;
|
||||
enum cipher algo;
|
||||
int ivlen;
|
||||
int authlen;
|
||||
int replaysize;
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
struct sa_list {
|
||||
struct sa_list *next;
|
||||
struct sockaddr_storage daddr;
|
||||
u_int32_t spi;
|
||||
const EVP_CIPHER *evp;
|
||||
int ivlen;
|
||||
int authlen;
|
||||
char secret[256]; /* is that big enough for all secrets? */
|
||||
int secretlen;
|
||||
};
|
||||
|
||||
struct esp_algorithm esp_xforms[]={
|
||||
{"none", NONE, 0, 0, 0},
|
||||
{"des-cbc", DESCBC, 8, 0, 0},
|
||||
{"des-cbc-hmac96", DESCBC, 8, 12, 4},
|
||||
{"blowfish-cbc", BLOWFISH,8, 0, 0},
|
||||
{"blowfish-cbc-hmac96", BLOWFISH,8, 12, 4},
|
||||
{"rc5-cbc", RC5, 8, 0, 0},
|
||||
{"rc5-cbc-hmac96", RC5, 8, 12, 4},
|
||||
{"cast128-cbc", CAST128, 8, 0, 0},
|
||||
{"cast128-cbc-hmac96", CAST128, 8, 12, 4},
|
||||
{"3des-cbc-hmac96", DES3CBC, 8, 12, 4},
|
||||
};
|
||||
static struct sa_list *sa_list_head = NULL;
|
||||
static struct sa_list *sa_default = NULL;
|
||||
|
||||
static void esp_print_addsa(struct sa_list *sa, int sa_def)
|
||||
{
|
||||
/* copy the "sa" */
|
||||
|
||||
struct sa_list *nsa;
|
||||
|
||||
nsa = (struct sa_list *)malloc(sizeof(struct sa_list));
|
||||
if (nsa == NULL)
|
||||
error("ran out of memory to allocate sa structure");
|
||||
|
||||
*nsa = *sa;
|
||||
|
||||
if (sa_def)
|
||||
sa_default = nsa;
|
||||
|
||||
nsa->next = sa_list_head;
|
||||
sa_list_head = nsa;
|
||||
}
|
||||
|
||||
|
||||
static int hexdigit(char hex)
|
||||
{
|
||||
if(hex >= '0' && hex <= '9') {
|
||||
if (hex >= '0' && hex <= '9')
|
||||
return (hex - '0');
|
||||
} else if(hex >= 'A' && hex <= 'F') {
|
||||
else if (hex >= 'A' && hex <= 'F')
|
||||
return (hex - 'A' + 10);
|
||||
} else if(hex >= 'a' && hex <= 'f') {
|
||||
else if (hex >= 'a' && hex <= 'f')
|
||||
return (hex - 'a' + 10);
|
||||
} else {
|
||||
else {
|
||||
printf("invalid hex digit %c in espsecret\n", hex);
|
||||
return 0;
|
||||
}
|
||||
@ -114,79 +124,236 @@ static int hex2byte(char *hexstring)
|
||||
{
|
||||
int byte;
|
||||
|
||||
byte = (hexdigit(hexstring[0]) << 4) +
|
||||
hexdigit(hexstring[1]);
|
||||
byte = (hexdigit(hexstring[0]) << 4) + hexdigit(hexstring[1]);
|
||||
return byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* decode the form: SPINUM@IP <tab> ALGONAME:0xsecret
|
||||
*
|
||||
* special form: file /name
|
||||
* causes us to go read from this file instead.
|
||||
*
|
||||
*/
|
||||
static void esp_print_decode_onesecret(char *line)
|
||||
{
|
||||
struct sa_list sa1;
|
||||
int sa_def;
|
||||
|
||||
char *spikey;
|
||||
char *decode;
|
||||
|
||||
spikey = strsep(&line, " \t");
|
||||
sa_def = 0;
|
||||
memset(&sa1, 0, sizeof(struct sa_list));
|
||||
|
||||
/* if there is only one token, then it is an algo:key token */
|
||||
if (line == NULL) {
|
||||
decode = spikey;
|
||||
spikey = NULL;
|
||||
/* memset(&sa1.daddr, 0, sizeof(sa1.daddr)); */
|
||||
/* sa1.spi = 0; */
|
||||
sa_def = 1;
|
||||
} else
|
||||
decode = line;
|
||||
|
||||
if (spikey && strcasecmp(spikey, "file") == 0) {
|
||||
/* open file and read it */
|
||||
FILE *secretfile;
|
||||
char fileline[1024];
|
||||
char *nl;
|
||||
|
||||
secretfile = fopen(line, FOPEN_READ_TXT);
|
||||
if (secretfile == NULL) {
|
||||
perror(line);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
while (fgets(fileline, sizeof(fileline)-1, secretfile) != NULL) {
|
||||
/* remove newline from the line */
|
||||
nl = strchr(fileline, '\n');
|
||||
if (nl)
|
||||
*nl = '\0';
|
||||
if (fileline[0] == '#') continue;
|
||||
if (fileline[0] == '\0') continue;
|
||||
|
||||
esp_print_decode_onesecret(fileline);
|
||||
}
|
||||
fclose(secretfile);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (spikey) {
|
||||
char *spistr, *foo;
|
||||
u_int32_t spino;
|
||||
struct sockaddr_in *sin;
|
||||
#ifdef INET6
|
||||
struct sockaddr_in6 *sin6;
|
||||
#endif
|
||||
|
||||
spistr = strsep(&spikey, "@");
|
||||
|
||||
spino = strtoul(spistr, &foo, 0);
|
||||
if (spistr == foo || !spikey) {
|
||||
printf("print_esp: failed to decode spi# %s\n", foo);
|
||||
return;
|
||||
}
|
||||
|
||||
sa1.spi = spino;
|
||||
|
||||
sin = (struct sockaddr_in *)&sa1.daddr;
|
||||
#ifdef INET6
|
||||
sin6 = (struct sockaddr_in6 *)&sa1.daddr;
|
||||
if (inet_pton(AF_INET6, spikey, &sin6->sin6_addr) == 1) {
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
sin6->sin6_len = sizeof(struct sockaddr_in6);
|
||||
#endif
|
||||
sin6->sin6_family = AF_INET6;
|
||||
} else
|
||||
#endif
|
||||
if (inet_pton(AF_INET, spikey, &sin->sin_addr) == 1) {
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
sin->sin_len = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
sin->sin_family = AF_INET;
|
||||
} else {
|
||||
printf("print_esp: can not decode IP# %s\n", spikey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (decode) {
|
||||
char *colon, *p;
|
||||
char espsecret_key[256];
|
||||
int len;
|
||||
size_t i;
|
||||
const EVP_CIPHER *evp;
|
||||
int ivlen = 8;
|
||||
int authlen = 0;
|
||||
|
||||
/* skip any blank spaces */
|
||||
while (isspace((unsigned char)*decode))
|
||||
decode++;
|
||||
|
||||
colon = strchr(decode, ':');
|
||||
if (colon == NULL) {
|
||||
printf("failed to decode espsecret: %s\n", decode);
|
||||
return;
|
||||
}
|
||||
*colon = '\0';
|
||||
|
||||
len = colon - decode;
|
||||
if (strlen(decode) > strlen("-hmac96") &&
|
||||
!strcmp(decode + strlen(decode) - strlen("-hmac96"),
|
||||
"-hmac96")) {
|
||||
p = strstr(decode, "-hmac96");
|
||||
*p = '\0';
|
||||
authlen = 12;
|
||||
}
|
||||
if (strlen(decode) > strlen("-cbc") &&
|
||||
!strcmp(decode + strlen(decode) - strlen("-cbc"), "-cbc")) {
|
||||
p = strstr(decode, "-cbc");
|
||||
*p = '\0';
|
||||
}
|
||||
evp = EVP_get_cipherbyname(decode);
|
||||
if (!evp) {
|
||||
printf("failed to find cipher algo %s\n", decode);
|
||||
sa1.evp = NULL;
|
||||
sa1.authlen = 0;
|
||||
sa1.ivlen = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
sa1.evp = evp;
|
||||
sa1.authlen = authlen;
|
||||
sa1.ivlen = ivlen;
|
||||
|
||||
colon++;
|
||||
if (colon[0] == '0' && colon[1] == 'x') {
|
||||
/* decode some hex! */
|
||||
colon += 2;
|
||||
len = strlen(colon) / 2;
|
||||
|
||||
if (len > 256) {
|
||||
printf("secret is too big: %d\n", len);
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (colon[0] != '\0' && colon[1]!='\0') {
|
||||
espsecret_key[i] = hex2byte(colon);
|
||||
colon += 2;
|
||||
i++;
|
||||
}
|
||||
|
||||
memcpy(sa1.secret, espsecret_key, i);
|
||||
sa1.secretlen = i;
|
||||
} else {
|
||||
i = strlen(colon);
|
||||
|
||||
if (i < sizeof(sa1.secret)) {
|
||||
memcpy(sa1.secret, colon, i);
|
||||
sa1.secretlen = i;
|
||||
} else {
|
||||
memcpy(sa1.secret, colon, sizeof(sa1.secret));
|
||||
sa1.secretlen = sizeof(sa1.secret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
esp_print_addsa(&sa1, sa_def);
|
||||
}
|
||||
|
||||
static void esp_print_decodesecret(void)
|
||||
{
|
||||
char *colon;
|
||||
int len, i;
|
||||
struct esp_algorithm *xf;
|
||||
char *line;
|
||||
char *p;
|
||||
|
||||
if(espsecret == NULL) {
|
||||
/* set to NONE transform */
|
||||
espsecret_xform = esp_xforms;
|
||||
return;
|
||||
}
|
||||
p = espsecret;
|
||||
|
||||
if(espsecret_key != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
colon = strchr(espsecret, ':');
|
||||
if(colon == NULL) {
|
||||
printf("failed to decode espsecret: %s\n",
|
||||
espsecret);
|
||||
/* set to NONE transform */
|
||||
espsecret_xform = esp_xforms;
|
||||
}
|
||||
|
||||
len = colon - espsecret;
|
||||
xf = esp_xforms;
|
||||
while(xf->name && strncasecmp(espsecret, xf->name, len)!=0) {
|
||||
xf++;
|
||||
}
|
||||
if(xf->name == NULL) {
|
||||
printf("failed to find cipher algo %s\n",
|
||||
espsecret);
|
||||
espsecret_xform = esp_xforms;
|
||||
return;
|
||||
}
|
||||
espsecret_xform = xf;
|
||||
|
||||
colon++;
|
||||
if(colon[0]=='0' && colon[1]=='x') {
|
||||
/* decode some hex! */
|
||||
colon+=2;
|
||||
len = strlen(colon) / 2;
|
||||
espsecret_key = (char *)malloc(len);
|
||||
if(espsecret_key == NULL) {
|
||||
fprintf(stderr, "%s: ran out of memory (%d) to allocate secret key\n",
|
||||
program_name, len);
|
||||
exit(2);
|
||||
while (espsecret && espsecret[0] != '\0') {
|
||||
/* pick out the first line or first thing until a comma */
|
||||
if ((line = strsep(&espsecret, "\n,")) == NULL) {
|
||||
line = espsecret;
|
||||
espsecret = NULL;
|
||||
}
|
||||
i = 0;
|
||||
while(colon[0] != '\0' && colon[1]!='\0') {
|
||||
espsecret_key[i]=hex2byte(colon);
|
||||
colon+=2;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
espsecret_key = colon;
|
||||
|
||||
esp_print_decode_onesecret(line);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
esp_print(register const u_char *bp, register const u_char *bp2,
|
||||
int *nhdr, int *padlen)
|
||||
static void esp_init(void)
|
||||
{
|
||||
register const struct esp *esp;
|
||||
|
||||
OpenSSL_add_all_algorithms();
|
||||
EVP_add_cipher_alias(SN_des_ede3_cbc, "3des");
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
esp_print(const u_char *bp, const u_char *bp2
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
,
|
||||
int *nhdr
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
,
|
||||
int *padlen
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
)
|
||||
{
|
||||
register const struct newesp *esp;
|
||||
register const u_char *ep;
|
||||
u_int32_t spi;
|
||||
struct ip *ip = NULL;
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
struct ip *ip;
|
||||
struct sa_list *sa = NULL;
|
||||
int espsecret_keylen;
|
||||
#ifdef INET6
|
||||
struct ip6_hdr *ip6 = NULL;
|
||||
#endif
|
||||
@ -195,11 +362,23 @@ esp_print(register const u_char *bp, register const u_char *bp2,
|
||||
char *secret;
|
||||
int ivlen = 0;
|
||||
u_char *ivoff;
|
||||
u_char *p;
|
||||
|
||||
esp = (struct esp *)bp;
|
||||
spi = (u_int32_t)ntohl(esp->esp_spi);
|
||||
const u_char *p;
|
||||
EVP_CIPHER_CTX ctx;
|
||||
int blocksz;
|
||||
static int initialized = 0;
|
||||
#endif
|
||||
|
||||
esp = (struct newesp *)bp;
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
secret = NULL;
|
||||
advance = 0;
|
||||
|
||||
if (!initialized) {
|
||||
esp_init();
|
||||
initialized = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* keep secret out of a register */
|
||||
@ -209,187 +388,109 @@ esp_print(register const u_char *bp, register const u_char *bp2,
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
if ((u_char *)(esp + 1) >= ep - sizeof(struct esp)) {
|
||||
if ((u_char *)(esp + 1) >= ep) {
|
||||
fputs("[|ESP]", stdout);
|
||||
goto fail;
|
||||
}
|
||||
printf("ESP(spi=0x%08x", spi);
|
||||
printf(",seq=0x%x", (u_int32_t)ntohl(*(u_int32_t *)(esp + 1)));
|
||||
printf("ESP(spi=0x%08x", EXTRACT_32BITS(&esp->esp_spi));
|
||||
printf(",seq=0x%x", EXTRACT_32BITS(&esp->esp_seq));
|
||||
printf(")");
|
||||
|
||||
/* if we don't have decryption key, we can't decrypt this packet. */
|
||||
if (!espsecret)
|
||||
goto fail;
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
goto fail;
|
||||
#else
|
||||
/* initiailize SAs */
|
||||
if (sa_list_head == NULL) {
|
||||
if (!espsecret)
|
||||
goto fail;
|
||||
|
||||
if(!espsecret_xform) {
|
||||
esp_print_decodesecret();
|
||||
}
|
||||
if(espsecret_xform->algo == NONE) {
|
||||
|
||||
if (sa_list_head == NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ip = (struct ip *)bp2;
|
||||
switch (IP_V(ip)) {
|
||||
#ifdef INET6
|
||||
case 6:
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
ip = NULL;
|
||||
/* we do not attempt to decrypt jumbograms */
|
||||
if (!ntohs(ip6->ip6_plen))
|
||||
if (!EXTRACT_16BITS(&ip6->ip6_plen))
|
||||
goto fail;
|
||||
/* if we can't get nexthdr, we do not need to decrypt it */
|
||||
len = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen);
|
||||
len = sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen);
|
||||
|
||||
/* see if we can find the SA, and if so, decode it */
|
||||
for (sa = sa_list_head; sa != NULL; sa = sa->next) {
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa->daddr;
|
||||
if (sa->spi == ntohl(esp->esp_spi) &&
|
||||
sin6->sin6_family == AF_INET6 &&
|
||||
memcmp(&sin6->sin6_addr, &ip6->ip6_dst,
|
||||
sizeof(struct in6_addr)) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /*INET6*/
|
||||
case 4:
|
||||
/* nexthdr & padding are in the last fragment */
|
||||
if (ntohs(ip->ip_off) & IP_MF)
|
||||
if (EXTRACT_16BITS(&ip->ip_off) & IP_MF)
|
||||
goto fail;
|
||||
#ifdef INET6
|
||||
ip6 = NULL;
|
||||
#endif
|
||||
len = ntohs(ip->ip_len);
|
||||
len = EXTRACT_16BITS(&ip->ip_len);
|
||||
|
||||
/* see if we can find the SA, and if so, decode it */
|
||||
for (sa = sa_list_head; sa != NULL; sa = sa->next) {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)&sa->daddr;
|
||||
if (sa->spi == ntohl(esp->esp_spi) &&
|
||||
sin->sin_family == AF_INET &&
|
||||
sin->sin_addr.s_addr == ip->ip_dst.s_addr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* if we didn't find the specific one, then look for
|
||||
* an unspecified one.
|
||||
*/
|
||||
if (sa == NULL)
|
||||
sa = sa_default;
|
||||
|
||||
/* if not found fail */
|
||||
if (sa == NULL)
|
||||
goto fail;
|
||||
|
||||
/* if we can't get nexthdr, we do not need to decrypt it */
|
||||
if (ep - bp2 < len)
|
||||
goto fail;
|
||||
|
||||
ivoff = (u_char *)(esp + 1) + espsecret_xform->replaysize;
|
||||
ivlen = espsecret_xform->ivlen;
|
||||
secret = espsecret_key;
|
||||
|
||||
switch (espsecret_xform->algo) {
|
||||
case DESCBC:
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
{
|
||||
u_char iv[8];
|
||||
des_key_schedule schedule;
|
||||
|
||||
switch (ivlen) {
|
||||
case 4:
|
||||
memcpy(iv, ivoff, 4);
|
||||
memcpy(&iv[4], ivoff, 4);
|
||||
p = &iv[4];
|
||||
*p++ ^= 0xff;
|
||||
*p++ ^= 0xff;
|
||||
*p++ ^= 0xff;
|
||||
*p++ ^= 0xff;
|
||||
break;
|
||||
case 8:
|
||||
memcpy(iv, ivoff, 8);
|
||||
break;
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
|
||||
des_check_key = 0;
|
||||
des_set_key((void *)secret, schedule);
|
||||
|
||||
p = ivoff + ivlen;
|
||||
des_cbc_encrypt((void *)p, (void *)p,
|
||||
(long)(ep - p), schedule, (void *)iv,
|
||||
DES_DECRYPT);
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case BLOWFISH:
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
{
|
||||
BF_KEY schedule;
|
||||
|
||||
BF_set_key(&schedule, strlen(secret), secret);
|
||||
|
||||
p = ivoff + ivlen;
|
||||
BF_cbc_encrypt(p, p, (long)(ep - p), &schedule, ivoff,
|
||||
BF_DECRYPT);
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case RC5:
|
||||
#if defined(HAVE_LIBCRYPTO) && defined(HAVE_RC5_H)
|
||||
{
|
||||
RC5_32_KEY schedule;
|
||||
|
||||
RC5_32_set_key(&schedule, strlen(secret), secret,
|
||||
RC5_16_ROUNDS);
|
||||
|
||||
p = ivoff + ivlen;
|
||||
RC5_32_cbc_encrypt(p, p, (long)(ep - p), &schedule, ivoff,
|
||||
RC5_DECRYPT);
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case CAST128:
|
||||
#if defined(HAVE_LIBCRYPTO) && defined(HAVE_CAST_H) && !defined(HAVE_BUGGY_CAST128)
|
||||
{
|
||||
CAST_KEY schedule;
|
||||
|
||||
CAST_set_key(&schedule, strlen(secret), secret);
|
||||
|
||||
p = ivoff + ivlen;
|
||||
CAST_cbc_encrypt(p, p, (long)(ep - p), &schedule, ivoff,
|
||||
CAST_DECRYPT);
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case DES3CBC:
|
||||
#if defined(HAVE_LIBCRYPTO)
|
||||
{
|
||||
des_key_schedule s1, s2, s3;
|
||||
|
||||
des_check_key = 1;
|
||||
des_set_odd_parity((void *)secret);
|
||||
des_set_odd_parity((void *)(secret + 8));
|
||||
des_set_odd_parity((void *)(secret + 16));
|
||||
if(des_set_key((void *)secret, s1) != 0) {
|
||||
printf("failed to schedule key 1\n");
|
||||
}
|
||||
if(des_set_key((void *)(secret + 8), s2)!=0) {
|
||||
printf("failed to schedule key 2\n");
|
||||
}
|
||||
if(des_set_key((void *)(secret + 16), s3)!=0) {
|
||||
printf("failed to schedule key 3\n");
|
||||
}
|
||||
|
||||
p = ivoff + ivlen;
|
||||
des_ede3_cbc_encrypt((void *)p, (void *)p,
|
||||
(long)(ep - p),
|
||||
s1, s2, s3,
|
||||
(void *)ivoff, DES_DECRYPT);
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case NONE:
|
||||
default:
|
||||
advance = sizeof(struct esp) + espsecret_xform->replaysize;
|
||||
break;
|
||||
if (ep - bp2 > len) {
|
||||
/* FCS included at end of frame (NetBSD 1.6 or later) */
|
||||
ep = bp2 + len;
|
||||
}
|
||||
|
||||
ep = ep - espsecret_xform->authlen;
|
||||
ivoff = (u_char *)(esp + 1) + 0;
|
||||
ivlen = sa->ivlen;
|
||||
secret = sa->secret;
|
||||
espsecret_keylen = sa->secretlen;
|
||||
|
||||
if (sa->evp) {
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
if (EVP_CipherInit(&ctx, sa->evp, secret, NULL, 0) < 0)
|
||||
printf("espkey init failed");
|
||||
|
||||
blocksz = EVP_CIPHER_CTX_block_size(&ctx);
|
||||
|
||||
p = ivoff;
|
||||
EVP_CipherInit(&ctx, NULL, NULL, p, 0);
|
||||
EVP_Cipher(&ctx, p + ivlen, p + ivlen, ep - (p + ivlen));
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
} else
|
||||
advance = sizeof(struct newesp);
|
||||
|
||||
ep = ep - sa->authlen;
|
||||
/* sanity check for pad length */
|
||||
if (ep - bp < *(ep - 2))
|
||||
goto fail;
|
||||
@ -402,9 +503,8 @@ esp_print(register const u_char *bp, register const u_char *bp2,
|
||||
|
||||
printf(": ");
|
||||
return advance;
|
||||
#endif
|
||||
|
||||
fail:
|
||||
if (nhdr)
|
||||
*nhdr = -1;
|
||||
return 65536;
|
||||
return -1;
|
||||
}
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.13 2001/09/17 21:58:02 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.16.2.3 2003/11/19 00:35:43 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -30,13 +30,7 @@ static const char rcsid[] =
|
||||
|
||||
#ifdef INET6
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -44,6 +38,7 @@ static const char rcsid[] =
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
int
|
||||
frag6_print(register const u_char *bp, register const u_char *bp2)
|
||||
@ -62,21 +57,21 @@ frag6_print(register const u_char *bp, register const u_char *bp2)
|
||||
|
||||
if (vflag) {
|
||||
printf("frag (0x%08x:%d|%ld)",
|
||||
(u_int32_t)ntohl(dp->ip6f_ident),
|
||||
ntohs(dp->ip6f_offlg & IP6F_OFF_MASK),
|
||||
sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) -
|
||||
EXTRACT_32BITS(&dp->ip6f_ident),
|
||||
EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
|
||||
sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
|
||||
(long)(bp - bp2) - sizeof(struct ip6_frag));
|
||||
} else {
|
||||
printf("frag (%d|%ld)",
|
||||
ntohs(dp->ip6f_offlg & IP6F_OFF_MASK),
|
||||
sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen) -
|
||||
EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK,
|
||||
sizeof(struct ip6_hdr) + EXTRACT_16BITS(&ip6->ip6_plen) -
|
||||
(long)(bp - bp2) - sizeof(struct ip6_frag));
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* it is meaningless to decode non-first fragment */
|
||||
if (ntohs(dp->ip6f_offlg & IP6F_OFF_MASK) != 0)
|
||||
return 65535;
|
||||
if ((EXTRACT_16BITS(&dp->ip6f_offlg) & IP6F_OFF_MASK) != 0)
|
||||
return -1;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@ -85,7 +80,7 @@ frag6_print(register const u_char *bp, register const u_char *bp2)
|
||||
}
|
||||
trunc:
|
||||
fputs("[|frag]", stdout);
|
||||
return 65535;
|
||||
return -1;
|
||||
#undef TCHECK
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
@ -1,175 +1,373 @@
|
||||
/* $OpenBSD: print-gre.c,v 1.6 2002/10/30 03:04:04 fgsch Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Lawrence Berkeley Laboratory,
|
||||
* Berkeley, CA. The name of the University may not 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Jason L. Wright
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* Initial contribution from John Hawkinson <jhawk@bbnplanet.com>
|
||||
*
|
||||
* This module implements support for decoding GRE (Generic Routing
|
||||
* Encapsulation) tunnels; they're documented in RFC1701 and RFC1702.
|
||||
* This code only supports the IP encapsulation thereof.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* tcpdump filter for GRE - Generic Routing Encapsulation
|
||||
* RFC1701 (GRE), RFC1702 (GRE IPv4), and RFC2637 (Enhanced GRE)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.13.4.1 2002/06/01 23:51:13 guy Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.22.2.2 2003/11/16 08:51:24 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
#include "extract.h"
|
||||
|
||||
struct gre {
|
||||
u_int16_t flags;
|
||||
u_int16_t proto;
|
||||
};
|
||||
#include "ip.h"
|
||||
|
||||
/* RFC 2784 - GRE */
|
||||
#define GRE_CP 0x8000 /* Checksum Present */
|
||||
#define GRE_VER_MASK 0x0007 /* Version */
|
||||
#define GRE_CP 0x8000 /* checksum present */
|
||||
#define GRE_RP 0x4000 /* routing present */
|
||||
#define GRE_KP 0x2000 /* key present */
|
||||
#define GRE_SP 0x1000 /* sequence# present */
|
||||
#define GRE_sP 0x0800 /* source routing */
|
||||
#define GRE_RECRS 0x0700 /* recursion count */
|
||||
#define GRE_AP 0x0080 /* acknowledgment# present */
|
||||
#define GRE_VERS 0x0007 /* protocol version */
|
||||
|
||||
/* RFC 2890 - Key and Sequence extensions to GRE */
|
||||
#define GRE_KP 0x2000 /* Key Present */
|
||||
#define GRE_SP 0x1000 /* Sequence Present */
|
||||
#define GREPROTO_IP 0x0800 /* IP */
|
||||
#define GREPROTO_PPP 0x880b /* PPTP */
|
||||
#define GREPROTO_ISO 0x00fe /* OSI */
|
||||
|
||||
/* Legacy from RFC 1700 */
|
||||
#define GRE_RP 0x4000 /* Routing Present */
|
||||
#define GRE_sP 0x0800 /* strict source route present */
|
||||
#define GRE_RECUR_MASK 0x0700 /* Recursion Control */
|
||||
#define GRE_RECUR_SHIFT 8
|
||||
/* source route entry types */
|
||||
#define GRESRE_IP 0x0800 /* IP */
|
||||
#define GRESRE_ASN 0xfffe /* ASN */
|
||||
|
||||
#define GRE_COP (GRE_RP|GRE_CP) /* Checksum & Offset Present */
|
||||
void gre_print_0(const u_char *, u_int);
|
||||
void gre_print_1(const u_char *, u_int);
|
||||
void gre_sre_print(u_int16_t, u_int8_t, u_int8_t, const u_char *, u_int);
|
||||
void gre_sre_ip_print(u_int8_t, u_int8_t, const u_char *, u_int);
|
||||
void gre_sre_asn_print(u_int8_t, u_int8_t, const u_char *, u_int);
|
||||
|
||||
/* "Enhanced GRE" from RFC2637 - PPTP */
|
||||
#define GRE_AP 0x0080 /* Ack present */
|
||||
|
||||
#define GRE_MBZ_MASK 0x0078 /* not defined */
|
||||
|
||||
/*
|
||||
* Deencapsulate and print a GRE-tunneled IP datagram
|
||||
*/
|
||||
void
|
||||
gre_print(const u_char *bp, u_int length)
|
||||
{
|
||||
const u_char *cp = bp + 4;
|
||||
const struct gre *gre;
|
||||
u_int16_t flags, proto;
|
||||
u_short ver=0;
|
||||
u_short extracted_ethertype;
|
||||
u_int len = length, vers;
|
||||
|
||||
gre = (const struct gre *)bp;
|
||||
|
||||
TCHECK(gre->proto);
|
||||
flags = EXTRACT_16BITS(&gre->flags);
|
||||
proto = EXTRACT_16BITS(&gre->proto);
|
||||
(void)printf("gre ");
|
||||
|
||||
if (flags) {
|
||||
/* Decode the flags */
|
||||
putchar('[');
|
||||
if (flags & GRE_CP)
|
||||
putchar('C');
|
||||
if (flags & GRE_RP)
|
||||
putchar('R');
|
||||
if (flags & GRE_KP)
|
||||
putchar('K');
|
||||
if (flags & GRE_SP)
|
||||
putchar('S');
|
||||
if (flags & GRE_sP)
|
||||
putchar('s');
|
||||
if (flags & GRE_AP)
|
||||
putchar('A');
|
||||
if (flags & GRE_RECUR_MASK)
|
||||
printf("R%x", (flags & GRE_RECUR_MASK) >> GRE_RECUR_SHIFT);
|
||||
ver = flags & GRE_VER_MASK;
|
||||
printf("v%u", ver);
|
||||
|
||||
if (flags & GRE_MBZ_MASK)
|
||||
printf("!%x", flags & GRE_MBZ_MASK);
|
||||
fputs("] ", stdout);
|
||||
}
|
||||
|
||||
if (flags & GRE_COP) {
|
||||
int checksum, offset;
|
||||
|
||||
TCHECK2(*cp, 4);
|
||||
checksum = EXTRACT_16BITS(cp);
|
||||
offset = EXTRACT_16BITS(cp + 2);
|
||||
|
||||
if (flags & GRE_CP) {
|
||||
/* Checksum present */
|
||||
|
||||
/* todo: check checksum */
|
||||
if (vflag > 1)
|
||||
printf("C:%04x ", checksum);
|
||||
}
|
||||
if (flags & GRE_RP) {
|
||||
/* Offset present */
|
||||
|
||||
if (vflag > 1)
|
||||
printf("O:%04x ", offset);
|
||||
}
|
||||
cp += 4; /* skip checksum and offset */
|
||||
}
|
||||
if (flags & GRE_KP) {
|
||||
TCHECK2(*cp, 4);
|
||||
if (ver == 1) { /* PPTP */
|
||||
if (vflag > 1)
|
||||
printf("PL:%u ", EXTRACT_16BITS(cp));
|
||||
printf("ID:%04x ", EXTRACT_16BITS(cp+2));
|
||||
}
|
||||
else
|
||||
printf("K:%08x ", EXTRACT_32BITS(cp));
|
||||
cp += 4; /* skip key */
|
||||
}
|
||||
if (flags & GRE_SP) {
|
||||
TCHECK2(*cp, 4);
|
||||
printf("S:%u ", EXTRACT_32BITS(cp));
|
||||
cp += 4; /* skip seq */
|
||||
}
|
||||
if (flags & GRE_AP && ver >= 1) {
|
||||
TCHECK2(*cp, 4);
|
||||
printf("A:%u ", EXTRACT_32BITS(cp));
|
||||
cp += 4; /* skip ack */
|
||||
}
|
||||
/* We don't support routing fields (variable length) now. Punt. */
|
||||
if (flags & GRE_RP)
|
||||
if (len < 2) {
|
||||
printf("[|gre]");
|
||||
return;
|
||||
}
|
||||
vers = EXTRACT_16BITS(bp) & 7;
|
||||
|
||||
TCHECK(cp[0]);
|
||||
if (vers == 0)
|
||||
gre_print_0(bp, len);
|
||||
else if (vers == 1)
|
||||
gre_print_1(bp, len);
|
||||
else
|
||||
printf("gre-unknown-version=%u", vers);
|
||||
return;
|
||||
|
||||
length -= cp - bp;
|
||||
if (ether_encap_print(proto, cp, length, length,
|
||||
&extracted_ethertype) == 0)
|
||||
printf("gre-proto-0x%04X", proto);
|
||||
}
|
||||
|
||||
void
|
||||
gre_print_0(const u_char *bp, u_int length)
|
||||
{
|
||||
u_int len = length;
|
||||
u_int16_t flags, prot;
|
||||
|
||||
flags = EXTRACT_16BITS(bp);
|
||||
if (vflag) {
|
||||
printf("[%s%s%s%s%s] ",
|
||||
(flags & GRE_CP) ? "C" : "",
|
||||
(flags & GRE_RP) ? "R" : "",
|
||||
(flags & GRE_KP) ? "K" : "",
|
||||
(flags & GRE_SP) ? "S" : "",
|
||||
(flags & GRE_sP) ? "s" : "");
|
||||
}
|
||||
|
||||
len -= 2;
|
||||
bp += 2;
|
||||
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
prot = EXTRACT_16BITS(bp);
|
||||
len -= 2;
|
||||
bp += 2;
|
||||
|
||||
if ((flags & GRE_CP) | (flags & GRE_RP)) {
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
if (vflag)
|
||||
printf("sum 0x%x ", EXTRACT_16BITS(bp));
|
||||
bp += 2;
|
||||
len -= 2;
|
||||
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
printf("off 0x%x ", EXTRACT_16BITS(bp));
|
||||
bp += 2;
|
||||
len -= 2;
|
||||
}
|
||||
|
||||
if (flags & GRE_KP) {
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
printf("key=0x%x ", EXTRACT_32BITS(bp));
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
if (flags & GRE_SP) {
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
printf("seq %u ", EXTRACT_32BITS(bp));
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
if (flags & GRE_RP) {
|
||||
for (;;) {
|
||||
u_int16_t af;
|
||||
u_int8_t sreoff;
|
||||
u_int8_t srelen;
|
||||
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
af = EXTRACT_16BITS(bp);
|
||||
sreoff = *(bp + 2);
|
||||
srelen = *(bp + 3);
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
|
||||
if (af == 0 && srelen == 0)
|
||||
break;
|
||||
|
||||
gre_sre_print(af, sreoff, srelen, bp, len);
|
||||
|
||||
if (len < srelen)
|
||||
goto trunc;
|
||||
bp += srelen;
|
||||
len -= srelen;
|
||||
}
|
||||
}
|
||||
|
||||
switch (prot) {
|
||||
case GREPROTO_IP:
|
||||
ip_print(bp, len);
|
||||
break;
|
||||
case GREPROTO_ISO:
|
||||
isoclns_print(bp, len, len);
|
||||
break;
|
||||
default:
|
||||
printf("gre-proto-0x%x", prot);
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
fputs("[|gre]", stdout);
|
||||
|
||||
printf("[|gre]");
|
||||
}
|
||||
|
||||
void
|
||||
gre_print_1(const u_char *bp, u_int length)
|
||||
{
|
||||
u_int len = length;
|
||||
u_int16_t flags, prot;
|
||||
|
||||
flags = EXTRACT_16BITS(bp);
|
||||
len -= 2;
|
||||
bp += 2;
|
||||
|
||||
if (vflag) {
|
||||
printf("[%s%s%s%s%s%s] ",
|
||||
(flags & GRE_CP) ? "C" : "",
|
||||
(flags & GRE_RP) ? "R" : "",
|
||||
(flags & GRE_KP) ? "K" : "",
|
||||
(flags & GRE_SP) ? "S" : "",
|
||||
(flags & GRE_sP) ? "s" : "",
|
||||
(flags & GRE_AP) ? "A" : "");
|
||||
}
|
||||
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
prot = EXTRACT_16BITS(bp);
|
||||
len -= 2;
|
||||
bp += 2;
|
||||
|
||||
if (flags & GRE_CP) {
|
||||
printf("cpset!");
|
||||
return;
|
||||
}
|
||||
if (flags & GRE_RP) {
|
||||
printf("rpset!");
|
||||
return;
|
||||
}
|
||||
if ((flags & GRE_KP) == 0) {
|
||||
printf("kpunset!");
|
||||
return;
|
||||
}
|
||||
if (flags & GRE_sP) {
|
||||
printf("spset!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags & GRE_KP) {
|
||||
u_int32_t k;
|
||||
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
k = EXTRACT_32BITS(bp);
|
||||
printf("call %d ", k & 0xffff);
|
||||
len -= 4;
|
||||
bp += 4;
|
||||
}
|
||||
|
||||
if (flags & GRE_SP) {
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
printf("seq %u ", EXTRACT_32BITS(bp));
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
if (flags & GRE_AP) {
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
printf("ack %u ", EXTRACT_32BITS(bp));
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
if ((flags & GRE_SP) == 0) {
|
||||
printf("no-payload");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (prot) {
|
||||
case GREPROTO_PPP:
|
||||
printf("gre-ppp-payload");
|
||||
break;
|
||||
default:
|
||||
printf("gre-proto-0x%x", prot);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|gre]");
|
||||
}
|
||||
|
||||
void
|
||||
gre_sre_print(u_int16_t af, u_int8_t sreoff, u_int8_t srelen,
|
||||
const u_char *bp, u_int len)
|
||||
{
|
||||
switch (af) {
|
||||
case GRESRE_IP:
|
||||
printf("(rtaf=ip");
|
||||
gre_sre_ip_print(sreoff, srelen, bp, len);
|
||||
printf(") ");
|
||||
break;
|
||||
case GRESRE_ASN:
|
||||
printf("(rtaf=asn");
|
||||
gre_sre_asn_print(sreoff, srelen, bp, len);
|
||||
printf(") ");
|
||||
break;
|
||||
default:
|
||||
printf("(rtaf=0x%x) ", af);
|
||||
}
|
||||
}
|
||||
void
|
||||
gre_sre_ip_print(u_int8_t sreoff, u_int8_t srelen, const u_char *bp, u_int len)
|
||||
{
|
||||
struct in_addr a;
|
||||
const u_char *up = bp;
|
||||
|
||||
if (sreoff & 3) {
|
||||
printf(" badoffset=%u", sreoff);
|
||||
return;
|
||||
}
|
||||
if (srelen & 3) {
|
||||
printf(" badlength=%u", srelen);
|
||||
return;
|
||||
}
|
||||
if (sreoff >= srelen) {
|
||||
printf(" badoff/len=%u/%u", sreoff, srelen);
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (len < 4 || srelen == 0)
|
||||
return;
|
||||
|
||||
memcpy(&a, bp, sizeof(a));
|
||||
printf(" %s%s",
|
||||
((bp - up) == sreoff) ? "*" : "",
|
||||
inet_ntoa(a));
|
||||
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
srelen -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gre_sre_asn_print(u_int8_t sreoff, u_int8_t srelen, const u_char *bp, u_int len)
|
||||
{
|
||||
const u_char *up = bp;
|
||||
|
||||
if (sreoff & 1) {
|
||||
printf(" badoffset=%u", sreoff);
|
||||
return;
|
||||
}
|
||||
if (srelen & 1) {
|
||||
printf(" badlength=%u", srelen);
|
||||
return;
|
||||
}
|
||||
if (sreoff >= srelen) {
|
||||
printf(" badoff/len=%u/%u", sreoff, srelen);
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (len < 2 || srelen == 0)
|
||||
return;
|
||||
|
||||
printf(" %s%x",
|
||||
((bp - up) == sreoff) ? "*" : "",
|
||||
EXTRACT_16BITS(bp));
|
||||
|
||||
bp += 2;
|
||||
len -= 2;
|
||||
srelen -= 2;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Julian Cowley
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -30,18 +30,17 @@
|
||||
/* Cisco Hot Standby Router Protocol (HSRP). */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.2 2001/10/08 16:12:37 fenner Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.7.2.2 2003/11/16 08:51:24 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
@ -86,20 +85,20 @@ static struct tok states[] = {
|
||||
|
||||
/* HSRP protocol header. */
|
||||
struct hsrp {
|
||||
u_char hsrp_version;
|
||||
u_char hsrp_op_code;
|
||||
u_char hsrp_state;
|
||||
u_char hsrp_hellotime;
|
||||
u_char hsrp_holdtime;
|
||||
u_char hsrp_priority;
|
||||
u_char hsrp_group;
|
||||
u_char hsrp_reserved;
|
||||
u_char hsrp_authdata[HSRP_AUTH_SIZE];
|
||||
u_int8_t hsrp_version;
|
||||
u_int8_t hsrp_op_code;
|
||||
u_int8_t hsrp_state;
|
||||
u_int8_t hsrp_hellotime;
|
||||
u_int8_t hsrp_holdtime;
|
||||
u_int8_t hsrp_priority;
|
||||
u_int8_t hsrp_group;
|
||||
u_int8_t hsrp_reserved;
|
||||
u_int8_t hsrp_authdata[HSRP_AUTH_SIZE];
|
||||
struct in_addr hsrp_virtaddr;
|
||||
};
|
||||
|
||||
void
|
||||
hsrp_print(register const u_char *bp, register u_int len)
|
||||
hsrp_print(register const u_int8_t *bp, register u_int len)
|
||||
{
|
||||
struct hsrp *hp = (struct hsrp *) bp;
|
||||
|
||||
@ -119,7 +118,7 @@ hsrp_print(register const u_char *bp, register u_int len)
|
||||
if (hp->hsrp_reserved != 0) {
|
||||
printf("[reserved=%d!] ", hp->hsrp_reserved);
|
||||
}
|
||||
TCHECK2(hp->hsrp_virtaddr, sizeof(hp->hsrp_virtaddr));
|
||||
TCHECK(hp->hsrp_virtaddr);
|
||||
printf("addr=%s", ipaddr_string(&hp->hsrp_virtaddr));
|
||||
if (vflag) {
|
||||
printf(" hellotime=");
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.56.4.1 2002/05/31 10:08:31 guy Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.72.2.4 2004/03/24 00:14:09 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -30,27 +30,18 @@ static const char rcsid[] =
|
||||
|
||||
#ifdef INET6
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "ip6.h"
|
||||
#include "icmp6.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "udp.h"
|
||||
#include "ah.h"
|
||||
@ -58,12 +49,12 @@ static const char rcsid[] =
|
||||
static const char *get_rtpref(u_int);
|
||||
static const char *get_lifetime(u_int32_t);
|
||||
static void print_lladdr(const u_char *, size_t);
|
||||
void icmp6_opt_print(const u_char *, int);
|
||||
void mld6_print(const u_char *);
|
||||
static struct udphdr *get_upperlayer(u_char *, int *);
|
||||
static void icmp6_opt_print(const u_char *, int);
|
||||
static void mld6_print(const u_char *);
|
||||
static struct udphdr *get_upperlayer(u_char *, u_int *);
|
||||
static void dnsname_print(const u_char *, const u_char *);
|
||||
void icmp6_nodeinfo_print(int, const u_char *, const u_char *);
|
||||
void icmp6_rrenum_print(int, const u_char *, const u_char *);
|
||||
static void icmp6_nodeinfo_print(u_int, const u_char *, const u_char *);
|
||||
static void icmp6_rrenum_print(const u_char *, const u_char *);
|
||||
|
||||
#ifndef abs
|
||||
#define abs(a) ((0 < (a)) ? (a) : -(a))
|
||||
@ -110,8 +101,51 @@ print_lladdr(const u_int8_t *p, size_t l)
|
||||
}
|
||||
}
|
||||
|
||||
static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
|
||||
u_int len)
|
||||
{
|
||||
size_t i;
|
||||
register 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_ICMPV6;
|
||||
|
||||
sum = 0;
|
||||
for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
|
||||
sum += phu.pa[i];
|
||||
|
||||
sp = (const u_int16_t *)icp;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
|
||||
{
|
||||
const struct icmp6_hdr *dp;
|
||||
const struct ip6_hdr *ip;
|
||||
@ -121,7 +155,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
int dport;
|
||||
const u_char *ep;
|
||||
char buf[256];
|
||||
int icmp6len, prot;
|
||||
u_int prot;
|
||||
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
ip = (struct ip6_hdr *)bp2;
|
||||
@ -129,13 +163,21 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
str = buf;
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
if (ip->ip6_plen)
|
||||
icmp6len = (ntohs(ip->ip6_plen) + sizeof(struct ip6_hdr) -
|
||||
(bp - bp2));
|
||||
else /* XXX: jumbo payload case... */
|
||||
icmp6len = snapend - bp;
|
||||
|
||||
TCHECK(dp->icmp6_code);
|
||||
TCHECK(dp->icmp6_cksum);
|
||||
|
||||
if (vflag && !fragmented) {
|
||||
int sum = dp->icmp6_cksum;
|
||||
|
||||
if (TTEST2(bp[0], length)) {
|
||||
sum = icmp6_cksum(ip, dp, length);
|
||||
if (sum != 0)
|
||||
(void)printf("[bad icmp6 cksum %x!] ", sum);
|
||||
else
|
||||
(void)printf("[icmp6 sum ok] ");
|
||||
}
|
||||
}
|
||||
|
||||
switch (dp->icmp6_type) {
|
||||
case ICMP6_DST_UNREACH:
|
||||
TCHECK(oip->ip6_dst);
|
||||
@ -162,7 +204,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
== NULL)
|
||||
goto trunc;
|
||||
|
||||
dport = ntohs(ouh->uh_dport);
|
||||
dport = EXTRACT_16BITS(&ouh->uh_dport);
|
||||
switch (prot) {
|
||||
case IPPROTO_TCP:
|
||||
printf("icmp6: %s tcp port %s unreachable",
|
||||
@ -190,7 +232,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
break;
|
||||
case ICMP6_PACKET_TOO_BIG:
|
||||
TCHECK(dp->icmp6_mtu);
|
||||
printf("icmp6: too big %u", (u_int32_t)ntohl(dp->icmp6_mtu));
|
||||
printf("icmp6: too big %u", EXTRACT_32BITS(&dp->icmp6_mtu));
|
||||
break;
|
||||
case ICMP6_TIME_EXCEEDED:
|
||||
TCHECK(oip->ip6_dst);
|
||||
@ -213,15 +255,15 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
switch (dp->icmp6_code) {
|
||||
case ICMP6_PARAMPROB_HEADER:
|
||||
printf("icmp6: parameter problem errorneous - octet %u",
|
||||
(u_int32_t)ntohl(dp->icmp6_pptr));
|
||||
EXTRACT_32BITS(&dp->icmp6_pptr));
|
||||
break;
|
||||
case ICMP6_PARAMPROB_NEXTHEADER:
|
||||
printf("icmp6: parameter problem next header - octet %u",
|
||||
(u_int32_t)ntohl(dp->icmp6_pptr));
|
||||
EXTRACT_32BITS(&dp->icmp6_pptr));
|
||||
break;
|
||||
case ICMP6_PARAMPROB_OPTION:
|
||||
printf("icmp6: parameter problem option - octet %u",
|
||||
(u_int32_t)ntohl(dp->icmp6_pptr));
|
||||
EXTRACT_32BITS(&dp->icmp6_pptr));
|
||||
break;
|
||||
default:
|
||||
printf("icmp6: parameter problem code-#%d",
|
||||
@ -230,10 +272,12 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
}
|
||||
break;
|
||||
case ICMP6_ECHO_REQUEST:
|
||||
printf("icmp6: echo request");
|
||||
break;
|
||||
case ICMP6_ECHO_REPLY:
|
||||
printf("icmp6: echo reply");
|
||||
TCHECK(dp->icmp6_seq);
|
||||
printf("icmp6: echo %s seq %u",
|
||||
dp->icmp6_type == ICMP6_ECHO_REQUEST ?
|
||||
"request" : "reply",
|
||||
EXTRACT_16BITS(&dp->icmp6_seq));
|
||||
break;
|
||||
case ICMP6_MEMBERSHIP_QUERY:
|
||||
printf("icmp6: multicast listener query ");
|
||||
@ -252,7 +296,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
if (vflag) {
|
||||
#define RTSOLLEN 8
|
||||
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
|
||||
icmp6len - RTSOLLEN);
|
||||
length - RTSOLLEN);
|
||||
}
|
||||
break;
|
||||
case ND_ROUTER_ADVERT:
|
||||
@ -277,14 +321,14 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
printf("pref=%s, ",
|
||||
get_rtpref(p->nd_ra_flags_reserved));
|
||||
|
||||
printf("router_ltime=%d, ", ntohs(p->nd_ra_router_lifetime));
|
||||
printf("router_ltime=%d, ", EXTRACT_16BITS(&p->nd_ra_router_lifetime));
|
||||
printf("reachable_time=%u, ",
|
||||
(u_int32_t)ntohl(p->nd_ra_reachable));
|
||||
EXTRACT_32BITS(&p->nd_ra_reachable));
|
||||
printf("retrans_time=%u)",
|
||||
(u_int32_t)ntohl(p->nd_ra_retransmit));
|
||||
EXTRACT_32BITS(&p->nd_ra_retransmit));
|
||||
#define RTADVLEN 16
|
||||
icmp6_opt_print((const u_char *)dp + RTADVLEN,
|
||||
icmp6len - RTADVLEN);
|
||||
length - RTADVLEN);
|
||||
}
|
||||
break;
|
||||
case ND_NEIGHBOR_SOLICIT:
|
||||
@ -297,7 +341,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
if (vflag) {
|
||||
#define NDSOLLEN 24
|
||||
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
|
||||
icmp6len - NDSOLLEN);
|
||||
length - NDSOLLEN);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -329,7 +373,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
}
|
||||
#define NDADVLEN 24
|
||||
icmp6_opt_print((const u_char *)dp + NDADVLEN,
|
||||
icmp6len - NDADVLEN);
|
||||
length - NDADVLEN);
|
||||
#undef NDADVLEN
|
||||
}
|
||||
}
|
||||
@ -339,22 +383,71 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
TCHECK(RDR(dp)->nd_rd_dst);
|
||||
printf("icmp6: redirect %s",
|
||||
getname6((const u_char *)&RDR(dp)->nd_rd_dst));
|
||||
TCHECK(RDR(dp)->nd_rd_target);
|
||||
printf(" to %s",
|
||||
getname6((const u_char*)&RDR(dp)->nd_rd_target));
|
||||
#define REDIRECTLEN 40
|
||||
if (vflag) {
|
||||
icmp6_opt_print((const u_char *)dp + REDIRECTLEN,
|
||||
icmp6len - REDIRECTLEN);
|
||||
length - REDIRECTLEN);
|
||||
}
|
||||
break;
|
||||
#undef REDIRECTLEN
|
||||
#undef RDR
|
||||
case ICMP6_ROUTER_RENUMBERING:
|
||||
icmp6_rrenum_print(icmp6len, bp, ep);
|
||||
icmp6_rrenum_print(bp, ep);
|
||||
break;
|
||||
case ICMP6_NI_QUERY:
|
||||
case ICMP6_NI_REPLY:
|
||||
icmp6_nodeinfo_print(icmp6len, bp, ep);
|
||||
icmp6_nodeinfo_print(length, bp, ep);
|
||||
break;
|
||||
case ICMP6_HADISCOV_REQUEST:
|
||||
printf("icmp6: ha discovery request");
|
||||
if (vflag) {
|
||||
TCHECK(dp->icmp6_data16[0]);
|
||||
printf("(id=%d)", EXTRACT_16BITS(&dp->icmp6_data16[0]));
|
||||
}
|
||||
break;
|
||||
case ICMP6_HADISCOV_REPLY:
|
||||
printf("icmp6: ha discovery reply");
|
||||
if (vflag) {
|
||||
struct in6_addr *in6;
|
||||
u_char *cp;
|
||||
|
||||
TCHECK(dp->icmp6_data16[0]);
|
||||
printf("(id=%d", EXTRACT_16BITS(&dp->icmp6_data16[0]));
|
||||
cp = (u_char *)dp + length;
|
||||
in6 = (struct in6_addr *)(dp + 1);
|
||||
for (; (u_char *)in6 < cp; in6++) {
|
||||
TCHECK(*in6);
|
||||
printf(", %s", ip6addr_string(in6));
|
||||
}
|
||||
printf(")");
|
||||
}
|
||||
break;
|
||||
case ICMP6_MOBILEPREFIX_SOLICIT:
|
||||
printf("icmp6: mobile router solicitation");
|
||||
if (vflag) {
|
||||
TCHECK(dp->icmp6_data16[0]);
|
||||
printf("(id=%d)", EXTRACT_16BITS(&dp->icmp6_data16[0]));
|
||||
}
|
||||
break;
|
||||
case ICMP6_MOBILEPREFIX_ADVERT:
|
||||
printf("icmp6: mobile router advertisement");
|
||||
if (vflag) {
|
||||
TCHECK(dp->icmp6_data16[0]);
|
||||
printf("(id=%d", EXTRACT_16BITS(&dp->icmp6_data16[0]));
|
||||
if (dp->icmp6_data16[1] & 0xc0)
|
||||
printf(" ");
|
||||
if (dp->icmp6_data16[1] & 0x80)
|
||||
printf("M");
|
||||
if (dp->icmp6_data16[1] & 0x40)
|
||||
printf("O");
|
||||
printf(")");
|
||||
#define MPADVLEN 8
|
||||
icmp6_opt_print((const u_char *)dp + MPADVLEN,
|
||||
length - MPADVLEN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("icmp6: type-#%d", dp->icmp6_type);
|
||||
@ -366,7 +459,7 @@ icmp6_print(const u_char *bp, const u_char *bp2)
|
||||
}
|
||||
|
||||
static struct udphdr *
|
||||
get_upperlayer(u_char *bp, int *prot)
|
||||
get_upperlayer(u_char *bp, u_int *prot)
|
||||
{
|
||||
const u_char *ep;
|
||||
struct ip6_hdr *ip6 = (struct ip6_hdr *)bp;
|
||||
@ -374,12 +467,13 @@ get_upperlayer(u_char *bp, int *prot)
|
||||
struct ip6_hbh *hbh;
|
||||
struct ip6_frag *fragh;
|
||||
struct ah *ah;
|
||||
int nh, hlen;
|
||||
u_int nh;
|
||||
int hlen;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
if (TTEST(ip6->ip6_nxt) == 0)
|
||||
if (!TTEST(ip6->ip6_nxt))
|
||||
return NULL;
|
||||
|
||||
nh = ip6->ip6_nxt;
|
||||
@ -404,7 +498,7 @@ get_upperlayer(u_char *bp, int *prot)
|
||||
case IPPROTO_DSTOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
hbh = (struct ip6_hbh *)bp;
|
||||
if (TTEST(hbh->ip6h_len) == 0)
|
||||
if (!TTEST(hbh->ip6h_len))
|
||||
return(NULL);
|
||||
nh = hbh->ip6h_nxt;
|
||||
hlen = (hbh->ip6h_len + 1) << 3;
|
||||
@ -412,10 +506,10 @@ get_upperlayer(u_char *bp, int *prot)
|
||||
|
||||
case IPPROTO_FRAGMENT: /* this should be odd, but try anyway */
|
||||
fragh = (struct ip6_frag *)bp;
|
||||
if (TTEST(fragh->ip6f_offlg) == 0)
|
||||
if (!TTEST(fragh->ip6f_offlg))
|
||||
return(NULL);
|
||||
/* fragments with non-zero offset are meaningless */
|
||||
if ((fragh->ip6f_offlg & IP6F_OFF_MASK) != 0)
|
||||
if ((EXTRACT_16BITS(&fragh->ip6f_offlg) & IP6F_OFF_MASK) != 0)
|
||||
return(NULL);
|
||||
nh = fragh->ip6f_nxt;
|
||||
hlen = sizeof(struct ip6_frag);
|
||||
@ -423,7 +517,7 @@ get_upperlayer(u_char *bp, int *prot)
|
||||
|
||||
case IPPROTO_AH:
|
||||
ah = (struct ah *)bp;
|
||||
if (TTEST(ah->ah_len) == 0)
|
||||
if (!TTEST(ah->ah_len))
|
||||
return(NULL);
|
||||
nh = ah->ah_nxt;
|
||||
hlen = (ah->ah_len + 2) << 2;
|
||||
@ -438,7 +532,7 @@ get_upperlayer(u_char *bp, int *prot)
|
||||
return(NULL); /* should be notreached, though */
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
icmp6_opt_print(const u_char *bp, int resid)
|
||||
{
|
||||
const struct nd_opt_hdr *op;
|
||||
@ -447,6 +541,7 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
const struct icmp6_opts_redirect *opr;
|
||||
const struct nd_opt_mtu *opm;
|
||||
const struct nd_opt_advinterval *opa;
|
||||
const struct nd_opt_homeagent_info *oph;
|
||||
const struct nd_opt_route_info *opri;
|
||||
const u_char *cp, *ep;
|
||||
struct in6_addr in6, *in6p;
|
||||
@ -505,9 +600,9 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
if (opp->nd_opt_pi_flags_reserved)
|
||||
printf(" ");
|
||||
printf("valid_ltime=%s,",
|
||||
get_lifetime((u_int32_t)ntohl(opp->nd_opt_pi_valid_time)));
|
||||
get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_valid_time)));
|
||||
printf("preferred_ltime=%s,",
|
||||
get_lifetime((u_int32_t)ntohl(opp->nd_opt_pi_preferred_time)));
|
||||
get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time)));
|
||||
printf("prefix=%s/%d",
|
||||
ip6addr_string(&opp->nd_opt_pi_prefix),
|
||||
opp->nd_opt_pi_prefix_len);
|
||||
@ -531,7 +626,7 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
printf(" mtu=%u", (u_int32_t)ntohl(opm->nd_opt_mtu_mtu));
|
||||
printf(" mtu=%u", EXTRACT_32BITS(&opm->nd_opt_mtu_mtu));
|
||||
if (opm->nd_opt_mtu_len != 1)
|
||||
printf("!");
|
||||
printf(")");
|
||||
@ -541,10 +636,18 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
TCHECK(opa->nd_opt_adv_interval);
|
||||
printf("(advint:"); /*)*/
|
||||
printf(" advint=%u",
|
||||
(u_int32_t)ntohl(opa->nd_opt_adv_interval));
|
||||
EXTRACT_32BITS(&opa->nd_opt_adv_interval));
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
break;
|
||||
case ND_OPT_HOMEAGENT_INFO:
|
||||
oph = (struct nd_opt_homeagent_info *)op;
|
||||
TCHECK(oph->nd_opt_hai_lifetime);
|
||||
printf("(ha info:"); /*)*/
|
||||
printf(" pref=%d", EXTRACT_16BITS(&oph->nd_opt_hai_preference));
|
||||
printf(", lifetime=%u", EXTRACT_16BITS(&oph->nd_opt_hai_lifetime));
|
||||
printf(")");
|
||||
break;
|
||||
case ND_OPT_ROUTE_INFO:
|
||||
opri = (struct nd_opt_route_info *)op;
|
||||
TCHECK(opri->nd_opt_rti_lifetime);
|
||||
@ -569,7 +672,7 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
opri->nd_opt_rti_prefixlen);
|
||||
printf(", pref=%s", get_rtpref(opri->nd_opt_rti_flags));
|
||||
printf(", lifetime=%s",
|
||||
get_lifetime((u_int32_t)ntohl(opri->nd_opt_rti_lifetime)));
|
||||
get_lifetime(EXTRACT_32BITS(&opri->nd_opt_rti_lifetime)));
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
@ -590,7 +693,7 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
#undef ECHECK
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mld6_print(const u_char *bp)
|
||||
{
|
||||
struct mld6_hdr *mp = (struct mld6_hdr *)bp;
|
||||
@ -602,7 +705,7 @@ mld6_print(const u_char *bp)
|
||||
if ((u_char *)mp + sizeof(*mp) > ep)
|
||||
return;
|
||||
|
||||
printf("max resp delay: %d ", ntohs(mp->mld6_maxdelay));
|
||||
printf("max resp delay: %d ", EXTRACT_16BITS(&mp->mld6_maxdelay));
|
||||
printf("addr: %s", ip6addr_string(&mp->mld6_addr));
|
||||
}
|
||||
|
||||
@ -642,15 +745,17 @@ dnsname_print(const u_char *cp, const u_char *ep)
|
||||
printf("\"");
|
||||
}
|
||||
|
||||
void
|
||||
icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
static void
|
||||
icmp6_nodeinfo_print(u_int icmp6len, const u_char *bp, const u_char *ep)
|
||||
{
|
||||
struct icmp6_nodeinfo *ni6;
|
||||
struct icmp6_hdr *dp;
|
||||
const u_char *cp;
|
||||
int siz, i;
|
||||
size_t siz, i;
|
||||
int needcomma;
|
||||
|
||||
if (ep < bp)
|
||||
return;
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
ni6 = (struct icmp6_nodeinfo *)bp;
|
||||
siz = ep - bp;
|
||||
@ -667,13 +772,13 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
TCHECK2(*dp, sizeof(*ni6));
|
||||
ni6 = (struct icmp6_nodeinfo *)dp;
|
||||
printf(" ("); /*)*/
|
||||
switch (ntohs(ni6->ni_qtype)) {
|
||||
switch (EXTRACT_16BITS(&ni6->ni_qtype)) {
|
||||
case NI_QTYPE_NOOP:
|
||||
printf("noop");
|
||||
break;
|
||||
case NI_QTYPE_SUPTYPES:
|
||||
printf("supported qtypes");
|
||||
i = ntohs(ni6->ni_flags);
|
||||
i = EXTRACT_16BITS(&ni6->ni_flags);
|
||||
if (i)
|
||||
printf(" [%s]", (i & 0x01) ? "C" : "");
|
||||
break;
|
||||
@ -809,7 +914,7 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ntohs(ni6->ni_qtype)) {
|
||||
switch (EXTRACT_16BITS(&ni6->ni_qtype)) {
|
||||
case NI_QTYPE_NOOP:
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
@ -822,7 +927,7 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
printf("supported qtypes");
|
||||
i = ntohs(ni6->ni_flags);
|
||||
i = EXTRACT_16BITS(&ni6->ni_flags);
|
||||
if (i)
|
||||
printf(" [%s]", (i & 0x01) ? "C" : "");
|
||||
break;
|
||||
@ -844,7 +949,7 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
printf("\"");
|
||||
} else
|
||||
dnsname_print(cp, ep);
|
||||
if ((ntohs(ni6->ni_flags) & 0x01) != 0)
|
||||
if ((EXTRACT_16BITS(&ni6->ni_flags) & 0x01) != 0)
|
||||
printf(" [TTL=%u]", *(u_int32_t *)(ni6 + 1));
|
||||
break;
|
||||
case NI_QTYPE_NODEADDR:
|
||||
@ -857,7 +962,7 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
break;
|
||||
printf(" %s", getname6(bp + i));
|
||||
i += sizeof(struct in6_addr);
|
||||
printf("(%d)", (int32_t)ntohl(*(int32_t *)(bp + i)));
|
||||
printf("(%d)", (int32_t)EXTRACT_32BITS(bp + i));
|
||||
i += sizeof(int32_t);
|
||||
}
|
||||
i = ni6->ni_flags;
|
||||
@ -889,8 +994,8 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
fputs("[|icmp6]", stdout);
|
||||
}
|
||||
|
||||
void
|
||||
icmp6_rrenum_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
static void
|
||||
icmp6_rrenum_print(const u_char *bp, const u_char *ep)
|
||||
{
|
||||
struct icmp6_router_renum *rr6;
|
||||
struct icmp6_hdr *dp;
|
||||
@ -901,6 +1006,8 @@ icmp6_rrenum_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
char hbuf[NI_MAXHOST];
|
||||
int n;
|
||||
|
||||
if (ep < bp)
|
||||
return;
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
rr6 = (struct icmp6_router_renum *)bp;
|
||||
siz = ep - bp;
|
||||
@ -922,7 +1029,7 @@ icmp6_rrenum_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
break;
|
||||
}
|
||||
|
||||
printf(", seq=%u", (u_int32_t)ntohl(rr6->rr_seqnum));
|
||||
printf(", seq=%u", EXTRACT_32BITS(&rr6->rr_seqnum));
|
||||
|
||||
if (vflag) {
|
||||
#define F(x, y) ((rr6->rr_flags) & (x) ? (y) : "")
|
||||
@ -937,7 +1044,7 @@ icmp6_rrenum_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
printf("seg=%u,", rr6->rr_segnum);
|
||||
printf("maxdelay=%u", rr6->rr_maxdelay);
|
||||
if (rr6->rr_reserved)
|
||||
printf("rsvd=0x%x", (u_int16_t)ntohs(rr6->rr_reserved));
|
||||
printf("rsvd=0x%x", EXTRACT_16BITS(&rr6->rr_reserved));
|
||||
/*[*/
|
||||
printf("]");
|
||||
#undef F
|
||||
@ -1002,12 +1109,12 @@ icmp6_rrenum_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
printf("vltime=infty,");
|
||||
else
|
||||
printf("vltime=%u,",
|
||||
(u_int32_t)ntohl(use->rpu_vltime));
|
||||
EXTRACT_32BITS(&use->rpu_vltime));
|
||||
if (~use->rpu_pltime == 0)
|
||||
printf("pltime=infty,");
|
||||
else
|
||||
printf("pltime=%u,",
|
||||
(u_int32_t)ntohl(use->rpu_pltime));
|
||||
EXTRACT_32BITS(&use->rpu_pltime));
|
||||
}
|
||||
if (inet_ntop(AF_INET6, &use->rpu_prefix, hbuf,
|
||||
sizeof(hbuf)))
|
||||
|
@ -20,18 +20,15 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.5.4.1 2002/06/02 18:25:05 guy Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.11.2.3 2003/11/19 09:41:29 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -50,10 +47,10 @@ static const char rcsid[] =
|
||||
* The packet format for a traceroute request.
|
||||
*/
|
||||
struct tr_query {
|
||||
u_int tr_src; /* traceroute source */
|
||||
u_int tr_dst; /* traceroute destination */
|
||||
u_int tr_raddr; /* traceroute response address */
|
||||
u_int tr_rttlqid; /* response ttl and qid */
|
||||
u_int32_t tr_src; /* traceroute source */
|
||||
u_int32_t tr_dst; /* traceroute destination */
|
||||
u_int32_t tr_raddr; /* traceroute response address */
|
||||
u_int32_t tr_rttlqid; /* response ttl and qid */
|
||||
};
|
||||
|
||||
#define TR_GETTTL(x) (int)(((x) >> 24) & 0xff)
|
||||
@ -64,17 +61,17 @@ struct tr_query {
|
||||
* beginning, followed by one tr_resp for each hop taken.
|
||||
*/
|
||||
struct tr_resp {
|
||||
u_int tr_qarr; /* query arrival time */
|
||||
u_int tr_inaddr; /* incoming interface address */
|
||||
u_int tr_outaddr; /* outgoing interface address */
|
||||
u_int tr_rmtaddr; /* parent address in source tree */
|
||||
u_int tr_vifin; /* input packet count on interface */
|
||||
u_int tr_vifout; /* output packet count on interface */
|
||||
u_int tr_pktcnt; /* total incoming packets for src-grp */
|
||||
u_char tr_rproto; /* routing proto deployed on router */
|
||||
u_char tr_fttl; /* ttl required to forward on outvif */
|
||||
u_char tr_smask; /* subnet mask for src addr */
|
||||
u_char tr_rflags; /* forwarding error codes */
|
||||
u_int32_t tr_qarr; /* query arrival time */
|
||||
u_int32_t tr_inaddr; /* incoming interface address */
|
||||
u_int32_t tr_outaddr; /* outgoing interface address */
|
||||
u_int32_t tr_rmtaddr; /* parent address in source tree */
|
||||
u_int32_t tr_vifin; /* input packet count on interface */
|
||||
u_int32_t tr_vifout; /* output packet count on interface */
|
||||
u_int32_t tr_pktcnt; /* total incoming packets for src-grp */
|
||||
u_int8_t tr_rproto; /* routing proto deployed on router */
|
||||
u_int8_t tr_fttl; /* ttl required to forward on outvif */
|
||||
u_int8_t tr_smask; /* subnet mask for src addr */
|
||||
u_int8_t tr_rflags; /* forwarding error codes */
|
||||
};
|
||||
|
||||
/* defs within mtrace */
|
||||
@ -109,33 +106,51 @@ static struct tok igmpv3report2str[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
static void
|
||||
print_mtrace(register const u_char *bp, register u_int len)
|
||||
{
|
||||
register const struct tr_query *tr = (const struct tr_query *)(bp + 8);
|
||||
|
||||
printf("mtrace %lu: %s to %s reply-to %s",
|
||||
(u_long)TR_GETQID(ntohl(tr->tr_rttlqid)),
|
||||
TCHECK(*tr);
|
||||
if (len < 8 + sizeof (struct tr_query)) {
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
}
|
||||
printf("mtrace %u: %s to %s reply-to %s",
|
||||
TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)),
|
||||
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
|
||||
ipaddr_string(&tr->tr_raddr));
|
||||
if (IN_CLASSD(ntohl(tr->tr_raddr)))
|
||||
printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid)));
|
||||
if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr)))
|
||||
printf(" with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)));
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|igmp]");
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
print_mresp(register const u_char *bp, register u_int len)
|
||||
{
|
||||
register const struct tr_query *tr = (const struct tr_query *)(bp + 8);
|
||||
|
||||
TCHECK(*tr);
|
||||
if (len < 8 + sizeof (struct tr_query)) {
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
}
|
||||
printf("mresp %lu: %s to %s reply-to %s",
|
||||
(u_long)TR_GETQID(ntohl(tr->tr_rttlqid)),
|
||||
(u_long)TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)),
|
||||
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
|
||||
ipaddr_string(&tr->tr_raddr));
|
||||
if (IN_CLASSD(ntohl(tr->tr_raddr)))
|
||||
printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid)));
|
||||
if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr)))
|
||||
printf(" with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)));
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|igmp]");
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
print_igmpv3_report(register const u_char *bp, register u_int len)
|
||||
{
|
||||
u_int group, nsrcs, ngroups;
|
||||
@ -143,15 +158,15 @@ print_igmpv3_report(register const u_char *bp, register u_int len)
|
||||
|
||||
/* Minimum len is 16, and should be a multiple of 4 */
|
||||
if (len < 16 || len & 0x03) {
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
}
|
||||
TCHECK2(bp[6], 2);
|
||||
ngroups = EXTRACT_16BITS(&bp[6]);
|
||||
(void)printf(", %d group record(s)", ngroups);
|
||||
(void)printf(", %d group record(s)", ngroups);
|
||||
if (vflag > 0) {
|
||||
/* Print the group records */
|
||||
group = 8;
|
||||
group = 8;
|
||||
for (i=0; i<ngroups; i++) {
|
||||
if (len < group+8) {
|
||||
(void)printf(" [invalid number of groups]");
|
||||
@ -200,9 +215,10 @@ print_igmpv3_query(register const u_char *bp, register u_int len)
|
||||
(void)printf(" v3");
|
||||
/* Minimum len is 12, and should be a multiple of 4 */
|
||||
if (len < 12 || len & 0x03) {
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
}
|
||||
TCHECK(bp[1]);
|
||||
mrc = bp[1];
|
||||
if (mrc < 128) {
|
||||
mrt = mrc;
|
||||
@ -248,31 +264,35 @@ igmp_print(register const u_char *bp, register u_int len)
|
||||
return;
|
||||
}
|
||||
|
||||
TCHECK2(bp[0], 8);
|
||||
TCHECK(bp[0]);
|
||||
switch (bp[0]) {
|
||||
case 0x11:
|
||||
(void)printf("igmp query");
|
||||
if (len >= 12)
|
||||
print_igmpv3_query(bp, len);
|
||||
else {
|
||||
TCHECK(bp[1]);
|
||||
if (bp[1]) {
|
||||
(void)printf(" v2");
|
||||
if (bp[1] != 100)
|
||||
(void)printf(" [max resp time %d]", bp[1]);
|
||||
} else
|
||||
(void)printf(" v1");
|
||||
if (EXTRACT_32BITS(&bp[4]))
|
||||
TCHECK2(bp[4], 4);
|
||||
if (EXTRACT_32BITS(&bp[4]))
|
||||
(void)printf(" [gaddr %s]", ipaddr_string(&bp[4]));
|
||||
if (len != 8)
|
||||
(void)printf(" [len %d]", len);
|
||||
}
|
||||
break;
|
||||
case 0x12:
|
||||
TCHECK2(bp[4], 4);
|
||||
(void)printf("igmp v1 report %s", ipaddr_string(&bp[4]));
|
||||
if (len != 8)
|
||||
(void)printf(" [len %d]", len);
|
||||
break;
|
||||
case 0x16:
|
||||
TCHECK2(bp[4], 4);
|
||||
(void)printf("igmp v2 report %s", ipaddr_string(&bp[4]));
|
||||
break;
|
||||
case 0x22:
|
||||
|
@ -22,21 +22,16 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.16 2001/06/15 22:17:32 fenner Exp $ (LBL)";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.18.2.2 2003/11/16 08:51:26 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h> /* concession to AIX */
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1998 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:
|
||||
@ -13,7 +13,7 @@
|
||||
* 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
|
||||
@ -32,23 +32,20 @@
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.9 2001/05/09 02:47:26 itojun Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.14.2.3 2003/11/19 00:35:44 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ip6.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
/* items outside of rfc2292bis */
|
||||
#ifndef IP6OPT_MINLEN
|
||||
@ -64,10 +61,12 @@ static const char rcsid[] =
|
||||
#define IP6OPT_BU_MINLEN 10
|
||||
#define IP6OPT_BA_MINLEN 13
|
||||
#define IP6OPT_BR_MINLEN 2
|
||||
#define IP6SOPT_ALTCOA 0x4
|
||||
#define IP6SOPT_ALTCOA_MINLEN 18
|
||||
#define IP6SOPT_UI 0x2
|
||||
#define IP6SOPT_UI_MINLEN 4
|
||||
#define IP6SOPT_ALTCOA 0x3
|
||||
#define IP6SOPT_ALTCOA_MINLEN 18
|
||||
#define IP6SOPT_AUTH 0x4
|
||||
#define IP6SOPT_AUTH_MINLEN 6
|
||||
|
||||
static void ip6_sopt_print(const u_char *, int);
|
||||
|
||||
@ -100,6 +99,13 @@ ip6_sopt_print(const u_char *bp, int len)
|
||||
}
|
||||
printf(", padn");
|
||||
break;
|
||||
case IP6SOPT_UI:
|
||||
if (len - i < IP6SOPT_UI_MINLEN) {
|
||||
printf(", ui: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf(", ui: 0x%04x ", EXTRACT_16BITS(&bp[i + 2]));
|
||||
break;
|
||||
case IP6SOPT_ALTCOA:
|
||||
if (len - i < IP6SOPT_ALTCOA_MINLEN) {
|
||||
printf(", altcoa: trunc");
|
||||
@ -107,12 +113,12 @@ ip6_sopt_print(const u_char *bp, int len)
|
||||
}
|
||||
printf(", alt-CoA: %s", ip6addr_string(&bp[i+2]));
|
||||
break;
|
||||
case IP6SOPT_UI:
|
||||
if (len - i < IP6SOPT_UI_MINLEN) {
|
||||
printf(", ui: trunc");
|
||||
case IP6SOPT_AUTH:
|
||||
if (len - i < IP6SOPT_AUTH_MINLEN) {
|
||||
printf(", auth: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf("(ui: 0x%04x) ", ntohs(*(u_int16_t *)&bp[i + 2]));
|
||||
printf(", auth spi: 0x%08x", EXTRACT_32BITS(&bp[i + 2]));
|
||||
break;
|
||||
default:
|
||||
if (len - i < IP6OPT_MINLEN) {
|
||||
@ -133,7 +139,7 @@ void
|
||||
ip6_opt_print(const u_char *bp, int len)
|
||||
{
|
||||
int i;
|
||||
int optlen;
|
||||
int optlen = 0;
|
||||
|
||||
for (i = 0; i < len; i += optlen) {
|
||||
if (bp[i] == IP6OPT_PAD1)
|
||||
@ -167,7 +173,7 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
printf("(rtalert: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(rtalert: 0x%04x) ", ntohs(*(u_int16_t *)&bp[i + 2]));
|
||||
printf("(rtalert: 0x%04x) ", EXTRACT_16BITS(&bp[i + 2]));
|
||||
break;
|
||||
case IP6OPT_JUMBO:
|
||||
if (len - i < IP6OPT_JUMBO_LEN) {
|
||||
@ -178,7 +184,7 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
printf("(jumbo: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(jumbo: %u) ", (u_int32_t)ntohl(*(u_int32_t *)&bp[i + 2]));
|
||||
printf("(jumbo: %u) ", EXTRACT_32BITS(&bp[i + 2]));
|
||||
break;
|
||||
case IP6OPT_HOME_ADDRESS:
|
||||
if (len - i < IP6OPT_HOMEADDR_MINLEN) {
|
||||
@ -211,16 +217,13 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
if (bp[i + 2] & 0x40)
|
||||
printf("H");
|
||||
if (bp[i + 2] & 0x20)
|
||||
printf("R");
|
||||
printf("S");
|
||||
if (bp[i + 2] & 0x10)
|
||||
printf("D");
|
||||
if (bp[i + 2] & 0x0f)
|
||||
if ((bp[i + 2] & 0x0f) || bp[i + 3] || bp[i + 4])
|
||||
printf("res");
|
||||
printf(", prefixlen: %u", bp[i + 3]);
|
||||
printf(", sequence: %u",
|
||||
(u_int16_t)ntohs(*(u_int16_t *)&bp[i + 4]));
|
||||
printf(", lifetime: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 8]));
|
||||
printf(", sequence: %u", bp[i + 5]);
|
||||
printf(", lifetime: %u", EXTRACT_32BITS(&bp[i + 6]));
|
||||
|
||||
if (bp[i + 1] > IP6OPT_BU_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BU_MINLEN],
|
||||
@ -239,12 +242,11 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
}
|
||||
printf("(ba: ");
|
||||
printf("status: %u", bp[i + 2]);
|
||||
printf(", sequence: %u",
|
||||
(u_int16_t)ntohs(*(u_int16_t *)&bp[i + 3]));
|
||||
printf(", lifetime: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 7]));
|
||||
printf(", refresh: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 11]));
|
||||
if (bp[i + 3])
|
||||
printf("res");
|
||||
printf(", sequence: %u", bp[i + 4]);
|
||||
printf(", lifetime: %u", EXTRACT_32BITS(&bp[i + 5]));
|
||||
printf(", refresh: %u", EXTRACT_32BITS(&bp[i + 9]));
|
||||
|
||||
if (bp[i + 1] > IP6OPT_BA_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BA_MINLEN],
|
||||
@ -303,7 +305,7 @@ hbhopt_print(register const u_char *bp)
|
||||
|
||||
trunc:
|
||||
fputs("[|HBH]", stdout);
|
||||
return(hbhlen);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
@ -328,6 +330,6 @@ dstopt_print(register const u_char *bp)
|
||||
|
||||
trunc:
|
||||
fputs("[|DSTOPT]", stdout);
|
||||
return(dstoptlen);
|
||||
return(-1);
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.13 2000/12/12 09:58:41 itojun Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.17.2.3 2003/11/19 00:35:45 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -29,12 +29,7 @@ static const char rcsid[] =
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@ -50,9 +45,10 @@ struct ipcomp {
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
int
|
||||
ipcomp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
ipcomp_print(register const u_char *bp, int *nhdr _U_)
|
||||
{
|
||||
register const struct ipcomp *ipcomp;
|
||||
register const u_char *ep;
|
||||
@ -62,7 +58,7 @@ ipcomp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
#endif
|
||||
|
||||
ipcomp = (struct ipcomp *)bp;
|
||||
cpi = (u_int16_t)ntohs(ipcomp->comp_cpi);
|
||||
cpi = EXTRACT_16BITS(&ipcomp->comp_cpi);
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
@ -91,7 +87,5 @@ ipcomp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
|
||||
#endif
|
||||
fail:
|
||||
if (nhdr)
|
||||
*nhdr = -1;
|
||||
return 65536;
|
||||
return -1;
|
||||
}
|
||||
|
137
contrib/tcpdump/print-ipfc.c
Normal file
137
contrib/tcpdump/print-ipfc.c
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 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/print-ipfc.c,v 1.4.2.2 2003/11/16 08:51:28 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "ether.h"
|
||||
#include "ipfc.h"
|
||||
|
||||
/*
|
||||
* RFC 2625 IP-over-Fibre Channel.
|
||||
*/
|
||||
|
||||
/* Extract src, dst addresses */
|
||||
static inline void
|
||||
extract_ipfc_addrs(const struct ipfc_header *ipfcp, char *ipfcsrc,
|
||||
char *ipfcdst)
|
||||
{
|
||||
/*
|
||||
* We assume that, as per RFC 2625, the lower 48 bits of the
|
||||
* source and destination addresses are MAC addresses.
|
||||
*/
|
||||
memcpy(ipfcdst, (const char *)&ipfcp->ipfc_dhost[2], 6);
|
||||
memcpy(ipfcsrc, (const char *)&ipfcp->ipfc_shost[2], 6);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the Network_Header
|
||||
*/
|
||||
static inline void
|
||||
ipfc_hdr_print(register const struct ipfc_header *ipfcp _U_,
|
||||
register u_int length, register const u_char *ipfcsrc,
|
||||
register const u_char *ipfcdst)
|
||||
{
|
||||
const char *srcname, *dstname;
|
||||
|
||||
srcname = etheraddr_string(ipfcsrc);
|
||||
dstname = etheraddr_string(ipfcdst);
|
||||
|
||||
/*
|
||||
* XXX - show the upper 16 bits? Do so only if "vflag" is set?
|
||||
*/
|
||||
(void) printf("%s %s %d: ", srcname, dstname, length);
|
||||
}
|
||||
|
||||
static void
|
||||
ipfc_print(const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
const struct ipfc_header *ipfcp = (const struct ipfc_header *)p;
|
||||
struct ether_header ehdr;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
if (caplen < IPFC_HDRLEN) {
|
||||
printf("[|ipfc]");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Get the network addresses into a canonical form
|
||||
*/
|
||||
extract_ipfc_addrs(ipfcp, (char *)ESRC(&ehdr), (char *)EDST(&ehdr));
|
||||
|
||||
if (eflag)
|
||||
ipfc_hdr_print(ipfcp, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
|
||||
/* Skip over Network_Header */
|
||||
length -= IPFC_HDRLEN;
|
||||
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) {
|
||||
/*
|
||||
* Some kinds of LLC packet we cannot
|
||||
* handle intelligently
|
||||
*/
|
||||
if (!eflag)
|
||||
ipfc_hdr_print(ipfcp, length + IPFC_HDRLEN,
|
||||
ESRC(&ehdr), EDST(&ehdr));
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
}
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, 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'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
ipfc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
ipfc_print(p, h->len, h->caplen);
|
||||
|
||||
return (IPFC_HDRLEN);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -22,32 +22,25 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.15 2000/09/29 04:58:42 guy Exp $";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.21.2.2 2003/11/16 08:51:30 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
const u_char *c_print(register const u_char *, register const u_char *);
|
||||
const u_char *krb4_print_hdr(const u_char *);
|
||||
void krb4_print(const u_char *);
|
||||
void krb_print(const u_char *, u_int);
|
||||
|
||||
static const u_char *c_print(register const u_char *, register const u_char *);
|
||||
static const u_char *krb4_print_hdr(const u_char *);
|
||||
static void krb4_print(const u_char *);
|
||||
|
||||
#define AUTH_MSG_KDC_REQUEST 1<<1
|
||||
#define AUTH_MSG_KDC_REPLY 2<<1
|
||||
@ -72,8 +65,8 @@ void krb_print(const u_char *, u_int);
|
||||
#define KERB_ERR_NULL_KEY 10
|
||||
|
||||
struct krb {
|
||||
u_char pvno; /* Protocol Version */
|
||||
u_char type; /* Type+B */
|
||||
u_int8_t pvno; /* Protocol Version */
|
||||
u_int8_t type; /* Type+B */
|
||||
};
|
||||
|
||||
static char tstr[] = " [|kerberos]";
|
||||
@ -106,26 +99,7 @@ static struct tok kerr2str[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
/* little endian (unaligned) to host byte order */
|
||||
/* XXX need to look at this... */
|
||||
#define vtohlp(x) ((( ((char *)(x))[0] ) ) | \
|
||||
(( ((char *)(x))[1] ) << 8) | \
|
||||
(( ((char *)(x))[2] ) << 16) | \
|
||||
(( ((char *)(x))[3] ) << 24))
|
||||
#define vtohsp(x) ((( ((char *)(x))[0] ) ) | \
|
||||
(( ((char *)(x))[1] ) << 8))
|
||||
/* network (big endian) (unaligned) to host byte order */
|
||||
#define ntohlp(x) ((( ((char *)(x))[3] ) ) | \
|
||||
(( ((char *)(x))[2] ) << 8) | \
|
||||
(( ((char *)(x))[1] ) << 16) | \
|
||||
(( ((char *)(x))[0] ) << 24))
|
||||
#define ntohsp(x) ((( ((char *)(x))[1] ) ) | \
|
||||
(( ((char *)(x))[0] ) << 8))
|
||||
|
||||
|
||||
|
||||
const u_char *
|
||||
static const u_char *
|
||||
c_print(register const u_char *s, register const u_char *ep)
|
||||
{
|
||||
register u_char c;
|
||||
@ -154,7 +128,7 @@ c_print(register const u_char *s, register const u_char *ep)
|
||||
return (s);
|
||||
}
|
||||
|
||||
const u_char *
|
||||
static const u_char *
|
||||
krb4_print_hdr(const u_char *cp)
|
||||
{
|
||||
cp += 2;
|
||||
@ -175,7 +149,7 @@ krb4_print_hdr(const u_char *cp)
|
||||
#undef PRINT
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
krb4_print(const u_char *cp)
|
||||
{
|
||||
register const struct krb *kp;
|
||||
@ -185,7 +159,7 @@ krb4_print(const u_char *cp)
|
||||
#define PRINT if ((cp = c_print(cp, snapend)) == NULL) goto trunc
|
||||
/* True if struct krb is little endian */
|
||||
#define IS_LENDIAN(kp) (((kp)->type & 0x01) != 0)
|
||||
#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? vtohsp(cp) : ntohsp(cp))
|
||||
#define KTOHSP(kp, cp) (IS_LENDIAN(kp) ? EXTRACT_LE_16BITS(cp) : EXTRACT_16BITS(cp))
|
||||
|
||||
kp = (struct krb *)cp;
|
||||
|
||||
@ -253,7 +227,7 @@ krb4_print(const u_char *cp)
|
||||
}
|
||||
|
||||
void
|
||||
krb_print(const u_char *dat, u_int length)
|
||||
krb_print(const u_char *dat)
|
||||
{
|
||||
register const struct krb *kp;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user