This commit is contained in:
Bruce M Simpson 2004-03-31 09:17:26 +00:00
parent c76561e4dc
commit 5b0fe47811
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/tcpdump/dist/; revision=127668
185 changed files with 27521 additions and 10744 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View 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.

View File

@ -1 +1 @@
3.7.2+multidlt
3.8.3

View File

@ -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

View File

@ -1,4 +1,4 @@
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.80.2.4 2002/07/13 09:38:53 guy Exp $ (LBL)
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.98.2.4 2004/03/28 21:04:49 fenner Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
@ -236,9 +236,9 @@ AC_DEFUN(AC_LBL_LIBPCAP,
AC_MSG_CHECKING(for local pcap library)
libpcap=FAIL
lastdir=FAIL
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
for dir in $places ../libpcap libpcap ; do
for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
if test $lastdir = $basedir ; then
dnl skip alphas when an actual release is present
@ -257,6 +257,36 @@ AC_DEFUN(AC_LBL_LIBPCAP,
if test $libpcap = FAIL ; then
AC_MSG_ERROR(see the INSTALL doc for more info)
fi
dnl
dnl Good old Red Hat Linux puts "pcap.h" in
dnl "/usr/include/pcap"; had the LBL folks done so,
dnl that would have been a good idea, but for
dnl the Red Hat folks to do so just breaks source
dnl compatibility with other systems.
dnl
dnl We work around this by assuming that, as we didn't
dnl find a local libpcap, libpcap is in /usr/lib or
dnl /usr/local/lib and that the corresponding header
dnl file is under one of those directories; if we don't
dnl find it in either of those directories, we check to
dnl see if it's in a "pcap" subdirectory of them and,
dnl if so, add that subdirectory to the "-I" list.
dnl
AC_MSG_CHECKING(for extraneous pcap header directories)
if test \( ! -r /usr/local/include/pcap.h \) -a \
\( ! -r /usr/include/pcap.h \); then
if test -r /usr/local/include/pcap/pcap.h; then
d="/usr/local/include/pcap"
elif test -r /usr/include/pcap/pcap.h; then
d="/usr/include/pcap"
fi
fi
if test -z "$d" ; then
AC_MSG_RESULT(not found)
else
$2="-I$d $$2"
AC_MSG_RESULT(found -- -I$d added)
fi
else
$1=$libpcap
places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
@ -280,8 +310,42 @@ AC_DEFUN(AC_LBL_LIBPCAP,
AC_MSG_RESULT(yes)
LIBS="$LIBS -I:$pseexe"
fi
#
# We need "-lodm" and "-lcfg", as libpcap requires them on
# AIX, and we just build a static libpcap.a and thus can't
# arrange that when you link with libpcap you automatically
# link with those libraries.
#
LIBS="$LIBS -lodm -lcfg"
;;
esac])
esac
dnl
dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
dnl and "pcap_datalink_name_to_val()", and use substitute versions
dnl if they're not present
dnl
AC_CHECK_FUNC(pcap_list_datalinks,
AC_DEFINE(HAVE_PCAP_LIST_DATALINKS),
AC_LIBOBJ(datalinks))
AC_CHECK_FUNC(pcap_set_datalink,
AC_DEFINE(HAVE_PCAP_SET_DATALINK))
AC_CHECK_FUNC(pcap_datalink_name_to_val,
[
AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL)
AC_CHECK_FUNC(pcap_datalink_val_to_description,
AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION),
AC_LIBOBJ(dlnames))
],
AC_LIBOBJ(dlnames))
dnl
dnl Check for "pcap_breakloop()"; you can't substitute for it if
dnl it's absent (it has hooks into the live capture routines),
dnl so just define the HAVE_ value if it's there.
dnl
AC_CHECK_FUNCS(pcap_breakloop)
])
dnl
dnl Define RETSIGTYPE and RETSIGVAL
@ -310,10 +374,10 @@ AC_DEFUN(AC_LBL_TYPE_SIGNAL,
;;
*)
dnl prefer sigset() to sigaction()
AC_CHECK_FUNCS(sigset)
if test $ac_cv_func_sigset = no ; then
AC_CHECK_FUNCS(sigaction)
dnl prefer sigaction() to sigset()
AC_CHECK_FUNCS(sigaction)
if test $ac_cv_func_sigaction = no ; then
AC_CHECK_FUNCS(sigset)
fi
;;
esac])
@ -538,8 +602,39 @@ AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
[case "$host_cpu" in
#
# These are CPU types where:
#
# the CPU faults on an unaligned access, but at least some
# OSes that support that CPU catch the fault and simulate
# the unaligned access (e.g., Alpha/{Digital,Tru64} UNIX) -
# the simulation is slow, so we don't want to use it;
#
# the CPU, I infer (from the old
#
# XXX: should also check that they don't do weird things (like on arm)
alpha*|arm*|hp*|mips*|sparc*|ia64)
#
# comment) doesn't fault on unaligned accesses, but doesn't
# do a normal unaligned fetch, either (e.g., presumably, ARM);
#
# for whatever reason, the test program doesn't work
# (this has been claimed to be the case for several of those
# CPUs - I don't know what the problem is; the problem
# was reported as "the test program dumps core" for SuperH,
# but that's what the test program is *supposed* to do -
# it dumps core before it writes anything, so the test
# for an empty output file should find an empty output
# file and conclude that unaligned accesses don't work).
#
# This run-time test won't work if you're cross-compiling, so
# in order to support cross-compiling for a particular CPU,
# we have to wire in the list of CPU types anyway, as far as
# I know, so perhaps we should just have a set of CPUs on
# which we know it doesn't work, a set of CPUs on which we
# know it does work, and have the script just fail on other
# cpu types and update it when such a failure occurs.
#
alpha*|arm*|hp*|mips*|sh*|sparc*|ia64|nv1)
ac_cv_lbl_unaligned_fail=yes
;;
@ -594,7 +689,8 @@ EOF
dnl
dnl If using gcc and the file .devel exists:
dnl Compile with -g (if supported) and -Wall
dnl If using gcc 2, do extra prototype checking
dnl If using gcc 2 or later, do extra prototype checking and some other
dnl checks
dnl If an os prototype include exists, symlink os-proto.h to it
dnl
dnl usage:
@ -620,7 +716,7 @@ AC_DEFUN(AC_LBL_DEVEL,
fi
$1="$$1 -Wall"
if test $ac_cv_lbl_gcc_vers -gt 1 ; then
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes"
$1="$$1 -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -W"
fi
fi
else
@ -658,6 +754,11 @@ dnl results:
dnl
dnl LIBS
dnl
dnl XXX - "AC_LBL_LIBRARY_NET" was redone to use "AC_SEARCH_LIBS"
dnl rather than "AC_LBL_CHECK_LIB", so this isn't used any more.
dnl We keep it around for reference purposes in case it's ever
dnl useful in the future.
dnl
define(AC_LBL_CHECK_LIB,
[AC_MSG_CHECKING([for $2 in -l$1])
@ -1097,6 +1198,9 @@ ac_cv___attribute__=yes,
ac_cv___attribute__=no)])
if test "$ac_cv___attribute__" = "yes"; then
AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
V_DEFS="$V_DEFS -D_U_=\"__attribute__((unused))\""
else
V_DEFS="$V_DEFS -D_U_=\"\""
fi
AC_MSG_RESULT($ac_cv___attribute__)
])

View File

@ -22,19 +22,15 @@
* and address to string conversion routines
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.83.4.1 2002/06/02 00:08:07 guy Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.96.2.6 2004/03/24 04:14:31 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <tcpdump-stdinc.h>
#ifdef USE_ETHER_NTOHOST
#ifdef HAVE_NETINET_IF_ETHER_H
@ -43,30 +39,27 @@ struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */
#include <netinet/if_ether.h>
#endif /* HAVE_NETINET_IF_ETHER_H */
#ifdef HAVE_NETINET_ETHER_H
#include <netinet/ether.h> /* ether_ntohost on linux */
#endif /* HAVE_NETINET_ETHER_H */
#endif /* USE_ETHER_NTOHOST */
#include <arpa/inet.h>
#include <ctype.h>
#include <netdb.h>
#include <pcap.h>
#include <pcap-namedb.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "interface.h"
#include "addrtoname.h"
#include "llc.h"
#include "setsignal.h"
/* Forwards */
static RETSIGTYPE nohostname(int);
/*
* hash tables for whatever-to-name translations
*
* XXX there has to be error checks against strdup(3) failure
*/
#define HASHNAMESIZE 4096
@ -83,6 +76,52 @@ struct hnamemem uporttable[HASHNAMESIZE];
struct hnamemem eprototable[HASHNAMESIZE];
struct hnamemem dnaddrtable[HASHNAMESIZE];
struct hnamemem llcsaptable[HASHNAMESIZE];
struct hnamemem ipxsaptable[HASHNAMESIZE];
#if defined(INET6) && defined(WIN32)
/*
* fake gethostbyaddr for Win2k/XP
* gethostbyaddr() returns incorrect value when AF_INET6 is passed
* to 3rd argument.
*
* h_name in struct hostent is only valid.
*/
static struct hostent *
win32_gethostbyaddr(const char *addr, int len, int type)
{
static struct hostent host;
static char hostbuf[NI_MAXHOST];
char hname[NI_MAXHOST];
struct sockaddr_in6 addr6;
host.h_name = hostbuf;
switch (type) {
case AF_INET:
return gethostbyaddr(addr, len, type);
break;
case AF_INET6:
memset(&addr6, 0, sizeof(addr6));
addr6.sin6_family = AF_INET6;
memcpy(&addr6.sin6_addr, addr, len);
#ifdef __MINGW32__
/* MinGW doesn't provide getnameinfo */
return NULL;
#else
if (getnameinfo((struct sockaddr *)&addr6, sizeof(addr6),
hname, sizeof(hname), NULL, 0, 0)) {
return NULL;
} else {
strcpy(host.h_name, hname);
return &host;
}
#endif /* __MINGW32__ */
break;
default:
return NULL;
}
}
#define gethostbyaddr win32_gethostbyaddr
#endif /* INET6 & WIN32*/
#ifdef INET6
struct h6namemem {
@ -152,25 +191,25 @@ intoa(u_int32_t addr)
static u_int32_t f_netmask;
static u_int32_t f_localnet;
static u_int32_t netmask;
/*
* "getname" is written in this atrocious way to make sure we don't
* wait forever while trying to get hostnames from yp.
*/
#include <setjmp.h>
jmp_buf getname_env;
static RETSIGTYPE
nohostname(int signo)
{
longjmp(getname_env, 1);
}
/*
* Return a name for the IP address pointed to by ap. This address
* is assumed to be in network byte order.
*
* NOTE: ap is *NOT* necessarily part of the packet data (not even if
* this is being called with the "ipaddr_string()" macro), so you
* *CANNOT* use the TCHECK{2}/TTEST{2} macros on it. Furthermore,
* even in cases where it *is* part of the packet data, the caller
* would still have to check for a null return value, even if it's
* just printing the return value with "%s" - not all versions of
* printf print "(null)" with "%s" and a null pointer, some of them
* don't check for a null pointer and crash in that case.
*
* The callers of this routine should, before handing this routine
* a pointer to packet data, be sure that the data is present in
* the packet buffer. They should probably do those checks anyway,
* as other data at that layer might not be IP addresses, and it
* also needs to check whether they're present in the packet buffer.
*/
const char *
getname(const u_char *ap)
@ -189,35 +228,26 @@ getname(const u_char *ap)
p->nxt = newhnamemem();
/*
* Only print names when:
* (1) -n was not given.
* Print names unless:
* (1) -n was given.
* (2) Address is foreign and -f was given. (If -f was not
* give, f_netmask and f_local are 0 and the test
* given, f_netmask and f_localnet are 0 and the test
* evaluates to true)
* (3) -a was given or the host portion is not all ones
* nor all zeros (i.e. not a network or broadcast address)
*/
if (!nflag &&
(addr & f_netmask) == f_localnet &&
(aflag ||
!((addr & ~netmask) == 0 || (addr | netmask) == 0xffffffff))) {
if (!setjmp(getname_env)) {
(void)setsignal(SIGALRM, nohostname);
(void)alarm(20);
hp = gethostbyaddr((char *)&addr, 4, AF_INET);
(void)alarm(0);
if (hp) {
char *dotp;
(addr & f_netmask) == f_localnet) {
hp = gethostbyaddr((char *)&addr, 4, AF_INET);
if (hp) {
char *dotp;
p->name = strdup(hp->h_name);
if (Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
if (dotp)
*dotp = '\0';
}
return (p->name);
p->name = strdup(hp->h_name);
if (Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
if (dotp)
*dotp = '\0';
}
return (p->name);
}
}
p->name = strdup(intoa(addr));
@ -248,39 +278,21 @@ getname6(const u_char *ap)
p->nxt = newh6namemem();
/*
* Only print names when:
* (1) -n was not given.
* (2) Address is foreign and -f was given. (If -f was not
* give, f_netmask and f_local are 0 and the test
* evaluates to true)
* (3) -a was given or the host portion is not all ones
* nor all zeros (i.e. not a network or broadcast address)
* Do not print names if -n was given.
*/
if (!nflag
#if 0
&&
(addr & f_netmask) == f_localnet &&
(aflag ||
!((addr & ~netmask) == 0 || (addr | netmask) == 0xffffffff))
#endif
) {
if (!setjmp(getname_env)) {
(void)setsignal(SIGALRM, nohostname);
(void)alarm(20);
hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6);
(void)alarm(0);
if (hp) {
char *dotp;
if (!nflag) {
hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6);
if (hp) {
char *dotp;
p->name = strdup(hp->h_name);
if (Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
if (dotp)
*dotp = '\0';
}
return (p->name);
p->name = strdup(hp->h_name);
if (Nflag) {
/* Remove domain qualifications */
dotp = strchr(p->name, '.');
if (dotp)
*dotp = '\0';
}
return (p->name);
}
}
cp = inet_ntop(AF_INET6, &addr, ntop_buf, sizeof(ntop_buf));
@ -323,7 +335,7 @@ lookup_emem(const u_char *ep)
}
/*
* Find the hash node that corresponds to the bytestring 'bs'
* Find the hash node that corresponds to the bytestring 'bs'
* with length 'nlen'
*/
@ -441,7 +453,7 @@ lookup_protoid(const u_char *pi)
const char *
etheraddr_string(register const u_char *ep)
{
register u_int i, j;
register u_int i;
register char *cp;
register struct enamemem *tp;
char buf[sizeof("00:00:00:00:00:00")];
@ -451,21 +463,19 @@ etheraddr_string(register const u_char *ep)
return (tp->e_name);
#ifdef USE_ETHER_NTOHOST
if (!nflag) {
char buf[128];
if (ether_ntohost(buf, (const struct ether_addr *)ep) == 0) {
tp->e_name = strdup(buf);
char buf2[128];
if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) {
tp->e_name = strdup(buf2);
return (tp->e_name);
}
}
#endif
cp = buf;
if ((j = *ep >> 4) != 0)
*cp++ = hex[j];
*cp++ = hex[*ep >> 4 ];
*cp++ = hex[*ep++ & 0xf];
for (i = 5; (int)--i >= 0;) {
*cp++ = ':';
if ((j = *ep >> 4) != 0)
*cp++ = hex[j];
*cp++ = hex[*ep >> 4 ];
*cp++ = hex[*ep++ & 0xf];
}
*cp = '\0';
@ -482,7 +492,7 @@ linkaddr_string(const u_char *ep, const unsigned int len)
if (len == 6) /* XXX not totally correct... */
return etheraddr_string(ep);
tp = lookup_bytestring(ep, len);
if (tp->e_name)
return (tp->e_name);
@ -638,6 +648,32 @@ udpport_string(register u_short port)
return (tp->name);
}
const char *
ipxsap_string(u_short port)
{
register char *cp;
register struct hnamemem *tp;
register u_int32_t i = port;
char buf[sizeof("0000")];
for (tp = &ipxsaptable[i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt)
if (tp->addr == i)
return (tp->name);
tp->addr = i;
tp->nxt = newhnamemem();
cp = buf;
NTOHS(port);
*cp++ = hex[port >> 12 & 0xf];
*cp++ = hex[port >> 8 & 0xf];
*cp++ = hex[port >> 4 & 0xf];
*cp++ = hex[port & 0xf];
*cp++ = '\0';
tp->name = strdup(buf);
return (tp->name);
}
static void
init_servarray(void)
{
@ -670,7 +706,11 @@ init_servarray(void)
}
/*XXX from libbpfc.a */
#ifndef WIN32
extern struct eproto {
#else
__declspec( dllimport) struct eproto {
#endif
char *s;
u_short p;
} eproto_db[];
@ -682,12 +722,12 @@ init_eprotoarray(void)
register struct hnamemem *table;
for (i = 0; eproto_db[i].s; i++) {
int j = ntohs(eproto_db[i].p) & (HASHNAMESIZE-1);
int j = htons(eproto_db[i].p) & (HASHNAMESIZE-1);
table = &eprototable[j];
while (table->name)
table = table->nxt;
table->name = eproto_db[i].s;
table->addr = ntohs(eproto_db[i].p);
table->addr = htons(eproto_db[i].p);
table->nxt = newhnamemem();
}
}
@ -833,6 +873,240 @@ init_llcsaparray(void)
}
}
static struct tok ipxsap_db[] = {
{ 0x0000, "Unknown" },
{ 0x0001, "User" },
{ 0x0002, "User Group" },
{ 0x0003, "PrintQueue" },
{ 0x0004, "FileServer" },
{ 0x0005, "JobServer" },
{ 0x0006, "Gateway" },
{ 0x0007, "PrintServer" },
{ 0x0008, "ArchiveQueue" },
{ 0x0009, "ArchiveServer" },
{ 0x000a, "JobQueue" },
{ 0x000b, "Administration" },
{ 0x000F, "Novell TI-RPC" },
{ 0x0017, "Diagnostics" },
{ 0x0020, "NetBIOS" },
{ 0x0021, "NAS SNA Gateway" },
{ 0x0023, "NACS AsyncGateway" },
{ 0x0024, "RemoteBridge/RoutingService" },
{ 0x0026, "BridgeServer" },
{ 0x0027, "TCP/IP Gateway" },
{ 0x0028, "Point-to-point X.25 BridgeServer" },
{ 0x0029, "3270 Gateway" },
{ 0x002a, "CHI Corp" },
{ 0x002c, "PC Chalkboard" },
{ 0x002d, "TimeSynchServer" },
{ 0x002e, "ARCserve5.0/PalindromeBackup" },
{ 0x0045, "DI3270 Gateway" },
{ 0x0047, "AdvertisingPrintServer" },
{ 0x004a, "NetBlazerModems" },
{ 0x004b, "BtrieveVAP" },
{ 0x004c, "NetwareSQL" },
{ 0x004d, "XtreeNetwork" },
{ 0x0050, "BtrieveVAP4.11" },
{ 0x0052, "QuickLink" },
{ 0x0053, "PrintQueueUser" },
{ 0x0058, "Multipoint X.25 Router" },
{ 0x0060, "STLB/NLM" },
{ 0x0064, "ARCserve" },
{ 0x0066, "ARCserve3.0" },
{ 0x0072, "WAN CopyUtility" },
{ 0x007a, "TES-NetwareVMS" },
{ 0x0092, "WATCOM Debugger/EmeraldTapeBackupServer" },
{ 0x0095, "DDA OBGYN" },
{ 0x0098, "NetwareAccessServer" },
{ 0x009a, "Netware for VMS II/NamedPipeServer" },
{ 0x009b, "NetwareAccessServer" },
{ 0x009e, "PortableNetwareServer/SunLinkNVT" },
{ 0x00a1, "PowerchuteAPC UPS" },
{ 0x00aa, "LAWserve" },
{ 0x00ac, "CompaqIDA StatusMonitor" },
{ 0x0100, "PIPE STAIL" },
{ 0x0102, "LAN ProtectBindery" },
{ 0x0103, "OracleDataBaseServer" },
{ 0x0107, "Netware386/RSPX RemoteConsole" },
{ 0x010f, "NovellSNA Gateway" },
{ 0x0111, "TestServer" },
{ 0x0112, "HP PrintServer" },
{ 0x0114, "CSA MUX" },
{ 0x0115, "CSA LCA" },
{ 0x0116, "CSA CM" },
{ 0x0117, "CSA SMA" },
{ 0x0118, "CSA DBA" },
{ 0x0119, "CSA NMA" },
{ 0x011a, "CSA SSA" },
{ 0x011b, "CSA STATUS" },
{ 0x011e, "CSA APPC" },
{ 0x0126, "SNA TEST SSA Profile" },
{ 0x012a, "CSA TRACE" },
{ 0x012b, "NetwareSAA" },
{ 0x012e, "IKARUS VirusScan" },
{ 0x0130, "CommunicationsExecutive" },
{ 0x0133, "NNS DomainServer/NetwareNamingServicesDomain" },
{ 0x0135, "NetwareNamingServicesProfile" },
{ 0x0137, "Netware386 PrintQueue/NNS PrintQueue" },
{ 0x0141, "LAN SpoolServer" },
{ 0x0152, "IRMALAN Gateway" },
{ 0x0154, "NamedPipeServer" },
{ 0x0166, "NetWareManagement" },
{ 0x0168, "Intel PICKIT CommServer/Intel CAS TalkServer" },
{ 0x0173, "Compaq" },
{ 0x0174, "Compaq SNMP Agent" },
{ 0x0175, "Compaq" },
{ 0x0180, "XTreeServer/XTreeTools" },
{ 0x018A, "NASI ServicesBroadcastServer" },
{ 0x01b0, "GARP Gateway" },
{ 0x01b1, "Binfview" },
{ 0x01bf, "IntelLanDeskManager" },
{ 0x01ca, "AXTEC" },
{ 0x01cb, "ShivaNetModem/E" },
{ 0x01cc, "ShivaLanRover/E" },
{ 0x01cd, "ShivaLanRover/T" },
{ 0x01ce, "ShivaUniversal" },
{ 0x01d8, "CastelleFAXPressServer" },
{ 0x01da, "CastelleLANPressPrintServer" },
{ 0x01dc, "CastelleFAX/Xerox7033 FaxServer/ExcelLanFax" },
{ 0x01f0, "LEGATO" },
{ 0x01f5, "LEGATO" },
{ 0x0233, "NMS Agent/NetwareManagementAgent" },
{ 0x0237, "NMS IPX Discovery/LANternReadWriteChannel" },
{ 0x0238, "NMS IP Discovery/LANternTrapAlarmChannel" },
{ 0x023a, "LANtern" },
{ 0x023c, "MAVERICK" },
{ 0x023f, "NovellSMDR" },
{ 0x024e, "NetwareConnect" },
{ 0x024f, "NASI ServerBroadcast Cisco" },
{ 0x026a, "NMS ServiceConsole" },
{ 0x026b, "TimeSynchronizationServer Netware 4.x" },
{ 0x0278, "DirectoryServer Netware 4.x" },
{ 0x027b, "NetwareManagementAgent" },
{ 0x0280, "Novell File and Printer Sharing Service for PC" },
{ 0x0304, "NovellSAA Gateway" },
{ 0x0308, "COM/VERMED" },
{ 0x030a, "GalacticommWorldgroupServer" },
{ 0x030c, "IntelNetport2/HP JetDirect/HP Quicksilver" },
{ 0x0320, "AttachmateGateway" },
{ 0x0327, "MicrosoftDiagnostiocs" },
{ 0x0328, "WATCOM SQL Server" },
{ 0x0335, "MultiTechSystems MultisynchCommServer" },
{ 0x0343, "Xylogics RemoteAccessServer/LANModem" },
{ 0x0355, "ArcadaBackupExec" },
{ 0x0358, "MSLCD1" },
{ 0x0361, "NETINELO" },
{ 0x037e, "Powerchute UPS Monitoring" },
{ 0x037f, "ViruSafeNotify" },
{ 0x0386, "HP Bridge" },
{ 0x0387, "HP Hub" },
{ 0x0394, "NetWare SAA Gateway" },
{ 0x039b, "LotusNotes" },
{ 0x03b7, "CertusAntiVirus" },
{ 0x03c4, "ARCserve4.0" },
{ 0x03c7, "LANspool3.5" },
{ 0x03d7, "LexmarkPrinterServer" },
{ 0x03d8, "LexmarkXLE PrinterServer" },
{ 0x03dd, "BanyanENS NetwareClient" },
{ 0x03de, "GuptaSequelBaseServer/NetWareSQL" },
{ 0x03e1, "UnivelUnixware" },
{ 0x03e4, "UnivelUnixware" },
{ 0x03fc, "IntelNetport" },
{ 0x03fd, "PrintServerQueue" },
{ 0x040A, "ipnServer" },
{ 0x040D, "LVERRMAN" },
{ 0x040E, "LVLIC" },
{ 0x0414, "NET Silicon (DPI)/Kyocera" },
{ 0x0429, "SiteLockVirus" },
{ 0x0432, "UFHELPR???" },
{ 0x0433, "Synoptics281xAdvancedSNMPAgent" },
{ 0x0444, "MicrosoftNT SNA Server" },
{ 0x0448, "Oracle" },
{ 0x044c, "ARCserve5.01" },
{ 0x0457, "CanonGP55" },
{ 0x045a, "QMS Printers" },
{ 0x045b, "DellSCSI Array" },
{ 0x0491, "NetBlazerModems" },
{ 0x04ac, "OnTimeScheduler" },
{ 0x04b0, "CD-Net" },
{ 0x0513, "EmulexNQA" },
{ 0x0520, "SiteLockChecks" },
{ 0x0529, "SiteLockChecks" },
{ 0x052d, "CitrixOS2 AppServer" },
{ 0x0535, "Tektronix" },
{ 0x0536, "Milan" },
{ 0x055d, "Attachmate SNA gateway" },
{ 0x056b, "IBM8235 ModemServer" },
{ 0x056c, "ShivaLanRover/E PLUS" },
{ 0x056d, "ShivaLanRover/T PLUS" },
{ 0x0580, "McAfeeNetShield" },
{ 0x05B8, "NLM to workstation communication (Revelation Software)" },
{ 0x05BA, "CompatibleSystemsRouters" },
{ 0x05BE, "CheyenneHierarchicalStorageManager" },
{ 0x0606, "JCWatermarkImaging" },
{ 0x060c, "AXISNetworkPrinter" },
{ 0x0610, "AdaptecSCSIManagement" },
{ 0x0621, "IBM AntiVirus" },
{ 0x0640, "Windows95 RemoteRegistryService" },
{ 0x064e, "MicrosoftIIS" },
{ 0x067b, "Microsoft Win95/98 File and Print Sharing for NetWare" },
{ 0x067c, "Microsoft Win95/98 File and Print Sharing for NetWare" },
{ 0x076C, "Xerox" },
{ 0x079b, "ShivaLanRover/E 115" },
{ 0x079c, "ShivaLanRover/T 115" },
{ 0x07B4, "CubixWorldDesk" },
{ 0x07c2, "Quarterdeck IWare Connect V2.x NLM" },
{ 0x07c1, "Quarterdeck IWare Connect V3.x NLM" },
{ 0x0810, "ELAN License Server Demo" },
{ 0x0824, "ShivaLanRoverAccessSwitch/E" },
{ 0x086a, "ISSC Collector" },
{ 0x087f, "ISSC DAS AgentAIX" },
{ 0x0880, "Intel Netport PRO" },
{ 0x0881, "Intel Netport PRO" },
{ 0x0b29, "SiteLock" },
{ 0x0c29, "SiteLockApplications" },
{ 0x0c2c, "LicensingServer" },
{ 0x2101, "PerformanceTechnologyInstantInternet" },
{ 0x2380, "LAI SiteLock" },
{ 0x238c, "MeetingMaker" },
{ 0x4808, "SiteLockServer/SiteLockMetering" },
{ 0x5555, "SiteLockUser" },
{ 0x6312, "Tapeware" },
{ 0x6f00, "RabbitGateway" },
{ 0x7703, "MODEM" },
{ 0x8002, "NetPortPrinters" },
{ 0x8008, "WordPerfectNetworkVersion" },
{ 0x85BE, "Cisco EIGRP" },
{ 0x8888, "WordPerfectNetworkVersion/QuickNetworkManagement" },
{ 0x9000, "McAfeeNetShield" },
{ 0x9604, "CSA-NT_MON" },
{ 0xb6a8, "OceanIsleReachoutRemoteControl" },
{ 0xf11f, "SiteLockMetering" },
{ 0xf1ff, "SiteLock" },
{ 0xf503, "Microsoft SQL Server" },
{ 0xF905, "IBM TimeAndPlace" },
{ 0xfbfb, "TopCallIII FaxServer" },
{ 0xffff, "AnyService/Wildcard" },
{ 0, (char *)0 }
};
static void
init_ipxsaparray(void)
{
register int i;
register struct hnamemem *table;
for (i = 0; ipxsap_db[i].s != NULL; i++) {
int j = htons(ipxsap_db[i].v) & (HASHNAMESIZE-1);
table = &ipxsaptable[j];
while (table->name)
table = table->nxt;
table->name = ipxsap_db[i].s;
table->addr = htons(ipxsap_db[i].v);
table->nxt = newhnamemem();
}
}
/*
* Initialize the address to name translation machinery. We map all
* non-local IP addresses to numeric addresses if fflag is true (i.e.,
@ -842,7 +1116,6 @@ init_llcsaparray(void)
void
init_addrtoname(u_int32_t localnet, u_int32_t mask)
{
netmask = mask;
if (fflag) {
f_localnet = localnet;
f_netmask = mask;
@ -858,6 +1131,7 @@ init_addrtoname(u_int32_t localnet, u_int32_t mask)
init_eprotoarray();
init_llcsaparray();
init_protoidarray();
init_ipxsaparray();
}
const char *

190
contrib/tcpdump/aodv.h Normal file
View 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_ */

View File

@ -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 {

View File

@ -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
View 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 */

View 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

View File

@ -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

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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)

View File

@ -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
View 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;
};

View File

@ -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.

View File

@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.16 2001/06/21 17:56:02 itojun Exp $ (LBL)
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.20 2003/07/01 19:10:26 guy Exp $ (LBL)
*/
/*
@ -69,9 +69,6 @@
#ifndef ETHERTYPE_SCA
#define ETHERTYPE_SCA 0x6007
#endif
#ifndef ETHERTYPE_REVARP
#define ETHERTYPE_REVARP 0x8035
#endif
#ifndef ETHERTYPE_LANBRIDGE
#define ETHERTYPE_LANBRIDGE 0x8038
#endif
@ -120,3 +117,11 @@
#ifndef ETHERTYPE_LOOPBACK
#define ETHERTYPE_LOOPBACK 0x9000
#endif
#ifndef ETHERTYPE_VMAN
#define ETHERTYPE_VMAN 0x9100 /* Extreme VMAN Protocol */
#endif
#ifndef ETHERTYPE_ISO
#define ETHERTYPE_ISO 0xfefe /* nonstandard - used in Cisco HDLC encapsulation */
#endif
extern const struct tok ethertype_values[];

View File

@ -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)))

View File

@ -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
View 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
View 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[];

View File

@ -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"

View File

@ -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 */

View File

@ -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)

View File

@ -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 */

View File

@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.178.4.2 2002/07/10 07:32:17 guy Exp $ (LBL)
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.217.2.5 2004/03/17 19:47:48 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@ -27,8 +27,6 @@
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
#endif
#include <sys/types.h>
#include <sys/time.h>
#ifndef HAVE___ATTRIBUTE__
#define __attribute__(x)
@ -59,6 +57,10 @@ extern size_t strlcpy(char *, const char *, size_t);
extern char *strdup(const char *);
#endif
#ifndef HAVE_STRSEP
extern char *strsep(char **, const char *);
#endif
struct tok {
int v; /* value */
const char *s; /* string */
@ -79,7 +81,7 @@ extern int uflag; /* Print undecoded NFS handles */
extern int vflag; /* verbose */
extern int xflag; /* print packet in hex */
extern int Xflag; /* print packet in hex/ascii */
extern int Aflag; /* print packet only in ascii observing TAB, LF, CR and SPACE as graphical chars */
extern char *espsecret;
extern int packettype; /* as specified by -T */
@ -90,6 +92,8 @@ extern int packettype; /* as specified by -T */
#define PT_RTCP 5 /* Real-Time Applications control protocol */
#define PT_SNMP 6 /* Simple Network Management Protocol */
#define PT_CNFP 7 /* Cisco NetFlow protocol */
#define PT_TFTP 8 /* trivial file transfer protocol */
#define PT_AODV 9 /* Ad-hoc On-demand Distance Vector Protocol */
#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))
@ -129,8 +133,7 @@ extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
extern int snaplen;
/* global pointers to beginning and end of current packet (during printing) */
extern const u_char *packetp;
/* global pointer to end of current packet (during printing) */
extern const u_char *snapend;
/*
@ -159,15 +162,13 @@ extern void relts_print(int);
extern int fn_print(const u_char *, const u_char *);
extern int fn_printn(const u_char *, u_int, const u_char *);
extern const char *tok2str(const struct tok *, const char *, int);
extern int mask2plen(u_int32_t);
extern char *bittok2str(const struct tok *, const char *, int);
extern const char *tok2strary_internal(const char **, int, const char *, int);
#define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
extern const char *dnaddr_string(u_short);
extern void info(int);
extern int infodelay;
extern int infoprint;
extern void error(const char *, ...)
__attribute__((noreturn, format (printf, 1, 2)));
extern void warning(const char *, ...) __attribute__ ((format (printf, 1, 2)));
@ -189,92 +190,101 @@ extern const char *dnnum_string(u_short);
#include <pcap.h>
extern void ascii_print_with_offset(const u_char *, u_int, u_int);
extern void ascii_print(const u_char *, u_int);
extern void hex_print_with_offset(const u_char *, u_int, u_int);
extern void telnet_print(const u_char *, u_int);
extern void hex_print(const u_char *, u_int);
extern int print_unknown_data(const u_char *, const char *,int);
extern void ascii_print_with_offset(const u_char *, const u_char *, u_int, u_int);
extern void ascii_print(const u_char *, const u_char *, u_int);
extern void hex_print_with_offset(const u_char *, const u_char *, u_int, u_int);
extern void telnet_print(const u_char *, u_int);
extern void hex_print(const u_char *, const u_char *, u_int);
extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
const u_char *, u_short *);
extern int snap_print(const u_char *, u_int, u_int, u_short *, u_int32_t,
u_short, u_int);
extern void aarp_print(const u_char *, u_int);
extern void aodv_print(const u_char *, u_int, int);
extern void arp_print(const u_char *, u_int, u_int);
extern void atalk_print(const u_char *, u_int);
extern void atm_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void bootp_print(const u_char *, u_int, u_short, u_short);
extern void atm_print(u_int, u_int, u_int, const u_char *, u_int, u_int);
extern u_int atm_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sunatm_if_print(const struct pcap_pkthdr *, const u_char *);
extern void bootp_print(const u_char *, u_int);
extern void bgp_print(const u_char *, int);
extern void beep_print(const u_char *, u_int);
extern void cnfp_print(const u_char *, u_int, const u_char *);
extern void cnfp_print(const u_char *, const u_char *);
extern void decnet_print(const u_char *, u_int, u_int);
extern void default_print(const u_char *, u_int);
extern void default_print_unaligned(const u_char *, u_int);
extern void dvmrp_print(const u_char *, u_int);
extern void egp_print(const u_char *, u_int, const u_char *);
extern void arcnet_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void ether_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void token_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void fddi_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ieee802_11_if_print(u_char *, const struct pcap_pkthdr *,
extern void egp_print(const u_char *);
extern u_int enc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int pflog_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int arcnet_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int arcnet_linux_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ether_print(const u_char *, u_int, u_int);
extern u_int ether_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int token_print(const u_char *, u_int, u_int);
extern u_int token_if_print(const struct pcap_pkthdr *, const u_char *);
extern void fddi_print(const u_char *, u_int, u_int);
extern u_int fddi_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int fr_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ieee802_11_radio_if_print(const struct pcap_pkthdr *,
const u_char *);
extern u_int ap1394_if_print(const struct pcap_pkthdr *, const u_char *);
extern void gre_print(const u_char *, u_int);
extern void icmp_print(const u_char *, u_int, const u_char *);
extern void icmp_print(const u_char *, u_int, const u_char *, int);
extern void igmp_print(const u_char *, u_int);
extern void igrp_print(const u_char *, u_int, const u_char *);
extern void ip_print(const u_char *, u_int);
extern void ipN_print(const u_char *, u_int);
extern u_int ipfc_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ipx_print(const u_char *, u_int);
extern void isoclns_print(const u_char *, u_int, u_int, const u_char *,
const u_char *);
extern void krb_print(const u_char *, u_int);
extern void llap_print(const u_char *, u_int);
extern void ltalk_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void isoclns_print(const u_char *, u_int, u_int);
extern void krb_print(const u_char *);
extern u_int llap_print(const u_char *, u_int);
extern u_int ltalk_if_print(const struct pcap_pkthdr *, const u_char *);
extern void msdp_print(const unsigned char *, u_int);
extern void nfsreply_print(const u_char *, u_int, const u_char *);
extern void nfsreq_print(const u_char *, u_int, const u_char *);
extern void ns_print(const u_char *, u_int);
extern void ns_print(const u_char *, u_int, int);
extern void ntp_print(const u_char *, u_int);
extern void null_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern u_int null_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ospf_print(const u_char *, u_int, const u_char *);
extern void pimv1_print(const u_char *, u_int);
extern void cisco_autorp_print(const u_char *, u_int);
extern void rsvp_print(const u_char *, u_int);
extern void ldp_print(const u_char *, u_int);
extern void mobile_print(const u_char *, u_int);
extern void pim_print(const u_char *, u_int);
extern void pppoe_print(const u_char *, u_int);
extern void ppp_print(register const u_char *, u_int);
extern void ppp_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void ppp_hdlc_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void ppp_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void pppoe_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern int vjc_print(register const char *, register u_int, u_short);
extern void raw_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern u_int pppoe_print(const u_char *, u_int);
extern u_int ppp_print(register const u_char *, u_int);
extern u_int ppp_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ppp_hdlc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int ppp_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int pppoe_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int prism_if_print(const struct pcap_pkthdr *, const u_char *);
extern int vjc_print(register const char *, u_short);
extern u_int raw_if_print(const struct pcap_pkthdr *, const u_char *);
extern void rip_print(const u_char *, u_int);
extern void sl_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern void lane_if_print(u_char *, const struct pcap_pkthdr *,const u_char *);
extern void cip_if_print(u_char *, const struct pcap_pkthdr *,const u_char *);
extern void sl_bsdos_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void chdlc_if_print(u_char *, const struct pcap_pkthdr *,
const u_char *);
extern void chdlc_print(register const u_char *, u_int, u_int);
extern void sll_if_print(u_char *, const struct pcap_pkthdr *, const u_char *);
extern u_int sl_if_print(const struct pcap_pkthdr *, const u_char *);
extern void lane_print(const u_char *, u_int, u_int);
extern u_int lane_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int cip_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
extern void snmp_print(const u_char *, u_int);
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
extern void tcp_print(const u_char *, u_int, const u_char *, int);
extern void tftp_print(const u_char *, u_int);
extern void timed_print(const u_char *, u_int);
extern void timed_print(const u_char *);
extern void udp_print(const u_char *, u_int, const u_char *, int);
extern void wb_print(const void *, u_int);
extern int ah_print(register const u_char *, register const u_char *);
extern int ah_print(register const u_char *);
extern int esp_print(register const u_char *, register const u_char *, int *, int *);
extern void isakmp_print(const u_char *, u_int, const u_char *);
extern int ipcomp_print(register const u_char *, register const u_char *, int *);
extern int ipcomp_print(register const u_char *, int *);
extern void rx_print(register const u_char *, int, int, int, u_char *);
extern void netbeui_print(u_short, const u_char *, int);
extern void ipx_netbios_print(const u_char *, u_int);
@ -284,18 +294,18 @@ extern void nbt_udp138_print(const u_char *, int);
extern char *smb_errstr(int, int);
extern void print_data(const unsigned char *, int);
extern void l2tp_print(const u_char *, u_int);
extern void lcp_print(const u_char *, u_int);
extern void vrrp_print(const u_char *, u_int, int);
extern void cdp_print(const u_char *, u_int, u_int, const u_char *,
const u_char *);
extern void cdp_print(const u_char *, u_int, u_int);
extern void stp_print(const u_char *, u_int);
extern void radius_print(const u_char *, u_int);
extern void lwres_print(const u_char *, u_int);
extern void pptp_print(const u_char *, u_int);
extern void pptp_print(const u_char *);
extern void sctp_print(const u_char *, const u_char *, u_int);
extern void mpls_print(const u_char *, u_int);
extern void mpls_lsp_ping_print(const u_char *, u_int);
extern void zephyr_print(const u_char *, int);
extern void hsrp_print(const u_char *, u_int);
extern void bfd_print(const u_char *, u_int, u_int);
#ifdef INET6
extern void ip6_print(const u_char *, u_int);
@ -303,13 +313,15 @@ extern void ip6_opt_print(const u_char *, int);
extern int hbhopt_print(const u_char *);
extern int dstopt_print(const u_char *);
extern int frag6_print(const u_char *, const u_char *);
extern void icmp6_print(const u_char *, const u_char *);
extern int mobility_print(const u_char *, const u_char *);
extern void icmp6_print(const u_char *, u_int, const u_char *, int);
extern void ripng_print(const u_char *, unsigned int);
extern int rt6_print(const u_char *, const u_char *);
extern void ospf6_print(const u_char *, u_int);
extern void dhcp6_print(const u_char *, u_int, u_int16_t, u_int16_t);
extern void dhcp6_print(const u_char *, u_int);
#endif /*INET6*/
extern u_short in_cksum(const u_short *, register u_int, int);
extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t);
#ifndef HAVE_BPF_DUMP
struct bpf_program;

View File

@ -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 *);

View File

@ -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
View 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
View 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

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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;
};

View 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);

View File

@ -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 */

View File

@ -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 };

View File

@ -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

View File

@ -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

View File

@ -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;

View 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);
}

View 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);
}

View File

@ -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);

View File

@ -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:

View File

@ -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. */

View File

@ -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>
/*
*

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 */
};

View File

@ -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;

View File

@ -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;

View 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 */
}

View File

@ -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.

View File

@ -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 {

View File

@ -1,3 +1,4 @@
/* @(#) $Header: /tcpdump/master/tcpdump/nfs.h,v 1.7 2002/12/11 07:13:55 guy Exp $ (LBL) */
/* $NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp $ */
/*

View File

@ -1,4 +1,4 @@
/* @(#) $Header: /tcpdump/master/tcpdump/nfsfh.h,v 1.12 2001/09/17 21:57:52 fenner Exp $ (LBL) */
/* @(#) $Header: /tcpdump/master/tcpdump/nfsfh.h,v 1.13 2002/04/24 06:27:05 guy Exp $ (LBL) */
/*
* Copyright (c) 1993, 1994 Jeffrey C. Mogul, Digital Equipment Corporation,
@ -65,4 +65,4 @@ typedef struct {
#define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\
dev_eq(a.Fsid_dev, b.Fsid_dev))
extern void Parse_fh(caddr_t *, int, my_fsid *, ino_t *, const char **, const char **, int);
extern void Parse_fh(const unsigned char *, int, my_fsid *, ino_t *, const char **, const char **, int);

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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
View 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
View 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

View File

@ -41,18 +41,16 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.23 2001/09/17 21:57:53 fenner Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.25.2.2 2003/11/16 08:51:07 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <tcpdump-stdinc.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@ -108,11 +106,11 @@ static const char rcsid[] =
((lsb) + ((e)<<8) + ((d)<<16) + ((c)<<24))
#endif
static int is_UCX(unsigned char *);
static int is_UCX(const unsigned char *);
void
Parse_fh(fh, len, fsidp, inop, osnamep, fsnamep, ourself)
register caddr_t *fh;
register const unsigned char *fh;
int len;
my_fsid *fsidp;
ino_t *inop;
@ -120,7 +118,7 @@ const char **osnamep; /* if non-NULL, return OS name here */
const char **fsnamep; /* if non-NULL, return server fs name here (for VMS) */
int ourself; /* true if file handle was generated on this host */
{
register unsigned char *fhp = (unsigned char *)fh;
register const unsigned char *fhp = fh;
u_int32_t temp;
int fhtype = FHT_UNKNOWN;
int i;
@ -436,7 +434,7 @@ int ourself; /* true if file handle was generated on this host */
*/
static int
is_UCX(fhp)
unsigned char *fhp;
const unsigned char *fhp;
{
register int i;
int seen_null = 0;

View 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
View 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)

View File

@ -1,4 +1,4 @@
/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.12 2001/02/04 02:17:55 fenner Exp $ (LBL) */
/* @(#) $Header: /tcpdump/master/tcpdump/ppp.h,v 1.14 2003/05/22 15:29:22 hannes Exp $ (LBL) */
/*
* Point to Point Protocol (PPP) RFC1331
*
@ -38,6 +38,8 @@
#define PPP_HELLO 0x0201 /* 802.1d Hello Packets */
#define PPP_LUXCOM 0x0231 /* Luxcom */
#define PPP_SNS 0x0233 /* Sigma Network Systems */
#define PPP_MPLS_UCAST 0x0281 /* rfc 3032 */
#define PPP_MPLS_MCAST 0x0283 /* rfc 3022 */
#define PPP_IPCP 0x8021 /* IP Control Protocol */
#define PPP_OSICP 0x8023 /* OSI Network Layer Control Protocol */
@ -49,13 +51,17 @@
#define PPP_VINESCP 0x8035 /* Banyan Vines Control Protocol */
#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
#define PPP_CCP 0x80fd /* Compress Control Protocol */
#define PPP_MPLSCP 0x8281 /* rfc 3022 */
#define PPP_LCP 0xc021 /* Link Control Protocol */
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
#define PPP_LQM 0xc025 /* Link Quality Monitoring */
#define PPP_SPAP 0xc027
#define PPP_CHAP 0xc223 /* Challenge Handshake Authentication Protocol */
#define PPP_BACP 0xc02b /* Bandwidth Allocation Control Protocol */
#define PPP_BAP 0xc02d /* BAP */
#define PPP_MP 0xc03d /* Multi-Link */
#define PPP_SPAP_OLD 0xc123
#define PPP_EAP 0xc227
extern struct tok ppptype2str[];

File diff suppressed because it is too large Load Diff

View File

@ -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;
}

View 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);
}
}

View 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;
}

View File

@ -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);
}

View File

@ -20,18 +20,15 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.51.4.2 2002/07/10 07:09:53 guy Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.61.2.2 2003/11/16 08:51:10 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <tcpdump-stdinc.h>
#include <stdio.h>
#include <string.h>
@ -88,18 +85,169 @@ struct arp_pkthdr {
#define ARP_HDRLEN 8
#define HRD(ap) ((ap)->ar_hrd)
#define HRD(ap) EXTRACT_16BITS(&(ap)->ar_hrd)
#define HLN(ap) ((ap)->ar_hln)
#define PLN(ap) ((ap)->ar_pln)
#define OP(ap) ((ap)->ar_op)
#define PRO(ap) ((ap)->ar_pro)
#define OP(ap) EXTRACT_16BITS(&(ap)->ar_op)
#define PRO(ap) EXTRACT_16BITS(&(ap)->ar_pro)
#define SHA(ap) (ar_sha(ap))
#define SPA(ap) (ar_spa(ap))
#define THA(ap) (ar_tha(ap))
#define TPA(ap) (ar_tpa(ap))
/*
* ATM Address Resolution Protocol.
*
* See RFC 2225 for protocol description. ATMARP packets are similar
* to ARP packets, except that there are no length fields for the
* protocol address - instead, there are type/length fields for
* the ATM number and subaddress - and the hardware addresses consist
* of an ATM number and an ATM subaddress.
*/
struct atmarp_pkthdr {
u_short aar_hrd; /* format of hardware address */
#define ARPHRD_ATM2225 19 /* ATM (RFC 2225) */
u_short aar_pro; /* format of protocol address */
u_char aar_shtl; /* length of source ATM number */
u_char aar_sstl; /* length of source ATM subaddress */
#define ATMARP_IS_E164 0x40 /* bit in type/length for E.164 format */
#define ATMARP_LEN_MASK 0x3F /* length of {sub}address in type/length */
u_short aar_op; /* same as regular ARP */
#define ATMARPOP_NAK 10 /* NAK */
u_char aar_spln; /* length of source protocol address */
u_char aar_thtl; /* length of target ATM number */
u_char aar_tstl; /* length of target ATM subaddress */
u_char aar_tpln; /* length of target protocol address */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
u_char aar_sha[]; /* source ATM number */
u_char aar_ssa[]; /* source ATM subaddress */
u_char aar_spa[]; /* sender protocol address */
u_char aar_tha[]; /* target ATM number */
u_char aar_tsa[]; /* target ATM subaddress */
u_char aar_tpa[]; /* target protocol address */
#endif
#define ATMHRD(ap) EXTRACT_16BITS(&(ap)->aar_hrd)
#define ATMSHLN(ap) ((ap)->aar_shtl & ATMARP_LEN_MASK)
#define ATMSSLN(ap) ((ap)->aar_sstl & ATMARP_LEN_MASK)
#define ATMSPLN(ap) ((ap)->aar_spln)
#define ATMOP(ap) EXTRACT_16BITS(&(ap)->aar_op)
#define ATMPRO(ap) EXTRACT_16BITS(&(ap)->aar_pro)
#define ATMTHLN(ap) ((ap)->aar_thtl & ATMARP_LEN_MASK)
#define ATMTSLN(ap) ((ap)->aar_tstl & ATMARP_LEN_MASK)
#define ATMTPLN(ap) ((ap)->aar_tpln)
#define aar_sha(ap) ((const u_char *)((ap)+1))
#define aar_ssa(ap) (aar_sha(ap) + ATMSHLN(ap))
#define aar_spa(ap) (aar_ssa(ap) + ATMSSLN(ap))
#define aar_tha(ap) (aar_spa(ap) + ATMSPLN(ap))
#define aar_tsa(ap) (aar_tha(ap) + ATMTHLN(ap))
#define aar_tpa(ap) (aar_tsa(ap) + ATMTSLN(ap))
};
#define ATMSHA(ap) (aar_sha(ap))
#define ATMSSA(ap) (aar_ssa(ap))
#define ATMSPA(ap) (aar_spa(ap))
#define ATMTHA(ap) (aar_tha(ap))
#define ATMTSA(ap) (aar_tsa(ap))
#define ATMTPA(ap) (aar_tpa(ap))
static u_char ezero[6];
static void
atmarp_addr_print(const u_char *ha, u_int ha_len, const u_char *srca,
u_int srca_len)
{
if (ha_len == 0)
(void)printf("<No address>");
else {
(void)printf("%s", linkaddr_string(ha, ha_len));
if (srca_len != 0)
(void)printf(",%s", linkaddr_string(srca, srca_len));
}
}
static void
atmarp_print(const u_char *bp, u_int length, u_int caplen)
{
const struct atmarp_pkthdr *ap;
u_short pro, hrd, op;
ap = (const struct atmarp_pkthdr *)bp;
TCHECK(*ap);
hrd = ATMHRD(ap);
pro = ATMPRO(ap);
op = ATMOP(ap);
if (!TTEST2(*aar_tpa(ap), ATMTPLN(ap))) {
(void)printf("truncated-atmarp");
default_print((const u_char *)ap, length);
return;
}
if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
ATMSPLN(ap) != 4 || ATMTPLN(ap) != 4) {
(void)printf("atmarp-#%d for proto #%d (%d/%d) hardware #%d",
op, pro, ATMSPLN(ap), ATMTPLN(ap), hrd);
return;
}
if (pro == ETHERTYPE_TRAIL)
(void)printf("trailer-");
switch (op) {
case ARPOP_REQUEST:
(void)printf("arp who-has %s", ipaddr_string(ATMTPA(ap)));
if (ATMTHLN(ap) != 0) {
(void)printf(" (");
atmarp_addr_print(ATMTHA(ap), ATMTHLN(ap),
ATMTSA(ap), ATMTSLN(ap));
(void)printf(")");
}
(void)printf(" tell %s", ipaddr_string(ATMSPA(ap)));
break;
case ARPOP_REPLY:
(void)printf("arp reply %s", ipaddr_string(ATMSPA(ap)));
(void)printf(" is-at ");
atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
ATMSSLN(ap));
break;
case ARPOP_INVREQUEST:
(void)printf("invarp who-is ");
atmarp_addr_print(ATMTHA(ap), ATMTHLN(ap), ATMTSA(ap),
ATMTSLN(ap));
(void)printf(" tell ");
atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
ATMSSLN(ap));
break;
case ARPOP_INVREPLY:
(void)printf("invarp reply ");
atmarp_addr_print(ATMSHA(ap), ATMSHLN(ap), ATMSSA(ap),
ATMSSLN(ap));
(void)printf(" at %s", ipaddr_string(ATMSPA(ap)));
break;
case ATMARPOP_NAK:
(void)printf("nak reply for %s",
ipaddr_string(ATMSPA(ap)));
break;
default:
(void)printf("atmarp-#%d", op);
default_print((const u_char *)ap, caplen);
return;
}
return;
trunc:
(void)printf("[|atmarp]");
}
void
arp_print(const u_char *bp, u_int length, u_int caplen)
{
@ -108,17 +256,22 @@ arp_print(const u_char *bp, u_int length, u_int caplen)
ap = (const struct arp_pkthdr *)bp;
TCHECK(*ap);
if ((const u_char *)(ar_tpa(ap) + PLN(ap)) > snapend) {
hrd = HRD(ap);
if (hrd == ARPHRD_ATM2225) {
atmarp_print(bp, length, caplen);
return;
}
pro = PRO(ap);
op = OP(ap);
if (!TTEST2(*ar_tpa(ap), PLN(ap))) {
(void)printf("truncated-arp");
default_print((const u_char *)ap, length);
return;
}
pro = EXTRACT_16BITS(&PRO(ap));
hrd = EXTRACT_16BITS(&HRD(ap));
op = EXTRACT_16BITS(&OP(ap));
if (pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) {
if ((pro != ETHERTYPE_IP && pro != ETHERTYPE_TRAIL) ||
PLN(ap) != 4 || HLN(ap) == 0) {
(void)printf("arp-#%d for proto #%d (%d) hardware #%d (%d)",
op, pro, PLN(ap), hrd, HLN(ap));
return;
@ -152,6 +305,18 @@ arp_print(const u_char *bp, u_int length, u_int caplen)
ipaddr_string(TPA(ap)));
break;
case ARPOP_INVREQUEST:
(void)printf("invarp who-is %s tell %s",
linkaddr_string(THA(ap), HLN(ap)),
linkaddr_string(SHA(ap), HLN(ap)));
break;
case ARPOP_INVREPLY:
(void)printf("invarp reply %s at %s",
linkaddr_string(THA(ap), HLN(ap)),
ipaddr_string(TPA(ap)));
break;
default:
(void)printf("arp-#%d", op);
default_print((const u_char *)ap, caplen);

View File

@ -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 */

View File

@ -22,24 +22,19 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.70.2.1 2002/02/05 10:04:18 guy Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.78.2.2 2003/11/16 08:51:11 guy Exp $ (LBL)";
#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 <stdlib.h>
#include <string.h>
#include <netdb.h> /* for MAXHOSTNAMELEN on some platforms */
#include <pcap.h>
#include "interface.h"
@ -86,31 +81,23 @@ static const char *ddpskt_string(int);
/*
* Print LLAP packets received on a physical LocalTalk interface.
*/
void
ltalk_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
u_int
ltalk_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
snapend = p + h->caplen;
++infodelay;
ts_print(&h->ts);
llap_print(p, h->caplen);
if(xflag)
default_print(p, h->caplen);
putchar('\n');
--infodelay;
if (infoprint)
info(0);
return (llap_print(p, h->caplen));
}
/*
* Print AppleTalk LLAP packets.
*/
void
u_int
llap_print(register const u_char *bp, u_int length)
{
register const struct LAP *lp;
register const struct atDDP *dp;
register const struct atShortDDP *sdp;
u_short snet;
u_int hdrlen;
/*
* Our packet is on a 4-byte boundary, as we're either called
@ -123,12 +110,13 @@ llap_print(register const u_char *bp, u_int length)
lp = (const struct LAP *)bp;
bp += sizeof(*lp);
length -= sizeof(*lp);
hdrlen = sizeof(*lp);
switch (lp->type) {
case lapShortDDP:
if (length < ddpSSize) {
(void)printf(" [|sddp %d]", length);
return;
return (length);
}
sdp = (const struct atShortDDP *)bp;
printf("%s.%s",
@ -137,13 +125,14 @@ llap_print(register const u_char *bp, u_int length)
ataddr_string(0, lp->dst), ddpskt_string(sdp->dstSkt));
bp += ddpSSize;
length -= ddpSSize;
hdrlen += ddpSSize;
ddp_print(bp, length, sdp->type, 0, lp->src, sdp->srcSkt);
break;
case lapDDP:
if (length < ddpSize) {
(void)printf(" [|ddp %d]", length);
return;
return (length);
}
dp = (const struct atDDP *)bp;
snet = EXTRACT_16BITS(&dp->srcNet);
@ -154,6 +143,7 @@ llap_print(register const u_char *bp, u_int length)
ddpskt_string(dp->dstSkt));
bp += ddpSize;
length -= ddpSize;
hdrlen += ddpSize;
ddp_print(bp, length, dp->type, snet, dp->srcNode, dp->srcSkt);
break;
@ -168,6 +158,7 @@ llap_print(register const u_char *bp, u_int length)
lp->src, lp->dst, lp->type, length);
break;
}
return (hdrlen);
}
/*
@ -194,21 +185,6 @@ atalk_print(register const u_char *bp, u_int length)
ddpskt_string(dp->dstSkt));
bp += ddpSize;
length -= ddpSize;
#ifdef LBL_ALIGN
if ((long)bp & 3) {
static u_char *abuf = NULL;
if (abuf == NULL) {
abuf = (u_char *)malloc(snaplen);
if (abuf == NULL)
error("atalk_print: malloc");
}
memcpy((char *)abuf, (char *)bp, min(length, snaplen));
snapend += abuf - (u_char *)bp;
packetp = abuf;
bp = abuf;
}
#endif
ddp_print(bp, length, dp->type, snet, dp->srcNode, dp->srcSkt);
}
@ -222,9 +198,10 @@ aarp_print(register const u_char *bp, u_int length)
printf("aarp ");
ap = (const struct aarp *)bp;
if (ntohs(ap->htype) == 1 && ntohs(ap->ptype) == ETHERTYPE_ATALK &&
if (EXTRACT_16BITS(&ap->htype) == 1 &&
EXTRACT_16BITS(&ap->ptype) == ETHERTYPE_ATALK &&
ap->halen == 6 && ap->palen == 4 )
switch (ntohs(ap->op)) {
switch (EXTRACT_16BITS(&ap->op)) {
case 1: /* request */
(void)printf("who-has %s tell %s",
@ -242,8 +219,8 @@ aarp_print(register const u_char *bp, u_int length)
return;
}
(void)printf("len %u op %u htype %u ptype %#x halen %u palen %u",
length, ntohs(ap->op), ntohs(ap->htype), ntohs(ap->ptype),
ap->halen, ap->palen);
length, EXTRACT_16BITS(&ap->op), EXTRACT_16BITS(&ap->htype),
EXTRACT_16BITS(&ap->ptype), ap->halen, ap->palen);
}
/*

View File

@ -19,130 +19,225 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.21 2001/07/05 18:54:14 guy Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.33.2.2 2003/11/16 08:51:11 guy Exp $ (LBL)";
#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>
#include <string.h>
#include "interface.h"
#include "extract.h"
#include "addrtoname.h"
#include "ethertype.h"
#include "atm.h"
#include "atmuni31.h"
#include "llc.h"
#include "ether.h"
/*
* This is the top level routine of the printer. 'p' is the points
* to the LLC/SNAP header of the packet, 'tvp' is the timestamp,
* 'length' is the length of the packet off the wire, and 'caplen'
* is the number of bytes actually captured.
* Print an RFC 1483 LLC-encapsulated ATM frame.
*/
void
atm_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
static void
atm_llc_print(const u_char *p, int length, int caplen)
{
u_int caplen = h->caplen;
u_int length = h->len;
u_short ethertype;
u_short extracted_ethertype;
++infodelay;
ts_print(&h->ts);
if (caplen < 8) {
printf("[|atm]");
goto out;
}
if (p[0] != 0xaa || p[1] != 0xaa || p[2] != 0x03) {
/*XXX assume 802.6 MAC header from fore driver */
if (eflag)
printf("%04x%04x %04x%04x ",
p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3],
p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7],
p[8] << 24 | p[9] << 16 | p[10] << 8 | p[11],
p[12] << 24 | p[13] << 16 | p[14] << 8 | p[15]);
p += 20;
length -= 20;
caplen -= 20;
}
ethertype = p[6] << 8 | p[7];
if (eflag)
printf("%02x %02x %02x %02x-%02x-%02x %04x: ",
p[0], p[1], p[2], /* dsap/ssap/ctrl */
p[3], p[4], p[5], /* manufacturer's code */
ethertype);
/*
* 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;
length -= 8;
caplen -= 8;
p += 8;
switch (ethertype) {
case ETHERTYPE_IP:
ip_print(p, length);
break;
#ifdef INET6
case ETHERTYPE_IPV6:
ip6_print(p, length);
break;
#endif /*INET6*/
/*XXX this probably isn't right */
case ETHERTYPE_ARP:
case ETHERTYPE_REVARP:
arp_print(p, length, caplen);
break;
#ifdef notyet
case ETHERTYPE_DN:
decnet_print(p, length, caplen);
break;
case ETHERTYPE_ATALK:
if (vflag)
fputs("et1 ", stdout);
atalk_print(p, length);
break;
case ETHERTYPE_AARP:
aarp_print(p, length);
break;
case ETHERTYPE_LAT:
case ETHERTYPE_MOPRC:
case ETHERTYPE_MOPDL:
/* default_print for now */
#endif
default:
if (!llc_print(p, length, caplen, NULL, NULL,
&extracted_ethertype)) {
/* ether_type not known, print raw packet */
if (!eflag)
printf("%02x %02x %02x %02x-%02x-%02x %04x: ",
packetp[0], packetp[1], packetp[2], /* dsap/ssap/ctrl */
packetp[3], packetp[4], packetp[5], /* manufacturer's code */
ethertype);
if (extracted_ethertype) {
printf("(LLC %s) ",
etherproto_string(htons(extracted_ethertype)));
}
if (!xflag && !qflag)
default_print(p, caplen);
}
if (xflag)
default_print(p, caplen);
out:
putchar('\n');
--infodelay;
if (infoprint)
info(0);
}
/*
* Given a SAP value, generate the LLC header value for a UI packet
* with that SAP as the source and destination SAP.
*/
#define LLC_UI_HDR(sap) ((sap)<<16 | (sap<<8) | 0x03)
/*
* This is the top level routine of the printer. 'p' points
* to the LLC/SNAP header of the packet, 'h->ts' is the timestamp,
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
* is the number of bytes actually captured.
*/
u_int
atm_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int length = h->len;
u_int32_t llchdr;
u_int hdrlen = 0;
if (caplen < 8) {
printf("[|atm]");
return (caplen);
}
/*
* Extract the presumed LLC header into a variable, for quick
* testing.
* Then check for a header that's neither a header for a SNAP
* packet nor an RFC 2684 routed NLPID-formatted PDU nor
* an 802.2-but-no-SNAP IP packet.
*/
llchdr = EXTRACT_24BITS(p);
if (llchdr != LLC_UI_HDR(LLCSAP_SNAP) &&
llchdr != LLC_UI_HDR(LLCSAP_ISONS) &&
llchdr != LLC_UI_HDR(LLCSAP_IP)) {
/*
* XXX - assume 802.6 MAC header from Fore driver.
*
* Unfortunately, the above list doesn't check for
* all known SAPs, doesn't check for headers where
* the source and destination SAP aren't the same,
* and doesn't check for non-UI frames. It also
* runs the risk of an 802.6 MAC header that happens
* to begin with one of those values being
* incorrectly treated as an 802.2 header.
*
* So is that Fore driver still around? And, if so,
* is it still putting 802.6 MAC headers on ATM
* packets? If so, could it be changed to use a
* new DLT_IEEE802_6 value if we added it?
*/
if (eflag)
printf("%08x%08x %08x%08x ",
EXTRACT_32BITS(p),
EXTRACT_32BITS(p+4),
EXTRACT_32BITS(p+8),
EXTRACT_32BITS(p+12));
p += 20;
length -= 20;
caplen -= 20;
hdrlen += 20;
}
atm_llc_print(p, length, caplen);
return (hdrlen);
}
/*
* ATM signalling.
*/
static struct tok msgtype2str[] = {
{ CALL_PROCEED, "Call_proceeding" },
{ CONNECT, "Connect" },
{ CONNECT_ACK, "Connect_ack" },
{ SETUP, "Setup" },
{ RELEASE, "Release" },
{ RELEASE_DONE, "Release_complete" },
{ RESTART, "Restart" },
{ RESTART_ACK, "Restart_ack" },
{ STATUS, "Status" },
{ STATUS_ENQ, "Status_enquiry" },
{ ADD_PARTY, "Add_party" },
{ ADD_PARTY_ACK, "Add_party_ack" },
{ ADD_PARTY_REJ, "Add_party_reject" },
{ DROP_PARTY, "Drop_party" },
{ DROP_PARTY_ACK, "Drop_party_ack" },
{ 0, NULL }
};
static void
sig_print(const u_char *p, int caplen)
{
bpf_u_int32 call_ref;
if (caplen < PROTO_POS) {
printf("[|atm]");
return;
}
if (p[PROTO_POS] == Q2931) {
/*
* protocol:Q.2931 for User to Network Interface
* (UNI 3.1) signalling
*/
printf("Q.2931");
if (caplen < MSG_TYPE_POS) {
printf(" [|atm]");
return;
}
printf(":%s ",
tok2str(msgtype2str, "msgtype#%d", p[MSG_TYPE_POS]));
if (caplen < CALL_REF_POS+3) {
printf("[|atm]");
return;
}
call_ref = EXTRACT_24BITS(&p[CALL_REF_POS]);
printf("CALL_REF:0x%06x", call_ref);
} else {
/* SCCOP with some unknown protocol atop it */
printf("SSCOP, proto %d ", p[PROTO_POS]);
}
}
/*
* Print an ATM PDU (such as an AAL5 PDU).
*/
void
atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
u_int caplen)
{
if (eflag)
printf("VPI:%u VCI:%u ", vpi, vci);
if (vpi == 0) {
switch (vci) {
case PPC:
sig_print(p, caplen);
return;
case BCC:
printf("broadcast sig: ");
return;
case OAMF4SC:
printf("oamF4(segment): ");
return;
case OAMF4EC:
printf("oamF4(end): ");
return;
case METAC:
printf("meta: ");
return;
case ILMIC:
printf("ilmi: ");
snmp_print(p, length);
return;
}
}
switch (traftype) {
case ATM_LLC:
default:
/*
* Assumes traffic is LLC if unknown.
*/
atm_llc_print(p, length, caplen);
break;
case ATM_LANE:
lane_print(p, length, caplen);
break;
}
}

View File

@ -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
View 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

View File

@ -21,21 +21,16 @@
* Format and print bootp packets.
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60.4.2 2002/06/01 23:51:11 guy Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.75.2.3 2004/03/02 07:45:13 hannes Exp $ (LBL)";
#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>
@ -50,12 +45,22 @@ static void cmu_print(const u_char *);
static char tstr[] = " [|bootp]";
static const struct tok bootp_flag_values[] = {
{ 0x8000, "Broadcast" },
{ 0, NULL}
};
static const struct tok bootp_op_values[] = {
{ BOOTPREQUEST, "Request" },
{ BOOTPREPLY, "Reply" },
{ 0, NULL}
};
/*
* Print bootp requests
*/
void
bootp_print(register const u_char *cp, u_int length,
u_short sport, u_short dport)
bootp_print(register const u_char *cp, u_int length)
{
register const struct bootp *bp;
static const u_char vm_cmu[4] = VM_CMU;
@ -63,84 +68,72 @@ bootp_print(register const u_char *cp, u_int length,
bp = (const struct bootp *)cp;
TCHECK(bp->bp_op);
switch (bp->bp_op) {
case BOOTREQUEST:
/* Usually, a request goes from a client to a server */
if (sport != IPPORT_BOOTPC || dport != IPPORT_BOOTPS)
printf(" (request)");
break;
printf("BOOTP/DHCP, %s",
tok2str(bootp_op_values, "unknown (0x%02x)", bp->bp_op));
case BOOTREPLY:
/* Usually, a reply goes from a server to a client */
if (sport != IPPORT_BOOTPS || dport != IPPORT_BOOTPC)
printf(" (reply)");
break;
default:
printf(" bootp-#%d", bp->bp_op);
if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
TCHECK2(bp->bp_chaddr[0], 6);
printf(" from %s", etheraddr_string(bp->bp_chaddr));
}
printf(", length: %u", length);
if (!vflag)
return;
TCHECK(bp->bp_secs);
/* The usual hardware address type is 1 (10Mb Ethernet) */
if (bp->bp_htype != 1)
printf(" htype-#%d", bp->bp_htype);
printf(", htype-#%d", bp->bp_htype);
/* The usual length for 10Mb Ethernet address is 6 bytes */
if (bp->bp_htype != 1 || bp->bp_hlen != 6)
printf(" hlen:%d", bp->bp_hlen);
printf(", hlen:%d", bp->bp_hlen);
/* Only print interesting fields */
if (bp->bp_hops)
printf(" hops:%d", bp->bp_hops);
printf(", hops:%d", bp->bp_hops);
if (bp->bp_xid)
printf(" xid:0x%x", (u_int32_t)ntohl(bp->bp_xid));
printf(", xid:0x%x", EXTRACT_32BITS(&bp->bp_xid));
if (bp->bp_secs)
printf(" secs:%d", ntohs(bp->bp_secs));
if (bp->bp_flags)
printf(" flags:0x%x", ntohs(bp->bp_flags));
printf(", secs:%d", EXTRACT_16BITS(&bp->bp_secs));
printf(", flags: [%s]",
bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags)));
if (vflag>1)
printf( " (0x%04x)", EXTRACT_16BITS(&bp->bp_flags));
/* Client's ip address */
TCHECK(bp->bp_ciaddr);
if (bp->bp_ciaddr.s_addr)
printf(" C:%s", ipaddr_string(&bp->bp_ciaddr));
printf("\n\t Client IP: %s", ipaddr_string(&bp->bp_ciaddr));
/* 'your' ip address (bootp client) */
TCHECK(bp->bp_yiaddr);
if (bp->bp_yiaddr.s_addr)
printf(" Y:%s", ipaddr_string(&bp->bp_yiaddr));
printf("\n\t Your IP: %s", ipaddr_string(&bp->bp_yiaddr));
/* Server's ip address */
TCHECK(bp->bp_siaddr);
if (bp->bp_siaddr.s_addr)
printf(" S:%s", ipaddr_string(&bp->bp_siaddr));
printf("\n\t Server IP: %s", ipaddr_string(&bp->bp_siaddr));
/* Gateway's ip address */
TCHECK(bp->bp_giaddr);
if (bp->bp_giaddr.s_addr)
printf(" G:%s", ipaddr_string(&bp->bp_giaddr));
printf("\n\t Gateway IP: %s", ipaddr_string(&bp->bp_giaddr));
/* Client's Ethernet address */
if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
register const struct ether_header *eh;
register const char *e;
TCHECK2(bp->bp_chaddr[0], 6);
eh = (const struct ether_header *)packetp;
if (bp->bp_op == BOOTREQUEST)
e = (const char *)ESRC(eh);
else if (bp->bp_op == BOOTREPLY)
e = (const char *)EDST(eh);
else
e = 0;
if (e == 0 || memcmp((const char *)bp->bp_chaddr, e, 6) != 0)
printf(" ether %s", etheraddr_string(bp->bp_chaddr));
printf("\n\t Client Ethernet Address: %s", etheraddr_string(bp->bp_chaddr));
}
TCHECK2(bp->bp_sname[0], 1); /* check first char only */
if (*bp->bp_sname) {
printf(" sname \"");
printf("\n\t sname \"");
if (fn_print(bp->bp_sname, snapend)) {
putchar('"');
fputs(tstr + 1, stdout);
@ -148,9 +141,9 @@ bootp_print(register const u_char *cp, u_int length,
}
putchar('"');
}
TCHECK2(bp->bp_sname[0], 1); /* check first char only */
TCHECK2(bp->bp_file[0], 1); /* check first char only */
if (*bp->bp_file) {
printf(" file \"");
printf("\n\t file \"");
if (fn_print(bp->bp_file, snapend)) {
putchar('"');
fputs(tstr + 1, stdout);
@ -172,7 +165,7 @@ bootp_print(register const u_char *cp, u_int length,
ul = EXTRACT_32BITS(&bp->bp_vend);
if (ul != 0)
printf("vend-#0x%x", ul);
printf("\n\t Vendor-#0x%x", ul);
}
return;
@ -284,7 +277,7 @@ static struct tok tag2str[] = {
{ TAG_NS_SEARCH, "sNSSEARCH" }, /* XXX 's' */
/* RFC 3011 */
{ TAG_IP4_SUBNET_SELECT, "iSUBNET" },
/* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */
/* http://www.iana.org/assignments/bootp-dhcp-extensions/index.htm */
{ TAG_USER_CLASS, "aCLASS" },
{ TAG_SLP_NAMING_AUTH, "aSLP-NA" },
{ TAG_CLIENT_FQDN, "$FQDN" },
@ -355,7 +348,7 @@ rfc1048_print(register const u_char *bp)
u_int16_t us;
u_int8_t uc;
printf(" vend-rfc1048");
printf("\n\t Vendor-rfc1048:");
/* Step over magic cookie */
bp += sizeof(int32_t);
@ -378,7 +371,7 @@ rfc1048_print(register const u_char *bp)
} else
cp = tok2str(tag2str, "?T%u", tag);
c = *cp++;
printf(" %s:", cp);
printf("\n\t %s:", cp);
/* Get the length; check for truncation */
if (bp + 1 >= snapend) {
@ -387,7 +380,7 @@ rfc1048_print(register const u_char *bp)
}
len = *bp++;
if (bp + len >= snapend) {
fputs(tstr, stdout);
printf("[|bootp %u]", len);
return;
}
@ -563,6 +556,10 @@ rfc1048_print(register const u_char *bp)
break;
case TAG_CLIENT_FQDN:
/* option 81 should be at least 4 bytes long */
if (len < 4)
printf("ERROR: options 81 len %u < 4 bytes", len);
break;
if (*bp++)
printf("[svrreg]");
if (*bp)
@ -580,8 +577,10 @@ rfc1048_print(register const u_char *bp)
size--;
if (type == 0) {
putchar('"');
(void)fn_printn(bp, size, NULL);
(void)fn_printn(bp, size, NULL);
putchar('"');
bp += size;
size = 0;
break;
} else {
printf("[%s]", tok2str(arp2str, "type-%d", type));
@ -607,8 +606,10 @@ rfc1048_print(register const u_char *bp)
break;
}
/* Data left over? */
if (size)
if (size) {
printf("[len %u]", len);
bp += size;
}
}
return;
trunc:

View File

@ -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;
}

View File

@ -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]");
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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;

View File

@ -20,18 +20,15 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.78 2001/10/19 09:00:48 guy Exp $ (LBL)";
static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.86.2.3 2004/03/28 20:54:00 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <tcpdump-stdinc.h>
#include "nameser.h"
@ -57,15 +54,16 @@ static const char *ns_resp[] = {
/* skip over a domain name */
static const u_char *
ns_nskip(register const u_char *cp, register const u_char *bp)
ns_nskip(register const u_char *cp)
{
register u_char i;
if (!TTEST2(*cp, 1))
return (NULL);
if (((i = *cp++) & INDIR_MASK) == INDIR_MASK)
return (cp + 1);
i = *cp++;
while (i) {
if ((i & INDIR_MASK) == INDIR_MASK)
return (cp + 1);
if ((i & INDIR_MASK) == EDNS0_MASK) {
int bitlen, bytelen;
@ -91,7 +89,6 @@ static const u_char *
blabel_print(const u_char *cp)
{
int bitlen, slen, b;
int truncated = 0;
const u_char *bitp, *lim;
char tc;
@ -100,27 +97,28 @@ blabel_print(const u_char *cp)
if ((bitlen = *cp) == 0)
bitlen = 256;
slen = (bitlen + 3) / 4;
if ((lim = cp + 1 + slen) > snapend) {
truncated = 1;
lim = snapend;
}
lim = cp + 1 + slen;
/* print the bit string as a hex string */
printf("\\[x");
for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++)
for (bitp = cp + 1, b = bitlen; bitp < lim && b > 7; b -= 8, bitp++) {
TCHECK(*bitp);
printf("%02x", *bitp);
if (bitp == lim)
printf("...");
else if (b > 4) {
}
if (b > 4) {
TCHECK(*bitp);
tc = *bitp++;
printf("%02x", tc & (0xff << (8 - b)));
} else if (b > 0) {
TCHECK(*bitp);
tc = *bitp++;
printf("%1x", ((tc >> 4) & 0x0f) & (0x0f << (4 - b)));
}
printf("/%d]", bitlen);
return(truncated ? NULL : lim);
return lim;
trunc:
printf(".../%d]", bitlen);
return NULL;
}
static int
@ -155,7 +153,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
int elt;
int data_size = snapend - bp;
if ((l = labellen(cp)) < 0)
if ((l = labellen(cp)) == (u_int)-1)
return(NULL);
if (!TTEST2(*cp, 1))
return(NULL);
@ -175,7 +173,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
if (!TTEST2(*cp, 1))
return(NULL);
cp = bp + (((i << 8) | *cp) & 0x3fff);
if ((l = labellen(cp)) < 0)
if ((l = labellen(cp)) == (u_int)-1)
return(NULL);
if (!TTEST2(*cp, 1))
return(NULL);
@ -214,7 +212,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
cp += l;
chars_processed += l;
putchar('.');
if ((l = labellen(cp)) < 0)
if ((l = labellen(cp)) == (u_int)-1)
return(NULL);
if (!TTEST2(*cp, 1))
return(NULL);
@ -230,7 +228,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp)
/* print a <character-string> */
static const u_char *
ns_cprint(register const u_char *cp, register const u_char *bp)
ns_cprint(register const u_char *cp)
{
register u_int i;
@ -242,56 +240,57 @@ ns_cprint(register const u_char *cp, register const u_char *bp)
return (cp + i);
}
/* http://www.iana.org/assignments/dns-parameters */
struct tok ns_type2str[] = {
{ T_A, "A" },
{ T_NS, "NS" },
{ T_MD, "MD" },
{ T_MF, "MF" },
{ T_CNAME, "CNAME" },
{ T_SOA, "SOA" },
{ T_MB, "MB" },
{ T_MG, "MG" },
{ T_MR, "MR" },
{ T_NULL, "NULL" },
{ T_WKS, "WKS" },
{ T_PTR, "PTR" },
{ T_HINFO, "HINFO" },
{ T_MINFO, "MINFO" },
{ T_MX, "MX" },
{ T_TXT, "TXT" },
{ T_RP, "RP" },
{ T_AFSDB, "AFSDB" },
{ T_X25, "X25" },
{ T_ISDN, "ISDN" },
{ T_RT, "RT" },
{ T_NSAP, "NSAP" },
{ T_A, "A" }, /* RFC 1035 */
{ T_NS, "NS" }, /* RFC 1035 */
{ T_MD, "MD" }, /* RFC 1035 */
{ T_MF, "MF" }, /* RFC 1035 */
{ T_CNAME, "CNAME" }, /* RFC 1035 */
{ T_SOA, "SOA" }, /* RFC 1035 */
{ T_MB, "MB" }, /* RFC 1035 */
{ T_MG, "MG" }, /* RFC 1035 */
{ T_MR, "MR" }, /* RFC 1035 */
{ T_NULL, "NULL" }, /* RFC 1035 */
{ T_WKS, "WKS" }, /* RFC 1035 */
{ T_PTR, "PTR" }, /* RFC 1035 */
{ T_HINFO, "HINFO" }, /* RFC 1035 */
{ T_MINFO, "MINFO" }, /* RFC 1035 */
{ T_MX, "MX" }, /* RFC 1035 */
{ T_TXT, "TXT" }, /* RFC 1035 */
{ T_RP, "RP" }, /* RFC 1183 */
{ T_AFSDB, "AFSDB" }, /* RFC 1183 */
{ T_X25, "X25" }, /* RFC 1183 */
{ T_ISDN, "ISDN" }, /* RFC 1183 */
{ T_RT, "RT" }, /* RFC 1183 */
{ T_NSAP, "NSAP" }, /* RFC 1706 */
{ T_NSAP_PTR, "NSAP_PTR" },
{ T_SIG, "SIG" },
{ T_KEY, "KEY" },
{ T_PX, "PX" },
{ T_GPOS, "GPOS" },
{ T_AAAA, "AAAA" },
{ T_LOC, "LOC" },
{ T_NXT, "NXT" },
{ T_EID, "EID" },
{ T_NIMLOC, "NIMLOC" },
{ T_SRV, "SRV" },
{ T_ATMA, "ATMA" },
{ T_NAPTR, "NAPTR" },
{ T_A6, "A6" },
{ T_DNAME, "DNAME" },
{ T_OPT, "OPT" },
{ T_SIG, "SIG" }, /* RFC 2535 */
{ T_KEY, "KEY" }, /* RFC 2535 */
{ T_PX, "PX" }, /* RFC 2163 */
{ T_GPOS, "GPOS" }, /* RFC 1712 */
{ T_AAAA, "AAAA" }, /* RFC 1886 */
{ T_LOC, "LOC" }, /* RFC 1876 */
{ T_NXT, "NXT" }, /* RFC 2535 */
{ T_EID, "EID" }, /* Nimrod */
{ T_NIMLOC, "NIMLOC" }, /* Nimrod */
{ T_SRV, "SRV" }, /* RFC 2782 */
{ T_ATMA, "ATMA" }, /* ATM Forum */
{ T_NAPTR, "NAPTR" }, /* RFC 2168, RFC 2915 */
{ T_A6, "A6" }, /* RFC 2874 */
{ T_DNAME, "DNAME" }, /* RFC 2672 */
{ T_OPT, "OPT" }, /* RFC 2671 */
{ T_UINFO, "UINFO" },
{ T_UID, "UID" },
{ T_GID, "GID" },
{ T_UNSPEC, "UNSPEC" },
{ T_UNSPECA, "UNSPECA" },
{ T_TKEY, "TKEY" },
{ T_TSIG, "TSIG" },
{ T_IXFR, "IXFR" },
{ T_AXFR, "AXFR" },
{ T_MAILB, "MAILB" },
{ T_MAILA, "MAILA" },
{ T_TKEY, "TKEY" }, /* RFC 2930 */
{ T_TSIG, "TSIG" }, /* RFC 2845 */
{ T_IXFR, "IXFR" }, /* RFC 1995 */
{ T_AXFR, "AXFR" }, /* RFC 1035 */
{ T_MAILB, "MAILB" }, /* RFC 1035 */
{ T_MAILA, "MAILA" }, /* RFC 1035 */
{ T_ANY, "ANY" },
{ 0, NULL }
};
@ -306,23 +305,25 @@ struct tok ns_class2str[] = {
/* print a query */
static const u_char *
ns_qprint(register const u_char *cp, register const u_char *bp)
ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns)
{
register const u_char *np = cp;
register u_int i;
cp = ns_nskip(cp, bp);
cp = ns_nskip(cp);
if (cp == NULL || !TTEST2(*cp, 4))
return(NULL);
/* print the qtype and qclass (if it's not IN) */
i = *cp++ << 8;
i |= *cp++;
i = EXTRACT_16BITS(cp);
cp += 2;
printf(" %s", tok2str(ns_type2str, "Type%d", i));
i = *cp++ << 8;
i |= *cp++;
if (i != C_IN)
i = EXTRACT_16BITS(cp);
cp += 2;
if (is_mdns && i == (C_IN|C_CACHE_FLUSH))
printf(" (Cache flush)");
else if (i != C_IN)
printf(" %s", tok2str(ns_class2str, "(Class %d)", i));
fputs("? ", stdout);
@ -332,7 +333,7 @@ ns_qprint(register const u_char *cp, register const u_char *bp)
/* print a reply */
static const u_char *
ns_rprint(register const u_char *cp, register const u_char *bp)
ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
{
register u_int class;
register u_short typ, len;
@ -343,24 +344,26 @@ ns_rprint(register const u_char *cp, register const u_char *bp)
if ((cp = ns_nprint(cp, bp)) == NULL)
return NULL;
} else
cp = ns_nskip(cp, bp);
cp = ns_nskip(cp);
if (cp == NULL || !TTEST2(*cp, 10))
return (snapend);
/* print the type/qtype and class (if it's not IN) */
typ = *cp++ << 8;
typ |= *cp++;
class = *cp++ << 8;
class |= *cp++;
if (class != C_IN && typ != T_OPT)
typ = EXTRACT_16BITS(cp);
cp += 2;
class = EXTRACT_16BITS(cp);
cp += 2;
if (is_mdns && class == (C_IN|C_CACHE_FLUSH))
printf(" (Cache flush)");
else if (class != C_IN && typ != T_OPT)
printf(" %s", tok2str(ns_class2str, "(Class %d)", class));
/* ignore ttl */
cp += 4;
len = *cp++ << 8;
len |= *cp++;
len = EXTRACT_16BITS(cp);
cp += 2;
rp = cp + len;
@ -418,8 +421,23 @@ ns_rprint(register const u_char *cp, register const u_char *bp)
break;
case T_TXT:
while (cp < rp) {
printf(" \"");
cp = ns_cprint(cp);
if (cp == NULL)
return(NULL);
putchar('"');
}
break;
case T_SRV:
putchar(' ');
(void)ns_cprint(cp, bp);
if (!TTEST2(*cp, 6))
return(NULL);
if (ns_nprint(cp + 6, bp) == NULL)
return(NULL);
printf(":%d %d %d", EXTRACT_16BITS(cp + 4),
EXTRACT_16BITS(cp), EXTRACT_16BITS(cp + 2));
break;
#ifdef INET6
@ -504,55 +522,56 @@ ns_rprint(register const u_char *cp, register const u_char *bp)
}
void
ns_print(register const u_char *bp, u_int length)
ns_print(register const u_char *bp, u_int length, int is_mdns)
{
register const HEADER *np;
register int qdcount, ancount, nscount, arcount;
register const u_char *cp;
u_int16_t b2;
np = (const HEADER *)bp;
TCHECK(*np);
/* get the byte-order right */
qdcount = ntohs(np->qdcount);
ancount = ntohs(np->ancount);
nscount = ntohs(np->nscount);
arcount = ntohs(np->arcount);
qdcount = EXTRACT_16BITS(&np->qdcount);
ancount = EXTRACT_16BITS(&np->ancount);
nscount = EXTRACT_16BITS(&np->nscount);
arcount = EXTRACT_16BITS(&np->arcount);
if (DNS_QR(np)) {
/* this is a response */
printf(" %d%s%s%s%s%s%s",
ntohs(np->id),
EXTRACT_16BITS(&np->id),
ns_ops[DNS_OPCODE(np)],
ns_resp[DNS_RCODE(np)],
DNS_AA(np)? "*" : "",
DNS_RA(np)? "" : "-",
DNS_TC(np)? "|" : "",
DNS_CD(np)? "%" : "");
DNS_AD(np)? "$" : "");
if (qdcount != 1)
printf(" [%dq]", qdcount);
/* Print QUESTION section on -vv */
cp = (const u_char *)(np + 1);
while (qdcount--) {
if (qdcount < ntohs(np->qdcount) - 1)
if (qdcount < EXTRACT_16BITS(&np->qdcount) - 1)
putchar(',');
if (vflag > 1) {
fputs(" q:", stdout);
if ((cp = ns_qprint(cp, bp)) == NULL)
if ((cp = ns_qprint(cp, bp, is_mdns)) == NULL)
goto trunc;
} else {
if ((cp = ns_nskip(cp, bp)) == NULL)
if ((cp = ns_nskip(cp)) == NULL)
goto trunc;
cp += 4; /* skip QTYPE and QCLASS */
}
}
printf(" %d/%d/%d", ancount, nscount, arcount);
if (ancount--) {
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && ancount--) {
putchar(',');
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
@ -562,11 +581,11 @@ ns_print(register const u_char *bp, u_int length)
if (vflag > 1) {
if (cp < snapend && nscount--) {
fputs(" ns:", stdout);
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && nscount--) {
putchar(',');
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
@ -574,11 +593,11 @@ ns_print(register const u_char *bp, u_int length)
goto trunc;
if (cp < snapend && arcount--) {
fputs(" ar:", stdout);
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && arcount--) {
putchar(',');
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
@ -588,13 +607,14 @@ ns_print(register const u_char *bp, u_int length)
}
else {
/* this is a request */
printf(" %d%s%s%s", ntohs(np->id), ns_ops[DNS_OPCODE(np)],
printf(" %d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)],
DNS_RD(np) ? "+" : "",
DNS_AD(np) ? "$" : "");
DNS_CD(np) ? "%" : "");
/* any weirdness? */
if (*(((u_short *)np)+1) & htons(0x6cf))
printf(" [b2&3=0x%x]", ntohs(*(((u_short *)np)+1)));
b2 = EXTRACT_16BITS(((u_short *)np)+1);
if (b2 & 0x6cf)
printf(" [b2&3=0x%x]", b2);
if (DNS_OPCODE(np) == IQUERY) {
if (qdcount)
@ -615,12 +635,13 @@ ns_print(register const u_char *bp, u_int length)
cp = (const u_char *)(np + 1);
if (qdcount--) {
cp = ns_qprint(cp, (const u_char *)np);
cp = ns_qprint(cp, (const u_char *)np, is_mdns);
if (!cp)
goto trunc;
while (cp < snapend && qdcount--) {
cp = ns_qprint((const u_char *)cp,
(const u_char *)np);
(const u_char *)np,
is_mdns);
if (!cp)
goto trunc;
}
@ -631,11 +652,11 @@ ns_print(register const u_char *bp, u_int length)
/* Print remaining sections on -vv */
if (vflag > 1) {
if (ancount--) {
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && ancount--) {
putchar(',');
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
@ -643,11 +664,11 @@ ns_print(register const u_char *bp, u_int length)
goto trunc;
if (cp < snapend && nscount--) {
fputs(" ns:", stdout);
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (nscount-- && cp < snapend) {
putchar(',');
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}
@ -655,11 +676,11 @@ ns_print(register const u_char *bp, u_int length)
goto trunc;
if (cp < snapend && arcount--) {
fputs(" ar:", stdout);
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
while (cp < snapend && arcount--) {
putchar(',');
if ((cp = ns_rprint(cp, bp)) == NULL)
if ((cp = ns_rprint(cp, bp, is_mdns)) == NULL)
goto trunc;
}
}

View File

@ -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);
}

View File

@ -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:

Some files were not shown because too many files have changed in this diff Show More