Update tcpdump to 4.1.1.
Changes: Thu. April 1, 2010. guy@alum.mit.edu. Summary for 4.1.1 tcpdump release Fix build on systems with PF, such as FreeBSD and OpenBSD. Don't blow up if a zero-length link-layer address is passed to linkaddr_string(). Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu. Summary for 4.1.0 tcpdump release Fix printing of MAC addresses for VLAN frames with a length field Add some additional bounds checks and use the EXTRACT_ macros more Add a -b flag to print the AS number in BGP packets in ASDOT notation rather than ASPLAIN notation Add ICMPv6 RFC 5006 support Decode the access flags in NFS access requests Handle the new DLT_ for memory-mapped USB captures on Linux Make the default snapshot (-s) the maximum Print name of device (when -L is used) Support for OpenSolaris (and SXCE build 125 and later) Print new TCP flags Add support for RPL DIO Add support for TCP User Timeout (UTO) Add support for non-standard Ethertypes used by 3com PPPoE gear Add support for 802.11n and 802.11s Add support for Transparent Ethernet Bridge ethertype in GRE Add 4 byte AS support for BGP printer Add support for the MDT SAFI 66 BG printer Add basic IPv6 support to print-olsr Add USB printer Add printer for ForCES Handle frames with an FCS Handle 802.11n Control Wrapper, Block Acq Req and Block Ack frames Fix TCP sequence number printing Report 802.2 packets as 802.2 instead of 802.3 Don't include -L/usr/lib in LDFLAGS On x86_64 Linux, look in lib64 directory too Lots of code clean ups Autoconf clean ups Update testcases to make output changes Fix compiling with/out smi (--with{,out}-smi) Fix compiling without IPv6 support (--disable-ipv6)
This commit is contained in:
parent
0ea0e7ad03
commit
6d59e2f382
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/tcpdump/dist/; revision=214456 svn path=/vendor/tcpdump/4.1.1/; revision=214468; tag=vendor/tcpdump/4.1.1
43
CHANGES
43
CHANGES
@ -1,4 +1,45 @@
|
||||
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.98.2.2 2008-10-15 23:26:30 ken Exp $
|
||||
Thu. April 1, 2010. guy@alum.mit.edu.
|
||||
Summary for 4.1.1 tcpdump release
|
||||
Fix build on systems with PF, such as FreeBSD and OpenBSD.
|
||||
Don't blow up if a zero-length link-layer address is passed to
|
||||
linkaddr_string().
|
||||
|
||||
Thu. March 11, 2010. ken@netfunctional.ca/guy@alum.mit.edu.
|
||||
Summary for 4.1.0 tcpdump release
|
||||
Fix printing of MAC addresses for VLAN frames with a length
|
||||
field
|
||||
Add some additional bounds checks and use the EXTRACT_ macros
|
||||
more
|
||||
Add a -b flag to print the AS number in BGP packets in ASDOT
|
||||
notation rather than ASPLAIN notation
|
||||
Add ICMPv6 RFC 5006 support
|
||||
Decode the access flags in NFS access requests
|
||||
Handle the new DLT_ for memory-mapped USB captures on Linux
|
||||
Make the default snapshot (-s) the maximum
|
||||
Print name of device (when -L is used)
|
||||
Support for OpenSolaris (and SXCE build 125 and later)
|
||||
Print new TCP flags
|
||||
Add support for RPL DIO
|
||||
Add support for TCP User Timeout (UTO)
|
||||
Add support for non-standard Ethertypes used by 3com PPPoE gear
|
||||
Add support for 802.11n and 802.11s
|
||||
Add support for Transparent Ethernet Bridge ethertype in GRE
|
||||
Add 4 byte AS support for BGP printer
|
||||
Add support for the MDT SAFI 66 BG printer
|
||||
Add basic IPv6 support to print-olsr
|
||||
Add USB printer
|
||||
Add printer for ForCES
|
||||
Handle frames with an FCS
|
||||
Handle 802.11n Control Wrapper, Block Acq Req and Block Ack frames
|
||||
Fix TCP sequence number printing
|
||||
Report 802.2 packets as 802.2 instead of 802.3
|
||||
Don't include -L/usr/lib in LDFLAGS
|
||||
On x86_64 Linux, look in lib64 directory too
|
||||
Lots of code clean ups
|
||||
Autoconf clean ups
|
||||
Update testcases to make output changes
|
||||
Fix compiling with/out smi (--with{,out}-smi)
|
||||
Fix compiling without IPv6 support (--disable-ipv6)
|
||||
|
||||
Mon. October 27, 2008. ken@netfunctional.ca. Summary for 4.0.0 tcpdump release
|
||||
Add support for Bluetooth Sniffing
|
||||
|
27
CREDITS
27
CREDITS
@ -27,6 +27,7 @@ Additional people who have contributed patches:
|
||||
Ben Byer <bushing at sourceforge dot net>
|
||||
Atsushi Onoe <onoe at netbsd dot org>
|
||||
Ben Smithurst <ben at scientia dot demon dot co dot uk>
|
||||
Bert Vermeulen <bert at biot dot com>
|
||||
Bjoern A. Zeeb <bzeeb at Zabbadoz dot NeT>
|
||||
Brent L. Bates <blbates at vigyan dot com>
|
||||
Brian Ginsbach <ginsbach at cray dot com>
|
||||
@ -44,11 +45,15 @@ Additional people who have contributed patches:
|
||||
Daniel Hagerty <hag at ai dot mit dot edu>
|
||||
Darren Reed <darrenr at reed dot wattle dot id dot au>
|
||||
David Binderman <d dot binderman at virgin dot net>
|
||||
David Horn <dhorn2000 at gmail dot com>
|
||||
David Smith <dsmith at redhat dot com>
|
||||
David Young <dyoung at ojctech dot com>
|
||||
Don Ebright <Don dot Ebright at compuware dot com>
|
||||
Eddie Kohler <xexd at sourceforge dot net>
|
||||
Elmar Kirchner <elmar at juniper dot net>
|
||||
Fang Wang <fangwang at sourceforge dot net>
|
||||
Florent Drouin <Florent dot Drouin at alcatel-lucent dot fr>
|
||||
Florian Forster <octo at verplant dot org>
|
||||
Francis Dupont <Francis dot Dupont at enst-bretagne dot fr>
|
||||
Francisco Matias Cuenca-Acuna <mcuenca at george dot rutgers dot edu>
|
||||
Francois-Xavier Le Bail <fx dot lebail at yahoo dot com>
|
||||
@ -68,8 +73,10 @@ Additional people who have contributed patches:
|
||||
Heinz-Ado Arnolds <Ado dot Arnolds at dhm-systems dot de>
|
||||
Hendrik Scholz <hendrik at scholz dot net>
|
||||
Ian McDonald <imcdnzl at gmail dot com>
|
||||
Jacek Tobiasz <Jacek dot Tobiasz at atm dot com dot pl>
|
||||
Ilpo Järvinen <ilpo dot jarvinen at helsinki dot fi>
|
||||
Jacek Tobiasz <Jacek dot Tobiasz at atm dot com dot pl>
|
||||
Jakob Schlyter <jakob at openbsd dot org>
|
||||
Jamal Hadi Salim <hadi at cyberus dot ca>
|
||||
Jan Oravec <wsx at wsx6 dot net>
|
||||
Jason R. Thorpe <thorpej at netbsd dot org>
|
||||
Jefferson Ogata <jogata at nodc dot noaa dot gov>
|
||||
@ -78,10 +85,12 @@ Additional people who have contributed patches:
|
||||
Jim Hutchins <jim at ca dot sandia dot gov>
|
||||
Jonathan Heusser <jonny at drugphish dot ch>
|
||||
Tatuya Jinmei <jinmei at kame dot net>
|
||||
João Medeiros <ignotus21 at sourceforge dot net>
|
||||
Joerg Mayer <jmayer@loplof.de>
|
||||
Jørgen Thomsen <jth at jth dot net>
|
||||
Jørgen Thomsen <jth at jth dot net>
|
||||
Julian Cowley <julian at lava dot net>
|
||||
Kaarthik Sivakumar <kaarthik at torrentnet dot com>
|
||||
Karl Norby <karl-norby at sourceforge dot net>
|
||||
Kazushi Sugyo <sugyo at pb dot jp dot nec dot com>
|
||||
Kelly Carmichael <kcarmich at ipapp dot com>
|
||||
Ken Hornstein <kenh at cmf dot nrl dot navy dot mil>
|
||||
@ -92,7 +101,8 @@ Additional people who have contributed patches:
|
||||
Larry Lile <lile at stdio dot com>
|
||||
Lennert Buytenhek <buytenh at gnu dot org>
|
||||
Loris Degioanni <loris at netgroup-serv dot polito dot it>
|
||||
Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
|
||||
Love Hörnquist-Åstrand <lha at stacken dot kth dot se>
|
||||
Lucas C. Villa Real <lucasvr at us dot ibm dot com>
|
||||
Luis Martin Garcia <luis dot mgarc at gmail dot com>
|
||||
Maciej W. Rozycki <macro at ds2 dot pg dot gda dot pl>
|
||||
Manu Pathak <mapathak at cisco dot com>
|
||||
@ -100,12 +110,13 @@ Additional people who have contributed patches:
|
||||
Marc A. Lehmann <pcg at goof dot com>
|
||||
Mark Ellzey Thomas <mark at ackers dot net>
|
||||
Marko Kiiskila <carnil at cs dot tut dot fi>
|
||||
Markus Schöpflin <schoepflin at sourceforge dot net>
|
||||
Markus Schöpflin <schoepflin at sourceforge dot net>
|
||||
Marshall Rose <mrose at dbc dot mtview dot ca dot us>
|
||||
Martin Husemann <martin at netbsd dot org>
|
||||
Max Laier <max at love2party dot net>
|
||||
Michael A. Meffie III <meffie at sourceforge dot net>
|
||||
Michael Madore <mmadore at turbolinux dot com>
|
||||
Michael Riepe <too-tired at sourceforge dot net>
|
||||
Michael Shalayeff <mickey at openbsd dot org>
|
||||
Michael Shields <shields at msrl dot com>
|
||||
Michael T. Stolarchuk <mts at off dot to>
|
||||
@ -132,13 +143,16 @@ Additional people who have contributed patches:
|
||||
Peter Fales <peter at fales-lorenz dot net>
|
||||
Peter Jeremy <peter dot jeremy at alcatel dot com dot au>
|
||||
<pfhunt at users dot sourceforge dot net>
|
||||
Peter Volkov <pva at gentoo dot org>
|
||||
Phil Wood <cpw at lanl dot gov>
|
||||
Rafal Maszkowski <rzm at icm dot edu dot pl>
|
||||
Randy Sofia <rsofia at users dot sourceforge dot net>
|
||||
Raphael Raimbault <raphael dot raimbault at netasq dot com>
|
||||
Rick Cheng <rcheng at juniper dot net>
|
||||
Rick Jones <rick dot jones2 at hp dot com>
|
||||
Rick Watson <watsonrick at users dot sourceforge dot net>
|
||||
Rob Braun <bbraun at synack dot net>
|
||||
Robert Edmonds <stu-42 at sourceforge dot net>
|
||||
Roderick Schertler <roderick at argon dot org>
|
||||
Sagun Shakya <sagun dot shakya at sun dot com>
|
||||
Sami Farin <safari at iki dot fi>
|
||||
@ -155,11 +169,14 @@ Additional people who have contributed patches:
|
||||
Terry Kennedy <terry at tmk dot com>
|
||||
Timo Koskiahde
|
||||
Tony Li <tli at procket dot com>
|
||||
Toshihiro Kanda <candy at fct dot kgc dot co dot jp>
|
||||
Uns Lider <unslider at miranda dot org>
|
||||
Victor Oppleman <oppleman at users dot sourceforge dot net>
|
||||
Wesley Griffin <wgriffin at users dot sourceforge dot net>
|
||||
Wesley Shields <wxs at FreeBSD dot org>
|
||||
Wilbert de Graaf <wilbertdg at hetnet dot nl>
|
||||
Will Drewry <will at alum dot bu dot edu>
|
||||
Will Drewry <will at alum dot bu dot edu>
|
||||
William J. Hulley <bill dot hulley at gmail dot com>
|
||||
Yen Yen Lim
|
||||
Yoshifumi Nishida
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.1.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL.txt,v 1.2 2008-02-06 10:47:53 guy Exp $ (LBL)
|
||||
|
||||
If you have not built libpcap, and your system does not have libpcap
|
||||
installed, install libpcap first. Your system might provide a version
|
||||
@ -221,6 +221,7 @@ print-tftp.c - Trivial File Transfer Protocol printer routines
|
||||
print-timed.c - BSD time daemon protocol printer routines
|
||||
print-token.c - Token Ring printer routines
|
||||
print-udp.c - UDP printer routines
|
||||
print-usb.c - USB printer routines
|
||||
print-vjc.c - PPP Van Jacobson compression (RFC1144) printer routines
|
||||
print-vrrp.c - Virtual Router Redundancy Protocol
|
||||
print-wb.c - White Board printer routines
|
||||
|
22
Makefile-devel-adds
Normal file
22
Makefile-devel-adds
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Auto-regenerate configure script or Makefile when things change.
|
||||
# From autoconf.info . Works best with GNU Make.
|
||||
#
|
||||
${srcdir}/configure: configure.in
|
||||
cd ${srcdir} && autoconf
|
||||
|
||||
# autoheader might not change config.h.in, so touch a stamp file.
|
||||
${srcdir}/config.h.in: ${srcdir}/stamp-h.in
|
||||
${srcdir}/stamp-h.in: configure.in acconfig.h
|
||||
cd ${srcdir} && autoheader
|
||||
echo timestamp > ${srcdir}/stamp-h.in
|
||||
|
||||
config.h: stamp-h
|
||||
stamp-h: ${srcdir}/config.h.in config.status
|
||||
./config.status
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
./config.status
|
||||
|
||||
config.status: ${srcdir}/configure
|
||||
./config.status --recheck
|
108
Makefile.in
108
Makefile.in
@ -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.317.2.4 2008-05-27 07:14:26 guy Exp $ (LBL)
|
||||
# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.325 2008-11-21 23:17:26 guy Exp $ (LBL)
|
||||
|
||||
#
|
||||
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
||||
@ -77,7 +77,7 @@ CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c
|
||||
print-eap.c print-eigrp.c\
|
||||
print-esp.c print-ether.c print-fddi.c print-fr.c \
|
||||
print-gre.c print-hsrp.c print-icmp.c print-igmp.c \
|
||||
print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c \
|
||||
print-igrp.c print-ip.c print-ipcomp.c print-ipfc.c print-ipnet.c \
|
||||
print-ipx.c print-isoclns.c print-juniper.c print-krb.c \
|
||||
print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \
|
||||
print-lmp.c print-lspping.c print-lwapp.c \
|
||||
@ -88,9 +88,9 @@ CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c
|
||||
print-rx.c print-sctp.c print-sflow.c print-sip.c print-sl.c print-sll.c \
|
||||
print-slow.c print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
|
||||
print-symantec.c print-syslog.c print-tcp.c print-telnet.c print-tftp.c \
|
||||
print-timed.c print-token.c print-udld.c print-udp.c \
|
||||
print-vjc.c print-vqp.c print-vrrp.c print-vtp.c \
|
||||
print-wb.c print-zephyr.c setsignal.c tcpdump.c util.c
|
||||
print-timed.c print-token.c print-udld.c print-udp.c print-usb.c \
|
||||
print-vjc.c print-vqp.c print-vrrp.c print-vtp.c print-forces.c \
|
||||
print-wb.c print-zephyr.c signature.c setsignal.c tcpdump.c util.c
|
||||
|
||||
LIBNETDISSECT_SRC=print-isakmp.c
|
||||
LIBNETDISSECT_OBJ=$(LIBNETDISSECT_SRC:.c=.o)
|
||||
@ -128,6 +128,7 @@ HDR = \
|
||||
ethertype.h \
|
||||
extract.h \
|
||||
fddi.h \
|
||||
forces.h \
|
||||
gmpls.h \
|
||||
gmt2local.h \
|
||||
icmp6.h \
|
||||
@ -139,6 +140,7 @@ HDR = \
|
||||
ip.h \
|
||||
ip6.h \
|
||||
ipfc.h \
|
||||
ipnet.h \
|
||||
ipproto.h \
|
||||
ipsec_doi.h \
|
||||
ipx.h \
|
||||
@ -171,6 +173,7 @@ HDR = \
|
||||
sctpConstants.h \
|
||||
sctpHeader.h \
|
||||
setsignal.h \
|
||||
signature.h \
|
||||
slcompress.h \
|
||||
slip.h \
|
||||
sll.h \
|
||||
@ -204,6 +207,7 @@ EXTRA_DIST = \
|
||||
INSTALL.txt \
|
||||
LICENSE \
|
||||
Makefile.in \
|
||||
Makefile-devel-adds \
|
||||
README \
|
||||
Readme.Win32 \
|
||||
VERSION \
|
||||
@ -226,7 +230,6 @@ EXTRA_DIST = \
|
||||
missing/bittypes.h \
|
||||
missing/dlnames.c \
|
||||
missing/datalinks.c \
|
||||
missing/getaddrinfo.c \
|
||||
missing/getnameinfo.c \
|
||||
missing/inet_aton.c \
|
||||
missing/inet_ntop.c \
|
||||
@ -258,7 +261,83 @@ EXTRA_DIST = \
|
||||
smbutil.c \
|
||||
stime.awk \
|
||||
strcasecmp.c \
|
||||
tcpdump.1 \
|
||||
tcpdump.1.in \
|
||||
tests/02-sunrise-sunset-esp.puu \
|
||||
tests/08-sunrise-sunset-aes.puu \
|
||||
tests/08-sunrise-sunset-esp2.puu \
|
||||
tests/TESTLIST \
|
||||
tests/TESTonce \
|
||||
tests/TESTrun.sh \
|
||||
tests/bgp-infinite-loop.pcap \
|
||||
tests/bgp_vpn_attrset.out \
|
||||
tests/bgp_vpn_attrset.pcap \
|
||||
tests/chdlc-slarp-short.pcap \
|
||||
tests/chdlc-slarp.pcap \
|
||||
tests/dio.out \
|
||||
tests/dio.pcap \
|
||||
tests/e1000g.out \
|
||||
tests/e1000g.pcap \
|
||||
tests/eapon1.gdbinit \
|
||||
tests/eapon1.out \
|
||||
tests/eapon1.puu \
|
||||
tests/eapon2.puu \
|
||||
tests/esp-secrets.txt \
|
||||
tests/esp0.out \
|
||||
tests/esp1.gdbinit \
|
||||
tests/esp1.out \
|
||||
tests/esp2.gdbinit \
|
||||
tests/esp2.out \
|
||||
tests/esp3.gdbinit \
|
||||
tests/esp4.gdbinit \
|
||||
tests/esp5.gdbinit \
|
||||
tests/esp5.out \
|
||||
tests/espudp1.out \
|
||||
tests/espudp1.puu \
|
||||
tests/forces1.out \
|
||||
tests/forces1.pcap \
|
||||
tests/forces1vvv.out \
|
||||
tests/forces1vvvv.out \
|
||||
tests/forces2.out \
|
||||
tests/forces2.pcap \
|
||||
tests/forces2v.out \
|
||||
tests/forces2vv.out \
|
||||
tests/ikev2.puu \
|
||||
tests/ikev2four.out \
|
||||
tests/ikev2four.puu \
|
||||
tests/ikev2fourv.out \
|
||||
tests/ikev2fourv4.out \
|
||||
tests/ikev2pI2-secrets.txt \
|
||||
tests/ikev2pI2.out \
|
||||
tests/ikev2pI2.puu \
|
||||
tests/isakmp-delete-segfault.puu \
|
||||
tests/isakmp-identification-segfault.puu \
|
||||
tests/isakmp-pointer-loop.puu \
|
||||
tests/isakmp1.out \
|
||||
tests/isakmp2.out \
|
||||
tests/isakmp3.out \
|
||||
tests/isakmp4.out \
|
||||
tests/isakmp4500.puu \
|
||||
tests/isis-infinite-loop.pcap \
|
||||
tests/ldp-infinite-loop.pcap \
|
||||
tests/lmp.out \
|
||||
tests/lmp.puu \
|
||||
tests/lmp.sh \
|
||||
tests/lspping-fec-ldp.pcap \
|
||||
tests/lspping-fec-rsvp.pcap \
|
||||
tests/mpls-ldp-hello.out \
|
||||
tests/mpls-ldp-hello.puu \
|
||||
tests/mpls-traceroute.pcap \
|
||||
tests/ospf-gmpls.out \
|
||||
tests/ospf-gmpls.puu \
|
||||
tests/print-A.out \
|
||||
tests/print-AA.out \
|
||||
tests/print-capX.out \
|
||||
tests/print-capXX.out \
|
||||
tests/print-flags.puu \
|
||||
tests/print-flags.sh \
|
||||
tests/print-x.out \
|
||||
tests/print-xx.out \
|
||||
tests/rsvp-infinite-loop.pcap \
|
||||
vfprintf.c \
|
||||
win32/Include/Arpa/tftp.h \
|
||||
win32/Include/errno.h \
|
||||
@ -312,14 +391,13 @@ version.o: version.c
|
||||
|
||||
version.c: $(srcdir)/VERSION
|
||||
@rm -f $@
|
||||
if grep CVS ${srcdir}/VERSION >/dev/null; then \
|
||||
if grep GIT ${srcdir}/VERSION >/dev/null; then \
|
||||
read ver <${srcdir}/VERSION; \
|
||||
echo $$ver | tr -d '\012'; \
|
||||
date +_%Y_%m_%d; \
|
||||
else \
|
||||
cat ${srcdir}/VERSION; \
|
||||
fi | sed -e 's/.*/char version[] = "&";/' > $@
|
||||
|
||||
fi | sed -e 's/.*/const char version[] = "&";/' > $@
|
||||
|
||||
install: all
|
||||
[ -d $(DESTDIR)$(sbindir) ] || \
|
||||
@ -328,7 +406,7 @@ install: all
|
||||
$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG).`cat ${srcdir}/VERSION`
|
||||
[ -d $(DESTDIR)$(mandir)/man1 ] || \
|
||||
(mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
|
||||
$(INSTALL_DATA) $(srcdir)/$(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
|
||||
$(INSTALL_DATA) $(PROG).1 $(DESTDIR)$(mandir)/man1/$(PROG).1
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(sbindir)/$(PROG)
|
||||
@ -340,11 +418,15 @@ lint: $(GENSRC)
|
||||
grep -v 'possible pointer alignment problem'
|
||||
|
||||
clean:
|
||||
rm -f $(CLEANFILES)
|
||||
rm -f $(CLEANFILES) $(PROG)-`cat VERSION`.tar.gz
|
||||
|
||||
distclean:
|
||||
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
|
||||
config.h gnuc.h os-proto.h stamp-h stamp-h.in
|
||||
config.h gnuc.h os-proto.h stamp-h stamp-h.in $(PROG).1
|
||||
|
||||
check: tcpdump
|
||||
uudecode --help || (echo "No uudecode program found, not running tests"; echo "apt-get/rpm install sharutils?"; exit 1)
|
||||
(cd tests && ./TESTrun.sh)
|
||||
|
||||
tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
14
README
14
README
@ -1,19 +1,17 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.66.2.1 2008-05-30 01:38:20 guy Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.68 2008-12-15 00:05:27 guy Exp $ (LBL)
|
||||
|
||||
TCPDUMP 3.9
|
||||
TCPDUMP 4.x.y
|
||||
Now maintained by "The Tcpdump Group"
|
||||
See www.tcpdump.org
|
||||
|
||||
Please send inquiries/comments/reports to:
|
||||
tcpdump-workers@lists.tcpdump.org
|
||||
|
||||
Anonymous CVS is available via:
|
||||
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master login
|
||||
(password "anoncvs")
|
||||
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout tcpdump
|
||||
Anonymous Git is available via:
|
||||
git clone git://bpf.tcpdump.org/tcpdump
|
||||
|
||||
Version 3.9 of TCPDUMP can be retrieved with the CVS tag "tcpdump_3_9rel1":
|
||||
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_9rel1 tcpdump
|
||||
Version 4.x.y of TCPDUMP can be retrieved with the CVS tag "tcpdump_4_xrely":
|
||||
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_4_xrely tcpdump
|
||||
|
||||
Please submit patches against the master copy to the tcpdump project on
|
||||
sourceforge.net.
|
||||
|
24
Readme.Win32
Normal file
24
Readme.Win32
Normal file
@ -0,0 +1,24 @@
|
||||
To build tcpdump under Windows, you need:
|
||||
|
||||
- version 6 (or higher) of Microsoft Visual Studio or the Cygnus gnu
|
||||
C compiler.
|
||||
- The November 2001 (or later) edition of Microsoft Platform
|
||||
Software Development Kit (SDK), that contains some necessary includes
|
||||
for IPv6 support. You can download it from http://www.microsoft.com/sdk
|
||||
- the WinPcap source code, that includes libpcap for win32. Download it
|
||||
from http://winpcap.polito.it or download libpcap sources from
|
||||
http://www.tcpdump.org and follow the instructions in the README.Win32
|
||||
file.
|
||||
|
||||
First, extract tcpdump and WinPcap in the same folder, and build WinPcap.
|
||||
|
||||
The Visual Studio project and the cygwin makefile are in the Win32\prj
|
||||
folder.
|
||||
|
||||
From Visual Studio, open windump.dsw and build the program. The release
|
||||
version of the WinDump.exe executable file will be created in the
|
||||
windump\win32\prj\release directory . The debug version will be generated
|
||||
in windump\win32\prj\debug.
|
||||
|
||||
From cygnus, go to windump\win32\prj\ and type "make". WinDump.exe will be
|
||||
created in the same directory.
|
43
acconfig.h
43
acconfig.h
@ -2,32 +2,18 @@
|
||||
* make them to acconfig.h and rerun autoheader */
|
||||
@TOP@
|
||||
|
||||
/* Define if you have SSLeay 0.9.0b with the buggy cast128. */
|
||||
#undef HAVE_BUGGY_CAST128
|
||||
|
||||
/* Define if you enable IPv6 support */
|
||||
#undef INET6
|
||||
|
||||
/* 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
|
||||
|
||||
@ -43,18 +29,9 @@
|
||||
/* define if INADDRSZ is defined (XXX not used!) */
|
||||
#undef HAVE_INADDRSZ
|
||||
|
||||
/* 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
|
||||
|
||||
/* define if struct sockaddr has the sa_len member */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* define if you have struct sockaddr_storage */
|
||||
#undef HAVE_SOCKADDR_STORAGE
|
||||
|
||||
@ -91,18 +68,6 @@
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
/* The successful return value from signal (?)XXX */
|
||||
#undef RETSIGVAL
|
||||
|
||||
/* Define this on IRIX */
|
||||
#undef _BSD_SIGNALS
|
||||
|
||||
/* For HP/UX ANSI compiler? */
|
||||
#undef _HPUX_SOURCE
|
||||
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
@ -115,14 +80,6 @@
|
||||
/* Whether or not to include the possibly-buggy SMB printer */
|
||||
#undef TCPDUMP_DO_SMB
|
||||
|
||||
/* Long story short: aclocal.m4 depends on autoconf 2.13
|
||||
* implementation details wrt "const"; newer versions
|
||||
* have different implementation details so for now we
|
||||
* put "const" here. This may cause duplicate definitions
|
||||
* 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
|
||||
|
||||
|
442
aclocal.m4
vendored
442
aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.113.2.3 2008-09-25 21:50:04 guy Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.116 2008-09-25 21:45:50 guy Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1995, 1996, 1997, 1998
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -23,27 +23,23 @@ dnl LBL autoconf macros
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl Determine which compiler we're using (cc or gcc)
|
||||
dnl If using gcc, determine the version number
|
||||
dnl If using cc, require that it support ansi prototypes
|
||||
dnl If using gcc, use -O2 (otherwise use -O)
|
||||
dnl If using cc, explicitly specify /usr/local/include
|
||||
dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC.
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl It appears that newer versions of autoconf (2.64 and later) will,
|
||||
dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the
|
||||
dnl beginning of the macro, even if the macro itself calls AC_PROG_CC.
|
||||
dnl See the "Prerequisite Macros" and "Expanded Before Required" sections
|
||||
dnl in the Autoconf documentation.
|
||||
dnl
|
||||
dnl AC_LBL_C_INIT(copt, incls)
|
||||
dnl This causes a steaming heap of fail in our case, as we were, in
|
||||
dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC,
|
||||
dnl calling AC_PROG_CC, and then doing the tests we now do in
|
||||
dnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC,
|
||||
dnl and AC_LBL_C_INIT at the top level.
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt set)
|
||||
dnl $2 (incls set)
|
||||
dnl CC
|
||||
dnl LDFLAGS
|
||||
dnl ac_cv_lbl_gcc_vers
|
||||
dnl LBL_CFLAGS
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_C_INIT,
|
||||
[AC_PREREQ(2.12)
|
||||
AC_DEFUN(AC_LBL_C_INIT_BEFORE_CC,
|
||||
[AC_PREREQ(2.50)
|
||||
AC_BEFORE([$0], [AC_LBL_C_INIT])
|
||||
AC_BEFORE([$0], [AC_PROG_CC])
|
||||
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
|
||||
AC_BEFORE([$0], [AC_LBL_DEVEL])
|
||||
@ -72,7 +68,33 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
CC=cc
|
||||
export CC
|
||||
fi
|
||||
AC_PROG_CC
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Determine which compiler we're using (cc or gcc)
|
||||
dnl If using gcc, determine the version number
|
||||
dnl If using cc, require that it support ansi prototypes
|
||||
dnl If using gcc, use -O2 (otherwise use -O)
|
||||
dnl If using cc, explicitly specify /usr/local/include
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_C_INIT(copt, incls)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (copt set)
|
||||
dnl $2 (incls set)
|
||||
dnl CC
|
||||
dnl LDFLAGS
|
||||
dnl ac_cv_lbl_gcc_vers
|
||||
dnl LBL_CFLAGS
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_C_INIT,
|
||||
[AC_PREREQ(2.50)
|
||||
AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
|
||||
AC_BEFORE([$0], [AC_LBL_DEVEL])
|
||||
AC_BEFORE([$0], [AC_LBL_SHLIBS_INIT])
|
||||
if test "$GCC" = yes ; then
|
||||
if test "$SHLICC2" = yes ; then
|
||||
ac_cv_lbl_gcc_vers=2
|
||||
@ -117,8 +139,26 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
CFLAGS="$savedcflags"
|
||||
V_CCOPT="-Aa $V_CCOPT"
|
||||
AC_DEFINE(_HPUX_SOURCE)
|
||||
$1="-Aa $$1"
|
||||
AC_DEFINE(_HPUX_SOURCE,1,[needed on HP-UX])
|
||||
;;
|
||||
|
||||
osf*)
|
||||
AC_MSG_CHECKING(for ansi mode in DEC compiler ($CC -std1))
|
||||
savedcflags="$CFLAGS"
|
||||
CFLAGS="-std1"
|
||||
AC_CACHE_VAL(ac_cv_lbl_cc_osf1_cc_std1,
|
||||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[int frob(int, char *)],
|
||||
ac_cv_lbl_cc_osf1_cc_std1=yes,
|
||||
ac_cv_lbl_cc_osf1_cc_std1=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_cc_osf1_cc_std1)
|
||||
if test $ac_cv_lbl_cc_osf1_cc_std1 = no ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
CFLAGS="$savedcflags"
|
||||
$1="-std1 $$1"
|
||||
;;
|
||||
|
||||
*)
|
||||
@ -132,11 +172,15 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
case "$host_os" in
|
||||
|
||||
irix*)
|
||||
V_CCOPT="$V_CCOPT -xansi -signed -O"
|
||||
$1="$$1 -xansi -signed -O"
|
||||
;;
|
||||
|
||||
osf*)
|
||||
V_CCOPT="$V_CCOPT -std1 -O"
|
||||
#
|
||||
# Presumed to be DEC OSF/1, Digital UNIX, or
|
||||
# Tru64 UNIX.
|
||||
#
|
||||
$1="$$1 -O"
|
||||
;;
|
||||
|
||||
ultrix*)
|
||||
@ -150,14 +194,14 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
ac_cv_lbl_cc_const_proto=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
|
||||
if test $ac_cv_lbl_cc_const_proto = no ; then
|
||||
AC_DEFINE(const,)
|
||||
AC_DEFINE(const,[],
|
||||
[to handle Ultrix compilers that don't support const in prototypes])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
#
|
||||
# Try compiling a sample of the type of code that appears in
|
||||
# gencode.c with "inline", "__inline__", and "__inline".
|
||||
@ -167,8 +211,13 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
# at least some versions of HP's C compiler can inline that, but can't
|
||||
# inline a function that returns a struct pointer.
|
||||
#
|
||||
# Make sure we use the V_CCOPT flags, because some of those might
|
||||
# disable inlining.
|
||||
#
|
||||
AC_DEFUN(AC_LBL_C_INLINE,
|
||||
[AC_MSG_CHECKING(for inline)
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$V_CCOPT"
|
||||
AC_CACHE_VAL(ac_cv_lbl_inline, [
|
||||
ac_cv_lbl_inline=""
|
||||
ac_lbl_cc_inline=no
|
||||
@ -196,6 +245,7 @@ AC_DEFUN(AC_LBL_C_INLINE,
|
||||
if test "$ac_lbl_cc_inline" = yes ; then
|
||||
ac_cv_lbl_inline=$ac_lbl_inline
|
||||
fi])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
if test ! -z "$ac_cv_lbl_inline" ; then
|
||||
AC_MSG_RESULT($ac_cv_lbl_inline)
|
||||
else
|
||||
@ -238,9 +288,10 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
libpcap=FAIL
|
||||
lastdir=FAIL
|
||||
places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
|
||||
egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
|
||||
egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'`
|
||||
for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do
|
||||
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'`
|
||||
basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//' | \
|
||||
sed -e 's/-PRE-GIT$//' `
|
||||
if test $lastdir = $basedir ; then
|
||||
dnl skip alphas when an actual release is present
|
||||
continue;
|
||||
@ -254,43 +305,60 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
done
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
dnl
|
||||
dnl Some versions of Red Hat Linux put "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
|
||||
dnl (We now also put pcap.h in /usr/include/pcap, but we
|
||||
dnl leave behind a /usr/include/pcap.h that includes it,
|
||||
dnl so you can still just include <pcap.h>.)
|
||||
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)
|
||||
|
||||
#
|
||||
# Look for pcap-config.
|
||||
#
|
||||
AC_PATH_PROG(PCAP_CONFIG, pcap-config)
|
||||
if test -n "$PCAP_CONFIG" ; then
|
||||
#
|
||||
# Found - use it to get the include flags for
|
||||
# libpcap and the flags to link with libpcap.
|
||||
#
|
||||
$2="`\"$PCAP_CONFIG\" --cflags` $$2"
|
||||
libpcap="`\"$PCAP_CONFIG\" --libs`"
|
||||
else
|
||||
$2="-I$d $$2"
|
||||
AC_MSG_RESULT(found -- -I$d added)
|
||||
#
|
||||
# Not found; look for pcap.
|
||||
#
|
||||
AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
|
||||
if test $libpcap = FAIL ; then
|
||||
AC_MSG_ERROR(see the INSTALL doc for more info)
|
||||
fi
|
||||
dnl
|
||||
dnl Some versions of Red Hat Linux put "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
|
||||
dnl (We now also put pcap.h in /usr/include/pcap, but we
|
||||
dnl leave behind a /usr/include/pcap.h that includes it,
|
||||
dnl so you can still just include <pcap.h>.)
|
||||
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
|
||||
fi
|
||||
else
|
||||
$1=$libpcap
|
||||
@ -304,26 +372,50 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
AC_MSG_ERROR(cannot find pcap.h, see INSTALL)
|
||||
fi
|
||||
AC_MSG_RESULT($libpcap)
|
||||
AC_PATH_PROG(PCAP_CONFIG, pcap-config,, $d)
|
||||
if test -n "$PCAP_CONFIG"; then
|
||||
#
|
||||
# The libpcap directory has a pcap-config script.
|
||||
# Use it to get any additioal libraries needed
|
||||
# to link with the libpcap archive library in
|
||||
# that directory
|
||||
#
|
||||
libpcap="$libpcap `\"$PCAP_CONFIG\" --additional-libs --static`"
|
||||
fi
|
||||
fi
|
||||
LIBS="$libpcap $LIBS"
|
||||
case "$host_os" in
|
||||
if ! test -n "$PCAP_CONFIG" ; then
|
||||
#
|
||||
# We don't have pcap-config; find out any additional link flags
|
||||
# we need. (If we have pcap-config, we assume it tells us what
|
||||
# we need.)
|
||||
#
|
||||
case "$host_os" in
|
||||
|
||||
aix*)
|
||||
aix*)
|
||||
#
|
||||
# If libpcap is DLPI-based, we have to use /lib/pse.exp if
|
||||
# present, as we use the STREAMS routines.
|
||||
#
|
||||
# (XXX - true only if we're linking with a static libpcap?)
|
||||
#
|
||||
pseexe="/lib/pse.exp"
|
||||
AC_MSG_CHECKING(for $pseexe)
|
||||
if test -f $pseexe ; then
|
||||
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.
|
||||
# If libpcap is BPF-based, we need "-lodm" and "-lcfg", as
|
||||
# we use them to load the BPF module.
|
||||
#
|
||||
# (XXX - true only if we're linking with a static libpcap?)
|
||||
#
|
||||
LIBS="$LIBS -lodm -lcfg"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
|
||||
@ -383,14 +475,14 @@ AC_DEFUN(AC_LBL_TYPE_SIGNAL,
|
||||
[AC_BEFORE([$0], [AC_LBL_LIBPCAP])
|
||||
AC_TYPE_SIGNAL
|
||||
if test "$ac_cv_type_signal" = void ; then
|
||||
AC_DEFINE(RETSIGVAL,)
|
||||
AC_DEFINE(RETSIGVAL,[],[return value of signal handlers])
|
||||
else
|
||||
AC_DEFINE(RETSIGVAL,(0))
|
||||
AC_DEFINE(RETSIGVAL,(0),[return value of signal handlers])
|
||||
fi
|
||||
case "$host_os" in
|
||||
|
||||
irix*)
|
||||
AC_DEFINE(_BSD_SIGNALS)
|
||||
AC_DEFINE(_BSD_SIGNALS,1,[get BSD semantics on Irix])
|
||||
;;
|
||||
|
||||
*)
|
||||
@ -438,65 +530,6 @@ AC_DEFUN(AC_LBL_FIXINCLUDES,
|
||||
fi
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Check for flex, default to lex
|
||||
dnl Require flex 2.4 or higher
|
||||
dnl Check for bison, default to yacc
|
||||
dnl Default to lex/yacc if both flex and bison are not available
|
||||
dnl Define the yy prefix string if using flex and bison
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix)
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl $1 (lex set)
|
||||
dnl $2 (yacc appended)
|
||||
dnl $3 (optional flex and bison -P prefix)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_LEX_AND_YACC,
|
||||
[AC_ARG_WITH(flex, [ --without-flex don't use flex])
|
||||
AC_ARG_WITH(bison, [ --without-bison don't use bison])
|
||||
if test "$with_flex" = no ; then
|
||||
$1=lex
|
||||
else
|
||||
AC_CHECK_PROGS($1, flex, lex)
|
||||
fi
|
||||
if test "$$1" = flex ; then
|
||||
# The -V flag was added in 2.4
|
||||
AC_MSG_CHECKING(for flex 2.4 or higher)
|
||||
AC_CACHE_VAL(ac_cv_lbl_flex_v24,
|
||||
if flex -V >/dev/null 2>&1; then
|
||||
ac_cv_lbl_flex_v24=yes
|
||||
else
|
||||
ac_cv_lbl_flex_v24=no
|
||||
fi)
|
||||
AC_MSG_RESULT($ac_cv_lbl_flex_v24)
|
||||
if test $ac_cv_lbl_flex_v24 = no ; then
|
||||
s="2.4 or higher required"
|
||||
AC_MSG_WARN(ignoring obsolete flex executable ($s))
|
||||
$1=lex
|
||||
fi
|
||||
fi
|
||||
if test "$with_bison" = no ; then
|
||||
$2=yacc
|
||||
else
|
||||
AC_CHECK_PROGS($2, bison, yacc)
|
||||
fi
|
||||
if test "$$2" = bison ; then
|
||||
$2="$$2 -y"
|
||||
fi
|
||||
if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then
|
||||
AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc)
|
||||
$1=lex
|
||||
$2=yacc
|
||||
fi
|
||||
if test "$$1" = flex -a -n "$3" ; then
|
||||
$1="$$1 -P$3"
|
||||
$2="$$2 -p $3"
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Checks to see if union wait is used with WEXITSTATUS()
|
||||
dnl
|
||||
@ -521,9 +554,9 @@ AC_DEFUN(AC_LBL_UNION_WAIT,
|
||||
ac_cv_lbl_union_wait=yes))
|
||||
AC_MSG_RESULT($ac_cv_lbl_union_wait)
|
||||
if test $ac_cv_lbl_union_wait = yes ; then
|
||||
AC_DEFINE(DECLWAITSTATUS,union wait)
|
||||
AC_DEFINE(DECLWAITSTATUS,union wait,[type for wait])
|
||||
else
|
||||
AC_DEFINE(DECLWAITSTATUS,int)
|
||||
AC_DEFINE(DECLWAITSTATUS,int,[type for wait])
|
||||
fi])
|
||||
|
||||
dnl
|
||||
@ -538,7 +571,7 @@ dnl
|
||||
dnl HAVE_SOCKADDR_SA_LEN (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
|
||||
[AC_MSG_CHECKING(if sockaddr struct has sa_len member)
|
||||
[AC_MSG_CHECKING(if sockaddr struct has the sa_len member)
|
||||
AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
@ -548,7 +581,7 @@ AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
|
||||
ac_cv_lbl_sockaddr_has_sa_len=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
|
||||
if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
|
||||
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
|
||||
AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[if struct sockaddr has the sa_len member])
|
||||
fi])
|
||||
|
||||
dnl
|
||||
@ -572,7 +605,7 @@ AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
|
||||
else
|
||||
ac_cv_lbl_have_run_path=no
|
||||
fi
|
||||
rm -f conftest*])
|
||||
rm -f -r conftest*])
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_run_path)
|
||||
])
|
||||
|
||||
@ -712,12 +745,12 @@ EOF
|
||||
ac_cv_lbl_unaligned_fail=no
|
||||
fi
|
||||
fi
|
||||
rm -f conftest* core core.conftest
|
||||
rm -f -r conftest* core core.conftest
|
||||
;;
|
||||
esac])
|
||||
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
|
||||
if test $ac_cv_lbl_unaligned_fail = yes ; then
|
||||
AC_DEFINE(LBL_ALIGN)
|
||||
AC_DEFINE(LBL_ALIGN,1,[if unaligned access fails])
|
||||
fi])
|
||||
|
||||
dnl
|
||||
@ -768,7 +801,8 @@ AC_DEFUN(AC_LBL_DEVEL,
|
||||
name="lbl/os-$os.h"
|
||||
if test -f $name ; then
|
||||
ln -s $name os-proto.h
|
||||
AC_DEFINE(HAVE_OS_PROTO_H)
|
||||
AC_DEFINE(HAVE_OS_PROTO_H, 1,
|
||||
[if there's an os_proto.h for this platform, to use additional prototypes])
|
||||
else
|
||||
AC_MSG_WARN(can't find $name)
|
||||
fi
|
||||
@ -953,83 +987,6 @@ AC_DEFUN(AC_CHECK_SA_LEN, [
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Checks for portable prototype declaration macro
|
||||
AC_DEFUN(AC_CHECK_PORTABLE_PROTO, [
|
||||
AC_MSG_CHECKING(for __P)
|
||||
AC_CACHE_VAL($1,
|
||||
AC_TRY_COMPILE([
|
||||
# include <unistd.h>],
|
||||
[int f __P(())],
|
||||
$1=yes,
|
||||
$1=no))
|
||||
AC_MSG_RESULT($$1)
|
||||
if test $$1 = yes; then
|
||||
AC_DEFINE(HAVE_PORTABLE_PROTOTYPE)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl checks for u_intXX_t
|
||||
AC_DEFUN(AC_CHECK_BITTYPES, [
|
||||
$1=yes
|
||||
dnl check for u_int8_t
|
||||
AC_MSG_CHECKING(for u_int8_t)
|
||||
AC_CACHE_VAL(ac_cv_u_int8_t,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>],
|
||||
[u_int8_t i],
|
||||
ac_cv_u_int8_t=yes,
|
||||
ac_cv_u_int8_t=no))
|
||||
AC_MSG_RESULT($ac_cv_u_int8_t)
|
||||
if test $ac_cv_u_int8_t = yes; then
|
||||
AC_DEFINE(HAVE_U_INT8_T)
|
||||
else
|
||||
$1=no
|
||||
fi
|
||||
dnl check for u_int16_t
|
||||
AC_MSG_CHECKING(for u_int16_t)
|
||||
AC_CACHE_VAL(ac_cv_u_int16_t,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>],
|
||||
[u_int16_t i],
|
||||
ac_cv_u_int16_t=yes,
|
||||
ac_cv_u_int16_t=no))
|
||||
AC_MSG_RESULT($ac_cv_u_int16_t)
|
||||
if test $ac_cv_u_int16_t = yes; then
|
||||
AC_DEFINE(HAVE_U_INT16_T)
|
||||
else
|
||||
$1=no
|
||||
fi
|
||||
dnl check for u_int32_t
|
||||
AC_MSG_CHECKING(for u_int32_t)
|
||||
AC_CACHE_VAL(ac_cv_u_int32_t,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>],
|
||||
[u_int32_t i],
|
||||
ac_cv_u_int32_t=yes,
|
||||
ac_cv_u_int32_t=no))
|
||||
AC_MSG_RESULT($ac_cv_u_int32_t)
|
||||
if test $ac_cv_u_int32_t = yes; then
|
||||
AC_DEFINE(HAVE_U_INT32_T)
|
||||
else
|
||||
$1=no
|
||||
fi
|
||||
dnl check for u_int64_t
|
||||
AC_MSG_CHECKING(for u_int64_t)
|
||||
AC_CACHE_VAL(ac_cv_u_int64_t,
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>],
|
||||
[u_int64_t i],
|
||||
ac_cv_u_int64_t=yes,
|
||||
ac_cv_u_int64_t=no))
|
||||
AC_MSG_RESULT($ac_cv_u_int64_t)
|
||||
if test $ac_cv_u_int64_t = yes; then
|
||||
AC_DEFINE(HAVE_U_INT64_T)
|
||||
else
|
||||
$1=no
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Checks for addrinfo structure
|
||||
AC_DEFUN(AC_STRUCT_ADDRINFO, [
|
||||
@ -1259,8 +1216,49 @@ fi
|
||||
AC_MSG_RESULT($ac_cv___attribute__)
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Test whether __attribute__((format)) can be applied to function
|
||||
dnl pointers
|
||||
dnl
|
||||
|
||||
AC_DEFUN(AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER, [
|
||||
AC_MSG_CHECKING([whether __attribute__((format)) can be applied to function pointers])
|
||||
AC_CACHE_VAL(ac_cv___attribute___format_function_pointer, [
|
||||
AC_COMPILE_IFELSE(
|
||||
AC_LANG_SOURCE([[
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int (*foo)(const char *fmt, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
(*foo)("%s", "test");
|
||||
}
|
||||
]]),
|
||||
ac_cv___attribute___format_function_pointer=yes,
|
||||
ac_cv___attribute___format_function_pointer=no)])
|
||||
if test "$ac_cv___attribute___format_function_pointer" = "yes"; then
|
||||
AC_DEFINE(__ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS, 1,
|
||||
[define if your compiler allows __attribute__((format)) to be applied to function pointers])
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv___attribute___format_function_pointer)
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LBL_SSLEAY,
|
||||
[
|
||||
#
|
||||
# Find the last component of $libdir; it's not necessarily
|
||||
# "lib" - it might be "lib64" on, for example, x86-64
|
||||
# Linux systems.
|
||||
#
|
||||
# We assume the directory in which we're looking for
|
||||
# libcrypto has a subdirectory with that as its name.
|
||||
#
|
||||
tmplib=`echo "$libdir" | sed 's,.*/,,'`
|
||||
|
||||
#
|
||||
# XXX - is there a better way to check if a given library is
|
||||
# in a given directory than checking each of the possible
|
||||
@ -1271,10 +1269,10 @@ AC_DEFUN(AC_LBL_SSLEAY,
|
||||
#
|
||||
# Or should we just look for "libcrypto.*"?
|
||||
#
|
||||
if test -d "$1/lib" -a \( -f "$1/lib/libcrypto.a" -o \
|
||||
-f "$1/lib/libcrypto.so" -o \
|
||||
-f "$1/lib/libcrypto.sl" -o \
|
||||
-f "$1/lib/libcrypto.dylib" \); then
|
||||
if test -d "$1/$tmplib" -a \( -f "$1/$tmplib/libcrypto.a" -o \
|
||||
-f "$1/$tmplib/libcrypto.so" -o \
|
||||
-f "$1/$tmplib/libcrypto.sl" -o \
|
||||
-f "$1/$tmplib/libcrypto.dylib" \); then
|
||||
ac_cv_ssleay_path="$1"
|
||||
fi
|
||||
|
||||
|
47
addrtoname.c
47
addrtoname.c
@ -86,12 +86,12 @@ struct hnamemem {
|
||||
struct hnamemem *nxt;
|
||||
};
|
||||
|
||||
struct hnamemem hnametable[HASHNAMESIZE];
|
||||
struct hnamemem tporttable[HASHNAMESIZE];
|
||||
struct hnamemem uporttable[HASHNAMESIZE];
|
||||
struct hnamemem eprototable[HASHNAMESIZE];
|
||||
struct hnamemem dnaddrtable[HASHNAMESIZE];
|
||||
struct hnamemem ipxsaptable[HASHNAMESIZE];
|
||||
static struct hnamemem hnametable[HASHNAMESIZE];
|
||||
static struct hnamemem tporttable[HASHNAMESIZE];
|
||||
static struct hnamemem uporttable[HASHNAMESIZE];
|
||||
static struct hnamemem eprototable[HASHNAMESIZE];
|
||||
static struct hnamemem dnaddrtable[HASHNAMESIZE];
|
||||
static struct hnamemem ipxsaptable[HASHNAMESIZE];
|
||||
|
||||
#if defined(INET6) && defined(WIN32)
|
||||
/*
|
||||
@ -140,7 +140,7 @@ struct h6namemem {
|
||||
struct h6namemem *nxt;
|
||||
};
|
||||
|
||||
struct h6namemem h6nametable[HASHNAMESIZE];
|
||||
static struct h6namemem h6nametable[HASHNAMESIZE];
|
||||
#endif /* INET6 */
|
||||
|
||||
struct enamemem {
|
||||
@ -153,9 +153,9 @@ struct enamemem {
|
||||
struct enamemem *e_nxt;
|
||||
};
|
||||
|
||||
struct enamemem enametable[HASHNAMESIZE];
|
||||
struct enamemem nsaptable[HASHNAMESIZE];
|
||||
struct enamemem bytestringtable[HASHNAMESIZE];
|
||||
static struct enamemem enametable[HASHNAMESIZE];
|
||||
static struct enamemem nsaptable[HASHNAMESIZE];
|
||||
static struct enamemem bytestringtable[HASHNAMESIZE];
|
||||
|
||||
struct protoidmem {
|
||||
u_int32_t p_oui;
|
||||
@ -164,7 +164,7 @@ struct protoidmem {
|
||||
struct protoidmem *p_nxt;
|
||||
};
|
||||
|
||||
struct protoidmem protoidtable[HASHNAMESIZE];
|
||||
static struct protoidmem protoidtable[HASHNAMESIZE];
|
||||
|
||||
/*
|
||||
* A faster replacement for inet_ntoa().
|
||||
@ -311,7 +311,7 @@ getname6(const u_char *ap)
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
static char hex[] = "0123456789abcdef";
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
|
||||
|
||||
/* Find the hash node that corresponds the ether address 'ep' */
|
||||
@ -514,13 +514,14 @@ linkaddr_string(const u_char *ep, const unsigned int type, const unsigned int le
|
||||
register char *cp;
|
||||
register struct enamemem *tp;
|
||||
|
||||
if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) {
|
||||
return etheraddr_string(ep);
|
||||
}
|
||||
if (len == 0)
|
||||
return ("<empty>");
|
||||
|
||||
if (type == LINKADDR_FRELAY) {
|
||||
return q922_string(ep);
|
||||
}
|
||||
if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN)
|
||||
return (etheraddr_string(ep));
|
||||
|
||||
if (type == LINKADDR_FRELAY)
|
||||
return (q922_string(ep));
|
||||
|
||||
tp = lookup_bytestring(ep, len);
|
||||
if (tp->e_name)
|
||||
@ -747,7 +748,7 @@ init_eprotoarray(void)
|
||||
}
|
||||
}
|
||||
|
||||
static struct protoidlist {
|
||||
static const struct protoidlist {
|
||||
const u_char protoid[5];
|
||||
const char *name;
|
||||
} protoidlist[] = {
|
||||
@ -768,7 +769,7 @@ init_protoidarray(void)
|
||||
{
|
||||
register int i;
|
||||
register struct protoidmem *tp;
|
||||
struct protoidlist *pl;
|
||||
const struct protoidlist *pl;
|
||||
u_char protoid[5];
|
||||
|
||||
protoid[0] = 0;
|
||||
@ -792,7 +793,7 @@ init_protoidarray(void)
|
||||
}
|
||||
}
|
||||
|
||||
static struct etherlist {
|
||||
static const struct etherlist {
|
||||
const u_char addr[6];
|
||||
const char *name;
|
||||
} etherlist[] = {
|
||||
@ -817,7 +818,7 @@ static struct etherlist {
|
||||
static void
|
||||
init_etherarray(void)
|
||||
{
|
||||
register struct etherlist *el;
|
||||
register const struct etherlist *el;
|
||||
register struct enamemem *tp;
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
char name[256];
|
||||
@ -861,7 +862,7 @@ init_etherarray(void)
|
||||
}
|
||||
}
|
||||
|
||||
static struct tok ipxsap_db[] = {
|
||||
static const struct tok ipxsap_db[] = {
|
||||
{ 0x0000, "Unknown" },
|
||||
{ 0x0001, "User" },
|
||||
{ 0x0002, "User Group" },
|
||||
|
4
af.c
4
af.c
@ -28,7 +28,7 @@ static const char rcsid[] _U_ =
|
||||
#include "interface.h"
|
||||
#include "af.h"
|
||||
|
||||
struct tok af_values[] = {
|
||||
const struct tok af_values[] = {
|
||||
{ 0, "Reserved"},
|
||||
{ AFNUM_INET, "IPv4"},
|
||||
{ AFNUM_INET6, "IPv6"},
|
||||
@ -50,7 +50,7 @@ struct tok af_values[] = {
|
||||
{ 0, NULL},
|
||||
};
|
||||
|
||||
struct tok bsd_af_values[] = {
|
||||
const struct tok bsd_af_values[] = {
|
||||
{ BSD_AFNUM_INET, "IPv4" },
|
||||
{ BSD_AFNUM_NS, "NS" },
|
||||
{ BSD_AFNUM_ISO, "ISO" },
|
||||
|
4
af.h
4
af.h
@ -17,8 +17,8 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
extern struct tok af_values[];
|
||||
extern struct tok bsd_af_values[];
|
||||
extern const struct tok af_values[];
|
||||
extern const struct tok bsd_af_values[];
|
||||
|
||||
/* RFC1700 address family numbers */
|
||||
#define AFNUM_INET 1
|
||||
|
@ -29,7 +29,7 @@
|
||||
* 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.6.1 2007-10-22 19:39:12 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/atmuni31.h,v 1.3 2007-10-22 19:37:51 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Based on UNI3.1 standard by ATM Forum */
|
||||
|
5
bootp.h
5
bootp.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.18 2007-08-21 21:59:11 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.19 2008-04-22 09:46:03 hannes Exp $ (LBL) */
|
||||
/*
|
||||
* Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
|
||||
*
|
||||
@ -27,7 +27,8 @@ 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 - see bootp_flag_values[] in print-bootp.c */
|
||||
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 */
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.16.4.1 2008-02-14 20:54:53 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.17 2008-02-14 20:53:49 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
67
checksum.c
67
checksum.c
@ -31,17 +31,73 @@ static const char rcsid[] _U_ =
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
#define CRC10_POLYNOMIAL 0x633
|
||||
static u_int16_t crc10_table[256];
|
||||
/*
|
||||
* CRC-10 table generated using the following Python snippet:
|
||||
|
||||
import sys
|
||||
|
||||
crc_table = []
|
||||
for i in range(256):
|
||||
accum = i << 2
|
||||
for j in range(8):
|
||||
accum <<= 1
|
||||
if accum & 0x400:
|
||||
accum ^= 0x633
|
||||
crc_table.append(accum)
|
||||
|
||||
for i in range(len(crc_table)/8):
|
||||
for j in range(8):
|
||||
sys.stdout.write("0x%04x, " % crc_table[i*8+j])
|
||||
sys.stdout.write("\n")
|
||||
|
||||
*/
|
||||
static const u_int16_t crc10_table[256] =
|
||||
{
|
||||
0x0000, 0x0233, 0x0255, 0x0066, 0x0299, 0x00aa, 0x00cc, 0x02ff,
|
||||
0x0301, 0x0132, 0x0154, 0x0367, 0x0198, 0x03ab, 0x03cd, 0x01fe,
|
||||
0x0031, 0x0202, 0x0264, 0x0057, 0x02a8, 0x009b, 0x00fd, 0x02ce,
|
||||
0x0330, 0x0103, 0x0165, 0x0356, 0x01a9, 0x039a, 0x03fc, 0x01cf,
|
||||
0x0062, 0x0251, 0x0237, 0x0004, 0x02fb, 0x00c8, 0x00ae, 0x029d,
|
||||
0x0363, 0x0150, 0x0136, 0x0305, 0x01fa, 0x03c9, 0x03af, 0x019c,
|
||||
0x0053, 0x0260, 0x0206, 0x0035, 0x02ca, 0x00f9, 0x009f, 0x02ac,
|
||||
0x0352, 0x0161, 0x0107, 0x0334, 0x01cb, 0x03f8, 0x039e, 0x01ad,
|
||||
0x00c4, 0x02f7, 0x0291, 0x00a2, 0x025d, 0x006e, 0x0008, 0x023b,
|
||||
0x03c5, 0x01f6, 0x0190, 0x03a3, 0x015c, 0x036f, 0x0309, 0x013a,
|
||||
0x00f5, 0x02c6, 0x02a0, 0x0093, 0x026c, 0x005f, 0x0039, 0x020a,
|
||||
0x03f4, 0x01c7, 0x01a1, 0x0392, 0x016d, 0x035e, 0x0338, 0x010b,
|
||||
0x00a6, 0x0295, 0x02f3, 0x00c0, 0x023f, 0x000c, 0x006a, 0x0259,
|
||||
0x03a7, 0x0194, 0x01f2, 0x03c1, 0x013e, 0x030d, 0x036b, 0x0158,
|
||||
0x0097, 0x02a4, 0x02c2, 0x00f1, 0x020e, 0x003d, 0x005b, 0x0268,
|
||||
0x0396, 0x01a5, 0x01c3, 0x03f0, 0x010f, 0x033c, 0x035a, 0x0169,
|
||||
0x0188, 0x03bb, 0x03dd, 0x01ee, 0x0311, 0x0122, 0x0144, 0x0377,
|
||||
0x0289, 0x00ba, 0x00dc, 0x02ef, 0x0010, 0x0223, 0x0245, 0x0076,
|
||||
0x01b9, 0x038a, 0x03ec, 0x01df, 0x0320, 0x0113, 0x0175, 0x0346,
|
||||
0x02b8, 0x008b, 0x00ed, 0x02de, 0x0021, 0x0212, 0x0274, 0x0047,
|
||||
0x01ea, 0x03d9, 0x03bf, 0x018c, 0x0373, 0x0140, 0x0126, 0x0315,
|
||||
0x02eb, 0x00d8, 0x00be, 0x028d, 0x0072, 0x0241, 0x0227, 0x0014,
|
||||
0x01db, 0x03e8, 0x038e, 0x01bd, 0x0342, 0x0171, 0x0117, 0x0324,
|
||||
0x02da, 0x00e9, 0x008f, 0x02bc, 0x0043, 0x0270, 0x0216, 0x0025,
|
||||
0x014c, 0x037f, 0x0319, 0x012a, 0x03d5, 0x01e6, 0x0180, 0x03b3,
|
||||
0x024d, 0x007e, 0x0018, 0x022b, 0x00d4, 0x02e7, 0x0281, 0x00b2,
|
||||
0x017d, 0x034e, 0x0328, 0x011b, 0x03e4, 0x01d7, 0x01b1, 0x0382,
|
||||
0x027c, 0x004f, 0x0029, 0x021a, 0x00e5, 0x02d6, 0x02b0, 0x0083,
|
||||
0x012e, 0x031d, 0x037b, 0x0148, 0x03b7, 0x0184, 0x01e2, 0x03d1,
|
||||
0x022f, 0x001c, 0x007a, 0x0249, 0x00b6, 0x0285, 0x02e3, 0x00d0,
|
||||
0x011f, 0x032c, 0x034a, 0x0179, 0x0386, 0x01b5, 0x01d3, 0x03e0,
|
||||
0x021e, 0x002d, 0x004b, 0x0278, 0x0087, 0x02b4, 0x02d2, 0x00e1
|
||||
};
|
||||
|
||||
static void
|
||||
init_crc10_table(void)
|
||||
{
|
||||
#define CRC10_POLYNOMIAL 0x633
|
||||
register int i, j;
|
||||
register u_int16_t accum;
|
||||
u_int16_t verify_crc10_table[256];
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
@ -50,9 +106,12 @@ init_crc10_table(void)
|
||||
{
|
||||
if ((accum <<= 1) & 0x400) accum ^= CRC10_POLYNOMIAL;
|
||||
}
|
||||
crc10_table[i] = accum;
|
||||
verify_crc10_table[i] = accum;
|
||||
}
|
||||
return;
|
||||
assert(memcmp(verify_crc10_table,
|
||||
crc10_table,
|
||||
sizeof(verify_crc10_table)) == 0);
|
||||
#undef CRC10_POLYNOMIAL
|
||||
}
|
||||
|
||||
u_int16_t
|
||||
|
875
config.guess
vendored
875
config.guess
vendored
File diff suppressed because it is too large
Load Diff
74
config.h.in
74
config.h.in
@ -2,32 +2,18 @@
|
||||
/* "generated automatically" means DO NOT MAKE CHANGES TO config.h.in --
|
||||
* make them to acconfig.h and rerun autoheader */
|
||||
|
||||
/* Define if you have SSLeay 0.9.0b with the buggy cast128. */
|
||||
#undef HAVE_BUGGY_CAST128
|
||||
|
||||
/* Define if you enable IPv6 support */
|
||||
#undef INET6
|
||||
|
||||
/* 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
|
||||
|
||||
@ -43,18 +29,9 @@
|
||||
/* define if INADDRSZ is defined (XXX not used!) */
|
||||
#undef HAVE_INADDRSZ
|
||||
|
||||
/* 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
|
||||
|
||||
/* define if struct sockaddr has the sa_len member */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* define if you have struct sockaddr_storage */
|
||||
#undef HAVE_SOCKADDR_STORAGE
|
||||
|
||||
@ -91,18 +68,6 @@
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
/* The successful return value from signal (?)XXX */
|
||||
#undef RETSIGVAL
|
||||
|
||||
/* Define this on IRIX */
|
||||
#undef _BSD_SIGNALS
|
||||
|
||||
/* For HP/UX ANSI compiler? */
|
||||
#undef _HPUX_SOURCE
|
||||
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
@ -115,14 +80,6 @@
|
||||
/* Whether or not to include the possibly-buggy SMB printer */
|
||||
#undef TCPDUMP_DO_SMB
|
||||
|
||||
/* Long story short: aclocal.m4 depends on autoconf 2.13
|
||||
* implementation details wrt "const"; newer versions
|
||||
* have different implementation details so for now we
|
||||
* put "const" here. This may cause duplicate definitions
|
||||
* 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
|
||||
|
||||
@ -151,9 +108,6 @@
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `getaddrinfo' function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define to 1 if you have the `getnameinfo' function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
@ -187,6 +141,9 @@
|
||||
/* Define to 1 if you have the <openssl/evp.h> header file. */
|
||||
#undef HAVE_OPENSSL_EVP_H
|
||||
|
||||
/* if there's an os_proto.h for this platform, to use additional prototypes */
|
||||
#undef HAVE_OS_PROTO_H
|
||||
|
||||
/* Define to 1 if you have the <pcap/bluetooth.h> header file. */
|
||||
#undef HAVE_PCAP_BLUETOOTH_H
|
||||
|
||||
@ -208,6 +165,9 @@
|
||||
/* Define to 1 if you have the `pcap_lib_version' function. */
|
||||
#undef HAVE_PCAP_LIB_VERSION
|
||||
|
||||
/* Define to 1 if you have the <pcap/usb.h> header file. */
|
||||
#undef HAVE_PCAP_USB_H
|
||||
|
||||
/* Define to 1 if you have the `pfopen' function. */
|
||||
#undef HAVE_PFOPEN
|
||||
|
||||
@ -229,6 +189,9 @@
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* if struct sockaddr has the sa_len member */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
@ -283,6 +246,9 @@
|
||||
/* define if your compiler has __attribute__ */
|
||||
#undef HAVE___ATTRIBUTE__
|
||||
|
||||
/* if unaligned access fails */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
/* Define to 1 if netinet/ether.h declares `ether_ntohost' */
|
||||
#undef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
|
||||
|
||||
@ -307,6 +273,9 @@
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* return value of signal handlers */
|
||||
#undef RETSIGVAL
|
||||
|
||||
/* The size of `char', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR
|
||||
|
||||
@ -328,6 +297,19 @@
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* get BSD semantics on Irix */
|
||||
#undef _BSD_SIGNALS
|
||||
|
||||
/* needed on HP-UX */
|
||||
#undef _HPUX_SOURCE
|
||||
|
||||
/* define if your compiler allows __attribute__((format)) to be applied to
|
||||
function pointers */
|
||||
#undef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
|
||||
|
||||
/* to handle Ultrix compilers that don't support const in prototypes */
|
||||
#undef const
|
||||
|
||||
/* Define as token for inline if inlining supported */
|
||||
#undef inline
|
||||
|
||||
|
319
config.sub
vendored
319
config.sub
vendored
@ -1,9 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2003-11-03'
|
||||
timestamp='2009-12-31'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -21,22 +22,26 @@ timestamp='2003-11-03'
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# 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>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# diff and a properly formatted GNU ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
@ -70,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
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, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -83,11 +89,11 @@ Try \`$me --help' for more information."
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
echo "$timestamp" ; exit ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit 0 ;;
|
||||
echo "$version" ; exit ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
echo "$usage"; exit ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
@ -99,7 +105,7 @@ while test $# -gt 0 ; do
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit 0;;
|
||||
exit ;;
|
||||
|
||||
* )
|
||||
break ;;
|
||||
@ -118,8 +124,10 @@ 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* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
|
||||
kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@ -145,10 +153,13 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis)
|
||||
-apple | -axis | -knuth | -cray | -microblaze)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
@ -170,6 +181,10 @@ case $os in
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco6)
|
||||
os=-sco5v6
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco5)
|
||||
os=-sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@ -186,6 +201,10 @@ case $os in
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco5v6*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@ -230,22 +249,28 @@ case $basic_machine in
|
||||
| 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 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| bfin \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
| mips64vr | mips64vrel \
|
||||
| mips64octeon | mips64octeonel \
|
||||
| mips64orion | mips64orionel \
|
||||
| mips64r5900 | mips64r5900el \
|
||||
| mips64vr | mips64vrel \
|
||||
| mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr4300 | mips64vr4300el \
|
||||
| mips64vr5000 | mips64vr5000el \
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
@ -254,30 +279,40 @@ case $basic_machine in
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| openrisc | or32 \
|
||||
| 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 \
|
||||
| rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
| z8k)
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
|
||||
;;
|
||||
ms1)
|
||||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
@ -297,28 +332,32 @@ case $basic_machine in
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| avr-* | avr32-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | cydra-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
| mips64vr-* | mips64vrel-* \
|
||||
| mips64octeon-* | mips64octeonel-* \
|
||||
| mips64orion-* | mips64orionel-* \
|
||||
| mips64r5900-* | mips64r5900el-* \
|
||||
| mips64vr-* | mips64vrel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* \
|
||||
| mips64vr4300-* | mips64vr4300el-* \
|
||||
| mips64vr5000-* | mips64vr5000el-* \
|
||||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
@ -326,26 +365,35 @@ case $basic_machine in
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | 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-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
||||
| xtensa-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-*)
|
||||
| z8k-* | z80-*)
|
||||
;;
|
||||
# Recognize the basic CPU types without company name, with glob match.
|
||||
xtensa*)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
@ -363,6 +411,9 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
@ -380,6 +431,9 @@ case $basic_machine in
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amd64-*)
|
||||
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@ -403,6 +457,10 @@ case $basic_machine in
|
||||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aros)
|
||||
basic_machine=i386-pc
|
||||
os=-aros
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
@ -411,10 +469,26 @@ case $basic_machine in
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
blackfin)
|
||||
basic_machine=bfin-unknown
|
||||
os=-linux
|
||||
;;
|
||||
blackfin-*)
|
||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
bluegene*)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cegcc)
|
||||
basic_machine=arm-unknown
|
||||
os=-cegcc
|
||||
;;
|
||||
convex-c1)
|
||||
basic_machine=c1-convex
|
||||
os=-bsd
|
||||
@ -439,12 +513,27 @@ case $basic_machine in
|
||||
basic_machine=j90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
craynv)
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
crisv32 | crisv32-* | etraxfs*)
|
||||
basic_machine=crisv32-axis
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
crx)
|
||||
basic_machine=crx-unknown
|
||||
os=-elf
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@ -467,6 +556,14 @@ case $basic_machine in
|
||||
basic_machine=m88k-motorola
|
||||
os=-sysv3
|
||||
;;
|
||||
dicos)
|
||||
basic_machine=i686-pc
|
||||
os=-dicos
|
||||
;;
|
||||
djgpp)
|
||||
basic_machine=i586-pc
|
||||
os=-msdosdjgpp
|
||||
;;
|
||||
dpx20 | dpx20-*)
|
||||
basic_machine=rs6000-bull
|
||||
os=-bosx
|
||||
@ -617,6 +714,14 @@ case $basic_machine in
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
;;
|
||||
m68knommu-*)
|
||||
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
m88k-omron*)
|
||||
basic_machine=m88k-omron
|
||||
;;
|
||||
@ -628,10 +733,17 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
basic_machine=arm-unknown
|
||||
os=-mingw32ce
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
@ -645,10 +757,6 @@ case $basic_machine in
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
@ -661,6 +769,9 @@ case $basic_machine in
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
;;
|
||||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
@ -729,10 +840,6 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nv1)
|
||||
basic_machine=nv1-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@ -740,9 +847,8 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
or32 | or32-*)
|
||||
openrisc | openrisc-*)
|
||||
basic_machine=or32-unknown
|
||||
os=-coff
|
||||
;;
|
||||
os400)
|
||||
basic_machine=powerpc-ibm
|
||||
@ -764,6 +870,14 @@ case $basic_machine in
|
||||
basic_machine=i860-intel
|
||||
os=-osf
|
||||
;;
|
||||
parisc)
|
||||
basic_machine=hppa-unknown
|
||||
os=-linux
|
||||
;;
|
||||
parisc-*)
|
||||
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
pbd)
|
||||
basic_machine=sparc-tti
|
||||
;;
|
||||
@ -773,6 +887,12 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pc98)
|
||||
basic_machine=i386-pc
|
||||
;;
|
||||
pc98-*)
|
||||
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexgen | viac3)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
@ -829,6 +949,10 @@ case $basic_machine in
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
@ -855,6 +979,10 @@ case $basic_machine in
|
||||
sb1el)
|
||||
basic_machine=mipsisa64sb1el-unknown
|
||||
;;
|
||||
sde)
|
||||
basic_machine=mipsisa32-sde
|
||||
os=-elf
|
||||
;;
|
||||
sei)
|
||||
basic_machine=mips-sei
|
||||
os=-seiux
|
||||
@ -866,6 +994,9 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sh5el)
|
||||
basic_machine=sh5le-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
@ -955,6 +1086,10 @@ case $basic_machine in
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=tile-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
@ -1015,6 +1150,10 @@ case $basic_machine in
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xbox)
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
@ -1026,6 +1165,10 @@ case $basic_machine in
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
;;
|
||||
z80-*-coff)
|
||||
basic_machine=z80-unknown
|
||||
os=-sim
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
@ -1045,6 +1188,9 @@ case $basic_machine in
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
mmix)
|
||||
basic_machine=mmix-knuth
|
||||
;;
|
||||
rs6000)
|
||||
basic_machine=rs6000-ibm
|
||||
;;
|
||||
@ -1061,13 +1207,10 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@ -1114,6 +1257,9 @@ case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
@ -1134,25 +1280,30 @@ case $os in
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1170,7 +1321,7 @@ case $os in
|
||||
os=`echo $os | sed -e 's|nto|nto-qnx|'`
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
@ -1215,6 +1366,9 @@ case $os in
|
||||
-atheos*)
|
||||
os=-atheos
|
||||
;;
|
||||
-syllable*)
|
||||
os=-syllable
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
@ -1276,6 +1430,14 @@ case $os in
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-dicos*)
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@ -1298,6 +1460,12 @@ else
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
score-*)
|
||||
os=-elf
|
||||
;;
|
||||
spu-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
@ -1307,9 +1475,9 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
@ -1335,6 +1503,9 @@ case $basic_machine in
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
@ -1353,9 +1524,15 @@ case $basic_machine in
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
*-haiku)
|
||||
os=-haiku
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
@ -1458,7 +1635,7 @@ case $basic_machine in
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
-cnk*|-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
@ -1521,7 +1698,7 @@ case $basic_machine in
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit 0
|
||||
exit
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
|
101
configure.in
101
configure.in
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.196.2.6 2008-09-25 21:50:04 guy Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.204 2008-11-18 07:39:20 guy Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1994, 1995, 1996, 1997
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -6,15 +6,29 @@ dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_REVISION($Revision: 1.196.2.6 $)
|
||||
#
|
||||
# See
|
||||
#
|
||||
# http://ftp.gnu.org/gnu/config/README
|
||||
#
|
||||
# for the URLs to use to fetch new versions of config.guess and
|
||||
# config.sub.
|
||||
#
|
||||
|
||||
AC_REVISION($Revision: 1.204 $)
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(tcpdump.c)
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
|
||||
AC_PROG_CC
|
||||
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
||||
AC_LBL_C_INLINE
|
||||
AC_C___ATTRIBUTE__
|
||||
if test "$ac_cv___attribute__" = "yes"; then
|
||||
AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
|
||||
fi
|
||||
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h)
|
||||
AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -70,6 +84,12 @@ linux*)
|
||||
esac
|
||||
|
||||
|
||||
AC_ARG_WITH(smi,
|
||||
[ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
|
||||
--without-smi don't link with libsmi],,
|
||||
with_smi=yes)
|
||||
|
||||
if test "x$with_smi" != "xno" ; then
|
||||
AC_CHECK_HEADERS(smi.h)
|
||||
AC_CHECK_LIB(smi, smiInit)
|
||||
if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
|
||||
@ -111,6 +131,7 @@ dnl autoconf ever comes back to match the documentation.
|
||||
libsmi=no]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
|
||||
AC_ARG_ENABLE(smb,
|
||||
@ -138,7 +159,7 @@ fi
|
||||
|
||||
AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
|
||||
AC_MSG_CHECKING([whether to chroot])
|
||||
if test ! -z "$with_chroot" ; then
|
||||
if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
|
||||
AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
|
||||
AC_MSG_RESULT(to \"$withval\")
|
||||
else
|
||||
@ -434,7 +455,7 @@ main()
|
||||
fi
|
||||
fi
|
||||
])
|
||||
AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
|
||||
AC_REPLACE_FUNCS(getnameinfo)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
|
||||
@ -455,13 +476,6 @@ AC_CHECK_SIZEOF(int, 4)
|
||||
AC_CHECK_SIZEOF(long, 4)
|
||||
AC_CHECK_SIZEOF(long long, 8)
|
||||
|
||||
dnl
|
||||
dnl Checks for u_intXX_t
|
||||
dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
|
||||
dnl if test "$ac_cv_bittypes" = no; then
|
||||
dnl missing_includes=yes
|
||||
dnl fi
|
||||
|
||||
dnl
|
||||
dnl Checks for addrinfo structure
|
||||
AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
|
||||
@ -779,6 +793,12 @@ V_GROUP=0
|
||||
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
|
||||
V_GROUP=wheel
|
||||
fi
|
||||
#
|
||||
# Assume V7/BSD convention for man pages (file formats in section 5,
|
||||
# miscellaneous info in section 7).
|
||||
#
|
||||
MAN_FILE_FORMATS=5
|
||||
MAN_MISC_INFO=7
|
||||
case "$host_os" in
|
||||
|
||||
aix*)
|
||||
@ -786,16 +806,42 @@ aix*)
|
||||
AC_DEFINE(_SUN)
|
||||
;;
|
||||
|
||||
hpux*)
|
||||
#
|
||||
# Use System V conventions for man pages.
|
||||
#
|
||||
MAN_FILE_FORMATS=4
|
||||
MAN_MISC_INFO=5
|
||||
;;
|
||||
|
||||
irix*)
|
||||
V_GROUP=sys
|
||||
|
||||
#
|
||||
# Use System V conventions for man pages.
|
||||
#
|
||||
MAN_FILE_FORMATS=4
|
||||
MAN_MISC_INFO=5
|
||||
;;
|
||||
|
||||
osf*)
|
||||
V_GROUP=system
|
||||
|
||||
#
|
||||
# Use System V conventions for man pages.
|
||||
#
|
||||
MAN_FILE_FORMATS=4
|
||||
MAN_MISC_INFO=5
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
V_GROUP=sys
|
||||
|
||||
#
|
||||
# Use System V conventions for man pages.
|
||||
#
|
||||
MAN_FILE_FORMATS=4
|
||||
MAN_MISC_INFO=5
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -810,13 +856,18 @@ fi
|
||||
savedcppflags="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
AC_CHECK_HEADERS(pcap/bluetooth.h)
|
||||
AC_CHECK_HEADERS(pcap/usb.h)
|
||||
CPPFLAGS="$savedcppflags"
|
||||
|
||||
AC_CHECK_HEADERS(sys/bitypes.h)
|
||||
|
||||
AC_CHECK_TYPE([int8_t], ,
|
||||
[AC_DEFINE([int8_t], [signed char],
|
||||
[Define to `signed char' if int8_t not defined.])])
|
||||
[Define to `signed char' if int8_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([u_int8_t], ,
|
||||
[AC_DEFINE([u_int8_t], [unsigned char],
|
||||
[Define to `unsigned char' if u_int8_t not defined.])],
|
||||
@ -826,7 +877,11 @@ AC_CHECK_TYPE([u_int8_t], ,
|
||||
#endif])
|
||||
AC_CHECK_TYPE([int16_t], ,
|
||||
[AC_DEFINE([int16_t], [short],
|
||||
[Define to `short' if int16_t not defined.])])
|
||||
[Define to `short' if int16_t not defined.])]
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([u_int16_t], ,
|
||||
[AC_DEFINE([u_int16_t], [unsigned short],
|
||||
[Define to `unsigned short' if u_int16_t not defined.])],
|
||||
@ -836,7 +891,11 @@ AC_CHECK_TYPE([u_int16_t], ,
|
||||
#endif])
|
||||
AC_CHECK_TYPE([int32_t], ,
|
||||
[AC_DEFINE([int32_t], [int],
|
||||
[Define to `int' if int32_t not defined.])])
|
||||
[Define to `int' if int32_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([u_int32_t], ,
|
||||
[AC_DEFINE([u_int32_t], [unsigned int],
|
||||
[Define to `unsigned int' if u_int32_t not defined.])],
|
||||
@ -846,7 +905,11 @@ AC_CHECK_TYPE([u_int32_t], ,
|
||||
#endif])
|
||||
AC_CHECK_TYPE([int64_t], ,
|
||||
[AC_DEFINE([int64_t], [long long],
|
||||
[Define to `long long' if int64_t not defined.])])
|
||||
[Define to `long long' if int64_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([u_int64_t], ,
|
||||
[AC_DEFINE([u_int64_t], [unsigned long long],
|
||||
[Define to `unsigned long long' if u_int64_t not defined.])],
|
||||
@ -989,7 +1052,9 @@ if test "$want_libcrypto" != "no"; then
|
||||
fi
|
||||
if test "$ac_cv_ssleay_path" != no; then
|
||||
V_INCLS="$V_INCLS $incdir"
|
||||
LDFLAGS="-L$dir/lib $LDFLAGS"
|
||||
if test "$dir" != "/usr"; then
|
||||
LDFLAGS="-L$dir/lib $LDFLAGS"
|
||||
fi
|
||||
if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
|
||||
LIBS="$LIBS -lRSAglue"
|
||||
fi
|
||||
@ -1024,6 +1089,8 @@ AC_SUBST(V_GROUP)
|
||||
AC_SUBST(V_INCLS)
|
||||
AC_SUBST(V_PCAPDEP)
|
||||
AC_SUBST(LOCALSRC)
|
||||
AC_SUBST(MAN_FILE_FORMATS)
|
||||
AC_SUBST(MAN_MISC_INFO)
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
@ -1034,5 +1101,5 @@ AC_OUTPUT_COMMANDS([if test -f .devel; then
|
||||
cat Makefile-devel-adds >> Makefile
|
||||
make depend
|
||||
fi])
|
||||
AC_OUTPUT(Makefile)
|
||||
AC_OUTPUT(Makefile tcpdump.1)
|
||||
exit 0
|
||||
|
11
ethertype.h
11
ethertype.h
@ -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.29.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ethertype.h,v 1.30 2008-02-06 10:47:53 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -76,6 +76,9 @@
|
||||
#ifndef ETHERTYPE_SCA
|
||||
#define ETHERTYPE_SCA 0x6007
|
||||
#endif
|
||||
#ifndef ETHERTYPE_TEB
|
||||
#define ETHERTYPE_TEB 0x6558
|
||||
#endif
|
||||
#ifndef ETHERTYPE_LANBRIDGE
|
||||
#define ETHERTYPE_LANBRIDGE 0x8038
|
||||
#endif
|
||||
@ -127,6 +130,12 @@
|
||||
#ifndef ETHERTYPE_PPPOES
|
||||
#define ETHERTYPE_PPPOES 0x8864
|
||||
#endif
|
||||
#ifndef ETHERTYPE_PPPOED2
|
||||
#define ETHERTYPE_PPPOED2 0x3c12
|
||||
#endif
|
||||
#ifndef ETHERTYPE_PPPOES2
|
||||
#define ETHERTYPE_PPPOES2 0x3c13
|
||||
#endif
|
||||
#ifndef ETHERTYPE_JUMBO
|
||||
#define ETHERTYPE_JUMBO 0x8870
|
||||
#endif
|
||||
|
679
forces.h
Normal file
679
forces.h
Normal file
@ -0,0 +1,679 @@
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 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.
|
||||
*
|
||||
* Copyright (c) 2009 Mojatatu Networks, Inc
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Per draft-ietf-forces-protocol-22
|
||||
*/
|
||||
#define ForCES_VERS 1
|
||||
#define ForCES_HDRL 24
|
||||
#define ForCES_ALNL 4U
|
||||
#define TLV_HDRL 4
|
||||
#define ILV_HDRL 8
|
||||
|
||||
#define TOM_RSVD 0x0
|
||||
#define TOM_ASSNSETUP 0x1
|
||||
#define TOM_ASSNTEARD 0x2
|
||||
#define TOM_CONFIG 0x3
|
||||
#define TOM_QUERY 0x4
|
||||
#define TOM_EVENTNOT 0x5
|
||||
#define TOM_PKTREDIR 0x6
|
||||
#define TOM_HEARTBT 0x0F
|
||||
#define TOM_ASSNSETREP 0x11
|
||||
#define TOM_CONFIGREP 0x13
|
||||
#define TOM_QUERYREP 0x14
|
||||
|
||||
/*
|
||||
* tom_h Flags: resv1(8b):maxtlvs(4b):resv2(2b):mintlv(2b)
|
||||
*/
|
||||
#define ZERO_TTLV 0x01
|
||||
#define ZERO_MORE_TTLV 0x02
|
||||
#define ONE_MORE_TTLV 0x04
|
||||
#define ZERO_TLV 0x00
|
||||
#define ONE_TLV 0x10
|
||||
#define TWO_TLV 0x20
|
||||
#define MAX_TLV 0xF0
|
||||
|
||||
#define TTLV_T1 (ONE_MORE_TTLV|ONE_TLV)
|
||||
#define TTLV_T2 (ONE_MORE_TTLV|MAX_TLV)
|
||||
|
||||
struct tom_h {
|
||||
u_int32_t v;
|
||||
u_int16_t flags;
|
||||
u_int16_t op_msk;
|
||||
const char *s;
|
||||
int (*print) (register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
};
|
||||
|
||||
enum {
|
||||
TOM_RSV_I,
|
||||
TOM_ASS_I,
|
||||
TOM_AST_I,
|
||||
TOM_CFG_I,
|
||||
TOM_QRY_I,
|
||||
TOM_EVN_I,
|
||||
TOM_RED_I,
|
||||
TOM_HBT_I,
|
||||
TOM_ASR_I,
|
||||
TOM_CNR_I,
|
||||
TOM_QRR_I,
|
||||
_TOM_RSV_MAX
|
||||
};
|
||||
#define TOM_MAX_IND (_TOM_RSV_MAX - 1)
|
||||
|
||||
int lfbselect_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int redirect_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int asrtlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int asttlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int gentltlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int print_metailv(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int print_metatlv(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int print_reddata(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
|
||||
static inline int tom_valid(u_int8_t tom)
|
||||
{
|
||||
if (tom > 0) {
|
||||
if (tom >= 0x7 && tom <= 0xe)
|
||||
return 0;
|
||||
if (tom == 0x10)
|
||||
return 0;
|
||||
if (tom > 0x14)
|
||||
return 0;
|
||||
return 1;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline const char *ForCES_node(u_int32_t node)
|
||||
{
|
||||
if (node <= 0x3FFFFFFF)
|
||||
return "FE";
|
||||
if (node >= 0x40000000 && node <= 0x7FFFFFFF)
|
||||
return "CE";
|
||||
if (node >= 0xC0000000 && node <= 0xFFFFFFEF)
|
||||
return "AllMulticast";
|
||||
if (node == 0xFFFFFFFD)
|
||||
return "AllCEsBroadcast";
|
||||
if (node == 0xFFFFFFFE)
|
||||
return "AllFEsBroadcast";
|
||||
if (node == 0xFFFFFFFF)
|
||||
return "AllBroadcast";
|
||||
|
||||
return "ForCESreserved";
|
||||
|
||||
}
|
||||
|
||||
static inline const char *ForCES_ACKp(u_int32_t flg)
|
||||
{
|
||||
if (flg == 0x0)
|
||||
return "NoACK";
|
||||
if (flg == 0x1)
|
||||
return "SuccessACK";
|
||||
if (flg == 0x2)
|
||||
return "FailureACK";
|
||||
if (flg == 0x3)
|
||||
return "AlwaysACK";
|
||||
return "ACKUnknown";
|
||||
}
|
||||
|
||||
static inline const char *ForCES_EMp(u_int32_t flg)
|
||||
{
|
||||
if (flg == 0x0)
|
||||
return "EMReserved";
|
||||
if (flg == 0x1)
|
||||
return "execute-all-or-none";
|
||||
if (flg == 0x2)
|
||||
return "execute-until-failure";
|
||||
if (flg == 0x3)
|
||||
return "continue-execute-on-failure";
|
||||
return "EMUnknown";
|
||||
}
|
||||
|
||||
static inline const char *ForCES_ATp(u_int32_t flg)
|
||||
{
|
||||
if (flg == 0x0)
|
||||
return "Standalone";
|
||||
if (flg == 0x1)
|
||||
return "2PCtransaction";
|
||||
return "ATUnknown";
|
||||
}
|
||||
|
||||
static inline const char *ForCES_TPp(u_int32_t flg)
|
||||
{
|
||||
if (flg == 0x0)
|
||||
return "StartofTransaction";
|
||||
if (flg == 0x1)
|
||||
return "MiddleofTransaction";
|
||||
if (flg == 0x2)
|
||||
return "EndofTransaction";
|
||||
if (flg == 0x3)
|
||||
return "abort";
|
||||
return "TPUnknown";
|
||||
}
|
||||
|
||||
/*
|
||||
* Structure of forces header, naked of TLVs.
|
||||
*/
|
||||
struct forcesh {
|
||||
u_int8_t fm_vrsvd; /* version and reserved */
|
||||
#define ForCES_V(forcesh) ((forcesh)->fm_vrsvd >> 4)
|
||||
u_int8_t fm_tom; /* type of message */
|
||||
u_int16_t fm_len; /* total length * 4 bytes */
|
||||
#define ForCES_BLN(forcesh) ((u_int32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2))
|
||||
u_int32_t fm_sid; /* Source ID */
|
||||
#define ForCES_SID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_sid)
|
||||
u_int32_t fm_did; /* Destination ID */
|
||||
#define ForCES_DID(forcesh) EXTRACT_32BITS(&(forcesh)->fm_did)
|
||||
u_int8_t fm_cor[8]; /* correlator */
|
||||
u_int32_t fm_flags; /* flags */
|
||||
#define ForCES_ACK(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30)
|
||||
#define ForCES_PRI(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27)
|
||||
#define ForCES_RS1(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24)
|
||||
#define ForCES_EM(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00C00000) >> 22)
|
||||
#define ForCES_AT(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00200000) >> 21)
|
||||
#define ForCES_TP(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x00180000) >> 19)
|
||||
#define ForCES_RS2(forcesh) ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x0007FFFF) >> 0)
|
||||
};
|
||||
|
||||
#define ForCES_HLN_VALID(fhl,tlen) ((tlen) >= ForCES_HDRL && \
|
||||
(fhl) >= ForCES_HDRL && \
|
||||
(fhl) == (tlen))
|
||||
|
||||
#define F_LFB_RSVD 0x0
|
||||
#define F_LFB_FEO 0x1
|
||||
#define F_LFB_FEPO 0x2
|
||||
const struct tok ForCES_LFBs[] = {
|
||||
{F_LFB_RSVD, "Invalid TLV"},
|
||||
{F_LFB_FEO, "FEObj LFB"},
|
||||
{F_LFB_FEPO, "FEProtoObj LFB"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
int forces_type_print(register const u_char * pptr, const struct forcesh *fhdr,
|
||||
register u_int mlen, const struct tom_h *tops);
|
||||
|
||||
enum {
|
||||
F_OP_RSV,
|
||||
F_OP_SET,
|
||||
F_OP_SETPROP,
|
||||
F_OP_SETRESP,
|
||||
F_OP_SETPRESP,
|
||||
F_OP_DEL,
|
||||
F_OP_DELRESP,
|
||||
F_OP_GET,
|
||||
F_OP_GETPROP,
|
||||
F_OP_GETRESP,
|
||||
F_OP_GETPRESP,
|
||||
F_OP_REPORT,
|
||||
F_OP_COMMIT,
|
||||
F_OP_RCOMMIT,
|
||||
F_OP_RTRCOMP,
|
||||
_F_OP_MAX
|
||||
};
|
||||
|
||||
#define F_OP_MAX (_F_OP_MAX - 1)
|
||||
enum {
|
||||
B_OP_SET = 1 << (F_OP_SET - 1),
|
||||
B_OP_SETPROP = 1 << (F_OP_SETPROP - 1),
|
||||
B_OP_SETRESP = 1 << (F_OP_SETRESP - 1),
|
||||
B_OP_SETPRESP = 1 << (F_OP_SETPRESP - 1),
|
||||
B_OP_DEL = 1 << (F_OP_DEL - 1),
|
||||
B_OP_DELRESP = 1 << (F_OP_DELRESP - 1),
|
||||
B_OP_GET = 1 << (F_OP_GET - 1),
|
||||
B_OP_GETPROP = 1 << (F_OP_GETPROP - 1),
|
||||
B_OP_GETRESP = 1 << (F_OP_GETRESP - 1),
|
||||
B_OP_GETPRESP = 1 << (F_OP_GETPRESP - 1),
|
||||
B_OP_REPORT = 1 << (F_OP_REPORT - 1),
|
||||
B_OP_COMMIT = 1 << (F_OP_COMMIT - 1),
|
||||
B_OP_RCOMMIT = 1 << (F_OP_RCOMMIT - 1),
|
||||
B_OP_RTRCOMP = 1 << (F_OP_RTRCOMP - 1),
|
||||
};
|
||||
|
||||
struct optlv_h {
|
||||
u_int16_t flags;
|
||||
u_int16_t op_msk;
|
||||
const char *s;
|
||||
int (*print) (register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
};
|
||||
|
||||
int genoptlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int recpdoptlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int invoptlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
|
||||
#define OP_MIN_SIZ 8
|
||||
struct pathdata_h {
|
||||
u_int16_t pflags;
|
||||
u_int16_t pIDcnt;
|
||||
};
|
||||
|
||||
#define B_FULLD 0x1
|
||||
#define B_SPARD 0x2
|
||||
#define B_RESTV 0x4
|
||||
#define B_KEYIN 0x8
|
||||
|
||||
static const struct optlv_h OPTLV_msg[F_OP_MAX + 1] = {
|
||||
/* F_OP_RSV */ {ZERO_TTLV, 0, "Invalid OPTLV", invoptlv_print},
|
||||
/* F_OP_SET */ {TTLV_T2, B_FULLD | B_SPARD, " Set", recpdoptlv_print},
|
||||
/* F_OP_SETPROP */
|
||||
{TTLV_T2, B_FULLD | B_SPARD, " SetProp", recpdoptlv_print},
|
||||
/* F_OP_SETRESP */ {TTLV_T2, B_RESTV, " SetResp", recpdoptlv_print},
|
||||
/* F_OP_SETPRESP */ {TTLV_T2, B_RESTV, " SetPropResp", recpdoptlv_print},
|
||||
/* F_OP_DEL */ {ZERO_TTLV, 0, " Del", recpdoptlv_print},
|
||||
/* F_OP_DELRESP */ {TTLV_T2, B_RESTV, " DelResp", recpdoptlv_print},
|
||||
/* F_OP_GET */ {ZERO_TTLV, 0, " Get", recpdoptlv_print},
|
||||
/* F_OP_GETPROP */ {ZERO_TTLV, 0, " GetProp", recpdoptlv_print},
|
||||
/* F_OP_GETRESP */
|
||||
{TTLV_T2, B_FULLD | B_RESTV, " GetResp", recpdoptlv_print},
|
||||
/* F_OP_GETPRESP */
|
||||
{TTLV_T2, B_FULLD | B_RESTV, " GetPropResp", recpdoptlv_print},
|
||||
/* F_OP_REPORT */
|
||||
{TTLV_T2, B_FULLD | B_SPARD, " Report", recpdoptlv_print},
|
||||
/* F_OP_COMMIT */ {ZERO_TTLV, 0, " Commit", NULL},
|
||||
/* F_OP_RCOMMIT */ {TTLV_T1, B_RESTV, " RCommit", genoptlv_print},
|
||||
/* F_OP_RTRCOMP */ {ZERO_TTLV, 0, " RTRCOMP", NULL},
|
||||
};
|
||||
|
||||
static inline const struct optlv_h *get_forces_optlv_h(u_int16_t opt)
|
||||
{
|
||||
if (opt > F_OP_MAX || opt <= F_OP_RSV)
|
||||
return &OPTLV_msg[F_OP_RSV];
|
||||
|
||||
return &OPTLV_msg[opt];
|
||||
}
|
||||
|
||||
#define IND_SIZE 256
|
||||
#define IND_CHR ' '
|
||||
#define IND_PREF '\n'
|
||||
#define IND_SUF 0x0
|
||||
char ind_buf[IND_SIZE];
|
||||
|
||||
static inline char *indent_pr(int indent, int nlpref)
|
||||
{
|
||||
int i = 0;
|
||||
char *r = ind_buf;
|
||||
|
||||
if (indent > (IND_SIZE - 1))
|
||||
indent = IND_SIZE - 1;
|
||||
|
||||
if (nlpref) {
|
||||
r[i] = IND_PREF;
|
||||
i++;
|
||||
indent--;
|
||||
}
|
||||
|
||||
while (--indent >= 0)
|
||||
r[i++] = IND_CHR;
|
||||
|
||||
r[i] = IND_SUF;
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline int op_valid(u_int16_t op, u_int16_t mask)
|
||||
{
|
||||
int opb = 1 << (op - 1);
|
||||
|
||||
if (op == 0)
|
||||
return 0;
|
||||
if (opb & mask)
|
||||
return 1;
|
||||
/* I guess we should allow vendor operations? */
|
||||
if (op >= 0x8000)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define F_TLV_RSVD 0x0000
|
||||
#define F_TLV_REDR 0x0001
|
||||
#define F_TLV_ASRS 0x0010
|
||||
#define F_TLV_ASRT 0x0011
|
||||
#define F_TLV_LFBS 0x1000
|
||||
#define F_TLV_PDAT 0x0110
|
||||
#define F_TLV_KEYI 0x0111
|
||||
#define F_TLV_FULD 0x0112
|
||||
#define F_TLV_SPAD 0x0113
|
||||
#define F_TLV_REST 0x0114
|
||||
#define F_TLV_METD 0x0115
|
||||
#define F_TLV_REDD 0x0116
|
||||
#define F_TLV_VNST 0x8000
|
||||
|
||||
static const struct tok ForCES_TLV[] = {
|
||||
{F_TLV_RSVD, "Invalid TLV"},
|
||||
{F_TLV_REDR, "REDIRECT TLV"},
|
||||
{F_TLV_ASRS, "ASResult TLV"},
|
||||
{F_TLV_ASRT, "ASTreason TLV"},
|
||||
{F_TLV_LFBS, "LFBselect TLV"},
|
||||
{F_TLV_PDAT, "PATH-DATA TLV"},
|
||||
{F_TLV_KEYI, "KEYINFO TLV"},
|
||||
{F_TLV_FULD, "FULLDATA TLV"},
|
||||
{F_TLV_SPAD, "SPARSEDATA TLV"},
|
||||
{F_TLV_REST, "RESULT TLV"},
|
||||
{F_TLV_METD, "METADATA TLV"},
|
||||
{F_TLV_REDD, "REDIRECTDATA TLV"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
#define TLV_HLN 4
|
||||
static inline int ttlv_valid(u_int16_t ttlv)
|
||||
{
|
||||
if (ttlv > 0) {
|
||||
if (ttlv == 1 || ttlv == 0x1000)
|
||||
return 1;
|
||||
if (ttlv >= 0x10 && ttlv <= 0x11)
|
||||
return 1;
|
||||
if (ttlv >= 0x110 && ttlv <= 0x116)
|
||||
return 1;
|
||||
if (ttlv >= 0x8000)
|
||||
return 0; /* XXX: */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct forces_ilv {
|
||||
u_int32_t type;
|
||||
u_int32_t length;
|
||||
};
|
||||
|
||||
struct forces_tlv {
|
||||
u_int16_t type;
|
||||
u_int16_t length;
|
||||
};
|
||||
|
||||
int otlv_print(const struct forces_tlv *otlv, u_int16_t op_msk, int indent);
|
||||
|
||||
#define F_ALN_LEN(len) ( ((len)+ForCES_ALNL-1) & ~(ForCES_ALNL-1) )
|
||||
#define GET_TOP_TLV(fhdr) ((struct forces_tlv *)((fhdr) + sizeof (struct forcesh)))
|
||||
#define TLV_SET_LEN(len) (F_ALN_LEN(TLV_HDRL) + (len))
|
||||
#define TLV_ALN_LEN(len) F_ALN_LEN(TLV_SET_LEN(len))
|
||||
#define TLV_RDAT_LEN(tlv) ((int)(EXTRACT_16BITS(&(tlv)->length) - TLV_SET_LEN(0))
|
||||
#define TLV_DATA(tlvp) ((void*)(((char*)(tlvp)) + TLV_SET_LEN(0)))
|
||||
#define GO_NXT_TLV(tlv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length)), \
|
||||
(struct forces_tlv*)(((char*)(tlv)) \
|
||||
+ F_ALN_LEN(EXTRACT_16BITS(&(tlv)->length))))
|
||||
#define ILV_SET_LEN(len) (F_ALN_LEN(ILV_HDRL) + (len))
|
||||
#define ILV_ALN_LEN(len) F_ALN_LEN(ILV_SET_LEN(len))
|
||||
#define ILV_RDAT_LEN(ilv) ((int)(EXTRACT_32BITS(&(ilv)->length)) - ILV_SET_LEN(0))
|
||||
#define ILV_DATA(ilvp) ((void*)(((char*)(ilvp)) + ILV_SET_LEN(0)))
|
||||
#define GO_NXT_ILV(ilv,rlen) ((rlen) -= F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length)), \
|
||||
(struct forces_ilv *)(((char*)(ilv)) \
|
||||
+ F_ALN_LEN(EXTRACT_32BITS(&(ilv)->length))))
|
||||
#define INVALID_RLEN -1
|
||||
#define INVALID_STLN -2
|
||||
#define INVALID_LTLN -3
|
||||
#define INVALID_ALEN -4
|
||||
|
||||
static const struct tok ForCES_TLV_err[] = {
|
||||
{INVALID_RLEN, "Invalid total length"},
|
||||
{INVALID_STLN, "xLV too short"},
|
||||
{INVALID_LTLN, "xLV too long"},
|
||||
{INVALID_ALEN, "data padding missing"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
static inline int tlv_valid(const struct forces_tlv *tlv, u_int rlen)
|
||||
{
|
||||
if (rlen < TLV_HDRL)
|
||||
return INVALID_RLEN;
|
||||
if (EXTRACT_16BITS(&tlv->length) < TLV_HDRL)
|
||||
return INVALID_STLN;
|
||||
if (EXTRACT_16BITS(&tlv->length) > rlen)
|
||||
return INVALID_LTLN;
|
||||
if (rlen < F_ALN_LEN(EXTRACT_16BITS(&tlv->length)))
|
||||
return INVALID_ALEN;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ilv_valid(const struct forces_ilv *ilv, u_int rlen)
|
||||
{
|
||||
if (rlen < ILV_HDRL)
|
||||
return INVALID_RLEN;
|
||||
if (EXTRACT_32BITS(&ilv->length) < ILV_HDRL)
|
||||
return INVALID_STLN;
|
||||
if (EXTRACT_32BITS(&ilv->length) > rlen)
|
||||
return INVALID_LTLN;
|
||||
if (rlen < F_ALN_LEN(EXTRACT_32BITS(&ilv->length)))
|
||||
return INVALID_ALEN;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct forces_lfbsh {
|
||||
u_int32_t class;
|
||||
u_int32_t instance;
|
||||
};
|
||||
|
||||
#define ASSNS_OPS (B_OP_REPORT)
|
||||
#define CFG_OPS (B_OP_SET|B_OP_SETPROP|B_OP_DEL|B_OP_COMMIT|B_OP_RTRCOMP)
|
||||
#define CFG_ROPS (B_OP_SETRESP|B_OP_SETPRESP|B_OP_DELRESP|B_OP_RCOMMIT)
|
||||
#define CFG_QY (B_OP_GET|B_OP_GETPROP)
|
||||
#define CFG_QYR (B_OP_GETRESP|B_OP_GETPRESP)
|
||||
#define CFG_EVN (B_OP_REPORT)
|
||||
|
||||
static const struct tom_h ForCES_msg[TOM_MAX_IND + 1] = {
|
||||
/* TOM_RSV_I */ {TOM_RSVD, ZERO_TTLV, 0, "Invalid message", NULL},
|
||||
/* TOM_ASS_I */ {TOM_ASSNSETUP, ZERO_MORE_TTLV | TWO_TLV, ASSNS_OPS,
|
||||
"Association Setup", lfbselect_print},
|
||||
/* TOM_AST_I */
|
||||
{TOM_ASSNTEARD, TTLV_T1, 0, "Association TearDown", asttlv_print},
|
||||
/* TOM_CFG_I */ {TOM_CONFIG, TTLV_T2, CFG_OPS, "Config", lfbselect_print},
|
||||
/* TOM_QRY_I */ {TOM_QUERY, TTLV_T2, CFG_QY, "Query", lfbselect_print},
|
||||
/* TOM_EVN_I */ {TOM_EVENTNOT, TTLV_T1, CFG_EVN, "Event Notification",
|
||||
lfbselect_print},
|
||||
/* TOM_RED_I */
|
||||
{TOM_PKTREDIR, TTLV_T2, 0, "Packet Redirect", redirect_print},
|
||||
/* TOM_HBT_I */ {TOM_HEARTBT, ZERO_TTLV, 0, "HeartBeat", NULL},
|
||||
/* TOM_ASR_I */
|
||||
{TOM_ASSNSETREP, TTLV_T1, 0, "Association Response", asrtlv_print},
|
||||
/* TOM_CNR_I */ {TOM_CONFIGREP, TTLV_T2, CFG_ROPS, "Config Response",
|
||||
lfbselect_print},
|
||||
/* TOM_QRR_I */
|
||||
{TOM_QUERYREP, TTLV_T2, CFG_QYR, "Query Response", lfbselect_print},
|
||||
};
|
||||
|
||||
static inline const struct tom_h *get_forces_tom(u_int8_t tom)
|
||||
{
|
||||
int i;
|
||||
for (i = TOM_RSV_I; i <= TOM_MAX_IND; i++) {
|
||||
const struct tom_h *th = &ForCES_msg[i];
|
||||
if (th->v == tom)
|
||||
return th;
|
||||
}
|
||||
return &ForCES_msg[TOM_RSV_I];
|
||||
}
|
||||
|
||||
struct pdata_ops {
|
||||
u_int32_t v;
|
||||
u_int16_t flags;
|
||||
u_int16_t op_msk;
|
||||
const char *s;
|
||||
int (*print) (register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
};
|
||||
|
||||
enum {
|
||||
PD_RSV_I,
|
||||
PD_SEL_I,
|
||||
PD_FDT_I,
|
||||
PD_SDT_I,
|
||||
PD_RES_I,
|
||||
PD_PDT_I,
|
||||
_PD_RSV_MAX
|
||||
};
|
||||
#define PD_MAX_IND (_TOM_RSV_MAX - 1)
|
||||
|
||||
static inline int pd_valid(u_int16_t pd)
|
||||
{
|
||||
if (pd >= F_TLV_PDAT && pd <= F_TLV_REST)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void chk_op_type(u_int16_t type, u_int16_t msk, u_int16_t omsk)
|
||||
{
|
||||
if (type != F_TLV_PDAT) {
|
||||
if (msk & B_KEYIN) {
|
||||
if (type != F_TLV_KEYI) {
|
||||
printf
|
||||
("Based on flags expected KEYINFO TLV!\n");
|
||||
}
|
||||
} else {
|
||||
if (!(msk & omsk)) {
|
||||
printf
|
||||
("Illegal DATA encoding for type 0x%x programmed %x got %x \n",
|
||||
type, omsk, msk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int fdatatlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int sdatailv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int sdatatlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int pdatatlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
int pkeyitlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
|
||||
int pdatacnt_print(register const u_char * pptr, register u_int len,
|
||||
u_int32_t IDcnt, u_int16_t op_msk, int indent);
|
||||
int pdata_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
|
||||
int prestlv_print(register const u_char * pptr, register u_int len,
|
||||
u_int16_t op_msk, int indent);
|
||||
#define F_SELKEY 1
|
||||
|
||||
struct res_val {
|
||||
u_int8_t result;
|
||||
u_int8_t resv1;
|
||||
u_int16_t resv2;
|
||||
};
|
||||
|
||||
static const struct pdata_ops ForCES_pdata[PD_MAX_IND + 1] = {
|
||||
/* PD_RSV_I */ {0, 0, 0, "Invalid message", NULL},
|
||||
/* PD_SEL_I */ {F_TLV_KEYI, 0, 0, "KEYINFO TLV", pkeyitlv_print},
|
||||
/* PD_FDT_I */ {F_TLV_FULD, 0, B_FULLD, "FULLDATA TLV", fdatatlv_print},
|
||||
/* PD_SDT_I */ {F_TLV_SPAD, 0, B_SPARD, "SPARSEDATA TLV", sdatatlv_print},
|
||||
/* PD_RES_I */ {F_TLV_REST, 0, B_RESTV, "RESULT TLV", prestlv_print},
|
||||
/* PD_PDT_I */
|
||||
{F_TLV_PDAT, 0, 0, "Inner PATH-DATA TLV", recpdoptlv_print},
|
||||
};
|
||||
|
||||
static inline const struct pdata_ops *get_forces_pd(u_int16_t pd)
|
||||
{
|
||||
int i;
|
||||
for (i = PD_RSV_I + 1; i <= PD_MAX_IND; i++) {
|
||||
const struct pdata_ops *pdo = &ForCES_pdata[i];
|
||||
if (pdo->v == pd)
|
||||
return pdo;
|
||||
}
|
||||
return &ForCES_pdata[TOM_RSV_I];
|
||||
}
|
||||
|
||||
enum {
|
||||
E_SUCCESS,
|
||||
E_INVALID_HEADER,
|
||||
E_LENGTH_MISMATCH,
|
||||
E_VERSION_MISMATCH,
|
||||
E_INVALID_DESTINATION_PID,
|
||||
E_LFB_UNKNOWN,
|
||||
E_LFB_NOT_FOUND,
|
||||
E_LFB_INSTANCE_ID_NOT_FOUND,
|
||||
E_INVALID_PATH,
|
||||
E_COMPONENT_DOES_NOT_EXIST,
|
||||
E_EXISTS,
|
||||
E_NOT_FOUND,
|
||||
E_READ_ONLY,
|
||||
E_INVALID_ARRAY_CREATION,
|
||||
E_VALUE_OUT_OF_RANGE,
|
||||
E_CONTENTS_TOO_LONG,
|
||||
E_INVALID_PARAMETERS,
|
||||
E_INVALID_MESSAGE_TYPE,
|
||||
E_INVALID_FLAGS,
|
||||
E_INVALID_TLV,
|
||||
E_EVENT_ERROR,
|
||||
E_NOT_SUPPORTED,
|
||||
E_MEMORY_ERROR,
|
||||
E_INTERNAL_ERROR,
|
||||
/* 0x18-0xFE are reserved .. */
|
||||
E_UNSPECIFIED_ERROR = 0XFF
|
||||
};
|
||||
|
||||
const struct tok ForCES_errs[] = {
|
||||
{E_SUCCESS, "SUCCESS"},
|
||||
{E_INVALID_HEADER, "INVALID HEADER"},
|
||||
{E_LENGTH_MISMATCH, "LENGTH MISMATCH"},
|
||||
{E_VERSION_MISMATCH, "VERSION MISMATCH"},
|
||||
{E_INVALID_DESTINATION_PID, "INVALID DESTINATION PID"},
|
||||
{E_LFB_UNKNOWN, "LFB UNKNOWN"},
|
||||
{E_LFB_NOT_FOUND, "LFB NOT FOUND"},
|
||||
{E_LFB_INSTANCE_ID_NOT_FOUND, "LFB INSTANCE ID NOT FOUND"},
|
||||
{E_INVALID_PATH, "INVALID PATH"},
|
||||
{E_COMPONENT_DOES_NOT_EXIST, "COMPONENT DOES NOT EXIST"},
|
||||
{E_EXISTS, "EXISTS ALREADY"},
|
||||
{E_NOT_FOUND, "NOT FOUND"},
|
||||
{E_READ_ONLY, "READ ONLY"},
|
||||
{E_INVALID_ARRAY_CREATION, "INVALID ARRAY CREATION"},
|
||||
{E_VALUE_OUT_OF_RANGE, "VALUE OUT OF RANGE"},
|
||||
{E_CONTENTS_TOO_LONG, "CONTENTS TOO LONG"},
|
||||
{E_INVALID_PARAMETERS, "INVALID PARAMETERS"},
|
||||
{E_INVALID_MESSAGE_TYPE, "INVALID MESSAGE TYPE"},
|
||||
{E_INVALID_FLAGS, "INVALID FLAGS"},
|
||||
{E_INVALID_TLV, "INVALID TLV"},
|
||||
{E_EVENT_ERROR, "EVENT ERROR"},
|
||||
{E_NOT_SUPPORTED, "NOT SUPPORTED"},
|
||||
{E_MEMORY_ERROR, "MEMORY ERROR"},
|
||||
{E_INTERNAL_ERROR, "INTERNAL ERROR"},
|
||||
{E_UNSPECIFIED_ERROR, "UNSPECIFIED ERROR"},
|
||||
{0, NULL}
|
||||
};
|
18
gmpls.c
18
gmpls.c
@ -28,7 +28,7 @@ static const char rcsid[] _U_ =
|
||||
#include "gmpls.h"
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_link_prot_values[] = {
|
||||
const struct tok gmpls_link_prot_values[] = {
|
||||
{ 0x01, "Extra Traffic"},
|
||||
{ 0x02, "Unprotected"},
|
||||
{ 0x04, "Shared"},
|
||||
@ -41,7 +41,7 @@ struct tok gmpls_link_prot_values[] = {
|
||||
};
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_switch_cap_values[] = {
|
||||
const struct tok gmpls_switch_cap_values[] = {
|
||||
{ GMPLS_PSC1, "Packet-Switch Capable-1"},
|
||||
{ GMPLS_PSC2, "Packet-Switch Capable-2"},
|
||||
{ GMPLS_PSC3, "Packet-Switch Capable-3"},
|
||||
@ -54,14 +54,14 @@ struct tok gmpls_switch_cap_values[] = {
|
||||
};
|
||||
|
||||
/* rfc4205 */
|
||||
struct tok gmpls_switch_cap_tsc_indication_values[] = {
|
||||
const struct tok gmpls_switch_cap_tsc_indication_values[] = {
|
||||
{ 0, "Standard SONET/SDH" },
|
||||
{ 1, "Arbitrary SONET/SDH" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_encoding_values[] = {
|
||||
const struct tok gmpls_encoding_values[] = {
|
||||
{ 1, "Packet"},
|
||||
{ 2, "Ethernet V2/DIX"},
|
||||
{ 3, "ANSI/ETSI PDH"},
|
||||
@ -77,7 +77,7 @@ struct tok gmpls_encoding_values[] = {
|
||||
};
|
||||
|
||||
/* rfc3471 */
|
||||
struct tok gmpls_payload_values[] = {
|
||||
const struct tok gmpls_payload_values[] = {
|
||||
{ 0, "Unknown"},
|
||||
{ 1, "Reserved"},
|
||||
{ 2, "Reserved"},
|
||||
@ -145,7 +145,7 @@ struct tok gmpls_payload_values[] = {
|
||||
* Link Type values used by LMP Service Discovery (specifically, the Client
|
||||
* Port Service Attributes Object). See UNI 1.0 section 9.4.2 for details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
|
||||
const struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
|
||||
{ 5, "SDH ITU-T G.707"},
|
||||
{ 6, "SONET ANSI T1.105"},
|
||||
{ 0, NULL}
|
||||
@ -156,7 +156,7 @@ struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
|
||||
* the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
|
||||
* details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
|
||||
const struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
|
||||
{ 5, "VC-3"},
|
||||
{ 6, "VC-4"},
|
||||
{ 7, "STM-0"},
|
||||
@ -173,7 +173,7 @@ struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
|
||||
* the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
|
||||
* details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
|
||||
const struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
|
||||
{ 5, "STS-1 SPE"},
|
||||
{ 6, "STS-3c SPE"},
|
||||
{ 7, "STS-1"},
|
||||
@ -189,7 +189,7 @@ struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
|
||||
#define DIFFSERV_BC_MODEL_MAM 1 /* draft-ietf-tewg-diff-te-proto-07 */
|
||||
#define DIFFSERV_BC_MODEL_EXTD_MAM 254 /* experimental */
|
||||
|
||||
struct tok diffserv_te_bc_values[] = {
|
||||
const struct tok diffserv_te_bc_values[] = {
|
||||
{ DIFFSERV_BC_MODEL_RDM, "Russian dolls"},
|
||||
{ DIFFSERV_BC_MODEL_MAM, "Maximum allocation"},
|
||||
{ DIFFSERV_BC_MODEL_EXTD_MAM, "Maximum allocation with E-LSP support"},
|
||||
|
18
gmpls.h
18
gmpls.h
@ -23,12 +23,12 @@
|
||||
#define GMPLS_LSC 150
|
||||
#define GMPLS_FSC 200
|
||||
|
||||
extern struct tok gmpls_link_prot_values[];
|
||||
extern struct tok gmpls_switch_cap_values[];
|
||||
extern struct tok gmpls_switch_cap_tsc_indication_values[];
|
||||
extern struct tok gmpls_encoding_values[];
|
||||
extern struct tok gmpls_payload_values[];
|
||||
extern struct tok diffserv_te_bc_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_link_type_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[];
|
||||
extern const struct tok gmpls_link_prot_values[];
|
||||
extern const struct tok gmpls_switch_cap_values[];
|
||||
extern const struct tok gmpls_switch_cap_tsc_indication_values[];
|
||||
extern const struct tok gmpls_encoding_values[];
|
||||
extern const struct tok gmpls_payload_values[];
|
||||
extern const struct tok diffserv_te_bc_values[];
|
||||
extern const struct tok lmp_sd_service_config_cpsa_link_type_values[];
|
||||
extern const struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[];
|
||||
extern const struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[];
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/gmt2local.h,v 1.2.1.1 1999-10-07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/gmt2local.h,v 1.2 1999-10-07 23:47:10 mcr Exp $ (LBL)
|
||||
*/
|
||||
#ifndef gmt2local_h
|
||||
#define gmt2local_h
|
||||
|
10
icmp6.h
10
icmp6.h
@ -276,7 +276,7 @@ struct nd_opt_hdr { /* Neighbor discovery option header */
|
||||
#define ND_OPT_ADVINTERVAL 7
|
||||
#define ND_OPT_HOMEAGENT_INFO 8
|
||||
#define ND_OPT_ROUTE_INFO 9 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */
|
||||
|
||||
#define ND_OPT_RDNSS 25
|
||||
|
||||
struct nd_opt_prefix_info { /* prefix information */
|
||||
u_int8_t nd_opt_pi_type;
|
||||
@ -308,6 +308,14 @@ struct nd_opt_mtu { /* MTU option */
|
||||
u_int32_t nd_opt_mtu_mtu;
|
||||
};
|
||||
|
||||
struct nd_opt_rdnss { /* RDNSS RFC 5006 */
|
||||
u_int8_t nd_opt_rdnss_type;
|
||||
u_int8_t nd_opt_rdnss_len;
|
||||
u_int16_t nd_opt_rdnss_reserved;
|
||||
u_int32_t nd_opt_rdnss_lifetime;
|
||||
struct in6_addr nd_opt_rdnss_addr[1]; /* variable-length */
|
||||
};
|
||||
|
||||
struct nd_opt_advinterval { /* Advertisement interval option */
|
||||
u_int8_t nd_opt_adv_type;
|
||||
u_int8_t nd_opt_adv_len;
|
||||
|
58
ieee802_11.h
58
ieee802_11.h
@ -30,6 +30,7 @@
|
||||
#define IEEE802_11_RA_LEN 6
|
||||
#define IEEE802_11_TA_LEN 6
|
||||
#define IEEE802_11_SEQ_LEN 2
|
||||
#define IEEE802_11_CTL_LEN 2
|
||||
#define IEEE802_11_IV_LEN 3
|
||||
#define IEEE802_11_KID_LEN 1
|
||||
|
||||
@ -67,11 +68,14 @@
|
||||
#define ST_DISASSOC 0xA
|
||||
#define ST_AUTH 0xB
|
||||
#define ST_DEAUTH 0xC
|
||||
/* RESERVED 0xD */
|
||||
#define ST_ACTION 0xD
|
||||
/* RESERVED 0xE */
|
||||
/* RESERVED 0xF */
|
||||
|
||||
|
||||
#define CTRL_CONTROL_WRAPPER 0x7
|
||||
#define CTRL_BAR 0x8
|
||||
#define CTRL_BA 0x9
|
||||
#define CTRL_PS_POLL 0xA
|
||||
#define CTRL_RTS 0xB
|
||||
#define CTRL_CTS 0xC
|
||||
@ -140,12 +144,6 @@ struct mgmt_header_t {
|
||||
#define CAPABILITY_CFP_REQ(cap) ((cap) & 0x0008)
|
||||
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
|
||||
|
||||
typedef enum {
|
||||
NOT_PRESENT,
|
||||
PRESENT,
|
||||
TRUNCATED
|
||||
} elem_status_t;
|
||||
|
||||
struct ssid_t {
|
||||
u_int8_t element_id;
|
||||
u_int8_t length;
|
||||
@ -233,20 +231,20 @@ struct mgmt_body_t {
|
||||
u_int16_t reason_code;
|
||||
u_int16_t auth_alg;
|
||||
u_int16_t auth_trans_seq_num;
|
||||
elem_status_t challenge_status;
|
||||
int challenge_present;
|
||||
struct challenge_t challenge;
|
||||
u_int16_t capability_info;
|
||||
elem_status_t ssid_status;
|
||||
int ssid_present;
|
||||
struct ssid_t ssid;
|
||||
elem_status_t rates_status;
|
||||
int rates_present;
|
||||
struct rates_t rates;
|
||||
elem_status_t ds_status;
|
||||
int ds_present;
|
||||
struct ds_t ds;
|
||||
elem_status_t cf_status;
|
||||
int cf_present;
|
||||
struct cf_t cf;
|
||||
elem_status_t fh_status;
|
||||
int fh_present;
|
||||
struct fh_t fh;
|
||||
elem_status_t tim_status;
|
||||
int tim_present;
|
||||
struct tim_t tim;
|
||||
};
|
||||
|
||||
@ -312,6 +310,38 @@ struct ctrl_end_ack_t {
|
||||
#define CTRL_END_ACK_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_RA_LEN+IEEE802_11_BSSID_LEN)
|
||||
|
||||
struct ctrl_ba_t {
|
||||
u_int16_t fc;
|
||||
u_int16_t duration;
|
||||
u_int8_t ra[6];
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_BA_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
|
||||
|
||||
struct ctrl_bar_t {
|
||||
u_int16_t fc;
|
||||
u_int16_t dur;
|
||||
u_int8_t ra[6];
|
||||
u_int8_t ta[6];
|
||||
u_int16_t ctl;
|
||||
u_int16_t seq;
|
||||
u_int8_t fcs[4];
|
||||
};
|
||||
|
||||
#define CTRL_BAR_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
|
||||
IEEE802_11_RA_LEN+IEEE802_11_TA_LEN+\
|
||||
IEEE802_11_CTL_LEN+IEEE802_11_SEQ_LEN)
|
||||
|
||||
struct meshcntl_t {
|
||||
u_int8_t flags;
|
||||
u_int8_t ttl;
|
||||
u_int8_t seq[4];
|
||||
u_int8_t addr4[6];
|
||||
u_int8_t addr5[6];
|
||||
u_int8_t addr6[6];
|
||||
};
|
||||
|
||||
#define IV_IV(iv) ((iv) & 0xFFFFFF)
|
||||
#define IV_PAD(iv) (((iv) >> 24) & 0x3F)
|
||||
#define IV_KEYID(iv) (((iv) >> 30) & 0x03)
|
||||
|
@ -33,11 +33,11 @@
|
||||
#ifndef _NET_IF_IEEE80211RADIOTAP_H_
|
||||
#define _NET_IF_IEEE80211RADIOTAP_H_
|
||||
|
||||
/* A generic radio capture format is desirable. There is one for
|
||||
* Linux, but it is neither rigidly defined (there were not even
|
||||
* units given for some fields) nor easily extensible.
|
||||
/* A generic radio capture format is desirable. It must be
|
||||
* rigidly defined (e.g., units for fields should be given),
|
||||
* and easily extensible.
|
||||
*
|
||||
* I suggest the following extensible radio capture format. It is
|
||||
* The following is an extensible radio capture format. It is
|
||||
* based on a bitmap indicating which fields are present.
|
||||
*
|
||||
* I am trying to describe precisely what the application programmer
|
||||
@ -47,13 +47,12 @@
|
||||
* function of...") that I cannot set false expectations for lawyerly
|
||||
* readers.
|
||||
*/
|
||||
#if defined(__KERNEL__) || defined(_KERNEL)
|
||||
#ifndef DLT_IEEE802_11_RADIO
|
||||
#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus WLAN header */
|
||||
#endif
|
||||
#endif /* defined(__KERNEL__) || defined(_KERNEL) */
|
||||
|
||||
/* The radio capture header precedes the 802.11 header. */
|
||||
/*
|
||||
* The radio capture header precedes the 802.11 header.
|
||||
*
|
||||
* Note well: all radiotap fields are little-endian.
|
||||
*/
|
||||
struct ieee80211_radiotap_header {
|
||||
u_int8_t it_version; /* Version 0. Only increases
|
||||
* for drastic changes,
|
||||
@ -73,7 +72,7 @@ struct ieee80211_radiotap_header {
|
||||
* Additional extensions are made
|
||||
* by setting bit 31.
|
||||
*/
|
||||
} __attribute__((__packed__));
|
||||
};
|
||||
|
||||
/* Name Data type Units
|
||||
* ---- --------- -----
|
||||
@ -87,15 +86,19 @@ struct ieee80211_radiotap_header {
|
||||
* IEEE80211_RADIOTAP_CHANNEL 2 x u_int16_t MHz, bitmap
|
||||
*
|
||||
* Tx/Rx frequency in MHz, followed by flags (see below).
|
||||
* Note that IEEE80211_RADIOTAP_XCHANNEL must be used to
|
||||
* represent an HT channel as there is not enough room in
|
||||
* the flags word.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_FHSS u_int16_t see below
|
||||
*
|
||||
* For frequency-hopping radios, the hop set (first byte)
|
||||
* and pattern (second byte).
|
||||
*
|
||||
* IEEE80211_RADIOTAP_RATE u_int8_t 500kb/s
|
||||
* IEEE80211_RADIOTAP_RATE u_int8_t 500kb/s or index
|
||||
*
|
||||
* Tx/Rx data rate
|
||||
* Tx/Rx data rate. If bit 0x80 is set then it represents an
|
||||
* an MCS index and not an IEEE rate.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from
|
||||
* one milliwatt (dBm)
|
||||
@ -155,9 +158,16 @@ struct ieee80211_radiotap_header {
|
||||
* Unitless indication of the Rx/Tx antenna for this packet.
|
||||
* The first antenna is antenna 0.
|
||||
*
|
||||
* IEEE80211_RADIOTAP_FCS u_int32_t data
|
||||
* IEEE80211_RADIOTAP_XCHANNEL u_int32_t bitmap
|
||||
* u_int16_t MHz
|
||||
* u_int8_t channel number
|
||||
* u_int8_t .5 dBm
|
||||
*
|
||||
* FCS from frame in network byte order.
|
||||
* Extended channel specification: flags (see below) followed by
|
||||
* frequency in MHz, the corresponding IEEE channel number, and
|
||||
* finally the maximum regulatory transmit power cap in .5 dBm
|
||||
* units. This property supersedes IEEE80211_RADIOTAP_CHANNEL
|
||||
* and only one of the two should be present.
|
||||
*/
|
||||
enum ieee80211_radiotap_type {
|
||||
IEEE80211_RADIOTAP_TSFT = 0,
|
||||
@ -174,20 +184,27 @@ enum ieee80211_radiotap_type {
|
||||
IEEE80211_RADIOTAP_ANTENNA = 11,
|
||||
IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
|
||||
IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
|
||||
/* NB: gap for netbsd definitions */
|
||||
IEEE80211_RADIOTAP_XCHANNEL = 18,
|
||||
IEEE80211_RADIOTAP_EXT = 31
|
||||
};
|
||||
|
||||
#ifndef _KERNEL
|
||||
/* Channel flags. */
|
||||
#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */
|
||||
#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */
|
||||
#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */
|
||||
#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */
|
||||
#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */
|
||||
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
|
||||
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
|
||||
#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
|
||||
#endif /* !_KERNEL */
|
||||
/* channel attributes */
|
||||
#define IEEE80211_CHAN_TURBO 0x00010 /* Turbo channel */
|
||||
#define IEEE80211_CHAN_CCK 0x00020 /* CCK channel */
|
||||
#define IEEE80211_CHAN_OFDM 0x00040 /* OFDM channel */
|
||||
#define IEEE80211_CHAN_2GHZ 0x00080 /* 2 GHz spectrum channel. */
|
||||
#define IEEE80211_CHAN_5GHZ 0x00100 /* 5 GHz spectrum channel */
|
||||
#define IEEE80211_CHAN_PASSIVE 0x00200 /* Only passive scan allowed */
|
||||
#define IEEE80211_CHAN_DYN 0x00400 /* Dynamic CCK-OFDM channel */
|
||||
#define IEEE80211_CHAN_GFSK 0x00800 /* GFSK channel (FHSS PHY) */
|
||||
#define IEEE80211_CHAN_GSM 0x01000 /* 900 MHz spectrum channel */
|
||||
#define IEEE80211_CHAN_STURBO 0x02000 /* 11a static turbo channel only */
|
||||
#define IEEE80211_CHAN_HALF 0x04000 /* Half rate channel */
|
||||
#define IEEE80211_CHAN_QUARTER 0x08000 /* Quarter rate channel */
|
||||
#define IEEE80211_CHAN_HT20 0x10000 /* HT 20 channel */
|
||||
#define IEEE80211_CHAN_HT40U 0x20000 /* HT 40 channel w/ ext above */
|
||||
#define IEEE80211_CHAN_HT40D 0x40000 /* HT 40 channel w/ ext below */
|
||||
|
||||
/* For IEEE80211_RADIOTAP_FLAGS */
|
||||
#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
|
||||
@ -209,5 +226,6 @@ enum ieee80211_radiotap_type {
|
||||
* (to 32-bit boundary)
|
||||
*/
|
||||
#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* does not pass FCS check */
|
||||
#define IEEE80211_RADIOTAP_F_SHORTGI 0x80 /* HT short GI */
|
||||
|
||||
#endif /* _NET_IF_IEEE80211RADIOTAP_H_ */
|
||||
|
37
interface.h
37
interface.h
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.280.2.4 2008-04-04 19:42:52 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.285 2008-08-16 11:36:20 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -82,21 +82,6 @@ extern char *strsep(char **, const char *);
|
||||
#define max(a,b) ((b)>(a)?(b):(a))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The default snapshot length. This value allows most printers to print
|
||||
* useful information while keeping the amount of unwanted data down.
|
||||
*/
|
||||
#ifndef INET6
|
||||
#define DEFAULT_SNAPLEN 68 /* ether + IPv4 + TCP + 14 */
|
||||
#else
|
||||
#define DEFAULT_SNAPLEN 96 /* ether + IPv6 + TCP + 22 */
|
||||
#endif
|
||||
|
||||
#ifndef BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
|
||||
#define ESRC(ep) ((ep)->ether_shost)
|
||||
#define EDST(ep) ((ep)->ether_dhost)
|
||||
|
||||
@ -181,10 +166,10 @@ extern void hex_and_ascii_print(const char *, const u_char *, u_int);
|
||||
extern void hex_print_with_offset(const char *, const u_char *, u_int, u_int);
|
||||
extern void hex_print(const char *, const u_char *, u_int);
|
||||
extern void telnet_print(const u_char *, u_int);
|
||||
extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
|
||||
extern int ethertype_print(u_short, const u_char *, u_int, u_int);
|
||||
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_int);
|
||||
extern int snap_print(const u_char *, u_int, u_int, u_int);
|
||||
extern void aarp_print(const u_char *, u_int);
|
||||
extern void aodv_print(const u_char *, u_int, int);
|
||||
extern void atalk_print(const u_char *, u_int);
|
||||
@ -204,7 +189,8 @@ 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 void ether_print(const u_char *, u_int, u_int,
|
||||
void (*)(const u_char *), const u_char *);
|
||||
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 *);
|
||||
@ -239,7 +225,7 @@ extern void ns_print(const u_char *, u_int, int);
|
||||
extern void ntp_print(const u_char *, u_int);
|
||||
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 olsr_print (const u_char *, u_int);
|
||||
extern void olsr_print (const u_char *, u_int, int);
|
||||
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);
|
||||
@ -251,7 +237,7 @@ extern void lwapp_control_print(const u_char *, u_int, int);
|
||||
extern void lwapp_data_print(const u_char *, u_int);
|
||||
extern void eigrp_print(const u_char *, u_int);
|
||||
extern void mobile_print(const u_char *, u_int);
|
||||
extern void pim_print(const u_char *, u_int);
|
||||
extern void pim_print(const u_char *, u_int, u_int);
|
||||
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 *);
|
||||
@ -324,6 +310,7 @@ extern void lwres_print(const u_char *, u_int);
|
||||
extern void pptp_print(const u_char *);
|
||||
extern void dccp_print(const u_char *, const u_char *, u_int);
|
||||
extern void sctp_print(const u_char *, const u_char *, u_int);
|
||||
extern void forces_print(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);
|
||||
@ -332,19 +319,22 @@ extern void bfd_print(const u_char *, u_int, u_int);
|
||||
extern void sip_print(const u_char *, u_int);
|
||||
extern void syslog_print(const u_char *, u_int);
|
||||
extern u_int bt_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int usb_linux_48_byte_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int usb_linux_64_byte_print(const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
#ifdef INET6
|
||||
extern void ip6_print(const u_char *, u_int);
|
||||
extern void ip6_opt_print(const u_char *, int);
|
||||
extern int nextproto6_cksum(const struct ip6_hdr *, const u_short *, u_int, u_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 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);
|
||||
extern int mask62plen(const u_char *);
|
||||
#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);
|
||||
@ -363,6 +353,7 @@ extern void bpf_dump(const struct bpf_program *, int);
|
||||
#ifndef NETDISSECT_REWORKED
|
||||
extern netdissect_options *gndo;
|
||||
|
||||
#define bflag gndo->ndo_bflag
|
||||
#define eflag gndo->ndo_eflag
|
||||
#define fflag gndo->ndo_fflag
|
||||
#define Kflag gndo->ndo_Kflag
|
||||
@ -387,7 +378,7 @@ extern netdissect_options *gndo;
|
||||
#define Iflag gndo->ndo_Iflag
|
||||
#define suppress_default_print gndo->ndo_suppress_default_print
|
||||
#define packettype gndo->ndo_packettype
|
||||
#define tcpmd5secret gndo->ndo_tcpmd5secret
|
||||
#define sigsecret gndo->ndo_sigsecret
|
||||
#define Wflag gndo->ndo_Wflag
|
||||
#define WflagChars gndo->ndo_WflagChars
|
||||
#define Cflag_count gndo->ndo_Cflag_count
|
||||
|
14
ip6.h
14
ip6.h
@ -88,6 +88,20 @@ struct ip6_hdr {
|
||||
struct in6_addr ip6_dst; /* destination address */
|
||||
};
|
||||
|
||||
/*
|
||||
* Pseudo header, used for higher layer checksumming.
|
||||
*/
|
||||
union ip6_pseudo_hdr {
|
||||
struct {
|
||||
struct in6_addr ph_src;
|
||||
struct in6_addr ph_dst;
|
||||
u_int32_t ph_len;
|
||||
u_int8_t ph_zero[3];
|
||||
u_int8_t ph_nxt;
|
||||
} ph;
|
||||
u_int16_t pa[20];
|
||||
};
|
||||
|
||||
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
|
||||
#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
|
||||
#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
|
||||
|
13
ipnet.h
Normal file
13
ipnet.h
Normal file
@ -0,0 +1,13 @@
|
||||
typedef struct ipnet_hdr {
|
||||
uint8_t iph_version;
|
||||
uint8_t iph_family;
|
||||
uint16_t iph_htype;
|
||||
uint32_t iph_pktlen;
|
||||
uint32_t iph_ifindex;
|
||||
uint32_t iph_grifindex;
|
||||
uint32_t iph_zsrc;
|
||||
uint32_t iph_zdst;
|
||||
} ipnet_hdr_t;
|
||||
|
||||
#define IPH_AF_INET 2 /* Matches Solaris's AF_INET */
|
||||
#define IPH_AF_INET6 26 /* Matches Solaris's AF_INET6 */
|
@ -27,7 +27,7 @@ static const char rcsid[] _U_ =
|
||||
#include "interface.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
struct tok ipproto_values[] = {
|
||||
const struct tok ipproto_values[] = {
|
||||
{ IPPROTO_HOPOPTS, "Options" },
|
||||
{ IPPROTO_ICMP, "ICMP" },
|
||||
{ IPPROTO_IGMP, "IGMP" },
|
||||
|
@ -37,7 +37,7 @@
|
||||
* $FreeBSD: src/sys/netinet/in.h,v 1.38.2.3 1999/08/29 16:29:34 peter Exp $
|
||||
*/
|
||||
|
||||
extern struct tok ipproto_values[];
|
||||
extern const struct tok ipproto_values[];
|
||||
|
||||
#ifndef IPPROTO_IP
|
||||
#define IPPROTO_IP 0 /* dummy for IP */
|
||||
|
24
isakmp.h
24
isakmp.h
@ -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.11 2007-08-29 02:38:14 mcr Exp $ */
|
||||
/* YIPS @(#)$Id: isakmp.h,v 1.12 2007-11-24 18:13:33 mcr Exp $ */
|
||||
|
||||
/* refer to RFC 2408 */
|
||||
|
||||
@ -127,6 +127,7 @@ struct isakmp {
|
||||
#define ISAKMP_NPTYPE_N 11 /* Notification */
|
||||
#define ISAKMP_NPTYPE_D 12 /* Delete */
|
||||
#define ISAKMP_NPTYPE_VID 13 /* Vendor ID */
|
||||
#define ISAKMP_NPTYPE_v2E 46 /* v2 Encrypted payload */
|
||||
|
||||
#define IKEv1_MAJOR_VERSION 1
|
||||
#define IKEv1_MINOR_VERSION 0
|
||||
@ -422,14 +423,31 @@ struct ikev2_ke {
|
||||
};
|
||||
|
||||
|
||||
/* 3.5. Identification Payloads */
|
||||
enum ikev2_id_type {
|
||||
ID_IPV4_ADDR=1,
|
||||
ID_FQDN=2,
|
||||
ID_RFC822_ADDR=3,
|
||||
ID_IPV6_ADDR=5,
|
||||
ID_DER_ASN1_DN=9,
|
||||
ID_DER_ASN1_GN=10,
|
||||
ID_KEY_ID=11,
|
||||
};
|
||||
struct ikev2_id {
|
||||
struct isakmp_gen h;
|
||||
u_int8_t type; /* ID type */
|
||||
u_int8_t res1;
|
||||
u_int16_t res2;
|
||||
/* SPI */
|
||||
/* Notification Data */
|
||||
};
|
||||
|
||||
/* 3.10 Notification Payload */
|
||||
struct ikev2_n {
|
||||
struct isakmp_gen h;
|
||||
u_int8_t prot_id; /* Protocol-ID */
|
||||
u_int8_t spi_size; /* SPI Size */
|
||||
u_int16_t type; /* Notify Message Type */
|
||||
/* SPI */
|
||||
/* Notification Data */
|
||||
};
|
||||
|
||||
enum ikev2_n_type {
|
||||
|
2
l2vpn.c
2
l2vpn.c
@ -27,7 +27,7 @@ static const char rcsid[] _U_ =
|
||||
#include "l2vpn.h"
|
||||
|
||||
/* draft-ietf-pwe3-iana-allocation-04 */
|
||||
struct tok l2vpn_encaps_values[] = {
|
||||
const struct tok l2vpn_encaps_values[] = {
|
||||
{ 0x00, "Reserved"},
|
||||
{ 0x01, "Frame Relay"},
|
||||
{ 0x02, "ATM AAL5 VCC transport"},
|
||||
|
2
l2vpn.h
2
l2vpn.h
@ -14,4 +14,4 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
extern struct tok l2vpn_encaps_values[];
|
||||
extern const struct tok l2vpn_encaps_values[];
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-sunos4.h,v 1.32.1.1 1999-10-07 23:47:13 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-sunos4.h,v 1.32 1999-10-07 23:47:13 mcr Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Prototypes missing in SunOS 4 */
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-ultrix4.h,v 1.19.1.1 1999-10-07 23:47:13 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-ultrix4.h,v 1.19 1999-10-07 23:47:13 mcr Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Prototypes missing in Ultrix 4 */
|
||||
|
@ -81,9 +81,6 @@ struct addrinfo {
|
||||
|
||||
extern void freeaddrinfo (struct addrinfo *);
|
||||
extern void freehostent (struct hostent *);
|
||||
extern char *gai_strerror (int);
|
||||
extern int getaddrinfo (const char *, const char *,
|
||||
const struct addrinfo *, struct addrinfo **);
|
||||
extern int getnameinfo (const struct sockaddr *, size_t, char *,
|
||||
size_t, char *, size_t, int);
|
||||
extern struct hostent *getipnodebyaddr (const void *, size_t, int, int *);
|
||||
|
File diff suppressed because it is too large
Load Diff
68
netdissect.h
68
netdissect.h
@ -21,7 +21,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.23.2.2 2008-04-04 19:42:52 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/netdissect.h,v 1.27 2008-08-16 11:36:20 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef netdissect_h
|
||||
@ -84,6 +84,7 @@ typedef struct netdissect_options netdissect_options;
|
||||
|
||||
struct netdissect_options {
|
||||
int ndo_aflag; /* translate network and broadcast addresses */
|
||||
int ndo_bflag; /* print 4 byte ASes in ASDOT notation */
|
||||
int ndo_eflag; /* print ethernet header */
|
||||
int ndo_fflag; /* don't translate "foreign" IP address */
|
||||
int ndo_Kflag; /* don't check TCP checksums */
|
||||
@ -122,7 +123,7 @@ struct netdissect_options {
|
||||
struct sa_list *ndo_sa_list_head; /* used by print-esp.c */
|
||||
struct sa_list *ndo_sa_default;
|
||||
|
||||
char *ndo_tcpmd5secret; /* TCP-MD5 secret key */
|
||||
char *ndo_sigsecret; /* Signature verification secret key */
|
||||
|
||||
struct esp_algorithm *ndo_espsecret_xform; /* cache of decoded */
|
||||
char *ndo_espsecret_key;
|
||||
@ -148,11 +149,23 @@ struct netdissect_options {
|
||||
void (*ndo_info)(netdissect_options *, int verbose);
|
||||
|
||||
int (*ndo_printf)(netdissect_options *,
|
||||
const char *fmt, ...);
|
||||
const char *fmt, ...)
|
||||
#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
void (*ndo_error)(netdissect_options *,
|
||||
const char *fmt, ...);
|
||||
const char *fmt, ...)
|
||||
#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
void (*ndo_warning)(netdissect_options *,
|
||||
const char *fmt, ...);
|
||||
const char *fmt, ...)
|
||||
#ifdef __ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
;
|
||||
};
|
||||
|
||||
#define PT_VAT 1 /* Visual Audio Tool */
|
||||
@ -170,22 +183,21 @@ struct netdissect_options {
|
||||
#define max(a,b) ((b)>(a)?(b):(a))
|
||||
#endif
|
||||
|
||||
#ifndef INET6
|
||||
/*
|
||||
* The default snapshot length. This value allows most printers to print
|
||||
* useful information while keeping the amount of unwanted data down.
|
||||
* In particular, it allows for an ethernet header, tcp/ip header, and
|
||||
* 14 bytes of data (assuming no ip options).
|
||||
* Maximum snapshot length. This should be enough to capture the full
|
||||
* packet on most network interfaces.
|
||||
*
|
||||
* XXX - could it be larger? If so, should it? Some applications might
|
||||
* use the snapshot length in a savefile header to control the size of
|
||||
* the buffer they allocate, so a size of, say, 2^31-1 might not work
|
||||
* well.
|
||||
*/
|
||||
#define DEFAULT_SNAPLEN 68
|
||||
#else
|
||||
#define DEFAULT_SNAPLEN 96
|
||||
#endif
|
||||
#define MAXIMUM_SNAPLEN 65535
|
||||
|
||||
#ifndef BIG_ENDIAN
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
/*
|
||||
* The default snapshot length is the maximum.
|
||||
*/
|
||||
#define DEFAULT_SNAPLEN MAXIMUM_SNAPLEN
|
||||
|
||||
#define ESRC(ep) ((ep)->ether_shost)
|
||||
#define EDST(ep) ((ep)->ether_dhost)
|
||||
@ -257,6 +269,8 @@ extern int esp_print(netdissect_options *,
|
||||
register const u_char *bp, int len, register const u_char *bp2,
|
||||
int *nhdr, int *padlen);
|
||||
extern void arp_print(netdissect_options *,const u_char *, u_int, u_int);
|
||||
extern void icmp6_print(netdissect_options *ndo, const u_char *,
|
||||
u_int, const u_char *, int);
|
||||
extern void isakmp_print(netdissect_options *,const u_char *,
|
||||
u_int, const u_char *);
|
||||
extern void isakmp_rfc3948_print(netdissect_options *,const u_char *,
|
||||
@ -277,8 +291,8 @@ extern void hex_print_with_offset(netdissect_options *,const char *,
|
||||
u_int, u_int);
|
||||
extern void hex_print(netdissect_options *,const char *, u_int);
|
||||
extern void telnet_print(netdissect_options *,const u_char *, u_int);
|
||||
extern int ether_encap_print(netdissect_options *,u_short, const u_char *,
|
||||
u_int, u_int, u_short *);
|
||||
extern int ethertype_print(netdissect_options *,u_short, const u_char *,
|
||||
u_int, u_int);
|
||||
extern int llc_print(netdissect_options *,
|
||||
const u_char *, u_int, u_int, const u_char *,
|
||||
const u_char *, u_short *);
|
||||
@ -345,7 +359,7 @@ extern void ospf_print(netdissect_options *,const u_char *,
|
||||
u_int, const u_char *);
|
||||
extern void pimv1_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void mobile_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void pim_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void pim_print(netdissect_options *,const u_char *, u_int, u_int);
|
||||
extern void pppoe_if_print(u_char *,const struct pcap_pkthdr *, const u_char *);
|
||||
extern void pppoe_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void ppp_print(netdissect_options *,
|
||||
@ -416,10 +430,15 @@ extern void stp_print(netdissect_options *,const u_char *p, u_int length);
|
||||
extern void radius_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void lwres_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void pptp_print(netdissect_options *,const u_char *, u_int);
|
||||
#endif
|
||||
|
||||
extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
|
||||
|
||||
#if 0
|
||||
#ifdef INET6
|
||||
extern void ip6_print(netdissect_options *,const u_char *, u_int);
|
||||
extern void ip6_opt_print(netdissect_options *,const u_char *, int);
|
||||
extern int nextproto6_cksum(const struct ip6_hdr *, const u_short *, u_int, u_int);
|
||||
extern int hbhopt_print(netdissect_options *,const u_char *);
|
||||
extern int dstopt_print(netdissect_options *,const u_char *);
|
||||
extern int frag6_print(netdissect_options *,const u_char *,
|
||||
@ -441,4 +460,11 @@ extern u_short in_cksum(const u_short *,
|
||||
|
||||
#endif
|
||||
|
||||
extern void esp_print_decodesecret(netdissect_options *ndo);
|
||||
extern int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
|
||||
int initiator,
|
||||
u_char spii[8], u_char spir[8],
|
||||
u_char *buf, u_char *end);
|
||||
|
||||
|
||||
#endif /* netdissect_h */
|
||||
|
3
nfs.h
3
nfs.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/nfs.h,v 1.8.2.1 2007-11-18 03:24:55 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/nfs.h,v 1.9 2007-11-18 03:24:38 guy Exp $ (LBL) */
|
||||
/* NetBSD: nfs.h,v 1.1 1996/05/23 22:49:53 fvdl Exp */
|
||||
|
||||
/*
|
||||
@ -215,6 +215,7 @@
|
||||
#define NFSV3ACCESS_EXTEND 0x08
|
||||
#define NFSV3ACCESS_DELETE 0x10
|
||||
#define NFSV3ACCESS_EXECUTE 0x20
|
||||
#define NFSV3ACCESS_FULL 0x3f
|
||||
|
||||
#define NFSV3WRITE_UNSTABLE 0
|
||||
#define NFSV3WRITE_DATASYNC 1
|
||||
|
2
nlpid.c
2
nlpid.c
@ -26,7 +26,7 @@ static const char rcsid[] _U_ =
|
||||
#include "interface.h"
|
||||
#include "nlpid.h"
|
||||
|
||||
struct tok nlpid_values[] = {
|
||||
const struct tok nlpid_values[] = {
|
||||
{ NLPID_NULLNS, "NULL" },
|
||||
{ NLPID_Q933, "Q.933" },
|
||||
{ NLPID_LMI, "LMI" },
|
||||
|
2
nlpid.h
2
nlpid.h
@ -14,7 +14,7 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
extern struct tok nlpid_values[];
|
||||
extern const struct tok nlpid_values[];
|
||||
|
||||
#define NLPID_NULLNS 0x00
|
||||
#define NLPID_Q933 0x08 /* ANSI T1.617 Annex D or ITU-T Q.933 Annex A */
|
||||
|
6
oui.c
6
oui.c
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.8.2.1 2008-01-09 09:44:39 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.9 2008-01-09 09:40:47 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -28,7 +28,7 @@ static const char rcsid[] _U_ =
|
||||
|
||||
/* FIXME complete OUI list using a script */
|
||||
|
||||
struct tok oui_values[] = {
|
||||
const struct tok oui_values[] = {
|
||||
{ OUI_ENCAP_ETHER, "Ethernet" },
|
||||
{ OUI_CISCO, "Cisco" },
|
||||
{ OUI_NORTEL, "Nortel Networks SONMP" },
|
||||
@ -55,7 +55,7 @@ struct tok oui_values[] = {
|
||||
*
|
||||
* List taken from Ethereal's epan/sminmpec.c.
|
||||
*/
|
||||
struct tok smi_values[] = {
|
||||
const struct tok smi_values[] = {
|
||||
{ SMI_IETF, "IETF (reserved)"},
|
||||
{ SMI_ACC, "ACC"},
|
||||
{ SMI_CISCO, "Cisco"},
|
||||
|
6
oui.h
6
oui.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.7.2.1 2008-01-09 09:44:39 hannes Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.8 2008-01-09 09:40:47 hannes Exp $ (LBL) */
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
@ -14,8 +14,8 @@
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
*/
|
||||
|
||||
extern struct tok oui_values[];
|
||||
extern struct tok smi_values[];
|
||||
extern const struct tok oui_values[];
|
||||
extern const struct tok smi_values[];
|
||||
|
||||
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
|
||||
#define OUI_CISCO 0x00000c /* Cisco protocols */
|
||||
|
915
print-802_11.c
915
print-802_11.c
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@ static const char rcsid[] _U_ =
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
@ -57,18 +58,21 @@ static inline void
|
||||
ap1394_hdr_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
register const struct firewire_header *fp;
|
||||
u_int16_t firewire_type;
|
||||
|
||||
fp = (const struct firewire_header *)bp;
|
||||
|
||||
(void)printf("%s > %s",
|
||||
linkaddr_string(fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN),
|
||||
linkaddr_string(fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN));
|
||||
|
||||
firewire_type = EXTRACT_16BITS(&fp->firewire_type);
|
||||
if (!qflag) {
|
||||
(void)printf(", ethertype %s (0x%04x)",
|
||||
tok2str(ethertype_values,"Unknown", ntohs(fp->firewire_type)),
|
||||
ntohs(fp->firewire_type));
|
||||
tok2str(ethertype_values,"Unknown", firewire_type),
|
||||
firewire_type);
|
||||
} else {
|
||||
(void)printf(", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ntohs(fp->firewire_type)));
|
||||
(void)printf(", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", firewire_type));
|
||||
}
|
||||
|
||||
(void)printf(", length %u: ", length);
|
||||
@ -87,7 +91,6 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
u_int caplen = h->caplen;
|
||||
struct firewire_header *fp;
|
||||
u_short ether_type;
|
||||
u_short extracted_ether_type;
|
||||
|
||||
if (caplen < FIREWIRE_HDRLEN) {
|
||||
printf("[|ap1394]");
|
||||
@ -102,11 +105,8 @@ ap1394_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
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 = EXTRACT_16BITS(&fp->firewire_type);
|
||||
if (ethertype_print(ether_type, p, length, caplen) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ap1394_hdr_print((u_char *)fp, length + FIREWIRE_HDRLEN);
|
||||
|
@ -35,6 +35,7 @@ static const char rcsid[] _U_ =
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "arcnet.h"
|
||||
|
||||
static int arcnet_encap_print(u_char arctype, const u_char *p,
|
||||
@ -151,11 +152,11 @@ arcnet_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
return (caplen);
|
||||
}
|
||||
flag = ap->arc_flag2;
|
||||
seqid = ntohs(ap->arc_seqid2);
|
||||
seqid = EXTRACT_16BITS(&ap->arc_seqid2);
|
||||
archdrlen = ARC_HDRNEWLEN_EXC;
|
||||
} else {
|
||||
flag = ap->arc_flag;
|
||||
seqid = ntohs(ap->arc_seqid);
|
||||
seqid = EXTRACT_16BITS(&ap->arc_seqid);
|
||||
archdrlen = ARC_HDRNEWLEN;
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ aarp_print(register const u_char *bp, u_int length)
|
||||
|
||||
case 2: /* response */
|
||||
(void)printf("reply %s is-at %s",
|
||||
AT(pdaddr), etheraddr_string(ap->hdaddr));
|
||||
AT(psaddr), etheraddr_string(ap->hsaddr));
|
||||
return;
|
||||
|
||||
case 3: /* probe (oy!) */
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.48.2.1 2007-10-22 19:39:12 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.49 2007-10-22 19:37:51 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
14
print-bfd.c
14
print-bfd.c
@ -171,13 +171,17 @@ bfd_print(register const u_char *pptr, register u_int len, register u_int port)
|
||||
{
|
||||
const struct bfd_header_t *bfd_header;
|
||||
const struct bfd_auth_header_t *bfd_auth_header;
|
||||
u_int8_t version;
|
||||
u_int8_t version = 0;
|
||||
|
||||
bfd_header = (const struct bfd_header_t *)pptr;
|
||||
TCHECK(*bfd_header);
|
||||
version = BFD_EXTRACT_VERSION(bfd_header->version_diag);
|
||||
|
||||
switch (port << 8 | version) {
|
||||
if (port == BFD_CONTROL_PORT) {
|
||||
TCHECK(*bfd_header);
|
||||
version = BFD_EXTRACT_VERSION(bfd_header->version_diag);
|
||||
} else if (port == BFD_ECHO_PORT) {
|
||||
/* Echo is BFD v1 only */
|
||||
version = 1;
|
||||
}
|
||||
switch ((port << 8) | version) {
|
||||
|
||||
/* BFDv0 */
|
||||
case (BFD_CONTROL_PORT << 8):
|
||||
|
196
print-bgp.c
196
print-bgp.c
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.117.2.1 2007-12-08 10:08:07 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.118 2007-12-07 15:54:52 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
@ -346,7 +346,8 @@ static struct tok bgp_pmsi_flag_values[] = {
|
||||
#define SAFNUM_MULTICAST_VPN 5
|
||||
#define SAFNUM_TUNNEL 64 /* XXX */
|
||||
#define SAFNUM_VPLS 65 /* XXX */
|
||||
#define SAFNUM_MDT 66 /* XXX */
|
||||
/* draft-nalawade-idr-mdt-safi-03 */
|
||||
#define SAFNUM_MDT 66
|
||||
/* Section 4.3.4 of draft-rosen-rfc2547bis-03.txt */
|
||||
#define SAFNUM_VPNUNICAST 128
|
||||
#define SAFNUM_VPNMULTICAST 129
|
||||
@ -464,6 +465,29 @@ static struct tok bgp_extd_comm_ospf_rtype_values[] = {
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
#define TOKBUFSIZE 128
|
||||
static char astostr[20];
|
||||
|
||||
/*
|
||||
* as_printf
|
||||
*
|
||||
* Convert an AS number into a string and return string pointer.
|
||||
*
|
||||
* Bepending on bflag is set or not, AS number is converted into ASDOT notation
|
||||
* or plain number notation.
|
||||
*
|
||||
*/
|
||||
static char *
|
||||
as_printf (char *str, int size, u_int asnum)
|
||||
{
|
||||
if (!bflag || asnum <= 0xFFFF) {
|
||||
snprintf(str, size, "%u", asnum);
|
||||
} else {
|
||||
snprintf(str, size, "%u.%u", asnum >> 16, asnum & 0xFFFF);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int
|
||||
decode_prefix4(const u_char *pptr, char *buf, u_int buflen)
|
||||
{
|
||||
@ -656,9 +680,10 @@ bgp_vpn_rd_print (const u_char *pptr) {
|
||||
|
||||
/* 4-byte-AS:number fmt*/
|
||||
case 2:
|
||||
snprintf(pos, sizeof(rd) - (pos - rd), "%u:%u (%u.%u.%u.%u:%u)",
|
||||
EXTRACT_32BITS(pptr+2), EXTRACT_16BITS(pptr+6),
|
||||
*(pptr+2), *(pptr+3), *(pptr+4), *(pptr+5), EXTRACT_16BITS(pptr+6));
|
||||
snprintf(pos, sizeof(rd) - (pos - rd), "%s:%u (%u.%u.%u.%u:%u)",
|
||||
as_printf(astostr, sizeof(astostr), EXTRACT_32BITS(pptr+2)),
|
||||
EXTRACT_16BITS(pptr+6), *(pptr+2), *(pptr+3), *(pptr+4),
|
||||
*(pptr+5), EXTRACT_16BITS(pptr+6));
|
||||
break;
|
||||
default:
|
||||
snprintf(pos, sizeof(rd) - (pos - rd), "unknown RD format");
|
||||
@ -696,9 +721,9 @@ decode_rt_routing_info(const u_char *pptr, char *buf, u_int buflen)
|
||||
((u_char *)&route_target)[(plen + 7) / 8 - 1] &=
|
||||
((0xff00 >> (plen % 8)) & 0xff);
|
||||
}
|
||||
snprintf(buf, buflen, "origin AS: %u, route target %s",
|
||||
EXTRACT_32BITS(pptr+1),
|
||||
bgp_vpn_rd_print((u_char *)&route_target));
|
||||
snprintf(buf, buflen, "origin AS: %s, route target %s",
|
||||
as_printf(astostr, sizeof(astostr), EXTRACT_32BITS(pptr+1)),
|
||||
bgp_vpn_rd_print((u_char *)&route_target));
|
||||
|
||||
return 5 + (plen + 7) / 8;
|
||||
|
||||
@ -744,6 +769,55 @@ decode_labeled_vpn_prefix4(const u_char *pptr, char *buf, u_int buflen)
|
||||
return -2;
|
||||
}
|
||||
|
||||
/*
|
||||
* +-------------------------------+
|
||||
* | |
|
||||
* | RD:IPv4-address (12 octets) |
|
||||
* | |
|
||||
* +-------------------------------+
|
||||
* | MDT Group-address (4 octets) |
|
||||
* +-------------------------------+
|
||||
*/
|
||||
|
||||
#define MDT_VPN_NLRI_LEN 16
|
||||
|
||||
static int
|
||||
decode_mdt_vpn_nlri(const u_char *pptr, char *buf, u_int buflen)
|
||||
{
|
||||
|
||||
const u_char *rd;
|
||||
const u_char *vpn_ip;
|
||||
|
||||
TCHECK(pptr[0]);
|
||||
|
||||
/* if the NLRI is not predefined length, quit.*/
|
||||
if (*pptr != MDT_VPN_NLRI_LEN * NBBY)
|
||||
return -1;
|
||||
pptr++;
|
||||
|
||||
/* RD */
|
||||
TCHECK2(pptr[0], 8);
|
||||
rd = pptr;
|
||||
pptr+=8;
|
||||
|
||||
/* IPv4 address */
|
||||
TCHECK2(pptr[0], sizeof(struct in_addr));
|
||||
vpn_ip = pptr;
|
||||
pptr+=sizeof(struct in_addr);
|
||||
|
||||
/* MDT Group Address */
|
||||
TCHECK2(pptr[0], sizeof(struct in_addr));
|
||||
|
||||
snprintf(buf, buflen, "RD: %s, VPN IP Address: %s, MC Group Address: %s",
|
||||
bgp_vpn_rd_print(rd), ipaddr_string(vpn_ip), ipaddr_string(pptr));
|
||||
|
||||
return MDT_VPN_NLRI_LEN + 1;
|
||||
|
||||
trunc:
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
#define BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI 1
|
||||
#define BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI 2
|
||||
#define BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI 3
|
||||
@ -789,9 +863,10 @@ decode_multicast_vpn(const u_char *pptr, char *buf, u_int buflen)
|
||||
case BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI:
|
||||
TCHECK2(pptr[0], BGP_VPN_RD_LEN + 4);
|
||||
offset = strlen(buf);
|
||||
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %u",
|
||||
bgp_vpn_rd_print(pptr),
|
||||
EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN));
|
||||
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
|
||||
bgp_vpn_rd_print(pptr),
|
||||
as_printf(astostr, sizeof(astostr),
|
||||
EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN)));
|
||||
break;
|
||||
|
||||
case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI:
|
||||
@ -824,9 +899,10 @@ decode_multicast_vpn(const u_char *pptr, char *buf, u_int buflen)
|
||||
case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_TREE_JOIN:
|
||||
TCHECK2(pptr[0], BGP_VPN_RD_LEN);
|
||||
offset = strlen(buf);
|
||||
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %u",
|
||||
bgp_vpn_rd_print(pptr),
|
||||
EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN));
|
||||
snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
|
||||
bgp_vpn_rd_print(pptr),
|
||||
as_printf(astostr, sizeof(astostr),
|
||||
EXTRACT_32BITS(pptr + BGP_VPN_RD_LEN)));
|
||||
pptr += BGP_VPN_RD_LEN;
|
||||
|
||||
bgp_vpn_sg_print(pptr, buf, buflen);
|
||||
@ -1222,9 +1298,11 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
tokbuf, sizeof(tokbuf)));
|
||||
for (i = 0; i < tptr[1] * as_size; i += as_size) {
|
||||
TCHECK2(tptr[2 + i], as_size);
|
||||
printf("%u ",
|
||||
as_size == 2 ? EXTRACT_16BITS(&tptr[2 + i]) :
|
||||
EXTRACT_32BITS(&tptr[2 + i]));
|
||||
printf("%s ",
|
||||
as_printf(astostr, sizeof(astostr),
|
||||
as_size == 2 ?
|
||||
EXTRACT_16BITS(&tptr[2 + i]) :
|
||||
EXTRACT_32BITS(&tptr[2 + i])));
|
||||
}
|
||||
TCHECK(tptr[0]);
|
||||
printf("%s", tok2strbuf(bgp_as_path_segment_close_values,
|
||||
@ -1255,23 +1333,36 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
if (len != 0)
|
||||
printf("invalid len");
|
||||
break;
|
||||
case BGPTYPE_AGGREGATOR:
|
||||
if (len != 6) {
|
||||
printf("invalid len");
|
||||
break;
|
||||
}
|
||||
TCHECK2(tptr[0], 6);
|
||||
printf(" AS #%u, origin %s", EXTRACT_16BITS(tptr),
|
||||
case BGPTYPE_AGGREGATOR:
|
||||
|
||||
/*
|
||||
* Depending on the AS encoded is of 2 bytes or of 4 bytes,
|
||||
* the length of this PA can be either 6 bytes or 8 bytes.
|
||||
*/
|
||||
if (len != 6 && len != 8) {
|
||||
printf("invalid len");
|
||||
break;
|
||||
}
|
||||
TCHECK2(tptr[0], len);
|
||||
if (len == 6) {
|
||||
printf(" AS #%s, origin %s",
|
||||
as_printf(astostr, sizeof(astostr), EXTRACT_16BITS(tptr)),
|
||||
getname(tptr + 2));
|
||||
break;
|
||||
} else {
|
||||
printf(" AS #%s, origin %s",
|
||||
as_printf(astostr, sizeof(astostr),
|
||||
EXTRACT_32BITS(tptr)), getname(tptr + 4));
|
||||
}
|
||||
break;
|
||||
case BGPTYPE_AGGREGATOR4:
|
||||
if (len != 8) {
|
||||
printf("invalid len");
|
||||
break;
|
||||
}
|
||||
TCHECK2(tptr[0], 8);
|
||||
printf(" AS #%u, origin %s", EXTRACT_32BITS(tptr),
|
||||
getname(tptr + 4));
|
||||
printf(" AS #%s, origin %s",
|
||||
as_printf(astostr, sizeof(astostr), EXTRACT_32BITS(tptr)),
|
||||
getname(tptr + 4));
|
||||
break;
|
||||
case BGPTYPE_COMMUNITIES:
|
||||
if (len % 4) {
|
||||
@ -1349,6 +1440,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
case (AFNUM_INET<<8 | SAFNUM_VPNMULTICAST):
|
||||
case (AFNUM_INET<<8 | SAFNUM_VPNUNIMULTICAST):
|
||||
case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN):
|
||||
case (AFNUM_INET<<8 | SAFNUM_MDT):
|
||||
#ifdef INET6
|
||||
case (AFNUM_INET6<<8 | SAFNUM_UNICAST):
|
||||
case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
|
||||
@ -1395,7 +1487,8 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
case (AFNUM_INET<<8 | SAFNUM_LABUNICAST):
|
||||
case (AFNUM_INET<<8 | SAFNUM_RT_ROUTING_INFO):
|
||||
case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN):
|
||||
if (tlen < (int)sizeof(struct in_addr)) {
|
||||
case (AFNUM_INET<<8 | SAFNUM_MDT):
|
||||
if (tlen < (int)sizeof(struct in_addr)) {
|
||||
printf("invalid len");
|
||||
tlen = 0;
|
||||
} else {
|
||||
@ -1579,6 +1672,16 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
else
|
||||
printf("\n\t %s", buf);
|
||||
break;
|
||||
|
||||
case (AFNUM_INET<<8 | SAFNUM_MDT):
|
||||
advance = decode_mdt_vpn_nlri(tptr, buf, sizeof(buf));
|
||||
if (advance == -1)
|
||||
printf("\n\t (illegal prefix length)");
|
||||
else if (advance == -2)
|
||||
goto trunc;
|
||||
else
|
||||
printf("\n\t %s", buf);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case (AFNUM_INET6<<8 | SAFNUM_UNICAST):
|
||||
case (AFNUM_INET6<<8 | SAFNUM_MULTICAST):
|
||||
@ -1781,6 +1884,15 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
else
|
||||
printf("\n\t %s", buf);
|
||||
break;
|
||||
case (AFNUM_INET<<8 | SAFNUM_MDT):
|
||||
advance = decode_mdt_vpn_nlri(tptr, buf, sizeof(buf));
|
||||
if (advance == -1)
|
||||
printf("\n\t (illegal prefix length)");
|
||||
else if (advance == -2)
|
||||
goto trunc;
|
||||
else
|
||||
printf("\n\t %s", buf);
|
||||
break;
|
||||
case (AFNUM_INET<<8 | SAFNUM_MULTICAST_VPN): /* fall through */
|
||||
case (AFNUM_INET6<<8 | SAFNUM_MULTICAST_VPN):
|
||||
advance = decode_multicast_vpn(tptr, buf, sizeof(buf));
|
||||
@ -1841,10 +1953,10 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
break;
|
||||
case BGP_EXT_COM_RT_2:
|
||||
case BGP_EXT_COM_RO_2:
|
||||
printf(": %u:%u",
|
||||
EXTRACT_32BITS(tptr+2),
|
||||
EXTRACT_16BITS(tptr+6));
|
||||
break;
|
||||
printf(": %s:%u",
|
||||
as_printf(astostr, sizeof(astostr),
|
||||
EXTRACT_32BITS(tptr+2)), EXTRACT_16BITS(tptr+6));
|
||||
break;
|
||||
case BGP_EXT_COM_LINKBAND:
|
||||
bw.i = EXTRACT_32BITS(tptr+2);
|
||||
printf(": bandwidth: %.3f Mbps",
|
||||
@ -1951,8 +2063,9 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
}
|
||||
case BGPTYPE_ATTR_SET:
|
||||
TCHECK2(tptr[0], 4);
|
||||
printf("\n\t Origin AS: %u", EXTRACT_32BITS(tptr));
|
||||
tptr+=4;
|
||||
printf("\n\t Origin AS: %s",
|
||||
as_printf(astostr, sizeof(astostr), EXTRACT_32BITS(tptr)));
|
||||
tptr+=4;
|
||||
len -=4;
|
||||
|
||||
while (len >= 2 ) {
|
||||
@ -2022,7 +2135,8 @@ bgp_open_print(const u_char *dat, int length)
|
||||
memcpy(&bgpo, dat, BGP_OPEN_SIZE);
|
||||
|
||||
printf("\n\t Version %d, ", bgpo.bgpo_version);
|
||||
printf("my AS %u, ", ntohs(bgpo.bgpo_myas));
|
||||
printf("my AS %s, ",
|
||||
as_printf(astostr, sizeof(astostr), ntohs(bgpo.bgpo_myas)));
|
||||
printf("Holdtime %us, ", ntohs(bgpo.bgpo_holdtime));
|
||||
printf("ID %s", getname((u_char *)&bgpo.bgpo_id));
|
||||
printf("\n\t Optional parameters, length: %u", bgpo.bgpo_optlen);
|
||||
@ -2098,6 +2212,18 @@ bgp_open_print(const u_char *dat, int length)
|
||||
case BGP_CAPCODE_RR:
|
||||
case BGP_CAPCODE_RR_CISCO:
|
||||
break;
|
||||
case BGP_CAPCODE_AS_NEW:
|
||||
|
||||
/*
|
||||
* Extract the 4 byte AS number encoded.
|
||||
*/
|
||||
TCHECK2(opt[i + BGP_OPT_SIZE + 2], cap_len);
|
||||
if (cap_len == 4) {
|
||||
printf("\n\t\t 4 Byte AS %s",
|
||||
as_printf(astostr, sizeof(astostr),
|
||||
EXTRACT_32BITS(opt + i + BGP_OPT_SIZE + 2)));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
TCHECK2(opt[i+BGP_OPT_SIZE+2],cap_len);
|
||||
printf("\n\t\tno decoder for Capability %u",
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.88 2007-09-20 15:04:45 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.89 2008-04-22 09:45:08 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -585,8 +585,6 @@ rfc1048_print(register const u_char *bp)
|
||||
if (len < 1) {
|
||||
printf("ERROR: option %u len %u < 1 bytes",
|
||||
TAG_NETBIOS_NODE, len);
|
||||
bp += len;
|
||||
len = 0;
|
||||
break;
|
||||
}
|
||||
tag = *bp++;
|
||||
@ -599,8 +597,6 @@ rfc1048_print(register const u_char *bp)
|
||||
if (len < 1) {
|
||||
printf("ERROR: option %u len %u < 1 bytes",
|
||||
TAG_OPT_OVERLOAD, len);
|
||||
bp += len;
|
||||
len = 0;
|
||||
break;
|
||||
}
|
||||
tag = *bp++;
|
||||
@ -640,8 +636,6 @@ rfc1048_print(register const u_char *bp)
|
||||
if (len < 1) {
|
||||
printf("ERROR: option %u len %u < 1 bytes",
|
||||
TAG_CLIENT_ID, len);
|
||||
bp += len;
|
||||
len = 0;
|
||||
break;
|
||||
}
|
||||
type = *bp++;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bt.c,v 1.1.2.1 2008-09-25 21:50:04 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bt.c,v 1.2 2008-09-25 21:45:50 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -33,6 +33,7 @@ static const char rcsid[] _U_ =
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
|
||||
@ -60,7 +61,7 @@ bt_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
length -= BT_HDRLEN;
|
||||
p += BT_HDRLEN;
|
||||
if (eflag)
|
||||
(void)printf("hci length %d, direction %s, ", length, (ntohl(hdr->direction)&0x1)?"in":"out");
|
||||
(void)printf("hci length %d, direction %s, ", length, (EXTRACT_32BITS(&hdr->direction)&0x1)?"in":"out");
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
|
29
print-cdp.c
29
print-cdp.c
@ -130,16 +130,19 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
|
||||
|
||||
case 0x01: /* Device-ID */
|
||||
if (!vflag)
|
||||
printf(", Device-ID '%.*s'", len, tptr);
|
||||
else
|
||||
printf("'%.*s'", len, tptr);
|
||||
printf(", Device-ID ");
|
||||
printf("'");
|
||||
fn_printn(tptr, len, NULL);
|
||||
printf("'");
|
||||
break;
|
||||
case 0x02: /* Address */
|
||||
if (cdp_print_addr(tptr, len) < 0)
|
||||
goto trunc;
|
||||
break;
|
||||
case 0x03: /* Port-ID */
|
||||
printf("'%.*s'", len, tptr);
|
||||
printf("'");
|
||||
fn_printn(tptr, len, NULL);
|
||||
printf("'");
|
||||
break;
|
||||
case 0x04: /* Capabilities */
|
||||
printf("(0x%08x): %s",
|
||||
@ -156,7 +159,9 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
|
||||
}
|
||||
break;
|
||||
case 0x06: /* Platform */
|
||||
printf("'%.*s'", len, tptr);
|
||||
printf("'");
|
||||
fn_printn(tptr, len, NULL);
|
||||
printf("'");
|
||||
break;
|
||||
case 0x07: /* Prefixes */
|
||||
if (cdp_print_prefixes(tptr, len) < 0)
|
||||
@ -165,7 +170,9 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
|
||||
case 0x08: /* Protocol Hello Option - not documented */
|
||||
break;
|
||||
case 0x09: /* VTP Mgmt Domain - not documented */
|
||||
printf("'%.*s'", len,tptr);
|
||||
printf("'");
|
||||
fn_printn(tptr, len, NULL);
|
||||
printf("'");
|
||||
break;
|
||||
case 0x0a: /* Native VLAN ID - not documented */
|
||||
printf("%d",EXTRACT_16BITS(tptr));
|
||||
@ -195,14 +202,20 @@ cdp_print(const u_char *pptr, u_int length, u_int caplen)
|
||||
printf("0x%02x", *(tptr));
|
||||
break;
|
||||
case 0x14: /* System Name - not documented */
|
||||
printf("'%.*s'", len, tptr);
|
||||
printf("'");
|
||||
fn_printn(tptr, len, NULL);
|
||||
printf("'");
|
||||
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 );
|
||||
printf("0x%02x", *(tptr));
|
||||
if (len > 1) {
|
||||
printf("/");
|
||||
fn_printn(tptr + 1, len - 1, NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print_unknown_data(tptr,"\n\t ",len);
|
||||
|
@ -423,6 +423,8 @@ cfm_print(register const u_char *pptr, register u_int length) {
|
||||
break;
|
||||
|
||||
case CFM_OPCODE_LTM:
|
||||
msg_ptr.cfm_ltm = (const struct cfm_ltm_t *)tptr;
|
||||
|
||||
printf(", Flags [%s]",
|
||||
bittok2str(cfm_ltm_flag_values, "none", cfm_common_header->flags));
|
||||
|
||||
@ -437,6 +439,8 @@ cfm_print(register const u_char *pptr, register u_int length) {
|
||||
break;
|
||||
|
||||
case CFM_OPCODE_LTR:
|
||||
msg_ptr.cfm_ltr = (const struct cfm_ltr_t *)tptr;
|
||||
|
||||
printf(", Flags [%s]",
|
||||
bittok2str(cfm_ltr_flag_values, "none", cfm_common_header->flags));
|
||||
|
||||
|
28
print-dccp.c
28
print-dccp.c
@ -9,7 +9,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dccp.c,v 1.7.2.1 2007-11-09 00:45:16 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dccp.c,v 1.8 2007-11-09 00:44:09 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -394,9 +394,6 @@ void dccp_print(const u_char *bp, const u_char *data2, u_int len)
|
||||
static int dccp_print_option(const u_char *option)
|
||||
{
|
||||
u_int8_t optlen, i;
|
||||
u_int32_t *ts;
|
||||
u_int16_t *var16;
|
||||
u_int32_t *var32;
|
||||
|
||||
TCHECK(*option);
|
||||
|
||||
@ -470,22 +467,17 @@ static int dccp_print_option(const u_char *option)
|
||||
for (i = 0; i < optlen -2; i ++) printf("%02x", *(option +2 + i));
|
||||
break;
|
||||
case 41:
|
||||
ts = (u_int32_t *)(option + 2);
|
||||
printf("timestamp %u", (u_int32_t)ntohl(*ts));
|
||||
printf("timestamp %u", EXTRACT_32BITS(option + 2));
|
||||
break;
|
||||
case 42:
|
||||
ts = (u_int32_t *)(option + 2);
|
||||
printf("timestamp_echo %u", (u_int32_t)ntohl(*ts));
|
||||
printf("timestamp_echo %u", EXTRACT_32BITS(option + 2));
|
||||
break;
|
||||
case 43:
|
||||
printf("elapsed_time ");
|
||||
if (optlen == 6){
|
||||
ts = (u_int32_t *)(option + 2);
|
||||
printf("%u", (u_int32_t)ntohl(*ts));
|
||||
} else {
|
||||
var16 = (u_int16_t *)(option + 2);
|
||||
printf("%u", ntohs(*var16));
|
||||
}
|
||||
if (optlen == 6)
|
||||
printf("%u", EXTRACT_32BITS(option + 2));
|
||||
else
|
||||
printf("%u", EXTRACT_16BITS(option + 2));
|
||||
break;
|
||||
case 44:
|
||||
printf("data_checksum ");
|
||||
@ -496,12 +488,10 @@ static int dccp_print_option(const u_char *option)
|
||||
printf("CCID option %d",*option);
|
||||
switch (optlen) {
|
||||
case 4:
|
||||
var16 = (u_int16_t *)(option + 2);
|
||||
printf(" %u",ntohs(*var16));
|
||||
printf(" %u", EXTRACT_16BITS(option + 2));
|
||||
break;
|
||||
case 6:
|
||||
var32 = (u_int32_t *)(option + 2);
|
||||
printf(" %u",(u_int32_t)ntohl(*var32));
|
||||
printf(" %u", EXTRACT_32BITS(option + 2));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
266
print-dhcp6.c
266
print-dhcp6.c
@ -40,7 +40,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.36.2.1 2008-02-06 10:26:27 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.37 2008-02-06 10:26:09 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -177,54 +177,19 @@ struct dhcp6opt {
|
||||
/* type-dependent data follows */
|
||||
};
|
||||
|
||||
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_addr {
|
||||
u_int16_t dh6opt_ia_addr_type;
|
||||
u_int16_t dh6opt_ia_addr_len;
|
||||
struct in6_addr dh6opt_ia_addr_addr;
|
||||
u_int32_t dh6opt_ia_addr_pltime;
|
||||
u_int32_t dh6opt_ia_addr_vltime;
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
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__));
|
||||
|
||||
struct dhcp6_auth {
|
||||
u_int16_t dh6opt_auth_type;
|
||||
u_int16_t dh6opt_auth_len;
|
||||
u_int8_t dh6opt_auth_proto;
|
||||
u_int8_t dh6opt_auth_alg;
|
||||
u_int8_t dh6opt_auth_rdm;
|
||||
u_int8_t dh6opt_auth_rdinfo[8];
|
||||
/* authentication information follows */
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
static const char *
|
||||
dhcp6opt_name(int type)
|
||||
{
|
||||
static char genstr[sizeof("opt_65535") + 1]; /* XXX thread unsafe */
|
||||
|
||||
if (type > 65535)
|
||||
return "INVALID option";
|
||||
return "INVALID-option";
|
||||
|
||||
switch(type) {
|
||||
case DH6OPT_CLIENTID:
|
||||
return "client ID";
|
||||
return "client-ID";
|
||||
case DH6OPT_SERVERID:
|
||||
return "server ID";
|
||||
return "server-ID";
|
||||
case DH6OPT_IA_NA:
|
||||
return "IA_NA";
|
||||
case DH6OPT_IA_TA:
|
||||
@ -232,87 +197,87 @@ dhcp6opt_name(int type)
|
||||
case DH6OPT_IA_ADDR:
|
||||
return "IA_ADDR";
|
||||
case DH6OPT_ORO:
|
||||
return "option request";
|
||||
return "option-request";
|
||||
case DH6OPT_PREFERENCE:
|
||||
return "preference";
|
||||
case DH6OPT_ELAPSED_TIME:
|
||||
return "elapsed time";
|
||||
return "elapsed-time";
|
||||
case DH6OPT_RELAY_MSG:
|
||||
return "relay message";
|
||||
return "relay-message";
|
||||
case DH6OPT_AUTH:
|
||||
return "authentication";
|
||||
case DH6OPT_UNICAST:
|
||||
return "server unicast";
|
||||
return "server-unicast";
|
||||
case DH6OPT_STATUS_CODE:
|
||||
return "status code";
|
||||
return "status-code";
|
||||
case DH6OPT_RAPID_COMMIT:
|
||||
return "rapid commit";
|
||||
return "rapid-commit";
|
||||
case DH6OPT_USER_CLASS:
|
||||
return "user class";
|
||||
return "user-class";
|
||||
case DH6OPT_VENDOR_CLASS:
|
||||
return "vendor class";
|
||||
return "vendor-class";
|
||||
case DH6OPT_VENDOR_OPTS:
|
||||
return "vendor-specific info";
|
||||
return "vendor-specific-info";
|
||||
case DH6OPT_INTERFACE_ID:
|
||||
return "interface ID";
|
||||
return "interface-ID";
|
||||
case DH6OPT_RECONF_MSG:
|
||||
return "reconfigure message";
|
||||
return "reconfigure-message";
|
||||
case DH6OPT_RECONF_ACCEPT:
|
||||
return "reconfigure accept";
|
||||
return "reconfigure-accept";
|
||||
case DH6OPT_SIP_SERVER_D:
|
||||
return "SIP servers domain";
|
||||
return "SIP-servers-domain";
|
||||
case DH6OPT_SIP_SERVER_A:
|
||||
return "SIP servers address";
|
||||
return "SIP-servers-address";
|
||||
case DH6OPT_DNS:
|
||||
return "DNS";
|
||||
case DH6OPT_DNSNAME:
|
||||
return "DNS name";
|
||||
return "DNS-name";
|
||||
case DH6OPT_IA_PD:
|
||||
return "IA_PD";
|
||||
case DH6OPT_IA_PD_PREFIX:
|
||||
return "IA_PD prefix";
|
||||
return "IA_PD-prefix";
|
||||
case DH6OPT_NTP_SERVERS:
|
||||
return "NTP Server";
|
||||
return "NTP-Server";
|
||||
case DH6OPT_LIFETIME:
|
||||
return "lifetime";
|
||||
case DH6OPT_NIS_SERVERS:
|
||||
return "NIS server";
|
||||
return "NIS-server";
|
||||
case DH6OPT_NISP_SERVERS:
|
||||
return "NIS+ server";
|
||||
return "NIS+-server";
|
||||
case DH6OPT_NIS_NAME:
|
||||
return "NIS domain name";
|
||||
return "NIS-domain-name";
|
||||
case DH6OPT_NISP_NAME:
|
||||
return "NIS+ domain name";
|
||||
return "NIS+-domain-name";
|
||||
case DH6OPT_BCMCS_SERVER_D:
|
||||
return "BCMCS domain name";
|
||||
return "BCMCS-domain-name";
|
||||
case DH6OPT_BCMCS_SERVER_A:
|
||||
return "BCMCS server";
|
||||
return "BCMCS-server";
|
||||
case DH6OPT_GEOCONF_CIVIC:
|
||||
return "Geoconf Civic";
|
||||
return "Geoconf-Civic";
|
||||
case DH6OPT_REMOTE_ID:
|
||||
return "Remote ID";
|
||||
return "Remote-ID";
|
||||
case DH6OPT_SUBSCRIBER_ID:
|
||||
return "Subscriber ID";
|
||||
return "Subscriber-ID";
|
||||
case DH6OPT_CLIENT_FQDN:
|
||||
return "Client FQDN";
|
||||
return "Client-FQDN";
|
||||
case DH6OPT_PANA_AGENT:
|
||||
return "PANA agent";
|
||||
return "PANA-agent";
|
||||
case DH6OPT_NEW_POSIX_TIMEZONE:
|
||||
return "POSIX timezone";
|
||||
return "POSIX-timezone";
|
||||
case DH6OPT_NEW_TZDB_TIMEZONE:
|
||||
return "POSIX tz database";
|
||||
return "POSIX-tz-database";
|
||||
case DH6OPT_ERO:
|
||||
return "Echo request option";
|
||||
return "Echo-request-option";
|
||||
case DH6OPT_LQ_QUERY:
|
||||
return "Lease query";
|
||||
return "Lease-query";
|
||||
case DH6OPT_CLIENT_DATA:
|
||||
return "LQ client data";
|
||||
return "LQ-client-data";
|
||||
case DH6OPT_CLT_TIME:
|
||||
return "Clt time";
|
||||
return "Clt-time";
|
||||
case DH6OPT_LQ_RELAY_DATA:
|
||||
return "LQ relay data";
|
||||
return "LQ-relay-data";
|
||||
case DH6OPT_LQ_CLIENT_LINK:
|
||||
return "LQ client link";
|
||||
return "LQ-client-link";
|
||||
default:
|
||||
snprintf(genstr, sizeof(genstr), "opt_%d", type);
|
||||
return(genstr);
|
||||
@ -364,12 +329,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
size_t i;
|
||||
u_int16_t opttype;
|
||||
size_t optlen;
|
||||
u_int16_t val16;
|
||||
u_int32_t val32;
|
||||
struct dhcp6_ia ia;
|
||||
struct dhcp6_ia_prefix ia_prefix;
|
||||
struct dhcp6_ia_addr ia_addr;
|
||||
struct dhcp6_auth authopt;
|
||||
u_int8_t auth_proto;
|
||||
u_int authinfolen, authrealmlen;
|
||||
|
||||
if (cp == ep)
|
||||
@ -438,25 +398,19 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
}
|
||||
break;
|
||||
case DH6OPT_IA_ADDR:
|
||||
if (optlen < sizeof(ia_addr) - 4) {
|
||||
if (optlen < 24) {
|
||||
/*(*/
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&ia_addr, (u_char *)dh6o, sizeof(ia_addr));
|
||||
printf(" %s",
|
||||
ip6addr_string(&ia_addr.dh6opt_ia_addr_addr));
|
||||
ia_addr.dh6opt_ia_addr_pltime =
|
||||
ntohl(ia_addr.dh6opt_ia_addr_pltime);
|
||||
ia_addr.dh6opt_ia_addr_vltime =
|
||||
ntohl(ia_addr.dh6opt_ia_addr_vltime);
|
||||
printf(" pltime:%lu vltime:%lu",
|
||||
(unsigned long)ia_addr.dh6opt_ia_addr_pltime,
|
||||
(unsigned long)ia_addr.dh6opt_ia_addr_vltime);
|
||||
if (optlen > sizeof(ia_addr) - 4) {
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" %s", ip6addr_string(&tp[0]));
|
||||
printf(" pltime:%u vltime:%u",
|
||||
EXTRACT_32BITS(&tp[16]),
|
||||
EXTRACT_32BITS(&tp[20]));
|
||||
if (optlen > 24) {
|
||||
/* there are sub-options */
|
||||
dhcp6opt_print((u_char *)dh6o +
|
||||
sizeof(ia_addr),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
dhcp6opt_print(tp + 24, tp + 24 + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
@ -468,10 +422,8 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
}
|
||||
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(" %s",
|
||||
dhcp6opt_name(EXTRACT_16BITS(&tp[i])));
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
@ -480,29 +432,31 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
printf(" %d)", *((u_char *)(dh6o + 1) + 1));
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" %d)", *tp);
|
||||
break;
|
||||
case DH6OPT_ELAPSED_TIME:
|
||||
if (optlen != 2) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&val16, dh6o + 1, sizeof(val16));
|
||||
val16 = ntohs(val16);
|
||||
printf(" %d)", (int)val16);
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" %d)", EXTRACT_16BITS(tp));
|
||||
break;
|
||||
case DH6OPT_RELAY_MSG:
|
||||
printf(" (");
|
||||
dhcp6_print((const u_char *)(dh6o + 1), optlen);
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
dhcp6_print(tp, optlen);
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_AUTH:
|
||||
if (optlen < sizeof(authopt) - sizeof(*dh6o)) {
|
||||
if (optlen < 11) {
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&authopt, dh6o, sizeof(authopt));
|
||||
switch (authopt.dh6opt_auth_proto) {
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
auth_proto = *tp;
|
||||
switch (auth_proto) {
|
||||
case DH6OPT_AUTHPROTO_DELAYED:
|
||||
printf(" proto: delayed");
|
||||
break;
|
||||
@ -510,37 +464,36 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
printf(" proto: reconfigure");
|
||||
break;
|
||||
default:
|
||||
printf(" proto: %d",
|
||||
authopt.dh6opt_auth_proto);
|
||||
printf(" proto: %d", auth_proto);
|
||||
break;
|
||||
}
|
||||
switch (authopt.dh6opt_auth_alg) {
|
||||
tp++;
|
||||
switch (*tp) {
|
||||
case DH6OPT_AUTHALG_HMACMD5:
|
||||
/* XXX: may depend on the protocol */
|
||||
printf(", alg: HMAC-MD5");
|
||||
break;
|
||||
default:
|
||||
printf(", alg: %d", authopt.dh6opt_auth_alg);
|
||||
printf(", alg: %d", *tp);
|
||||
break;
|
||||
}
|
||||
switch (authopt.dh6opt_auth_rdm) {
|
||||
tp++;
|
||||
switch (*tp) {
|
||||
case DH6OPT_AUTHRDM_MONOCOUNTER:
|
||||
printf(", RDM: mono");
|
||||
break;
|
||||
default:
|
||||
printf(", RDM: %d", authopt.dh6opt_auth_rdm);
|
||||
printf(", RDM: %d", *tp);
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)&authopt.dh6opt_auth_rdinfo;
|
||||
tp++;
|
||||
printf(", RD:");
|
||||
for (i = 0; i < 4; i++, tp += sizeof(val16))
|
||||
for (i = 0; i < 4; i++, tp += 2)
|
||||
printf(" %04x", EXTRACT_16BITS(tp));
|
||||
|
||||
/* protocol dependent part */
|
||||
tp = (u_char *)dh6o + sizeof(authopt);
|
||||
authinfolen =
|
||||
optlen + sizeof(*dh6o) - sizeof(authopt);
|
||||
switch (authopt.dh6opt_auth_proto) {
|
||||
authinfolen = optlen - 11;
|
||||
switch (auth_proto) {
|
||||
case DH6OPT_AUTHPROTO_DELAYED:
|
||||
if (authinfolen == 0)
|
||||
break;
|
||||
@ -596,9 +549,10 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
* Since we cannot predict the encoding, print hex dump
|
||||
* at most 10 characters.
|
||||
*/
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" ");
|
||||
for (i = 0; i < optlen && i < 10; i++)
|
||||
printf("%02x", ((u_char *)(dh6o + 1))[i]);
|
||||
printf("%02x", tp[i]);
|
||||
printf("...)");
|
||||
break;
|
||||
case DH6OPT_RECONF_MSG:
|
||||
@ -640,28 +594,23 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&val16, (u_char *)(dh6o + 1), sizeof(val16));
|
||||
val16 = ntohs(val16);
|
||||
printf(" %s)", dhcp6stcode(val16));
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" %s)", dhcp6stcode(EXTRACT_16BITS(&tp[0])));
|
||||
break;
|
||||
case DH6OPT_IA_NA:
|
||||
case DH6OPT_IA_PD:
|
||||
if (optlen < sizeof(ia) - 4) {
|
||||
if (optlen < 12) {
|
||||
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) {
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" IAID:%u T1:%u T2:%u",
|
||||
EXTRACT_32BITS(&tp[0]),
|
||||
EXTRACT_32BITS(&tp[4]),
|
||||
EXTRACT_32BITS(&tp[8]));
|
||||
if (optlen > 12) {
|
||||
/* there are sub-options */
|
||||
dhcp6opt_print((u_char *)dh6o + sizeof(ia),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
dhcp6opt_print(tp + 12, tp + 12 + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
@ -670,37 +619,27 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&val32, dh6o + 1, sizeof(val32));
|
||||
val32 = ntohl(val32);
|
||||
printf(" IAID:%lu", (unsigned long)val32);
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" IAID:%u", EXTRACT_32BITS(tp));
|
||||
if (optlen > 4) {
|
||||
/* there are sub-options */
|
||||
dhcp6opt_print((u_char *)(dh6o + 1) + 4,
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
dhcp6opt_print(tp + 4, tp + 4 + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_IA_PD_PREFIX:
|
||||
if (optlen < sizeof(ia_prefix) - 4) {
|
||||
if (optlen < 25) {
|
||||
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) {
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" %s/%d", ip6addr_string(&tp[9]), tp[8]);
|
||||
printf(" pltime:%u vltime:%u",
|
||||
EXTRACT_32BITS(&tp[0]),
|
||||
EXTRACT_32BITS(&tp[4]));
|
||||
if (optlen > 25) {
|
||||
/* there are sub-options */
|
||||
dhcp6opt_print((u_char *)dh6o +
|
||||
sizeof(ia_prefix),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
dhcp6opt_print(tp + 25, tp + 25 + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
@ -710,9 +649,8 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
printf(" ?)");
|
||||
break;
|
||||
}
|
||||
memcpy(&val32, dh6o + 1, sizeof(val32));
|
||||
val32 = ntohl(val32);
|
||||
printf(" %d)", (int)val32);
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
printf(" %d)", EXTRACT_32BITS(tp));
|
||||
break;
|
||||
case DH6OPT_REMOTE_ID:
|
||||
if (optlen < 4) {
|
||||
@ -720,9 +658,7 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
break;
|
||||
}
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
memcpy(&val32, &tp[0], sizeof(val32));
|
||||
val32 = ntohl(val32);
|
||||
printf(" %d ", (int)val32);
|
||||
printf(" %d ", EXTRACT_32BITS(tp));
|
||||
/*
|
||||
* Print hex dump first 10 characters.
|
||||
*/
|
||||
@ -755,10 +691,10 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
|
||||
printf(")");
|
||||
break;
|
||||
case DH6OPT_CLIENT_DATA:
|
||||
tp = (u_char *)(dh6o + 1);
|
||||
if (optlen > 0) {
|
||||
/* there are encapsulated options */
|
||||
dhcp6opt_print((u_char *)(dh6o + 1),
|
||||
(u_char *)(dh6o + 1) + optlen);
|
||||
dhcp6opt_print(tp, tp + optlen);
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.97.2.1 2007-12-09 01:51:12 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.98 2007-12-09 01:40:32 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.4.4.1 2008-02-06 10:34:15 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-enc.c,v 1.6 2008-11-18 07:35:32 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,6 +35,7 @@ static const char rcsid[] _U_ =
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#include "enc.h"
|
||||
@ -67,7 +68,7 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
|
||||
ENC_PRINT_TYPE(flags, M_CONF, "confidential");
|
||||
/* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
|
||||
printf("SPI 0x%08x: ", (u_int32_t)ntohl(hdr->spi));
|
||||
printf("SPI 0x%08x: ", EXTRACT_32BITS(&hdr->spi));
|
||||
|
||||
length -= ENC_HDRLEN;
|
||||
caplen -= ENC_HDRLEN;
|
||||
@ -77,9 +78,11 @@ enc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
case AF_INET:
|
||||
ip_print(gndo, p, length);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
ip6_print(p, length);
|
||||
break;
|
||||
#endif /*INET6*/
|
||||
}
|
||||
|
||||
out:
|
||||
|
409
print-esp.c
409
print-esp.c
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.56 2005-04-21 06:44:40 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.58 2007-12-07 00:03:07 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -71,14 +71,72 @@ struct sockaddr_storage {
|
||||
struct sa_list {
|
||||
struct sa_list *next;
|
||||
struct sockaddr_storage daddr;
|
||||
u_int32_t spi;
|
||||
u_int32_t spi; /* if == 0, then IKEv2 */
|
||||
int initiator;
|
||||
u_char spii[8]; /* for IKEv2 */
|
||||
u_char spir[8];
|
||||
const EVP_CIPHER *evp;
|
||||
int ivlen;
|
||||
int authlen;
|
||||
u_char authsecret[256];
|
||||
int authsecret_len;
|
||||
u_char secret[256]; /* is that big enough for all secrets? */
|
||||
int secretlen;
|
||||
};
|
||||
|
||||
/*
|
||||
* this will adjust ndo_packetp and ndo_snapend to new buffer!
|
||||
*/
|
||||
int esp_print_decrypt_buffer_by_ikev2(netdissect_options *ndo,
|
||||
int initiator,
|
||||
u_char spii[8], u_char spir[8],
|
||||
u_char *buf, u_char *end)
|
||||
{
|
||||
struct sa_list *sa;
|
||||
u_char *iv;
|
||||
int len;
|
||||
EVP_CIPHER_CTX ctx;
|
||||
|
||||
/* initiator arg is any non-zero value */
|
||||
if(initiator) initiator=1;
|
||||
|
||||
/* see if we can find the SA, and if so, decode it */
|
||||
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
|
||||
if (sa->spi == 0
|
||||
&& initiator == sa->initiator
|
||||
&& memcmp(spii, sa->spii, 8) == 0
|
||||
&& memcmp(spir, sa->spir, 8) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(sa == NULL) return 0;
|
||||
if(sa->evp == NULL) return 0;
|
||||
|
||||
/*
|
||||
* remove authenticator, and see if we still have something to
|
||||
* work with
|
||||
*/
|
||||
end = end - sa->authlen;
|
||||
iv = buf;
|
||||
buf = buf + sa->ivlen;
|
||||
len = end-buf;
|
||||
|
||||
if(end <= buf) return 0;
|
||||
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
if (EVP_CipherInit(&ctx, sa->evp, sa->secret, NULL, 0) < 0)
|
||||
(*ndo->ndo_warning)(ndo, "espkey init failed");
|
||||
EVP_CipherInit(&ctx, NULL, NULL, iv, 0);
|
||||
EVP_Cipher(&ctx, buf, buf, len);
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
|
||||
ndo->ndo_packetp = buf;
|
||||
ndo->ndo_snapend = end;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static void esp_print_addsa(netdissect_options *ndo,
|
||||
struct sa_list *sa, int sa_def)
|
||||
{
|
||||
@ -122,14 +180,194 @@ static u_int hex2byte(netdissect_options *ndo, char *hexstring)
|
||||
return byte;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns size of binary, 0 on failure.
|
||||
*/
|
||||
static
|
||||
int espprint_decode_hex(netdissect_options *ndo,
|
||||
u_char *binbuf, unsigned int binbuf_len,
|
||||
char *hex)
|
||||
{
|
||||
unsigned int len;
|
||||
int i;
|
||||
|
||||
len = strlen(hex) / 2;
|
||||
|
||||
if (len > binbuf_len) {
|
||||
(*ndo->ndo_warning)(ndo, "secret is too big: %d\n", len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (hex[0] != '\0' && hex[1]!='\0') {
|
||||
binbuf[i] = hex2byte(ndo, hex);
|
||||
hex += 2;
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* decode the form: SPINUM@IP <tab> ALGONAME:0xsecret
|
||||
*/
|
||||
|
||||
static int
|
||||
espprint_decode_encalgo(netdissect_options *ndo,
|
||||
char *decode, struct sa_list *sa)
|
||||
{
|
||||
int len;
|
||||
size_t i;
|
||||
const EVP_CIPHER *evp;
|
||||
int authlen = 0;
|
||||
char *colon, *p;
|
||||
|
||||
colon = strchr(decode, ':');
|
||||
if (colon == NULL) {
|
||||
(*ndo->ndo_warning)(ndo, "failed to decode espsecret: %s\n", decode);
|
||||
return 0;
|
||||
}
|
||||
*colon = '\0';
|
||||
|
||||
len = colon - decode;
|
||||
if (strlen(decode) > strlen("-hmac96") &&
|
||||
!strcmp(decode + strlen(decode) - strlen("-hmac96"),
|
||||
"-hmac96")) {
|
||||
p = strstr(decode, "-hmac96");
|
||||
*p = '\0';
|
||||
authlen = 12;
|
||||
}
|
||||
if (strlen(decode) > strlen("-cbc") &&
|
||||
!strcmp(decode + strlen(decode) - strlen("-cbc"), "-cbc")) {
|
||||
p = strstr(decode, "-cbc");
|
||||
*p = '\0';
|
||||
}
|
||||
evp = EVP_get_cipherbyname(decode);
|
||||
|
||||
if (!evp) {
|
||||
(*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
|
||||
sa->evp = NULL;
|
||||
sa->authlen = 0;
|
||||
sa->ivlen = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sa->evp = evp;
|
||||
sa->authlen = authlen;
|
||||
sa->ivlen = EVP_CIPHER_iv_length(evp);
|
||||
|
||||
colon++;
|
||||
if (colon[0] == '0' && colon[1] == 'x') {
|
||||
/* decode some hex! */
|
||||
|
||||
colon += 2;
|
||||
sa->secretlen = espprint_decode_hex(ndo, sa->secret, sizeof(sa->secret), colon);
|
||||
if(sa->secretlen == 0) return 0;
|
||||
} else {
|
||||
i = strlen(colon);
|
||||
|
||||
if (i < sizeof(sa->secret)) {
|
||||
memcpy(sa->secret, colon, i);
|
||||
sa->secretlen = i;
|
||||
} else {
|
||||
memcpy(sa->secret, colon, sizeof(sa->secret));
|
||||
sa->secretlen = sizeof(sa->secret);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* for the moment, ignore the auth algorith, just hard code the authenticator
|
||||
* length. Need to research how openssl looks up HMAC stuff.
|
||||
*/
|
||||
static int
|
||||
espprint_decode_authalgo(netdissect_options *ndo,
|
||||
char *decode, struct sa_list *sa)
|
||||
{
|
||||
char *colon;
|
||||
|
||||
colon = strchr(decode, ':');
|
||||
if (colon == NULL) {
|
||||
(*ndo->ndo_warning)(ndo, "failed to decode espsecret: %s\n", decode);
|
||||
return 0;
|
||||
}
|
||||
*colon = '\0';
|
||||
|
||||
if(strcasecmp(colon,"sha1") == 0 ||
|
||||
strcasecmp(colon,"md5") == 0) {
|
||||
sa->authlen = 12;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void esp_print_decode_ikeline(netdissect_options *ndo, char *line,
|
||||
const char *file, int lineno)
|
||||
{
|
||||
/* it's an IKEv2 secret, store it instead */
|
||||
struct sa_list sa1;
|
||||
|
||||
char *init;
|
||||
char *icookie, *rcookie;
|
||||
int ilen, rlen;
|
||||
char *authkey;
|
||||
char *enckey;
|
||||
|
||||
init = strsep(&line, " \t");
|
||||
icookie = strsep(&line, " \t");
|
||||
rcookie = strsep(&line, " \t");
|
||||
authkey = strsep(&line, " \t");
|
||||
enckey = strsep(&line, " \t");
|
||||
|
||||
/* if any fields are missing */
|
||||
if(!init || !icookie || !rcookie || !authkey || !enckey) {
|
||||
(*ndo->ndo_warning)(ndo, "print_esp: failed to find all fields for ikev2 at %s:%u",
|
||||
file, lineno);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ilen = strlen(icookie);
|
||||
rlen = strlen(rcookie);
|
||||
|
||||
if((init[0]!='I' && init[0]!='R')
|
||||
|| icookie[0]!='0' || icookie[1]!='x'
|
||||
|| rcookie[0]!='0' || rcookie[1]!='x'
|
||||
|| ilen!=18
|
||||
|| rlen!=18) {
|
||||
(*ndo->ndo_warning)(ndo, "print_esp: line %s:%u improperly formatted.",
|
||||
file, lineno);
|
||||
|
||||
(*ndo->ndo_warning)(ndo, "init=%s icookie=%s(%u) rcookie=%s(%u)",
|
||||
init, icookie, ilen, rcookie, rlen);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sa1.spi = 0;
|
||||
sa1.initiator = (init[0] == 'I');
|
||||
if(espprint_decode_hex(ndo, sa1.spii, sizeof(sa1.spii), icookie+2)!=8)
|
||||
return;
|
||||
|
||||
if(espprint_decode_hex(ndo, sa1.spir, sizeof(sa1.spir), rcookie+2)!=8)
|
||||
return;
|
||||
|
||||
if(!espprint_decode_encalgo(ndo, enckey, &sa1)) return;
|
||||
|
||||
if(!espprint_decode_authalgo(ndo, authkey, &sa1)) return;
|
||||
|
||||
esp_print_addsa(ndo, &sa1, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* special form: file /name
|
||||
* causes us to go read from this file instead.
|
||||
*
|
||||
*/
|
||||
static void esp_print_decode_onesecret(netdissect_options *ndo, char *line)
|
||||
static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
|
||||
const char *file, int lineno)
|
||||
{
|
||||
struct sa_list sa1;
|
||||
int sa_def;
|
||||
@ -155,15 +393,18 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line)
|
||||
/* open file and read it */
|
||||
FILE *secretfile;
|
||||
char fileline[1024];
|
||||
int lineno=0;
|
||||
char *nl;
|
||||
char *filename = line;
|
||||
|
||||
secretfile = fopen(line, FOPEN_READ_TXT);
|
||||
secretfile = fopen(filename, FOPEN_READ_TXT);
|
||||
if (secretfile == NULL) {
|
||||
perror(line);
|
||||
perror(filename);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
while (fgets(fileline, sizeof(fileline)-1, secretfile) != NULL) {
|
||||
lineno++;
|
||||
/* remove newline from the line */
|
||||
nl = strchr(fileline, '\n');
|
||||
if (nl)
|
||||
@ -171,31 +412,37 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line)
|
||||
if (fileline[0] == '#') continue;
|
||||
if (fileline[0] == '\0') continue;
|
||||
|
||||
esp_print_decode_onesecret(ndo, fileline);
|
||||
esp_print_decode_onesecret(ndo, fileline, filename, lineno);
|
||||
}
|
||||
fclose(secretfile);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (spikey && strcasecmp(spikey, "ikev2") == 0) {
|
||||
esp_print_decode_ikeline(ndo, line, file, lineno);
|
||||
return;
|
||||
}
|
||||
|
||||
if (spikey) {
|
||||
|
||||
char *spistr, *foo;
|
||||
u_int32_t spino;
|
||||
struct sockaddr_in *sin;
|
||||
#ifdef INET6
|
||||
struct sockaddr_in6 *sin6;
|
||||
#endif
|
||||
|
||||
|
||||
spistr = strsep(&spikey, "@");
|
||||
|
||||
|
||||
spino = strtoul(spistr, &foo, 0);
|
||||
if (spistr == foo || !spikey) {
|
||||
(*ndo->ndo_warning)(ndo, "print_esp: failed to decode spi# %s\n", foo);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sa1.spi = spino;
|
||||
|
||||
|
||||
sin = (struct sockaddr_in *)&sa1.daddr;
|
||||
#ifdef INET6
|
||||
sin6 = (struct sockaddr_in6 *)&sa1.daddr;
|
||||
@ -206,122 +453,63 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line)
|
||||
sin6->sin6_family = AF_INET6;
|
||||
} else
|
||||
#endif
|
||||
if (inet_pton(AF_INET, spikey, &sin->sin_addr) == 1) {
|
||||
if (inet_pton(AF_INET, spikey, &sin->sin_addr) == 1) {
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
sin->sin_len = sizeof(struct sockaddr_in);
|
||||
sin->sin_len = sizeof(struct sockaddr_in);
|
||||
#endif
|
||||
sin->sin_family = AF_INET;
|
||||
} else {
|
||||
(*ndo->ndo_warning)(ndo, "print_esp: can not decode IP# %s\n", spikey);
|
||||
return;
|
||||
}
|
||||
sin->sin_family = AF_INET;
|
||||
} else {
|
||||
(*ndo->ndo_warning)(ndo, "print_esp: can not decode IP# %s\n", spikey);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (decode) {
|
||||
char *colon, *p;
|
||||
u_char espsecret_key[256];
|
||||
int len;
|
||||
size_t i;
|
||||
const EVP_CIPHER *evp;
|
||||
int authlen = 0;
|
||||
|
||||
/* skip any blank spaces */
|
||||
while (isspace((unsigned char)*decode))
|
||||
decode++;
|
||||
|
||||
colon = strchr(decode, ':');
|
||||
if (colon == NULL) {
|
||||
(*ndo->ndo_warning)(ndo, "failed to decode espsecret: %s\n", decode);
|
||||
|
||||
if(!espprint_decode_encalgo(ndo, decode, &sa1)) {
|
||||
return;
|
||||
}
|
||||
*colon = '\0';
|
||||
|
||||
len = colon - decode;
|
||||
if (strlen(decode) > strlen("-hmac96") &&
|
||||
!strcmp(decode + strlen(decode) - strlen("-hmac96"),
|
||||
"-hmac96")) {
|
||||
p = strstr(decode, "-hmac96");
|
||||
*p = '\0';
|
||||
authlen = 12;
|
||||
}
|
||||
if (strlen(decode) > strlen("-cbc") &&
|
||||
!strcmp(decode + strlen(decode) - strlen("-cbc"), "-cbc")) {
|
||||
p = strstr(decode, "-cbc");
|
||||
*p = '\0';
|
||||
}
|
||||
evp = EVP_get_cipherbyname(decode);
|
||||
if (!evp) {
|
||||
(*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
|
||||
sa1.evp = NULL;
|
||||
sa1.authlen = 0;
|
||||
sa1.ivlen = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
sa1.evp = evp;
|
||||
sa1.authlen = authlen;
|
||||
sa1.ivlen = EVP_CIPHER_iv_length(evp);
|
||||
|
||||
colon++;
|
||||
if (colon[0] == '0' && colon[1] == 'x') {
|
||||
/* decode some hex! */
|
||||
colon += 2;
|
||||
len = strlen(colon) / 2;
|
||||
|
||||
if (len > 256) {
|
||||
(*ndo->ndo_warning)(ndo, "secret is too big: %d\n", len);
|
||||
return;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (colon[0] != '\0' && colon[1]!='\0') {
|
||||
espsecret_key[i] = hex2byte(ndo, colon);
|
||||
colon += 2;
|
||||
i++;
|
||||
}
|
||||
|
||||
memcpy(sa1.secret, espsecret_key, i);
|
||||
sa1.secretlen = i;
|
||||
} else {
|
||||
i = strlen(colon);
|
||||
|
||||
if (i < sizeof(sa1.secret)) {
|
||||
memcpy(sa1.secret, colon, i);
|
||||
sa1.secretlen = i;
|
||||
} else {
|
||||
memcpy(sa1.secret, colon, sizeof(sa1.secret));
|
||||
sa1.secretlen = sizeof(sa1.secret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
esp_print_addsa(ndo, &sa1, sa_def);
|
||||
}
|
||||
|
||||
static void esp_print_decodesecret(netdissect_options *ndo)
|
||||
{
|
||||
char *line;
|
||||
char *p;
|
||||
|
||||
p = ndo->ndo_espsecret;
|
||||
|
||||
while (ndo->ndo_espsecret && ndo->ndo_espsecret[0] != '\0') {
|
||||
/* pick out the first line or first thing until a comma */
|
||||
if ((line = strsep(&ndo->ndo_espsecret, "\n,")) == NULL) {
|
||||
line = ndo->ndo_espsecret;
|
||||
ndo->ndo_espsecret = NULL;
|
||||
}
|
||||
|
||||
esp_print_decode_onesecret(ndo, line);
|
||||
}
|
||||
}
|
||||
|
||||
static void esp_init(netdissect_options *ndo _U_)
|
||||
{
|
||||
|
||||
OpenSSL_add_all_algorithms();
|
||||
EVP_add_cipher_alias(SN_des_ede3_cbc, "3des");
|
||||
}
|
||||
|
||||
void esp_print_decodesecret(netdissect_options *ndo)
|
||||
{
|
||||
char *line;
|
||||
char *p;
|
||||
static int initialized = 0;
|
||||
|
||||
if (!initialized) {
|
||||
esp_init(ndo);
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
p = ndo->ndo_espsecret;
|
||||
|
||||
while (p && p[0] != '\0') {
|
||||
/* pick out the first line or first thing until a comma */
|
||||
if ((line = strsep(&p, "\n,")) == NULL) {
|
||||
line = p;
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
esp_print_decode_onesecret(ndo, line, "cmdline", 0);
|
||||
}
|
||||
|
||||
ndo->ndo_espsecret = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
@ -359,7 +547,6 @@ esp_print(netdissect_options *ndo,
|
||||
u_char *p;
|
||||
EVP_CIPHER_CTX ctx;
|
||||
int blocksz;
|
||||
static int initialized = 0;
|
||||
#endif
|
||||
|
||||
esp = (struct newesp *)bp;
|
||||
@ -367,11 +554,6 @@ esp_print(netdissect_options *ndo,
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
secret = NULL;
|
||||
advance = 0;
|
||||
|
||||
if (!initialized) {
|
||||
esp_init(ndo);
|
||||
initialized = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
@ -418,7 +600,7 @@ esp_print(netdissect_options *ndo,
|
||||
/* see if we can find the SA, and if so, decode it */
|
||||
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&sa->daddr;
|
||||
if (sa->spi == ntohl(esp->esp_spi) &&
|
||||
if (sa->spi == EXTRACT_32BITS(&esp->esp_spi) &&
|
||||
sin6->sin6_family == AF_INET6 &&
|
||||
memcmp(&sin6->sin6_addr, &ip6->ip6_dst,
|
||||
sizeof(struct in6_addr)) == 0) {
|
||||
@ -436,7 +618,7 @@ esp_print(netdissect_options *ndo,
|
||||
/* see if we can find the SA, and if so, decode it */
|
||||
for (sa = ndo->ndo_sa_list_head; sa != NULL; sa = sa->next) {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in *)&sa->daddr;
|
||||
if (sa->spi == ntohl(esp->esp_spi) &&
|
||||
if (sa->spi == EXTRACT_32BITS(&esp->esp_spi) &&
|
||||
sin->sin_family == AF_INET &&
|
||||
sin->sin_addr.s_addr == ip->ip_dst.s_addr) {
|
||||
break;
|
||||
@ -481,6 +663,7 @@ esp_print(netdissect_options *ndo,
|
||||
p = ivoff;
|
||||
EVP_CipherInit(&ctx, NULL, NULL, p, 0);
|
||||
EVP_Cipher(&ctx, p + ivlen, p + ivlen, ep - (p + ivlen));
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
advance = ivoff - (u_char *)esp + ivlen;
|
||||
} else
|
||||
advance = sizeof(struct newesp);
|
||||
|
191
print-ether.c
191
print-ether.c
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.105.2.1 2008-02-06 10:49:22 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.106 2008-02-06 10:47:53 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -33,6 +33,7 @@ static const char rcsid[] _U_ =
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
@ -56,6 +57,7 @@ const struct tok ethertype_values[] = {
|
||||
{ ETHERTYPE_DN, "DN" },
|
||||
{ ETHERTYPE_LAT, "LAT" },
|
||||
{ ETHERTYPE_SCA, "SCA" },
|
||||
{ ETHERTYPE_TEB, "TEB" },
|
||||
{ ETHERTYPE_LANBRIDGE, "Lanbridge" },
|
||||
{ ETHERTYPE_DECDNS, "DEC DNS" },
|
||||
{ ETHERTYPE_DECDTS, "DEC DTS" },
|
||||
@ -85,51 +87,67 @@ static inline void
|
||||
ether_hdr_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
register const struct ether_header *ep;
|
||||
u_int16_t ether_type;
|
||||
|
||||
ep = (const struct ether_header *)bp;
|
||||
|
||||
(void)printf("%s > %s",
|
||||
etheraddr_string(ESRC(ep)),
|
||||
etheraddr_string(EDST(ep)));
|
||||
|
||||
ether_type = EXTRACT_16BITS(&ep->ether_type);
|
||||
if (!qflag) {
|
||||
if (ntohs(ep->ether_type) <= ETHERMTU)
|
||||
if (ether_type <= ETHERMTU)
|
||||
(void)printf(", 802.3");
|
||||
else
|
||||
(void)printf(", ethertype %s (0x%04x)",
|
||||
tok2str(ethertype_values,"Unknown", ntohs(ep->ether_type)),
|
||||
ntohs(ep->ether_type));
|
||||
tok2str(ethertype_values,"Unknown", ether_type),
|
||||
ether_type);
|
||||
} else {
|
||||
if (ntohs(ep->ether_type) <= ETHERMTU)
|
||||
if (ether_type <= ETHERMTU)
|
||||
(void)printf(", 802.3");
|
||||
else
|
||||
(void)printf(", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ntohs(ep->ether_type)));
|
||||
(void)printf(", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ether_type));
|
||||
}
|
||||
|
||||
(void)printf(", length %u: ", length);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print an Ethernet frame.
|
||||
* This might be encapsulated within another frame; we might be passed
|
||||
* a pointer to a function that can print header information for that
|
||||
* frame's protocol, and an argument to pass to that function.
|
||||
*/
|
||||
void
|
||||
ether_print(const u_char *p, u_int length, u_int caplen)
|
||||
ether_print(const u_char *p, u_int length, u_int caplen,
|
||||
void (*print_encap_header)(const u_char *), const u_char *encap_header_arg)
|
||||
{
|
||||
struct ether_header *ep;
|
||||
u_int orig_length;
|
||||
u_short ether_type;
|
||||
u_short extracted_ether_type;
|
||||
|
||||
if (caplen < ETHER_HDRLEN) {
|
||||
if (caplen < ETHER_HDRLEN || length < ETHER_HDRLEN) {
|
||||
printf("[|ether]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
if (eflag) {
|
||||
if (print_encap_header != NULL)
|
||||
(*print_encap_header)(encap_header_arg);
|
||||
ether_hdr_print(p, length);
|
||||
}
|
||||
orig_length = length;
|
||||
|
||||
length -= ETHER_HDRLEN;
|
||||
caplen -= ETHER_HDRLEN;
|
||||
ep = (struct ether_header *)p;
|
||||
p += ETHER_HDRLEN;
|
||||
|
||||
ether_type = ntohs(ep->ether_type);
|
||||
ether_type = EXTRACT_16BITS(&ep->ether_type);
|
||||
|
||||
recurse:
|
||||
/*
|
||||
* Is it (gag) an 802.3 encapsulation?
|
||||
*/
|
||||
@ -138,21 +156,76 @@ ether_print(const u_char *p, u_int length, u_int caplen)
|
||||
if (llc_print(p, length, caplen, ESRC(ep), EDST(ep),
|
||||
&extracted_ether_type) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
|
||||
if (!eflag) {
|
||||
if (print_encap_header != NULL)
|
||||
(*print_encap_header)(encap_header_arg);
|
||||
ether_hdr_print((u_char *)ep, orig_length);
|
||||
}
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ether_type) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
ether_hdr_print((u_char *)ep, length + ETHER_HDRLEN);
|
||||
} else if (ether_type == ETHERTYPE_8021Q) {
|
||||
/*
|
||||
* Print VLAN information, and then go back and process
|
||||
* the enclosed type field.
|
||||
*/
|
||||
if (caplen < 4 || length < 4) {
|
||||
printf("[|vlan]");
|
||||
return;
|
||||
}
|
||||
if (eflag) {
|
||||
u_int16_t tag = EXTRACT_16BITS(p);
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
printf("vlan %u, p %u%s, ",
|
||||
tag & 0xfff,
|
||||
tag >> 13,
|
||||
(tag & 0x1000) ? ", CFI" : "");
|
||||
}
|
||||
|
||||
ether_type = EXTRACT_16BITS(p + 2);
|
||||
if (eflag && ether_type > ETHERMTU)
|
||||
printf("ethertype %s, ", tok2str(ethertype_values,"0x%04x", ether_type));
|
||||
p += 4;
|
||||
length -= 4;
|
||||
caplen -= 4;
|
||||
goto recurse;
|
||||
} else if (ether_type == ETHERTYPE_JUMBO) {
|
||||
/*
|
||||
* Alteon jumbo frames.
|
||||
* See
|
||||
*
|
||||
* http://tools.ietf.org/html/draft-ietf-isis-ext-eth-01
|
||||
*
|
||||
* which indicates that, following the type field,
|
||||
* there's an LLC header and payload.
|
||||
*/
|
||||
/* Try to print the LLC-layer header & higher layers */
|
||||
if (llc_print(p, length, caplen, ESRC(ep), EDST(ep),
|
||||
&extracted_ether_type) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag) {
|
||||
if (print_encap_header != NULL)
|
||||
(*print_encap_header)(encap_header_arg);
|
||||
ether_hdr_print((u_char *)ep, orig_length);
|
||||
}
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
} else {
|
||||
if (ethertype_print(ether_type, p, length, caplen) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag) {
|
||||
if (print_encap_header != NULL)
|
||||
(*print_encap_header)(encap_header_arg);
|
||||
ether_hdr_print((u_char *)ep, orig_length);
|
||||
}
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -164,30 +237,21 @@ ether_print(const u_char *p, u_int length, u_int caplen)
|
||||
u_int
|
||||
ether_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
ether_print(p, h->len, h->caplen);
|
||||
ether_print(p, h->len, h->caplen, NULL, NULL);
|
||||
|
||||
return (ETHER_HDRLEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints the packet encapsulated in an Ethernet data segment
|
||||
* (or an equivalent encapsulation), given the Ethernet type code.
|
||||
* Prints the packet payload, given an Ethernet type code for the payload's
|
||||
* protocol.
|
||||
*
|
||||
* Returns non-zero if it can do so, zero if the ethertype is unknown.
|
||||
*
|
||||
* The Ethernet type code is passed through a pointer; if it was
|
||||
* ETHERTYPE_8021Q, it gets updated to be the Ethernet type of
|
||||
* the 802.1Q payload, for the benefit of lower layers that might
|
||||
* want to know what it is.
|
||||
*/
|
||||
|
||||
int
|
||||
ether_encap_print(u_short ether_type, const u_char *p,
|
||||
u_int length, u_int caplen, u_short *extracted_ether_type)
|
||||
ethertype_print(u_short ether_type, const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
recurse:
|
||||
*extracted_ether_type = ether_type;
|
||||
|
||||
switch (ether_type) {
|
||||
|
||||
case ETHERTYPE_IP:
|
||||
@ -224,71 +288,14 @@ ether_encap_print(u_short ether_type, const u_char *p,
|
||||
ipx_print(p, length);
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_8021Q:
|
||||
if (eflag)
|
||||
printf("vlan %u, p %u%s, ",
|
||||
ntohs(*(u_int16_t *)p) & 0xfff,
|
||||
ntohs(*(u_int16_t *)p) >> 13,
|
||||
(ntohs(*(u_int16_t *)p) & 0x1000) ? ", CFI" : "");
|
||||
|
||||
ether_type = ntohs(*(u_int16_t *)(p + 2));
|
||||
p += 4;
|
||||
length -= 4;
|
||||
caplen -= 4;
|
||||
|
||||
if (ether_type > ETHERMTU) {
|
||||
if (eflag)
|
||||
printf("ethertype %s, ",
|
||||
tok2str(ethertype_values,"0x%04x", ether_type));
|
||||
goto recurse;
|
||||
}
|
||||
|
||||
*extracted_ether_type = 0;
|
||||
|
||||
if (llc_print(p, length, caplen, p - 18, p - 12,
|
||||
extracted_ether_type) == 0) {
|
||||
ether_hdr_print(p - 18, length + 4);
|
||||
|
||||
if (!suppress_default_print) {
|
||||
default_print(p - 18, caplen + 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_JUMBO:
|
||||
ether_type = ntohs(*(u_int16_t *)(p));
|
||||
p += 2;
|
||||
length -= 2;
|
||||
caplen -= 2;
|
||||
|
||||
if (ether_type > ETHERMTU) {
|
||||
if (eflag)
|
||||
printf("ethertype %s, ",
|
||||
tok2str(ethertype_values,"0x%04x", ether_type));
|
||||
goto recurse;
|
||||
}
|
||||
|
||||
*extracted_ether_type = 0;
|
||||
|
||||
if (llc_print(p, length, caplen, p - 16, p - 10,
|
||||
extracted_ether_type) == 0) {
|
||||
ether_hdr_print(p - 16, length + 2);
|
||||
|
||||
if (!suppress_default_print) {
|
||||
default_print(p - 16, caplen + 2);
|
||||
}
|
||||
}
|
||||
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_ISO:
|
||||
isoclns_print(p+1, length-1, length-1);
|
||||
return(1);
|
||||
|
||||
case ETHERTYPE_PPPOED:
|
||||
case ETHERTYPE_PPPOES:
|
||||
case ETHERTYPE_PPPOED2:
|
||||
case ETHERTYPE_PPPOES2:
|
||||
pppoe_print(p, length);
|
||||
return (1);
|
||||
|
||||
|
1043
print-forces.c
Normal file
1043
print-forces.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -256,11 +256,10 @@ fr_print(register const u_char *p, u_int length)
|
||||
if (eflag)
|
||||
fr_hdr_print(length, addr_len, dlci, flags, extracted_ethertype);
|
||||
|
||||
if (ether_encap_print(extracted_ethertype,
|
||||
if (ethertype_print(extracted_ethertype,
|
||||
p+addr_len+ETHERTYPE_LEN,
|
||||
length-addr_len-ETHERTYPE_LEN,
|
||||
length-addr_len-ETHERTYPE_LEN,
|
||||
&extracted_ethertype) == 0)
|
||||
length-addr_len-ETHERTYPE_LEN) == 0)
|
||||
/* ether_type not known, probably it wasn't one */
|
||||
printf("UI %02x! ", p[addr_len]);
|
||||
else
|
||||
@ -297,7 +296,7 @@ fr_print(register const u_char *p, u_int length)
|
||||
break;
|
||||
|
||||
case NLPID_SNAP:
|
||||
if (snap_print(p, length, length, &extracted_ethertype, 0) == 0) {
|
||||
if (snap_print(p, length, length, 0) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
fr_hdr_print(length + hdr_len, hdr_len,
|
||||
|
@ -225,6 +225,9 @@ gre_print_0(const u_char *bp, u_int length)
|
||||
case ETHERTYPE_GRE_ISO:
|
||||
isoclns_print(bp, len, len);
|
||||
break;
|
||||
case ETHERTYPE_TEB:
|
||||
ether_print(bp, len, len, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
printf("gre-proto-0x%x", prot);
|
||||
}
|
||||
|
112
print-icmp6.c
112
print-icmp6.c
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.85.2.1 2008-02-05 19:36:58 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.86 2008-02-05 19:36:13 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -62,6 +62,9 @@ static void icmp6_rrenum_print(const u_char *, const u_char *);
|
||||
#define abs(a) ((0 < (a)) ? (a) : -(a))
|
||||
#endif
|
||||
|
||||
/* inline the various RPL definitions */
|
||||
#define ND_RPL_MESSAGE 0x9B
|
||||
|
||||
static struct tok icmp6_type_values[] = {
|
||||
{ ICMP6_DST_UNREACH, "destination unreachable"},
|
||||
{ ICMP6_PACKET_TOO_BIG, "packet too big"},
|
||||
@ -91,6 +94,7 @@ static struct tok icmp6_type_values[] = {
|
||||
{ ICMP6_NI_REPLY, "node information reply"},
|
||||
{ MLD6_MTRACE, "mtrace message"},
|
||||
{ MLD6_MTRACE_RESP, "mtrace response"},
|
||||
{ ND_RPL_MESSAGE, "RPL"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -131,6 +135,7 @@ static struct tok icmp6_opt_values[] = {
|
||||
{ ND_OPT_PREFIX_INFORMATION, "prefix info"},
|
||||
{ ND_OPT_REDIRECTED_HEADER, "redirected header"},
|
||||
{ ND_OPT_MTU, "mtu"},
|
||||
{ ND_OPT_RDNSS, "rdnss"},
|
||||
{ ND_OPT_ADVINTERVAL, "advertisement interval"},
|
||||
{ ND_OPT_HOMEAGENT_INFO, "homeagent information"},
|
||||
{ ND_OPT_ROUTE_INFO, "route info"},
|
||||
@ -232,8 +237,87 @@ static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
|
||||
return (sum);
|
||||
}
|
||||
|
||||
enum ND_RPL_CODE {
|
||||
ND_RPL_DAG_IS=0x01,
|
||||
ND_RPL_DAG_IO=0x02,
|
||||
ND_RPL_DAO =0x04
|
||||
};
|
||||
|
||||
enum ND_RPL_DIO_FLAGS {
|
||||
ND_RPL_DIO_GROUNDED = 0x80,
|
||||
ND_RPL_DIO_DATRIG = 0x40,
|
||||
ND_RPL_DIO_DASUPPORT= 0x20,
|
||||
ND_RPL_DIO_RES4 = 0x10,
|
||||
ND_RPL_DIO_RES3 = 0x08,
|
||||
ND_RPL_DIO_PRF_MASK = 0x07, /* 3-bit preference */
|
||||
};
|
||||
|
||||
struct nd_rpl_dio {
|
||||
u_int8_t rpl_flags;
|
||||
u_int8_t rpl_seq;
|
||||
u_int8_t rpl_instanceid;
|
||||
u_int8_t rpl_dagrank;
|
||||
u_int8_t rpl_dagid[16];
|
||||
};
|
||||
|
||||
static void
|
||||
rpl_print(netdissect_options *ndo,
|
||||
const struct icmp6_hdr *hdr,
|
||||
const u_char *bp, u_int length _U_)
|
||||
{
|
||||
struct nd_rpl_dio *dio = (struct nd_rpl_dio *)bp;
|
||||
|
||||
ND_TCHECK(dio->rpl_dagid);
|
||||
|
||||
switch(hdr->icmp6_code) {
|
||||
case ND_RPL_DAG_IS:
|
||||
ND_PRINT((ndo, ", DAG Information Solicitation"));
|
||||
if(ndo->ndo_vflag) {
|
||||
}
|
||||
break;
|
||||
case ND_RPL_DAG_IO:
|
||||
ND_PRINT((ndo, ", DAG Information Object"));
|
||||
if(ndo->ndo_vflag) {
|
||||
char dagid[65];
|
||||
char *d = dagid;
|
||||
int i;
|
||||
for(i=0;i<16;i++) {
|
||||
if(isprint(dio->rpl_dagid[i])) {
|
||||
*d++ = dio->rpl_dagid[i];
|
||||
} else {
|
||||
int cnt=snprintf(d,4,"0x%02x",
|
||||
dio->rpl_dagid[i]);
|
||||
d += cnt;
|
||||
}
|
||||
}
|
||||
*d++ = '\0';
|
||||
ND_PRINT((ndo, " [seq:%u,instance:%u,rank:%u,dagid:%s]",
|
||||
dio->rpl_seq,
|
||||
dio->rpl_instanceid,
|
||||
dio->rpl_dagrank,
|
||||
dagid));
|
||||
}
|
||||
break;
|
||||
case ND_RPL_DAO:
|
||||
ND_PRINT((ndo, ", Destination Advertisement Object"));
|
||||
if(ndo->ndo_vflag) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ND_PRINT((ndo, ", RPL message, unknown code %u",hdr->icmp6_code));
|
||||
break;
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
ND_PRINT((ndo," [|truncated]"));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
|
||||
icmp6_print(netdissect_options *ndo,
|
||||
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
|
||||
{
|
||||
const struct icmp6_hdr *dp;
|
||||
const struct ip6_hdr *ip;
|
||||
@ -505,6 +589,9 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
|
||||
length - MPADVLEN);
|
||||
}
|
||||
break;
|
||||
case ND_RPL_MESSAGE:
|
||||
rpl_print(ndo, dp, &dp->icmp6_data8[0], length);
|
||||
break;
|
||||
default:
|
||||
printf(", length %u", length);
|
||||
if (vflag <= 1)
|
||||
@ -600,12 +687,14 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
const struct nd_opt_prefix_info *opp;
|
||||
const struct icmp6_opts_redirect *opr;
|
||||
const struct nd_opt_mtu *opm;
|
||||
const struct nd_opt_rdnss *oprd;
|
||||
const struct nd_opt_advinterval *opa;
|
||||
const struct nd_opt_homeagent_info *oph;
|
||||
const struct nd_opt_route_info *opri;
|
||||
const u_char *cp, *ep;
|
||||
struct in6_addr in6, *in6p;
|
||||
size_t l;
|
||||
u_int i;
|
||||
|
||||
#define ECHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) return
|
||||
|
||||
@ -664,6 +753,17 @@ icmp6_opt_print(const u_char *bp, int resid)
|
||||
EXTRACT_32BITS(&opm->nd_opt_mtu_mtu),
|
||||
(op->nd_opt_len != 1) ? "bad option length" : "" );
|
||||
break;
|
||||
case ND_OPT_RDNSS:
|
||||
oprd = (struct nd_opt_rdnss *)op;
|
||||
l = (op->nd_opt_len - 1) / 2;
|
||||
printf(" lifetime %us,",
|
||||
EXTRACT_32BITS(&oprd->nd_opt_rdnss_lifetime));
|
||||
for (i = 0; i < l; i++) {
|
||||
TCHECK(oprd->nd_opt_rdnss_addr[i]);
|
||||
printf(" addr: %s",
|
||||
ip6addr_string(&oprd->nd_opt_rdnss_addr[i]));
|
||||
}
|
||||
break;
|
||||
case ND_OPT_ADVINTERVAL:
|
||||
opa = (struct nd_opt_advinterval *)op;
|
||||
TCHECK(opa->nd_opt_adv_interval);
|
||||
@ -753,7 +853,7 @@ mldv2_report_print(const u_char *bp, u_int len)
|
||||
}
|
||||
|
||||
TCHECK(icp->icmp6_data16[1]);
|
||||
ngroups = ntohs(icp->icmp6_data16[1]);
|
||||
ngroups = EXTRACT_16BITS(&icp->icmp6_data16[1]);
|
||||
printf(", %d group record(s)", ngroups);
|
||||
if (vflag > 0) {
|
||||
/* Print the group records */
|
||||
@ -812,7 +912,7 @@ mldv2_query_print(const u_char *bp, u_int len)
|
||||
return;
|
||||
}
|
||||
TCHECK(icp->icmp6_data16[0]);
|
||||
mrc = ntohs(icp->icmp6_data16[0]);
|
||||
mrc = EXTRACT_16BITS(&icp->icmp6_data16[0]);
|
||||
if (mrc < 32768) {
|
||||
mrt = mrc;
|
||||
} else {
|
||||
@ -841,7 +941,7 @@ mldv2_query_print(const u_char *bp, u_int len)
|
||||
}
|
||||
|
||||
TCHECK2(bp[26], 2);
|
||||
nsrcs = ntohs(*(u_short *)&bp[26]);
|
||||
nsrcs = EXTRACT_16BITS(&bp[26]);
|
||||
if (nsrcs > 0) {
|
||||
if (len < 28 + nsrcs * sizeof(struct in6_addr))
|
||||
printf(" [invalid number of sources]");
|
||||
@ -863,7 +963,7 @@ mldv2_query_print(const u_char *bp, u_int len)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dnsname_print(const u_char *cp, const u_char *ep)
|
||||
{
|
||||
int i;
|
||||
|
@ -508,7 +508,8 @@ ip_print_demux(netdissect_options *ndo,
|
||||
break;
|
||||
|
||||
case IPPROTO_PIM:
|
||||
pim_print(ipds->cp, ipds->len);
|
||||
pim_print(ipds->cp, ipds->len,
|
||||
in_cksum((const u_short*)ipds->cp, ipds->len, 0));
|
||||
break;
|
||||
|
||||
case IPPROTO_VRRP:
|
||||
@ -657,7 +658,7 @@ ip_print(netdissect_options *ndo,
|
||||
printf(")");
|
||||
}
|
||||
|
||||
if ((u_char *)ipds->ip + hlen <= snapend) {
|
||||
if (!Kflag && (u_char *)ipds->ip + hlen <= snapend) {
|
||||
sum = in_cksum((const u_short *)ipds->ip, hlen, 0);
|
||||
if (sum != 0) {
|
||||
ip_sum = EXTRACT_16BITS(&ipds->ip->ip_sum);
|
||||
|
31
print-ip6.c
31
print-ip6.c
@ -36,6 +36,7 @@ static const char rcsid[] _U_ =
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "netdissect.h"
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
@ -43,6 +44,31 @@ static const char rcsid[] _U_ =
|
||||
#include "ip6.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
/*
|
||||
* Compute a V6-style checksum by building a pseudoheader.
|
||||
*/
|
||||
int
|
||||
nextproto6_cksum(const struct ip6_hdr *ip6, const u_short *data,
|
||||
u_int len, u_int next_proto)
|
||||
{
|
||||
size_t i;
|
||||
u_int32_t sum = 0;
|
||||
union ip6_pseudo_hdr phu;
|
||||
|
||||
/* pseudo-header */
|
||||
memset(&phu, 0, sizeof(phu));
|
||||
phu.ph.ph_src = ip6->ip6_src;
|
||||
phu.ph.ph_dst = ip6->ip6_dst;
|
||||
phu.ph.ph_len = htonl(len);
|
||||
phu.ph.ph_nxt = next_proto;
|
||||
|
||||
for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++) {
|
||||
sum += phu.pa[i];
|
||||
}
|
||||
|
||||
return in_cksum(data, len, sum);
|
||||
}
|
||||
|
||||
/*
|
||||
* print an IP6 datagram.
|
||||
*/
|
||||
@ -170,7 +196,7 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
udp_print(cp, len, (const u_char *)ip6, fragmented);
|
||||
return;
|
||||
case IPPROTO_ICMPV6:
|
||||
icmp6_print(cp, len, (const u_char *)ip6, fragmented);
|
||||
icmp6_print(gndo, cp, len, (const u_char *)ip6, fragmented);
|
||||
return;
|
||||
case IPPROTO_AH:
|
||||
advance = ah_print(cp);
|
||||
@ -193,7 +219,8 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
}
|
||||
|
||||
case IPPROTO_PIM:
|
||||
pim_print(cp, len);
|
||||
pim_print(cp, len, nextproto6_cksum(ip6, (u_short *)cp, len,
|
||||
IPPROTO_PIM));
|
||||
return;
|
||||
|
||||
case IPPROTO_OSPF:
|
||||
|
109
print-ipnet.c
Normal file
109
print-ipnet.c
Normal file
@ -0,0 +1,109 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "netdissect.h"
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ipnet.h"
|
||||
|
||||
#ifdef DLT_IPNET
|
||||
|
||||
const struct tok ipnet_values[] = {
|
||||
{ IPH_AF_INET, "IPv4" },
|
||||
{ IPH_AF_INET6, "IPv6" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static inline void
|
||||
ipnet_hdr_print(struct netdissect_options *ndo, const u_char *bp, u_int length)
|
||||
{
|
||||
const ipnet_hdr_t *hdr;
|
||||
hdr = (const ipnet_hdr_t *)bp;
|
||||
|
||||
ND_PRINT((ndo, "%d > %d", hdr->iph_zsrc, hdr->iph_zdst));
|
||||
|
||||
if (!ndo->ndo_qflag) {
|
||||
ND_PRINT((ndo,", family %s (%d)",
|
||||
tok2str(ipnet_values, "Unknown",
|
||||
hdr->iph_family),
|
||||
hdr->iph_family));
|
||||
} else {
|
||||
ND_PRINT((ndo,", %s",
|
||||
tok2str(ipnet_values,
|
||||
"Unknown Ethertype (0x%04x)",
|
||||
hdr->iph_family)));
|
||||
}
|
||||
|
||||
ND_PRINT((ndo, ", length %u: ", length));
|
||||
}
|
||||
|
||||
static void
|
||||
ipnet_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
ipnet_hdr_t *hdr;
|
||||
|
||||
if (caplen < sizeof(ipnet_hdr_t)) {
|
||||
ND_PRINT((ndo, "[|ipnet]"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ndo->ndo_eflag)
|
||||
ipnet_hdr_print(ndo, p, length);
|
||||
|
||||
length -= sizeof(ipnet_hdr_t);
|
||||
caplen -= sizeof(ipnet_hdr_t);
|
||||
hdr = (ipnet_hdr_t *)p;
|
||||
p += sizeof(ipnet_hdr_t);
|
||||
|
||||
switch (hdr->iph_family) {
|
||||
|
||||
case IPH_AF_INET:
|
||||
ip_print(ndo, p, length);
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case IPH_AF_INET6:
|
||||
ip6_print(p, length);
|
||||
break;
|
||||
#endif /*INET6*/
|
||||
|
||||
default:
|
||||
if (!ndo->ndo_eflag)
|
||||
ipnet_hdr_print(ndo, (u_char *)hdr,
|
||||
length + sizeof(ipnet_hdr_t));
|
||||
|
||||
if (!ndo->ndo_suppress_default_print)
|
||||
ndo->ndo_default_print(ndo, p, caplen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the ether header of the packet, 'h->ts' is the timestamp,
|
||||
* 'h->len' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
u_int
|
||||
ipnet_if_print(struct netdissect_options *ndo,
|
||||
const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
ipnet_print(ndo, p, h->len, h->caplen);
|
||||
|
||||
return (sizeof(ipnet_hdr_t));
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: whitesmith
|
||||
* c-basic-offset: 8
|
||||
* End:
|
||||
*/
|
||||
|
||||
#endif /* DLT_IPNET */
|
259
print-isakmp.c
259
print-isakmp.c
@ -30,7 +30,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.56 2007-08-29 12:31:00 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.61 2008-02-05 19:34:25 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#define NETDISSECT_REWORKED
|
||||
@ -94,16 +94,27 @@ DECLARE_PRINTER(v2_n);
|
||||
DECLARE_PRINTER(v2_d);
|
||||
DECLARE_PRINTER(v2_vid);
|
||||
DECLARE_PRINTER(v2_TS);
|
||||
DECLARE_PRINTER(v2_e);
|
||||
DECLARE_PRINTER(v2_cp);
|
||||
DECLARE_PRINTER(v2_eap);
|
||||
|
||||
static const u_char *ikev2_e_print(netdissect_options *ndo,
|
||||
struct isakmp *base,
|
||||
u_char tpay,
|
||||
const struct isakmp_gen *ext,
|
||||
u_int item_len,
|
||||
const u_char *end_pointer,
|
||||
u_int32_t phase,
|
||||
u_int32_t doi0,
|
||||
u_int32_t proto0, int depth);
|
||||
|
||||
|
||||
static const u_char *ike_sub0_print(netdissect_options *ndo,u_char, const struct isakmp_gen *,
|
||||
const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
|
||||
static const u_char *ikev1_sub_print(netdissect_options *ndo,u_char, const struct isakmp_gen *,
|
||||
const u_char *, u_int32_t, u_int32_t, u_int32_t, int);
|
||||
|
||||
static const u_char *ikev2_sub_print(netdissect_options *ndo,
|
||||
struct isakmp *base,
|
||||
u_char np, const struct isakmp_gen *ext,
|
||||
const u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto,
|
||||
@ -185,7 +196,7 @@ static const u_char *(*npfunc[])(netdissect_options *ndo, u_char tpay,
|
||||
ikev2_vid_print, /* 43 */
|
||||
ikev2_TS_print, /* 44 */
|
||||
ikev2_TS_print, /* 45 */
|
||||
ikev2_e_print, /* 46 */
|
||||
NULL, /* ikev2_e_print,*/ /* 46 - special */
|
||||
ikev2_cp_print, /* 47 */
|
||||
ikev2_eap_print, /* 48 */
|
||||
};
|
||||
@ -391,22 +402,29 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rawprint(netdissect_options *ndo, caddr_t loc, size_t len)
|
||||
static void
|
||||
hexprint(netdissect_options *ndo, caddr_t loc, size_t len)
|
||||
{
|
||||
static u_char *p;
|
||||
u_char *p;
|
||||
size_t i;
|
||||
|
||||
ND_TCHECK2(*loc, len);
|
||||
|
||||
p = (u_char *)loc;
|
||||
for (i = 0; i < len; i++)
|
||||
ND_PRINT((ndo,"%02x", p[i] & 0xff));
|
||||
}
|
||||
|
||||
static int
|
||||
rawprint(netdissect_options *ndo, caddr_t loc, size_t len)
|
||||
{
|
||||
ND_TCHECK2(*loc, len);
|
||||
|
||||
hexprint(ndo, loc, len);
|
||||
return 1;
|
||||
trunc:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* returns false if we run out of data buffer
|
||||
*/
|
||||
@ -1495,8 +1513,9 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
|
||||
safememcpy(&prop, ext, sizeof(prop));
|
||||
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), prop.h.critical);
|
||||
|
||||
ND_PRINT((ndo," #%u protoid=%s transform=%d",
|
||||
prop.p_no, PROTOIDSTR(prop.prot_id), prop.num_t));
|
||||
ND_PRINT((ndo," #%u protoid=%s transform=%d len=%u",
|
||||
prop.p_no, PROTOIDSTR(prop.prot_id),
|
||||
prop.num_t, ntohs(prop.h.len)));
|
||||
if (prop.spi_size) {
|
||||
ND_PRINT((ndo," spi="));
|
||||
if (!rawprint(ndo, (caddr_t)(p + 1), prop.spi_size))
|
||||
@ -1505,8 +1524,8 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
|
||||
|
||||
ext = (struct isakmp_gen *)((u_char *)(p + 1) + prop.spi_size);
|
||||
ND_TCHECK(*ext);
|
||||
|
||||
cp = ikev2_sub_print(ndo, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
|
||||
|
||||
cp = ikev2_sub_print(ndo, NULL, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
|
||||
prop.prot_id, depth);
|
||||
|
||||
return cp;
|
||||
@ -1523,21 +1542,21 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay,
|
||||
u_int32_t proto _U_, int depth _U_)
|
||||
{
|
||||
struct isakmp_gen e;
|
||||
int osa_len, sa_len;
|
||||
int osa_length, sa_length;
|
||||
|
||||
ND_TCHECK(*ext1);
|
||||
safememcpy(&e, ext1, sizeof(e));
|
||||
ikev2_pay_print(ndo, "sa", e.critical);
|
||||
|
||||
osa_len= ntohs(e.len);
|
||||
sa_len = osa_len - 4;
|
||||
ND_PRINT((ndo," len=%d", sa_len));
|
||||
osa_length= ntohs(e.len);
|
||||
sa_length = osa_length - 4;
|
||||
ND_PRINT((ndo," len=%d", sa_length));
|
||||
|
||||
ikev2_sub_print(ndo, ISAKMP_NPTYPE_P,
|
||||
ikev2_sub_print(ndo, NULL, ISAKMP_NPTYPE_P,
|
||||
ext1+1, ep,
|
||||
0, 0, 0, depth);
|
||||
|
||||
return (u_char *)ext1 + osa_len;
|
||||
return (u_char *)ext1 + osa_length;
|
||||
trunc:
|
||||
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
|
||||
return NULL;
|
||||
@ -1579,7 +1598,79 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
|
||||
u_int32_t phase _U_, u_int32_t doi _U_,
|
||||
u_int32_t proto _U_, int depth _U_)
|
||||
{
|
||||
return ikev2_gen_print(ndo, tpay, ext);
|
||||
struct ikev2_id id;
|
||||
int id_len, idtype_len, i;
|
||||
unsigned int dumpascii, dumphex;
|
||||
unsigned char *typedata;
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
safememcpy(&id, ext, sizeof(id));
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), id.h.critical);
|
||||
|
||||
id_len = ntohs(id.h.len);
|
||||
|
||||
ND_PRINT((ndo," len=%d", id_len - 4));
|
||||
if (2 < ndo->ndo_vflag && 4 < id_len) {
|
||||
ND_PRINT((ndo," "));
|
||||
if (!rawprint(ndo, (caddr_t)(ext + 1), id_len - 4))
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
idtype_len =id_len - sizeof(struct ikev2_id);
|
||||
dumpascii = 0;
|
||||
dumphex = 0;
|
||||
typedata = (unsigned char *)(ext)+sizeof(struct ikev2_id);
|
||||
|
||||
switch(id.type) {
|
||||
case ID_IPV4_ADDR:
|
||||
ND_PRINT((ndo, " ipv4:"));
|
||||
dumphex=1;
|
||||
break;
|
||||
case ID_FQDN:
|
||||
ND_PRINT((ndo, " fqdn:"));
|
||||
dumpascii=1;
|
||||
break;
|
||||
case ID_RFC822_ADDR:
|
||||
ND_PRINT((ndo, " rfc822:"));
|
||||
dumpascii=1;
|
||||
break;
|
||||
case ID_IPV6_ADDR:
|
||||
ND_PRINT((ndo, " ipv6:"));
|
||||
dumphex=1;
|
||||
break;
|
||||
case ID_DER_ASN1_DN:
|
||||
ND_PRINT((ndo, " dn:"));
|
||||
dumphex=1;
|
||||
break;
|
||||
case ID_DER_ASN1_GN:
|
||||
ND_PRINT((ndo, " gn:"));
|
||||
dumphex=1;
|
||||
break;
|
||||
case ID_KEY_ID:
|
||||
ND_PRINT((ndo, " keyid:"));
|
||||
dumphex=1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(dumpascii) {
|
||||
ND_TCHECK2(*typedata, idtype_len);
|
||||
for(i=0; i<idtype_len; i++) {
|
||||
if(isprint(typedata[i])) {
|
||||
ND_PRINT((ndo, "%c", typedata[i]));
|
||||
} else {
|
||||
ND_PRINT((ndo, "."));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dumphex) {
|
||||
if (!rawprint(ndo, (caddr_t)typedata, idtype_len))
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
return (u_char *)ext + id_len;
|
||||
trunc:
|
||||
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const u_char *
|
||||
@ -1609,27 +1700,30 @@ ikev2_auth_print(netdissect_options *ndo, u_char tpay,
|
||||
u_int32_t phase _U_, u_int32_t doi _U_,
|
||||
u_int32_t proto _U_, int depth _U_)
|
||||
{
|
||||
struct ikev2_auth e;
|
||||
struct ikev2_auth a;
|
||||
const char *v2_auth[]={ "invalid", "rsasig",
|
||||
"shared-secret", "dsssig" };
|
||||
u_char *authdata = (u_char*)ext + sizeof(a);
|
||||
unsigned int len;
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), e.h.critical);
|
||||
safememcpy(&a, ext, sizeof(a));
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), a.h.critical);
|
||||
len = ntohs(a.h.len);
|
||||
|
||||
ND_PRINT((ndo," len=%d method=%s", ntohs(e.h.len) - 4,
|
||||
STR_OR_ID(e.auth_method, v2_auth)));
|
||||
ND_PRINT((ndo," len=%d method=%s", len-4,
|
||||
STR_OR_ID(a.auth_method, v2_auth)));
|
||||
|
||||
if (1 < ndo->ndo_vflag && 4 < ntohs(e.h.len)) {
|
||||
if (1 < ndo->ndo_vflag && 4 < len) {
|
||||
ND_PRINT((ndo," authdata=("));
|
||||
if (!rawprint(ndo, (caddr_t)(ext + 1), ntohs(e.h.len) - 4))
|
||||
if (!rawprint(ndo, (caddr_t)authdata, len - sizeof(a)))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo,") "));
|
||||
} else if(ndo->ndo_vflag && 4 < ntohs(e.h.len)) {
|
||||
if(!ike_show_somedata(ndo, (const u_char *)(ext+1), ep)) goto trunc;
|
||||
} else if(ndo->ndo_vflag && 4 < len) {
|
||||
if(!ike_show_somedata(ndo, authdata, ep)) goto trunc;
|
||||
}
|
||||
|
||||
return (u_char *)ext + ntohs(e.h.len);
|
||||
return (u_char *)ext + len;
|
||||
trunc:
|
||||
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
|
||||
return NULL;
|
||||
@ -1905,7 +1999,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
|
||||
ND_TCHECK2(*vid, len);
|
||||
for(i=0; i<len; i++) {
|
||||
if(isprint(vid[i])) ND_PRINT((ndo, "%c", vid[i]));
|
||||
else ND_PRINT((ndo, ".", vid[i]));
|
||||
else ND_PRINT((ndo, "."));
|
||||
}
|
||||
if (2 < ndo->ndo_vflag && 4 < len) {
|
||||
ND_PRINT((ndo," "));
|
||||
@ -1929,13 +2023,74 @@ ikev2_TS_print(netdissect_options *ndo, u_char tpay,
|
||||
}
|
||||
|
||||
static const u_char *
|
||||
ikev2_e_print(netdissect_options *ndo, u_char tpay,
|
||||
const struct isakmp_gen *ext,
|
||||
u_int item_len _U_, const u_char *ep _U_,
|
||||
u_int32_t phase _U_, u_int32_t doi _U_,
|
||||
u_int32_t proto _U_, int depth _U_)
|
||||
ikev2_e_print(netdissect_options *ndo,
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
struct isakmp *base,
|
||||
u_char tpay,
|
||||
const struct isakmp_gen *ext,
|
||||
u_int item_len _U_, const u_char *ep _U_,
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
u_int32_t phase,
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
u_int32_t doi,
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
u_int32_t proto,
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
int depth)
|
||||
{
|
||||
return ikev2_gen_print(ndo, tpay, ext);
|
||||
struct isakmp_gen e;
|
||||
u_char *dat;
|
||||
volatile int dlen;
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), e.critical);
|
||||
|
||||
dlen = ntohs(e.len)-4;
|
||||
|
||||
ND_PRINT((ndo," len=%d", dlen));
|
||||
if (2 < ndo->ndo_vflag && 4 < dlen) {
|
||||
ND_PRINT((ndo," "));
|
||||
if (!rawprint(ndo, (caddr_t)(ext + 1), dlen))
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
dat = (u_char *)(ext+1);
|
||||
ND_TCHECK2(*dat, dlen);
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
/* try to decypt it! */
|
||||
if(esp_print_decrypt_buffer_by_ikev2(ndo,
|
||||
base->flags & ISAKMP_FLAG_I,
|
||||
base->i_ck, base->r_ck,
|
||||
dat, dat+dlen)) {
|
||||
|
||||
ext = (const struct isakmp_gen *)ndo->ndo_packetp;
|
||||
|
||||
/* got it decrypted, print stuff inside. */
|
||||
ikev2_sub_print(ndo, base, e.np, ext, ndo->ndo_snapend,
|
||||
phase, doi, proto, depth+1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* always return NULL, because E must be at end, and NP refers
|
||||
* to what was inside.
|
||||
*/
|
||||
return NULL;
|
||||
trunc:
|
||||
ND_PRINT((ndo," [|%s]", NPSTR(tpay)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const u_char *
|
||||
@ -1961,7 +2116,8 @@ ikev2_eap_print(netdissect_options *ndo, u_char tpay,
|
||||
static const u_char *
|
||||
ike_sub0_print(netdissect_options *ndo,
|
||||
u_char np, const struct isakmp_gen *ext, const u_char *ep,
|
||||
u_int32_t phase, u_int32_t doi, u_int32_t proto, int depth)
|
||||
|
||||
u_int32_t phase, u_int32_t doi, u_int32_t proto, int depth)
|
||||
{
|
||||
const u_char *cp;
|
||||
struct isakmp_gen e;
|
||||
@ -2058,7 +2214,7 @@ safememcpy(void *p, const void *q, size_t l)
|
||||
memcpy(p, q, l);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ikev1_print(netdissect_options *ndo,
|
||||
const u_char *bp, u_int length,
|
||||
const u_char *bp2, struct isakmp *base)
|
||||
@ -2135,7 +2291,8 @@ ikev1_print(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
static const u_char *
|
||||
ikev2_sub0_print(netdissect_options *ndo, u_char np, int pcount,
|
||||
ikev2_sub0_print(netdissect_options *ndo, struct isakmp *base,
|
||||
u_char np, int pcount,
|
||||
const struct isakmp_gen *ext, const u_char *ep,
|
||||
u_int32_t phase, u_int32_t doi, u_int32_t proto, int depth)
|
||||
{
|
||||
@ -2163,6 +2320,9 @@ ikev2_sub0_print(netdissect_options *ndo, u_char np, int pcount,
|
||||
} else if(np == ISAKMP_NPTYPE_T) {
|
||||
cp = ikev2_t_print(ndo, np, pcount, ext, item_len,
|
||||
ep, phase, doi, proto, depth);
|
||||
} else if(np == ISAKMP_NPTYPE_v2E) {
|
||||
cp = ikev2_e_print(ndo, base, np, ext, item_len,
|
||||
ep, phase, doi, proto, depth);
|
||||
} else if (NPFUNC(np)) {
|
||||
/*
|
||||
* XXX - what if item_len is too short, or too long,
|
||||
@ -2183,6 +2343,7 @@ ikev2_sub0_print(netdissect_options *ndo, u_char np, int pcount,
|
||||
|
||||
static const u_char *
|
||||
ikev2_sub_print(netdissect_options *ndo,
|
||||
struct isakmp *base,
|
||||
u_char np, const struct isakmp_gen *ext, const u_char *ep,
|
||||
u_int32_t phase, u_int32_t doi, u_int32_t proto, int depth)
|
||||
{
|
||||
@ -2206,7 +2367,7 @@ ikev2_sub_print(netdissect_options *ndo,
|
||||
for (i = 0; i < depth; i++)
|
||||
ND_PRINT((ndo," "));
|
||||
ND_PRINT((ndo,"("));
|
||||
cp = ikev2_sub0_print(ndo, np, pcount,
|
||||
cp = ikev2_sub0_print(ndo, base, np, pcount,
|
||||
ext, ep, phase, doi, proto, depth);
|
||||
ND_PRINT((ndo,")"));
|
||||
depth--;
|
||||
@ -2246,7 +2407,7 @@ ikev2_print(netdissect_options *ndo,
|
||||
|
||||
ND_PRINT((ndo, " %s", ETYPESTR(base->etype)));
|
||||
if (base->flags) {
|
||||
ND_PRINT((ndo, "[%s%s]",
|
||||
ND_PRINT((ndo, "[%s%s%s]",
|
||||
base->flags & ISAKMP_FLAG_I ? "I" : "",
|
||||
base->flags & ISAKMP_FLAG_V ? "V" : "",
|
||||
base->flags & ISAKMP_FLAG_R ? "R" : ""));
|
||||
@ -2273,7 +2434,7 @@ ikev2_print(netdissect_options *ndo,
|
||||
|
||||
np = base->np;
|
||||
ext = (struct isakmp_gen *)(p + 1);
|
||||
ikev2_sub_print(ndo, np, ext, ep, phase, 0, 0, 0);
|
||||
ikev2_sub_print(ndo, base, np, ext, ep, phase, 0, 0, 0);
|
||||
}
|
||||
|
||||
done:
|
||||
@ -2295,6 +2456,14 @@ isakmp_print(netdissect_options *ndo,
|
||||
const u_char *ep;
|
||||
int major, minor;
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
/* initialize SAs */
|
||||
if (ndo->ndo_sa_list_head == NULL) {
|
||||
if (ndo->ndo_espsecret)
|
||||
esp_print_decodesecret(ndo);
|
||||
}
|
||||
#endif
|
||||
|
||||
p = (const struct isakmp *)bp;
|
||||
ep = ndo->ndo_snapend;
|
||||
|
||||
@ -2317,14 +2486,14 @@ isakmp_print(netdissect_options *ndo,
|
||||
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_PRINT((ndo," msgid "));
|
||||
rawprint(ndo, (caddr_t)&base.msgid, sizeof(base.msgid));
|
||||
hexprint(ndo, (caddr_t)&base.msgid, sizeof(base.msgid));
|
||||
}
|
||||
|
||||
if (1 < ndo->ndo_vflag) {
|
||||
ND_PRINT((ndo," cookie "));
|
||||
rawprint(ndo, (caddr_t)&base.i_ck, sizeof(base.i_ck));
|
||||
hexprint(ndo, (caddr_t)&base.i_ck, sizeof(base.i_ck));
|
||||
ND_PRINT((ndo,"->"));
|
||||
rawprint(ndo, (caddr_t)&base.r_ck, sizeof(base.r_ck));
|
||||
hexprint(ndo, (caddr_t)&base.r_ck, sizeof(base.r_ck));
|
||||
}
|
||||
ND_PRINT((ndo,":"));
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.163 2007-03-02 09:16:19 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.165 2008-08-16 13:38:15 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -46,6 +46,7 @@ static const char rcsid[] _U_ =
|
||||
#include "extract.h"
|
||||
#include "gmpls.h"
|
||||
#include "oui.h"
|
||||
#include "signature.h"
|
||||
|
||||
/*
|
||||
* IS-IS is defined in ISO 10589. Look there for protocol definitions.
|
||||
@ -1764,7 +1765,7 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
|
||||
const struct isis_iih_lan_header *header_iih_lan;
|
||||
const struct isis_iih_ptp_header *header_iih_ptp;
|
||||
const struct isis_lsp_header *header_lsp;
|
||||
struct isis_lsp_header *header_lsp;
|
||||
const struct isis_csnp_header *header_csnp;
|
||||
const struct isis_psnp_header *header_psnp;
|
||||
|
||||
@ -1778,16 +1779,18 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
const u_int8_t *optr, *pptr, *tptr;
|
||||
u_short packet_len,pdu_len;
|
||||
u_int i,vendor_id;
|
||||
int sigcheck;
|
||||
|
||||
packet_len=length;
|
||||
optr = p; /* initialize the _o_riginal pointer to the packet start -
|
||||
need it for parsing the checksum TLV */
|
||||
need it for parsing the checksum TLV and authentication
|
||||
TLV verification */
|
||||
isis_header = (const struct isis_common_header *)p;
|
||||
TCHECK(*isis_header);
|
||||
pptr = p+(ISIS_COMMON_HEADER_SIZE);
|
||||
header_iih_lan = (const struct isis_iih_lan_header *)pptr;
|
||||
header_iih_ptp = (const struct isis_iih_ptp_header *)pptr;
|
||||
header_lsp = (const struct isis_lsp_header *)pptr;
|
||||
header_lsp = (struct isis_lsp_header *)pptr;
|
||||
header_csnp = (const struct isis_csnp_header *)pptr;
|
||||
header_psnp = (const struct isis_psnp_header *)pptr;
|
||||
|
||||
@ -2013,6 +2016,15 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
osi_print_cksum((u_int8_t *)header_lsp->lsp_id,
|
||||
EXTRACT_16BITS(header_lsp->checksum), 12, length-12);
|
||||
|
||||
/*
|
||||
* Clear checksum and lifetime prior to signature verification.
|
||||
*/
|
||||
header_lsp->checksum[0] = 0;
|
||||
header_lsp->checksum[1] = 0;
|
||||
header_lsp->remaining_lifetime[0] = 0;
|
||||
header_lsp->remaining_lifetime[1] = 0;
|
||||
|
||||
|
||||
printf(", PDU length: %u, Flags: [ %s",
|
||||
pdu_len,
|
||||
ISIS_MASK_LSP_OL_BIT(header_lsp->typeblock) ? "Overload bit set, " : "");
|
||||
@ -2188,13 +2200,12 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_MT_IS_REACH:
|
||||
mt_len = isis_print_mtid(tptr, "\n\t ");
|
||||
if (mt_len == 0) /* did something go wrong ? */
|
||||
goto trunctlv;
|
||||
tptr+=mt_len;
|
||||
tmp-=mt_len;
|
||||
while (tmp >= 2+NODE_ID_LEN+3+1) {
|
||||
mt_len = isis_print_mtid(tptr, "\n\t ");
|
||||
if (mt_len == 0) /* did something go wrong ? */
|
||||
goto trunctlv;
|
||||
tptr+=mt_len;
|
||||
tmp-=mt_len;
|
||||
|
||||
ext_is_len = isis_print_ext_is_reach(tptr,"\n\t ",tlv_type);
|
||||
if (ext_is_len == 0) /* did something go wrong ? */
|
||||
goto trunctlv;
|
||||
@ -2355,6 +2366,15 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
}
|
||||
if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1)
|
||||
printf(", (malformed subTLV) ");
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
sigcheck = signature_verify(optr, length,
|
||||
(unsigned char *)tptr + 1);
|
||||
#else
|
||||
sigcheck = CANT_CHECK_SIGNATURE;
|
||||
#endif
|
||||
printf(" (%s)", tok2str(signature_check_values, "Unknown", sigcheck));
|
||||
|
||||
break;
|
||||
case ISIS_SUBTLV_AUTH_PRIVATE:
|
||||
default:
|
||||
|
@ -647,7 +647,7 @@ juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
|
||||
p+=l2info.header_len;
|
||||
/* this DLT contains nothing but raw ethernet frames */
|
||||
ether_print(p, l2info.length, l2info.caplen);
|
||||
ether_print(p, l2info.length, l2info.caplen, NULL, NULL);
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
@ -664,7 +664,7 @@ juniper_ether_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
|
||||
p+=l2info.header_len;
|
||||
/* this DLT contains nothing but raw Ethernet frames */
|
||||
ether_print(p, l2info.length, l2info.caplen);
|
||||
ether_print(p, l2info.length, l2info.caplen, NULL, NULL);
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
@ -736,11 +736,10 @@ juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
extracted_ethertype = EXTRACT_16BITS(p);
|
||||
/* this DLT contains nothing but raw PPPoE frames,
|
||||
* prepended with a type field*/
|
||||
if (ether_encap_print(extracted_ethertype,
|
||||
if (ethertype_print(extracted_ethertype,
|
||||
p+ETHERTYPE_LEN,
|
||||
l2info.length-ETHERTYPE_LEN,
|
||||
l2info.caplen-ETHERTYPE_LEN,
|
||||
&extracted_ethertype) == 0)
|
||||
l2info.caplen-ETHERTYPE_LEN) == 0)
|
||||
/* ether_type not known, probably it wasn't one */
|
||||
printf("unknown ethertype 0x%04x", extracted_ethertype);
|
||||
|
||||
@ -988,7 +987,7 @@ juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
|
||||
if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
|
||||
(EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
|
||||
ether_print(p, l2info.length, l2info.caplen);
|
||||
ether_print(p, l2info.length, l2info.caplen, NULL, NULL);
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
|
41
print-l2tp.c
41
print-l2tp.c
@ -606,7 +606,7 @@ l2tp_avp_print(const u_char *dat, int length)
|
||||
void
|
||||
l2tp_print(const u_char *dat, u_int length)
|
||||
{
|
||||
const u_int16_t *ptr = (u_int16_t *)dat;
|
||||
const u_char *ptr = dat;
|
||||
u_int cnt = 0; /* total octets consumed */
|
||||
u_int16_t pad;
|
||||
int flag_t, flag_l, flag_s, flag_o;
|
||||
@ -614,7 +614,7 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
|
||||
flag_t = flag_l = flag_s = flag_o = FALSE;
|
||||
|
||||
TCHECK(*ptr); /* Flags & Version */
|
||||
TCHECK2(*ptr, 2); /* Flags & Version */
|
||||
if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
|
||||
printf(" l2tp:");
|
||||
} else if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
|
||||
@ -646,37 +646,42 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
printf("P");
|
||||
printf("]");
|
||||
|
||||
ptr++;
|
||||
ptr += 2;
|
||||
cnt += 2;
|
||||
|
||||
if (flag_l) {
|
||||
TCHECK(*ptr); /* Length */
|
||||
l2tp_len = EXTRACT_16BITS(ptr); ptr++;
|
||||
TCHECK2(*ptr, 2); /* Length */
|
||||
l2tp_len = EXTRACT_16BITS(ptr);
|
||||
ptr += 2;
|
||||
cnt += 2;
|
||||
} else {
|
||||
l2tp_len = 0;
|
||||
}
|
||||
|
||||
TCHECK(*ptr); /* Tunnel ID */
|
||||
printf("(%u/", EXTRACT_16BITS(ptr)); ptr++;
|
||||
TCHECK2(*ptr, 2); /* Tunnel ID */
|
||||
printf("(%u/", EXTRACT_16BITS(ptr));
|
||||
ptr += 2;
|
||||
cnt += 2;
|
||||
TCHECK(*ptr); /* Session ID */
|
||||
printf("%u)", EXTRACT_16BITS(ptr)); ptr++;
|
||||
TCHECK2(*ptr, 2); /* Session ID */
|
||||
printf("%u)", EXTRACT_16BITS(ptr));
|
||||
ptr += 2;
|
||||
cnt += 2;
|
||||
|
||||
if (flag_s) {
|
||||
TCHECK(*ptr); /* Ns */
|
||||
printf("Ns=%u,", EXTRACT_16BITS(ptr)); ptr++;
|
||||
TCHECK2(*ptr, 2); /* Ns */
|
||||
printf("Ns=%u,", EXTRACT_16BITS(ptr));
|
||||
ptr += 2;
|
||||
cnt += 2;
|
||||
TCHECK(*ptr); /* Nr */
|
||||
printf("Nr=%u", EXTRACT_16BITS(ptr)); ptr++;
|
||||
TCHECK2(*ptr, 2); /* Nr */
|
||||
printf("Nr=%u", EXTRACT_16BITS(ptr));
|
||||
ptr += 2;
|
||||
cnt += 2;
|
||||
}
|
||||
|
||||
if (flag_o) {
|
||||
TCHECK(*ptr); /* Offset Size */
|
||||
pad = EXTRACT_16BITS(ptr); ptr++;
|
||||
ptr += pad / sizeof(*ptr);
|
||||
TCHECK2(*ptr, 2); /* Offset Size */
|
||||
pad = EXTRACT_16BITS(ptr);
|
||||
ptr += (2 + pad);
|
||||
cnt += (2 + pad);
|
||||
}
|
||||
|
||||
@ -699,11 +704,11 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
if (length - cnt == 0) {
|
||||
printf(" ZLB");
|
||||
} else {
|
||||
l2tp_avp_print((u_char *)ptr, length - cnt);
|
||||
l2tp_avp_print(ptr, length - cnt);
|
||||
}
|
||||
} else {
|
||||
printf(" {");
|
||||
ppp_print((u_char *)ptr, length - cnt);
|
||||
ppp_print(ptr, length - cnt);
|
||||
printf("}");
|
||||
}
|
||||
|
||||
|
73
print-lane.c
73
print-lane.c
@ -60,25 +60,10 @@ static const struct tok lecop2str[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static inline void
|
||||
lane_hdr_print(register const u_char *bp, int length)
|
||||
static void
|
||||
lane_hdr_print(const u_char *bp)
|
||||
{
|
||||
register const struct lecdatahdr_8023 *ep;
|
||||
|
||||
ep = (const struct lecdatahdr_8023 *)bp;
|
||||
if (qflag)
|
||||
(void)printf("lecid:%x %s %s %d: ",
|
||||
EXTRACT_16BITS(&ep->le_header),
|
||||
etheraddr_string(ep->h_source),
|
||||
etheraddr_string(ep->h_dest),
|
||||
length);
|
||||
else
|
||||
(void)printf("lecid:%x %s %s %s %d: ",
|
||||
EXTRACT_16BITS(&ep->le_header),
|
||||
etheraddr_string(ep->h_source),
|
||||
etheraddr_string(ep->h_dest),
|
||||
etherproto_string(ep->h_type),
|
||||
length);
|
||||
(void)printf("lecid:%x ", EXTRACT_16BITS(bp));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -93,9 +78,6 @@ void
|
||||
lane_print(const u_char *p, u_int length, u_int caplen)
|
||||
{
|
||||
struct lane_controlhdr *lec;
|
||||
struct lecdatahdr_8023 *ep;
|
||||
u_short ether_type;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
if (caplen < sizeof(struct lane_controlhdr)) {
|
||||
printf("[|lane]");
|
||||
@ -113,49 +95,18 @@ lane_print(const u_char *p, u_int length, u_int caplen)
|
||||
return;
|
||||
}
|
||||
|
||||
if (caplen < sizeof(struct lecdatahdr_8023)) {
|
||||
printf("[|lane]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
lane_hdr_print(p, length);
|
||||
/*
|
||||
* Go past the LE header.
|
||||
*/
|
||||
length -= 2;
|
||||
caplen -= 2;
|
||||
p += 2;
|
||||
|
||||
/*
|
||||
* Go past the LANE header.
|
||||
* Now print the encapsulated frame, under the assumption
|
||||
* that it's an Ethernet frame.
|
||||
*/
|
||||
length -= sizeof(struct lecdatahdr_8023);
|
||||
caplen -= sizeof(struct lecdatahdr_8023);
|
||||
ep = (struct lecdatahdr_8023 *)p;
|
||||
p += sizeof(struct lecdatahdr_8023);
|
||||
|
||||
ether_type = EXTRACT_16BITS(&ep->h_type);
|
||||
|
||||
/*
|
||||
* Is it (gag) an 802.3 encapsulation?
|
||||
*/
|
||||
if (ether_type <= ETHERMTU) {
|
||||
/* Try to print the LLC-layer header & higher layers */
|
||||
if (llc_print(p, length, caplen, ep->h_source, ep->h_dest,
|
||||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
lane_hdr_print((u_char *)ep, length + sizeof(*ep));
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
}
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
lane_hdr_print((u_char *)ep, length + sizeof(*ep));
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
ether_print(p, length, caplen, lane_hdr_print, p - 2);
|
||||
}
|
||||
|
||||
u_int
|
||||
|
14
print-llc.c
14
print-llc.c
@ -309,8 +309,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
* Does anybody ever bridge one form of LAN traffic
|
||||
* over a networking type that uses 802.2 LLC?
|
||||
*/
|
||||
ret = snap_print(p+3, length-3, caplen-3, extracted_ethertype,
|
||||
2);
|
||||
ret = snap_print(p+3, length-3, caplen-3, 2);
|
||||
if (ret)
|
||||
return (ret);
|
||||
}
|
||||
@ -378,8 +377,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
}
|
||||
|
||||
int
|
||||
snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
u_short *extracted_ethertype, u_int bridge_pad)
|
||||
snap_print(const u_char *p, u_int length, u_int caplen, u_int bridge_pad)
|
||||
{
|
||||
u_int32_t orgcode;
|
||||
register u_short et;
|
||||
@ -419,8 +417,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
* Cisco hardware; the protocol ID is
|
||||
* an Ethernet protocol type.
|
||||
*/
|
||||
ret = ether_encap_print(et, p, length, caplen,
|
||||
extracted_ethertype);
|
||||
ret = ethertype_print(et, p, length, caplen);
|
||||
if (ret)
|
||||
return (ret);
|
||||
break;
|
||||
@ -435,8 +432,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
* but used 0x000000 and an Ethernet
|
||||
* packet type for AARP packets.
|
||||
*/
|
||||
ret = ether_encap_print(et, p, length, caplen,
|
||||
extracted_ethertype);
|
||||
ret = ethertype_print(et, p, length, caplen);
|
||||
if (ret)
|
||||
return (ret);
|
||||
}
|
||||
@ -483,7 +479,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
/*
|
||||
* What remains is an Ethernet packet.
|
||||
*/
|
||||
ether_print(p, length, caplen);
|
||||
ether_print(p, length, caplen, NULL, NULL);
|
||||
return (1);
|
||||
|
||||
case PID_RFC2684_802_5_FCS:
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lldp.c,v 1.7.2.3 2008-03-20 09:33:52 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lldp.c,v 1.10 2008-03-20 09:30:56 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.18.2.1 2008-01-28 13:48:16 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.20 2008-01-28 14:20:43 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -34,6 +34,7 @@ static const char rcsid[] _U_ =
|
||||
|
||||
#include "bgp.h"
|
||||
#include "l2vpn.h"
|
||||
#include "oui.h"
|
||||
|
||||
/*
|
||||
* LSPPING common header
|
||||
@ -134,7 +135,11 @@ struct lspping_tlv_header {
|
||||
#define LSPPING_TLV_TARGET_FEC_STACK 1
|
||||
#define LSPPING_TLV_DOWNSTREAM_MAPPING 2
|
||||
#define LSPPING_TLV_PAD 3
|
||||
#define LSPPING_TLV_ERROR_CODE 4
|
||||
#define LSPPING_TLV_VENDOR_ENTERPRISE 5
|
||||
#define LSPPING_TLV_VENDOR_ENTERPRISE_LEN 4
|
||||
#define LSPPING_TLV_INTERFACE_LABEL_STACK 7
|
||||
#define LSPPING_TLV_ERROR_CODE 9
|
||||
#define LSPPING_TLV_REPLY_TOS_BYTE 10
|
||||
#define LSPPING_TLV_BFD_DISCRIMINATOR 15 /* draft-ietf-bfd-mpls-02 */
|
||||
#define LSPPING_TLV_BFD_DISCRIMINATOR_LEN 4
|
||||
#define LSPPING_TLV_VENDOR_PRIVATE 0xfc00
|
||||
@ -144,8 +149,11 @@ static const struct tok lspping_tlv_values[] = {
|
||||
{ LSPPING_TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" },
|
||||
{ LSPPING_TLV_PAD, "Pad" },
|
||||
{ LSPPING_TLV_ERROR_CODE, "Error Code" },
|
||||
{ LSPPING_TLV_VENDOR_ENTERPRISE, "Vendor Enterprise Code" },
|
||||
{ LSPPING_TLV_INTERFACE_LABEL_STACK, "Interface Label Stack" },
|
||||
{ LSPPING_TLV_REPLY_TOS_BYTE, "Reply TOS Byte" },
|
||||
{ LSPPING_TLV_BFD_DISCRIMINATOR, "BFD Discriminator" },
|
||||
{ LSPPING_TLV_VENDOR_PRIVATE, "Vendor Enterprise Code" },
|
||||
{ LSPPING_TLV_VENDOR_PRIVATE, "Vendor Private Code" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -566,6 +574,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
tlen-=sizeof(const struct lspping_common_header);
|
||||
|
||||
while(tlen>(int)sizeof(struct lspping_tlv_header)) {
|
||||
|
||||
/* did we capture enough for fully decoding the tlv header ? */
|
||||
if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
|
||||
goto trunc;
|
||||
@ -840,11 +849,24 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
goto trunc;
|
||||
printf("\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr));
|
||||
break;
|
||||
|
||||
case LSPPING_TLV_VENDOR_ENTERPRISE:
|
||||
{
|
||||
u_int32_t vendor_id;
|
||||
|
||||
if (!TTEST2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN))
|
||||
goto trunc;
|
||||
vendor_id = EXTRACT_32BITS(tlv_tptr);
|
||||
printf("\n\t Vendor: %s (0x%04x)",
|
||||
tok2str(smi_values, "Unknown", vendor_id),
|
||||
vendor_id);
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
* FIXME those are the defined TLVs that lack a decoder
|
||||
* you are welcome to contribute code ;-)
|
||||
*/
|
||||
|
||||
case LSPPING_TLV_PAD:
|
||||
case LSPPING_TLV_ERROR_CODE:
|
||||
case LSPPING_TLV_VENDOR_PRIVATE:
|
||||
|
35
print-nfs.c
35
print-nfs.c
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.110.2.1 2007-12-22 03:08:45 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.111 2007-12-22 03:08:04 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -508,6 +508,7 @@ nfsreq_print(register const u_char *bp, u_int length,
|
||||
nfs_type type;
|
||||
int v3;
|
||||
u_int32_t proc;
|
||||
u_int32_t access_flags;
|
||||
struct nfsv3_sattr sa3;
|
||||
char srcid[20], dstid[20]; /*fits 32bit*/
|
||||
|
||||
@ -570,7 +571,37 @@ nfsreq_print(register const u_char *bp, u_int length,
|
||||
if ((dp = parsereq(rp, length)) != NULL &&
|
||||
(dp = parsefh(dp, v3)) != NULL) {
|
||||
TCHECK(dp[0]);
|
||||
printf(" %04x", EXTRACT_32BITS(&dp[0]));
|
||||
access_flags = EXTRACT_32BITS(&dp[0]);
|
||||
if (access_flags & ~NFSV3ACCESS_FULL) {
|
||||
/* NFSV3ACCESS definitions aren't up to date */
|
||||
printf(" %04x", access_flags);
|
||||
} else if ((access_flags & NFSV3ACCESS_FULL) == NFSV3ACCESS_FULL) {
|
||||
printf(" NFS_ACCESS_FULL");
|
||||
} else {
|
||||
char separator = ' ';
|
||||
if (access_flags & NFSV3ACCESS_READ) {
|
||||
printf(" NFS_ACCESS_READ");
|
||||
separator = '|';
|
||||
}
|
||||
if (access_flags & NFSV3ACCESS_LOOKUP) {
|
||||
printf("%cNFS_ACCESS_LOOKUP", separator);
|
||||
separator = '|';
|
||||
}
|
||||
if (access_flags & NFSV3ACCESS_MODIFY) {
|
||||
printf("%cNFS_ACCESS_MODIFY", separator);
|
||||
separator = '|';
|
||||
}
|
||||
if (access_flags & NFSV3ACCESS_EXTEND) {
|
||||
printf("%cNFS_ACCESS_EXTEND", separator);
|
||||
separator = '|';
|
||||
}
|
||||
if (access_flags & NFSV3ACCESS_DELETE) {
|
||||
printf("%cNFS_ACCESS_DELETE", separator);
|
||||
separator = '|';
|
||||
}
|
||||
if (access_flags & NFSV3ACCESS_EXECUTE)
|
||||
printf("%cNFS_ACCESS_EXECUTE", separator);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
27
print-ntp.c
27
print-ntp.c
@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.42 2005-05-06 07:56:53 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.43 2007-11-30 13:45:10 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -72,6 +72,12 @@ static struct tok ntp_leapind_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static struct tok ntp_stratum_values[] = {
|
||||
{ UNSPECIFIED, "unspecified" },
|
||||
{ PRIM_REF, "primary reference" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Print ntp requests
|
||||
*/
|
||||
@ -106,7 +112,9 @@ ntp_print(register const u_char *cp, u_int length)
|
||||
leapind);
|
||||
|
||||
TCHECK(bp->stratum);
|
||||
printf(", Stratum %u", bp->stratum);
|
||||
printf(", Stratum %u (%s)",
|
||||
bp->stratum,
|
||||
tok2str(ntp_stratum_values, (bp->stratum >=2 && bp->stratum<=15) ? "secondary reference" : "reserved", bp->stratum));
|
||||
|
||||
TCHECK(bp->ppoll);
|
||||
printf(", poll %us", bp->ppoll);
|
||||
@ -174,8 +182,19 @@ ntp_print(register const u_char *cp, u_int length)
|
||||
fputs("\n\t Originator - Transmit Timestamp: ", stdout);
|
||||
p_ntp_delta(&(bp->org_timestamp), &(bp->xmt_timestamp));
|
||||
|
||||
/* FIXME key-id, authentication */
|
||||
|
||||
if ( (sizeof(struct ntpdata) - length) == 16) { /* Optional: key-id */
|
||||
TCHECK(bp->key_id);
|
||||
printf("\n\tKey id: %u", bp->key_id);
|
||||
} else if ( (sizeof(struct ntpdata) - length) == 0) { /* Optional: key-id + authentication */
|
||||
TCHECK(bp->key_id);
|
||||
printf("\n\tKey id: %u", bp->key_id);
|
||||
TCHECK2(bp->message_digest, sizeof (bp->message_digest));
|
||||
printf("\n\tAuthentication: %08x%08x%08x%08x",
|
||||
EXTRACT_32BITS(bp->message_digest),
|
||||
EXTRACT_32BITS(bp->message_digest + 4),
|
||||
EXTRACT_32BITS(bp->message_digest + 8),
|
||||
EXTRACT_32BITS(bp->message_digest + 12));
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
|
381
print-olsr.c
381
print-olsr.c
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2007 The TCPDUMP project
|
||||
* Copyright (c) 2009 Florian Forster
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
@ -15,6 +16,7 @@
|
||||
* Optimized Link State Protocl (OLSR) as per rfc3626
|
||||
*
|
||||
* Original code by Hannes Gredler <hannes@juniper.net>
|
||||
* IPv6 additions by Florian Forster <octo at verplant.org>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -28,7 +30,7 @@
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
#include "extract.h"
|
||||
#include "ip.h"
|
||||
|
||||
/*
|
||||
@ -88,7 +90,7 @@ static struct tok olsr_msg_values[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct olsr_msg {
|
||||
struct olsr_msg4 {
|
||||
u_int8_t msg_type;
|
||||
u_int8_t vtime;
|
||||
u_int8_t msg_len[2];
|
||||
@ -98,6 +100,16 @@ struct olsr_msg {
|
||||
u_int8_t msg_seq[2];
|
||||
};
|
||||
|
||||
struct olsr_msg6 {
|
||||
u_int8_t msg_type;
|
||||
u_int8_t vtime;
|
||||
u_int8_t msg_len[2];
|
||||
u_int8_t originator[16];
|
||||
u_int8_t ttl;
|
||||
u_int8_t hopcount;
|
||||
u_int8_t msg_seq[2];
|
||||
};
|
||||
|
||||
struct olsr_hello {
|
||||
u_int8_t res[2];
|
||||
u_int8_t htime;
|
||||
@ -115,11 +127,16 @@ struct olsr_tc {
|
||||
u_int8_t res[2];
|
||||
};
|
||||
|
||||
struct olsr_hna {
|
||||
struct olsr_hna4 {
|
||||
u_int8_t network[4];
|
||||
u_int8_t mask[4];
|
||||
};
|
||||
|
||||
struct olsr_hna6 {
|
||||
u_int8_t network[16];
|
||||
u_int8_t mask[16];
|
||||
};
|
||||
|
||||
|
||||
#define OLSR_EXTRACT_LINK_TYPE(link_code) (link_code & 0x3)
|
||||
#define OLSR_EXTRACT_NEIGHBOR_TYPE(link_code) (link_code >> 2)
|
||||
@ -139,13 +156,20 @@ static struct tok olsr_neighbor_type_values[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct olsr_lq_neighbor {
|
||||
struct olsr_lq_neighbor4 {
|
||||
u_int8_t neighbor[4];
|
||||
u_int8_t link_quality;
|
||||
u_int8_t neighbor_link_quality;
|
||||
u_int8_t res[2];
|
||||
};
|
||||
|
||||
struct olsr_lq_neighbor6 {
|
||||
u_int8_t neighbor[16];
|
||||
u_int8_t link_quality;
|
||||
u_int8_t neighbor_link_quality;
|
||||
u_int8_t res[2];
|
||||
};
|
||||
|
||||
/*
|
||||
* macro to convert the 8-bit mantissa/exponent to a double float
|
||||
* taken from olsr.org.
|
||||
@ -158,13 +182,13 @@ struct olsr_lq_neighbor {
|
||||
* print a neighbor list with LQ extensions.
|
||||
*/
|
||||
static void
|
||||
olsr_print_lq_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
olsr_print_lq_neighbor4 (const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
struct olsr_lq_neighbor *lq_neighbor;
|
||||
struct olsr_lq_neighbor4 *lq_neighbor;
|
||||
|
||||
while (hello_len >= sizeof(struct olsr_lq_neighbor)) {
|
||||
while (hello_len >= sizeof(struct olsr_lq_neighbor4)) {
|
||||
|
||||
lq_neighbor = (struct olsr_lq_neighbor *)msg_data;
|
||||
lq_neighbor = (struct olsr_lq_neighbor4 *)msg_data;
|
||||
|
||||
printf("\n\t neighbor %s, link-quality %.2lf%%"
|
||||
", neighbor-link-quality %.2lf%%",
|
||||
@ -172,11 +196,33 @@ olsr_print_lq_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
((double)lq_neighbor->link_quality/2.55),
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55));
|
||||
|
||||
msg_data += sizeof(struct olsr_lq_neighbor);
|
||||
hello_len -= sizeof(struct olsr_lq_neighbor);
|
||||
msg_data += sizeof(struct olsr_lq_neighbor4);
|
||||
hello_len -= sizeof(struct olsr_lq_neighbor4);
|
||||
}
|
||||
}
|
||||
|
||||
#if INET6
|
||||
static void
|
||||
olsr_print_lq_neighbor6 (const u_char *msg_data, u_int hello_len)
|
||||
{
|
||||
struct olsr_lq_neighbor6 *lq_neighbor;
|
||||
|
||||
while (hello_len >= sizeof(struct olsr_lq_neighbor6)) {
|
||||
|
||||
lq_neighbor = (struct olsr_lq_neighbor6 *)msg_data;
|
||||
|
||||
printf("\n\t neighbor %s, link-quality %.2lf%%"
|
||||
", neighbor-link-quality %.2lf%%",
|
||||
ip6addr_string(lq_neighbor->neighbor),
|
||||
((double)lq_neighbor->link_quality/2.55),
|
||||
((double)lq_neighbor->neighbor_link_quality/2.55));
|
||||
|
||||
msg_data += sizeof(struct olsr_lq_neighbor6);
|
||||
hello_len -= sizeof(struct olsr_lq_neighbor6);
|
||||
}
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
/*
|
||||
* print a neighbor list.
|
||||
*/
|
||||
@ -202,38 +248,41 @@ olsr_print_neighbor (const u_char *msg_data, u_int hello_len)
|
||||
|
||||
|
||||
void
|
||||
olsr_print (const u_char *pptr, u_int length)
|
||||
olsr_print (const u_char *pptr, u_int length, int is_ipv6)
|
||||
{
|
||||
union {
|
||||
const struct olsr_common *common;
|
||||
const struct olsr_msg *msg;
|
||||
const struct olsr_msg4 *msg4;
|
||||
const struct olsr_msg6 *msg6;
|
||||
const struct olsr_hello *hello;
|
||||
const struct olsr_hello_link *hello_link;
|
||||
const struct olsr_lq_neighbor *lq_neighbor;
|
||||
const struct olsr_tc *tc;
|
||||
const struct olsr_hna *hna;
|
||||
const struct olsr_hna4 *hna;
|
||||
} ptr;
|
||||
|
||||
u_int msg_type, msg_len, msg_tlen, hello_len, prefix;
|
||||
u_int msg_type, msg_len, msg_tlen, hello_len;
|
||||
u_int16_t name_entry_type, name_entry_len;
|
||||
u_int name_entry_padding;
|
||||
u_int8_t link_type, neighbor_type;
|
||||
const u_char *tptr, *msg_data;
|
||||
|
||||
tptr = pptr;
|
||||
tptr = pptr;
|
||||
|
||||
if (length < sizeof(struct olsr_common)) {
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_common))) {
|
||||
goto trunc;
|
||||
goto trunc;
|
||||
}
|
||||
|
||||
ptr.common = (struct olsr_common *)tptr;
|
||||
length = MIN(length, EXTRACT_16BITS(ptr.common->packet_len));
|
||||
|
||||
printf("OLSR, seq 0x%04x, length %u",
|
||||
EXTRACT_16BITS(ptr.common->packet_seq),
|
||||
length);
|
||||
printf("OLSRv%i, seq 0x%04x, length %u",
|
||||
(is_ipv6 == 0) ? 4 : 6,
|
||||
EXTRACT_16BITS(ptr.common->packet_seq),
|
||||
length);
|
||||
|
||||
tptr += sizeof(struct olsr_common);
|
||||
|
||||
@ -241,41 +290,81 @@ olsr_print (const u_char *pptr, u_int length)
|
||||
* In non-verbose mode, just print version.
|
||||
*/
|
||||
if (vflag < 1) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
while (tptr < (pptr+length)) {
|
||||
union
|
||||
{
|
||||
struct olsr_msg4 *v4;
|
||||
struct olsr_msg6 *v6;
|
||||
} msgptr;
|
||||
int msg_len_valid = 0;
|
||||
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_msg)))
|
||||
if (!TTEST2(*tptr, sizeof(struct olsr_msg4)))
|
||||
goto trunc;
|
||||
|
||||
ptr.msg = (struct olsr_msg *)tptr;
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
{
|
||||
msgptr.v6 = (struct olsr_msg6 *) tptr;
|
||||
msg_type = msgptr.v6->msg_type;
|
||||
msg_len = EXTRACT_16BITS(msgptr.v6->msg_len);
|
||||
if ((msg_len >= sizeof (struct olsr_msg6))
|
||||
&& (msg_len <= length))
|
||||
msg_len_valid = 1;
|
||||
|
||||
msg_type = ptr.msg->msg_type;
|
||||
msg_len = EXTRACT_16BITS(ptr.msg->msg_len);
|
||||
/* infinite loop check */
|
||||
if (msg_type == 0 || msg_len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* infinite loop check */
|
||||
if (msg_type == 0 || msg_len == 0) {
|
||||
return;
|
||||
printf("\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
|
||||
"\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s",
|
||||
tok2str(olsr_msg_values, "Unknown", msg_type),
|
||||
msg_type, ip6addr_string(msgptr.v6->originator),
|
||||
msgptr.v6->ttl,
|
||||
msgptr.v6->hopcount,
|
||||
ME_TO_DOUBLE(msgptr.v6->vtime),
|
||||
EXTRACT_16BITS(msgptr.v6->msg_seq),
|
||||
msg_len, (msg_len_valid == 0) ? " (invalid)" : "");
|
||||
|
||||
msg_tlen = msg_len - sizeof(struct olsr_msg6);
|
||||
msg_data = tptr + sizeof(struct olsr_msg6);
|
||||
}
|
||||
else /* (!is_ipv6) */
|
||||
#endif /* INET6 */
|
||||
{
|
||||
msgptr.v4 = (struct olsr_msg4 *) tptr;
|
||||
msg_type = msgptr.v4->msg_type;
|
||||
msg_len = EXTRACT_16BITS(msgptr.v4->msg_len);
|
||||
if ((msg_len >= sizeof (struct olsr_msg4))
|
||||
&& (msg_len <= length))
|
||||
msg_len_valid = 1;
|
||||
|
||||
printf("\n\t%s Message (%u), originator %s, ttl %u, hop %u"
|
||||
"\n\t vtime %.3lfs, msg-seq 0x%04x, length %u",
|
||||
tok2str(olsr_msg_values, "Unknown", msg_type),
|
||||
msg_type, ipaddr_string(ptr.msg->originator),
|
||||
ptr.msg->ttl,
|
||||
ptr.msg->hopcount,
|
||||
ME_TO_DOUBLE(ptr.msg->vtime),
|
||||
EXTRACT_16BITS(ptr.msg->msg_seq),
|
||||
msg_len);
|
||||
/* infinite loop check */
|
||||
if (msg_type == 0 || msg_len == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
msg_tlen = msg_len - sizeof(struct olsr_msg);
|
||||
msg_data = tptr + sizeof(struct olsr_msg);
|
||||
printf("\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
|
||||
"\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s",
|
||||
tok2str(olsr_msg_values, "Unknown", msg_type),
|
||||
msg_type, ipaddr_string(msgptr.v4->originator),
|
||||
msgptr.v4->ttl,
|
||||
msgptr.v4->hopcount,
|
||||
ME_TO_DOUBLE(msgptr.v4->vtime),
|
||||
EXTRACT_16BITS(msgptr.v4->msg_seq),
|
||||
msg_len, (msg_len_valid == 0) ? " (invalid)" : "");
|
||||
|
||||
msg_tlen = msg_len - sizeof(struct olsr_msg4);
|
||||
msg_data = tptr + sizeof(struct olsr_msg4);
|
||||
}
|
||||
|
||||
switch (msg_type) {
|
||||
case OLSR_HELLO_MSG:
|
||||
case OLSR_HELLO_LQ_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello)))
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hello = (struct olsr_hello *)msg_data;
|
||||
@ -285,11 +374,12 @@ olsr_print (const u_char *pptr, u_int length)
|
||||
msg_tlen -= sizeof(struct olsr_hello);
|
||||
|
||||
while (msg_tlen >= sizeof(struct olsr_hello_link)) {
|
||||
int hello_len_valid = 0;
|
||||
|
||||
/*
|
||||
* link-type.
|
||||
*/
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello_link)))
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hello_link)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hello_link = (struct olsr_hello_link *)msg_data;
|
||||
@ -298,10 +388,18 @@ olsr_print (const u_char *pptr, u_int length)
|
||||
link_type = OLSR_EXTRACT_LINK_TYPE(ptr.hello_link->link_code);
|
||||
neighbor_type = OLSR_EXTRACT_NEIGHBOR_TYPE(ptr.hello_link->link_code);
|
||||
|
||||
printf("\n\t link-type %s, neighbor-type %s, len %u",
|
||||
if ((hello_len <= msg_tlen)
|
||||
&& (hello_len >= sizeof(struct olsr_hello_link)))
|
||||
hello_len_valid = 1;
|
||||
|
||||
printf("\n\t link-type %s, neighbor-type %s, len %u%s",
|
||||
tok2str(olsr_link_type_values, "Unknown", link_type),
|
||||
tok2str(olsr_neighbor_type_values, "Unknown", neighbor_type),
|
||||
hello_len);
|
||||
hello_len,
|
||||
(hello_len_valid == 0) ? " (invalid)" : "");
|
||||
|
||||
if (hello_len_valid == 0)
|
||||
break;
|
||||
|
||||
msg_data += sizeof(struct olsr_hello_link);
|
||||
msg_tlen -= sizeof(struct olsr_hello_link);
|
||||
@ -310,7 +408,12 @@ olsr_print (const u_char *pptr, u_int length)
|
||||
if (msg_type == OLSR_HELLO_MSG) {
|
||||
olsr_print_neighbor(msg_data, hello_len);
|
||||
} else {
|
||||
olsr_print_lq_neighbor(msg_data, hello_len);
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
olsr_print_lq_neighbor6(msg_data, hello_len);
|
||||
else
|
||||
#endif
|
||||
olsr_print_lq_neighbor4(msg_data, hello_len);
|
||||
}
|
||||
|
||||
msg_data += hello_len;
|
||||
@ -320,7 +423,7 @@ olsr_print (const u_char *pptr, u_int length)
|
||||
|
||||
case OLSR_TC_MSG:
|
||||
case OLSR_TC_LQ_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_tc)))
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_tc)))
|
||||
goto trunc;
|
||||
|
||||
ptr.tc = (struct olsr_tc *)msg_data;
|
||||
@ -332,56 +435,182 @@ olsr_print (const u_char *pptr, u_int length)
|
||||
if (msg_type == OLSR_TC_MSG) {
|
||||
olsr_print_neighbor(msg_data, msg_tlen);
|
||||
} else {
|
||||
olsr_print_lq_neighbor(msg_data, msg_tlen);
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
olsr_print_lq_neighbor6(msg_data, msg_tlen);
|
||||
else
|
||||
#endif
|
||||
olsr_print_lq_neighbor4(msg_data, msg_tlen);
|
||||
}
|
||||
break;
|
||||
|
||||
case OLSR_MID_MSG:
|
||||
if (!TTEST2(*msg_data, sizeof(struct in_addr)))
|
||||
goto trunc;
|
||||
{
|
||||
size_t addr_size = sizeof(struct in_addr);
|
||||
|
||||
while (msg_tlen >= sizeof(struct in_addr)) {
|
||||
printf("\n\t interface address %s", ipaddr_string(msg_data));
|
||||
msg_data += sizeof(struct in_addr);
|
||||
msg_tlen -= sizeof(struct in_addr);
|
||||
}
|
||||
break;
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
#endif
|
||||
|
||||
case OLSR_HNA_MSG:
|
||||
prefix = 1;
|
||||
printf("\n\t advertised networks\n\t ");
|
||||
while (msg_tlen >= sizeof(struct olsr_hna)) {
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hna)))
|
||||
while (msg_tlen >= addr_size) {
|
||||
if (!TTEST2(*msg_data, addr_size))
|
||||
goto trunc;
|
||||
|
||||
ptr.hna = (struct olsr_hna *)msg_data;
|
||||
|
||||
/* print 4 prefixes per line */
|
||||
|
||||
printf("%s/%u%s",
|
||||
ipaddr_string(ptr.hna->network),
|
||||
mask2plen(EXTRACT_32BITS(ptr.hna->mask)),
|
||||
prefix % 4 == 0 ? "\n\t " : " ");
|
||||
|
||||
msg_data += sizeof(struct olsr_hna);
|
||||
msg_tlen -= sizeof(struct olsr_hna);
|
||||
prefix ++;
|
||||
printf("\n\t interface address %s",
|
||||
#if INET6
|
||||
is_ipv6 ? ip6addr_string(msg_data) :
|
||||
#endif
|
||||
ipaddr_string(msg_data));
|
||||
msg_data += addr_size;
|
||||
msg_tlen -= addr_size;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OLSR_HNA_MSG:
|
||||
printf("\n\t Advertised networks (total %u)",
|
||||
(unsigned int) (msg_tlen / sizeof(struct olsr_hna6)));
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
{
|
||||
int i = 0;
|
||||
while (msg_tlen >= sizeof(struct olsr_hna6)) {
|
||||
struct olsr_hna6 *hna6;
|
||||
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hna6)))
|
||||
goto trunc;
|
||||
|
||||
hna6 = (struct olsr_hna6 *)msg_data;
|
||||
|
||||
printf("\n\t #%i: %s/%u",
|
||||
i, ip6addr_string(hna6->network),
|
||||
mask62plen (hna6->mask));
|
||||
|
||||
msg_data += sizeof(struct olsr_hna6);
|
||||
msg_tlen -= sizeof(struct olsr_hna6);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int col = 0;
|
||||
while (msg_tlen >= sizeof(struct olsr_hna4)) {
|
||||
if (!TTEST2(*msg_data, sizeof(struct olsr_hna4)))
|
||||
goto trunc;
|
||||
|
||||
ptr.hna = (struct olsr_hna4 *)msg_data;
|
||||
|
||||
/* print 4 prefixes per line */
|
||||
if (col == 0)
|
||||
printf ("\n\t ");
|
||||
else
|
||||
printf (", ");
|
||||
|
||||
printf("%s/%u",
|
||||
ipaddr_string(ptr.hna->network),
|
||||
mask2plen(EXTRACT_32BITS(ptr.hna->mask)));
|
||||
|
||||
msg_data += sizeof(struct olsr_hna4);
|
||||
msg_tlen -= sizeof(struct olsr_hna4);
|
||||
|
||||
col = (col + 1) % 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OLSR_NAMESERVICE_MSG:
|
||||
{
|
||||
u_int name_entries = EXTRACT_16BITS(msg_data+2);
|
||||
u_int addr_size = 4;
|
||||
int name_entries_valid = 0;
|
||||
u_int i;
|
||||
|
||||
if (is_ipv6)
|
||||
addr_size = 16;
|
||||
|
||||
if ((name_entries > 0)
|
||||
&& ((name_entries * (4 + addr_size)) <= msg_tlen))
|
||||
name_entries_valid = 1;
|
||||
|
||||
if (msg_tlen < 4)
|
||||
goto trunc;
|
||||
if (!TTEST2(*msg_data, 4))
|
||||
goto trunc;
|
||||
|
||||
printf("\n\t Version %u, Entries %u%s",
|
||||
EXTRACT_16BITS(msg_data),
|
||||
name_entries, (name_entries_valid == 0) ? " (invalid)" : "");
|
||||
|
||||
if (name_entries_valid == 0)
|
||||
break;
|
||||
|
||||
msg_data += 4;
|
||||
msg_tlen -= 4;
|
||||
|
||||
for (i = 0; i < name_entries; i++) {
|
||||
int name_entry_len_valid = 0;
|
||||
|
||||
if (msg_tlen < 4)
|
||||
break;
|
||||
if (!TTEST2(*msg_data, 4))
|
||||
goto trunc;
|
||||
|
||||
name_entry_type = EXTRACT_16BITS(msg_data);
|
||||
name_entry_len = EXTRACT_16BITS(msg_data+2);
|
||||
|
||||
msg_data += 4;
|
||||
msg_tlen -= 4;
|
||||
|
||||
if ((name_entry_len > 0) && ((addr_size + name_entry_len) <= msg_tlen))
|
||||
name_entry_len_valid = 1;
|
||||
|
||||
printf("\n\t #%u: type %#06x, length %u%s",
|
||||
(unsigned int) i, name_entry_type,
|
||||
name_entry_len, (name_entry_len_valid == 0) ? " (invalid)" : "");
|
||||
|
||||
if (name_entry_len_valid == 0)
|
||||
break;
|
||||
|
||||
/* 32-bit alignment */
|
||||
name_entry_padding = 0;
|
||||
if (name_entry_len%4 != 0)
|
||||
name_entry_padding = 4-(name_entry_len%4);
|
||||
|
||||
if (msg_tlen < addr_size + name_entry_len + name_entry_padding)
|
||||
goto trunc;
|
||||
|
||||
if (!TTEST2(*msg_data, addr_size + name_entry_len + name_entry_padding))
|
||||
goto trunc;
|
||||
|
||||
#if INET6
|
||||
if (is_ipv6)
|
||||
printf(", address %s, name \"",
|
||||
ip6addr_string(msg_data));
|
||||
else
|
||||
#endif
|
||||
printf(", address %s, name \"",
|
||||
ipaddr_string(msg_data));
|
||||
fn_printn(msg_data + addr_size, name_entry_len, NULL);
|
||||
printf("\"");
|
||||
|
||||
msg_data += addr_size + name_entry_len + name_entry_padding;
|
||||
msg_tlen -= addr_size + name_entry_len + name_entry_padding;
|
||||
} /* for (i = 0; i < name_entries; i++) */
|
||||
break;
|
||||
} /* case OLSR_NAMESERVICE_MSG */
|
||||
|
||||
/*
|
||||
* FIXME those are the defined messages that lack a decoder
|
||||
* you are welcome to contribute code ;-)
|
||||
*/
|
||||
|
||||
case OLSR_POWERINFO_MSG:
|
||||
case OLSR_NAMESERVICE_MSG:
|
||||
default:
|
||||
print_unknown_data(msg_data, "\n\t ", msg_tlen);
|
||||
print_unknown_data(msg_data, "\n\t ", msg_tlen);
|
||||
break;
|
||||
}
|
||||
} /* switch (msg_type) */
|
||||
tptr += msg_len;
|
||||
}
|
||||
} /* while (tptr < (pptr+length)) */
|
||||
|
||||
return;
|
||||
|
||||
|
@ -982,7 +982,7 @@ ospf_decode_v2(register const struct ospfhdr *op,
|
||||
bittok2str(ospf_dd_flag_values,"none",op->ospf_db.db_flags));
|
||||
TCHECK(op->ospf_db.db_ifmtu);
|
||||
if (op->ospf_db.db_ifmtu) {
|
||||
printf(", MTU: %u", ntohs(op->ospf_db.db_ifmtu));
|
||||
printf(", MTU: %u", EXTRACT_16BITS(&op->ospf_db.db_ifmtu));
|
||||
}
|
||||
TCHECK(op->ospf_db.db_seq);
|
||||
printf(", Sequence: 0x%08x", EXTRACT_32BITS(&op->ospf_db.db_seq));
|
||||
|
@ -42,6 +42,7 @@ static const char rcsid[] _U_ =
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "extract.h"
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
@ -94,8 +95,8 @@ pflog_print(const struct pfloghdr *hdr)
|
||||
{
|
||||
u_int32_t rulenr, subrulenr;
|
||||
|
||||
rulenr = ntohl(hdr->rulenr);
|
||||
subrulenr = ntohl(hdr->subrulenr);
|
||||
rulenr = EXTRACT_32BITS(&hdr->rulenr);
|
||||
subrulenr = EXTRACT_32BITS(&hdr->subrulenr);
|
||||
if (subrulenr == (u_int32_t)-1)
|
||||
printf("rule %u/", rulenr);
|
||||
else
|
||||
|
12
print-pim.c
12
print-pim.c
@ -118,7 +118,7 @@ struct pim {
|
||||
|
||||
#include "ip.h"
|
||||
|
||||
static void pimv2_print(register const u_char *bp, register u_int len);
|
||||
static void pimv2_print(register const u_char *bp, register u_int len, u_int cksum);
|
||||
|
||||
static void
|
||||
pimv1_join_prune_print(register const u_char *bp, register u_int len)
|
||||
@ -413,7 +413,7 @@ cisco_autorp_print(register const u_char *bp, register u_int len)
|
||||
}
|
||||
|
||||
void
|
||||
pim_print(register const u_char *bp, register u_int len)
|
||||
pim_print(register const u_char *bp, register u_int len, u_int cksum)
|
||||
{
|
||||
register const u_char *ep;
|
||||
register struct pim *pim = (struct pim *)bp;
|
||||
@ -438,7 +438,7 @@ pim_print(register const u_char *bp, register u_int len)
|
||||
PIM_VER(pim->pim_typever),
|
||||
len,
|
||||
tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)));
|
||||
pimv2_print(bp, len);
|
||||
pimv2_print(bp, len, cksum);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -618,7 +618,7 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
|
||||
}
|
||||
|
||||
static void
|
||||
pimv2_print(register const u_char *bp, register u_int len)
|
||||
pimv2_print(register const u_char *bp, register u_int len, u_int cksum)
|
||||
{
|
||||
register const u_char *ep;
|
||||
register struct pim *pim = (struct pim *)bp;
|
||||
@ -638,9 +638,7 @@ pimv2_print(register const u_char *bp, register u_int len)
|
||||
if (EXTRACT_16BITS(&pim->pim_cksum) == 0) {
|
||||
printf("(unverified)");
|
||||
} else {
|
||||
printf("(%scorrect)",
|
||||
TTEST2(bp[0], len) &&
|
||||
in_cksum((const u_short*)bp, len, 0) ? "in" : "" );
|
||||
printf("(%scorrect)", TTEST2(bp[0], len) && cksum ? "in" : "" );
|
||||
}
|
||||
|
||||
switch (PIM_TYPE(pim->pim_typever)) {
|
||||
|
@ -1629,7 +1629,7 @@ ppp_bsdos_if_print(const struct pcap_pkthdr *h _U_, register const u_char *p _U_
|
||||
hdrlength += 1;
|
||||
} else {
|
||||
/* Un-compressed protocol field */
|
||||
ptype = ntohs(*(u_int16_t *)p);
|
||||
ptype = EXTRACT_16BITS(p);
|
||||
if (eflag)
|
||||
printf("%04x ", ptype);
|
||||
p += 2;
|
||||
@ -1649,7 +1649,7 @@ ppp_bsdos_if_print(const struct pcap_pkthdr *h _U_, register const u_char *p _U_
|
||||
&& ph->phdr_ctl == PPP_CONTROL) {
|
||||
if (eflag)
|
||||
printf("%02x %02x ", q[0], q[1]);
|
||||
ptype = ntohs(ph->phdr_type);
|
||||
ptype = EXTRACT_16BITS(&ph->phdr_type);
|
||||
if (eflag && (ptype == PPP_VJC || ptype == PPP_VJNC)) {
|
||||
printf("%s ", tok2str(ppptype2str,
|
||||
"proto-#%d", ptype));
|
||||
|
132
print-rrcp.c
132
print-rrcp.c
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rrcp.c,v 1.1.2.2 2008-04-11 17:00:00 gianluca Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rrcp.c,v 1.2 2008-04-11 17:21:34 gianluca Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -44,34 +44,39 @@ static const char rcsid[] _U_ =
|
||||
#define ETH_ALEN 6
|
||||
#endif
|
||||
|
||||
struct rrcp_packet_t
|
||||
{
|
||||
u_int16_t rrcp_ethertype; /* 0x8899 */
|
||||
u_int8_t rrcp_proto; /* must be 0x01 */
|
||||
u_int8_t rrcp_opcode:7; /* 0x00 = hello, 0x01 = get, 0x02 = set */
|
||||
u_int8_t rrcp_isreply:1; /* 0 = request to switch, 1 = reply from switch */
|
||||
u_int16_t rrcp_authkey; /* 0x2379 by default */
|
||||
u_int16_t rrcp_reg_addr; /* register address */
|
||||
u_int32_t rrcp_reg_data; /* register data */
|
||||
u_int32_t cookie1;
|
||||
u_int32_t cookie2;
|
||||
#define RRCP_OPCODE_MASK 0x7F /* 0x00 = hello, 0x01 = get, 0x02 = set */
|
||||
#define RRCP_ISREPLY 0x80 /* 0 = request to switch, 0x80 = reply from switch */
|
||||
|
||||
#define RRCP_PROTO_OFFSET 0 /* proto - 1 byte, must be 1 */
|
||||
#define RRCP_OPCODE_ISREPLY_OFFSET 1 /* opcode and isreply flag - 1 byte */
|
||||
#define RRCP_AUTHKEY_OFFSET 2 /* authorization key - 2 bytes, 0x2379 by default */
|
||||
|
||||
/* most packets */
|
||||
#define RRCP_REG_ADDR_OFFSET 4 /* register address - 2 bytes */
|
||||
#define RRCP_REG_DATA_OFFSET 6 /* register data - 4 bytes */
|
||||
#define RRCP_COOKIE1_OFFSET 10 /* 4 bytes */
|
||||
#define RRCP_COOKIE2_OFFSET 14 /* 4 bytes */
|
||||
|
||||
/* hello reply packets */
|
||||
#define RRCP_DOWNLINK_PORT_OFFSET 4 /* 1 byte */
|
||||
#define RRCP_UPLINK_PORT_OFFSET 5 /* 1 byte */
|
||||
#define RRCP_UPLINK_MAC_OFFSET 6 /* 6 byte MAC address */
|
||||
#define RRCP_CHIP_ID_OFFSET 12 /* 2 bytes */
|
||||
#define RRCP_VENDOR_ID_OFFSET 14 /* 4 bytes */
|
||||
|
||||
static const struct tok proto_values[] = {
|
||||
{ 1, "RRCP" },
|
||||
{ 2, "RRCP-REP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
struct rrcp_helloreply_packet_t
|
||||
{
|
||||
u_int16_t rrcp_ethertype; /* 0x8899 */
|
||||
u_int8_t rrcp_proto; /* must be 0x01 */
|
||||
u_int8_t rrcp_opcode:7; /* 0x00 = hello, 0x01 = get, 0x02 = set */
|
||||
u_int8_t rrcp_isreply:1; /* 0 = request to switch, 1 = reply from switch */
|
||||
u_int16_t rrcp_authkey; /* 0x2379 by default */
|
||||
u_int8_t rrcp_downlink_port; /* */
|
||||
u_int8_t rrcp_uplink_port; /* */
|
||||
u_int8_t rrcp_uplink_mac[ETH_ALEN]; /* */
|
||||
u_int16_t rrcp_chip_id; /* */
|
||||
u_int32_t rrcp_vendor_id; /* */
|
||||
static const struct tok opcode_values[] = {
|
||||
{ 0, "hello" },
|
||||
{ 1, "get" },
|
||||
{ 2, "set" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Print RRCP requests
|
||||
*/
|
||||
@ -80,58 +85,59 @@ rrcp_print(netdissect_options *ndo,
|
||||
register const u_char *cp,
|
||||
u_int length _U_)
|
||||
{
|
||||
const struct rrcp_packet_t *rrcp;
|
||||
const struct rrcp_helloreply_packet_t *rrcp_hello;
|
||||
const u_char *rrcp;
|
||||
u_int8_t rrcp_proto;
|
||||
u_int8_t rrcp_opcode;
|
||||
register const struct ether_header *ep;
|
||||
char proto_str[16];
|
||||
char opcode_str[32];
|
||||
|
||||
ep = (const struct ether_header *)cp;
|
||||
rrcp = (const struct rrcp_packet_t *)(cp+12);
|
||||
rrcp_hello = (const struct rrcp_helloreply_packet_t *)(cp+12);
|
||||
rrcp = cp + ETHER_HDRLEN;
|
||||
|
||||
if (rrcp->rrcp_proto==1){
|
||||
strcpy(proto_str,"RRCP");
|
||||
}else if ( rrcp->rrcp_proto==2 ){
|
||||
strcpy(proto_str,"RRCP-REP");
|
||||
}else{
|
||||
sprintf(proto_str,"RRCP-0x%02d",rrcp->rrcp_proto);
|
||||
}
|
||||
if (rrcp->rrcp_opcode==0){
|
||||
strcpy(opcode_str,"hello");
|
||||
}else if ( rrcp->rrcp_opcode==1 ){
|
||||
strcpy(opcode_str,"get");
|
||||
}else if ( rrcp->rrcp_opcode==2 ){
|
||||
strcpy(opcode_str,"set");
|
||||
}else{
|
||||
sprintf(opcode_str,"unknown opcode (0x%02d)",rrcp->rrcp_opcode);
|
||||
}
|
||||
ND_TCHECK(*(rrcp + RRCP_PROTO_OFFSET));
|
||||
rrcp_proto = *(rrcp + RRCP_PROTO_OFFSET);
|
||||
ND_TCHECK(*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET));
|
||||
rrcp_opcode = (*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
|
||||
ND_PRINT((ndo, "%s > %s, %s %s",
|
||||
etheraddr_string(ESRC(ep)),
|
||||
etheraddr_string(EDST(ep)),
|
||||
proto_str, rrcp->rrcp_isreply ? "reply" : "query"));
|
||||
if (rrcp->rrcp_proto==1){
|
||||
ND_PRINT((ndo, ": %s", opcode_str));
|
||||
tok2strbuf(proto_values,"RRCP-0x%02d",rrcp_proto,proto_str,sizeof(proto_str)),
|
||||
((*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY) ? "reply" : "query"));
|
||||
if (rrcp_proto==1){
|
||||
ND_PRINT((ndo, ": %s",
|
||||
tok2strbuf(opcode_values,"unknown opcode (0x%02d)",rrcp_opcode,opcode_str,sizeof(opcode_str))));
|
||||
}
|
||||
if (rrcp->rrcp_opcode==1 || rrcp->rrcp_opcode==2){
|
||||
ND_PRINT((ndo, " addr=0x%04x, data=0x%04x",
|
||||
rrcp->rrcp_reg_addr, rrcp->rrcp_reg_data, rrcp->rrcp_authkey));
|
||||
if (rrcp_opcode==1 || rrcp_opcode==2){
|
||||
ND_TCHECK2(*(rrcp + RRCP_REG_ADDR_OFFSET), 6);
|
||||
ND_PRINT((ndo, " addr=0x%04x, data=0x%08x",
|
||||
EXTRACT_16BITS(rrcp + RRCP_REG_ADDR_OFFSET),
|
||||
EXTRACT_32BITS(rrcp + RRCP_REG_DATA_OFFSET)));
|
||||
}
|
||||
if (rrcp->rrcp_proto==1){
|
||||
if (rrcp_proto==1){
|
||||
ND_TCHECK2(*(rrcp + RRCP_AUTHKEY_OFFSET), 2);
|
||||
ND_PRINT((ndo, ", auth=0x%04x",
|
||||
ntohs(rrcp->rrcp_authkey)));
|
||||
EXTRACT_16BITS(rrcp + RRCP_AUTHKEY_OFFSET)));
|
||||
}
|
||||
if (rrcp->rrcp_proto==1 && rrcp->rrcp_opcode==0 && rrcp->rrcp_isreply){
|
||||
ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ",
|
||||
rrcp_hello->rrcp_downlink_port,
|
||||
rrcp_hello->rrcp_uplink_port,
|
||||
etheraddr_string(rrcp_hello->rrcp_uplink_mac),
|
||||
rrcp_hello->rrcp_vendor_id,
|
||||
rrcp_hello->rrcp_chip_id));
|
||||
}else if (rrcp->rrcp_opcode==1 || rrcp->rrcp_opcode==2 || rrcp->rrcp_proto==2){
|
||||
ND_PRINT((ndo, ", cookie=0x%08x%08x ",
|
||||
rrcp->cookie2, rrcp->cookie1));
|
||||
if (rrcp_proto==1 && rrcp_opcode==0 &&
|
||||
((*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY)){
|
||||
ND_TCHECK2(*(rrcp + RRCP_VENDOR_ID_OFFSET), 4);
|
||||
ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ",
|
||||
*(rrcp + RRCP_DOWNLINK_PORT_OFFSET),
|
||||
*(rrcp + RRCP_UPLINK_PORT_OFFSET),
|
||||
etheraddr_string(rrcp + RRCP_UPLINK_MAC_OFFSET),
|
||||
EXTRACT_32BITS(rrcp + RRCP_VENDOR_ID_OFFSET),
|
||||
EXTRACT_16BITS(rrcp + RRCP_CHIP_ID_OFFSET)));
|
||||
}else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){
|
||||
ND_TCHECK2(*(rrcp + RRCP_COOKIE2_OFFSET), 4);
|
||||
ND_PRINT((ndo, ", cookie=0x%08x%08x ",
|
||||
EXTRACT_32BITS(rrcp + RRCP_COOKIE2_OFFSET),
|
||||
EXTRACT_32BITS(rrcp + RRCP_COOKIE1_OFFSET)));
|
||||
}
|
||||
if (!ndo->ndo_vflag)
|
||||
return;
|
||||
return;
|
||||
|
||||
trunc:
|
||||
ND_PRINT((ndo, "[|rrcp]"));
|
||||
}
|
||||
|
208
print-rsvp.c
208
print-rsvp.c
@ -17,7 +17,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.48 2007-09-13 17:29:50 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.50 2008-08-16 11:36:20 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -36,6 +36,7 @@ static const char rcsid[] _U_ =
|
||||
#include "ethertype.h"
|
||||
#include "gmpls.h"
|
||||
#include "af.h"
|
||||
#include "signature.h"
|
||||
|
||||
/*
|
||||
* RFC 2205 common header
|
||||
@ -142,6 +143,7 @@ static const struct tok rsvp_header_flag_values[] = {
|
||||
#define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
|
||||
#define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
|
||||
#define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
|
||||
#define RSVP_OBJ_S2L 50 /* rfc4875 */
|
||||
#define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
|
||||
#define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
|
||||
#define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
|
||||
@ -198,6 +200,7 @@ static const struct tok rsvp_obj_values[] = {
|
||||
{ RSVP_OBJ_NOTIFY_REQ, "Notify Request" },
|
||||
{ RSVP_OBJ_PROTECTION, "Protection" },
|
||||
{ RSVP_OBJ_ADMIN_STATUS, "Administrative Status" },
|
||||
{ RSVP_OBJ_S2L, "Sub-LSP to LSP" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -210,6 +213,9 @@ static const struct tok rsvp_obj_values[] = {
|
||||
#define RSVP_CTYPE_2 2
|
||||
#define RSVP_CTYPE_3 3
|
||||
#define RSVP_CTYPE_4 4
|
||||
#define RSVP_CTYPE_12 12
|
||||
#define RSVP_CTYPE_13 13
|
||||
#define RSVP_CTYPE_14 14
|
||||
|
||||
/*
|
||||
* the ctypes are not globally unique so for
|
||||
@ -235,13 +241,19 @@ static const struct tok rsvp_ctype_values[] = {
|
||||
{ 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_IPV6, "IPv6" },
|
||||
{ 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_3, "IPv6 Flow-label" },
|
||||
{ 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
|
||||
{ 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_12, "IPv4 P2MP LSP Tunnel" },
|
||||
{ 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_13, "IPv6 P2MP LSP Tunnel" },
|
||||
{ 256*RSVP_OBJ_SESSION+RSVP_CTYPE_IPV4, "IPv4" },
|
||||
{ 256*RSVP_OBJ_SESSION+RSVP_CTYPE_IPV6, "IPv6" },
|
||||
{ 256*RSVP_OBJ_SESSION+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
|
||||
{ 256*RSVP_OBJ_SESSION+RSVP_CTYPE_UNI_IPV4, "UNI IPv4" },
|
||||
{ 256*RSVP_OBJ_SESSION+RSVP_CTYPE_13, "IPv4 P2MP LSP Tunnel" },
|
||||
{ 256*RSVP_OBJ_SESSION+RSVP_CTYPE_14, "IPv6 P2MP LSP Tunnel" },
|
||||
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV4, "IPv4" },
|
||||
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV6, "IPv6" },
|
||||
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
|
||||
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_12, "IPv4 P2MP LSP Tunnel" },
|
||||
{ 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_13, "IPv6 P2MP LSP Tunnel" },
|
||||
{ 256*RSVP_OBJ_MESSAGE_ID+RSVP_CTYPE_1, "1" },
|
||||
{ 256*RSVP_OBJ_MESSAGE_ID_ACK+RSVP_CTYPE_1, "Message id ack" },
|
||||
{ 256*RSVP_OBJ_MESSAGE_ID_ACK+RSVP_CTYPE_2, "Message id nack" },
|
||||
@ -282,6 +294,8 @@ static const struct tok rsvp_ctype_values[] = {
|
||||
{ 256*RSVP_OBJ_CLASSTYPE_OLD+RSVP_CTYPE_1, "1" },
|
||||
{ 256*RSVP_OBJ_LABEL_SET+RSVP_CTYPE_1, "1" },
|
||||
{ 256*RSVP_OBJ_GENERALIZED_UNI+RSVP_CTYPE_1, "1" },
|
||||
{ 256*RSVP_OBJ_S2L+RSVP_CTYPE_IPV4, "IPv4 sub-LSP" },
|
||||
{ 256*RSVP_OBJ_S2L+RSVP_CTYPE_IPV6, "IPv6 sub-LSP" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -316,6 +330,7 @@ struct rsvp_obj_frr_t {
|
||||
#define RSVP_OBJ_XRO_RES 0
|
||||
#define RSVP_OBJ_XRO_IPV4 1
|
||||
#define RSVP_OBJ_XRO_IPV6 2
|
||||
#define RSVP_OBJ_XRO_LABEL 3
|
||||
#define RSVP_OBJ_XRO_ASN 32
|
||||
#define RSVP_OBJ_XRO_MPLS 64
|
||||
|
||||
@ -323,6 +338,7 @@ static const struct tok rsvp_obj_xro_values[] = {
|
||||
{ RSVP_OBJ_XRO_RES, "Reserved" },
|
||||
{ RSVP_OBJ_XRO_IPV4, "IPv4 prefix" },
|
||||
{ RSVP_OBJ_XRO_IPV6, "IPv6 prefix" },
|
||||
{ RSVP_OBJ_XRO_LABEL, "Label" },
|
||||
{ RSVP_OBJ_XRO_ASN, "Autonomous system number" },
|
||||
{ RSVP_OBJ_XRO_MPLS, "MPLS label switched path termination" },
|
||||
{ 0, NULL}
|
||||
@ -337,6 +353,12 @@ static const struct tok rsvp_obj_rro_flag_values[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* RFC3209 */
|
||||
static const struct tok rsvp_obj_rro_label_flag_values[] = {
|
||||
{ 0x01, "Global" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
static const struct tok rsvp_resstyle_values[] = {
|
||||
{ 17, "Wildcard Filter" },
|
||||
{ 10, "Fixed Filter" },
|
||||
@ -369,11 +391,11 @@ static const struct tok rsvp_intserv_parameter_id_values[] = {
|
||||
};
|
||||
|
||||
static struct tok rsvp_session_attribute_flag_values[] = {
|
||||
{ 0x01, "Local Protection desired" },
|
||||
{ 0x02, "Label Recording desired" },
|
||||
{ 0x04, "SE Style desired" },
|
||||
{ 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
|
||||
{ 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
|
||||
{ 0x01, "Local Protection" },
|
||||
{ 0x02, "Label Recording" },
|
||||
{ 0x04, "SE Style" },
|
||||
{ 0x08, "Bandwidth protection" }, /* RFC4090 */
|
||||
{ 0x10, "Node protection" }, /* RFC4090 */
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -614,7 +636,16 @@ rsvp_intserv_print(const u_char *tptr, u_short obj_tlen) {
|
||||
}
|
||||
|
||||
static int
|
||||
rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
rsvp_obj_print (const u_char *pptr
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
, u_int plen
|
||||
#ifndef HAVE_LIBCRYPTO
|
||||
_U_
|
||||
#endif
|
||||
, const u_char *tptr,
|
||||
const char *ident, u_int tlen) {
|
||||
|
||||
const struct rsvp_object_header *rsvp_obj_header;
|
||||
const u_char *obj_tptr;
|
||||
@ -624,7 +655,7 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
} obj_ptr;
|
||||
|
||||
u_short rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen;
|
||||
int hexdump,processed,padbytes,error_code,error_value,i;
|
||||
int hexdump,processed,padbytes,error_code,error_value,i,sigcheck;
|
||||
union {
|
||||
float f;
|
||||
u_int32_t i;
|
||||
@ -728,7 +759,30 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
obj_tlen-=36;
|
||||
obj_tptr+=36;
|
||||
break;
|
||||
|
||||
case RSVP_CTYPE_14: /* IPv6 p2mp LSP Tunnel */
|
||||
if (obj_tlen < 26)
|
||||
return -1;
|
||||
printf("%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
|
||||
ident,
|
||||
EXTRACT_32BITS(obj_tptr),
|
||||
EXTRACT_16BITS(obj_tptr+6),
|
||||
ip6addr_string(obj_tptr+8));
|
||||
obj_tlen-=26;
|
||||
obj_tptr+=26;
|
||||
break;
|
||||
#endif
|
||||
case RSVP_CTYPE_13: /* IPv4 p2mp LSP Tunnel */
|
||||
if (obj_tlen < 12)
|
||||
return -1;
|
||||
printf("%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
|
||||
ident,
|
||||
ipaddr_string(obj_tptr),
|
||||
EXTRACT_16BITS(obj_tptr+6),
|
||||
ipaddr_string(obj_tptr+8));
|
||||
obj_tlen-=12;
|
||||
obj_tptr+=12;
|
||||
break;
|
||||
case RSVP_CTYPE_TUNNEL_IPV4:
|
||||
case RSVP_CTYPE_UNI_IPV4:
|
||||
if (obj_tlen < 12)
|
||||
@ -880,6 +934,20 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
obj_tlen-=20;
|
||||
obj_tptr+=20;
|
||||
break;
|
||||
case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */
|
||||
if (obj_tlen < 40)
|
||||
return-1;
|
||||
printf("%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"
|
||||
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
|
||||
ident,
|
||||
ip6addr_string(obj_tptr),
|
||||
EXTRACT_16BITS(obj_tptr+18),
|
||||
ident,
|
||||
ip6addr_string(obj_tptr+20),
|
||||
EXTRACT_16BITS(obj_tptr+38));
|
||||
obj_tlen-=40;
|
||||
obj_tptr+=40;
|
||||
break;
|
||||
#endif
|
||||
case RSVP_CTYPE_TUNNEL_IPV4:
|
||||
if (obj_tlen < 8)
|
||||
@ -891,6 +959,20 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
obj_tlen-=8;
|
||||
obj_tptr+=8;
|
||||
break;
|
||||
case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */
|
||||
if (obj_tlen < 16)
|
||||
return-1;
|
||||
printf("%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"
|
||||
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
|
||||
ident,
|
||||
ipaddr_string(obj_tptr),
|
||||
EXTRACT_16BITS(obj_tptr+6),
|
||||
ident,
|
||||
ipaddr_string(obj_tptr+8),
|
||||
EXTRACT_16BITS(obj_tptr+12));
|
||||
obj_tlen-=16;
|
||||
obj_tptr+=16;
|
||||
break;
|
||||
default:
|
||||
hexdump=TRUE;
|
||||
}
|
||||
@ -999,6 +1081,18 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
bittok2str(rsvp_obj_rro_flag_values,
|
||||
"none",
|
||||
*(obj_tptr+7))); /* rfc3209 says that this field is rsvd. */
|
||||
break;
|
||||
case RSVP_OBJ_XRO_LABEL:
|
||||
printf(", Flags: [%s] (%#x), Class-Type: %s (%u), %u",
|
||||
bittok2str(rsvp_obj_rro_label_flag_values,
|
||||
"none",
|
||||
*(obj_tptr+2)),
|
||||
*(obj_tptr+2),
|
||||
tok2str(rsvp_ctype_values,
|
||||
"Unknown",
|
||||
*(obj_tptr+3) + 256*RSVP_OBJ_RRO),
|
||||
*(obj_tptr+3),
|
||||
EXTRACT_32BITS(obj_tptr+4));
|
||||
}
|
||||
obj_tlen-=*(obj_tptr+1);
|
||||
obj_tptr+=*(obj_tptr+1);
|
||||
@ -1055,14 +1149,14 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
printf("%s Session Name: ", ident);
|
||||
for (i = 0; i < namelen; i++)
|
||||
safeputchar(*(obj_tptr+4+i));
|
||||
printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
|
||||
printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)",
|
||||
ident,
|
||||
(int)*obj_tptr,
|
||||
(int)*(obj_tptr+1),
|
||||
tok2str(rsvp_session_attribute_flag_values,
|
||||
bittok2str(rsvp_session_attribute_flag_values,
|
||||
"none",
|
||||
*(obj_tptr+2)));
|
||||
|
||||
*(obj_tptr+2)),
|
||||
*(obj_tptr+2));
|
||||
obj_tlen-=4+*(obj_tptr+3);
|
||||
obj_tptr+=4+*(obj_tptr+3);
|
||||
break;
|
||||
@ -1306,6 +1400,20 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
obj_tlen-=20;
|
||||
obj_tptr+=20;
|
||||
break;
|
||||
case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */
|
||||
if (obj_tlen < 40)
|
||||
return-1;
|
||||
printf("%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"
|
||||
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
|
||||
ident,
|
||||
ip6addr_string(obj_tptr),
|
||||
EXTRACT_16BITS(obj_tptr+18),
|
||||
ident,
|
||||
ip6addr_string(obj_tptr+20),
|
||||
EXTRACT_16BITS(obj_tptr+38));
|
||||
obj_tlen-=40;
|
||||
obj_tptr+=40;
|
||||
break;
|
||||
#endif
|
||||
case RSVP_CTYPE_TUNNEL_IPV4:
|
||||
if (obj_tlen < 8)
|
||||
@ -1317,6 +1425,20 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
obj_tlen-=8;
|
||||
obj_tptr+=8;
|
||||
break;
|
||||
case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */
|
||||
if (obj_tlen < 16)
|
||||
return-1;
|
||||
printf("%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"
|
||||
"%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
|
||||
ident,
|
||||
ipaddr_string(obj_tptr),
|
||||
EXTRACT_16BITS(obj_tptr+6),
|
||||
ident,
|
||||
ipaddr_string(obj_tptr+8),
|
||||
EXTRACT_16BITS(obj_tptr+12));
|
||||
obj_tlen-=16;
|
||||
obj_tptr+=16;
|
||||
break;
|
||||
default:
|
||||
hexdump=TRUE;
|
||||
}
|
||||
@ -1544,12 +1666,21 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
bittok2str(rsvp_obj_integrity_flag_values,
|
||||
"none",
|
||||
obj_ptr.rsvp_obj_integrity->flags));
|
||||
printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
|
||||
printf("%s MD5-sum 0x%08x%08x%08x%08x ",
|
||||
ident,
|
||||
EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest),
|
||||
EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+4),
|
||||
EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+8),
|
||||
EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+12));
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
sigcheck = signature_verify(pptr, plen, (unsigned char *)obj_ptr.\
|
||||
rsvp_obj_integrity->digest);
|
||||
#else
|
||||
sigcheck = CANT_CHECK_SIGNATURE;
|
||||
#endif
|
||||
printf(" (%s)", tok2str(signature_check_values, "Unknown", sigcheck));
|
||||
|
||||
obj_tlen+=sizeof(struct rsvp_obj_integrity_t);
|
||||
obj_tptr+=sizeof(struct rsvp_obj_integrity_t);
|
||||
break;
|
||||
@ -1613,7 +1744,32 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
hexdump=TRUE;
|
||||
}
|
||||
|
||||
case RSVP_OBJ_S2L:
|
||||
switch (rsvp_obj_ctype) {
|
||||
case RSVP_CTYPE_IPV4:
|
||||
if (obj_tlen < 4)
|
||||
return-1;
|
||||
printf("%s Sub-LSP destination address: %s",
|
||||
ident, ipaddr_string(obj_tptr));
|
||||
|
||||
obj_tlen-=4;
|
||||
obj_tptr+=4;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case RSVP_CTYPE_IPV6:
|
||||
if (obj_tlen < 16)
|
||||
return-1;
|
||||
printf("%s Sub-LSP destination address: %s",
|
||||
ident, ip6addr_string(obj_tptr));
|
||||
|
||||
obj_tlen-=16;
|
||||
obj_tptr+=16;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
hexdump=TRUE;
|
||||
}
|
||||
@ -1650,13 +1806,13 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
void
|
||||
rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
const struct rsvp_common_header *rsvp_com_header;
|
||||
struct rsvp_common_header *rsvp_com_header;
|
||||
const u_char *tptr,*subtptr;
|
||||
u_short tlen,subtlen;
|
||||
u_short plen, tlen, subtlen;
|
||||
|
||||
tptr=pptr;
|
||||
|
||||
rsvp_com_header = (const struct rsvp_common_header *)pptr;
|
||||
rsvp_com_header = (struct rsvp_common_header *)pptr;
|
||||
TCHECK(*rsvp_com_header);
|
||||
|
||||
/*
|
||||
@ -1679,7 +1835,7 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
/* ok they seem to want to know everything - lets fully decode it */
|
||||
|
||||
tlen=EXTRACT_16BITS(rsvp_com_header->length);
|
||||
plen = tlen = EXTRACT_16BITS(rsvp_com_header->length);
|
||||
|
||||
printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
|
||||
RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
|
||||
@ -1690,6 +1846,12 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
rsvp_com_header->ttl,
|
||||
EXTRACT_16BITS(rsvp_com_header->checksum));
|
||||
|
||||
/*
|
||||
* Clear checksum prior to signature verification.
|
||||
*/
|
||||
rsvp_com_header->checksum[0] = 0;
|
||||
rsvp_com_header->checksum[1] = 0;
|
||||
|
||||
if (tlen < sizeof(const struct rsvp_common_header)) {
|
||||
printf("ERROR: common header too short %u < %lu", tlen,
|
||||
(unsigned long)sizeof(const struct rsvp_common_header));
|
||||
@ -1704,7 +1866,7 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
case RSVP_MSGTYPE_AGGREGATE:
|
||||
while(tlen > 0) {
|
||||
subtptr=tptr;
|
||||
rsvp_com_header = (const struct rsvp_common_header *)subtptr;
|
||||
rsvp_com_header = (struct rsvp_common_header *)subtptr;
|
||||
TCHECK(*rsvp_com_header);
|
||||
|
||||
/*
|
||||
@ -1725,6 +1887,12 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
subtlen,
|
||||
rsvp_com_header->ttl,
|
||||
EXTRACT_16BITS(rsvp_com_header->checksum));
|
||||
|
||||
/*
|
||||
* Clear checksum prior to signature verification.
|
||||
*/
|
||||
rsvp_com_header->checksum[0] = 0;
|
||||
rsvp_com_header->checksum[1] = 0;
|
||||
|
||||
if (subtlen < sizeof(const struct rsvp_common_header)) {
|
||||
printf("ERROR: common header too short %u < %lu", subtlen,
|
||||
@ -1741,7 +1909,7 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
subtptr+=sizeof(const struct rsvp_common_header);
|
||||
subtlen-=sizeof(const struct rsvp_common_header);
|
||||
|
||||
if (rsvp_obj_print(subtptr,"\n\t ", subtlen) == -1)
|
||||
if (rsvp_obj_print(pptr, plen, subtptr,"\n\t ", subtlen) == -1)
|
||||
return;
|
||||
|
||||
tptr+=subtlen+sizeof(const struct rsvp_common_header);
|
||||
@ -1761,7 +1929,7 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
case RSVP_MSGTYPE_HELLO:
|
||||
case RSVP_MSGTYPE_ACK:
|
||||
case RSVP_MSGTYPE_SREFRESH:
|
||||
if (rsvp_obj_print(tptr,"\n\t ", tlen) == -1)
|
||||
if (rsvp_obj_print(pptr, plen, tptr,"\n\t ", tlen) == -1)
|
||||
return;
|
||||
break;
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.39.2.3 2008-07-01 07:45:09 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.42 2008-07-01 07:44:50 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
58
print-sctp.c
58
print-sctp.c
@ -59,6 +59,29 @@ static const char rcsid[] _U_ =
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
|
||||
#define CHAN_HP 6700
|
||||
#define CHAN_MP 6701
|
||||
#define CHAN_LP 6702
|
||||
|
||||
struct tok ForCES_channels[] = {
|
||||
{ CHAN_HP, "ForCES HP" },
|
||||
{ CHAN_MP, "ForCES MP" },
|
||||
{ CHAN_LP, "ForCES LP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static inline int isForCES_port(u_short Port)
|
||||
{
|
||||
if (Port == CHAN_HP)
|
||||
return 1;
|
||||
if (Port == CHAN_MP)
|
||||
return 1;
|
||||
if (Port == CHAN_LP)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
const u_char *bp2, /* beginning of enclosing */
|
||||
u_int sctpPacketLength) /* ip packet */
|
||||
@ -74,6 +97,8 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
const struct sctpChunkDesc *chunkDescPtr;
|
||||
const void *nextChunk;
|
||||
const char *sep;
|
||||
int isforces = 0;
|
||||
|
||||
|
||||
sctpPktHdr = (const struct sctpHeader*) bp;
|
||||
endPacketPtr = (const u_char*)sctpPktHdr+sctpPacketLength;
|
||||
@ -120,6 +145,15 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
if (isForCES_port(sourcePort)) {
|
||||
printf("[%s]", tok2str(ForCES_channels, NULL, sourcePort));
|
||||
isforces = 1;
|
||||
}
|
||||
if (isForCES_port(destPort)) {
|
||||
printf("[%s]", tok2str(ForCES_channels, NULL, destPort));
|
||||
isforces = 1;
|
||||
}
|
||||
|
||||
if (vflag >= 2)
|
||||
sep = "\n\t";
|
||||
else
|
||||
@ -193,9 +227,23 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
printf("[SSEQ %u] ", EXTRACT_16BITS(&dataHdrPtr->sequence));
|
||||
printf("[PPID 0x%x] ", EXTRACT_32BITS(&dataHdrPtr->payloadtype));
|
||||
fflush(stdout);
|
||||
if (isforces) {
|
||||
const u_char *payloadPtr;
|
||||
u_int chunksize = sizeof(struct sctpDataPart)+
|
||||
sizeof(struct sctpChunkDesc);
|
||||
payloadPtr = (const u_char *) (dataHdrPtr + 1);
|
||||
if (EXTRACT_16BITS(&chunkDescPtr->chunkLength) <
|
||||
sizeof(struct sctpDataPart)+
|
||||
sizeof(struct sctpChunkDesc)+1) {
|
||||
/* Less than 1 byte of chunk payload */
|
||||
printf("bogus ForCES chunk length %u]",
|
||||
EXTRACT_16BITS(&chunkDescPtr->chunkLength));
|
||||
return;
|
||||
}
|
||||
|
||||
if (vflag >= 2) /* if verbose output is specified */
|
||||
{ /* at the command line */
|
||||
forces_print(payloadPtr, EXTRACT_16BITS(&chunkDescPtr->chunkLength)- chunksize);
|
||||
} else if (vflag >= 2) { /* if verbose output is specified */
|
||||
/* at the command line */
|
||||
const u_char *payloadPtr;
|
||||
|
||||
printf("[Payload");
|
||||
@ -203,16 +251,16 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
if (!suppress_default_print) {
|
||||
payloadPtr = (const u_char *) (++dataHdrPtr);
|
||||
printf(":");
|
||||
if (htons(chunkDescPtr->chunkLength) <
|
||||
if (EXTRACT_16BITS(&chunkDescPtr->chunkLength) <
|
||||
sizeof(struct sctpDataPart)+
|
||||
sizeof(struct sctpChunkDesc)+1) {
|
||||
/* Less than 1 byte of chunk payload */
|
||||
printf("bogus chunk length %u]",
|
||||
htons(chunkDescPtr->chunkLength));
|
||||
EXTRACT_16BITS(&chunkDescPtr->chunkLength));
|
||||
return;
|
||||
}
|
||||
default_print(payloadPtr,
|
||||
htons(chunkDescPtr->chunkLength) -
|
||||
EXTRACT_16BITS(&chunkDescPtr->chunkLength) -
|
||||
(sizeof(struct sctpDataPart)+
|
||||
sizeof(struct sctpChunkDesc)));
|
||||
} else
|
||||
|
@ -44,6 +44,7 @@ sip_print(register const u_char *pptr, register u_int len)
|
||||
return;
|
||||
|
||||
for (idx = 0; idx < len; idx++) {
|
||||
TCHECK2(*(pptr+idx), 2);
|
||||
if (EXTRACT_16BITS(pptr+idx) != 0x0d0a) { /* linefeed ? */
|
||||
safeputchar(*(pptr+idx));
|
||||
} else {
|
||||
@ -57,4 +58,7 @@ sip_print(register const u_char *pptr, register u_int len)
|
||||
print_unknown_data(pptr,"\n\t",len);
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|sip]");
|
||||
}
|
||||
|
49
print-sll.c
49
print-sll.c
@ -85,7 +85,7 @@ sll_print(register const struct sll_header *sllp, u_int length)
|
||||
/*
|
||||
* 802.2.
|
||||
*/
|
||||
(void)printf("802.3");
|
||||
(void)printf("802.2");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -142,8 +142,9 @@ sll_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
caplen -= SLL_HDR_LEN;
|
||||
p += SLL_HDR_LEN;
|
||||
|
||||
ether_type = ntohs(sllp->sll_protocol);
|
||||
ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
|
||||
|
||||
recurse:
|
||||
/*
|
||||
* Is it (gag) an 802.3 encapsulation, or some non-Ethernet
|
||||
* packet type?
|
||||
@ -187,13 +188,43 @@ sll_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
default_print(p, caplen);
|
||||
break;
|
||||
}
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
sll_print(sllp, length + SLL_HDR_LEN);
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
} else if (ether_type == ETHERTYPE_8021Q) {
|
||||
/*
|
||||
* Print VLAN information, and then go back and process
|
||||
* the enclosed type field.
|
||||
*/
|
||||
if (caplen < 4 || length < 4) {
|
||||
printf("[|vlan]");
|
||||
return (SLL_HDR_LEN);
|
||||
}
|
||||
if (eflag) {
|
||||
u_int16_t tag = EXTRACT_16BITS(p);
|
||||
|
||||
printf("vlan %u, p %u%s, ",
|
||||
tag & 0xfff,
|
||||
tag >> 13,
|
||||
(tag & 0x1000) ? ", CFI" : "");
|
||||
}
|
||||
|
||||
ether_type = EXTRACT_16BITS(p + 2);
|
||||
if (ether_type <= ETHERMTU)
|
||||
ether_type = LINUX_SLL_P_802_2;
|
||||
if (!qflag) {
|
||||
(void)printf("ethertype %s, ",
|
||||
tok2str(ethertype_values, "Unknown", ether_type));
|
||||
}
|
||||
p += 4;
|
||||
length -= 4;
|
||||
caplen -= 4;
|
||||
goto recurse;
|
||||
} else {
|
||||
if (ethertype_print(ether_type, p, length, caplen) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
sll_print(sllp, length + SLL_HDR_LEN);
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
}
|
||||
|
||||
return (SLL_HDR_LEN);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.46.2.1 2007-12-09 00:31:35 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.47 2007-12-09 00:30:47 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
@ -28,6 +28,21 @@ static const char rcsid[] _U_ =
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* At least on HP-UX:
|
||||
*
|
||||
* 1) getrpcbynumber() is declared in <netdb.h>, not any of the RPC
|
||||
* header files
|
||||
*
|
||||
* and
|
||||
*
|
||||
* 2) if _XOPEN_SOURCE_EXTENDED is defined, <netdb.h> doesn't declare
|
||||
* it
|
||||
*
|
||||
* so we undefine it.
|
||||
*/
|
||||
#undef _XOPEN_SOURCE_EXTENDED
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#ifdef HAVE_GETRPCBYNUMBER
|
||||
|
@ -33,6 +33,7 @@ static const char rcsid[] _U_ =
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
@ -52,7 +53,7 @@ symantec_hdr_print(register const u_char *bp, u_int length)
|
||||
|
||||
sp = (const struct symantec_header *)bp;
|
||||
|
||||
etype = ntohs(sp->ether_type);
|
||||
etype = EXTRACT_16BITS(&sp->ether_type);
|
||||
if (!qflag) {
|
||||
if (etype <= ETHERMTU)
|
||||
(void)printf("invalid ethertype %u", etype);
|
||||
@ -83,7 +84,6 @@ symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
u_int caplen = h->caplen;
|
||||
struct symantec_header *sp;
|
||||
u_short ether_type;
|
||||
u_short extracted_ether_type;
|
||||
|
||||
if (caplen < sizeof (struct symantec_header)) {
|
||||
printf("[|symantec]");
|
||||
@ -98,7 +98,7 @@ symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
sp = (struct symantec_header *)p;
|
||||
p += sizeof (struct symantec_header);
|
||||
|
||||
ether_type = ntohs(sp->ether_type);
|
||||
ether_type = EXTRACT_16BITS(&sp->ether_type);
|
||||
|
||||
if (ether_type <= ETHERMTU) {
|
||||
/* ether_type not known, print raw packet */
|
||||
@ -107,8 +107,7 @@ symantec_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
|
||||
if (!suppress_default_print)
|
||||
default_print(p, caplen);
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ether_type) == 0) {
|
||||
} else if (ethertype_print(ether_type, p, length, caplen) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
symantec_hdr_print((u_char *)sp, length + sizeof (struct symantec_header));
|
||||
|
79
print-tcp.c
79
print-tcp.c
@ -25,8 +25,8 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.130.2.3 2007-12-22 03:08:45 guy Exp $ (LBL)";
|
||||
#else
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.135 2008-11-09 23:35:03 mcr Exp $ (LBL)";
|
||||
#else
|
||||
__RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $");
|
||||
#endif
|
||||
|
||||
@ -58,10 +58,7 @@ __RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $");
|
||||
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#define SIGNATURE_VALID 0
|
||||
#define SIGNATURE_INVALID 1
|
||||
#define CANT_CHECK_SIGNATURE 2
|
||||
#include <signature.h>
|
||||
|
||||
static int tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
const u_char *data, int length, const u_char *rcvsig);
|
||||
@ -124,6 +121,7 @@ struct tok tcp_option_values[] = {
|
||||
{ TCPOPT_CCECHO, "" },
|
||||
{ TCPOPT_SIGNATURE, "md5" },
|
||||
{ TCPOPT_AUTH, "enhanced auth" },
|
||||
{ TCPOPT_UTO, "uto" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -158,37 +156,6 @@ static int tcp_cksum(register const struct ip *ip,
|
||||
sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5]);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr *tp,
|
||||
u_int len)
|
||||
{
|
||||
size_t i;
|
||||
u_int32_t sum = 0;
|
||||
union {
|
||||
struct {
|
||||
struct in6_addr ph_src;
|
||||
struct in6_addr ph_dst;
|
||||
u_int32_t ph_len;
|
||||
u_int8_t ph_zero[3];
|
||||
u_int8_t ph_nxt;
|
||||
} ph;
|
||||
u_int16_t pa[20];
|
||||
} phu;
|
||||
|
||||
/* pseudo-header */
|
||||
memset(&phu, 0, sizeof(phu));
|
||||
phu.ph.ph_src = ip6->ip6_src;
|
||||
phu.ph.ph_dst = ip6->ip6_dst;
|
||||
phu.ph.ph_len = htonl(len);
|
||||
phu.ph.ph_nxt = IPPROTO_TCP;
|
||||
|
||||
for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
|
||||
sum += phu.pa[i];
|
||||
|
||||
return in_cksum((u_short *)tp, len, sum);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
tcp_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2, int fragmented)
|
||||
@ -200,6 +167,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
register char ch;
|
||||
u_int16_t sport, dport, win, urp;
|
||||
u_int32_t seq, ack, thseq, thack;
|
||||
u_int utoval;
|
||||
int threv;
|
||||
#ifdef INET6
|
||||
register const struct ip6_hdr *ip6;
|
||||
@ -442,7 +410,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !Kflag && !fragmented) {
|
||||
u_int16_t sum,tcp_sum;
|
||||
if (TTEST2(tp->th_sport, length)) {
|
||||
sum = tcp6_cksum(ip6, tp, length);
|
||||
sum = nextproto6_cksum(ip6, (u_short *)tp, length, IPPROTO_TCP);
|
||||
(void)printf(", cksum 0x%04x",EXTRACT_16BITS(&tp->th_sum));
|
||||
if (sum != 0) {
|
||||
tcp_sum = EXTRACT_16BITS(&tp->th_sum);
|
||||
@ -455,7 +423,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
#endif
|
||||
|
||||
length -= hlen;
|
||||
if (vflag > 1 || flags & (TH_SYN | TH_FIN | TH_RST)) {
|
||||
if (vflag > 1 || length > 0 || flags & (TH_SYN | TH_FIN | TH_RST)) {
|
||||
(void)printf(", seq %u", seq);
|
||||
|
||||
if (length > 0) {
|
||||
@ -613,6 +581,18 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
*/
|
||||
break;
|
||||
|
||||
case TCPOPT_UTO:
|
||||
datalen = 2;
|
||||
LENCHECK(datalen);
|
||||
utoval = EXTRACT_16BITS(cp);
|
||||
(void)printf("0x%x", utoval);
|
||||
if (utoval & 0x0001)
|
||||
utoval = (utoval >> 1) * 60;
|
||||
else
|
||||
utoval >>= 1;
|
||||
(void)printf(" %u", utoval);
|
||||
break;
|
||||
|
||||
default:
|
||||
datalen = len - 2;
|
||||
for (i = 0; i < datalen; ++i) {
|
||||
@ -750,10 +730,17 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
u_int8_t nxt;
|
||||
#endif
|
||||
|
||||
if (data + length > snapend) {
|
||||
printf("snaplen too short, ");
|
||||
return (CANT_CHECK_SIGNATURE);
|
||||
}
|
||||
|
||||
tp1 = *tp;
|
||||
|
||||
if (tcpmd5secret == NULL)
|
||||
if (sigsecret == NULL) {
|
||||
printf("shared secret not supplied with -M, ");
|
||||
return (CANT_CHECK_SIGNATURE);
|
||||
}
|
||||
|
||||
MD5_Init(&ctx);
|
||||
/*
|
||||
@ -772,7 +759,7 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
ip6 = (struct ip6_hdr *)ip;
|
||||
MD5_Update(&ctx, (char *)&ip6->ip6_src, sizeof(ip6->ip6_src));
|
||||
MD5_Update(&ctx, (char *)&ip6->ip6_dst, sizeof(ip6->ip6_dst));
|
||||
len32 = htonl(ntohs(ip6->ip6_plen));
|
||||
len32 = htonl(EXTRACT_16BITS(&ip6->ip6_plen));
|
||||
MD5_Update(&ctx, (char *)&len32, sizeof(len32));
|
||||
nxt = 0;
|
||||
MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
|
||||
@ -781,8 +768,14 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
nxt = IPPROTO_TCP;
|
||||
MD5_Update(&ctx, (char *)&nxt, sizeof(nxt));
|
||||
#endif
|
||||
} else
|
||||
} else {
|
||||
#ifdef INET6
|
||||
printf("IP version not 4 or 6, ");
|
||||
#else
|
||||
printf("IP version not 4, ");
|
||||
#endif
|
||||
return (CANT_CHECK_SIGNATURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 2: Update MD5 hash with TCP header, excluding options.
|
||||
@ -800,7 +793,7 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
/*
|
||||
* Step 4: Update MD5 hash with shared secret.
|
||||
*/
|
||||
MD5_Update(&ctx, tcpmd5secret, strlen(tcpmd5secret));
|
||||
MD5_Update(&ctx, sigsecret, strlen(sigsecret));
|
||||
MD5_Final(sig, &ctx);
|
||||
|
||||
if (memcmp(rcvsig, sig, TCP_SIGLEN) == 0)
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.38.2.1 2008-04-11 16:44:17 gianluca Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.39 2008-04-11 16:47:38 gianluca Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -39,6 +39,7 @@ static const char rcsid[] _U_ =
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
@ -126,7 +127,16 @@ token_print(const u_char *p, u_int length, u_int caplen)
|
||||
if (eflag)
|
||||
token_hdr_print(trp, length, ESRC(&ehdr), EDST(&ehdr));
|
||||
|
||||
if (caplen < TOKEN_HDRLEN + 2) {
|
||||
printf("[|token-ring]");
|
||||
return hdr_len;
|
||||
}
|
||||
route_len = RIF_LENGTH(trp);
|
||||
hdr_len += route_len;
|
||||
if (caplen < hdr_len) {
|
||||
printf("[|token-ring]");
|
||||
return hdr_len;
|
||||
}
|
||||
if (vflag) {
|
||||
printf("%s ", broadcast_indicator[BROADCAST(trp)]);
|
||||
printf("%s", direction[DIRECTION(trp)]);
|
||||
@ -135,10 +145,10 @@ token_print(const u_char *p, u_int length, u_int caplen)
|
||||
printf(" [%d:%d]", RING_NUMBER(trp, seg),
|
||||
BRIDGE_NUMBER(trp, seg));
|
||||
} else {
|
||||
printf("rt = %x", ntohs(trp->token_rcf));
|
||||
printf("rt = %x", EXTRACT_16BITS(&trp->token_rcf));
|
||||
|
||||
for (seg = 0; seg < SEGMENT_COUNT(trp); seg++)
|
||||
printf(":%x", ntohs(trp->token_rseg[seg]));
|
||||
printf(":%x", EXTRACT_16BITS(&trp->token_rseg[seg]));
|
||||
}
|
||||
printf(" (%s) ", largest_frame[LARGEST_FRAME(trp)]);
|
||||
} else {
|
||||
@ -147,7 +157,6 @@ token_print(const u_char *p, u_int length, u_int caplen)
|
||||
}
|
||||
|
||||
/* Skip over token ring MAC header and routing information */
|
||||
hdr_len += route_len;
|
||||
length -= hdr_len;
|
||||
p += hdr_len;
|
||||
caplen -= hdr_len;
|
||||
|
17
print-udp.c
17
print-udp.c
@ -568,7 +568,7 @@ udp_print(register const u_char *bp, u_int length,
|
||||
}
|
||||
udpipaddr_print(ip, sport, dport);
|
||||
|
||||
if (IP_V(ip) == 4 && (vflag > 1) && !fragmented) {
|
||||
if (IP_V(ip) == 4 && (vflag > 1) && !Kflag && !fragmented) {
|
||||
int sum = up->uh_sum;
|
||||
if (sum == 0) {
|
||||
(void)printf("[no cksum] ");
|
||||
@ -581,7 +581,7 @@ udp_print(register const u_char *bp, u_int length,
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
|
||||
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !Kflag && !fragmented) {
|
||||
int sum = up->uh_sum;
|
||||
/* for IPv6, UDP checksum is mandatory */
|
||||
if (TTEST2(cp[0], length)) {
|
||||
@ -672,11 +672,16 @@ udp_print(register const u_char *bp, u_int length,
|
||||
hsrp_print((const u_char *)(up + 1), length);
|
||||
else if (ISPORT(LWRES_PORT))
|
||||
lwres_print((const u_char *)(up + 1), length);
|
||||
else if (ISPORT(LDP_PORT))
|
||||
else if (ISPORT(LDP_PORT))
|
||||
ldp_print((const u_char *)(up + 1), length);
|
||||
else if (ISPORT(OLSR_PORT))
|
||||
olsr_print((const u_char *)(up + 1), length);
|
||||
else if (ISPORT(MPLS_LSP_PING_PORT))
|
||||
else if (ISPORT(OLSR_PORT))
|
||||
olsr_print((const u_char *)(up + 1), length,
|
||||
#if INET6
|
||||
(IP_V(ip) == 6) ? 1 : 0);
|
||||
#else
|
||||
0);
|
||||
#endif
|
||||
else if (ISPORT(MPLS_LSP_PING_PORT))
|
||||
lspping_print((const u_char *)(up + 1), length);
|
||||
else if (dport == BFD_CONTROL_PORT ||
|
||||
dport == BFD_ECHO_PORT )
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user