This commit was generated by cvs2svn to compensate for changes in r75115,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
b8cd33e7dd
11
contrib/tcpdump/.cvsignore
Normal file
11
contrib/tcpdump/.cvsignore
Normal file
@ -0,0 +1,11 @@
|
||||
version.c
|
||||
Makefile
|
||||
Makefile-devel.in
|
||||
config.status
|
||||
config.log
|
||||
config.cache
|
||||
config.h
|
||||
.devel
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
tcpdump
|
@ -1,3 +1,41 @@
|
||||
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.79 2001/01/10 20:13:58 mcr Exp $
|
||||
|
||||
Tuesday January 9, 2001. mcr@sandelman.ottawa.on.ca. Summary for 3.6 release
|
||||
Cleaned up documentation.
|
||||
Promisc mode fixes for Linux
|
||||
IPsec changes/cleanups.
|
||||
Alignment fixes for picky architectures
|
||||
|
||||
Removed dependency on native headers for packet dissectors.
|
||||
Removed Linux specific headers that were shipped
|
||||
|
||||
libpcap changes provide for exchanging capture files between
|
||||
systems. Save files now have well known PACKET_ values instead of
|
||||
depending upon system dependant mappings of DLT_* types.
|
||||
|
||||
Support for computing/checking IP and UDP/TCP checksums.
|
||||
|
||||
Updated autoconf stock files.
|
||||
|
||||
IPv6 improvements: dhcp (draft-15), mobile-ip6, ppp, ospf6,
|
||||
|
||||
Added dissector support for: ISOCLNS, Token Ring, IGMPv3, bxxp,
|
||||
timed, vrrp, radius, chdlc, cnfp, cdp, IEEE802.1d, raw-AppleTalk
|
||||
|
||||
Added filtering support for: VLANs, ESIS, ISIS
|
||||
|
||||
Improvements to: print-telnet, IPTalk, bootp/dhcp, ECN, PPP,
|
||||
L2TP, PPPoE
|
||||
|
||||
HP-UX 11.0 -- find the right dlpi device.
|
||||
Solaris 8 - IPv6 works
|
||||
Linux - Added support for an "any" device to capture on all interfaces
|
||||
|
||||
Security fixes: buffer overrun audit done. Strcpy replaced with
|
||||
strlcpy, sprintf replaced with snprintf.
|
||||
Look for lex problems, and warn about them.
|
||||
|
||||
|
||||
v3.5 Fri Jan 28 18:00:00 PST 2000
|
||||
|
||||
Bill Fenner <fenner@research.att.com>
|
||||
@ -43,7 +81,6 @@ Love <lha@stacken.kth.se>
|
||||
Michael C. Richardson <mcr@sandelman.ottawa.on.ca>
|
||||
- Created tcpdump.org repository
|
||||
|
||||
|
||||
v3.4 Sat Jul 25 12:40:55 PDT 1998
|
||||
|
||||
- Hardwire Linux slip support since it's too hard to detect.
|
||||
@ -558,4 +595,4 @@ v2.0 Sun Jan 13 12:20:40 PST 1991
|
||||
|
||||
- Initial public release.
|
||||
|
||||
@(#) $Header: /tcpdump/master/tcpdump/CHANGES,v 1.63.2.1 2000/01/27 23:18:19 fenner Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/CHANGES,v 1.79 2001/01/10 20:13:58 mcr Exp $ (LBL)
|
||||
|
59
contrib/tcpdump/CREDITS
Normal file
59
contrib/tcpdump/CREDITS
Normal file
@ -0,0 +1,59 @@
|
||||
This file lists people who have contributed to tcpdump:
|
||||
|
||||
The current maintainers:
|
||||
Bill Fenner <fenner@research.att.com>
|
||||
Assar Westerlund <assar@sics.se>
|
||||
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
|
||||
Jun-ichiro itojun Hagino <itojun@iijlab.net>
|
||||
Guy Harris <guy@alum.mit.edu>
|
||||
Torsten Landschoff <t.landschoff@gmx.net>
|
||||
Michael Richardson <mcr@sandelman.ottawa.on.ca>
|
||||
Ken Hornstein <kenh@cmf.nrl.navy.mil>
|
||||
|
||||
Additional people who have contributed patches:
|
||||
|
||||
Alfredo Andres <aandres@s21sec.com>
|
||||
Andrew Tridgell <tridge@linuxcare.com>
|
||||
Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
||||
Chris G. Demetriou <cgd@netbsd.org>
|
||||
Craig Rodrigues <rodrigc@mediaone.net>
|
||||
Daniel Hagerty <hag@ai.mit.edu>
|
||||
Francisco Matias Cuenca-Acuna <mcuenca@george.rutgers.edu>
|
||||
Frank Volf <volf@oasis.IAEhv.nl>
|
||||
Gert Doering <gert@greenie.muc.de>
|
||||
Gilbert Ramirez Jr. <gram@xiexie.org>
|
||||
Gisle Vanem <gvanem@eunet.no>
|
||||
JINMEI Tatuya <jinmei@kame.net>
|
||||
Jefferson Ogata <jogata@nodc.noaa.gov>
|
||||
Jeffrey Hutzelman <jhutz@cmu.edu>
|
||||
Juergen Schoenwaelder <schoenw@ibr.cs.tu-bs.de>
|
||||
Ken Hornstein <kenh@cmf.nrl.navy.mil>
|
||||
Kevin Steves <stevesk@sweden.hp.com>
|
||||
Larry Lile <lile@stdio.com>
|
||||
Lennert Buytenhek <buytenh@gnu.org>
|
||||
Love Hörnquist-Åstrand <lha@stacken.kth.se>
|
||||
Marko Kiiskila <carnil@cs.tut.fi>
|
||||
Michael Shalayeff <mickey@openbsd.org>
|
||||
Michael T. Stolarchuk <mts@off.to>
|
||||
Monroe Williams <monroe@pobox.com>
|
||||
Motonori Shindo <mshindo@mshindo.net>
|
||||
Olaf Kirch <okir@caldera.de>
|
||||
Onno van der Linden <onno@simplex.nl>
|
||||
Pascal Hennequin <pascal.hennequin@int-evry.fr>
|
||||
Pasvorn Boonmark <boonmark@juniper.net>
|
||||
Pekka Savola <pekkas@netcore.fi>
|
||||
Peter Jeremy <peter.jeremy@alcatel.com.au>
|
||||
Rafal Maszkowski <rzm@icm.edu.pl>
|
||||
Rick Jones <raj@cup.hp.com>
|
||||
Roderick Schertler <roderick@argon.org>
|
||||
Sebastian Krahmer <krahmer@cs.uni-potsdam.de>
|
||||
Timo Koskiahde
|
||||
Tony Li <tli@jnx.com>
|
||||
Wilbert de Graaf <wilbertdg@hetnet.nl>
|
||||
Kris Kennaway <kris@freebsd.org>
|
||||
Ben Smithurst <ben@scientia.demon.co.uk>
|
||||
|
||||
The original LBL crew:
|
||||
Steve McCanne
|
||||
Craig Leres
|
||||
Van Jacobson
|
@ -1,21 +1,30 @@
|
||||
CHANGES
|
||||
CREDITS
|
||||
FILES
|
||||
INSTALL
|
||||
LICENSE
|
||||
Makefile.in
|
||||
README
|
||||
VERSION
|
||||
acconfig.h
|
||||
aclocal.m4
|
||||
addrtoname.c
|
||||
addrtoname.h
|
||||
ah.h
|
||||
appletalk.h
|
||||
atime.awk
|
||||
bootp.h
|
||||
bpf_dump.c
|
||||
chdlc.h
|
||||
config.guess
|
||||
config.h.in
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
decnet.h
|
||||
dhcp6.h
|
||||
dhcp6opt.h
|
||||
esp.h
|
||||
ether.h
|
||||
ethertype.h
|
||||
extract.h
|
||||
fddi.h
|
||||
@ -24,80 +33,134 @@ gmt2local.h
|
||||
igrp.h
|
||||
install-sh
|
||||
interface.h
|
||||
ip.h
|
||||
ipsec_doi.h
|
||||
ipx.h
|
||||
lbl/gnuc.h
|
||||
isakmp.h
|
||||
l2tp.h
|
||||
lane.h
|
||||
lbl/os-solaris2.h
|
||||
lbl/os-sunos4.h
|
||||
lbl/os-ultrix4.h
|
||||
linux-include/net/slcompress.h
|
||||
linux-include/net/slip.h
|
||||
linux-include/netinet/if_ether.h
|
||||
linux-include/netinet/in_systm.h
|
||||
linux-include/netinet/ip.h
|
||||
linux-include/netinet/ip_icmp.h
|
||||
linux-include/netinet/ip_var.h
|
||||
linux-include/netinet/tcp.h
|
||||
linux-include/netinet/tcp_var.h
|
||||
linux-include/netinet/tcpip.h
|
||||
linux-include/netinet/udp.h
|
||||
linux-include/netinet/udp_var.h
|
||||
linux-include/sys/mbuf.h
|
||||
llc.h
|
||||
machdep.c
|
||||
machdep.h
|
||||
makemib
|
||||
mib.h
|
||||
missing/addrinfo.h
|
||||
missing/addrsize.h
|
||||
missing/bittypes.h
|
||||
missing/getaddrinfo.c
|
||||
missing/getnameinfo.c
|
||||
missing/inet_aton.c
|
||||
missing/inet_ntop.c
|
||||
missing/inet_pton.c
|
||||
missing/resolv6.h
|
||||
missing/resolv_ext.h
|
||||
missing/snprintf.c
|
||||
missing/sockstorage.h
|
||||
missing/strlcat.c
|
||||
missing/strlcpy.c
|
||||
mkdep
|
||||
nameser.h
|
||||
netbios.h
|
||||
nfs.h
|
||||
nfsfh.h
|
||||
nfsv2.h
|
||||
ntp.h
|
||||
oakley.h
|
||||
ospf.h
|
||||
ospf6.h
|
||||
packetdat.awk
|
||||
parsenfsfh.c
|
||||
ppp.h
|
||||
print-ah.c
|
||||
print-arp.c
|
||||
print-ascii.c
|
||||
print-atalk.c
|
||||
print-atm.c
|
||||
print-bgp.c
|
||||
print-bootp.c
|
||||
print-bxxp.c
|
||||
print-cdp.c
|
||||
print-chdlc.c
|
||||
print-cip.c
|
||||
print-cnfp.c
|
||||
print-decnet.c
|
||||
print-dhcp6.c
|
||||
print-domain.c
|
||||
print-dvmrp.c
|
||||
print-egp.c
|
||||
print-esp.c
|
||||
print-ether.c
|
||||
print-fddi.c
|
||||
print-frag6.c
|
||||
print-gre.c
|
||||
print-icmp.c
|
||||
print-icmp6.c
|
||||
print-igmp.c
|
||||
print-igrp.c
|
||||
print-ip.c
|
||||
print-ip6.c
|
||||
print-ip6opts.c
|
||||
print-ipcomp.c
|
||||
print-ipx.c
|
||||
print-isakmp.c
|
||||
print-isoclns.c
|
||||
print-krb.c
|
||||
print-l2tp.c
|
||||
print-lane.c
|
||||
print-lcp.c
|
||||
print-llc.c
|
||||
print-mobile.c
|
||||
print-netbios.c
|
||||
print-nfs.c
|
||||
print-ntp.c
|
||||
print-null.c
|
||||
print-ospf.c
|
||||
print-ospf6.c
|
||||
print-pim.c
|
||||
print-ppp.c
|
||||
print-pppoe.c
|
||||
print-radius.c
|
||||
print-raw.c
|
||||
print-rip.c
|
||||
print-ripng.c
|
||||
print-rt6.c
|
||||
print-rx.c
|
||||
print-sl.c
|
||||
print-sll.c
|
||||
print-smb.c
|
||||
print-snmp.c
|
||||
print-stp.c
|
||||
print-sunrpc.c
|
||||
print-tcp.c
|
||||
print-telnet.c
|
||||
print-tftp.c
|
||||
print-timed.c
|
||||
print-token.c
|
||||
print-udp.c
|
||||
print-vjc.c
|
||||
print-vrrp.c
|
||||
print-wb.c
|
||||
route6d.h
|
||||
rx.h
|
||||
savestr.c
|
||||
savestr.h
|
||||
send-ack.awk
|
||||
setsignal.c
|
||||
setsignal.h
|
||||
slip.h
|
||||
slcompress.h
|
||||
sll.h
|
||||
smb.h
|
||||
smbutil.c
|
||||
stime.awk
|
||||
strcasecmp.c
|
||||
tcp.h
|
||||
tcpdump.1
|
||||
tcpdump.c
|
||||
timed.h
|
||||
token.h
|
||||
udp.h
|
||||
util.c
|
||||
vfprintf.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.36.1.1.2.2 2000/01/29 17:02:09 itojun Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.47 2000/12/16 09:07:45 guy Exp $ (LBL)
|
||||
|
||||
If you have not built libpcap, do so first. See the README
|
||||
file in this directory for the ftp location.
|
||||
@ -7,64 +7,44 @@ You will need an ANSI C compiler to build tcpdump. The configure script
|
||||
will abort if your compiler is not ANSI compliant. If this happens, use
|
||||
the GNU C compiler, available via anonymous ftp:
|
||||
|
||||
ftp://prep.ai.mit.edu/pub/gnu/gcc.tar.gz
|
||||
ftp://ftp.gnu.org/pub/gnu/gcc/
|
||||
|
||||
After libpcap has been built (either install it with "make install" and
|
||||
"make install-incl" or make sure both the libpcap and tcpdump source
|
||||
trees are in the same directory), edit the BINDEST and MANDEST paths in
|
||||
Makefile.in and run ./configure (a shell script). "configure" will
|
||||
After libpcap has been built (either install it with "make install" or
|
||||
make sure both the libpcap and tcpdump source trees are in the same
|
||||
directory), run ./configure (a shell script). "configure" will
|
||||
determine your system attributes and generate an appropriate Makefile
|
||||
from Makefile.in. Now build tcpdump by running "make".
|
||||
|
||||
If everything builds ok, su and type "make install" (and optionally
|
||||
"make install-man). This will install tcpdump and the manual entry. By
|
||||
default, tcpdump is installed with group execute permissions. The group
|
||||
used depends on your os. In addition, BPF packet access is controlled
|
||||
by permissions to /dev/bpf0. In any case, DO NOT give untrusted users
|
||||
the capability of running tcpdump. Tcpdump can capture any traffic on
|
||||
your net, including passwords.
|
||||
If everything builds ok, su and type "make install". This will install
|
||||
tcpdump and the manual entry. By default, tcpdump is installed with
|
||||
group execute permissions. The group used depends on your os. In
|
||||
addition, BPF packet access is controlled by permissions to
|
||||
/dev/bpf0. In any case, DO NOT give untrusted users the capability of
|
||||
running tcpdump. Tcpdump can capture any traffic on your net,
|
||||
including passwords.
|
||||
|
||||
Note that tcpdump is shipped with some systems, for example, DEC/OSF
|
||||
and BSD/386. Remember to remove or rename the installed binary
|
||||
when upgrading.
|
||||
Note that most systems ship tcpdump, but usually an older version.
|
||||
Remember to remove or rename the installed binary when upgrading.
|
||||
|
||||
If you use Linux, this version of libpcap is known to compile and run
|
||||
under Red Hat 4.0 with the 2.0.25 kernel. It may work with earlier 2.X
|
||||
versions but is guaranteed not to work with 1.X kernels.
|
||||
|
||||
If you use OSF 4, note that that there appears to be some serious bugs
|
||||
with the stock C compiler. The configure code fragments that detect if
|
||||
the ether_header and ether_arp structs use the ether_addr struct
|
||||
generates warnings instead of fatal errors (?!?!) This makes configure
|
||||
think that the ether_arp struct is used when in fact it is not. To get
|
||||
around this, comment out:
|
||||
|
||||
#define ETHER_HEADER_HAS_EA 1
|
||||
and
|
||||
#define ETHER_ARP_HAS_EA 1
|
||||
|
||||
from config.h after running configure (and before attempting to
|
||||
compile tcpdump).
|
||||
|
||||
Another workaround is to use gcc.
|
||||
with 2.0.25 and more modern, and 2.2.x kernels. It is guaranteed not
|
||||
to work with 1.X kernels.
|
||||
|
||||
If your system is not one which we have tested tcpdump on, you may have
|
||||
to modify the configure script and Makefile.in. Please send us patches
|
||||
for any modifications you need to make.
|
||||
|
||||
== Tested platforms ==
|
||||
NetBSD 1.4.1/i386 (mcr)
|
||||
RedHat Linux 6.1/i386 (assar)
|
||||
Please see "PLATFORMS" for notes about tested platforms.
|
||||
|
||||
|
||||
FILES
|
||||
-----
|
||||
CHANGES - description of differences between releases
|
||||
CREDITS - people that have helped tcpdump along
|
||||
FILES - list of files exported as part of the distribution
|
||||
INSTALL - this file
|
||||
Makefile.in - compilation rules (input to the configure script)
|
||||
README - description of distribution
|
||||
README-AFS -
|
||||
VERSION - version of this release
|
||||
acconfig.h - autoconf input
|
||||
aclocal.m4 - autoconf macros
|
||||
@ -73,7 +53,6 @@ addrtoname.h - address to hostname definitions
|
||||
appletalk.h - AppleTalk definitions
|
||||
atime.awk - TCP ack awk script
|
||||
bootp.h - BOOTP definitions
|
||||
bpf_dump.c - bpf instruction pretty-printer routine
|
||||
config.guess - autoconf support
|
||||
config.h.in - autoconf input
|
||||
config.sub - autoconf support
|
||||
@ -97,7 +76,6 @@ l2tp.h -
|
||||
lane.h -
|
||||
lbl/gnuc.h - gcc macros and defines
|
||||
lbl/os-*.h - os dependent defines and prototypes
|
||||
linux-include/* - network include files missing on Linux
|
||||
llc.h - LLC definitions
|
||||
machdep.c - machine dependent routines
|
||||
machdep.h - machine dependent definitions
|
||||
@ -105,6 +83,7 @@ makemib - mib to header script
|
||||
mib.h - mib definitions
|
||||
missing/* - replacements for missing library functions
|
||||
mkdep - construct Makefile dependency list
|
||||
nameser.h - DNS definitions
|
||||
netbios.h - NETBIOS definitions
|
||||
nfs.h - Network File System V2 definitions
|
||||
nfsfh.h - Network File System file handle definitions
|
||||
@ -123,7 +102,8 @@ print-atm.c - atm printer routines
|
||||
print-bgp.c - Border Gateway Protocol printer routines
|
||||
print-bootp.c - BOOTP and IPv4 DHCP printer routines
|
||||
print-chdlc.c - CHDLC printer routines
|
||||
print-cip.c -
|
||||
print-cip.c - Classical-IP over ATM routines
|
||||
print-cnfp.c - Cisco NetFlow printer routines
|
||||
print-decnet.c - DECnet printer routines
|
||||
print-dhcp6.c - IPv6 DHCP printer routines
|
||||
print-domain.c - Domain Name System printer routines
|
||||
@ -167,12 +147,15 @@ print-rx.c - AFS RX printer routines
|
||||
print-sl.c - Compressed Serial Line Internet Protocol printer routines
|
||||
print-smb.c - SMB (samba) printer routines
|
||||
print-snmp.c - Simple Network Management Protocol printer routines
|
||||
print-stp.c - IEEE 802.1d spanning tree protocol printer routines
|
||||
print-sunrpc.c - Sun Remote Procedure Call printer routines
|
||||
print-tcp.c - TCP printer routines
|
||||
print-telnet.c - Telnet option printer routines
|
||||
print-tftp.c - Trivial File Transfer Protocol printer routines
|
||||
print-token.c - Token Ring printer routines
|
||||
print-udp.c - UDP printer routines
|
||||
print-vjc.c - PPP Van Jacovson compression (RFC1144) printer routines
|
||||
print-vrrp.c - Virtual Router Redundancy Protocol
|
||||
print-wb.c - white board printer routines
|
||||
route6d.h - packet definition for IPv6 Routing Information Protocol
|
||||
rx.h -
|
||||
|
19
contrib/tcpdump/LICENSE
Normal file
19
contrib/tcpdump/LICENSE
Normal file
@ -0,0 +1,19 @@
|
||||
License: BSD
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. The names of the authors may not be used to endorse or promote
|
||||
products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
22
contrib/tcpdump/Makefile-devel-adds
Normal file
22
contrib/tcpdump/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
|
@ -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.219 1999/12/22 15:44:09 itojun Exp $ (LBL)
|
||||
# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.244 2000/12/21 10:43:20 guy Exp $ (LBL)
|
||||
|
||||
#
|
||||
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
||||
@ -27,9 +27,9 @@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
# Pathname of directory to install the binary
|
||||
BINDEST = @sbindir@
|
||||
sbindir = @sbindir@
|
||||
# Pathname of directory to install the man page
|
||||
MANDEST = @mandir@
|
||||
mandir = @mandir@
|
||||
|
||||
# VPATH
|
||||
srcdir = @srcdir@
|
||||
@ -55,6 +55,8 @@ LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
|
||||
# Also, gcc does not remove the .o before forking 'as', which can be a
|
||||
@ -66,17 +68,20 @@ INSTALL = @INSTALL@
|
||||
CSRC = tcpdump.c \
|
||||
print-arp.c print-atalk.c print-atm.c print-bootp.c \
|
||||
print-decnet.c print-domain.c print-dvmrp.c print-egp.c \
|
||||
print-ether.c print-fddi.c print-gre.c print-icmp.c \
|
||||
print-ether.c print-fddi.c print-gre.c print-icmp.c print-igmp.c \
|
||||
print-igrp.c print-ip.c print-ipx.c print-isoclns.c print-krb.c \
|
||||
print-llc.c print-nfs.c print-ntp.c print-null.c print-ospf.c \
|
||||
print-pim.c print-ppp.c print-raw.c print-rip.c print-sl.c \
|
||||
print-snmp.c print-sunrpc.c print-tcp.c print-tftp.c print-udp.c \
|
||||
print-wb.c addrtoname.c bpf_dump.c gmt2local.c machdep.c \
|
||||
print-snmp.c print-stp.c print-sunrpc.c print-tcp.c print-tftp.c \
|
||||
print-udp.c print-wb.c addrtoname.c gmt2local.c machdep.c \
|
||||
parsenfsfh.c util.c savestr.c setsignal.c \
|
||||
print-esp.c print-ah.c print-vjc.c print-isakmp.c print-chdlc.c \
|
||||
print-ipcomp.c print-mobile.c print-l2tp.c print-bgp.c print-rx.c \
|
||||
print-lane.c print-cip.c print-pppoe.c print-lcp.c \
|
||||
print-smb.c smbutil.c print-ascii.c print-telnet.c
|
||||
print-smb.c smbutil.c print-ascii.c print-telnet.c print-cnfp.c \
|
||||
print-vrrp.c print-cdp.c print-token.c print-bxxp.c print-timed.c \
|
||||
print-radius.c print-sll.c
|
||||
|
||||
LOCALSRC = @LOCALSRC@
|
||||
GENSRC = version.c
|
||||
LIBOBJS = @LIBOBJS@
|
||||
@ -85,13 +90,13 @@ SRC = $(CSRC) $(GENSRC) $(LOCALSRC)
|
||||
|
||||
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
|
||||
# hack the extra indirection
|
||||
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) @LIBOBJS@
|
||||
OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) $(LOCALSRC:.c=.o) $(LIBOBJS)
|
||||
HDR = addrtoname.h appletalk.h bootp.h decnet.h \
|
||||
ethertype.h extract.h fddi.h gmt2local.h igrp.h interface.h \
|
||||
ipx.h llc.h machdep.h mib.h nfsfh.h nfsv2.h ntp.h ospf.h \
|
||||
savestr.c setsignal.h \
|
||||
gnuc.h ipsec_doi.h isakmp.h l2tp.h netbios.h oakley.h ospf6.h ppp.h \
|
||||
route6d.h
|
||||
gnuc.h ipsec_doi.h isakmp.h l2tp.h nameser.h \
|
||||
netbios.h oakley.h ospf6.h ppp.h route6d.h
|
||||
|
||||
TAGHDR = \
|
||||
/usr/include/arpa/tftp.h \
|
||||
@ -124,6 +129,12 @@ inet_ntop.o: $(srcdir)/missing/inet_ntop.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/inet_ntop.c
|
||||
inet_aton.o: $(srcdir)/missing/inet_aton.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/inet_aton.c
|
||||
snprintf.o: $(srcdir)/missing/snprintf.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
|
||||
strlcat.o: $(srcdir)/missing/strlcat.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
|
||||
strlcpy.o: $(srcdir)/missing/strlcpy.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
|
||||
|
||||
version.o: version.c
|
||||
$(CC) $(CFLAGS) -c version.c
|
||||
@ -132,17 +143,19 @@ version.c: $(srcdir)/VERSION
|
||||
@rm -f $@
|
||||
sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
|
||||
|
||||
install: force
|
||||
[ -d $(DESTDIR)$(BINDEST) ] || mkdir -p $(DESTDIR)$(BINDEST)
|
||||
$(INSTALL) -m 550 -o bin -g @V_GROUP@ $(PROG) \
|
||||
$(DESTDIR)$(BINDEST)/$(PROG)
|
||||
install:
|
||||
[ -d $(DESTDIR)$(sbindir) ] || \
|
||||
(mkdir -p $(DESTDIR)$(sbindir); chmod 755 $(DESTDIR)$(sbindir))
|
||||
$(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG)
|
||||
[ -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-man: force
|
||||
[ -d $(DESTDIR)$(MANDEST)/man1 ] || mkdir -p $(DESTDIR)$(MANDEST)/man1
|
||||
$(INSTALL) -m 444 -o bin -g bin $(srcdir)/$(PROG).1 \
|
||||
$(DESTDIR)$(MANDEST)/man1/$(PROG).1
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(sbindir)/$(PROG)
|
||||
rm -f $(DESTDIR)$(mandir)/man1/$(PROG).1
|
||||
|
||||
lint: $(GENSRC) force
|
||||
lint: $(GENSRC)
|
||||
lint -hbxn $(SRC) | \
|
||||
grep -v 'struct/union .* never defined' | \
|
||||
grep -v 'possible pointer alignment problem'
|
||||
@ -152,14 +165,14 @@ clean:
|
||||
|
||||
distclean:
|
||||
rm -f $(CLEANFILES) Makefile config.cache config.log config.status \
|
||||
config.h gnuc.h os-proto.h
|
||||
config.h gnuc.h os-proto.h stamp-h stamp-h.in
|
||||
|
||||
tags: $(TAGFILES)
|
||||
ctags -wtd $(TAGFILES)
|
||||
|
||||
tar: force
|
||||
tar:
|
||||
@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
|
||||
list="" ; tar="tar chFFf" ; \
|
||||
list="" ; tar="tar chf" ; \
|
||||
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
|
||||
echo \
|
||||
"rm -f ../$$name; ln -s $$dir ../$$name" ; \
|
||||
@ -171,6 +184,5 @@ tar: force
|
||||
"rm -f ../$$name" ; \
|
||||
rm -f ../$$name
|
||||
|
||||
force: /tmp
|
||||
depend: $(GENSRC) force
|
||||
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
|
||||
depend: $(GENSRC)
|
||||
${srcdir}/mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
|
||||
|
8
contrib/tcpdump/PLATFORMS
Normal file
8
contrib/tcpdump/PLATFORMS
Normal file
@ -0,0 +1,8 @@
|
||||
== Tested platforms ==
|
||||
NetBSD 1.5/i386 (mcr - 2000/12/8)
|
||||
|
||||
---
|
||||
RedHat Linux 6.1/i386 (assar)
|
||||
FreeBSD 2.2.8/i386 (itojun)
|
||||
|
||||
|
@ -1,20 +1,36 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.54.1.1 1999/10/07 23:47:09 mcr Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.58 2000/12/08 06:59:11 mcr Exp $ (LBL)
|
||||
|
||||
TCPDUMP 3.4
|
||||
Lawrence Berkeley National Laboratory
|
||||
Network Research Group
|
||||
tcpdump@ee.lbl.gov
|
||||
ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
|
||||
TCPDUMP 3.6
|
||||
Now maintained by "The Tcpdump Group"
|
||||
See www.tcpdump.org
|
||||
|
||||
Please send inquiries/comments/reports to tcpdump-workers@tcpdump.org
|
||||
|
||||
Anonymous CVS is available via:
|
||||
cvs -d cvs.tcpdump.org:/tcpdump/master login
|
||||
(password "anoncvs")
|
||||
cvs -d cvs.tcpdump.org:/tcpdump/master checkout tcpdump
|
||||
|
||||
Version 3.6 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_6":
|
||||
cvs -d cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_6 tcpdump
|
||||
|
||||
Please send patches against the master copy to patches@tcpdump.org.
|
||||
|
||||
formerly from Lawrence Berkeley National Laboratory
|
||||
Network Research Group <tcpdump@ee.lbl.gov>
|
||||
ftp://ftp.ee.lbl.gov/tcpdump.tar.Z (3.4)
|
||||
|
||||
This directory contains source code for tcpdump, a tool for network
|
||||
monitoring and data acquisition. The original distribution is
|
||||
available via anonymous ftp to ftp.ee.lbl.gov, in tcpdump.tar.Z.
|
||||
monitoring and data acquisition. This software was originally
|
||||
developed by the Network Research Group at the Lawrence Berkeley
|
||||
National Laboratory. The original distribution is available via
|
||||
anonymous ftp to ftp.ee.lbl.gov, in tcpdump.tar.Z. More recent
|
||||
development is performed at tcpdump.org, http://www.tcpdump.org/
|
||||
|
||||
Tcpdump now uses libpcap, a system-independent interface for user-level
|
||||
Tcpdump uses libpcap, a system-independent interface for user-level
|
||||
packet capture. Before building tcpdump, you must first retrieve and
|
||||
build libpcap, also from LBL, in:
|
||||
|
||||
ftp://ftp.ee.lbl.gov/libpcap.tar.Z
|
||||
build libpcap, also originally from LBL and now being maintained by
|
||||
tcpdump.org; see http://www.tcpdump.org/ .
|
||||
|
||||
Once libpcap is built (either install it or make sure it's in
|
||||
../libpcap), you can build tcpdump using the procedure in the INSTALL
|
||||
@ -50,13 +66,18 @@ It is a program that can be used to extract portions of tcpdump binary
|
||||
trace files. See the above distribution for further details and
|
||||
documentation.
|
||||
|
||||
Problems, bugs, questions, desirable enhancements, source code
|
||||
contributions, etc., should be sent to the email address
|
||||
"tcpdump@ee.lbl.gov".
|
||||
Problems, bugs, questions, desirable enhancements, etc.
|
||||
should be sent to the address "tcpdump-workers@tcpdump.org".
|
||||
|
||||
Source code contributions, etc. should be sent to the email address
|
||||
"patches@tcpdump.org".
|
||||
|
||||
Current versions can be found at www.tcpdump.org
|
||||
|
||||
- The TCPdump team
|
||||
|
||||
original text by: Steve McCanne, Craig Leres, Van Jacobson
|
||||
|
||||
- Steve McCanne
|
||||
Craig Leres
|
||||
Van Jacobson
|
||||
-------------------------------------
|
||||
This directory also contains some short awk programs intended as
|
||||
examples of ways to reduce tcpdump data when you're tracking
|
||||
@ -205,4 +226,3 @@ The method was:
|
||||
- Once a week, tell your funding agent that you're discovering
|
||||
wonderful things and you'll write up that research report
|
||||
"real soon now".
|
||||
|
||||
|
6
contrib/tcpdump/TODO
Normal file
6
contrib/tcpdump/TODO
Normal file
@ -0,0 +1,6 @@
|
||||
1. update credits
|
||||
2. review "FILES"
|
||||
3. search for version info
|
||||
4. get PLATFORMS filled in
|
||||
5. update CHANGES file
|
||||
6. do same for libpcap
|
@ -1 +1 @@
|
||||
3.5
|
||||
3.6
|
||||
|
@ -2,14 +2,10 @@
|
||||
* make them to acconfig.h and rerun autoheader */
|
||||
@TOP@
|
||||
|
||||
/* Define if you have SSLeay XXX why isn't this HAVE_LIBCRYPTO? */
|
||||
#undef CRYPTO
|
||||
|
||||
/* Define if you have SSLeay 0.9.0b with the buggy cast128. */
|
||||
#undef HAVE_BUGGY_CAST128
|
||||
|
||||
/* Define both to enable IPv6 support XXX why 2? ENABLE_IPV6 is not used. */
|
||||
#undef ENABLE_IPV6
|
||||
/* Define if you enable IPv6 support */
|
||||
#undef INET6
|
||||
|
||||
/* Define if you enable support for the libsmi. */
|
||||
@ -18,14 +14,6 @@
|
||||
/* Define if you have the <smi.h> header file. */
|
||||
#undef HAVE_SMI_H
|
||||
|
||||
/* Is T_AAAA predefined? */
|
||||
#undef HAVE_AAAA
|
||||
|
||||
/* Fallback definition if not in headers */
|
||||
/* XXX why is this not #ifndef HAVE_AAA #define T_AAAA ... ? */
|
||||
/* XXX or even #ifndef T_AAAA ... */
|
||||
#undef T_AAAA
|
||||
|
||||
/* define if you have struct __res_state_ext */
|
||||
#undef HAVE_RES_STATE_EXT
|
||||
|
||||
@ -38,11 +26,6 @@
|
||||
*/
|
||||
#undef ETHER_HEADER_HAS_EA
|
||||
|
||||
/*
|
||||
* define if struct ether_arp.arp_sha is a struct with ether_addr_octet
|
||||
*/
|
||||
#undef ETHER_ARP_HAS_EA
|
||||
|
||||
/* define if struct ether_arp contains arp_xsha */
|
||||
#undef ETHER_ARP_HAS_X
|
||||
|
||||
@ -61,9 +44,6 @@
|
||||
/* define if INADDRSZ is defined (XXX not used!) */
|
||||
#undef HAVE_INADDRSZ
|
||||
|
||||
/* define if you have <net/slip.h> */
|
||||
#undef HAVE_NET_SLIP_H
|
||||
|
||||
/* define if this is a development version, to use additional prototypes. */
|
||||
#undef HAVE_OS_PROTO_H
|
||||
|
||||
@ -79,6 +59,9 @@
|
||||
/* define if you have struct sockaddr_storage */
|
||||
#undef HAVE_SOCKADDR_STORAGE
|
||||
|
||||
/* define if you have both getipnodebyname() and getipnodebyaddr() */
|
||||
#undef USE_GETIPNODEBY
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
@ -94,9 +77,6 @@
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
/* OSF hack: "Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h" */
|
||||
#undef __STDC__
|
||||
|
||||
/* Workaround for missing sized types */
|
||||
/* XXX this should move to the more standard uint*_t */
|
||||
#undef int16_t
|
||||
|
57
contrib/tcpdump/ah.h
Normal file
57
contrib/tcpdump/ah.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* $NetBSD: ah.h,v 1.12 2000/07/23 05:23:04 itojun Exp $ */
|
||||
/* $KAME: ah.h,v 1.12 2000/07/20 17:41:01 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* RFC1826/2402 authentication header.
|
||||
*/
|
||||
|
||||
#ifndef _NETINET6_AH_H_
|
||||
#define _NETINET6_AH_H_
|
||||
|
||||
struct ah {
|
||||
u_int8_t ah_nxt; /* Next Header */
|
||||
u_int8_t ah_len; /* Length of data, in 32bit */
|
||||
u_int16_t ah_reserve; /* Reserved for future use */
|
||||
u_int32_t ah_spi; /* Security parameter index */
|
||||
/* variable size, 32bit bound*/ /* Authentication data */
|
||||
};
|
||||
|
||||
struct newah {
|
||||
u_int8_t ah_nxt; /* Next Header */
|
||||
u_int8_t ah_len; /* Length of data + 1, in 32bit */
|
||||
u_int16_t ah_reserve; /* Reserved for future use */
|
||||
u_int32_t ah_spi; /* Security parameter index */
|
||||
u_int32_t ah_seq; /* Sequence number field */
|
||||
/* variable size, 32bit bound*/ /* Authentication data */
|
||||
};
|
||||
|
||||
#endif /*_NETINET6_AH_H_*/
|
@ -20,13 +20,13 @@
|
||||
*
|
||||
* AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.12.1.1 1999/10/07 23:47:09 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.13 2000/10/03 02:54:54 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
struct LAP {
|
||||
u_char dst;
|
||||
u_char src;
|
||||
u_char type;
|
||||
u_int8_t dst;
|
||||
u_int8_t src;
|
||||
u_int8_t type;
|
||||
};
|
||||
#define lapShortDDP 1 /* short DDP type */
|
||||
#define lapDDP 2 /* DDP type */
|
||||
@ -35,22 +35,22 @@ struct LAP {
|
||||
/* Datagram Delivery Protocol */
|
||||
|
||||
struct atDDP {
|
||||
u_short length;
|
||||
u_short checksum;
|
||||
u_short dstNet;
|
||||
u_short srcNet;
|
||||
u_char dstNode;
|
||||
u_char srcNode;
|
||||
u_char dstSkt;
|
||||
u_char srcSkt;
|
||||
u_char type;
|
||||
u_int16_t length;
|
||||
u_int16_t checksum;
|
||||
u_int16_t dstNet;
|
||||
u_int16_t srcNet;
|
||||
u_int8_t dstNode;
|
||||
u_int8_t srcNode;
|
||||
u_int8_t dstSkt;
|
||||
u_int8_t srcSkt;
|
||||
u_int8_t type;
|
||||
};
|
||||
|
||||
struct atShortDDP {
|
||||
u_short length;
|
||||
u_char dstSkt;
|
||||
u_char srcSkt;
|
||||
u_char type;
|
||||
u_int16_t length;
|
||||
u_int8_t dstSkt;
|
||||
u_int8_t srcSkt;
|
||||
u_int8_t type;
|
||||
};
|
||||
|
||||
#define ddpMaxWKS 0x7F
|
||||
@ -73,9 +73,9 @@ struct atShortDDP {
|
||||
/* AppleTalk Transaction Protocol */
|
||||
|
||||
struct atATP {
|
||||
u_char control;
|
||||
u_char bitmap;
|
||||
u_short transID;
|
||||
u_int8_t control;
|
||||
u_int8_t bitmap;
|
||||
u_int16_t transID;
|
||||
int32_t userData;
|
||||
};
|
||||
|
||||
@ -94,8 +94,8 @@ struct atATP {
|
||||
/* AppleTalk Echo Protocol */
|
||||
|
||||
struct atEcho {
|
||||
u_char echoFunction;
|
||||
u_char *echoData;
|
||||
u_int8_t echoFunction;
|
||||
u_int8_t *echoData;
|
||||
};
|
||||
|
||||
#define echoSkt 4 /* the echoer socket */
|
||||
@ -107,15 +107,15 @@ struct atEcho {
|
||||
/* Name Binding Protocol */
|
||||
|
||||
struct atNBP {
|
||||
u_char control;
|
||||
u_char id;
|
||||
u_int8_t control;
|
||||
u_int8_t id;
|
||||
};
|
||||
|
||||
struct atNBPtuple {
|
||||
u_short net;
|
||||
u_char node;
|
||||
u_char skt;
|
||||
u_char enumerator;
|
||||
u_int16_t net;
|
||||
u_int8_t node;
|
||||
u_int8_t skt;
|
||||
u_int8_t enumerator;
|
||||
};
|
||||
|
||||
#define nbpBrRq 0x10
|
||||
@ -141,8 +141,8 @@ struct atNBPtuple {
|
||||
/* Zone Information Protocol */
|
||||
|
||||
struct zipHeader {
|
||||
u_char command;
|
||||
u_char netcount;
|
||||
u_int8_t command;
|
||||
u_int8_t netcount;
|
||||
};
|
||||
|
||||
#define zipHeaderSize 2
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.8 1999/10/17 23:35:46 mcr Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.10 2000/12/03 23:42:23 fenner Exp $ (LBL) */
|
||||
/*
|
||||
* Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
|
||||
*
|
||||
@ -21,21 +21,21 @@
|
||||
|
||||
|
||||
struct bootp {
|
||||
unsigned char bp_op; /* packet opcode type */
|
||||
unsigned char bp_htype; /* hardware addr type */
|
||||
unsigned char bp_hlen; /* hardware addr length */
|
||||
unsigned char bp_hops; /* gateway hops */
|
||||
u_int8_t bp_op; /* packet opcode type */
|
||||
u_int8_t bp_htype; /* hardware addr type */
|
||||
u_int8_t bp_hlen; /* hardware addr length */
|
||||
u_int8_t bp_hops; /* gateway hops */
|
||||
u_int32_t bp_xid; /* transaction ID */
|
||||
unsigned short bp_secs; /* seconds since boot began */
|
||||
unsigned short bp_flags; /* flags: 0x8000 is broadcast */
|
||||
u_int16_t bp_secs; /* seconds since boot began */
|
||||
u_int16_t bp_flags; /* flags: 0x8000 is broadcast */
|
||||
struct in_addr bp_ciaddr; /* client IP address */
|
||||
struct in_addr bp_yiaddr; /* 'your' IP address */
|
||||
struct in_addr bp_siaddr; /* server IP address */
|
||||
struct in_addr bp_giaddr; /* gateway IP address */
|
||||
unsigned char bp_chaddr[16]; /* client hardware address */
|
||||
unsigned char bp_sname[64]; /* server host name */
|
||||
unsigned char bp_file[128]; /* boot file name */
|
||||
unsigned char bp_vend[64]; /* vendor-specific area */
|
||||
u_int8_t bp_chaddr[16]; /* client hardware address */
|
||||
u_int8_t bp_sname[64]; /* server host name */
|
||||
u_int8_t bp_file[128]; /* boot file name */
|
||||
u_int8_t bp_vend[64]; /* vendor-specific area */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -65,85 +65,127 @@ struct bootp {
|
||||
* the vendor field of the packet.
|
||||
*/
|
||||
|
||||
#define TAG_PAD ((unsigned char) 0)
|
||||
#define TAG_SUBNET_MASK ((unsigned char) 1)
|
||||
#define TAG_TIME_OFFSET ((unsigned char) 2)
|
||||
#define TAG_GATEWAY ((unsigned char) 3)
|
||||
#define TAG_TIME_SERVER ((unsigned char) 4)
|
||||
#define TAG_NAME_SERVER ((unsigned char) 5)
|
||||
#define TAG_DOMAIN_SERVER ((unsigned char) 6)
|
||||
#define TAG_LOG_SERVER ((unsigned char) 7)
|
||||
#define TAG_COOKIE_SERVER ((unsigned char) 8)
|
||||
#define TAG_LPR_SERVER ((unsigned char) 9)
|
||||
#define TAG_IMPRESS_SERVER ((unsigned char) 10)
|
||||
#define TAG_RLP_SERVER ((unsigned char) 11)
|
||||
#define TAG_HOSTNAME ((unsigned char) 12)
|
||||
#define TAG_BOOTSIZE ((unsigned char) 13)
|
||||
#define TAG_END ((unsigned char) 255)
|
||||
#define TAG_PAD ((u_int8_t) 0)
|
||||
#define TAG_SUBNET_MASK ((u_int8_t) 1)
|
||||
#define TAG_TIME_OFFSET ((u_int8_t) 2)
|
||||
#define TAG_GATEWAY ((u_int8_t) 3)
|
||||
#define TAG_TIME_SERVER ((u_int8_t) 4)
|
||||
#define TAG_NAME_SERVER ((u_int8_t) 5)
|
||||
#define TAG_DOMAIN_SERVER ((u_int8_t) 6)
|
||||
#define TAG_LOG_SERVER ((u_int8_t) 7)
|
||||
#define TAG_COOKIE_SERVER ((u_int8_t) 8)
|
||||
#define TAG_LPR_SERVER ((u_int8_t) 9)
|
||||
#define TAG_IMPRESS_SERVER ((u_int8_t) 10)
|
||||
#define TAG_RLP_SERVER ((u_int8_t) 11)
|
||||
#define TAG_HOSTNAME ((u_int8_t) 12)
|
||||
#define TAG_BOOTSIZE ((u_int8_t) 13)
|
||||
#define TAG_END ((u_int8_t) 255)
|
||||
/* RFC1497 tags */
|
||||
#define TAG_DUMPPATH ((unsigned char) 14)
|
||||
#define TAG_DOMAINNAME ((unsigned char) 15)
|
||||
#define TAG_SWAP_SERVER ((unsigned char) 16)
|
||||
#define TAG_ROOTPATH ((unsigned char) 17)
|
||||
#define TAG_EXTPATH ((unsigned char) 18)
|
||||
#define TAG_DUMPPATH ((u_int8_t) 14)
|
||||
#define TAG_DOMAINNAME ((u_int8_t) 15)
|
||||
#define TAG_SWAP_SERVER ((u_int8_t) 16)
|
||||
#define TAG_ROOTPATH ((u_int8_t) 17)
|
||||
#define TAG_EXTPATH ((u_int8_t) 18)
|
||||
/* RFC2132 */
|
||||
#define TAG_IP_FORWARD ((unsigned char) 19)
|
||||
#define TAG_NL_SRCRT ((unsigned char) 20)
|
||||
#define TAG_PFILTERS ((unsigned char) 21)
|
||||
#define TAG_REASS_SIZE ((unsigned char) 22)
|
||||
#define TAG_DEF_TTL ((unsigned char) 23)
|
||||
#define TAG_MTU_TIMEOUT ((unsigned char) 24)
|
||||
#define TAG_MTU_TABLE ((unsigned char) 25)
|
||||
#define TAG_INT_MTU ((unsigned char) 26)
|
||||
#define TAG_LOCAL_SUBNETS ((unsigned char) 27)
|
||||
#define TAG_BROAD_ADDR ((unsigned char) 28)
|
||||
#define TAG_DO_MASK_DISC ((unsigned char) 29)
|
||||
#define TAG_SUPPLY_MASK ((unsigned char) 30)
|
||||
#define TAG_DO_RDISC ((unsigned char) 31)
|
||||
#define TAG_RTR_SOL_ADDR ((unsigned char) 32)
|
||||
#define TAG_STATIC_ROUTE ((unsigned char) 33)
|
||||
#define TAG_USE_TRAILERS ((unsigned char) 34)
|
||||
#define TAG_ARP_TIMEOUT ((unsigned char) 35)
|
||||
#define TAG_ETH_ENCAP ((unsigned char) 36)
|
||||
#define TAG_TCP_TTL ((unsigned char) 37)
|
||||
#define TAG_TCP_KEEPALIVE ((unsigned char) 38)
|
||||
#define TAG_KEEPALIVE_GO ((unsigned char) 39)
|
||||
#define TAG_NIS_DOMAIN ((unsigned char) 40)
|
||||
#define TAG_NIS_SERVERS ((unsigned char) 41)
|
||||
#define TAG_NTP_SERVERS ((unsigned char) 42)
|
||||
#define TAG_VENDOR_OPTS ((unsigned char) 43)
|
||||
#define TAG_NETBIOS_NS ((unsigned char) 44)
|
||||
#define TAG_NETBIOS_DDS ((unsigned char) 45)
|
||||
#define TAG_NETBIOS_NODE ((unsigned char) 46)
|
||||
#define TAG_NETBIOS_SCOPE ((unsigned char) 47)
|
||||
#define TAG_XWIN_FS ((unsigned char) 48)
|
||||
#define TAG_XWIN_DM ((unsigned char) 49)
|
||||
#define TAG_NIS_P_DOMAIN ((unsigned char) 64)
|
||||
#define TAG_NIS_P_SERVERS ((unsigned char) 65)
|
||||
#define TAG_MOBILE_HOME ((unsigned char) 68)
|
||||
#define TAG_SMPT_SERVER ((unsigned char) 69)
|
||||
#define TAG_POP3_SERVER ((unsigned char) 70)
|
||||
#define TAG_NNTP_SERVER ((unsigned char) 71)
|
||||
#define TAG_WWW_SERVER ((unsigned char) 72)
|
||||
#define TAG_FINGER_SERVER ((unsigned char) 73)
|
||||
#define TAG_IRC_SERVER ((unsigned char) 74)
|
||||
#define TAG_STREETTALK_SRVR ((unsigned char) 75)
|
||||
#define TAG_STREETTALK_STDA ((unsigned char) 76)
|
||||
#define TAG_IP_FORWARD ((u_int8_t) 19)
|
||||
#define TAG_NL_SRCRT ((u_int8_t) 20)
|
||||
#define TAG_PFILTERS ((u_int8_t) 21)
|
||||
#define TAG_REASS_SIZE ((u_int8_t) 22)
|
||||
#define TAG_DEF_TTL ((u_int8_t) 23)
|
||||
#define TAG_MTU_TIMEOUT ((u_int8_t) 24)
|
||||
#define TAG_MTU_TABLE ((u_int8_t) 25)
|
||||
#define TAG_INT_MTU ((u_int8_t) 26)
|
||||
#define TAG_LOCAL_SUBNETS ((u_int8_t) 27)
|
||||
#define TAG_BROAD_ADDR ((u_int8_t) 28)
|
||||
#define TAG_DO_MASK_DISC ((u_int8_t) 29)
|
||||
#define TAG_SUPPLY_MASK ((u_int8_t) 30)
|
||||
#define TAG_DO_RDISC ((u_int8_t) 31)
|
||||
#define TAG_RTR_SOL_ADDR ((u_int8_t) 32)
|
||||
#define TAG_STATIC_ROUTE ((u_int8_t) 33)
|
||||
#define TAG_USE_TRAILERS ((u_int8_t) 34)
|
||||
#define TAG_ARP_TIMEOUT ((u_int8_t) 35)
|
||||
#define TAG_ETH_ENCAP ((u_int8_t) 36)
|
||||
#define TAG_TCP_TTL ((u_int8_t) 37)
|
||||
#define TAG_TCP_KEEPALIVE ((u_int8_t) 38)
|
||||
#define TAG_KEEPALIVE_GO ((u_int8_t) 39)
|
||||
#define TAG_NIS_DOMAIN ((u_int8_t) 40)
|
||||
#define TAG_NIS_SERVERS ((u_int8_t) 41)
|
||||
#define TAG_NTP_SERVERS ((u_int8_t) 42)
|
||||
#define TAG_VENDOR_OPTS ((u_int8_t) 43)
|
||||
#define TAG_NETBIOS_NS ((u_int8_t) 44)
|
||||
#define TAG_NETBIOS_DDS ((u_int8_t) 45)
|
||||
#define TAG_NETBIOS_NODE ((u_int8_t) 46)
|
||||
#define TAG_NETBIOS_SCOPE ((u_int8_t) 47)
|
||||
#define TAG_XWIN_FS ((u_int8_t) 48)
|
||||
#define TAG_XWIN_DM ((u_int8_t) 49)
|
||||
#define TAG_NIS_P_DOMAIN ((u_int8_t) 64)
|
||||
#define TAG_NIS_P_SERVERS ((u_int8_t) 65)
|
||||
#define TAG_MOBILE_HOME ((u_int8_t) 68)
|
||||
#define TAG_SMPT_SERVER ((u_int8_t) 69)
|
||||
#define TAG_POP3_SERVER ((u_int8_t) 70)
|
||||
#define TAG_NNTP_SERVER ((u_int8_t) 71)
|
||||
#define TAG_WWW_SERVER ((u_int8_t) 72)
|
||||
#define TAG_FINGER_SERVER ((u_int8_t) 73)
|
||||
#define TAG_IRC_SERVER ((u_int8_t) 74)
|
||||
#define TAG_STREETTALK_SRVR ((u_int8_t) 75)
|
||||
#define TAG_STREETTALK_STDA ((u_int8_t) 76)
|
||||
/* DHCP options */
|
||||
#define TAG_REQUESTED_IP ((unsigned char) 50)
|
||||
#define TAG_IP_LEASE ((unsigned char) 51)
|
||||
#define TAG_OPT_OVERLOAD ((unsigned char) 52)
|
||||
#define TAG_TFTP_SERVER ((unsigned char) 66)
|
||||
#define TAG_BOOTFILENAME ((unsigned char) 67)
|
||||
#define TAG_DHCP_MESSAGE ((unsigned char) 53)
|
||||
#define TAG_SERVER_ID ((unsigned char) 54)
|
||||
#define TAG_PARM_REQUEST ((unsigned char) 55)
|
||||
#define TAG_MESSAGE ((unsigned char) 56)
|
||||
#define TAG_MAX_MSG_SIZE ((unsigned char) 57)
|
||||
#define TAG_RENEWAL_TIME ((unsigned char) 58)
|
||||
#define TAG_REBIND_TIME ((unsigned char) 59)
|
||||
#define TAG_VENDOR_CLASS ((unsigned char) 60)
|
||||
#define TAG_CLIENT_ID ((unsigned char) 61)
|
||||
#define TAG_REQUESTED_IP ((u_int8_t) 50)
|
||||
#define TAG_IP_LEASE ((u_int8_t) 51)
|
||||
#define TAG_OPT_OVERLOAD ((u_int8_t) 52)
|
||||
#define TAG_TFTP_SERVER ((u_int8_t) 66)
|
||||
#define TAG_BOOTFILENAME ((u_int8_t) 67)
|
||||
#define TAG_DHCP_MESSAGE ((u_int8_t) 53)
|
||||
#define TAG_SERVER_ID ((u_int8_t) 54)
|
||||
#define TAG_PARM_REQUEST ((u_int8_t) 55)
|
||||
#define TAG_MESSAGE ((u_int8_t) 56)
|
||||
#define TAG_MAX_MSG_SIZE ((u_int8_t) 57)
|
||||
#define TAG_RENEWAL_TIME ((u_int8_t) 58)
|
||||
#define TAG_REBIND_TIME ((u_int8_t) 59)
|
||||
#define TAG_VENDOR_CLASS ((u_int8_t) 60)
|
||||
#define TAG_CLIENT_ID ((u_int8_t) 61)
|
||||
/* RFC 2241 */
|
||||
#define TAG_NDS_SERVERS ((u_int8_t) 85)
|
||||
#define TAG_NDS_TREE_NAME ((u_int8_t) 86)
|
||||
#define TAG_NDS_CONTEXT ((u_int8_t) 87)
|
||||
/* RFC 2485 */
|
||||
#define TAG_OPEN_GROUP_UAP ((u_int8_t) 98)
|
||||
/* RFC 2563 */
|
||||
#define TAG_DISABLE_AUTOCONF ((u_int8_t) 116)
|
||||
/* RFC 2610 */
|
||||
#define TAG_SLP_DA ((u_int8_t) 78)
|
||||
#define TAG_SLP_SCOPE ((u_int8_t) 79)
|
||||
/* RFC 2937 */
|
||||
#define TAG_NS_SEARCH ((u_int8_t) 117)
|
||||
/* RFC 3011 */
|
||||
#define TAG_IP4_SUBNET_SELECT ((u_int8_t) 118)
|
||||
/* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */
|
||||
#define TAG_USER_CLASS ((u_int8_t) 77)
|
||||
#define TAG_SLP_NAMING_AUTH ((u_int8_t) 80)
|
||||
#define TAG_CLIENT_FQDN ((u_int8_t) 81)
|
||||
#define TAG_AGENT_CIRCUIT ((u_int8_t) 82)
|
||||
#define TAG_AGENT_REMOTE ((u_int8_t) 83)
|
||||
#define TAG_AGENT_MASK ((u_int8_t) 84)
|
||||
#define TAG_TZ_STRING ((u_int8_t) 88)
|
||||
#define TAG_FQDN_OPTION ((u_int8_t) 89)
|
||||
#define TAG_AUTH ((u_int8_t) 90)
|
||||
#define TAG_VINES_SERVERS ((u_int8_t) 91)
|
||||
#define TAG_SERVER_RANK ((u_int8_t) 92)
|
||||
#define TAG_CLIENT_ARCH ((u_int8_t) 93)
|
||||
#define TAG_CLIENT_NDI ((u_int8_t) 94)
|
||||
#define TAG_CLIENT_GUID ((u_int8_t) 97)
|
||||
#define TAG_LDAP_URL ((u_int8_t) 95)
|
||||
#define TAG_6OVER4 ((u_int8_t) 96)
|
||||
#define TAG_PRINTER_NAME ((u_int8_t) 100)
|
||||
#define TAG_MDHCP_SERVER ((u_int8_t) 101)
|
||||
#define TAG_IPX_COMPAT ((u_int8_t) 110)
|
||||
#define TAG_NETINFO_PARENT ((u_int8_t) 112)
|
||||
#define TAG_NETINFO_PARENT_TAG ((u_int8_t) 113)
|
||||
#define TAG_URL ((u_int8_t) 114)
|
||||
#define TAG_FAILOVER ((u_int8_t) 115)
|
||||
#define TAG_EXTENDED_REQUEST ((u_int8_t) 126)
|
||||
#define TAG_EXTENDED_OPTION ((u_int8_t) 127)
|
||||
|
||||
|
||||
/* DHCP Message types (values for TAG_DHCP_MESSAGE option) */
|
||||
#define DHCPDISCOVER 1
|
||||
@ -161,14 +203,14 @@ struct bootp {
|
||||
*/
|
||||
|
||||
struct cmu_vend {
|
||||
unsigned char v_magic[4]; /* magic number */
|
||||
u_int8_t v_magic[4]; /* magic number */
|
||||
u_int32_t v_flags; /* flags/opcodes, etc. */
|
||||
struct in_addr v_smask; /* Subnet mask */
|
||||
struct in_addr v_dgate; /* Default gateway */
|
||||
struct in_addr v_dns1, v_dns2; /* Domain name servers */
|
||||
struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */
|
||||
struct in_addr v_ts1, v_ts2; /* Time servers */
|
||||
unsigned char v_unused[24]; /* currently unused */
|
||||
u_int8_t v_unused[24]; /* currently unused */
|
||||
};
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.10 1999/11/21 09:36:44 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/bpf_dump.c,v 1.13 2000/12/09 02:58:45 fenner Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,8 +35,6 @@ static const char rcsid[] =
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
extern void bpf_dump(struct bpf_program *, int);
|
||||
|
||||
void
|
||||
bpf_dump(struct bpf_program *p, int option)
|
||||
{
|
||||
|
27
contrib/tcpdump/chdlc.h
Normal file
27
contrib/tcpdump/chdlc.h
Normal file
@ -0,0 +1,27 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/chdlc.h,v 1.1 2000/09/18 05:11:43 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define CHDLC_HDRLEN 4
|
||||
#define CHDLC_UNICAST 0x0f
|
||||
#define CHDLC_BCAST 0x8f
|
||||
#define CHDLC_TYPE_SLARP 0x8035
|
||||
#define CHDLC_TYPE_CDP 0x2000
|
907
contrib/tcpdump/config.guess
vendored
907
contrib/tcpdump/config.guess
vendored
File diff suppressed because it is too large
Load Diff
@ -18,46 +18,21 @@
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/* Define if you have SSLeay XXX why isn't this HAVE_LIBCRYPTO? */
|
||||
#undef CRYPTO
|
||||
|
||||
/* Define if you have SSLeay 0.9.0b with the buggy cast128. */
|
||||
#undef HAVE_BUGGY_CAST128
|
||||
|
||||
/* Define both to enable IPv6 support XXX why 2? ENABLE_IPV6 is not used. */
|
||||
#undef ENABLE_IPV6
|
||||
/* Define if you enable IPv6 support */
|
||||
#undef INET6
|
||||
|
||||
/* Define if you enable support for the libsmi. */
|
||||
#undef LIBSMI
|
||||
|
||||
/* Is T_AAAA predefined? */
|
||||
#undef HAVE_AAAA
|
||||
|
||||
/* Fallback definition if not in headers */
|
||||
/* XXX why is this not #ifndef HAVE_AAA #define T_AAAA ... ? */
|
||||
/* XXX or even #ifndef T_AAAA ... */
|
||||
#undef T_AAAA
|
||||
|
||||
/* 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.arp_sha is a struct with ether_addr_octet
|
||||
*/
|
||||
#undef ETHER_ARP_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
|
||||
|
||||
@ -73,15 +48,9 @@
|
||||
/* define if INADDRSZ is defined (XXX not used!) */
|
||||
#undef HAVE_INADDRSZ
|
||||
|
||||
/* define if you have <net/slip.h> */
|
||||
#undef HAVE_NET_SLIP_H
|
||||
|
||||
/* 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
|
||||
|
||||
@ -91,6 +60,9 @@
|
||||
/* define if you have struct sockaddr_storage */
|
||||
#undef HAVE_SOCKADDR_STORAGE
|
||||
|
||||
/* define if you have both getipnodebyname() and getipnodebyaddr() */
|
||||
#undef USE_GETIPNODEBY
|
||||
|
||||
/* define if unaligned memory accesses fail */
|
||||
#undef LBL_ALIGN
|
||||
|
||||
@ -106,9 +78,6 @@
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
/* OSF hack: "Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h" */
|
||||
#undef __STDC__
|
||||
|
||||
/* Workaround for missing sized types */
|
||||
/* XXX this should move to the more standard uint*_t */
|
||||
#undef int16_t
|
||||
@ -129,14 +98,23 @@
|
||||
/* The number of bytes in a short. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* Define if you have the bpf_dump function. */
|
||||
#undef HAVE_BPF_DUMP
|
||||
|
||||
/* Define if you have the ether_ntohost function. */
|
||||
#undef HAVE_ETHER_NTOHOST
|
||||
|
||||
/* Define if you have the freeaddrinfo function. */
|
||||
#undef HAVE_FREEADDRINFO
|
||||
|
||||
/* Define if you have the getaddrinfo function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the gethostbyname2 function. */
|
||||
#undef HAVE_GETHOSTBYNAME2
|
||||
/* Define if you have the getipnodebyaddr function. */
|
||||
#undef HAVE_GETIPNODEBYADDR
|
||||
|
||||
/* Define if you have the getipnodebyname function. */
|
||||
#undef HAVE_GETIPNODEBYNAME
|
||||
|
||||
/* Define if you have the getnameinfo function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
@ -162,26 +140,32 @@
|
||||
/* Define if you have the sigset function. */
|
||||
#undef HAVE_SIGSET
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strlcat function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcpy function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the vfprintf function. */
|
||||
#undef HAVE_VFPRINTF
|
||||
|
||||
/* Define if you have the vsnprintf function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define if you have the <cast.h> header file. */
|
||||
#undef HAVE_CAST_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the <net/slip.h> header file. */
|
||||
#undef HAVE_NET_SLIP_H
|
||||
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||
#undef HAVE_NETINET_IF_ETHER_H
|
||||
|
||||
/* Define if you have the <rc5.h> header file. */
|
||||
#undef HAVE_RC5_H
|
||||
@ -192,15 +176,15 @@
|
||||
/* Define if you have the <smi.h> header file. */
|
||||
#undef HAVE_SMI_H
|
||||
|
||||
/* Define if you have the <zlib.h> header file. */
|
||||
#undef HAVE_ZLIB_H
|
||||
|
||||
/* Define if you have the crypto library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define if you have the dnet library (-ldnet). */
|
||||
#undef HAVE_LIBDNET
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have the resolv library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
@ -216,5 +200,6 @@
|
||||
/* Define if you have the str library (-lstr). */
|
||||
#undef HAVE_LIBSTR
|
||||
|
||||
/* Define if you have the z library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
/* define if your compiler has __attribute__ */
|
||||
#undef HAVE___ATTRIBUTE__
|
||||
|
||||
|
565
contrib/tcpdump/config.sub
vendored
565
contrib/tcpdump/config.sub
vendored
@ -1,6 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2000-12-15'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
@ -25,6 +29,8 @@
|
||||
# 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>.
|
||||
#
|
||||
# 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.
|
||||
@ -45,30 +51,73 @@
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
# First pass through any local machine types.
|
||||
case $1 in
|
||||
*local*)
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
Operation modes:
|
||||
-h, --help print this help, then exit
|
||||
-t, --time-stamp print date of last modification, then exit
|
||||
-v, --version print version number, then exit
|
||||
|
||||
Report bugs and patches to <config-patches@gnu.org>."
|
||||
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
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."
|
||||
|
||||
help="
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
# Parse command line
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
break ;;
|
||||
-* )
|
||||
echo "$me: invalid option $1$help"
|
||||
exit 1 ;;
|
||||
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit 0;;
|
||||
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) echo "$me: missing argument$help" >&2
|
||||
exit 1;;
|
||||
1) ;;
|
||||
*) echo "$me: too many arguments$help" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
nto-qnx* | linux-gnu* | storm-chaos*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@ -94,15 +143,25 @@ 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)
|
||||
-apple | -axis)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-scout)
|
||||
;;
|
||||
-wrs)
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
os=-sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
@ -121,6 +180,9 @@ case $os in
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-udk*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@ -143,25 +205,47 @@ case $os in
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
-mint | -mint[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||
| arme[lb] | pyramid \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | i370 | sh \
|
||||
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc | sparclet | sparclite | sparc64)
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
|
||||
| arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
|
||||
| pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 \
|
||||
| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
| hppa64 \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
|
||||
| alphaev6[78] \
|
||||
| we32k | ns16k | clipper | i370 | sh | sh[34] \
|
||||
| powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el | mcore \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
|
||||
| thumb | d10v | d30v | fr30 | avr)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
i[234567]86 | x86_64)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
@ -170,23 +254,50 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
||||
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
||||
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
| xmp-* | ymp-* \
|
||||
| x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
|
||||
| hppa2.0n-* | hppa64-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| alphaev6[78]-* \
|
||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||
| clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f30[01]-* | s390-* | sv1-* | t3e-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
|
||||
| bs2000-* | tic54x-* | c54x-* | x86_64-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
basic_machine=i386-unknown
|
||||
os=-bsd
|
||||
;;
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
a29khif)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
@ -202,20 +313,24 @@ case $basic_machine in
|
||||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
;;
|
||||
amigados)
|
||||
basic_machine=m68k-cbm
|
||||
os=-amigados
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-unknown
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
apollo68bsd)
|
||||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
@ -259,6 +374,9 @@ case $basic_machine in
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
@ -292,6 +410,10 @@ case $basic_machine in
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
es1800 | OSE68k | ose68k | ose | OSE)
|
||||
basic_machine=m68k-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
@ -310,6 +432,14 @@ case $basic_machine in
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
h8300xray)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-xray
|
||||
;;
|
||||
h8500hms)
|
||||
basic_machine=h8500-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
@ -325,13 +455,30 @@ case $basic_machine in
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp3k9[0-9][0-9] | hp9[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
hp9k6[0-9][0-9] | hp6[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k7[0-79][0-9] | hp7[0-79][0-9])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k78[0-9] | hp78[0-9])
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][13679] | hp8[0-9][13679])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
@ -340,27 +487,54 @@ case $basic_machine in
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
hppaosf)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-osf
|
||||
;;
|
||||
hppro)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-proelf
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
i[34567]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
i[34567]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
i[34567]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
i[34567]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
i386mach)
|
||||
basic_machine=i386-mach
|
||||
os=-mach
|
||||
;;
|
||||
i386-vsta | vsta)
|
||||
basic_machine=i386-unknown
|
||||
os=-vsta
|
||||
;;
|
||||
i386-go32 | go32)
|
||||
basic_machine=i386-unknown
|
||||
os=-go32
|
||||
;;
|
||||
i386-mingw32 | mingw32)
|
||||
basic_machine=i386-unknown
|
||||
os=-mingw32
|
||||
;;
|
||||
i[34567]86-pw32 | pw32)
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
@ -389,16 +563,52 @@ case $basic_machine in
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips*-linux*)
|
||||
basic_machine=mips-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
mips3*-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||
;;
|
||||
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
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-unknown
|
||||
os=-msdos
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
netbsd386)
|
||||
basic_machine=i386-unknown
|
||||
os=-netbsd
|
||||
;;
|
||||
netwinder)
|
||||
basic_machine=armv4l-rebel
|
||||
os=-linux
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
@ -411,6 +621,10 @@ case $basic_machine in
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
necv70)
|
||||
basic_machine=v70-nec
|
||||
os=-sysv
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
@ -436,9 +650,32 @@ case $basic_machine in
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
mon960)
|
||||
basic_machine=i960-intel
|
||||
os=-mon960
|
||||
;;
|
||||
nonstopux)
|
||||
basic_machine=mips-compaq
|
||||
os=-nonstopux
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
os68k)
|
||||
basic_machine=m68k-none
|
||||
os=-os68k
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
@ -456,30 +693,28 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
@ -494,12 +729,20 @@ case $basic_machine in
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@ -507,6 +750,10 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
@ -514,6 +761,13 @@ case $basic_machine in
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
st2000)
|
||||
basic_machine=m68k-tandem
|
||||
;;
|
||||
stratus)
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@ -554,10 +808,28 @@ case $basic_machine in
|
||||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
sv1)
|
||||
basic_machine=sv1-cray
|
||||
os=-unicos
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
tx39el)
|
||||
basic_machine=mipstx39el-unknown
|
||||
;;
|
||||
tower | tower-32)
|
||||
basic_machine=m68k-ncr
|
||||
;;
|
||||
@ -569,6 +841,10 @@ case $basic_machine in
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
v810 | necv810)
|
||||
basic_machine=v810-nec
|
||||
os=-none
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
@ -577,7 +853,7 @@ case $basic_machine in
|
||||
basic_machine=vax-dec
|
||||
os=-vms
|
||||
;;
|
||||
vpp*|vx|vx-*)
|
||||
vpp*|vx|vx-*)
|
||||
basic_machine=f301-fujitsu
|
||||
;;
|
||||
vxworks960)
|
||||
@ -592,6 +868,14 @@ case $basic_machine in
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
w65*)
|
||||
basic_machine=w65-wdc
|
||||
os=-none
|
||||
;;
|
||||
w89k-*)
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
@ -599,6 +883,10 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
@ -606,8 +894,21 @@ case $basic_machine in
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
w89k)
|
||||
basic_machine=hppa1.1-winbond
|
||||
;;
|
||||
op50n)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
basic_machine=mips-mips
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
else
|
||||
basic_machine=mips-mips
|
||||
fi
|
||||
;;
|
||||
romp)
|
||||
basic_machine=romp-ibm
|
||||
@ -624,7 +925,10 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
sh3 | sh4)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv9)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@ -636,6 +940,16 @@ case $basic_machine in
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
mac | mpw | mac-mpw)
|
||||
basic_machine=m68k-apple
|
||||
;;
|
||||
pmac | pmac-mpw)
|
||||
basic_machine=powerpc-apple
|
||||
;;
|
||||
c4x*)
|
||||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
@ -668,9 +982,12 @@ case $os in
|
||||
-solaris)
|
||||
os=-solaris2
|
||||
;;
|
||||
-unixware* | svr4*)
|
||||
-svr4*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-unixware*)
|
||||
os=-sysv4.2uw
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
@ -681,17 +998,39 @@ case $os in
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -linux-gnu* | -uxpv*)
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* | -storm-chaos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
case $basic_machine in
|
||||
x86-* | i[34567]86-*)
|
||||
;;
|
||||
*)
|
||||
os=-nto$os
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto*)
|
||||
os=-nto-qnx
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@ -701,6 +1040,12 @@ case $os in
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
@ -716,12 +1061,18 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
os=-nsk
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
@ -747,9 +1098,18 @@ case $os in
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-ose*)
|
||||
os=-ose
|
||||
;;
|
||||
-es1800*)
|
||||
os=-ose
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-*mint | -*MiNT)
|
||||
os=-mint
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@ -775,6 +1135,9 @@ case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-rebel)
|
||||
os=-linux
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
@ -796,15 +1159,36 @@ case $basic_machine in
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
sparc-* | *-sun)
|
||||
os=-sunos4.1.1
|
||||
;;
|
||||
*-be)
|
||||
os=-beos
|
||||
;;
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
*-winbond)
|
||||
os=-proelf
|
||||
;;
|
||||
*-oki)
|
||||
os=-proelf
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
@ -815,7 +1199,7 @@ case $basic_machine in
|
||||
os=-sysv
|
||||
;;
|
||||
*-cbm)
|
||||
os=-amigados
|
||||
os=-amigaos
|
||||
;;
|
||||
*-dg)
|
||||
os=-dgux
|
||||
@ -865,9 +1249,21 @@ case $basic_machine in
|
||||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
f30[01]-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
os=-coff
|
||||
;;
|
||||
*-*bug)
|
||||
os=-coff
|
||||
;;
|
||||
*-apple)
|
||||
os=-macos
|
||||
;;
|
||||
*-atari*)
|
||||
os=-mint
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
@ -889,9 +1285,15 @@ case $basic_machine in
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
vendor=be
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-mpeix*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
@ -907,7 +1309,7 @@ case $basic_machine in
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
@ -919,9 +1321,26 @@ case $basic_machine in
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
-hms*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-mpw* | -macos*)
|
||||
vendor=apple
|
||||
;;
|
||||
-*mint | -*MiNT)
|
||||
vendor=atari
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "timestamp='"
|
||||
# time-stamp-format: "%:y-%02m-%02d"
|
||||
# time-stamp-end: "'"
|
||||
# End:
|
||||
|
1456
contrib/tcpdump/configure
vendored
1456
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.87.2.4 2000/01/25 18:39:02 itojun Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.132.4.1 2001/01/17 18:29:58 guy Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1994, 1995, 1996, 1997
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -6,59 +6,72 @@ dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_REVISION($Revision: 1.132.4.1 $)
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(tcpdump.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
umask 002
|
||||
|
||||
if test -z "$PWD" ; then
|
||||
PWD=`pwd`
|
||||
fi
|
||||
|
||||
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
|
||||
AC_C_INLINE
|
||||
AC_C___ATTRIBUTE__
|
||||
|
||||
AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h)
|
||||
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netinet/if_ether.h)
|
||||
AC_HEADER_TIME
|
||||
|
||||
case "$target_os" in
|
||||
|
||||
linux*)
|
||||
AC_MSG_CHECKING(Linux kernel version)
|
||||
AC_CACHE_VAL(ac_cv_linux_vers,
|
||||
ac_cv_linux_vers=`uname -r 2>&1 | \
|
||||
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
|
||||
if test "$cross_compiling" = yes; then
|
||||
AC_CACHE_VAL(ac_cv_linux_vers,
|
||||
ac_cv_linux_vers=unknown)
|
||||
else
|
||||
AC_CACHE_VAL(ac_cv_linux_vers,
|
||||
ac_cv_linux_vers=`uname -r 2>&1 | \
|
||||
sed -n -e '$s/.* //' -e '$s/\..*//p'`)
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_linux_vers)
|
||||
if test $ac_cv_linux_vers = unknown ; then
|
||||
AC_MSG_ERROR(cannot determine linux version when cross-compiling)
|
||||
fi
|
||||
if test $ac_cv_linux_vers -lt 2 ; then
|
||||
AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
|
||||
fi
|
||||
AC_DEFINE(HAVE_NET_SLIP_H)
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_CHECK_HEADERS(net/slip.h)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
AC_CHECK_HEADERS(smi.h)
|
||||
AC_CHECK_LIB(smi, main)
|
||||
AC_CHECK_LIB(smi, smiInit)
|
||||
AC_MSG_CHECKING([whether to enable libsmi])
|
||||
AC_TRY_RUN([ /* libsmi available check */
|
||||
#include <smi.h>
|
||||
main()
|
||||
{
|
||||
int current, revision, age, n;
|
||||
const int required = 2;
|
||||
if (smiInit(""))
|
||||
exit(1);
|
||||
else
|
||||
exit(0);
|
||||
if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
|
||||
exit(2);
|
||||
n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
|
||||
if (n != 3)
|
||||
exit(3);
|
||||
if (required < current - age || required > current)
|
||||
exit(4);
|
||||
exit(0);
|
||||
}
|
||||
],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(LIBSMI)
|
||||
libsmi=yes],
|
||||
[ AC_MSG_RESULT(no)
|
||||
libsmi=no],
|
||||
[ AC_MSG_RESULT(not when cross-compiling)
|
||||
libsmi=no]
|
||||
)
|
||||
|
||||
@ -70,7 +83,6 @@ AC_ARG_ENABLE(ipv6,
|
||||
--disable-ipv6 disable ipv6 support],
|
||||
[ case "$enableval" in
|
||||
yes) AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(ENABLE_IPV6)
|
||||
LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
|
||||
AC_DEFINE(INET6)
|
||||
ipv6=yes
|
||||
@ -93,7 +105,6 @@ main()
|
||||
}
|
||||
],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(ENABLE_IPV6)
|
||||
LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
|
||||
AC_DEFINE(INET6)
|
||||
ipv6=yes],
|
||||
@ -213,7 +224,7 @@ fi
|
||||
|
||||
|
||||
if test "$ipv6" = "yes"; then
|
||||
AC_CHECK_FUNCS(getaddrinfo, [dnl
|
||||
AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
|
||||
AC_MSG_CHECKING(getaddrinfo bug)
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
@ -329,7 +340,31 @@ main()
|
||||
fi
|
||||
AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
|
||||
fi
|
||||
AC_REPLACE_FUNCS(inet_ntop inet_pton inet_aton)
|
||||
dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
|
||||
AC_MSG_CHECKING(for inet_ntop)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[4], dst[128];
|
||||
inet_ntop(AF_INET, src, dst, sizeof(dst));],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_REPLACE_FUNCS(inet_ntop)])
|
||||
AC_MSG_CHECKING(for inet_pton)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128], dst[4];
|
||||
inet_pton(AF_INET, src, dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_REPLACE_FUNCS(inet_pton)])
|
||||
AC_MSG_CHECKING(for inet_aton)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>], [char src[128];
|
||||
struct in_addr dst;
|
||||
inet_aton(src, &dst);],
|
||||
[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
|
||||
AC_REPLACE_FUNCS(inet_aton)])
|
||||
|
||||
dnl portability macros for getaddrinfo/getnameinfo
|
||||
dnl
|
||||
@ -339,13 +374,6 @@ if test "$ac_cv_sockaddr_has_sa_len" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl check __P macro
|
||||
AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
|
||||
if test "$ac_cv_portable_proto" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl check sizeof basic types.
|
||||
dnl They're very likely to be wrong for cross-compiling.
|
||||
@ -403,13 +431,6 @@ if test "$ac_cv_res_inet6" = no; then
|
||||
missing_includes=yes
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Checks for AAAA
|
||||
AC_CHECK_AAAA(ac_cv_aaaa)
|
||||
if test "$ac_cv_aaaa" = no; then
|
||||
AC_DEFINE(T_AAAA, 28)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Checks for res_state_ext structure
|
||||
AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
|
||||
@ -429,21 +450,40 @@ if test "$missing_includes" = "yes"; then
|
||||
fi
|
||||
|
||||
|
||||
AC_REPLACE_FUNCS(vfprintf strcasecmp)
|
||||
AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
|
||||
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy)
|
||||
AC_CHECK_FUNCS(ether_ntohost setlinebuf)
|
||||
|
||||
usegetipnodeby=yes
|
||||
AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,
|
||||
[], [usegetipnodeby=no])
|
||||
if test $usegetipnodeby = yes; then
|
||||
AC_DEFINE(USE_GETIPNODEBY)
|
||||
fi
|
||||
|
||||
needsnprintf=no
|
||||
AC_CHECK_FUNCS(vsnprintf snprintf,,
|
||||
[needsnprintf=yes])
|
||||
if test $needsnprintf = yes; then
|
||||
LIBOBJS="$LIBOBJS snprintf.o"
|
||||
fi
|
||||
|
||||
dnl The following generates a warning from autoconf...
|
||||
errprint(__file__:__line__: please ignore the next warning:
|
||||
)dnl
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_CHECK_LIB(dnet, main)
|
||||
AC_CHECK_LIB(rpc, main)
|
||||
AC_CHECK_LIB(z, uncompress)
|
||||
AC_CHECK_HEADERS(zlib.h)
|
||||
AC_CHECK_LIB(nsl, getrpcbynumber)
|
||||
dnl AC_CHECK_LIB(z, uncompress)
|
||||
dnl AC_CHECK_HEADERS(zlib.h)
|
||||
|
||||
AC_LBL_TYPE_SIGNAL
|
||||
|
||||
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
|
||||
|
||||
AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
|
||||
|
||||
V_GROUP=0
|
||||
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
|
||||
V_GROUP=wheel
|
||||
@ -459,14 +499,8 @@ irix*)
|
||||
V_GROUP=sys
|
||||
;;
|
||||
|
||||
linux*)
|
||||
V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
|
||||
;;
|
||||
|
||||
osf*)
|
||||
V_GROUP=system
|
||||
dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
|
||||
AC_DEFINE(__STDC__,2)
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
@ -488,99 +522,25 @@ AC_LBL_DEVEL(V_CCOPT)
|
||||
|
||||
AC_LBL_SOCKADDR_SA_LEN
|
||||
|
||||
AC_MSG_CHECKING(if ether_header uses ether_addr structs)
|
||||
AC_CACHE_VAL(ac_cv_ether_header_has_ea,
|
||||
LBL_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $V_INCLS"
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# if __STDC__
|
||||
/* osf3 has REALLY good prototyes */
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
# endif
|
||||
# include <sys/socket.h>
|
||||
# include <net/if.h>
|
||||
# include <netinet/in.h>
|
||||
# include <netinet/if_ether.h>],
|
||||
[u_int i =
|
||||
sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
|
||||
ac_cv_ether_header_has_ea=yes,
|
||||
ac_cv_ether_header_has_ea=no)
|
||||
CFLAGS="$LBL_SAVE_CFLAGS")
|
||||
AC_MSG_RESULT($ac_cv_ether_header_has_ea)
|
||||
if test $ac_cv_ether_header_has_ea = yes ; then
|
||||
AC_DEFINE(ETHER_HEADER_HAS_EA)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
|
||||
AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
|
||||
LBL_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $V_INCLS"
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# if __STDC__
|
||||
/* osf3 has REALLY good prototyes */
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
# endif
|
||||
# include <sys/socket.h>
|
||||
# include <net/if.h>
|
||||
# include <netinet/in.h>
|
||||
# include <netinet/if_ether.h>],
|
||||
[u_int i =
|
||||
sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
|
||||
ac_cv_ether_arp_has_ea=yes,
|
||||
ac_cv_ether_arp_has_ea=no)
|
||||
CFLAGS="$LBL_SAVE_CFLAGS")
|
||||
AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
|
||||
if test $ac_cv_ether_arp_has_ea = yes ; then
|
||||
AC_DEFINE(ETHER_ARP_HAS_EA)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
|
||||
AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
|
||||
LBL_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $V_INCLS"
|
||||
AC_TRY_COMPILE([
|
||||
# include <sys/types.h>
|
||||
# include <sys/socket.h>
|
||||
# if __STDC__
|
||||
/* osf3 has REALLY good prototyes */
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
# endif
|
||||
# include <net/if.h>
|
||||
# include <netinet/in.h>
|
||||
# include <netinet/if_ether.h>],
|
||||
[u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
|
||||
ac_cv_struct_ether_arp_x=yes,
|
||||
ac_cv_struct_ether_arp_x=no)
|
||||
CFLAGS="$LBL_SAVE_CFLAGS")
|
||||
AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
|
||||
if test $ac_cv_struct_ether_arp_x = yes ; then
|
||||
AC_DEFINE(ETHER_ARP_HAS_X)
|
||||
fi
|
||||
|
||||
AC_LBL_UNALIGNED_ACCESS
|
||||
|
||||
AC_VAR_H_ERRNO
|
||||
|
||||
AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
|
||||
[], [
|
||||
AC_MSG_CHECKING(for SSLeay)
|
||||
ac_cv_ssleay_path=no
|
||||
incdir=no
|
||||
for dir in /usr/local /usr/local/ssl /usr/pkg; do
|
||||
for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
|
||||
if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
|
||||
ac_cv_ssleay_path=$dir
|
||||
fi
|
||||
if test -d $dir/include -a -f $dir/include/des.h; then
|
||||
if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
|
||||
incdir="-I$dir/include/ssleay"
|
||||
elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
|
||||
incdir="-I$dir/include -I$dir/include/openssl"
|
||||
elif test -d $dir/include -a -f $dir/include/des.h; then
|
||||
incdir="-I$dir/include"
|
||||
else
|
||||
if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
|
||||
incdir="-I$dir/include/ssleay"
|
||||
elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
|
||||
incdir="-I$dir/include -I$dir/include/openssl"
|
||||
fi
|
||||
fi
|
||||
if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
|
||||
break;
|
||||
@ -592,7 +552,7 @@ done
|
||||
AC_MSG_RESULT($ac_cv_ssleay_path)
|
||||
if test "$ac_cv_ssleay_path" != no; then
|
||||
V_INCLS="$V_INCLS $incdir"
|
||||
LIBS="$LIBS -L$dir/lib"
|
||||
LDFLAGS="-L$dir/lib $LDFLAGS"
|
||||
if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
|
||||
LIBS="$LIBS -lRSAglue"
|
||||
fi
|
||||
@ -600,11 +560,10 @@ if test "$ac_cv_ssleay_path" != no; then
|
||||
LIBS="$LIBS -lrsaref"
|
||||
fi
|
||||
AC_CHECK_LIB(crypto, des_cbc_encrypt)
|
||||
AC_DEFINE(CRYPTO)
|
||||
|
||||
bak_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $V_INCLS"
|
||||
AC_CHECK_HEADERS(cast.h rc5.h)
|
||||
AC_CHECK_HEADERS(cast.h)
|
||||
|
||||
if test "$ac_cv_header_cast_h" = "yes"; then
|
||||
AC_MSG_CHECKING(for buggy CAST128)
|
||||
@ -638,11 +597,8 @@ main()
|
||||
|
||||
CPPFLAGS=$bak_CPPFLAGS
|
||||
fi
|
||||
|
||||
if test -r ${srcdir}/lbl/gnuc.h ; then
|
||||
rm -f gnuc.h
|
||||
ln -s ${srcdir}/lbl/gnuc.h gnuc.h
|
||||
fi
|
||||
])
|
||||
AC_CHECK_HEADERS(rc5.h)
|
||||
|
||||
AC_SUBST(V_CCOPT)
|
||||
AC_SUBST(V_GROUP)
|
||||
@ -654,9 +610,10 @@ AC_PROG_INSTALL
|
||||
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
||||
if test -f .devel ; then
|
||||
AC_OUTPUT_COMMANDS([if test -f .devel; then
|
||||
echo timestamp > stamp-h
|
||||
cat Makefile-devel-adds >> Makefile
|
||||
make depend
|
||||
fi
|
||||
fi])
|
||||
AC_OUTPUT(Makefile)
|
||||
exit 0
|
||||
|
@ -18,21 +18,21 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.6.1.1 1999/10/07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.7 2000/10/03 02:54:55 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
typedef unsigned char byte[1]; /* single byte field */
|
||||
typedef unsigned char word[2]; /* 2 byte field */
|
||||
typedef unsigned char longword[4]; /* 4 bytes field */
|
||||
typedef u_int8_t byte[1]; /* single byte field */
|
||||
typedef u_int8_t word[2]; /* 2 byte field */
|
||||
typedef u_int8_t longword[4]; /* 4 bytes field */
|
||||
|
||||
/*
|
||||
* Definitions for DECNET Phase IV protocol headers
|
||||
*/
|
||||
union etheraddress {
|
||||
unsigned char dne_addr[6]; /* full ethernet address */
|
||||
u_int8_t dne_addr[6]; /* full ethernet address */
|
||||
struct {
|
||||
unsigned char dne_hiord[4]; /* DECnet HIORD prefix */
|
||||
unsigned char dne_nodeaddr[2]; /* DECnet node address */
|
||||
u_int8_t dne_hiord[4]; /* DECnet HIORD prefix */
|
||||
u_int8_t dne_nodeaddr[2]; /* DECnet node address */
|
||||
} dne_remote;
|
||||
};
|
||||
|
||||
@ -46,8 +46,8 @@ typedef union etheraddress etheraddr; /* Ethernet address */
|
||||
|
||||
#define DN_MAXADDL 20 /* max size of DECnet address */
|
||||
struct dn_naddr {
|
||||
unsigned short a_len; /* length of address */
|
||||
unsigned char a_addr[DN_MAXADDL]; /* address as bytes */
|
||||
u_int16_t a_len; /* length of address */
|
||||
u_int8_t a_addr[DN_MAXADDL]; /* address as bytes */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/dhcp6.h,v 1.4 2000/12/17 23:07:48 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (C) 1998 and 1999 WIDE Project.
|
||||
* All rights reserved.
|
||||
@ -27,7 +28,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* draft-ietf-dhc-dhcpv6-14
|
||||
* draft-ietf-dhc-dhcpv6-15
|
||||
*/
|
||||
|
||||
#ifndef __DHCP6_H_DEFINED
|
||||
@ -79,20 +80,27 @@ struct dhcp6_solicit {
|
||||
u_int8_t dh6sol_msgtype; /* DH6_SOLICIT */
|
||||
u_int8_t dh6sol_flags;
|
||||
#define DH6SOL_CLOSE 0x80
|
||||
u_int8_t dh6sol_pad;
|
||||
u_int8_t dh6sol_prefixsiz; /* prefix-size */
|
||||
#define DH6SOL_PREFIX 0x40
|
||||
/* XXX: solicit-ID is a 9-bit field...ugly! */
|
||||
#define DH6SOL_SOLICIT_ID_MASK 0x01ff
|
||||
#define DH6SOL_SOLICIT_ID_SHIFT 0
|
||||
#define DH6SOL_SOLICIT_ID(x) \
|
||||
(((x) & DH6SOL_SOLICIT_ID_MASK) >> DH6SOL_SOLICIT_ID_SHIFT)
|
||||
#define DH6SOL_SOLICIT_PLEN_MASK 0xfe00
|
||||
#define DH6SOL_SOLICIT_PLEN_SHIFT 9
|
||||
#define DH6SOL_SOLICIT_PLEN(x) \
|
||||
(((x) & DH6SOL_SOLICIT_PLEN_MASK) >> DH6SOL_SOLICIT_PLEN_SHIFT)
|
||||
u_int16_t dh6sol_plen_id; /* prefix-len and solict-ID */
|
||||
struct in6_addr dh6sol_cliaddr; /* client's lladdr */
|
||||
struct in6_addr dh6sol_relayaddr; /* relay agent's lladdr */
|
||||
};
|
||||
|
||||
/* NOTE: dhcpv6-12 and dhcpv6-13+n are not compatible at all */
|
||||
struct dhcp6_advert {
|
||||
u_int8_t dh6adv_msgtype; /* DH6_ADVERT */
|
||||
u_int8_t dh6adv_flags;
|
||||
#define DH6ADV_SERVPRESENT 0x80
|
||||
u_int8_t dh6adv_pad;
|
||||
u_int8_t dh6adv_rsv_id; /* reserved and uppermost bit of ID */
|
||||
u_int8_t dh6adv_solcit_id; /* lower 8 bits of solicit-ID */
|
||||
u_int8_t dh6adv_pref;
|
||||
struct in6_addr dh6adv_cliaddr; /* client's lladdr */
|
||||
struct in6_addr dh6adv_cliaddr; /* client's link-local addr */
|
||||
struct in6_addr dh6adv_relayaddr; /* relay agent's (non-ll) addr */
|
||||
struct in6_addr dh6adv_serveraddr; /* server's addr */
|
||||
/* extensions */
|
||||
@ -102,25 +110,26 @@ struct dhcp6_request {
|
||||
u_int8_t dh6req_msgtype; /* DH6_REQUEST */
|
||||
u_int8_t dh6req_flags;
|
||||
#define DH6REQ_CLOSE 0x80
|
||||
#define DH6REQ_SERVPRESENT 0x40
|
||||
#define DH6REQ_REBOOT 0x20
|
||||
#define DH6REQ_REBOOT 0x40
|
||||
u_int16_t dh6req_xid; /* transaction-ID */
|
||||
struct in6_addr dh6req_cliaddr; /* client's lladdr */
|
||||
struct in6_addr dh6req_relayaddr; /* relay agent's (non-ll) addr */
|
||||
/* struct in6_addr dh6req_serveraddr; optional: server's addr */
|
||||
struct in6_addr dh6req_serveraddr; /* server's addr */
|
||||
/* extensions */
|
||||
};
|
||||
|
||||
struct dhcp6_reply {
|
||||
u_int8_t dh6rep_msgtype; /* DH6_REPLY */
|
||||
u_int8_t dh6rep_flagandstat;
|
||||
#define DH6REP_CLIPRESENT 0x80
|
||||
#define DH6REP_RELAYPRESENT 0x80
|
||||
#define DH6REP_STATMASK 0x7f
|
||||
u_int16_t dh6rep_xid; /* transaction-ID */
|
||||
/* struct in6_addr dh6rep_cliaddr; optional: client's lladdr */
|
||||
struct in6_addr dh6rep_cliaddr; /* client's lladdr */
|
||||
/* struct in6_addr dh6rep_relayaddr; optional: relay address */
|
||||
/* extensions */
|
||||
};
|
||||
|
||||
/* XXX: followings are based on older drafts */
|
||||
struct dhcp6_release {
|
||||
u_int8_t dh6rel_msgtype; /* DH6_RELEASE */
|
||||
u_int8_t dh6rel_flags;
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/dhcp6opt.h,v 1.3 2000/12/17 23:07:49 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (C) 1998 and 1999 WIDE Project.
|
||||
* All rights reserved.
|
||||
@ -72,9 +73,9 @@ struct dhcp6_opt {
|
||||
extern struct dhcp6_opt *dh6o_pad;
|
||||
extern struct dhcp6_opt *dh6o_end;
|
||||
extern int dhcp6_param[];
|
||||
extern void dhcp6opttab_init __P((void));
|
||||
extern struct dhcp6_opt *dhcp6opttab_byname __P((char *));
|
||||
extern struct dhcp6_opt *dhcp6opttab_bycode __P((u_int));
|
||||
extern void dhcp6opttab_init (void);
|
||||
extern struct dhcp6_opt *dhcp6opttab_byname (char *);
|
||||
extern struct dhcp6_opt *dhcp6opttab_bycode (u_int);
|
||||
#endif
|
||||
|
||||
#endif /*__DHCP6OPT_H_DEFINED*/
|
||||
|
68
contrib/tcpdump/esp.h
Normal file
68
contrib/tcpdump/esp.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* $NetBSD: esp.h,v 1.13 2000/09/26 08:37:38 itojun Exp $ */
|
||||
/* $KAME: esp.h,v 1.15 2000/09/20 18:15:22 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* RFC1827/2406 Encapsulated Security Payload.
|
||||
*/
|
||||
|
||||
#ifndef _NETINET6_ESP_H_
|
||||
#define _NETINET6_ESP_H_
|
||||
|
||||
struct esp {
|
||||
u_int32_t esp_spi; /* ESP */
|
||||
/*variable size, 32bit bound*/ /* Initialization Vector */
|
||||
/*variable size*/ /* Payload data */
|
||||
/*variable size*/ /* padding */
|
||||
/*8bit*/ /* pad size */
|
||||
/*8bit*/ /* next header */
|
||||
/*8bit*/ /* next header */
|
||||
/*variable size, 32bit bound*/ /* Authentication data (new IPsec) */
|
||||
};
|
||||
|
||||
struct newesp {
|
||||
u_int32_t esp_spi; /* ESP */
|
||||
u_int32_t esp_seq; /* Sequence number */
|
||||
/*variable size*/ /* (IV and) Payload data */
|
||||
/*variable size*/ /* padding */
|
||||
/*8bit*/ /* pad size */
|
||||
/*8bit*/ /* next header */
|
||||
/*8bit*/ /* next header */
|
||||
/*variable size, 32bit bound*/ /* Authentication data */
|
||||
};
|
||||
|
||||
struct esptail {
|
||||
u_int8_t esp_padlen; /* pad length */
|
||||
u_int8_t esp_nxt; /* Next header */
|
||||
/*variable size, 32bit bound*/ /* Authentication data (new IPsec)*/
|
||||
};
|
||||
|
||||
#endif /*_NETINET6_ESP_H_*/
|
59
contrib/tcpdump/ether.h
Normal file
59
contrib/tcpdump/ether.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.6 2000/10/09 03:24:24 guy Exp $ (LBL) */
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)if_ether.h 8.3 (Berkeley) 5/2/95
|
||||
*/
|
||||
|
||||
#define ETHERMTU 1500
|
||||
|
||||
/*
|
||||
* The number of bytes in an ethernet (MAC) address.
|
||||
*/
|
||||
#define ETHER_ADDR_LEN 6
|
||||
|
||||
/*
|
||||
* Structure of a DEC/Intel/Xerox or 802.3 Ethernet header.
|
||||
*/
|
||||
struct ether_header {
|
||||
u_int8_t ether_dhost[ETHER_ADDR_LEN];
|
||||
u_int8_t ether_shost[ETHER_ADDR_LEN];
|
||||
u_int16_t ether_type;
|
||||
};
|
||||
|
||||
/*
|
||||
* Length of a DEC/Intel/Xerox or 802.3 Ethernet header; note that some
|
||||
* compilers may pad "struct ether_header" to a multiple of 4 bytes,
|
||||
* for example, so "sizeof (struct ether_header)" may not give the right
|
||||
* answer.
|
||||
*/
|
||||
#define ETHER_HDRLEN 14
|
@ -18,40 +18,40 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.15.1.1 1999/10/07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.16 2000/10/03 02:54:55 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Network to host order macros */
|
||||
|
||||
#ifdef LBL_ALIGN
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_short)*((u_char *)(p) + 0) << 8 | \
|
||||
(u_short)*((u_char *)(p) + 1))
|
||||
((u_int16_t)*((u_int8_t *)(p) + 0) << 8 | \
|
||||
(u_int16_t)*((u_int8_t *)(p) + 1))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)*((u_char *)(p) + 0) << 24 | \
|
||||
(u_int32_t)*((u_char *)(p) + 1) << 16 | \
|
||||
(u_int32_t)*((u_char *)(p) + 2) << 8 | \
|
||||
(u_int32_t)*((u_char *)(p) + 3))
|
||||
((u_int32_t)*((u_int8_t *)(p) + 0) << 24 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 1) << 16 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 2) << 8 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 3))
|
||||
#else
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_short)ntohs(*(u_short *)(p)))
|
||||
((u_int16_t)ntohs(*(u_int16_t *)(p)))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)ntohl(*(u_int32_t *)(p)))
|
||||
#endif
|
||||
|
||||
#define EXTRACT_24BITS(p) \
|
||||
((u_int32_t)*((u_char *)(p) + 0) << 16 | \
|
||||
(u_int32_t)*((u_char *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_char *)(p) + 2))
|
||||
((u_int32_t)*((u_int8_t *)(p) + 0) << 16 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 2))
|
||||
|
||||
/* Little endian protocol host order macros */
|
||||
|
||||
#define EXTRACT_LE_8BITS(p) (*(p))
|
||||
#define EXTRACT_LE_16BITS(p) \
|
||||
((u_short)*((u_char *)(p) + 1) << 8 | \
|
||||
(u_short)*((u_char *)(p) + 0))
|
||||
((u_int16_t)*((u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int16_t)*((u_int8_t *)(p) + 0))
|
||||
#define EXTRACT_LE_32BITS(p) \
|
||||
((u_int32_t)*((u_char *)(p) + 3) << 24 | \
|
||||
(u_int32_t)*((u_char *)(p) + 2) << 16 | \
|
||||
(u_int32_t)*((u_char *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_char *)(p) + 0))
|
||||
((u_int32_t)*((u_int8_t *)(p) + 3) << 24 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 2) << 16 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 0))
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.8.1.1 1999/10/07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/fddi.h,v 1.9 2000/10/09 02:59:39 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -37,6 +37,13 @@ struct fddi_header {
|
||||
u_char fddi_shost[6];
|
||||
};
|
||||
|
||||
/*
|
||||
* Length of an FDDI header; note that some compilers may pad
|
||||
* "struct fddi_header" to a multiple of 4 bytes, for example, so
|
||||
* "sizeof (struct fddi_header)" may not give the right
|
||||
* answer.
|
||||
*/
|
||||
#define FDDI_HDRLEN 13
|
||||
|
||||
/* Useful values for fddi_fc (frame control) field */
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.3 1999/11/21 09:36:47 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.4 2000/07/11 00:49:02 assar Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -36,7 +36,6 @@ static const char rcsid[] =
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "gnuc.h"
|
||||
#ifdef HAVE_OS_PROTO_H
|
||||
#include "os-proto.h"
|
||||
#endif
|
||||
|
412
contrib/tcpdump/icmp6.h
Normal file
412
contrib/tcpdump/icmp6.h
Normal file
@ -0,0 +1,412 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.4 2000/12/17 23:13:32 guy Exp $ (LBL) */
|
||||
/* $NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp $ */
|
||||
/* $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_ICMP6_H_
|
||||
#define _NETINET_ICMP6_H_
|
||||
|
||||
struct icmp6_hdr {
|
||||
u_int8_t icmp6_type; /* type field */
|
||||
u_int8_t icmp6_code; /* code field */
|
||||
u_int16_t icmp6_cksum; /* checksum field */
|
||||
union {
|
||||
u_int32_t icmp6_un_data32[1]; /* type-specific field */
|
||||
u_int16_t icmp6_un_data16[2]; /* type-specific field */
|
||||
u_int8_t icmp6_un_data8[4]; /* type-specific field */
|
||||
} icmp6_dataun;
|
||||
};
|
||||
|
||||
#define icmp6_data32 icmp6_dataun.icmp6_un_data32
|
||||
#define icmp6_data16 icmp6_dataun.icmp6_un_data16
|
||||
#define icmp6_data8 icmp6_dataun.icmp6_un_data8
|
||||
#define icmp6_pptr icmp6_data32[0] /* parameter prob */
|
||||
#define icmp6_mtu icmp6_data32[0] /* packet too big */
|
||||
#define icmp6_id icmp6_data16[0] /* echo request/reply */
|
||||
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
|
||||
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
|
||||
|
||||
#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
|
||||
#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
|
||||
#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
|
||||
#define ICMP6_PARAM_PROB 4 /* ip6 header bad */
|
||||
|
||||
#define ICMP6_ECHO_REQUEST 128 /* echo service */
|
||||
#define ICMP6_ECHO_REPLY 129 /* echo reply */
|
||||
#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
|
||||
#define MLD6_LISTENER_QUERY 130 /* multicast listener query */
|
||||
#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
|
||||
#define MLD6_LISTENER_REPORT 131 /* multicast listener report */
|
||||
#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
|
||||
#define MLD6_LISTENER_DONE 132 /* multicast listener done */
|
||||
|
||||
#define ND_ROUTER_SOLICIT 133 /* router solicitation */
|
||||
#define ND_ROUTER_ADVERT 134 /* router advertisment */
|
||||
#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
|
||||
#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */
|
||||
#define ND_REDIRECT 137 /* redirect */
|
||||
|
||||
#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
|
||||
|
||||
#define ICMP6_WRUREQUEST 139 /* who are you request */
|
||||
#define ICMP6_WRUREPLY 140 /* who are you reply */
|
||||
#define ICMP6_FQDN_QUERY 139 /* FQDN query */
|
||||
#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
|
||||
#define ICMP6_NI_QUERY 139 /* node information request */
|
||||
#define ICMP6_NI_REPLY 140 /* node information reply */
|
||||
|
||||
/* The definitions below are experimental. TBA */
|
||||
#define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
|
||||
#define MLD6_MTRACE 142 /* mtrace messages */
|
||||
|
||||
#define ICMP6_MAXTYPE 142
|
||||
|
||||
#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
|
||||
#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
|
||||
#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
|
||||
#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
|
||||
#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
|
||||
#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
|
||||
|
||||
#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
|
||||
#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
|
||||
|
||||
#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
|
||||
#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
|
||||
#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
|
||||
|
||||
#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
|
||||
|
||||
#define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */
|
||||
#define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */
|
||||
#define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */
|
||||
|
||||
#define ICMP6_NI_SUCCESS 0 /* node information successful reply */
|
||||
#define ICMP6_NI_REFUSED 1 /* node information request is refused */
|
||||
#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
|
||||
|
||||
#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
|
||||
#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
|
||||
#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
|
||||
|
||||
/* Used in kernel only */
|
||||
#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
|
||||
#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
|
||||
|
||||
/*
|
||||
* Multicast Listener Discovery
|
||||
*/
|
||||
struct mld6_hdr {
|
||||
struct icmp6_hdr mld6_hdr;
|
||||
struct in6_addr mld6_addr; /* multicast address */
|
||||
};
|
||||
|
||||
#define mld6_type mld6_hdr.icmp6_type
|
||||
#define mld6_code mld6_hdr.icmp6_code
|
||||
#define mld6_cksum mld6_hdr.icmp6_cksum
|
||||
#define mld6_maxdelay mld6_hdr.icmp6_data16[0]
|
||||
#define mld6_reserved mld6_hdr.icmp6_data16[1]
|
||||
|
||||
/*
|
||||
* Neighbor Discovery
|
||||
*/
|
||||
|
||||
struct nd_router_solicit { /* router solicitation */
|
||||
struct icmp6_hdr nd_rs_hdr;
|
||||
/* could be followed by options */
|
||||
};
|
||||
|
||||
#define nd_rs_type nd_rs_hdr.icmp6_type
|
||||
#define nd_rs_code nd_rs_hdr.icmp6_code
|
||||
#define nd_rs_cksum nd_rs_hdr.icmp6_cksum
|
||||
#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
|
||||
|
||||
struct nd_router_advert { /* router advertisement */
|
||||
struct icmp6_hdr nd_ra_hdr;
|
||||
u_int32_t nd_ra_reachable; /* reachable time */
|
||||
u_int32_t nd_ra_retransmit; /* retransmit timer */
|
||||
/* could be followed by options */
|
||||
};
|
||||
|
||||
#define nd_ra_type nd_ra_hdr.icmp6_type
|
||||
#define nd_ra_code nd_ra_hdr.icmp6_code
|
||||
#define nd_ra_cksum nd_ra_hdr.icmp6_cksum
|
||||
#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
|
||||
#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
|
||||
#define ND_RA_FLAG_MANAGED 0x80
|
||||
#define ND_RA_FLAG_OTHER 0x40
|
||||
#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
|
||||
|
||||
struct nd_neighbor_solicit { /* neighbor solicitation */
|
||||
struct icmp6_hdr nd_ns_hdr;
|
||||
struct in6_addr nd_ns_target; /*target address */
|
||||
/* could be followed by options */
|
||||
};
|
||||
|
||||
#define nd_ns_type nd_ns_hdr.icmp6_type
|
||||
#define nd_ns_code nd_ns_hdr.icmp6_code
|
||||
#define nd_ns_cksum nd_ns_hdr.icmp6_cksum
|
||||
#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
|
||||
|
||||
struct nd_neighbor_advert { /* neighbor advertisement */
|
||||
struct icmp6_hdr nd_na_hdr;
|
||||
struct in6_addr nd_na_target; /* target address */
|
||||
/* could be followed by options */
|
||||
};
|
||||
|
||||
#define nd_na_type nd_na_hdr.icmp6_type
|
||||
#define nd_na_code nd_na_hdr.icmp6_code
|
||||
#define nd_na_cksum nd_na_hdr.icmp6_cksum
|
||||
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
|
||||
/* netowkr endian */
|
||||
#define ND_NA_FLAG_ROUTER ((u_int32_t)htonl(0x80000000))
|
||||
#define ND_NA_FLAG_SOLICITED ((u_int32_t)htonl(0x40000000))
|
||||
#define ND_NA_FLAG_OVERRIDE ((u_int32_t)htonl(0x20000000))
|
||||
|
||||
struct nd_redirect { /* redirect */
|
||||
struct icmp6_hdr nd_rd_hdr;
|
||||
struct in6_addr nd_rd_target; /* target address */
|
||||
struct in6_addr nd_rd_dst; /* destination address */
|
||||
/* could be followed by options */
|
||||
};
|
||||
|
||||
#define nd_rd_type nd_rd_hdr.icmp6_type
|
||||
#define nd_rd_code nd_rd_hdr.icmp6_code
|
||||
#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
|
||||
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
|
||||
|
||||
struct nd_opt_hdr { /* Neighbor discovery option header */
|
||||
u_int8_t nd_opt_type;
|
||||
u_int8_t nd_opt_len;
|
||||
/* followed by option specific data*/
|
||||
};
|
||||
|
||||
#define ND_OPT_SOURCE_LINKADDR 1
|
||||
#define ND_OPT_TARGET_LINKADDR 2
|
||||
#define ND_OPT_PREFIX_INFORMATION 3
|
||||
#define ND_OPT_REDIRECTED_HEADER 4
|
||||
#define ND_OPT_MTU 5
|
||||
#define ND_OPT_ADVINT 7
|
||||
|
||||
struct nd_opt_prefix_info { /* prefix information */
|
||||
u_int8_t nd_opt_pi_type;
|
||||
u_int8_t nd_opt_pi_len;
|
||||
u_int8_t nd_opt_pi_prefix_len;
|
||||
u_int8_t nd_opt_pi_flags_reserved;
|
||||
u_int32_t nd_opt_pi_valid_time;
|
||||
u_int32_t nd_opt_pi_preferred_time;
|
||||
u_int32_t nd_opt_pi_reserved2;
|
||||
struct in6_addr nd_opt_pi_prefix;
|
||||
};
|
||||
|
||||
#define ND_OPT_PI_FLAG_ONLINK 0x80
|
||||
#define ND_OPT_PI_FLAG_AUTO 0x40
|
||||
#define ND_OPT_PI_FLAG_ROUTER 0x20 /*2292bis*/
|
||||
|
||||
struct nd_opt_rd_hdr { /* redirected header */
|
||||
u_int8_t nd_opt_rh_type;
|
||||
u_int8_t nd_opt_rh_len;
|
||||
u_int16_t nd_opt_rh_reserved1;
|
||||
u_int32_t nd_opt_rh_reserved2;
|
||||
/* followed by IP header and data */
|
||||
};
|
||||
|
||||
struct nd_opt_mtu { /* MTU option */
|
||||
u_int8_t nd_opt_mtu_type;
|
||||
u_int8_t nd_opt_mtu_len;
|
||||
u_int16_t nd_opt_mtu_reserved;
|
||||
u_int32_t nd_opt_mtu_mtu;
|
||||
};
|
||||
|
||||
struct nd_opt_advint { /* Advertisement interval option */
|
||||
u_int8_t nd_opt_advint_type;
|
||||
u_int8_t nd_opt_advint_len;
|
||||
u_int16_t nd_opt_advint_reserved;
|
||||
u_int32_t nd_opt_advint_advint;
|
||||
};
|
||||
|
||||
/*
|
||||
* icmp6 namelookup
|
||||
*/
|
||||
|
||||
struct icmp6_namelookup {
|
||||
struct icmp6_hdr icmp6_nl_hdr;
|
||||
u_int8_t icmp6_nl_nonce[8];
|
||||
int32_t icmp6_nl_ttl;
|
||||
#if 0
|
||||
u_int8_t icmp6_nl_len;
|
||||
u_int8_t icmp6_nl_name[3];
|
||||
#endif
|
||||
/* could be followed by options */
|
||||
};
|
||||
|
||||
/*
|
||||
* icmp6 node information
|
||||
*/
|
||||
struct icmp6_nodeinfo {
|
||||
struct icmp6_hdr icmp6_ni_hdr;
|
||||
u_int8_t icmp6_ni_nonce[8];
|
||||
/* could be followed by reply data */
|
||||
};
|
||||
|
||||
#define ni_type icmp6_ni_hdr.icmp6_type
|
||||
#define ni_code icmp6_ni_hdr.icmp6_code
|
||||
#define ni_cksum icmp6_ni_hdr.icmp6_cksum
|
||||
#define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
|
||||
#define ni_flags icmp6_ni_hdr.icmp6_data16[1]
|
||||
|
||||
#define NI_QTYPE_NOOP 0 /* NOOP */
|
||||
#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
|
||||
#define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */
|
||||
#define NI_QTYPE_DNSNAME 2 /* DNS Name */
|
||||
#define NI_QTYPE_NODEADDR 3 /* Node Addresses */
|
||||
#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */
|
||||
|
||||
/* network endian */
|
||||
#define NI_SUPTYPE_FLAG_COMPRESS ((u_int16_t)htons(0x1))
|
||||
#define NI_FQDN_FLAG_VALIDTTL ((u_int16_t)htons(0x1))
|
||||
|
||||
/* network endian */
|
||||
#define NI_NODEADDR_FLAG_TRUNCATE ((u_int16_t)htons(0x1))
|
||||
#define NI_NODEADDR_FLAG_ALL ((u_int16_t)htons(0x2))
|
||||
#define NI_NODEADDR_FLAG_COMPAT ((u_int16_t)htons(0x4))
|
||||
#define NI_NODEADDR_FLAG_LINKLOCAL ((u_int16_t)htons(0x8))
|
||||
#define NI_NODEADDR_FLAG_SITELOCAL ((u_int16_t)htons(0x10))
|
||||
#define NI_NODEADDR_FLAG_GLOBAL ((u_int16_t)htons(0x20))
|
||||
#define NI_NODEADDR_FLAG_ANYCAST ((u_int16_t)htons(0x40)) /* just experimental. not in spec */
|
||||
|
||||
struct ni_reply_fqdn {
|
||||
u_int32_t ni_fqdn_ttl; /* TTL */
|
||||
u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
|
||||
u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
|
||||
};
|
||||
|
||||
/*
|
||||
* Router Renumbering. as router-renum-08.txt
|
||||
*/
|
||||
struct icmp6_router_renum { /* router renumbering header */
|
||||
struct icmp6_hdr rr_hdr;
|
||||
u_int8_t rr_segnum;
|
||||
u_int8_t rr_flags;
|
||||
u_int16_t rr_maxdelay;
|
||||
u_int32_t rr_reserved;
|
||||
};
|
||||
#define ICMP6_RR_FLAGS_TEST 0x80
|
||||
#define ICMP6_RR_FLAGS_REQRESULT 0x40
|
||||
#define ICMP6_RR_FLAGS_ALLIF 0x20
|
||||
#define ICMP6_RR_FLAGS_SPECSITE 0x10
|
||||
#define ICMP6_RR_FLAGS_PREVDONE 0x08
|
||||
|
||||
#define rr_type rr_hdr.icmp6_type
|
||||
#define rr_code rr_hdr.icmp6_code
|
||||
#define rr_cksum rr_hdr.icmp6_cksum
|
||||
#define rr_seqnum rr_hdr.icmp6_data32[0]
|
||||
|
||||
struct rr_pco_match { /* match prefix part */
|
||||
u_int8_t rpm_code;
|
||||
u_int8_t rpm_len;
|
||||
u_int8_t rpm_ordinal;
|
||||
u_int8_t rpm_matchlen;
|
||||
u_int8_t rpm_minlen;
|
||||
u_int8_t rpm_maxlen;
|
||||
u_int16_t rpm_reserved;
|
||||
struct in6_addr rpm_prefix;
|
||||
};
|
||||
|
||||
#define RPM_PCO_ADD 1
|
||||
#define RPM_PCO_CHANGE 2
|
||||
#define RPM_PCO_SETGLOBAL 3
|
||||
#define RPM_PCO_MAX 4
|
||||
|
||||
struct rr_pco_use { /* use prefix part */
|
||||
u_int8_t rpu_uselen;
|
||||
u_int8_t rpu_keeplen;
|
||||
u_int8_t rpu_ramask;
|
||||
u_int8_t rpu_raflags;
|
||||
u_int32_t rpu_vltime;
|
||||
u_int32_t rpu_pltime;
|
||||
u_int32_t rpu_flags;
|
||||
struct in6_addr rpu_prefix;
|
||||
};
|
||||
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
|
||||
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
|
||||
|
||||
/* network endian */
|
||||
#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ((u_int32_t)htonl(0x80000000))
|
||||
#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ((u_int32_t)htonl(0x40000000))
|
||||
|
||||
struct rr_result { /* router renumbering result message */
|
||||
u_int16_t rrr_flags;
|
||||
u_int8_t rrr_ordinal;
|
||||
u_int8_t rrr_matchedlen;
|
||||
u_int32_t rrr_ifid;
|
||||
struct in6_addr rrr_prefix;
|
||||
};
|
||||
/* network endian */
|
||||
#define ICMP6_RR_RESULT_FLAGS_OOB ((u_int16_t)htons(0x0002))
|
||||
#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ((u_int16_t)htons(0x0001))
|
||||
|
||||
#endif /* not _NETINET_ICMP6_H_ */
|
@ -1,21 +1,18 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/igrp.h,v 1.4 2000/12/17 23:07:49 guy Exp $ (LBL) */
|
||||
/* Cisco IGRP definitions */
|
||||
|
||||
/* IGRP Header */
|
||||
|
||||
struct igrphdr {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
u_int ig_v:4; /* protocol version number */
|
||||
u_int ig_op:4; /* opcode */
|
||||
#else
|
||||
u_int ig_op:4; /* opcode */
|
||||
u_int ig_v:4; /* protocol version number */
|
||||
#endif
|
||||
u_char ig_ed; /* edition number */
|
||||
u_short ig_as; /* autonomous system number */
|
||||
u_short ig_ni; /* number of subnet in local net */
|
||||
u_short ig_ns; /* number of networks in AS */
|
||||
u_short ig_nx; /* number of networks ouside AS */
|
||||
u_short ig_sum; /* checksum of IGRP header & data */
|
||||
u_int8_t ig_vop; /* protocol version number / opcode */
|
||||
#define IGRP_V(x) (((x) & 0xf0) >> 4)
|
||||
#define IGRP_OP(x) ((x) & 0x0f)
|
||||
u_int8_t ig_ed; /* edition number */
|
||||
u_int16_t ig_as; /* autonomous system number */
|
||||
u_int16_t ig_ni; /* number of subnet in local net */
|
||||
u_int16_t ig_ns; /* number of networks in AS */
|
||||
u_int16_t ig_nx; /* number of networks ouside AS */
|
||||
u_int16_t ig_sum; /* checksum of IGRP header & data */
|
||||
};
|
||||
|
||||
#define IGRP_UPDATE 1
|
||||
@ -24,13 +21,13 @@ struct igrphdr {
|
||||
/* IGRP routing entry */
|
||||
|
||||
struct igrprte {
|
||||
u_char igr_net[3]; /* 3 significant octets of IP address */
|
||||
u_char igr_dly[3]; /* delay in tens of microseconds */
|
||||
u_char igr_bw[3]; /* bandwidth in units of 1 kb/s */
|
||||
u_char igr_mtu[2]; /* MTU in octets */
|
||||
u_char igr_rel; /* percent packets successfully tx/rx */
|
||||
u_char igr_ld; /* percent of channel occupied */
|
||||
u_char igr_hct; /* hop count */
|
||||
u_int8_t igr_net[3]; /* 3 significant octets of IP address */
|
||||
u_int8_t igr_dly[3]; /* delay in tens of microseconds */
|
||||
u_int8_t igr_bw[3]; /* bandwidth in units of 1 kb/s */
|
||||
u_int8_t igr_mtu[2]; /* MTU in octets */
|
||||
u_int8_t igr_rel; /* percent packets successfully tx/rx */
|
||||
u_int8_t igr_ld; /* percent of channel occupied */
|
||||
u_int8_t igr_hct; /* hop count */
|
||||
};
|
||||
|
||||
#define IGRP_RTE_SIZE 14 /* don't believe sizeof ! */
|
||||
|
159
contrib/tcpdump/ip.h
Normal file
159
contrib/tcpdump/ip.h
Normal file
@ -0,0 +1,159 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.7 2000/10/03 09:17:40 guy Exp $ (LBL) */
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ip.h 8.2 (Berkeley) 6/1/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Definitions for internet protocol version 4.
|
||||
* Per RFC 791, September 1981.
|
||||
*/
|
||||
#define IPVERSION 4
|
||||
|
||||
/*
|
||||
* Structure of an internet header, naked of options.
|
||||
*
|
||||
* We declare ip_len and ip_off to be short, rather than u_short
|
||||
* pragmatically since otherwise unsigned comparisons can result
|
||||
* against negative integers quite easily, and fail in subtle ways.
|
||||
*/
|
||||
struct ip {
|
||||
u_int8_t ip_vhl; /* header length, version */
|
||||
#define IP_V(ip) (((ip)->ip_vhl & 0xf0) >> 4)
|
||||
#define IP_HL(ip) ((ip)->ip_vhl & 0x0f)
|
||||
u_int8_t ip_tos; /* type of service */
|
||||
u_int16_t ip_len; /* total length */
|
||||
u_int16_t ip_id; /* identification */
|
||||
u_int16_t ip_off; /* fragment offset field */
|
||||
#define IP_DF 0x4000 /* dont fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||
u_int8_t ip_ttl; /* time to live */
|
||||
u_int8_t ip_p; /* protocol */
|
||||
u_int16_t ip_sum; /* checksum */
|
||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
#define IP_MAXPACKET 65535 /* maximum packet size */
|
||||
|
||||
/*
|
||||
* Definitions for IP type of service (ip_tos)
|
||||
*/
|
||||
#define IPTOS_LOWDELAY 0x10
|
||||
#define IPTOS_THROUGHPUT 0x08
|
||||
#define IPTOS_RELIABILITY 0x04
|
||||
|
||||
/*
|
||||
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
|
||||
*/
|
||||
#define IPTOS_PREC_NETCONTROL 0xe0
|
||||
#define IPTOS_PREC_INTERNETCONTROL 0xc0
|
||||
#define IPTOS_PREC_CRITIC_ECP 0xa0
|
||||
#define IPTOS_PREC_FLASHOVERRIDE 0x80
|
||||
#define IPTOS_PREC_FLASH 0x60
|
||||
#define IPTOS_PREC_IMMEDIATE 0x40
|
||||
#define IPTOS_PREC_PRIORITY 0x20
|
||||
#define IPTOS_PREC_ROUTINE 0x00
|
||||
|
||||
/*
|
||||
* Definitions for options.
|
||||
*/
|
||||
#define IPOPT_COPIED(o) ((o)&0x80)
|
||||
#define IPOPT_CLASS(o) ((o)&0x60)
|
||||
#define IPOPT_NUMBER(o) ((o)&0x1f)
|
||||
|
||||
#define IPOPT_CONTROL 0x00
|
||||
#define IPOPT_RESERVED1 0x20
|
||||
#define IPOPT_DEBMEAS 0x40
|
||||
#define IPOPT_RESERVED2 0x60
|
||||
|
||||
#define IPOPT_EOL 0 /* end of option list */
|
||||
#define IPOPT_NOP 1 /* no operation */
|
||||
|
||||
#define IPOPT_RR 7 /* record packet route */
|
||||
#define IPOPT_TS 68 /* timestamp */
|
||||
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
|
||||
#define IPOPT_LSRR 131 /* loose source route */
|
||||
#define IPOPT_SATID 136 /* satnet id */
|
||||
#define IPOPT_SSRR 137 /* strict source route */
|
||||
|
||||
/*
|
||||
* Offsets to fields in options other than EOL and NOP.
|
||||
*/
|
||||
#define IPOPT_OPTVAL 0 /* option ID */
|
||||
#define IPOPT_OLEN 1 /* option length */
|
||||
#define IPOPT_OFFSET 2 /* offset within option */
|
||||
#define IPOPT_MINOFF 4 /* min value of above */
|
||||
|
||||
/*
|
||||
* Time stamp option structure.
|
||||
*/
|
||||
struct ip_timestamp {
|
||||
u_int8_t ipt_code; /* IPOPT_TS */
|
||||
u_int8_t ipt_len; /* size of structure (variable) */
|
||||
u_int8_t ipt_ptr; /* index of current entry */
|
||||
u_int8_t ipt_oflwflg; /* flags, overflow counter */
|
||||
#define IPTS_OFLW(ip) (((ipt)->ipt_oflwflg & 0xf0) >> 4)
|
||||
#define IPTS_FLG(ip) ((ipt)->ipt_oflwflg & 0x0f)
|
||||
union ipt_timestamp {
|
||||
u_int32_t ipt_time[1];
|
||||
struct ipt_ta {
|
||||
struct in_addr ipt_addr;
|
||||
u_int32_t ipt_time;
|
||||
} ipt_ta[1];
|
||||
} ipt_timestamp;
|
||||
};
|
||||
|
||||
/* flag bits for ipt_flg */
|
||||
#define IPOPT_TS_TSONLY 0 /* timestamps only */
|
||||
#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
|
||||
#define IPOPT_TS_PRESPEC 3 /* specified modules only */
|
||||
|
||||
/* bits for security (not byte swapped) */
|
||||
#define IPOPT_SECUR_UNCLASS 0x0000
|
||||
#define IPOPT_SECUR_CONFID 0xf135
|
||||
#define IPOPT_SECUR_EFTO 0x789a
|
||||
#define IPOPT_SECUR_MMMM 0xbc4d
|
||||
#define IPOPT_SECUR_RESTR 0xaf13
|
||||
#define IPOPT_SECUR_SECRET 0xd788
|
||||
#define IPOPT_SECUR_TOPSECRET 0x6bc5
|
||||
|
||||
/*
|
||||
* Internet implementation parameters.
|
||||
*/
|
||||
#define MAXTTL 255 /* maximum time to live (seconds) */
|
||||
#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
|
||||
#define IPFRAGTTL 60 /* time to live for frags, slowhz */
|
||||
#define IPTTLDEC 1 /* subtracted when forwarding */
|
||||
|
||||
#define IP_MSS 576 /* default maximum segment size */
|
195
contrib/tcpdump/ip6.h
Normal file
195
contrib/tcpdump/ip6.h
Normal file
@ -0,0 +1,195 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.3 2000/12/17 23:07:48 guy Exp $ (LBL) */
|
||||
/* $NetBSD: ip6.h,v 1.9 2000/07/13 05:34:21 itojun Exp $ */
|
||||
/* $KAME: ip6.h,v 1.9 2000/07/02 21:01:32 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)ip.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IP6_H_
|
||||
#define _NETINET_IP6_H_
|
||||
|
||||
/*
|
||||
* Definition for internet protocol version 6.
|
||||
* RFC 2460
|
||||
*/
|
||||
|
||||
struct ip6_hdr {
|
||||
union {
|
||||
struct ip6_hdrctl {
|
||||
u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */
|
||||
u_int16_t ip6_un1_plen; /* payload length */
|
||||
u_int8_t ip6_un1_nxt; /* next header */
|
||||
u_int8_t ip6_un1_hlim; /* hop limit */
|
||||
} ip6_un1;
|
||||
u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */
|
||||
} ip6_ctlun;
|
||||
struct in6_addr ip6_src; /* source address */
|
||||
struct in6_addr ip6_dst; /* destination address */
|
||||
};
|
||||
|
||||
#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
|
||||
#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
|
||||
#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
|
||||
#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
|
||||
|
||||
#define IPV6_VERSION 0x60
|
||||
#define IPV6_VERSION_MASK 0xf0
|
||||
|
||||
/* in network endian */
|
||||
#define IPV6_FLOWINFO_MASK ((u_int32_t)htonl(0x0fffffff)) /* flow info (28 bits) */
|
||||
#define IPV6_FLOWLABEL_MASK ((u_int32_t)htonl(0x000fffff)) /* flow label (20 bits) */
|
||||
#if 1
|
||||
/* ECN bits proposed by Sally Floyd */
|
||||
#define IP6TOS_CE 0x01 /* congestion experienced */
|
||||
#define IP6TOS_ECT 0x02 /* ECN-capable transport */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Extension Headers
|
||||
*/
|
||||
|
||||
struct ip6_ext {
|
||||
u_char ip6e_nxt;
|
||||
u_char ip6e_len;
|
||||
};
|
||||
|
||||
/* Hop-by-Hop options header */
|
||||
/* XXX should we pad it to force alignment on an 8-byte boundary? */
|
||||
struct ip6_hbh {
|
||||
u_int8_t ip6h_nxt; /* next header */
|
||||
u_int8_t ip6h_len; /* length in units of 8 octets */
|
||||
/* followed by options */
|
||||
};
|
||||
|
||||
/* Destination options header */
|
||||
/* XXX should we pad it to force alignment on an 8-byte boundary? */
|
||||
struct ip6_dest {
|
||||
u_int8_t ip6d_nxt; /* next header */
|
||||
u_int8_t ip6d_len; /* length in units of 8 octets */
|
||||
/* followed by options */
|
||||
};
|
||||
|
||||
/* Option types and related macros */
|
||||
#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
|
||||
#define IP6OPT_PADN 0x01 /* 00 0 00001 */
|
||||
#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
|
||||
#define IP6OPT_JUMBO_LEN 6
|
||||
#define IP6OPT_ROUTER_ALERT 0x05 /* 00 0 00101 */
|
||||
|
||||
#define IP6OPT_RTALERT_LEN 4
|
||||
#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
|
||||
#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
|
||||
#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
|
||||
#define IP6OPT_MINLEN 2
|
||||
|
||||
#define IP6OPT_BINDING_UPDATE 0xc6 /* 11 0 00110 */
|
||||
#define IP6OPT_BINDING_ACK 0x07 /* 00 0 00111 */
|
||||
#define IP6OPT_BINDING_REQ 0x08 /* 00 0 01000 */
|
||||
#define IP6OPT_HOME_ADDRESS 0xc9 /* 11 0 01001 */
|
||||
#define IP6OPT_EID 0x8a /* 10 0 01010 */
|
||||
|
||||
#define IP6OPT_TYPE(o) ((o) & 0xC0)
|
||||
#define IP6OPT_TYPE_SKIP 0x00
|
||||
#define IP6OPT_TYPE_DISCARD 0x40
|
||||
#define IP6OPT_TYPE_FORCEICMP 0x80
|
||||
#define IP6OPT_TYPE_ICMP 0xC0
|
||||
|
||||
#define IP6OPT_MUTABLE 0x20
|
||||
|
||||
/* Routing header */
|
||||
struct ip6_rthdr {
|
||||
u_int8_t ip6r_nxt; /* next header */
|
||||
u_int8_t ip6r_len; /* length in units of 8 octets */
|
||||
u_int8_t ip6r_type; /* routing type */
|
||||
u_int8_t ip6r_segleft; /* segments left */
|
||||
/* followed by routing type specific data */
|
||||
};
|
||||
|
||||
/* Type 0 Routing header */
|
||||
struct ip6_rthdr0 {
|
||||
u_int8_t ip6r0_nxt; /* next header */
|
||||
u_int8_t ip6r0_len; /* length in units of 8 octets */
|
||||
u_int8_t ip6r0_type; /* always zero */
|
||||
u_int8_t ip6r0_segleft; /* segments left */
|
||||
u_int8_t ip6r0_reserved; /* reserved field */
|
||||
u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */
|
||||
struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */
|
||||
};
|
||||
|
||||
/* Fragment header */
|
||||
struct ip6_frag {
|
||||
u_int8_t ip6f_nxt; /* next header */
|
||||
u_int8_t ip6f_reserved; /* reserved field */
|
||||
u_int16_t ip6f_offlg; /* offset, reserved, and flag */
|
||||
u_int32_t ip6f_ident; /* identification */
|
||||
};
|
||||
|
||||
/* network endian */
|
||||
#define IP6F_OFF_MASK ((u_int16_t)htons(0xfff8)) /* mask out offset from _offlg */
|
||||
#define IP6F_RESERVED_MASK ((u_int16_t)htons(0x0006)) /* reserved bits in ip6f_offlg */
|
||||
#define IP6F_MORE_FRAG ((u_int16_t)htons(0x0001)) /* more-fragments flag */
|
||||
|
||||
#endif /* not _NETINET_IP6_H_ */
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/* YIPS @(#)$Id: ipsec_doi.h,v 1.1 1999/10/30 05:11:09 itojun Exp $ */
|
||||
/* YIPS @(#)$Id: ipsec_doi.h,v 1.4 2000/10/04 03:00:29 itojun Exp $ */
|
||||
|
||||
/* refer to RFC 2407 */
|
||||
|
||||
@ -51,6 +51,9 @@
|
||||
#define IPSECDOI_AH_MD5 2
|
||||
#define IPSECDOI_AH_SHA 3
|
||||
#define IPSECDOI_AH_DES 4
|
||||
#define IPSECDOI_AH_SHA2_256 5
|
||||
#define IPSECDOI_AH_SHA2_384 6
|
||||
#define IPSECDOI_AH_SHA2_512 7
|
||||
|
||||
/* 4.4.1 IPSEC Security Protocol Identifiers */
|
||||
#define IPSECDOI_PROTO_IPSEC_ESP 3
|
||||
@ -66,6 +69,8 @@
|
||||
#define IPSECDOI_ESP_DES_IV32 9
|
||||
#define IPSECDOI_ESP_RC4 10
|
||||
#define IPSECDOI_ESP_NULL 11
|
||||
#define IPSECDOI_ESP_RIJNDAEL 12
|
||||
#define IPSECDOI_ESP_AES 12
|
||||
|
||||
/* 4.4.1 IPSEC Security Protocol Identifiers */
|
||||
#define IPSECDOI_PROTO_IPCOMP 4
|
||||
@ -73,7 +78,6 @@
|
||||
#define IPSECDOI_IPCOMP_OUI 1
|
||||
#define IPSECDOI_IPCOMP_DEFLATE 2
|
||||
#define IPSECDOI_IPCOMP_LZS 3
|
||||
#define IPSECDOI_IPCOMP_V42BIS 4
|
||||
|
||||
/* 4.5 IPSEC Security Association Attributes */
|
||||
#define IPSECDOI_ATTR_SA_LTYPE 1 /* B */
|
||||
@ -88,16 +92,17 @@
|
||||
#define IPSECDOI_ATTR_ENC_MODE_TUNNEL 1
|
||||
#define IPSECDOI_ATTR_ENC_MODE_TRNS 2
|
||||
#define IPSECDOI_ATTR_AUTH 5 /* B */
|
||||
/* 0 means not to use authentication. */
|
||||
#define IPSECDOI_ATTR_AUTH_HMAC_MD5 1
|
||||
#define IPSECDOI_ATTR_AUTH_HMAC_SHA1 2
|
||||
#define IPSECDOI_ATTR_AUTH_DES_MAC 3
|
||||
#define IPSECDOI_ATTR_AUTH_KPDK 4
|
||||
#define IPSECDOI_ATTR_AUTH_KPDK 4 /*RFC-1826(Key/Pad/Data/Key)*/
|
||||
/*
|
||||
When negotiating ESP without authentication, the Auth
|
||||
Algorithm attribute MUST NOT be included in the proposal.
|
||||
When negotiating ESP without confidentiality, the Auth
|
||||
Algorithm attribute MUST be included in the proposal and
|
||||
the ESP transform ID must be ESP_NULL.
|
||||
* When negotiating ESP without authentication, the Auth
|
||||
* Algorithm attribute MUST NOT be included in the proposal.
|
||||
* When negotiating ESP without confidentiality, the Auth
|
||||
* Algorithm attribute MUST be included in the proposal and
|
||||
* the ESP transform ID must be ESP_NULL.
|
||||
*/
|
||||
#define IPSECDOI_ATTR_KEY_LENGTH 6 /* B */
|
||||
#define IPSECDOI_ATTR_KEY_ROUNDS 7 /* B */
|
||||
@ -143,22 +148,4 @@ struct ipsecdoi_id {
|
||||
#define IPSECDOI_NTYPE_REPLAY_STATUS 24577
|
||||
#define IPSECDOI_NTYPE_INITIAL_CONTACT 24578
|
||||
|
||||
#if 0
|
||||
/* ipsec sa structure */
|
||||
struct ipsec_sa {
|
||||
u_int8_t proto_id; /* Protocol id */
|
||||
vchar_t *spi; /* spi to receive, network byte order */
|
||||
vchar_t *spi_p; /* spi to send, network byte order */
|
||||
vchar_t *keymat; /* KEYMAT */
|
||||
u_int8_t t_id; /* transform id */
|
||||
u_int8_t enc_t; /* type of cipher */
|
||||
u_int8_t mode_t; /* tunnel or transport */
|
||||
u_int8_t hash_t; /* type of hash */
|
||||
u_int8_t life_t; /* type of duration of lifetime */
|
||||
u_int32_t ldur; /* life duration */
|
||||
u_int8_t dhgrp; /* DH; group */
|
||||
struct ipsec_sa *next;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* !defined(_IPSEC_DOI_H_) */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IPX protocol formats
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.1.1.1 1999/10/07 23:47:10 mcr Exp $
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.2 2000/10/03 02:54:56 itojun Exp $
|
||||
*/
|
||||
|
||||
/* well-known sockets */
|
||||
@ -13,16 +13,16 @@
|
||||
|
||||
/* IPX transport header */
|
||||
struct ipxHdr {
|
||||
u_short cksum; /* Checksum */
|
||||
u_short length; /* Length, in bytes, including header */
|
||||
u_char tCtl; /* Transport Control (i.e. hop count) */
|
||||
u_char pType; /* Packet Type (i.e. level 2 protocol) */
|
||||
u_short dstNet[2]; /* destination net */
|
||||
u_char dstNode[6]; /* destination node */
|
||||
u_short dstSkt; /* destination socket */
|
||||
u_short srcNet[2]; /* source net */
|
||||
u_char srcNode[6]; /* source node */
|
||||
u_short srcSkt; /* source socket */
|
||||
u_int16_t cksum; /* Checksum */
|
||||
u_int16_t length; /* Length, in bytes, including header */
|
||||
u_int8_t tCtl; /* Transport Control (i.e. hop count) */
|
||||
u_int8_t pType; /* Packet Type (i.e. level 2 protocol) */
|
||||
u_int16_t dstNet[2]; /* destination net */
|
||||
u_int8_t dstNode[6]; /* destination node */
|
||||
u_int16_t dstSkt; /* destination socket */
|
||||
u_int16_t srcNet[2]; /* source net */
|
||||
u_int8_t srcNode[6]; /* source node */
|
||||
u_int16_t srcSkt; /* source socket */
|
||||
} ipx_hdr_t;
|
||||
|
||||
#define ipxSize 30
|
||||
|
@ -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.4.2.1 2000/01/14 19:19:56 mcr Exp $ */
|
||||
/* YIPS @(#)$Id: isakmp.h,v 1.7 2000/10/03 05:16:38 itojun Exp $ */
|
||||
|
||||
/* refer to RFC 2408 */
|
||||
|
||||
@ -369,75 +369,6 @@ struct isakmp_ph2tab {
|
||||
int len;
|
||||
};
|
||||
|
||||
#if 0
|
||||
/* isakmp status structure */
|
||||
struct isakmp_ph1 {
|
||||
isakmp_index index;
|
||||
u_int8_t dir; /* INITIATOR or RESPONDER */
|
||||
u_int16_t status; /* status of this SA */
|
||||
u_int16_t etype;
|
||||
u_int32_t doi;
|
||||
u_int32_t sit;
|
||||
vchar_t *dhp; /* DH; prime, static value */
|
||||
vchar_t *dhpriv; /* DH; private value */
|
||||
vchar_t *dhpub; /* DH; public value */
|
||||
vchar_t *dhpub_p; /* DH; partner's public value */
|
||||
vchar_t *dhgxy; /* DH; shared secret */
|
||||
vchar_t *nonce; /* nonce value */
|
||||
vchar_t *nonce_p; /* partner's nonce value */
|
||||
vchar_t *skeyid; /* SKEYID */
|
||||
vchar_t *skeyid_d; /* SKEYID_d */
|
||||
vchar_t *skeyid_a; /* SKEYID_a, i.e. hash */
|
||||
vchar_t *skeyid_e; /* SKEYID_e, i.e. encryption */
|
||||
vchar_t *key; /* cipher key */
|
||||
vchar_t *hash; /* HASH minus general header */
|
||||
vchar_t *iv; /* IV */
|
||||
vchar_t *ive; /* new IV to encrypt next packet */
|
||||
vchar_t *ivd; /* new IV to decrypt next packet */
|
||||
vchar_t *sa; /* SA minus general header including p,t.*/
|
||||
vchar_t *id; /* ID minus general header */
|
||||
vchar_t *id_p; /* partner's ID minus general header */
|
||||
struct sockaddr *local; /* pointer to the my sockaddr */
|
||||
struct sockaddr *remote; /* partner's sockaddr */
|
||||
struct oakley_sa *isa; /* Is it good that caddr_t ? */
|
||||
struct sched *sc; /* back pointer to the record in schedule
|
||||
used to resend. */
|
||||
struct isakmp_ph1 *next;
|
||||
struct isakmp_ph1 *prev;
|
||||
struct isakmp_conf *cfp; /* pointer to isakmp configuration */
|
||||
struct isakmp_ph2tab ph2tab; /* list on negotiating Phase 2 */
|
||||
u_int32_t msgid2; /* XXX: msgid counter for Phase 2 */
|
||||
};
|
||||
|
||||
struct isakmp_ph2 {
|
||||
msgid_t msgid;
|
||||
u_int8_t dir; /* INITIATOR or RESPONDER */
|
||||
u_int16_t status; /* status of this SA */
|
||||
vchar_t *dhp; /* DH; prime, static value */
|
||||
vchar_t *dhpriv; /* DH; private value */
|
||||
vchar_t *dhpub; /* DH; public value */
|
||||
vchar_t *dhpub_p; /* DH; partner's public value */
|
||||
vchar_t *dhgxy; /* DH; shared secret */
|
||||
vchar_t *id; /* ID */
|
||||
vchar_t *id_p; /* ID for peer */
|
||||
vchar_t *nonce; /* nonce value in phase 2 */
|
||||
vchar_t *nonce_p; /* partner's nonce value in phase 2 */
|
||||
vchar_t *hash; /* HASH2 minus general header */
|
||||
vchar_t *iv; /* IV for Phase 2 */
|
||||
vchar_t *ive; /* new IV to encrypt next packet */
|
||||
vchar_t *ivd; /* new IV to decrypt next packet */
|
||||
struct isakmp_ph1 *ph1; /* back pointer to isakmp status */
|
||||
struct sched *sc; /* back pointer to the schedule using resend */
|
||||
struct pfkey_st *pst; /* pointer to the pfkey status record.
|
||||
is only used by initiator. */
|
||||
u_int8_t proxy; /* is proxy or not ?. */
|
||||
vchar_t *sa; /* SA payload */
|
||||
struct ipsec_sa *isa; /* values of SA to use, same SA in use. */
|
||||
struct isakmp_ph2 *next;
|
||||
struct isakmp_ph2 *prev;
|
||||
};
|
||||
#endif
|
||||
|
||||
#define EXCHANGE_PROXY 1
|
||||
#define EXCHANGE_MYSELF 0
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/l2tp.h,v 1.4 2000/12/17 23:07:49 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -18,7 +19,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* L2TP support contributed by Motonori Shindo (mshindo@ascend.co.jp)
|
||||
* L2TP support contributed by Motonori Shindo (mshindo@mshindo.net)
|
||||
*/
|
||||
|
||||
|
||||
@ -61,22 +62,22 @@
|
||||
|
||||
struct l2tp_avp_vec {
|
||||
const char *name;
|
||||
void (*print)(const u_char *, u_int);
|
||||
void (*print)(const u_char *, u_int32_t);
|
||||
};
|
||||
|
||||
struct l2tp_call_errors {
|
||||
u_short reserved;
|
||||
u_int crc_errs;
|
||||
u_int framing_errs;
|
||||
u_int hardware_overruns;
|
||||
u_int buffer_overruns;
|
||||
u_int timeout_errs;
|
||||
u_int alignment_errs;
|
||||
u_int16_t reserved;
|
||||
u_int32_t crc_errs;
|
||||
u_int32_t framing_errs;
|
||||
u_int32_t hardware_overruns;
|
||||
u_int32_t buffer_overruns;
|
||||
u_int32_t timeout_errs;
|
||||
u_int32_t alignment_errs;
|
||||
};
|
||||
|
||||
struct l2tp_accm {
|
||||
u_short reserved;
|
||||
u_int send_accm;
|
||||
u_int recv_accm;
|
||||
u_int16_t reserved;
|
||||
u_int32_t send_accm;
|
||||
u_int32_t recv_accm;
|
||||
};
|
||||
|
||||
|
@ -20,15 +20,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Id: lane.h,v 1.2 1999/11/21 16:35:11 assar Exp $ */
|
||||
/* $Id: lane.h,v 1.3 2000/10/03 02:54:56 itojun Exp $ */
|
||||
|
||||
#ifndef ETHER_ADDR_LEN
|
||||
#define ETHER_ADDR_LEN 6
|
||||
#endif
|
||||
|
||||
struct lecdatahdr_8023 {
|
||||
u_short le_header;
|
||||
u_char h_dest[ETHER_ADDR_LEN];
|
||||
u_char h_source[ETHER_ADDR_LEN];
|
||||
u_short h_type;
|
||||
u_int16_t le_header;
|
||||
u_int8_t h_dest[ETHER_ADDR_LEN];
|
||||
u_int8_t h_source[ETHER_ADDR_LEN];
|
||||
u_int16_t h_type;
|
||||
};
|
||||
|
@ -18,37 +18,13 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-solaris2.h,v 1.18.1.1 1999/10/07 23:47:13 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/lbl/os-solaris2.h,v 1.19 2000/10/11 04:02:15 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Prototypes missing in SunOS 5 */
|
||||
int daemon(int, int);
|
||||
int dn_expand(const u_char *, const u_char *, const u_char *, char *, int);
|
||||
int dn_skipname(const u_char *, const u_char *);
|
||||
int flock(int, int);
|
||||
int getdtablesize(void);
|
||||
int gethostname(char *, int);
|
||||
int getpagesize(void);
|
||||
char *getusershell(void);
|
||||
char *getwd(char *);
|
||||
int iruserok(u_int, int, char *, char *);
|
||||
#ifdef __STDC__
|
||||
struct utmp;
|
||||
void login(struct utmp *);
|
||||
#endif
|
||||
int logout(const char *);
|
||||
int res_query(const char *, int, int, u_char *, int);
|
||||
int setenv(const char *, const char *, int);
|
||||
#if defined(_STDIO_H) && defined(HAVE_SETLINEBUF)
|
||||
int setlinebuf(FILE *);
|
||||
#endif
|
||||
int sigblock(int);
|
||||
int sigsetmask(int);
|
||||
char *strerror(int);
|
||||
int snprintf(char *, size_t, const char *, ...);
|
||||
int strcasecmp(const char *, const char *);
|
||||
void unsetenv(const char *);
|
||||
#ifdef __STDC__
|
||||
struct timeval;
|
||||
#endif
|
||||
int utimes(const char *, struct timeval *);
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.6.1.1 1999/10/07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.8 2000/12/18 07:55:36 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -32,19 +32,19 @@
|
||||
*/
|
||||
|
||||
struct llc {
|
||||
u_char dsap;
|
||||
u_char ssap;
|
||||
u_int8_t dsap;
|
||||
u_int8_t ssap;
|
||||
union {
|
||||
u_char u_ctl;
|
||||
u_short is_ctl;
|
||||
u_int8_t u_ctl;
|
||||
u_int16_t is_ctl;
|
||||
struct {
|
||||
u_char snap_ui;
|
||||
u_char snap_pi[5];
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_pi[5];
|
||||
} snap;
|
||||
struct {
|
||||
u_char snap_ui;
|
||||
u_char snap_orgcode[3];
|
||||
u_char snap_ethertype[2];
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_orgcode[3];
|
||||
u_int8_t snap_ethertype[2];
|
||||
} snap_ether;
|
||||
} ctl;
|
||||
};
|
||||
@ -61,7 +61,7 @@ struct llc {
|
||||
#define LLC_S_FMT 1
|
||||
|
||||
#define LLC_U_POLL 0x10
|
||||
#define LLC_IS_POLL 0x0001
|
||||
#define LLC_IS_POLL 0x0100
|
||||
#define LLC_XID_FI 0x81
|
||||
|
||||
#define LLC_U_CMD(u) ((u) & 0xef)
|
||||
@ -74,13 +74,13 @@ struct llc {
|
||||
#define LLC_XID 0xaf
|
||||
#define LLC_FRMR 0x87
|
||||
|
||||
#define LLC_S_CMD(is) (((is) >> 10) & 0x03)
|
||||
#define LLC_RR 0x0100
|
||||
#define LLC_RNR 0x0500
|
||||
#define LLC_REJ 0x0900
|
||||
#define LLC_S_CMD(is) (((is) >> 1) & 0x03)
|
||||
#define LLC_RR 0x0001
|
||||
#define LLC_RNR 0x0005
|
||||
#define LLC_REJ 0x0009
|
||||
|
||||
#define LLC_IS_NR(is) (((is) >> 1) & 0x7f)
|
||||
#define LLC_I_NS(is) (((is) >> 9) & 0x7f)
|
||||
#define LLC_IS_NR(is) (((is) >> 9) & 0x7f)
|
||||
#define LLC_I_NS(is) (((is) >> 1) & 0x7f)
|
||||
|
||||
#ifndef LLCSAP_NULL
|
||||
#define LLCSAP_NULL 0x00
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.5 1999/11/21 09:36:47 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/machdep.c,v 1.6 2000/01/17 06:24:23 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -37,13 +37,13 @@ static const char rcsid[] =
|
||||
#include "machdep.h"
|
||||
|
||||
int
|
||||
abort_on_misalignment(char *ebuf)
|
||||
abort_on_misalignment(char *ebuf, size_t ebufsiz)
|
||||
{
|
||||
#ifdef __osf__
|
||||
static int buf[2] = { SSIN_UACPROC, UAC_SIGBUS };
|
||||
|
||||
if (setsysinfo(SSI_NVPAIRS, (caddr_t)buf, 1, 0, 0) < 0) {
|
||||
(void)sprintf(ebuf, "setsysinfo: errno %d", errno);
|
||||
(void)snprintf(ebuf, ebufsiz, "setsysinfo: errno %d", errno);
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
|
@ -18,10 +18,10 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/machdep.h,v 1.1.1.1 1999/10/07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/machdep.h,v 1.2 2000/01/17 06:24:24 itojun Exp $ (LBL)
|
||||
*/
|
||||
#ifndef tcpdump_machdep_h
|
||||
#define tcpdump_machdep_h
|
||||
|
||||
int abort_on_misalignment(char *);
|
||||
int abort_on_misalignment(char *, size_t);
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: addrinfo.h,v 1.2 1999/11/21 01:35:41 assar Exp $ */
|
||||
/* $Id: addrinfo.h,v 1.3 2000/10/24 00:56:52 fenner Exp $ */
|
||||
|
||||
#ifndef HAVE_ADDRINFO
|
||||
|
||||
@ -79,17 +79,17 @@ struct addrinfo {
|
||||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
};
|
||||
|
||||
extern void freeaddrinfo __P((struct addrinfo *));
|
||||
extern void freehostent __P((struct hostent *));
|
||||
extern char *gai_strerror __P((int));
|
||||
extern int getaddrinfo __P((const char *, const char *,
|
||||
const struct addrinfo *, struct addrinfo **));
|
||||
extern int getnameinfo __P((const struct sockaddr *, size_t, char *,
|
||||
size_t, char *, size_t, int));
|
||||
extern struct hostent *getipnodebyaddr __P((const void *, size_t, int, int *));
|
||||
extern struct hostent *getipnodebyname __P((const char *, int, int, int *));
|
||||
extern int inet_pton __P((int, const char *, void *));
|
||||
extern const char *inet_ntop __P((int, const void *, char *, size_t));
|
||||
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 *);
|
||||
extern struct hostent *getipnodebyname (const char *, int, int, int *);
|
||||
extern int inet_pton (int, const char *, void *);
|
||||
extern const char *inet_ntop (int, const void *, char *, size_t);
|
||||
#endif /* HAVE_ADDRINFO */
|
||||
|
||||
/*
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.6.2.2 2000/01/25 18:39:03 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getaddrinfo.c,v 1.10 2000/10/24 00:56:53 fenner Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -74,10 +74,6 @@ static const char rcsid[] =
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef HAVE_PORTABLE_PROTOTYPE
|
||||
#include "cdecl_ext.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_U_INT32_T
|
||||
#include "bittypes.h"
|
||||
#endif
|
||||
@ -175,24 +171,24 @@ static const struct explore explore[] = {
|
||||
#endif
|
||||
|
||||
|
||||
static int str_isnumber __P((const char *));
|
||||
static int explore_fqdn __P((const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **));
|
||||
static int explore_null __P((const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **));
|
||||
static int explore_numeric __P((const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **));
|
||||
static int explore_numeric_scope __P((const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **));
|
||||
static int get_name __P((const char *, const struct afd *, struct addrinfo **,
|
||||
char *, const struct addrinfo *, const char *));
|
||||
static int get_canonname __P((const struct addrinfo *,
|
||||
struct addrinfo *, const char *));
|
||||
static struct addrinfo *get_ai __P((const struct addrinfo *,
|
||||
const struct afd *, const char *));
|
||||
static int get_portmatch __P((const struct addrinfo *, const char *));
|
||||
static int get_port __P((struct addrinfo *, const char *, int));
|
||||
static const struct afd *find_afd __P((int));
|
||||
static int str_isnumber (const char *);
|
||||
static int explore_fqdn (const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **);
|
||||
static int explore_null (const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **);
|
||||
static int explore_numeric (const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **);
|
||||
static int explore_numeric_scope (const struct addrinfo *, const char *,
|
||||
const char *, struct addrinfo **);
|
||||
static int get_name (const char *, const struct afd *, struct addrinfo **,
|
||||
char *, const struct addrinfo *, const char *);
|
||||
static int get_canonname (const struct addrinfo *,
|
||||
struct addrinfo *, const char *);
|
||||
static struct addrinfo *get_ai (const struct addrinfo *,
|
||||
const struct afd *, const char *);
|
||||
static int get_portmatch (const struct addrinfo *, const char *);
|
||||
static int get_port (struct addrinfo *, const char *, int);
|
||||
static const struct afd *find_afd (int);
|
||||
|
||||
static char *ai_errlist[] = {
|
||||
"Success",
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getnameinfo.c,v 1.3.2.2 2000/01/25 18:39:03 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/getnameinfo.c,v 1.8 2000/10/24 00:56:53 fenner Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -58,10 +58,6 @@ static const char rcsid[] =
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef HAVE_PORTABLE_PROTOTYPE
|
||||
#include "cdecl_ext.h"
|
||||
#endif
|
||||
|
||||
#ifdef NEED_ADDRINFO_H
|
||||
#include "addrinfo.h"
|
||||
#endif
|
||||
@ -159,12 +155,12 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
(flags & NI_DGRAM) ? "udp" : "tcp");
|
||||
}
|
||||
if (sp) {
|
||||
if (strlen(sp->s_name) > servlen)
|
||||
if (strlen(sp->s_name) + 1 > servlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(serv, sp->s_name);
|
||||
} else {
|
||||
sprintf(numserv, "%d", ntohs(port));
|
||||
if (strlen(numserv) > servlen)
|
||||
snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
|
||||
if (strlen(numserv) + 1 > servlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(serv, numserv);
|
||||
}
|
||||
@ -220,7 +216,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
|
||||
== NULL)
|
||||
return ENI_SYSTEM;
|
||||
if (strlen(numaddr) > hostlen)
|
||||
if (strlen(numaddr) + 1 > hostlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(host, numaddr);
|
||||
#if defined(INET6) && defined(NI_WITHSCOPEID)
|
||||
@ -260,7 +256,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
p = strchr(hp->h_name, '.');
|
||||
if (p) *p = '\0';
|
||||
}
|
||||
if (strlen(hp->h_name) > hostlen) {
|
||||
if (strlen(hp->h_name) + 1 > hostlen) {
|
||||
#ifdef USE_GETIPNODEBY
|
||||
freehostent(hp);
|
||||
#endif
|
||||
@ -276,7 +272,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
|
||||
if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
|
||||
== NULL)
|
||||
return ENI_NOHOSTNAME;
|
||||
if (strlen(numaddr) > hostlen)
|
||||
if (strlen(numaddr) + 1 > hostlen)
|
||||
return ENI_MEMORY;
|
||||
strcpy(host, numaddr);
|
||||
}
|
||||
|
@ -36,11 +36,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: inet_aton.c,v 1.1.2.1 2000/01/11 06:58:29 fenner Exp $ */
|
||||
/* $Id: inet_aton.c,v 1.2 2000/01/09 21:35:45 fenner Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.1.2.1 2000/01/11 06:58:29 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_aton.c,v 1.2 2000/01/09 21:35:45 fenner Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -36,11 +36,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: inet_ntop.c,v 1.2.2.1 2000/01/11 06:58:30 fenner Exp $ */
|
||||
/* $Id: inet_ntop.c,v 1.3 2000/01/09 21:35:45 fenner Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_ntop.c,v 1.2.2.1 2000/01/11 06:58:30 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_ntop.c,v 1.3 2000/01/09 21:35:45 fenner Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -36,11 +36,11 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: inet_pton.c,v 1.1.2.1 2000/01/11 06:58:30 fenner Exp $ */
|
||||
/* $Id: inet_pton.c,v 1.2 2000/01/09 21:35:46 fenner Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_pton.c,v 1.1.2.1 2000/01/11 06:58:30 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/inet_pton.c,v 1.2 2000/01/09 21:35:46 fenner Exp $";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
628
contrib/tcpdump/missing/snprintf.c
Normal file
628
contrib/tcpdump/missing/snprintf.c
Normal file
@ -0,0 +1,628 @@
|
||||
/*
|
||||
* Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE 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.
|
||||
*/
|
||||
|
||||
/* $Id: snprintf.c,v 1.4 2001/01/02 22:33:04 guy Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/snprintf.c,v 1.4 2001/01/02 22:33:04 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <interface.h>
|
||||
|
||||
enum format_flags {
|
||||
minus_flag = 1,
|
||||
plus_flag = 2,
|
||||
space_flag = 4,
|
||||
alternate_flag = 8,
|
||||
zero_flag = 16
|
||||
};
|
||||
|
||||
/*
|
||||
* Common state
|
||||
*/
|
||||
|
||||
struct state {
|
||||
unsigned char *str;
|
||||
unsigned char *s;
|
||||
unsigned char *theend;
|
||||
size_t sz;
|
||||
size_t max_sz;
|
||||
int (*append_char)(struct state *, unsigned char);
|
||||
int (*reserve)(struct state *, size_t);
|
||||
/* XXX - methods */
|
||||
};
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
static int
|
||||
sn_reserve (struct state *state, size_t n)
|
||||
{
|
||||
return state->s + n > state->theend;
|
||||
}
|
||||
|
||||
static int
|
||||
sn_append_char (struct state *state, unsigned char c)
|
||||
{
|
||||
if (sn_reserve (state, 1)) {
|
||||
return 1;
|
||||
} else {
|
||||
*state->s++ = c;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
as_reserve (struct state *state, size_t n)
|
||||
{
|
||||
if (state->s + n > state->theend) {
|
||||
int off = state->s - state->str;
|
||||
unsigned char *tmp;
|
||||
|
||||
if (state->max_sz && state->sz >= state->max_sz)
|
||||
return 1;
|
||||
|
||||
state->sz = max(state->sz * 2, state->sz + n);
|
||||
if (state->max_sz)
|
||||
state->sz = min(state->sz, state->max_sz);
|
||||
tmp = realloc (state->str, state->sz);
|
||||
if (tmp == NULL)
|
||||
return 1;
|
||||
state->str = tmp;
|
||||
state->s = state->str + off;
|
||||
state->theend = state->str + state->sz - 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
as_append_char (struct state *state, unsigned char c)
|
||||
{
|
||||
if(as_reserve (state, 1))
|
||||
return 1;
|
||||
else {
|
||||
*state->s++ = c;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
append_number(struct state *state,
|
||||
unsigned long num, unsigned base, char *rep,
|
||||
int width, int prec, int flags, int minusp)
|
||||
{
|
||||
int len = 0;
|
||||
int i;
|
||||
|
||||
/* given precision, ignore zero flag */
|
||||
if(prec != -1)
|
||||
flags &= ~zero_flag;
|
||||
else
|
||||
prec = 1;
|
||||
/* zero value with zero precision -> "" */
|
||||
if(prec == 0 && num == 0)
|
||||
return 0;
|
||||
do{
|
||||
if((*state->append_char)(state, rep[num % base]))
|
||||
return 1;
|
||||
len++;
|
||||
num /= base;
|
||||
}while(num);
|
||||
prec -= len;
|
||||
/* pad with prec zeros */
|
||||
while(prec-- > 0){
|
||||
if((*state->append_char)(state, '0'))
|
||||
return 1;
|
||||
len++;
|
||||
}
|
||||
/* add length of alternate prefix (added later) to len */
|
||||
if(flags & alternate_flag && (base == 16 || base == 8))
|
||||
len += base / 8;
|
||||
/* pad with zeros */
|
||||
if(flags & zero_flag){
|
||||
width -= len;
|
||||
if(minusp || (flags & space_flag) || (flags & plus_flag))
|
||||
width--;
|
||||
while(width-- > 0){
|
||||
if((*state->append_char)(state, '0'))
|
||||
return 1;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
/* add alternate prefix */
|
||||
if(flags & alternate_flag && (base == 16 || base == 8)){
|
||||
if(base == 16)
|
||||
if((*state->append_char)(state, rep[10] + 23)) /* XXX */
|
||||
return 1;
|
||||
if((*state->append_char)(state, '0'))
|
||||
return 1;
|
||||
}
|
||||
/* add sign */
|
||||
if(minusp){
|
||||
if((*state->append_char)(state, '-'))
|
||||
return 1;
|
||||
len++;
|
||||
} else if(flags & plus_flag) {
|
||||
if((*state->append_char)(state, '+'))
|
||||
return 1;
|
||||
len++;
|
||||
} else if(flags & space_flag) {
|
||||
if((*state->append_char)(state, ' '))
|
||||
return 1;
|
||||
len++;
|
||||
}
|
||||
if(flags & minus_flag)
|
||||
/* swap before padding with spaces */
|
||||
for(i = 0; i < len / 2; i++){
|
||||
char c = state->s[-i-1];
|
||||
state->s[-i-1] = state->s[-len+i];
|
||||
state->s[-len+i] = c;
|
||||
}
|
||||
width -= len;
|
||||
while(width-- > 0){
|
||||
if((*state->append_char)(state, ' '))
|
||||
return 1;
|
||||
len++;
|
||||
}
|
||||
if(!(flags & minus_flag))
|
||||
/* swap after padding with spaces */
|
||||
for(i = 0; i < len / 2; i++){
|
||||
char c = state->s[-i-1];
|
||||
state->s[-i-1] = state->s[-len+i];
|
||||
state->s[-len+i] = c;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
append_string (struct state *state,
|
||||
unsigned char *arg,
|
||||
int width,
|
||||
int prec,
|
||||
int flags)
|
||||
{
|
||||
if(prec != -1)
|
||||
width -= prec;
|
||||
else
|
||||
width -= strlen((char *)arg);
|
||||
if(!(flags & minus_flag))
|
||||
while(width-- > 0)
|
||||
if((*state->append_char) (state, ' '))
|
||||
return 1;
|
||||
if (prec != -1) {
|
||||
while (*arg && prec--)
|
||||
if ((*state->append_char) (state, *arg++))
|
||||
return 1;
|
||||
} else {
|
||||
while (*arg)
|
||||
if ((*state->append_char) (state, *arg++))
|
||||
return 1;
|
||||
}
|
||||
if(flags & minus_flag)
|
||||
while(width-- > 0)
|
||||
if((*state->append_char) (state, ' '))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
append_char(struct state *state,
|
||||
unsigned char arg,
|
||||
int width,
|
||||
int flags)
|
||||
{
|
||||
while(!(flags & minus_flag) && --width > 0)
|
||||
if((*state->append_char) (state, ' '))
|
||||
return 1;
|
||||
|
||||
if((*state->append_char) (state, arg))
|
||||
return 1;
|
||||
while((flags & minus_flag) && --width > 0)
|
||||
if((*state->append_char) (state, ' '))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This can't be made into a function...
|
||||
*/
|
||||
|
||||
#define PARSE_INT_FORMAT(res, arg, unsig) \
|
||||
if (long_flag) \
|
||||
res = (unsig long)va_arg(arg, unsig long); \
|
||||
else if (short_flag) \
|
||||
res = (unsig short)va_arg(arg, unsig int); \
|
||||
else \
|
||||
res = (unsig int)va_arg(arg, unsig int)
|
||||
|
||||
/*
|
||||
* zyxprintf - return 0 or -1
|
||||
*/
|
||||
|
||||
static int
|
||||
xyzprintf (struct state *state, const char *char_format, va_list ap)
|
||||
{
|
||||
const unsigned char *format = (const unsigned char *)char_format;
|
||||
unsigned char c;
|
||||
|
||||
while((c = *format++)) {
|
||||
if (c == '%') {
|
||||
int flags = 0;
|
||||
int width = 0;
|
||||
int prec = -1;
|
||||
int long_flag = 0;
|
||||
int short_flag = 0;
|
||||
|
||||
/* flags */
|
||||
while((c = *format++)){
|
||||
if(c == '-')
|
||||
flags |= minus_flag;
|
||||
else if(c == '+')
|
||||
flags |= plus_flag;
|
||||
else if(c == ' ')
|
||||
flags |= space_flag;
|
||||
else if(c == '#')
|
||||
flags |= alternate_flag;
|
||||
else if(c == '0')
|
||||
flags |= zero_flag;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if((flags & space_flag) && (flags & plus_flag))
|
||||
flags ^= space_flag;
|
||||
|
||||
if((flags & minus_flag) && (flags & zero_flag))
|
||||
flags ^= zero_flag;
|
||||
|
||||
/* width */
|
||||
if (isdigit(c))
|
||||
do {
|
||||
width = width * 10 + c - '0';
|
||||
c = *format++;
|
||||
} while(isdigit(c));
|
||||
else if(c == '*') {
|
||||
width = va_arg(ap, int);
|
||||
c = *format++;
|
||||
}
|
||||
|
||||
/* precision */
|
||||
if (c == '.') {
|
||||
prec = 0;
|
||||
c = *format++;
|
||||
if (isdigit(c))
|
||||
do {
|
||||
prec = prec * 10 + c - '0';
|
||||
c = *format++;
|
||||
} while(isdigit(c));
|
||||
else if (c == '*') {
|
||||
prec = va_arg(ap, int);
|
||||
c = *format++;
|
||||
}
|
||||
}
|
||||
|
||||
/* size */
|
||||
|
||||
if (c == 'h') {
|
||||
short_flag = 1;
|
||||
c = *format++;
|
||||
} else if (c == 'l') {
|
||||
long_flag = 1;
|
||||
c = *format++;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case 'c' :
|
||||
if(append_char(state, va_arg(ap, int), width, flags))
|
||||
return -1;
|
||||
break;
|
||||
case 's' :
|
||||
if (append_string(state,
|
||||
va_arg(ap, unsigned char*),
|
||||
width,
|
||||
prec,
|
||||
flags))
|
||||
return -1;
|
||||
break;
|
||||
case 'd' :
|
||||
case 'i' : {
|
||||
long arg;
|
||||
unsigned long num;
|
||||
int minusp = 0;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, signed);
|
||||
|
||||
if (arg < 0) {
|
||||
minusp = 1;
|
||||
num = -arg;
|
||||
} else
|
||||
num = arg;
|
||||
|
||||
if (append_number (state, num, 10, "0123456789",
|
||||
width, prec, flags, minusp))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
case 'u' : {
|
||||
unsigned long arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
if (append_number (state, arg, 10, "0123456789",
|
||||
width, prec, flags, 0))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
case 'o' : {
|
||||
unsigned long arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
if (append_number (state, arg, 010, "01234567",
|
||||
width, prec, flags, 0))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
case 'x' : {
|
||||
unsigned long arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
if (append_number (state, arg, 0x10, "0123456789abcdef",
|
||||
width, prec, flags, 0))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
case 'X' :{
|
||||
unsigned long arg;
|
||||
|
||||
PARSE_INT_FORMAT(arg, ap, unsigned);
|
||||
|
||||
if (append_number (state, arg, 0x10, "0123456789ABCDEF",
|
||||
width, prec, flags, 0))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
case 'p' : {
|
||||
unsigned long arg = (unsigned long)va_arg(ap, void*);
|
||||
|
||||
if (append_number (state, arg, 0x10, "0123456789ABCDEF",
|
||||
width, prec, flags, 0))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
case 'n' : {
|
||||
int *arg = va_arg(ap, int*);
|
||||
*arg = state->s - state->str;
|
||||
break;
|
||||
}
|
||||
case '\0' :
|
||||
--format;
|
||||
/* FALLTHROUGH */
|
||||
case '%' :
|
||||
if ((*state->append_char)(state, c))
|
||||
return -1;
|
||||
break;
|
||||
default :
|
||||
if ( (*state->append_char)(state, '%')
|
||||
|| (*state->append_char)(state, c))
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
if ((*state->append_char) (state, c))
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
int
|
||||
snprintf (char *str, size_t sz, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vsnprintf (str, sz, format, args);
|
||||
|
||||
#ifdef PARANOIA
|
||||
{
|
||||
int ret2;
|
||||
char *tmp;
|
||||
|
||||
tmp = malloc (sz);
|
||||
if (tmp == NULL)
|
||||
abort ();
|
||||
|
||||
ret2 = vsprintf (tmp, format, args);
|
||||
if (ret != ret2 || strcmp(str, tmp))
|
||||
abort ();
|
||||
free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int
|
||||
asprintf (char **ret, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int val;
|
||||
|
||||
va_start(args, format);
|
||||
val = vasprintf (ret, format, args);
|
||||
|
||||
#ifdef PARANOIA
|
||||
{
|
||||
int ret2;
|
||||
char *tmp;
|
||||
tmp = malloc (val + 1);
|
||||
if (tmp == NULL)
|
||||
abort ();
|
||||
|
||||
ret2 = vsprintf (tmp, format, args);
|
||||
if (val != ret2 || strcmp(*ret, tmp))
|
||||
abort ();
|
||||
free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASNPRINTF
|
||||
int
|
||||
asnprintf (char **ret, size_t max_sz, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int val;
|
||||
|
||||
va_start(args, format);
|
||||
val = vasnprintf (ret, max_sz, format, args);
|
||||
|
||||
#ifdef PARANOIA
|
||||
{
|
||||
int ret2;
|
||||
char *tmp;
|
||||
tmp = malloc (val + 1);
|
||||
if (tmp == NULL)
|
||||
abort ();
|
||||
|
||||
ret2 = vsprintf (tmp, format, args);
|
||||
if (val != ret2 || strcmp(*ret, tmp))
|
||||
abort ();
|
||||
free (tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int
|
||||
vasprintf (char **ret, const char *format, va_list args)
|
||||
{
|
||||
return vasnprintf (ret, 0, format, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_VASNPRINTF
|
||||
int
|
||||
vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
|
||||
{
|
||||
int st;
|
||||
size_t len;
|
||||
struct state state;
|
||||
|
||||
state.max_sz = max_sz;
|
||||
state.sz = 1;
|
||||
state.str = malloc(state.sz);
|
||||
if (state.str == NULL) {
|
||||
*ret = NULL;
|
||||
return -1;
|
||||
}
|
||||
state.s = state.str;
|
||||
state.theend = state.s + state.sz - 1;
|
||||
state.append_char = as_append_char;
|
||||
state.reserve = as_reserve;
|
||||
|
||||
st = xyzprintf (&state, format, args);
|
||||
if (st) {
|
||||
free (state.str);
|
||||
*ret = NULL;
|
||||
return -1;
|
||||
} else {
|
||||
char *tmp;
|
||||
|
||||
*state.s = '\0';
|
||||
len = state.s - state.str;
|
||||
tmp = realloc (state.str, len+1);
|
||||
if (tmp == NULL) {
|
||||
free (state.str);
|
||||
*ret = NULL;
|
||||
return -1;
|
||||
}
|
||||
*ret = tmp;
|
||||
return len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int
|
||||
vsnprintf (char *str, size_t sz, const char *format, va_list args)
|
||||
{
|
||||
struct state state;
|
||||
int ret;
|
||||
unsigned char *ustr = (unsigned char *)str;
|
||||
|
||||
state.max_sz = 0;
|
||||
state.sz = sz;
|
||||
state.str = ustr;
|
||||
state.s = ustr;
|
||||
state.theend = ustr + sz - 1;
|
||||
state.append_char = sn_append_char;
|
||||
state.reserve = sn_reserve;
|
||||
|
||||
ret = xyzprintf (&state, format, args);
|
||||
*state.s = '\0';
|
||||
if (ret)
|
||||
return sz;
|
||||
else
|
||||
return state.s - state.str;
|
||||
}
|
||||
#endif
|
||||
|
78
contrib/tcpdump/missing/strlcat.c
Normal file
78
contrib/tcpdump/missing/strlcat.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* $NetBSD: strlcat.c,v 1.5 1999/09/20 04:39:47 lukem Exp $ */
|
||||
/* from OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strlcat.c,v 1.1 2000/01/19 05:34:19 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcat(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (*d != '\0' && n-- != 0)
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = siz - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return(dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return(dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
75
contrib/tcpdump/missing/strlcpy.c
Normal file
75
contrib/tcpdump/missing/strlcpy.c
Normal file
@ -0,0 +1,75 @@
|
||||
/* $NetBSD: strlcpy.c,v 1.5 1999/09/20 04:39:47 lukem Exp $ */
|
||||
/* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/missing/strlcpy.c,v 1.1 2000/01/19 05:34:19 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless siz == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
strlcpy(dst, src, siz)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t siz;
|
||||
{
|
||||
register char *d = dst;
|
||||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if (siz != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++)
|
||||
;
|
||||
}
|
||||
|
||||
return(s - src - 1); /* count does not include NUL */
|
||||
}
|
254
contrib/tcpdump/nameser.h
Normal file
254
contrib/tcpdump/nameser.h
Normal file
@ -0,0 +1,254 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/nameser.h,v 1.5 2000/12/28 20:30:41 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 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.
|
||||
*
|
||||
* @(#)nameser.h 8.2 (Berkeley) 2/16/94
|
||||
* -
|
||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies, and that
|
||||
* the name of Digital Equipment Corporation not be used in advertising or
|
||||
* publicity pertaining to distribution of the document or software without
|
||||
* specific, written prior permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
||||
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
#ifndef _NAMESER_H_
|
||||
#define _NAMESER_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Define constants based on rfc883
|
||||
*/
|
||||
#define PACKETSZ 512 /* maximum packet size */
|
||||
#define MAXDNAME 256 /* maximum domain name */
|
||||
#define MAXCDNAME 255 /* maximum compressed domain name */
|
||||
#define MAXLABEL 63 /* maximum length of domain label */
|
||||
/* Number of bytes of fixed size data in query structure */
|
||||
#define QFIXEDSZ 4
|
||||
/* number of bytes of fixed size data in resource record */
|
||||
#define RRFIXEDSZ 10
|
||||
|
||||
/*
|
||||
* Internet nameserver port number
|
||||
*/
|
||||
#define NAMESERVER_PORT 53
|
||||
|
||||
/*
|
||||
* Currently defined opcodes
|
||||
*/
|
||||
#define QUERY 0x0 /* standard query */
|
||||
#define IQUERY 0x1 /* inverse query */
|
||||
#define STATUS 0x2 /* nameserver status query */
|
||||
#if 0
|
||||
#define xxx 0x3 /* 0x3 reserved */
|
||||
#endif
|
||||
/* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */
|
||||
#define UPDATEA 0x9 /* add resource record */
|
||||
#define UPDATED 0xa /* delete a specific resource record */
|
||||
#define UPDATEDA 0xb /* delete all named resource record */
|
||||
#define UPDATEM 0xc /* modify a specific resource record */
|
||||
#define UPDATEMA 0xd /* modify all named resource record */
|
||||
|
||||
#define ZONEINIT 0xe /* initial zone transfer */
|
||||
#define ZONEREF 0xf /* incremental zone referesh */
|
||||
|
||||
/*
|
||||
* Currently defined response codes
|
||||
*/
|
||||
#define NOERROR 0 /* no error */
|
||||
#define FORMERR 1 /* format error */
|
||||
#define SERVFAIL 2 /* server failure */
|
||||
#define NXDOMAIN 3 /* non existent domain */
|
||||
#define NOTIMP 4 /* not implemented */
|
||||
#define REFUSED 5 /* query refused */
|
||||
/* non standard */
|
||||
#define NOCHANGE 0xf /* update failed to change db */
|
||||
|
||||
/*
|
||||
* Type values for resources and queries
|
||||
*/
|
||||
#define T_A 1 /* host address */
|
||||
#define T_NS 2 /* authoritative server */
|
||||
#define T_MD 3 /* mail destination */
|
||||
#define T_MF 4 /* mail forwarder */
|
||||
#define T_CNAME 5 /* connonical name */
|
||||
#define T_SOA 6 /* start of authority zone */
|
||||
#define T_MB 7 /* mailbox domain name */
|
||||
#define T_MG 8 /* mail group member */
|
||||
#define T_MR 9 /* mail rename name */
|
||||
#define T_NULL 10 /* null resource record */
|
||||
#define T_WKS 11 /* well known service */
|
||||
#define T_PTR 12 /* domain name pointer */
|
||||
#define T_HINFO 13 /* host information */
|
||||
#define T_MINFO 14 /* mailbox information */
|
||||
#define T_MX 15 /* mail routing information */
|
||||
#define T_TXT 16 /* text strings */
|
||||
#define T_RP 17 /* responsible person */
|
||||
#define T_AFSDB 18 /* AFS cell database */
|
||||
#define T_NSAP 22 /* NSAP address */
|
||||
#define T_NSAP_PTR 23 /* reverse lookup for NSAP */
|
||||
/* non standard */
|
||||
#define T_UINFO 100 /* user (finger) information */
|
||||
#define T_UID 101 /* user ID */
|
||||
#define T_GID 102 /* group ID */
|
||||
#define T_UNSPEC 103 /* Unspecified format (binary data) */
|
||||
/* Query type values which do not appear in resource records */
|
||||
#define T_AXFR 252 /* transfer zone of authority */
|
||||
#define T_MAILB 253 /* transfer mailbox records */
|
||||
#define T_MAILA 254 /* transfer mail agent records */
|
||||
#define T_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Values for class field
|
||||
*/
|
||||
|
||||
#define C_IN 1 /* the arpa internet */
|
||||
#define C_CHAOS 3 /* for chaos net (MIT) */
|
||||
#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */
|
||||
/* Query class values which do not appear in resource records */
|
||||
#define C_ANY 255 /* wildcard match */
|
||||
|
||||
/*
|
||||
* Status return codes for T_UNSPEC conversion routines
|
||||
*/
|
||||
#define CONV_SUCCESS 0
|
||||
#define CONV_OVERFLOW -1
|
||||
#define CONV_BADFMT -2
|
||||
#define CONV_BADCKSUM -3
|
||||
#define CONV_BADBUFLEN -4
|
||||
|
||||
/*
|
||||
* Structure for query header.
|
||||
*/
|
||||
typedef struct {
|
||||
u_int16_t id; /* query identification number */
|
||||
u_int8_t flags1; /* first byte of flags */
|
||||
u_int8_t flags2; /* second byte of flags */
|
||||
u_int16_t qdcount; /* number of question entries */
|
||||
u_int16_t ancount; /* number of answer entries */
|
||||
u_int16_t nscount; /* number of authority entries */
|
||||
u_int16_t arcount; /* number of resource entries */
|
||||
} HEADER;
|
||||
|
||||
/*
|
||||
* Macros for subfields of flag fields.
|
||||
*/
|
||||
#define DNS_QR(np) ((np)->flags1 & 0x80) /* response flag */
|
||||
#define DNS_OPCODE(np) ((((np)->flags1) >> 3) & 0xF) /* purpose of message */
|
||||
#define DNS_AA(np) ((np)->flags1 & 0x04) /* authoritative answer */
|
||||
#define DNS_TC(np) ((np)->flags1 & 0x02) /* truncated message */
|
||||
#define DNS_RD(np) ((np)->flags1 & 0x01) /* recursion desired */
|
||||
|
||||
#define DNS_RA(np) ((np)->flags2 & 0x80) /* recursion available */
|
||||
#define DNS_AD(np) ((np)->flags2 & 0x20) /* authentic data from named */
|
||||
#define DNS_CD(np) ((np)->flags2 & 0x10) /* checking disabled by resolver */
|
||||
#define DNS_RCODE(np) ((np)->flags2 & 0xF) /* response code */
|
||||
|
||||
/*
|
||||
* Defines for handling compressed domain names, EDNS0 labels, etc.
|
||||
*/
|
||||
#define INDIR_MASK 0xc0 /* 11.... */
|
||||
#define EDNS0_MASK 0x40 /* 01.... */
|
||||
# define EDNS0_ELT_BITLABEL 0x01
|
||||
|
||||
/*
|
||||
* Structure for passing resource records around.
|
||||
*/
|
||||
struct rrec {
|
||||
int16_t r_zone; /* zone number */
|
||||
int16_t r_class; /* class number */
|
||||
int16_t r_type; /* type number */
|
||||
u_int32_t r_ttl; /* time to live */
|
||||
int r_size; /* size of data area */
|
||||
char *r_data; /* pointer to data */
|
||||
};
|
||||
|
||||
/*
|
||||
* Inline versions of get/put short/long. Pointer is advanced.
|
||||
* We also assume that a "u_int16_t" holds 2 "chars"
|
||||
* and that a "u_int32_t" holds 4 "chars".
|
||||
*
|
||||
* These macros demonstrate the property of C whereby it can be
|
||||
* portable or it can be elegant but never both.
|
||||
*/
|
||||
#define GETSHORT(s, cp) { \
|
||||
register u_char *t_cp = (u_char *)(cp); \
|
||||
(s) = ((u_int16_t)t_cp[0] << 8) | (u_int16_t)t_cp[1]; \
|
||||
(cp) += 2; \
|
||||
}
|
||||
|
||||
#define GETLONG(l, cp) { \
|
||||
register u_char *t_cp = (u_char *)(cp); \
|
||||
(l) = (((u_int32_t)t_cp[0]) << 24) \
|
||||
| (((u_int32_t)t_cp[1]) << 16) \
|
||||
| (((u_int32_t)t_cp[2]) << 8) \
|
||||
| (((u_int32_t)t_cp[3])); \
|
||||
(cp) += 4; \
|
||||
}
|
||||
|
||||
#define PUTSHORT(s, cp) { \
|
||||
register u_int16_t t_s = (u_int16_t)(s); \
|
||||
register u_char *t_cp = (u_char *)(cp); \
|
||||
*t_cp++ = t_s >> 8; \
|
||||
*t_cp = t_s; \
|
||||
(cp) += 2; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Warning: PUTLONG --no-longer-- destroys its first argument. if you
|
||||
* were depending on this "feature", you will lose.
|
||||
*/
|
||||
#define PUTLONG(l, cp) { \
|
||||
register u_int32_t t_l = (u_int32_t)(l); \
|
||||
register u_char *t_cp = (u_char *)(cp); \
|
||||
*t_cp++ = t_l >> 24; \
|
||||
*t_cp++ = t_l >> 16; \
|
||||
*t_cp++ = t_l >> 8; \
|
||||
*t_cp = t_l; \
|
||||
(cp) += 4; \
|
||||
}
|
||||
|
||||
#endif /* !_NAMESER_H_ */
|
@ -1,4 +1,4 @@
|
||||
/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.3.1.1 1999/10/07 23:47:11 mcr Exp $ */
|
||||
/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.4 2000/10/03 02:54:57 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Based on ntp.h from the U of MD implementation
|
||||
@ -33,8 +33,8 @@ struct l_fixedpt {
|
||||
};
|
||||
|
||||
struct s_fixedpt {
|
||||
u_short int_part;
|
||||
u_short fraction;
|
||||
u_int16_t int_part;
|
||||
u_int16_t fraction;
|
||||
};
|
||||
|
||||
/* ================= Table 3.3. Packet Variables ================= */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.3 2000/12/17 23:07:50 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -91,14 +92,14 @@
|
||||
|
||||
/* link state advertisement header */
|
||||
struct lsa_hdr {
|
||||
u_short ls_age;
|
||||
u_char ls_options;
|
||||
u_char ls_type;
|
||||
u_int16_t ls_age;
|
||||
u_int8_t ls_options;
|
||||
u_int8_t ls_type;
|
||||
struct in_addr ls_stateid;
|
||||
struct in_addr ls_router;
|
||||
u_int32_t ls_seq;
|
||||
u_short ls_chksum;
|
||||
u_short ls_length;
|
||||
u_int16_t ls_chksum;
|
||||
u_int16_t ls_length;
|
||||
} ;
|
||||
|
||||
/* link state advertisement */
|
||||
@ -109,15 +110,15 @@ struct lsa {
|
||||
union {
|
||||
/* Router links advertisements */
|
||||
struct {
|
||||
u_char rla_flags;
|
||||
u_char rla_zero[1];
|
||||
u_short rla_count;
|
||||
u_int8_t rla_flags;
|
||||
u_int8_t rla_zero[1];
|
||||
u_int16_t rla_count;
|
||||
struct rlalink {
|
||||
struct in_addr link_id;
|
||||
struct in_addr link_data;
|
||||
u_char link_type;
|
||||
u_char link_toscount;
|
||||
u_short link_tos0metric;
|
||||
u_int8_t link_type;
|
||||
u_int8_t link_toscount;
|
||||
u_int16_t link_tos0metric;
|
||||
} rla_link[1]; /* may repeat */
|
||||
} un_rla;
|
||||
|
||||
@ -156,9 +157,9 @@ struct lsa {
|
||||
* TOS metric struct (will be 0 or more in router links update)
|
||||
*/
|
||||
struct tos_metric {
|
||||
u_char tos_type;
|
||||
u_char tos_zero;
|
||||
u_short tos_metric;
|
||||
u_int8_t tos_type;
|
||||
u_int8_t tos_zero;
|
||||
u_int16_t tos_metric;
|
||||
} ;
|
||||
|
||||
#define OSPF_AUTH_SIZE 8
|
||||
@ -167,22 +168,22 @@ struct tos_metric {
|
||||
* the main header
|
||||
*/
|
||||
struct ospfhdr {
|
||||
u_char ospf_version;
|
||||
u_char ospf_type;
|
||||
u_short ospf_len;
|
||||
u_int8_t ospf_version;
|
||||
u_int8_t ospf_type;
|
||||
u_int16_t ospf_len;
|
||||
struct in_addr ospf_routerid;
|
||||
struct in_addr ospf_areaid;
|
||||
u_short ospf_chksum;
|
||||
u_short ospf_authtype;
|
||||
u_char ospf_authdata[OSPF_AUTH_SIZE];
|
||||
u_int16_t ospf_chksum;
|
||||
u_int16_t ospf_authtype;
|
||||
u_int8_t ospf_authdata[OSPF_AUTH_SIZE];
|
||||
union {
|
||||
|
||||
/* Hello packet */
|
||||
struct {
|
||||
struct in_addr hello_mask;
|
||||
u_short hello_helloint;
|
||||
u_char hello_options;
|
||||
u_char hello_priority;
|
||||
u_int16_t hello_helloint;
|
||||
u_int8_t hello_options;
|
||||
u_int8_t hello_priority;
|
||||
u_int32_t hello_deadint;
|
||||
struct in_addr hello_dr;
|
||||
struct in_addr hello_bdr;
|
||||
@ -191,9 +192,9 @@ struct ospfhdr {
|
||||
|
||||
/* Database Description packet */
|
||||
struct {
|
||||
u_char db_zero[2];
|
||||
u_char db_options;
|
||||
u_char db_flags;
|
||||
u_int8_t db_zero[2];
|
||||
u_int8_t db_options;
|
||||
u_int8_t db_flags;
|
||||
u_int32_t db_seq;
|
||||
struct lsa_hdr db_lshdr[1]; /* may repeat */
|
||||
} un_db;
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.3 2000/12/17 23:07:50 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -83,10 +84,10 @@
|
||||
#define SLA_MASK_METRIC 0x00ffffff
|
||||
#define SLA_SHIFT_TOS 24
|
||||
|
||||
/* asla_tosmetric breakdown */
|
||||
#define ASLA_FLAG_EXTERNAL 0x80000000
|
||||
#define ASLA_MASK_TOS 0x7f000000
|
||||
#define ASLA_SHIFT_TOS 24
|
||||
/* asla_metric */
|
||||
#define ASLA_FLAG_EXTERNAL 0x04000000
|
||||
#define ASLA_FLAG_FWDADDR 0x02000000
|
||||
#define ASLA_FLAG_ROUTETAG 0x01000000
|
||||
#define ASLA_MASK_METRIC 0x00ffffff
|
||||
|
||||
/* multicast vertex type */
|
||||
@ -149,6 +150,13 @@ struct lsa {
|
||||
struct lsa_prefix inter_ap_prefix[1];
|
||||
} un_inter_ap;
|
||||
|
||||
/* AS external links advertisements */
|
||||
struct {
|
||||
u_int32_t asla_metric;
|
||||
struct lsa_prefix asla_prefix[1];
|
||||
/* some optional fields follow */
|
||||
} un_asla;
|
||||
|
||||
#if 0
|
||||
/* Summary links advertisements */
|
||||
struct {
|
||||
@ -156,16 +164,6 @@ struct lsa {
|
||||
u_int32_t sla_tosmetric[1]; /* may repeat */
|
||||
} un_sla;
|
||||
|
||||
/* AS external links advertisements */
|
||||
struct {
|
||||
struct in_addr asla_mask;
|
||||
struct aslametric {
|
||||
u_int32_t asla_tosmetric;
|
||||
struct in_addr asla_forward;
|
||||
struct in_addr asla_tag;
|
||||
} asla_metric[1]; /* may repeat */
|
||||
} un_asla;
|
||||
|
||||
/* Multicast group membership */
|
||||
struct mcla {
|
||||
u_int32_t mcla_vtype;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.5 1999/12/15 08:10:17 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ah.c,v 1.14 2000/12/12 09:58:40 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,38 +35,11 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* there's no standard definition so we are on our own */
|
||||
struct ah {
|
||||
u_int8_t ah_nxt; /* Next Header */
|
||||
u_int8_t ah_len; /* Length of data, in 32bit */
|
||||
u_int16_t ah_reserve; /* Reserved for future use */
|
||||
u_int32_t ah_spi; /* Security parameter index */
|
||||
/* variable size, 32bit bound*/ /* Authentication data */
|
||||
};
|
||||
|
||||
struct newah {
|
||||
u_int8_t ah_nxt; /* Next Header */
|
||||
u_int8_t ah_len; /* Length of data + 1, in 32bit */
|
||||
u_int16_t ah_reserve; /* Reserved for future use */
|
||||
u_int32_t ah_spi; /* Security parameter index */
|
||||
u_int32_t ah_seq; /* Sequence number field */
|
||||
/* variable size, 32bit bound*/ /* Authentication data */
|
||||
};
|
||||
#include "ah.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
@ -80,7 +53,7 @@ ah_print(register const u_char *bp, register const u_char *bp2)
|
||||
u_int32_t spi;
|
||||
|
||||
ah = (struct ah *)bp;
|
||||
ep = snapend; /* 'ep' points to the end of avaible data. */
|
||||
ep = snapend; /* 'ep' points to the end of available data. */
|
||||
|
||||
if ((u_char *)(ah + 1) >= ep - sizeof(struct ah))
|
||||
goto trunc;
|
||||
@ -88,7 +61,7 @@ ah_print(register const u_char *bp, register const u_char *bp2)
|
||||
sumlen = ah->ah_len << 2;
|
||||
spi = (u_int32_t)ntohl(ah->ah_spi);
|
||||
|
||||
printf("AH(spi=%u", spi);
|
||||
printf("AH(spi=0x%08x", spi);
|
||||
if (vflag)
|
||||
printf(",sumlen=%d", sumlen);
|
||||
printf(",seq=0x%x", (u_int32_t)ntohl(*(u_int32_t *)(ah + 1)));
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.2.2.2 2000/01/11 06:58:23 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.6 2000/01/29 16:47:46 itojun Exp $";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
@ -72,7 +72,8 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
|
||||
while (--nshorts >= 0) {
|
||||
s1 = *cp++;
|
||||
s2 = *cp++;
|
||||
(void)sprintf(hsp, " %02x%02x", s1, s2);
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x%02x", s1, s2);
|
||||
hsp += HEXDUMP_HEXSTUFF_PER_SHORT;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
*(asp++) = (isgraph(s2) ? s2 : '.');
|
||||
@ -87,7 +88,8 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
|
||||
}
|
||||
if (length & 1) {
|
||||
s1 = *cp++;
|
||||
(void)sprintf(hsp, " %02x", s1);
|
||||
(void)snprintf(hsp, sizeof(hexstuff) - (hsp - hexstuff),
|
||||
" %02x", s1);
|
||||
hsp += 3;
|
||||
*(asp++) = (isgraph(s1) ? s1 : '.');
|
||||
++i;
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.9.2.2 2000/01/25 18:32:53 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.21 2000/12/05 05:48:35 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -42,18 +42,15 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
struct bgp {
|
||||
u_int8_t bgp_marker[16];
|
||||
@ -240,7 +237,7 @@ num_or_str(const char **table, size_t siz, int value)
|
||||
{
|
||||
static char buf[20];
|
||||
if (value < 0 || siz <= value || table[value] == NULL) {
|
||||
sprintf(buf, "#%d", value);
|
||||
snprintf(buf, sizeof(buf), "#%d", value);
|
||||
return buf;
|
||||
} else
|
||||
return table[value];
|
||||
@ -266,7 +263,7 @@ bgp_notify_minor(int major, int minor)
|
||||
} else
|
||||
p = NULL;
|
||||
if (p == NULL) {
|
||||
sprintf(buf, "#%d", minor);
|
||||
snprintf(buf, sizeof(buf), "#%d", minor);
|
||||
return buf;
|
||||
} else
|
||||
return p;
|
||||
@ -288,7 +285,7 @@ decode_prefix4(const u_char *pd, char *buf, int buflen)
|
||||
((u_char *)&addr)[(plen + 7) / 8 - 1] &=
|
||||
((0xff00 >> (plen % 8)) & 0xff);
|
||||
}
|
||||
sprintf(buf, "%s/%d", getname((char *)&addr), plen);
|
||||
snprintf(buf, buflen, "%s/%d", getname((u_char *)&addr), plen);
|
||||
return 1 + (plen + 7) / 8;
|
||||
}
|
||||
|
||||
@ -309,7 +306,7 @@ decode_prefix6(const u_char *pd, char *buf, int buflen)
|
||||
addr.s6_addr[(plen + 7) / 8 - 1] &=
|
||||
((0xff00 >> (plen % 8)) & 0xff);
|
||||
}
|
||||
sprintf(buf, "%s/%d", getname6((char *)&addr), plen);
|
||||
snprintf(buf, buflen, "%s/%d", getname6((char *)&addr), plen);
|
||||
return 1 + (plen + 7) / 8;
|
||||
}
|
||||
#endif
|
||||
@ -323,7 +320,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
||||
int advance;
|
||||
int tlen;
|
||||
const u_char *p;
|
||||
char buf[256];
|
||||
char buf[MAXHOSTNAMELEN + 100];
|
||||
|
||||
p = dat;
|
||||
|
||||
@ -430,20 +427,24 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
||||
tlen = p[0];
|
||||
if (tlen) {
|
||||
printf(" nexthop");
|
||||
if (af == AFNUM_INET)
|
||||
advance = 4;
|
||||
#ifdef INET6
|
||||
else if (af == AFNUM_INET6)
|
||||
advance = 16;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < tlen; i += advance) {
|
||||
if (af == AFNUM_INET)
|
||||
i = 0;
|
||||
while (i < tlen) {
|
||||
switch (af) {
|
||||
case AFNUM_INET:
|
||||
printf(" %s", getname(p + 1 + i));
|
||||
i += sizeof(struct in_addr);
|
||||
break;
|
||||
#ifdef INET6
|
||||
else if (af == AFNUM_INET6)
|
||||
case AFNUM_INET6:
|
||||
printf(" %s", getname6(p + 1 + i));
|
||||
i += sizeof(struct in6_addr);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf(" (unknown af)");
|
||||
i = tlen; /*exit loop*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf(",");
|
||||
}
|
||||
@ -462,13 +463,23 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
||||
|
||||
printf(" NLRI");
|
||||
while (len - (p - dat) > 0) {
|
||||
if (af == AFNUM_INET)
|
||||
switch (af) {
|
||||
case AFNUM_INET:
|
||||
advance = decode_prefix4(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#ifdef INET6
|
||||
else if (af == AFNUM_INET6)
|
||||
case AFNUM_INET6:
|
||||
advance = decode_prefix6(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#endif
|
||||
printf(" %s", buf);
|
||||
default:
|
||||
printf(" (unknown af)");
|
||||
advance = 0;
|
||||
p = dat + len;
|
||||
break;
|
||||
}
|
||||
|
||||
p += advance;
|
||||
}
|
||||
@ -488,13 +499,23 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
|
||||
|
||||
printf(" Withdraw");
|
||||
while (len - (p - dat) > 0) {
|
||||
if (af == AFNUM_INET)
|
||||
switch (af) {
|
||||
case AFNUM_INET:
|
||||
advance = decode_prefix4(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#ifdef INET6
|
||||
else if (af == AFNUM_INET6)
|
||||
case AFNUM_INET6:
|
||||
advance = decode_prefix6(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
break;
|
||||
#endif
|
||||
printf(" %s", buf);
|
||||
default:
|
||||
printf(" (unknown af)");
|
||||
advance = 0;
|
||||
p = dat + len;
|
||||
break;
|
||||
}
|
||||
|
||||
p += advance;
|
||||
}
|
||||
@ -513,13 +534,14 @@ bgp_open_print(const u_char *dat, int length)
|
||||
const u_char *opt;
|
||||
int i;
|
||||
|
||||
TCHECK2(dat[0], sizeof(bgpo));
|
||||
memcpy(&bgpo, dat, sizeof(bgpo));
|
||||
hlen = ntohs(bgpo.bgpo_len);
|
||||
|
||||
printf(": Version %d,", bgpo.bgpo_version);
|
||||
printf(" AS #%u,", ntohs(bgpo.bgpo_myas));
|
||||
printf(" Holdtime %u,", ntohs(bgpo.bgpo_holdtime));
|
||||
printf(" ID %s,", getname((char *)&bgpo.bgpo_id));
|
||||
printf(" ID %s,", getname((u_char *)&bgpo.bgpo_id));
|
||||
printf(" Option length %u", bgpo.bgpo_optlen);
|
||||
|
||||
/* ugly! */
|
||||
@ -537,6 +559,9 @@ bgp_open_print(const u_char *dat, int length)
|
||||
bgpopt.bgpopt_len);
|
||||
i += sizeof(bgpopt) + bgpopt.bgpopt_len;
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
printf("[|BGP]");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -550,19 +575,40 @@ bgp_update_print(const u_char *dat, int length)
|
||||
int i;
|
||||
int newline;
|
||||
|
||||
TCHECK2(dat[0], sizeof(bgp));
|
||||
memcpy(&bgp, dat, sizeof(bgp));
|
||||
hlen = ntohs(bgp.bgp_len);
|
||||
p = dat + BGP_SIZE; /*XXX*/
|
||||
printf(":");
|
||||
|
||||
/* Unfeasible routes */
|
||||
len = ntohs(*(u_int16_t *)p);
|
||||
len = EXTRACT_16BITS(p);
|
||||
if (len) {
|
||||
/* Without keeping state from the original NLRI message,
|
||||
* it's not possible to tell if this a v4 or v6 route,
|
||||
* so only try to decode it if we're not v6 enabled.
|
||||
*/
|
||||
#ifdef INET6
|
||||
printf(" (Withdrawn routes: %d bytes)", len);
|
||||
#else
|
||||
char buf[MAXHOSTNAMELEN + 100];
|
||||
|
||||
TCHECK2(p[2], len);
|
||||
i = 2;
|
||||
|
||||
printf(" (Withdrawn routes:");
|
||||
|
||||
while(i < 2 + len) {
|
||||
i += decode_prefix4(&p[i], buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
}
|
||||
printf(")\n");
|
||||
#endif
|
||||
}
|
||||
p += 2 + len;
|
||||
|
||||
len = ntohs(*(u_int16_t *)p);
|
||||
TCHECK2(p[0], 2);
|
||||
len = EXTRACT_16BITS(p);
|
||||
if (len) {
|
||||
/* do something more useful!*/
|
||||
i = 2;
|
||||
@ -571,6 +617,7 @@ bgp_update_print(const u_char *dat, int length)
|
||||
while (i < 2 + len) {
|
||||
int alen, aoff;
|
||||
|
||||
TCHECK2(p[i], sizeof(bgpa));
|
||||
memcpy(&bgpa, &p[i], sizeof(bgpa));
|
||||
alen = bgp_attr_len(&bgpa);
|
||||
aoff = bgp_attr_off(&bgpa);
|
||||
@ -582,11 +629,14 @@ bgp_update_print(const u_char *dat, int length)
|
||||
printf("("); /* ) */
|
||||
printf("%s", bgp_attr_type(bgpa.bgpa_type));
|
||||
if (bgpa.bgpa_flags) {
|
||||
printf("[%s%s%s%s]",
|
||||
printf("[%s%s%s%s",
|
||||
bgpa.bgpa_flags & 0x80 ? "O" : "",
|
||||
bgpa.bgpa_flags & 0x40 ? "T" : "",
|
||||
bgpa.bgpa_flags & 0x20 ? "P" : "",
|
||||
bgpa.bgpa_flags & 0x00 ? "E" : "");
|
||||
bgpa.bgpa_flags & 0x10 ? "E" : "");
|
||||
if (bgpa.bgpa_flags & 0xf)
|
||||
printf("+%x", bgpa.bgpa_flags & 0xf);
|
||||
printf("]");
|
||||
}
|
||||
|
||||
bgp_attr_print(&bgpa, &p[i + aoff], alen);
|
||||
@ -608,7 +658,7 @@ bgp_update_print(const u_char *dat, int length)
|
||||
if (dat + length > p) {
|
||||
printf("(NLRI:"); /* ) */
|
||||
while (dat + length > p) {
|
||||
char buf[256];
|
||||
char buf[MAXHOSTNAMELEN + 100];
|
||||
i = decode_prefix4(p, buf, sizeof(buf));
|
||||
printf(" %s", buf);
|
||||
if (i < 0)
|
||||
@ -619,6 +669,9 @@ bgp_update_print(const u_char *dat, int length)
|
||||
/* ( */
|
||||
printf(")");
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
printf("[|BGP]");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -627,12 +680,16 @@ bgp_notification_print(const u_char *dat, int length)
|
||||
struct bgp_notification bgpn;
|
||||
int hlen;
|
||||
|
||||
TCHECK2(dat[0], sizeof(bgpn));
|
||||
memcpy(&bgpn, dat, sizeof(bgpn));
|
||||
hlen = ntohs(bgpn.bgpn_len);
|
||||
|
||||
printf(": error %s,", bgp_notify_major(bgpn.bgpn_major));
|
||||
printf(" subcode %s",
|
||||
bgp_notify_minor(bgpn.bgpn_major, bgpn.bgpn_minor));
|
||||
return;
|
||||
trunc:
|
||||
printf("[|BGP]");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -640,6 +697,7 @@ bgp_header_print(const u_char *dat, int length)
|
||||
{
|
||||
struct bgp bgp;
|
||||
|
||||
TCHECK2(dat[0], sizeof(bgp));
|
||||
memcpy(&bgp, dat, sizeof(bgp));
|
||||
printf("(%s", bgp_type(bgp.bgp_type)); /* ) */
|
||||
|
||||
@ -657,6 +715,9 @@ bgp_header_print(const u_char *dat, int length)
|
||||
|
||||
/* ( */
|
||||
printf(")");
|
||||
return;
|
||||
trunc:
|
||||
printf("[|BGP]");
|
||||
}
|
||||
|
||||
void
|
||||
@ -698,7 +759,7 @@ bgp_print(const u_char *dat, int length)
|
||||
}
|
||||
|
||||
/* found BGP header */
|
||||
TCHECK2(p[0], BGP_SIZE); /*XXX*/
|
||||
TCHECK2(p[0], sizeof(bgp)); /*XXX*/
|
||||
memcpy(&bgp, p, sizeof(bgp));
|
||||
|
||||
if (start != p)
|
||||
|
82
contrib/tcpdump/print-bxxp.c
Normal file
82
contrib/tcpdump/print-bxxp.c
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2000, Richard Sharpe
|
||||
*
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style licence that accompanies tcpdump or under the GNU GPL
|
||||
* version 2 or later.
|
||||
*
|
||||
* print-bxxp.c
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bxxp.c,v 1.3 2000/10/05 04:10:01 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
|
||||
/* Check for a string but not go beyond length
|
||||
* Return TRUE on match, FALSE otherwise
|
||||
*
|
||||
* Looks at the first few chars up to tl1 ...
|
||||
*/
|
||||
|
||||
int l_strnstart(const u_char *, u_int, const u_char *, u_int);
|
||||
|
||||
int
|
||||
l_strnstart(register const u_char *tstr1, register u_int tl1,
|
||||
register const u_char *str2, register u_int l2)
|
||||
{
|
||||
|
||||
if (tl1 > l2)
|
||||
return 0;
|
||||
|
||||
return (strncmp(tstr1, str2, tl1) == 0 ? 1 : 0);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
bxxp_print(register const u_char *bp, register u_int length)
|
||||
{
|
||||
|
||||
if (l_strnstart("REQ ", 4, bp, length)) { /* A REQuest */
|
||||
|
||||
printf(" BXXP REQ");
|
||||
|
||||
}
|
||||
else if (l_strnstart("RSP ", 4, bp, length)) {
|
||||
|
||||
printf(" BXXP RSP");
|
||||
|
||||
}
|
||||
else if (l_strnstart("SEQ ", 4, bp, length)) {
|
||||
|
||||
printf(" BXXP SEQ");
|
||||
|
||||
}
|
||||
else if (l_strnstart("END", 4, bp, length)) {
|
||||
|
||||
printf(" BXXP END");
|
||||
|
||||
}
|
||||
else
|
||||
printf(" BXXP (payload or undecoded)");
|
||||
|
||||
}
|
187
contrib/tcpdump/print-cdp.c
Normal file
187
contrib/tcpdump/print-cdp.c
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Code by Gert Doering, SpaceNet GmbH, gert@space.net
|
||||
*
|
||||
* Reference documentation:
|
||||
* http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cdp.c,v 1.4 2000/07/29 07:27:54 assar Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
static void cdp_print_addr( const u_char * p, int l );
|
||||
static void cdp_print_prefixes( const u_char * p, int l );
|
||||
|
||||
/*
|
||||
* Returns non-zero IFF it succeeds in printing the header
|
||||
*/
|
||||
void
|
||||
cdp_print(const u_char *p, u_int length, u_int caplen,
|
||||
const u_char *esrc, const u_char *edst)
|
||||
{
|
||||
int i;
|
||||
int type, len;
|
||||
|
||||
/* Cisco Discovery Protocol */
|
||||
|
||||
|
||||
if ( caplen < 12 ) {
|
||||
(void)printf("[|cdp]");
|
||||
return;
|
||||
}
|
||||
|
||||
i=8; /* CDP data starts at offset 8 */
|
||||
printf ("CDP v%d, ttl=%ds", p[i], p[i+1] );
|
||||
i+=4; /* skip version, TTL and chksum */
|
||||
|
||||
while (i < length) {
|
||||
if ( i+4 > caplen ) {
|
||||
printf("[!cdp]");
|
||||
return;
|
||||
}
|
||||
type = (p[i]<<8) + p[i+1];
|
||||
len = (p[i+2]<<8) + p[i+3];
|
||||
|
||||
if ( vflag )
|
||||
printf( "\n\t%02x/%02x", type, len );
|
||||
else
|
||||
printf( "\n\t" );
|
||||
|
||||
if ( i+len > caplen ) {
|
||||
printf("[!cdp]");
|
||||
return;
|
||||
}
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case 0x01:
|
||||
printf( " DevID '%.*s'", len-4, p+i+4 );
|
||||
break;
|
||||
case 0x02:
|
||||
printf( " Addr" );
|
||||
cdp_print_addr( p+i+4, len-4 );
|
||||
break;
|
||||
case 0x03:
|
||||
printf( " PortID '%.*s'", len-4, p+i+4 );
|
||||
break;
|
||||
case 0x04:
|
||||
printf( " CAP 0x%02x", (unsigned) p[i+7] );
|
||||
break;
|
||||
case 0x05:
|
||||
if ( vflag )
|
||||
printf( " Version:\n%.*s", len-4, p+i+4 );
|
||||
else
|
||||
printf( " Version: (suppressed)" );
|
||||
break;
|
||||
case 0x06:
|
||||
printf( " Platform: '%.*s'", len-4, p+i+4 );
|
||||
break;
|
||||
case 0x07:
|
||||
cdp_print_prefixes( p+i+4, len-4 );
|
||||
break;
|
||||
case 0x09: /* guess - not documented */
|
||||
printf( " VTP Management Domain: '%.*s'", len-4, p+i+4 );
|
||||
break;
|
||||
case 0x0a: /* guess - not documented */
|
||||
printf( " Native VLAN ID: %d", (p[i+4]<<8) + p[i+4+1] - 1 );
|
||||
break;
|
||||
case 0x0b: /* guess - not documented */
|
||||
printf( " Duplex: %s", p[i+4] ? "full": "half" );
|
||||
break;
|
||||
default:
|
||||
printf( " unknown field type %02x, len %d", type, len );
|
||||
}
|
||||
|
||||
/* avoid infinite loop */
|
||||
if (len == 0)
|
||||
break;
|
||||
i+=len;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cdp_print_addr( const u_char * p, int l )
|
||||
{
|
||||
int pl, al, num;
|
||||
const u_char * endp = p+l;
|
||||
|
||||
num = (p[0] << 24) + (p[1]<<16) + (p[2]<<8)+ p[3];
|
||||
p+=4;
|
||||
|
||||
printf(" (%d): ", num );
|
||||
|
||||
while( p < endp && num >= 0) {
|
||||
pl=*(p+1);
|
||||
p+=2;
|
||||
|
||||
/* special case: IPv4, protocol type=0xcc, addr. length=4 */
|
||||
if ( pl == 1 && *p == 0xcc &&
|
||||
p[1] == 0 && p[2] == 4 ) {
|
||||
p+=3;
|
||||
|
||||
printf( "IPv4 %d.%d.%d.%d ", p[0], p[1], p[2], p[3] );
|
||||
p+=4;
|
||||
} else { /* generic case: just print raw data */
|
||||
printf("pt=0x%02x, pl=%d, pb=", *(p-2), pl);
|
||||
while( pl-- > 0 )
|
||||
printf( " %02x", *p++);
|
||||
al=(*p << 8) + *(p+1);
|
||||
printf( ", al=%d, a=", al );
|
||||
p+=2;
|
||||
while( al-- > 0 )
|
||||
printf( " %02x", *p++);
|
||||
}
|
||||
printf(" ");
|
||||
num--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
cdp_print_prefixes( const u_char * p, int l )
|
||||
{
|
||||
printf( " IPv4 Prefixes (%d):", l/5 );
|
||||
|
||||
while(l > 0) {
|
||||
printf( " %d.%d.%d.%d/%d", p[0], p[1], p[2], p[3], p[4] );
|
||||
l-=5; p+=5;
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.2 1999/11/21 09:36:49 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.11 2000/10/09 01:53:19 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,40 +31,19 @@ static const char rcsid[] =
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
#ifdef __bsdi__
|
||||
#include <net/slcompress.h>
|
||||
#include <net/if_ppp.h>
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
#include "ppp.h"
|
||||
|
||||
/* XXX This goes somewhere else. */
|
||||
#define CHDLC_HDRLEN 4
|
||||
#define CHDLC_UNICAST 0x0f
|
||||
#define CHDLC_BCAST 0x8f
|
||||
#define CHDLC_TYPE_SLARP 0x8035
|
||||
#define CHDLC_TYPE_CDP 0x2000
|
||||
#include "chdlc.h"
|
||||
|
||||
static void chdlc_slarp_print(const u_char *, u_int);
|
||||
|
||||
@ -111,7 +90,7 @@ chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
|
||||
length -= CHDLC_HDRLEN;
|
||||
ip = (struct ip *)(p + CHDLC_HDRLEN);
|
||||
switch(proto) {
|
||||
switch (proto) {
|
||||
case ETHERTYPE_IP:
|
||||
ip_print((const u_char *)ip, length);
|
||||
break;
|
||||
@ -136,7 +115,7 @@ chdlc_if_print(u_char *user, const struct pcap_pkthdr *h,
|
||||
}
|
||||
|
||||
struct cisco_slarp {
|
||||
long code;
|
||||
u_int32_t code;
|
||||
#define SLARP_REQUEST 0
|
||||
#define SLARP_REPLY 1
|
||||
#define SLARP_KEEPALIVE 2
|
||||
@ -144,14 +123,14 @@ struct cisco_slarp {
|
||||
struct {
|
||||
struct in_addr addr;
|
||||
struct in_addr mask;
|
||||
u_short unused[3];
|
||||
u_int16_t unused[3];
|
||||
} addr;
|
||||
struct {
|
||||
long myseq;
|
||||
long yourseq;
|
||||
short rel;
|
||||
short t1;
|
||||
short t2;
|
||||
u_int32_t myseq;
|
||||
u_int32_t yourseq;
|
||||
u_int16_t rel;
|
||||
u_int16_t t1;
|
||||
u_int16_t t2;
|
||||
} keep;
|
||||
} un;
|
||||
};
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.2 1999/11/21 09:36:49 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cip.c,v 1.11 2000/12/22 22:45:10 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -34,59 +34,52 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
#include "ether.h"
|
||||
|
||||
const u_char *packetp;
|
||||
const u_char *snapend;
|
||||
|
||||
#define RFC1483LLC_LEN 8
|
||||
#define RFC1483LLC_LEN 8
|
||||
|
||||
static unsigned char rfcllc[] = {
|
||||
0xaa, /* DSAP: non-ISO */
|
||||
0xaa, /* SSAP: non-ISO */
|
||||
0x03, /* Ctrl: Unnumbered Information Command PDU */
|
||||
0x00, /* OUI: EtherType */
|
||||
0x00,
|
||||
0x00 };
|
||||
0xaa, /* DSAP: non-ISO */
|
||||
0xaa, /* SSAP: non-ISO */
|
||||
0x03, /* Ctrl: Unnumbered Information Command PDU */
|
||||
0x00, /* OUI: EtherType */
|
||||
0x00,
|
||||
0x00 };
|
||||
|
||||
static inline void
|
||||
cip_print(register const u_char *bp, int length)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (memcmp(rfcllc, bp, sizeof(rfcllc))) {
|
||||
if (qflag) {
|
||||
for(i=0;i<RFC1483LLC_LEN;i++)
|
||||
(void)printf("%2.2x ",bp[i]);
|
||||
} else {
|
||||
for(i=0;i<RFC1483LLC_LEN-2;i++)
|
||||
(void)printf("%2.2x ",bp[i]);
|
||||
etherproto_string(((u_short*)bp)[3]);
|
||||
}
|
||||
} else {
|
||||
if (qflag)
|
||||
(void)printf("(null encapsulation)");
|
||||
else {
|
||||
(void)printf("(null encap)");
|
||||
etherproto_string(ETHERTYPE_IP);
|
||||
}
|
||||
}
|
||||
if (memcmp(rfcllc, bp, sizeof(rfcllc))) {
|
||||
if (qflag) {
|
||||
for (i = 0;i < RFC1483LLC_LEN; i++)
|
||||
(void)printf("%2.2x ",bp[i]);
|
||||
} else {
|
||||
for (i = 0;i < RFC1483LLC_LEN - 2; i++)
|
||||
(void)printf("%2.2x ",bp[i]);
|
||||
etherproto_string(((u_short*)bp)[3]);
|
||||
}
|
||||
} else {
|
||||
if (qflag)
|
||||
(void)printf("(null encapsulation)");
|
||||
else {
|
||||
(void)printf("(null encap)");
|
||||
etherproto_string(ETHERTYPE_IP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -112,7 +105,7 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
cip_print(p, length);
|
||||
cip_print(p, length);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
@ -123,13 +116,15 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
snapend = p + caplen;
|
||||
|
||||
if (memcmp(rfcllc, p, sizeof(rfcllc))==0) {
|
||||
length -= RFC1483LLC_LEN;
|
||||
caplen -= RFC1483LLC_LEN;
|
||||
bp = (u_short*)p;
|
||||
p += RFC1483LLC_LEN;
|
||||
ether_type = ntohs(bp[3]);
|
||||
} else
|
||||
ether_type = ETHERTYPE_IP;
|
||||
length -= RFC1483LLC_LEN;
|
||||
caplen -= RFC1483LLC_LEN;
|
||||
bp = (u_short *)p;
|
||||
p += RFC1483LLC_LEN;
|
||||
ether_type = ntohs(bp[3]);
|
||||
} else {
|
||||
ether_type = ETHERTYPE_IP;
|
||||
bp = (u_short *)p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is it (gag) an 802.3 encapsulation?
|
||||
@ -137,10 +132,11 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
extracted_ethertype = 0;
|
||||
if (ether_type < ETHERMTU) {
|
||||
/* Try to print the LLC-layer header & higher layers */
|
||||
if (llc_print(p, length, caplen, NULL, NULL)==0) {
|
||||
if (llc_print(p, length, caplen, NULL, NULL,
|
||||
&extracted_ethertype)==0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
cip_print((u_char *)bp, length);
|
||||
cip_print((u_char *)bp, length + RFC1483LLC_LEN);
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
@ -148,7 +144,8 @@ cip_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
cip_print((u_char *)bp, length + RFC1483LLC_LEN);
|
||||
|
181
contrib/tcpdump/print-cnfp.c
Normal file
181
contrib/tcpdump/print-cnfp.c
Normal file
@ -0,0 +1,181 @@
|
||||
/* $OpenBSD: print-cnfp.c,v 1.2 1998/06/25 20:26:59 mickey Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Michael Shalayeff
|
||||
* 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 Michael Shalayeff.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Cisco NetFlow protocol */
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.6 2000/09/23 08:26:32 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
#include "tcp.h"
|
||||
|
||||
struct nfhdr {
|
||||
u_int32_t ver_cnt; /* version [15], and # of records */
|
||||
u_int32_t msys_uptime;
|
||||
u_int32_t utc_sec;
|
||||
u_int32_t utc_nsec;
|
||||
u_int32_t sequence; /* v5 flow sequence number */
|
||||
u_int32_t reserved; /* v5 only */
|
||||
};
|
||||
|
||||
struct nfrec {
|
||||
struct in_addr src_ina;
|
||||
struct in_addr dst_ina;
|
||||
struct in_addr nhop_ina;
|
||||
u_int32_t ifaces; /* src,dst ifaces */
|
||||
u_int32_t packets;
|
||||
u_int32_t octets;
|
||||
u_int32_t start_time; /* sys_uptime value */
|
||||
u_int32_t last_time; /* sys_uptime value */
|
||||
u_int32_t ports; /* src,dst ports */
|
||||
u_int32_t proto_tos; /* proto, tos, pad, flags(v5) */
|
||||
u_int32_t asses; /* v1: flags; v5: src,dst AS */
|
||||
u_int32_t masks; /* src,dst addr prefix */
|
||||
|
||||
};
|
||||
|
||||
void
|
||||
cnfp_print(const u_char *cp, u_int len, const u_char *bp)
|
||||
{
|
||||
register const struct nfhdr *nh;
|
||||
register const struct nfrec *nr;
|
||||
register const struct ip *ip;
|
||||
struct protoent *pent;
|
||||
int nrecs, ver;
|
||||
time_t t;
|
||||
|
||||
ip = (struct ip *)bp;
|
||||
nh = (struct nfhdr *)cp;
|
||||
|
||||
if ((u_char *)(nh + 1) > snapend)
|
||||
return;
|
||||
|
||||
nrecs = ntohl(nh->ver_cnt) & 0xffff;
|
||||
ver = (ntohl(nh->ver_cnt) & 0xffff0000) >> 16;
|
||||
t = ntohl(nh->utc_sec);
|
||||
/* (p = ctime(&t))[24] = '\0'; */
|
||||
|
||||
printf("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
|
||||
(unsigned)ntohl(nh->msys_uptime)/1000,
|
||||
(unsigned)ntohl(nh->msys_uptime)%1000,
|
||||
(unsigned)ntohl(nh->utc_sec), (unsigned)ntohl(nh->utc_nsec));
|
||||
|
||||
if (ver == 5) {
|
||||
printf("#%u, ", (unsigned)htonl(nh->sequence));
|
||||
nr = (struct nfrec *)&nh[1];
|
||||
snaplen -= 24;
|
||||
} else {
|
||||
nr = (struct nfrec *)&nh->sequence;
|
||||
snaplen -= 16;
|
||||
}
|
||||
|
||||
printf("%2u recs", nrecs);
|
||||
|
||||
for (; nrecs-- && (u_char *)(nr + 1) <= snapend; nr++) {
|
||||
char buf[20];
|
||||
char asbuf[20];
|
||||
|
||||
printf("\n started %u.%03u, last %u.%03u",
|
||||
(unsigned)ntohl(nr->start_time)/1000,
|
||||
(unsigned)ntohl(nr->start_time)%1000,
|
||||
(unsigned)ntohl(nr->last_time)/1000,
|
||||
(unsigned)ntohl(nr->last_time)%1000);
|
||||
|
||||
asbuf[0] = buf[0] = '\0';
|
||||
if (ver == 5) {
|
||||
snprintf(buf, sizeof(buf), "/%u",
|
||||
(unsigned)(ntohl(nr->masks) >> 24) & 0xff);
|
||||
snprintf(asbuf, sizeof(asbuf), "%u:",
|
||||
(unsigned)(ntohl(nr->asses) >> 16) & 0xffff);
|
||||
}
|
||||
printf("\n %s%s%s:%u ", inet_ntoa(nr->src_ina), buf, asbuf,
|
||||
(unsigned)ntohl(nr->ports) >> 16);
|
||||
|
||||
if (ver == 5) {
|
||||
snprintf(buf, sizeof(buf), "/%d",
|
||||
(unsigned)(ntohl(nr->masks) >> 16) & 0xff);
|
||||
snprintf(asbuf, sizeof(asbuf), "%u:",
|
||||
(unsigned)ntohl(nr->asses) & 0xffff);
|
||||
}
|
||||
printf("> %s%s%s:%u ", inet_ntoa(nr->dst_ina), buf, asbuf,
|
||||
(unsigned)ntohl(nr->ports) & 0xffff);
|
||||
|
||||
printf(">> %s\n ", inet_ntoa(nr->nhop_ina));
|
||||
|
||||
pent = getprotobynumber((ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
if (!pent || nflag)
|
||||
printf("%u ",
|
||||
(unsigned)(ntohl(nr->proto_tos) >> 8) & 0xff);
|
||||
else
|
||||
printf("%s ", pent->p_name);
|
||||
|
||||
/* tcp flags for tcp only */
|
||||
if (pent && pent->p_proto == IPPROTO_TCP) {
|
||||
int flags;
|
||||
if (ver == 1)
|
||||
flags = (ntohl(nr->asses) >> 24) & 0xff;
|
||||
else
|
||||
flags = (ntohl(nr->proto_tos) >> 16) & 0xff;
|
||||
if (flags & TH_FIN) putchar('F');
|
||||
if (flags & TH_SYN) putchar('S');
|
||||
if (flags & TH_RST) putchar('R');
|
||||
if (flags & TH_PUSH) putchar('P');
|
||||
if (flags & TH_ACK) putchar('A');
|
||||
if (flags & TH_URG) putchar('U');
|
||||
if (flags)
|
||||
putchar(' ');
|
||||
}
|
||||
printf("tos %u, %u (%u octets)",
|
||||
(unsigned)ntohl(nr->proto_tos) & 0xff,
|
||||
(unsigned)ntohl(nr->packets),
|
||||
(unsigned)ntohl(nr->octets));
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.27 1999/11/21 09:36:50 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.30 2000/09/28 06:42:57 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -32,20 +32,14 @@ static const char rcsid[] =
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#ifdef HAVE_LIBDNET
|
||||
#include <netdnet/dnetdb.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -740,13 +734,14 @@ char *
|
||||
dnnum_string(u_short dnaddr)
|
||||
{
|
||||
char *str;
|
||||
size_t siz;
|
||||
int area = (u_short)(dnaddr & AREAMASK) >> AREASHIFT;
|
||||
int node = dnaddr & NODEMASK;
|
||||
|
||||
str = (char *)malloc(sizeof("00.0000"));
|
||||
str = (char *)malloc(siz = sizeof("00.0000"));
|
||||
if (str == NULL)
|
||||
error("dnnum_string: malloc");
|
||||
sprintf(str, "%d.%d", area, node);
|
||||
snprintf(str, siz, "%d.%d", area, node);
|
||||
return(str);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.3 1999/12/22 06:27:20 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.12 2000/10/24 00:56:50 fenner Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -40,18 +40,12 @@ static const char rcsid[] =
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
@ -62,10 +56,10 @@ struct rtentry;
|
||||
#include "dhcp6opt.h"
|
||||
|
||||
#if 0
|
||||
static void dhcp6opttab_init __P((void));
|
||||
static struct dhcp6_opt *dhcp6opttab_byname __P((char *));
|
||||
static void dhcp6opttab_init (void);
|
||||
static struct dhcp6_opt *dhcp6opttab_byname (char *);
|
||||
#endif
|
||||
static struct dhcp6_opt *dhcp6opttab_bycode __P((u_int));
|
||||
static struct dhcp6_opt *dhcp6opttab_bycode (u_int);
|
||||
|
||||
static char tstr[] = " [|dhcp6]";
|
||||
|
||||
@ -74,36 +68,35 @@ static struct dhcp6_opt dh6opttab[] = {
|
||||
{ 1, OL6_N, "IP Address", OT6_NONE, },
|
||||
|
||||
/* General Extension */
|
||||
{ 2, 4, "Time Offset", OT6_NUM, },
|
||||
{ 3, OL6_N, "IEEE 1003.1 POSIX Timezone", OT6_STR, },
|
||||
{ 6, OL6_16N, "Domain Name Server", OT6_V6, },
|
||||
{ 10, OL6_N, "Domain Name", OT6_STR, },
|
||||
{ 8193, OL6_N, "IEEE 1003.1 POSIX Timezone", OT6_STR, },
|
||||
{ 8194, OL6_16N, "Domain Name Server", OT6_V6, },
|
||||
{ 8195, OL6_N, "Domain Name", OT6_STR, },
|
||||
|
||||
/* Application and Service Parameters */
|
||||
{ 16, OL6_N, "Directory Agent", OT6_NONE, },
|
||||
{ 17, OL6_N, "Service Scope" , OT6_NONE, },
|
||||
{ 18, OL6_16N, "Network Time Protocol Servers", OT6_V6, },
|
||||
{ 19, OL6_N, "NIS Domain", OT6_STR, },
|
||||
{ 20, OL6_16N, "NIS Servers", OT6_V6, },
|
||||
{ 21, OL6_N, "NIS+ Domain", OT6_STR, },
|
||||
{ 22, OL6_16N, "NIS+ Servers", OT6_V6, },
|
||||
{ 8196, OL6_N, "SLP Agent", OT6_NONE, },
|
||||
{ 8197, OL6_N, "SLP Scope" , OT6_NONE, },
|
||||
{ 8198, OL6_16N, "Network Time Protocol Servers", OT6_V6, },
|
||||
{ 8199, OL6_N, "NIS Domain", OT6_STR, },
|
||||
{ 8200, OL6_16N, "NIS Servers", OT6_V6, },
|
||||
{ 8201, OL6_N, "NIS+ Domain", OT6_STR, },
|
||||
{ 8202, OL6_16N, "NIS+ Servers", OT6_V6, },
|
||||
|
||||
/* TCP Parameters */
|
||||
{ 32, 4, "TCP Keepalive Interval", OT6_NUM, },
|
||||
{ 8203, 4, "TCP Keepalive Interval", OT6_NUM, },
|
||||
|
||||
/* DHCPv6 Extensions */
|
||||
{ 40, 4, "Maximum DHCPv6 Message Size", OT6_NUM, },
|
||||
{ 41, OL6_N, "DHCP Retransmission and Configuration Parameter",
|
||||
{ 8204, 4, "Maximum DHCPv6 Message Size", OT6_NUM, },
|
||||
{ 8205, OL6_N, "DHCP Retransmission and Configuration Parameter",
|
||||
OT6_NONE, },
|
||||
{ 48, OL6_N, "Platform Specific Information", OT6_NONE, },
|
||||
{ 49, OL6_N, "Platform Class Identifier", OT6_STR, },
|
||||
{ 64, OL6_N, "Class Identifier", OT6_STR, },
|
||||
{ 66, 16, "Reconfigure Multicast Address", OT6_V6, },
|
||||
{ 67, 16, "Renumber DHCPv6 Server Address",
|
||||
{ 8206, OL6_N, "Extension Request", OT6_NONE, },
|
||||
{ 8207, OL6_N, "Subnet Prefix", OT6_NONE, },
|
||||
{ 8208, OL6_N, "Platform Specific Information", OT6_NONE, },
|
||||
{ 8209, OL6_N, "Platform Class Identifier", OT6_STR, },
|
||||
{ 8210, OL6_N, "Class Identifier", OT6_STR, },
|
||||
{ 8211, 16, "Reconfigure Multicast Address", OT6_V6, },
|
||||
{ 8212, 16, "Renumber DHCPv6 Server Address",
|
||||
OT6_V6, },
|
||||
{ 68, OL6_N, "DHCP Relay ICMP Error Message", OT6_NONE, },
|
||||
{ 84, OL6_N, "Client-Server Authentication", OT6_NONE, },
|
||||
{ 85, 4, "Client Key Selection", OT6_NUM, },
|
||||
{ 8213, OL6_N, "Client-Server Authentication", OT6_NONE, },
|
||||
{ 8214, 4, "Client Key Selection", OT6_NUM, },
|
||||
|
||||
/* End Extension */
|
||||
{ 65536, OL6_Z, "End", OT6_NONE, },
|
||||
@ -159,13 +152,18 @@ dhcp6ext_print(u_char *cp, u_char *ep)
|
||||
|
||||
if (cp == ep)
|
||||
return;
|
||||
printf(" ");
|
||||
while (cp < ep) {
|
||||
if (ep - cp < sizeof(u_int16_t))
|
||||
break;
|
||||
code = ntohs(*(u_int16_t *)&cp[0]);
|
||||
if (ep - cp < sizeof(u_int16_t) * 2)
|
||||
break;
|
||||
if (code != 65535)
|
||||
len = ntohs(*(u_int16_t *)&cp[2]);
|
||||
else
|
||||
len = 0;
|
||||
if (ep - cp < len + 4)
|
||||
break;
|
||||
p = dhcp6opttab_bycode(code);
|
||||
if (p == NULL) {
|
||||
printf("(unknown, len=%d)", len);
|
||||
@ -191,11 +189,11 @@ dhcp6ext_print(u_char *cp, u_char *ep)
|
||||
break;
|
||||
}
|
||||
if (cp + 4 + len > ep) {
|
||||
printf("[|%s]", p->name);
|
||||
printf(" [|%s]", p->name);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("(%s, ", p->name);
|
||||
printf(" (%s, ", p->name);
|
||||
switch (p->type) {
|
||||
case OT6_V6:
|
||||
for (i = 0; i < len; i += 16) {
|
||||
@ -232,11 +230,12 @@ dhcp6ext_print(u_char *cp, u_char *ep)
|
||||
*/
|
||||
void
|
||||
dhcp6_print(register const u_char *cp, u_int length,
|
||||
u_short sport, u_short dport)
|
||||
u_int16_t sport, u_int16_t dport)
|
||||
{
|
||||
union dhcp6 *dh6;
|
||||
u_char *ep;
|
||||
u_char *extp;
|
||||
u_int16_t field16;
|
||||
|
||||
printf("dhcp6");
|
||||
|
||||
@ -246,31 +245,43 @@ dhcp6_print(register const u_char *cp, u_int length,
|
||||
TCHECK(dh6->dh6_msgtype);
|
||||
switch (dh6->dh6_msgtype) {
|
||||
case DH6_SOLICIT:
|
||||
if (vflag && TTEST(dh6->dh6_sol.dh6sol_relayaddr)) {
|
||||
printf(" solicit(");
|
||||
if ((dh6->dh6_sol.dh6sol_flags & DH6SOL_CLOSE) != 0)
|
||||
printf("C");
|
||||
if (dh6->dh6_sol.dh6sol_flags != 0)
|
||||
printf(" ");
|
||||
printf("cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_sol.dh6sol_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_sol.dh6sol_relayaddr));
|
||||
printf(")");
|
||||
} else
|
||||
if (!(vflag && TTEST(dh6->dh6_sol.dh6sol_relayaddr))) {
|
||||
printf(" solicit");
|
||||
break;
|
||||
}
|
||||
|
||||
printf(" solicit ("); /*)*/
|
||||
if (dh6->dh6_sol.dh6sol_flags != 0) {
|
||||
u_int8_t f = dh6->dh6_sol.dh6sol_flags;
|
||||
printf("%s%s ",
|
||||
(f & DH6SOL_PREFIX) ? "P" : "",
|
||||
(f & DH6SOL_CLOSE) ? "C" : "");
|
||||
}
|
||||
|
||||
memcpy(&field16, &dh6->dh6_sol.dh6sol_plen_id,
|
||||
sizeof(field16));
|
||||
field16 = ntohs(field16);
|
||||
if (field16 & ~DH6SOL_SOLICIT_PLEN_MASK)
|
||||
printf("plen=%d ", DH6SOL_SOLICIT_PLEN(field16));
|
||||
printf("solicit-ID=%d", DH6SOL_SOLICIT_ID(field16));
|
||||
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_sol.dh6sol_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_sol.dh6sol_relayaddr));
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_ADVERT:
|
||||
if (!(vflag && TTEST(dh6->dh6_adv.dh6adv_serveraddr))) {
|
||||
printf(" advert");
|
||||
break;
|
||||
}
|
||||
printf(" advert(");
|
||||
if ((dh6->dh6_adv.dh6adv_flags & DH6ADV_SERVPRESENT) != 0)
|
||||
printf("S");
|
||||
if (dh6->dh6_adv.dh6adv_flags != 0)
|
||||
printf(" ");
|
||||
printf("pref=%u", dh6->dh6_adv.dh6adv_pref);
|
||||
printf(" advert ("); /*)*/
|
||||
memcpy(&field16, &dh6->dh6_adv.dh6adv_rsv_id, sizeof(field16));
|
||||
printf("solicit-ID=%d",
|
||||
ntohs(field16) & DH6SOL_SOLICIT_ID_MASK);
|
||||
printf(" pref=%u", dh6->dh6_adv.dh6adv_pref);
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_adv.dh6adv_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
@ -279,6 +290,7 @@ dhcp6_print(register const u_char *cp, u_int length,
|
||||
ip6addr_string(&dh6->dh6_adv.dh6adv_serveraddr));
|
||||
extp = (u_char *)((&dh6->dh6_adv) + 1);
|
||||
dhcp6ext_print(extp, ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_REQUEST:
|
||||
@ -286,26 +298,22 @@ dhcp6_print(register const u_char *cp, u_int length,
|
||||
printf(" request");
|
||||
break;
|
||||
}
|
||||
printf(" request(");
|
||||
if ((dh6->dh6_req.dh6req_flags & DH6REQ_CLOSE) != 0)
|
||||
printf("C");
|
||||
if ((dh6->dh6_req.dh6req_flags & DH6REQ_SERVPRESENT) != 0)
|
||||
printf("S");
|
||||
if ((dh6->dh6_req.dh6req_flags & DH6REQ_REBOOT) != 0)
|
||||
printf("R");
|
||||
if (dh6->dh6_req.dh6req_flags != 0)
|
||||
printf(" ");
|
||||
printf(" request ("); /*)*/
|
||||
if (dh6->dh6_req.dh6req_flags != 0) {
|
||||
u_int8_t f = dh6->dh6_req.dh6req_flags;
|
||||
printf("%s%s ",
|
||||
(f & DH6REQ_CLOSE) ? "C" : "",
|
||||
(f & DH6REQ_REBOOT) ? "R" : "");
|
||||
}
|
||||
printf("xid=0x%04x", dh6->dh6_req.dh6req_xid);
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_cliaddr));
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_cliaddr));
|
||||
printf(" relayaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_relayaddr));
|
||||
extp = (char *)((&dh6->dh6_req) + 1);
|
||||
if ((dh6->dh6_req.dh6req_flags & DH6REQ_SERVPRESENT) != 0) {
|
||||
printf(" servaddr=%s", ip6addr_string(extp));
|
||||
extp += 16;
|
||||
}
|
||||
dhcp6ext_print(extp, ep);
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_relayaddr));
|
||||
printf(" servaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_req.dh6req_serveraddr));
|
||||
dhcp6ext_print((char *)(&dh6->dh6_req + 1), ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_REPLY:
|
||||
@ -313,19 +321,22 @@ dhcp6_print(register const u_char *cp, u_int length,
|
||||
printf(" reply");
|
||||
break;
|
||||
}
|
||||
printf(" reply(");
|
||||
if ((dh6->dh6_rep.dh6rep_flagandstat & DH6REP_CLIPRESENT) != 0)
|
||||
printf("C");
|
||||
if (dh6->dh6_rep.dh6rep_flagandstat != 0)
|
||||
printf(" ");
|
||||
printf(" reply ("); /*)*/
|
||||
if ((dh6->dh6_rep.dh6rep_flagandstat & DH6REP_RELAYPRESENT) != 0)
|
||||
printf("R ");
|
||||
printf("stat=0x%02x",
|
||||
dh6->dh6_rep.dh6rep_flagandstat & DH6REP_STATMASK);
|
||||
printf(" xid=0x%04x", dh6->dh6_rep.dh6rep_xid);
|
||||
printf(" cliaddr=%s",
|
||||
ip6addr_string(&dh6->dh6_rep.dh6rep_cliaddr));
|
||||
extp = (u_char *)((&dh6->dh6_rep) + 1);
|
||||
if ((dh6->dh6_rep.dh6rep_flagandstat & DH6REP_CLIPRESENT) != 0) {
|
||||
printf(" cliaddr=%s", ip6addr_string(extp));
|
||||
extp += 16;
|
||||
if ((dh6->dh6_rep.dh6rep_flagandstat & DH6REP_RELAYPRESENT) !=
|
||||
0) {
|
||||
printf(" relayaddr=%s", ip6addr_string(extp));
|
||||
extp += sizeof(struct in6_addr);
|
||||
}
|
||||
dhcp6ext_print(extp, ep);
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
case DH6_RELEASE:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.17 1999/11/22 04:30:34 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-dvmrp.c,v 1.20 2000/09/29 04:58:36 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -33,12 +33,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.24 1999/11/21 09:36:51 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.26 2000/09/29 04:58:36 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -33,8 +33,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
@ -42,6 +40,8 @@ static const char rcsid[] =
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#include "ip.h"
|
||||
|
||||
struct egp_packet {
|
||||
u_char egp_version;
|
||||
#define EGP_VERSION 2
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.5 1999/12/15 08:10:18 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.17 2000/12/12 09:58:41 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -36,20 +36,9 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#ifdef CRYPTO
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
#include <des.h>
|
||||
#include <blowfish.h>
|
||||
#ifdef HAVE_RC5_H
|
||||
@ -62,33 +51,12 @@ static const char rcsid[] =
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ip.h"
|
||||
#include "esp.h"
|
||||
#ifdef INET6
|
||||
#include <netinet/ip6.h>
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
|
||||
/* there's no standard definition so we are on our own */
|
||||
struct esp {
|
||||
u_int32_t esp_spi; /* ESP */
|
||||
/*variable size, 32bit bound*/ /* Initialization Vector */
|
||||
/*variable size*/ /* Payload data */
|
||||
/*variable size*/ /* padding */
|
||||
/*8bit*/ /* pad size */
|
||||
/*8bit*/ /* next header */
|
||||
/*8bit*/ /* next header */
|
||||
/*variable size, 32bit bound*/ /* Authentication data (new IPsec) */
|
||||
};
|
||||
|
||||
struct newesp {
|
||||
u_int32_t esp_spi; /* ESP */
|
||||
u_int32_t esp_seq; /* Sequence number */
|
||||
/*variable size*/ /* (IV and) Payload data */
|
||||
/*variable size*/ /* padding */
|
||||
/*8bit*/ /* pad size */
|
||||
/*8bit*/ /* next header */
|
||||
/*8bit*/ /* next header */
|
||||
/*variable size, 32bit bound*/ /* Authentication data */
|
||||
};
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
@ -112,14 +80,14 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
esp = (struct esp *)bp;
|
||||
spi = (u_int32_t)ntohl(esp->esp_spi);
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
if ((u_char *)(esp + 1) >= ep - sizeof(struct esp)) {
|
||||
fputs("[|ESP]", stdout);
|
||||
goto fail;
|
||||
}
|
||||
printf("ESP(spi=%u", spi);
|
||||
printf("ESP(spi=0x%08x", spi);
|
||||
printf(",seq=0x%x", (u_int32_t)ntohl(*(u_int32_t *)(esp + 1)));
|
||||
printf(")");
|
||||
|
||||
@ -164,7 +132,7 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
|
||||
ip = (struct ip *)bp2;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
#ifdef INET6
|
||||
case 6:
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
@ -197,7 +165,7 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
|
||||
switch (algo) {
|
||||
case DESCBC:
|
||||
#ifdef CRYPTO
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
{
|
||||
u_char iv[8];
|
||||
des_key_schedule schedule;
|
||||
@ -232,10 +200,10 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*CRYPTO*/
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case BLOWFISH:
|
||||
#ifdef CRYPTO
|
||||
#ifdef HAVE_LIBCRYPTO
|
||||
{
|
||||
BF_KEY schedule;
|
||||
u_char *p;
|
||||
@ -250,10 +218,10 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*CRYPTO*/
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case RC5:
|
||||
#if defined(CRYPTO) && defined(HAVE_RC5_H)
|
||||
#if defined(HAVE_LIBCRYPTO) && defined(HAVE_RC5_H)
|
||||
{
|
||||
RC5_32_KEY schedule;
|
||||
u_char *p;
|
||||
@ -269,10 +237,10 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*CRYPTO*/
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case CAST128:
|
||||
#if defined(CRYPTO) && defined(HAVE_CAST_H) && !defined(HAVE_BUGGY_CAST128)
|
||||
#if defined(HAVE_LIBCRYPTO) && defined(HAVE_CAST_H) && !defined(HAVE_BUGGY_CAST128)
|
||||
{
|
||||
CAST_KEY schedule;
|
||||
u_char *p;
|
||||
@ -287,10 +255,10 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*CRYPTO*/
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case DES3CBC:
|
||||
#if defined(CRYPTO)
|
||||
#if defined(HAVE_LIBCRYPTO)
|
||||
{
|
||||
des_key_schedule s1, s2, s3;
|
||||
u_char *p;
|
||||
@ -308,7 +276,7 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
#else
|
||||
goto fail;
|
||||
#endif /*CRYPTO*/
|
||||
#endif /*HAVE_LIBCRYPTO*/
|
||||
|
||||
case NONE:
|
||||
default:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.3.2.1 2000/01/11 06:58:24 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.12 2000/10/07 05:53:10 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,21 +35,12 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <netinet/ip6.h>
|
||||
#include "ip6.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
@ -68,7 +59,7 @@ frag6_print(register const u_char *bp, register const u_char *bp2)
|
||||
dp = (struct ip6_frag *)bp;
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
TCHECK(dp->ip6f_offlg);
|
||||
@ -86,7 +77,7 @@ frag6_print(register const u_char *bp, register const u_char *bp2)
|
||||
(long)(bp - bp2) - sizeof(struct ip6_frag));
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
/* it is meaningless to decode non-first fragment */
|
||||
if (ntohs(dp->ip6f_offlg & IP6F_OFF_MASK) != 0)
|
||||
return 65535;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.6 1999/11/21 09:36:52 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.9 2000/12/18 05:41:59 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -37,8 +37,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
@ -88,7 +86,7 @@ gre_print(const u_char *bp, u_int length)
|
||||
{
|
||||
const u_char *cp = bp + 4;
|
||||
const struct gre *gre;
|
||||
u_short flags, proto;
|
||||
u_short flags, proto, extracted_ethertype;
|
||||
|
||||
gre = (const struct gre *)bp;
|
||||
|
||||
@ -125,7 +123,8 @@ gre_print(const u_char *bp, u_int length)
|
||||
cp += 4;
|
||||
|
||||
length -= cp - bp;
|
||||
if (ether_encap_print(proto, cp, length, length) == 0)
|
||||
if (ether_encap_print(proto, cp, length, length,
|
||||
&extracted_ethertype) == 0)
|
||||
printf("gre-proto-0x%04X", proto);
|
||||
return;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.2.2.1 2000/01/11 06:58:24 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.42 2000/12/13 07:57:05 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -37,43 +37,46 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/icmp6.h>
|
||||
#include "ip6.h"
|
||||
#include "icmp6.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#include "udp.h"
|
||||
#include "ah.h"
|
||||
|
||||
void icmp6_opt_print(const u_char *, int);
|
||||
void mld6_print(const u_char *);
|
||||
static struct udphdr *get_upperlayer(u_char *, int *);
|
||||
static void dnsname_print(const u_char *, const u_char *);
|
||||
void icmp6_nodeinfo_print(int, const u_char *, const u_char *);
|
||||
void icmp6_rrenum_print(int, const u_char *, const u_char *);
|
||||
|
||||
#ifndef abs
|
||||
#define abs(a) ((0 < (a)) ? (a) : -(a))
|
||||
#endif
|
||||
|
||||
void
|
||||
icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
{
|
||||
register const struct icmp6_hdr *dp;
|
||||
const struct icmp6_hdr *dp;
|
||||
register const struct ip6_hdr *ip;
|
||||
register const char *str;
|
||||
register const struct ip6_hdr *oip;
|
||||
register const struct udphdr *ouh;
|
||||
register int hlen, dport;
|
||||
register int dport;
|
||||
register const u_char *ep;
|
||||
char buf[256];
|
||||
int icmp6len;
|
||||
int icmp6len, prot;
|
||||
|
||||
#if 0
|
||||
#define TCHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) goto trunc
|
||||
@ -83,7 +86,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
ip = (struct ip6_hdr *)bp2;
|
||||
oip = (struct ip6_hdr *)(dp + 1);
|
||||
str = buf;
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
if (ip->ip6_plen)
|
||||
icmp6len = (ntohs(ip->ip6_plen) + sizeof(struct ip6_hdr) -
|
||||
@ -92,13 +95,13 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
icmp6len = snapend - bp;
|
||||
|
||||
#if 0
|
||||
(void)printf("%s > %s: ",
|
||||
(void)printf("%s > %s: ",
|
||||
ip6addr_string(&ip->ip6_src),
|
||||
ip6addr_string(&ip->ip6_dst));
|
||||
#endif
|
||||
|
||||
TCHECK(dp->icmp6_code);
|
||||
switch(dp->icmp6_type) {
|
||||
switch (dp->icmp6_type) {
|
||||
case ICMP6_DST_UNREACH:
|
||||
TCHECK(oip->ip6_dst);
|
||||
switch (dp->icmp6_code) {
|
||||
@ -110,11 +113,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
printf("icmp6: %s unreachable prohibited",
|
||||
ip6addr_string(&oip->ip6_dst));
|
||||
break;
|
||||
#ifdef ICMP6_DST_UNREACH_BEYONDSCOPE
|
||||
case ICMP6_DST_UNREACH_BEYONDSCOPE:
|
||||
#else
|
||||
case ICMP6_DST_UNREACH_NOTNEIGHBOR:
|
||||
#endif
|
||||
printf("icmp6: %s beyond scope of source address %s",
|
||||
ip6addr_string(&oip->ip6_dst),
|
||||
ip6addr_string(&oip->ip6_src));
|
||||
@ -124,11 +123,12 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
ip6addr_string(&oip->ip6_dst));
|
||||
break;
|
||||
case ICMP6_DST_UNREACH_NOPORT:
|
||||
TCHECK(oip->ip6_nxt);
|
||||
hlen = sizeof(struct ip6_hdr);
|
||||
ouh = (struct udphdr *)(((u_char *)oip) + hlen);
|
||||
if ((ouh = get_upperlayer((u_char *)oip, &prot))
|
||||
== NULL)
|
||||
goto trunc;
|
||||
|
||||
dport = ntohs(ouh->uh_dport);
|
||||
switch (oip->ip6_nxt) {
|
||||
switch (prot) {
|
||||
case IPPROTO_TCP:
|
||||
printf("icmp6: %s tcp port %s unreachable",
|
||||
ip6addr_string(&oip->ip6_dst),
|
||||
@ -216,7 +216,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
printf("icmp6: router solicitation ");
|
||||
if (vflag) {
|
||||
#define RTSOLLEN 8
|
||||
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
|
||||
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
|
||||
icmp6len - RTSOLLEN);
|
||||
}
|
||||
break;
|
||||
@ -232,6 +232,11 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
printf("M");
|
||||
if (p->nd_ra_flags_reserved & ND_RA_FLAG_OTHER)
|
||||
printf("O");
|
||||
#ifndef ND_RA_FLAG_HA
|
||||
#define ND_RA_FLAG_HA 0x20
|
||||
#endif
|
||||
if (p->nd_ra_flags_reserved & ND_RA_FLAG_HA)
|
||||
printf("H");
|
||||
if (p->nd_ra_flags_reserved != 0)
|
||||
printf(" ");
|
||||
printf("router_ltime=%d, ", ntohs(p->nd_ra_router_lifetime));
|
||||
@ -240,7 +245,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
printf("retrans_time=%u)",
|
||||
(u_int32_t)ntohl(p->nd_ra_retransmit));
|
||||
#define RTADVLEN 16
|
||||
icmp6_opt_print((const u_char *)dp + RTADVLEN,
|
||||
icmp6_opt_print((const u_char *)dp + RTADVLEN,
|
||||
icmp6len - RTADVLEN);
|
||||
}
|
||||
break;
|
||||
@ -253,7 +258,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
ip6addr_string(&p->nd_ns_target));
|
||||
if (vflag) {
|
||||
#define NDSOLLEN 24
|
||||
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
|
||||
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
|
||||
icmp6len - NDSOLLEN);
|
||||
}
|
||||
}
|
||||
@ -266,7 +271,7 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
TCHECK(p->nd_na_target);
|
||||
printf("icmp6: neighbor adv: tgt is %s",
|
||||
ip6addr_string(&p->nd_na_target));
|
||||
if (vflag) {
|
||||
if (vflag) {
|
||||
#define ND_NA_FLAG_ALL \
|
||||
(ND_NA_FLAG_ROUTER|ND_NA_FLAG_SOLICITED|ND_NA_FLAG_OVERRIDE)
|
||||
/* we don't need ntohl() here. see advanced-api-04. */
|
||||
@ -285,124 +290,34 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
printf(")");
|
||||
}
|
||||
#define NDADVLEN 24
|
||||
icmp6_opt_print((const u_char *)dp + NDADVLEN,
|
||||
icmp6_opt_print((const u_char *)dp + NDADVLEN,
|
||||
icmp6len - NDADVLEN);
|
||||
#undef NDADVLEN
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ND_REDIRECT:
|
||||
{
|
||||
#define RDR(i) ((struct nd_redirect *)(i))
|
||||
char tgtbuf[INET6_ADDRSTRLEN], dstbuf[INET6_ADDRSTRLEN];
|
||||
|
||||
TCHECK(RDR(dp)->nd_rd_dst);
|
||||
inet_ntop(AF_INET6, &RDR(dp)->nd_rd_target,
|
||||
tgtbuf, INET6_ADDRSTRLEN);
|
||||
inet_ntop(AF_INET6, &RDR(dp)->nd_rd_dst,
|
||||
dstbuf, INET6_ADDRSTRLEN);
|
||||
printf("icmp6: redirect %s to %s", dstbuf, tgtbuf);
|
||||
printf("icmp6: redirect %s",
|
||||
getname6((const u_char *)&RDR(dp)->nd_rd_dst));
|
||||
printf(" to %s",
|
||||
getname6((const u_char*)&RDR(dp)->nd_rd_target));
|
||||
#define REDIRECTLEN 40
|
||||
if (vflag) {
|
||||
icmp6_opt_print((const u_char *)dp + REDIRECTLEN,
|
||||
icmp6len - REDIRECTLEN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#undef REDIRECTLEN
|
||||
#undef RDR
|
||||
case ICMP6_ROUTER_RENUMBERING:
|
||||
switch (dp->icmp6_code) {
|
||||
case ICMP6_ROUTER_RENUMBERING_COMMAND:
|
||||
printf("icmp6: router renum command");
|
||||
break;
|
||||
case ICMP6_ROUTER_RENUMBERING_RESULT:
|
||||
printf("icmp6: router renum result");
|
||||
break;
|
||||
default:
|
||||
printf("icmp6: router renum code-#%d", dp->icmp6_code);
|
||||
break;
|
||||
}
|
||||
icmp6_rrenum_print(icmp6len, bp, ep);
|
||||
break;
|
||||
#ifdef ICMP6_WRUREQUEST
|
||||
case ICMP6_WRUREQUEST: /*ICMP6_FQDN_QUERY*/
|
||||
{
|
||||
int siz;
|
||||
siz = ep - (u_char *)(dp + 1);
|
||||
if (siz == 4)
|
||||
printf("icmp6: who-are-you request");
|
||||
else {
|
||||
printf("icmp6: FQDN request");
|
||||
if (vflag) {
|
||||
if (siz < 8)
|
||||
printf("?(icmp6_data %d bytes)", siz);
|
||||
else if (8 < siz)
|
||||
printf("?(extra %d bytes)", siz - 8);
|
||||
}
|
||||
}
|
||||
case ICMP6_NI_QUERY:
|
||||
case ICMP6_NI_REPLY:
|
||||
icmp6_nodeinfo_print(icmp6len, bp, ep);
|
||||
break;
|
||||
}
|
||||
#endif /*ICMP6_WRUREQUEST*/
|
||||
#ifdef ICMP6_WRUREPLY
|
||||
case ICMP6_WRUREPLY: /*ICMP6_FQDN_REPLY*/
|
||||
{
|
||||
enum { UNKNOWN, WRU, FQDN } mode = UNKNOWN;
|
||||
u_char const *buf;
|
||||
u_char const *cp = NULL;
|
||||
|
||||
buf = (u_char *)(dp + 1);
|
||||
|
||||
/* fair guess */
|
||||
if (buf[12] == ep - buf - 13)
|
||||
mode = FQDN;
|
||||
else if (dp->icmp6_code == 1)
|
||||
mode = FQDN;
|
||||
|
||||
/* wild guess */
|
||||
if (mode == UNKNOWN) {
|
||||
cp = buf + 4;
|
||||
while (cp < ep) {
|
||||
if (!isprint(*cp++))
|
||||
mode = FQDN;
|
||||
}
|
||||
}
|
||||
#ifndef abs
|
||||
#define abs(a) ((0 < (a)) ? (a) : -(a))
|
||||
#endif
|
||||
if (mode == UNKNOWN && 2 < abs(buf[12] - (ep - buf - 13)))
|
||||
mode = WRU;
|
||||
if (mode == UNKNOWN)
|
||||
mode = FQDN;
|
||||
|
||||
if (mode == WRU) {
|
||||
cp = buf + 4;
|
||||
printf("icmp6: who-are-you reply(\"");
|
||||
} else if (mode == FQDN) {
|
||||
cp = buf + 13;
|
||||
printf("icmp6: FQDN reply(\"");
|
||||
}
|
||||
for (; cp < ep; cp++)
|
||||
printf((isprint(*cp) ? "%c" : "\\%03o"), *cp);
|
||||
printf("\"");
|
||||
if (vflag) {
|
||||
printf(",%s", mode == FQDN ? "FQDN" : "WRU");
|
||||
if (mode == FQDN) {
|
||||
long ttl;
|
||||
ttl = (long)ntohl(*(u_long *)&buf[8]);
|
||||
if (dp->icmp6_code == 1)
|
||||
printf(",TTL=unknown");
|
||||
else if (ttl < 0)
|
||||
printf(",TTL=%ld:invalid", ttl);
|
||||
else
|
||||
printf(",TTL=%ld", ttl);
|
||||
if (buf[12] != ep - buf - 13) {
|
||||
(void)printf(",invalid namelen:%d/%u",
|
||||
buf[12],
|
||||
(unsigned int)(ep - buf - 13));
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
#endif /*ICMP6_WRUREPLY*/
|
||||
default:
|
||||
printf("icmp6: type-#%d", dp->icmp6_type);
|
||||
break;
|
||||
@ -415,6 +330,79 @@ icmp6_print(register const u_char *bp, register const u_char *bp2)
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct udphdr *
|
||||
get_upperlayer(register u_char *bp, int *prot)
|
||||
{
|
||||
register const u_char *ep;
|
||||
struct ip6_hdr *ip6 = (struct ip6_hdr *)bp;
|
||||
struct udphdr *uh;
|
||||
struct ip6_hbh *hbh;
|
||||
struct ip6_frag *fragh;
|
||||
struct ah *ah;
|
||||
int nh, hlen;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
if (TTEST(ip6->ip6_nxt) == 0)
|
||||
return NULL;
|
||||
|
||||
nh = ip6->ip6_nxt;
|
||||
hlen = sizeof(struct ip6_hdr);
|
||||
|
||||
while (bp < snapend) {
|
||||
bp += hlen;
|
||||
|
||||
switch(nh) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_TCP:
|
||||
uh = (struct udphdr *)bp;
|
||||
if (TTEST(uh->uh_dport)) {
|
||||
*prot = nh;
|
||||
return(uh);
|
||||
}
|
||||
else
|
||||
return(NULL);
|
||||
/* NOTREACHED */
|
||||
|
||||
case IPPROTO_HOPOPTS:
|
||||
case IPPROTO_DSTOPTS:
|
||||
case IPPROTO_ROUTING:
|
||||
hbh = (struct ip6_hbh *)bp;
|
||||
if (TTEST(hbh->ip6h_len) == 0)
|
||||
return(NULL);
|
||||
nh = hbh->ip6h_nxt;
|
||||
hlen = (hbh->ip6h_len + 1) << 3;
|
||||
break;
|
||||
|
||||
case IPPROTO_FRAGMENT: /* this should be odd, but try anyway */
|
||||
fragh = (struct ip6_frag *)bp;
|
||||
if (TTEST(fragh->ip6f_offlg) == 0)
|
||||
return(NULL);
|
||||
/* fragments with non-zero offset are meaningless */
|
||||
if ((fragh->ip6f_offlg & IP6F_OFF_MASK) != 0)
|
||||
return(NULL);
|
||||
nh = fragh->ip6f_nxt;
|
||||
hlen = sizeof(struct ip6_frag);
|
||||
break;
|
||||
|
||||
case IPPROTO_AH:
|
||||
ah = (struct ah *)bp;
|
||||
if (TTEST(ah->ah_len) == 0)
|
||||
return(NULL);
|
||||
nh = ah->ah_nxt;
|
||||
hlen = (ah->ah_len + 2) << 2;
|
||||
break;
|
||||
|
||||
default: /* unknown or undecodable header */
|
||||
*prot = nh; /* meaningless, but set here anyway */
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL); /* should be notreached, though */
|
||||
}
|
||||
|
||||
void
|
||||
icmp6_opt_print(register const u_char *bp, int resid)
|
||||
{
|
||||
@ -423,6 +411,7 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
register const struct nd_opt_prefix_info *opp;
|
||||
register const struct icmp6_opts_redirect *opr;
|
||||
register const struct nd_opt_mtu *opm;
|
||||
register const struct nd_opt_advint *opa;
|
||||
register const u_char *ep;
|
||||
int opts_len;
|
||||
#if 0
|
||||
@ -434,9 +423,6 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
char buf[256];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#define TCHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) goto trunc
|
||||
#endif
|
||||
#define ECHECK(var) if ((u_char *)&(var) > ep - sizeof(var)) return
|
||||
|
||||
op = (struct nd_opt_hdr *)bp;
|
||||
@ -445,13 +431,13 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
oip = &dp->icmp6_ip6;
|
||||
str = buf;
|
||||
#endif
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
ECHECK(op->nd_opt_len);
|
||||
if (resid <= 0)
|
||||
return;
|
||||
switch(op->nd_opt_type) {
|
||||
switch (op->nd_opt_type) {
|
||||
case ND_OPT_SOURCE_LINKADDR:
|
||||
opl = (struct nd_opt_hdr *)op;
|
||||
#if 1
|
||||
@ -460,10 +446,11 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
#else
|
||||
TCHECK((u_char *)opl + (opl->nd_opt_len << 3) - 1);
|
||||
#endif
|
||||
printf("(src lladdr: %s",
|
||||
printf("(src lladdr: %s", /*)*/
|
||||
etheraddr_string((u_char *)(opl + 1)));
|
||||
if (opl->nd_opt_len != 1)
|
||||
printf("!");
|
||||
/*(*/
|
||||
printf(")");
|
||||
icmp6_opt_print((const u_char *)op + (op->nd_opt_len << 3),
|
||||
resid - (op->nd_opt_len << 3));
|
||||
@ -476,10 +463,11 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
#else
|
||||
TCHECK((u_char *)opl + (opl->nd_opt_len << 3) - 1);
|
||||
#endif
|
||||
printf("(tgt lladdr: %s",
|
||||
printf("(tgt lladdr: %s", /*)*/
|
||||
etheraddr_string((u_char *)(opl + 1)));
|
||||
if (opl->nd_opt_len != 1)
|
||||
printf("!");
|
||||
/*(*/
|
||||
printf(")");
|
||||
icmp6_opt_print((const u_char *)op + (op->nd_opt_len << 3),
|
||||
resid - (op->nd_opt_len << 3));
|
||||
@ -487,11 +475,13 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
case ND_OPT_PREFIX_INFORMATION:
|
||||
opp = (struct nd_opt_prefix_info *)op;
|
||||
TCHECK(opp->nd_opt_pi_prefix);
|
||||
printf("(prefix info: ");
|
||||
printf("(prefix info: "); /*)*/
|
||||
if (opp->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ONLINK)
|
||||
printf("L");
|
||||
printf("L");
|
||||
if (opp->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO)
|
||||
printf("A");
|
||||
printf("A");
|
||||
if (opp->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ROUTER)
|
||||
printf("R");
|
||||
if (opp->nd_opt_pi_flags_reserved)
|
||||
printf(" ");
|
||||
printf("valid_ltime=");
|
||||
@ -512,6 +502,7 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
opp->nd_opt_pi_prefix_len);
|
||||
if (opp->nd_opt_pi_len != 4)
|
||||
printf("!");
|
||||
/*(*/
|
||||
printf(")");
|
||||
icmp6_opt_print((const u_char *)op + (op->nd_opt_len << 3),
|
||||
resid - (op->nd_opt_len << 3));
|
||||
@ -526,7 +517,7 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
case ND_OPT_MTU:
|
||||
opm = (struct nd_opt_mtu *)op;
|
||||
TCHECK(opm->nd_opt_mtu_mtu);
|
||||
printf("(mtu: ");
|
||||
printf("(mtu: "); /*)*/
|
||||
printf("mtu=%u", (u_int32_t)ntohl(opm->nd_opt_mtu_mtu));
|
||||
if (opm->nd_opt_mtu_len != 1)
|
||||
printf("!");
|
||||
@ -534,6 +525,17 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
icmp6_opt_print((const u_char *)op + (op->nd_opt_len << 3),
|
||||
resid - (op->nd_opt_len << 3));
|
||||
break;
|
||||
case ND_OPT_ADVINT:
|
||||
opa = (struct nd_opt_advint *)op;
|
||||
TCHECK(opa->nd_opt_advint_advint);
|
||||
printf("(advint: "); /*)*/
|
||||
printf("advint=%u",
|
||||
(u_int32_t)ntohl(opa->nd_opt_advint_advint));
|
||||
/*(*/
|
||||
printf(")");
|
||||
icmp6_opt_print((const u_char *)op + (op->nd_opt_len << 3),
|
||||
resid - (op->nd_opt_len << 3));
|
||||
break;
|
||||
default:
|
||||
opts_len = op->nd_opt_len;
|
||||
printf("(unknwon opt_type=%d, opt_len=%d)",
|
||||
@ -548,9 +550,6 @@ icmp6_opt_print(register const u_char *bp, int resid)
|
||||
trunc:
|
||||
fputs("[ndp opt]", stdout);
|
||||
return;
|
||||
#if 0
|
||||
#undef TCHECK
|
||||
#endif
|
||||
#undef ECHECK
|
||||
}
|
||||
|
||||
@ -560,7 +559,7 @@ mld6_print(register const u_char *bp)
|
||||
register struct mld6_hdr *mp = (struct mld6_hdr *)bp;
|
||||
register const u_char *ep;
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
if ((u_char *)mp + sizeof(*mp) > ep)
|
||||
@ -568,7 +567,427 @@ mld6_print(register const u_char *bp)
|
||||
|
||||
printf("max resp delay: %d ", ntohs(mp->mld6_maxdelay));
|
||||
printf("addr: %s", ip6addr_string(&mp->mld6_addr));
|
||||
}
|
||||
|
||||
static void
|
||||
dnsname_print(const u_char *cp, const u_char *ep)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* DNS name decoding - no decompression */
|
||||
printf(", \"");
|
||||
while (cp < ep) {
|
||||
i = *cp++;
|
||||
if (i) {
|
||||
if (i > ep - cp) {
|
||||
printf("???");
|
||||
break;
|
||||
}
|
||||
while (i-- && cp < ep) {
|
||||
safeputchar(*cp);
|
||||
cp++;
|
||||
}
|
||||
if (cp + 1 < ep && *cp)
|
||||
printf(".");
|
||||
} else {
|
||||
if (cp == ep) {
|
||||
/* FQDN */
|
||||
printf(".");
|
||||
} else if (cp + 1 == ep && *cp == '\0') {
|
||||
/* truncated */
|
||||
} else {
|
||||
/* invalid */
|
||||
printf("???");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("\"");
|
||||
}
|
||||
|
||||
void
|
||||
icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
{
|
||||
struct icmp6_nodeinfo *ni6;
|
||||
struct icmp6_hdr *dp;
|
||||
const u_char *cp;
|
||||
int siz, i;
|
||||
int needcomma;
|
||||
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
ni6 = (struct icmp6_nodeinfo *)bp;
|
||||
siz = ep - bp;
|
||||
|
||||
switch (ni6->ni_type) {
|
||||
case ICMP6_NI_QUERY:
|
||||
if (siz == sizeof(*dp) + 4) {
|
||||
/* KAME who-are-you */
|
||||
printf("icmp6: who-are-you request");
|
||||
break;
|
||||
}
|
||||
printf("icmp6: node information query");
|
||||
|
||||
TCHECK2(*dp, sizeof(*ni6));
|
||||
ni6 = (struct icmp6_nodeinfo *)dp;
|
||||
printf(" ("); /*)*/
|
||||
switch (ntohs(ni6->ni_qtype)) {
|
||||
case NI_QTYPE_NOOP:
|
||||
printf("noop");
|
||||
break;
|
||||
case NI_QTYPE_SUPTYPES:
|
||||
printf("supported qtypes");
|
||||
i = ntohs(ni6->ni_flags);
|
||||
if (i)
|
||||
printf(" [%s]", (i & 0x01) ? "C" : "");
|
||||
break;
|
||||
break;
|
||||
case NI_QTYPE_FQDN:
|
||||
printf("DNS name");
|
||||
break;
|
||||
case NI_QTYPE_NODEADDR:
|
||||
printf("node addresses");
|
||||
i = ni6->ni_flags;
|
||||
if (!i)
|
||||
break;
|
||||
/* NI_NODEADDR_FLAG_TRUNCATE undefined for query */
|
||||
printf(" [%s%s%s%s%s%s]",
|
||||
(i & NI_NODEADDR_FLAG_ANYCAST) ? "a" : "",
|
||||
(i & NI_NODEADDR_FLAG_GLOBAL) ? "G" : "",
|
||||
(i & NI_NODEADDR_FLAG_SITELOCAL) ? "S" : "",
|
||||
(i & NI_NODEADDR_FLAG_LINKLOCAL) ? "L" : "",
|
||||
(i & NI_NODEADDR_FLAG_COMPAT) ? "C" : "",
|
||||
(i & NI_NODEADDR_FLAG_ALL) ? "A" : "");
|
||||
break;
|
||||
default:
|
||||
printf("unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ni6->ni_qtype == NI_QTYPE_NOOP ||
|
||||
ni6->ni_qtype == NI_QTYPE_SUPTYPES) {
|
||||
if (siz != sizeof(*ni6))
|
||||
if (vflag)
|
||||
printf(", invalid len");
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* XXX backward compat, icmp-name-lookup-03 */
|
||||
if (siz == sizeof(*ni6)) {
|
||||
printf(", 03 draft");
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ni6->ni_code) {
|
||||
case ICMP6_NI_SUBJ_IPV6:
|
||||
if (!TTEST2(*dp,
|
||||
sizeof(*ni6) + sizeof(struct in6_addr)))
|
||||
break;
|
||||
if (siz != sizeof(*ni6) + sizeof(struct in6_addr)) {
|
||||
if (vflag)
|
||||
printf(", invalid subject len");
|
||||
break;
|
||||
}
|
||||
printf(", subject=%s",
|
||||
getname6((const u_char *)(ni6 + 1)));
|
||||
break;
|
||||
case ICMP6_NI_SUBJ_FQDN:
|
||||
printf(", subject=DNS name");
|
||||
cp = (const u_char *)(ni6 + 1);
|
||||
if (cp[0] == ep - cp - 1) {
|
||||
/* icmp-name-lookup-03, pascal string */
|
||||
if (vflag)
|
||||
printf(", 03 draft");
|
||||
cp++;
|
||||
printf(", \"");
|
||||
while (cp < ep) {
|
||||
safeputchar(*cp);
|
||||
cp++;
|
||||
}
|
||||
printf("\"");
|
||||
} else
|
||||
dnsname_print(cp, ep);
|
||||
break;
|
||||
case ICMP6_NI_SUBJ_IPV4:
|
||||
if (!TTEST2(*dp, sizeof(*ni6) + sizeof(struct in_addr)))
|
||||
break;
|
||||
if (siz != sizeof(*ni6) + sizeof(struct in_addr)) {
|
||||
if (vflag)
|
||||
printf(", invalid subject len");
|
||||
break;
|
||||
}
|
||||
printf(", subject=%s",
|
||||
getname((const u_char *)(ni6 + 1)));
|
||||
break;
|
||||
default:
|
||||
printf(", unknown subject");
|
||||
break;
|
||||
}
|
||||
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
|
||||
case ICMP6_NI_REPLY:
|
||||
if (icmp6len > siz) {
|
||||
printf("[|icmp6: node information reply]");
|
||||
break;
|
||||
}
|
||||
|
||||
needcomma = 0;
|
||||
|
||||
ni6 = (struct icmp6_nodeinfo *)dp;
|
||||
printf("icmp6: node information reply");
|
||||
printf(" ("); /*)*/
|
||||
switch (ni6->ni_code) {
|
||||
case ICMP6_NI_SUCCESS:
|
||||
if (vflag) {
|
||||
printf("success");
|
||||
needcomma++;
|
||||
}
|
||||
break;
|
||||
case ICMP6_NI_REFUSED:
|
||||
printf("refused");
|
||||
needcomma++;
|
||||
if (siz != sizeof(*ni6))
|
||||
if (vflag)
|
||||
printf(", invalid length");
|
||||
break;
|
||||
case ICMP6_NI_UNKNOWN:
|
||||
printf("unknown");
|
||||
needcomma++;
|
||||
if (siz != sizeof(*ni6))
|
||||
if (vflag)
|
||||
printf(", invalid length");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ni6->ni_code != ICMP6_NI_SUCCESS) {
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ntohs(ni6->ni_qtype)) {
|
||||
case NI_QTYPE_NOOP:
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
printf("noop");
|
||||
if (siz != sizeof(*ni6))
|
||||
if (vflag)
|
||||
printf(", invalid length");
|
||||
break;
|
||||
case NI_QTYPE_SUPTYPES:
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
printf("supported qtypes");
|
||||
i = ntohs(ni6->ni_flags);
|
||||
if (i)
|
||||
printf(" [%s]", (i & 0x01) ? "C" : "");
|
||||
break;
|
||||
case NI_QTYPE_FQDN:
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
printf("DNS name");
|
||||
cp = (const u_char *)(ni6 + 1) + 4;
|
||||
if (cp[0] == ep - cp - 1) {
|
||||
/* icmp-name-lookup-03, pascal string */
|
||||
if (vflag)
|
||||
printf(", 03 draft");
|
||||
cp++;
|
||||
printf(", \"");
|
||||
while (cp < ep) {
|
||||
safeputchar(*cp);
|
||||
cp++;
|
||||
}
|
||||
printf("\"");
|
||||
} else
|
||||
dnsname_print(cp, ep);
|
||||
if ((ntohs(ni6->ni_flags) & 0x01) != 0)
|
||||
printf(" [TTL=%u]", *(u_int32_t *)(ni6 + 1));
|
||||
break;
|
||||
case NI_QTYPE_NODEADDR:
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
printf("node addresses");
|
||||
i = sizeof(*ni6);
|
||||
while (i < siz) {
|
||||
if (i + sizeof(struct in6_addr) + sizeof(int32_t) > siz)
|
||||
break;
|
||||
printf(" %s", getname6(bp + i));
|
||||
i += sizeof(struct in6_addr);
|
||||
printf("(%d)", ntohl(*(int32_t *)(bp + i)));
|
||||
i += sizeof(int32_t);
|
||||
}
|
||||
i = ni6->ni_flags;
|
||||
if (!i)
|
||||
break;
|
||||
printf(" [%s%s%s%s%s%s%s]",
|
||||
(i & NI_NODEADDR_FLAG_ANYCAST) ? "a" : "",
|
||||
(i & NI_NODEADDR_FLAG_GLOBAL) ? "G" : "",
|
||||
(i & NI_NODEADDR_FLAG_SITELOCAL) ? "S" : "",
|
||||
(i & NI_NODEADDR_FLAG_LINKLOCAL) ? "L" : "",
|
||||
(i & NI_NODEADDR_FLAG_COMPAT) ? "C" : "",
|
||||
(i & NI_NODEADDR_FLAG_ALL) ? "A" : "",
|
||||
(i & NI_NODEADDR_FLAG_TRUNCATE) ? "T" : "");
|
||||
break;
|
||||
default:
|
||||
if (needcomma)
|
||||
printf(", ");
|
||||
printf("unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
/*(*/
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
fputs("[|icmp6]", stdout);
|
||||
}
|
||||
|
||||
void
|
||||
icmp6_rrenum_print(int icmp6len, const u_char *bp, const u_char *ep)
|
||||
{
|
||||
struct icmp6_router_renum *rr6;
|
||||
struct icmp6_hdr *dp;
|
||||
size_t siz;
|
||||
const char *cp;
|
||||
struct rr_pco_match *match;
|
||||
struct rr_pco_use *use;
|
||||
char hbuf[NI_MAXHOST];
|
||||
int n;
|
||||
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
rr6 = (struct icmp6_router_renum *)bp;
|
||||
siz = ep - bp;
|
||||
cp = (const char *)(rr6 + 1);
|
||||
|
||||
TCHECK(rr6->rr_reserved);
|
||||
switch (rr6->rr_code) {
|
||||
case ICMP6_ROUTER_RENUMBERING_COMMAND:
|
||||
printf("router renum: command");
|
||||
break;
|
||||
case ICMP6_ROUTER_RENUMBERING_RESULT:
|
||||
printf("router renum: result");
|
||||
break;
|
||||
case ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET:
|
||||
printf("router renum: sequence number reset");
|
||||
break;
|
||||
default:
|
||||
printf("router renum: code-#%d", rr6->rr_code);
|
||||
break;
|
||||
}
|
||||
|
||||
printf(", seq=%u", (u_int32_t)ntohl(rr6->rr_seqnum));
|
||||
|
||||
if (vflag) {
|
||||
#define F(x, y) ((rr6->rr_flags) & (x) ? (y) : "")
|
||||
printf("["); /*]*/
|
||||
if (rr6->rr_flags) {
|
||||
printf("%s%s%s%s%s,", F(ICMP6_RR_FLAGS_TEST, "T"),
|
||||
F(ICMP6_RR_FLAGS_REQRESULT, "R"),
|
||||
F(ICMP6_RR_FLAGS_ALLIF, "A"),
|
||||
F(ICMP6_RR_FLAGS_SPECSITE, "S"),
|
||||
F(ICMP6_RR_FLAGS_PREVDONE, "P"));
|
||||
}
|
||||
printf("seg=%u,", rr6->rr_segnum);
|
||||
printf("maxdelay=%u", rr6->rr_maxdelay);
|
||||
if (rr6->rr_reserved)
|
||||
printf("rsvd=0x%x", (u_int16_t)ntohs(rr6->rr_reserved));
|
||||
/*[*/
|
||||
printf("]");
|
||||
#undef F
|
||||
}
|
||||
|
||||
if (rr6->rr_code == ICMP6_ROUTER_RENUMBERING_COMMAND) {
|
||||
match = (struct rr_pco_match *)cp;
|
||||
cp = (const char *)(match + 1);
|
||||
|
||||
TCHECK(match->rpm_prefix);
|
||||
|
||||
if (vflag)
|
||||
printf("\n\t");
|
||||
else
|
||||
printf(" ");
|
||||
printf("match("); /*)*/
|
||||
switch (match->rpm_code) {
|
||||
case RPM_PCO_ADD: printf("add"); break;
|
||||
case RPM_PCO_CHANGE: printf("change"); break;
|
||||
case RPM_PCO_SETGLOBAL: printf("setglobal"); break;
|
||||
default: printf("#%u", match->rpm_code); break;
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
printf(",ord=%u", match->rpm_ordinal);
|
||||
printf(",min=%u", match->rpm_minlen);
|
||||
printf(",max=%u", match->rpm_maxlen);
|
||||
}
|
||||
if (inet_ntop(AF_INET6, &match->rpm_prefix, hbuf, sizeof(hbuf)))
|
||||
printf(",%s/%u", hbuf, match->rpm_matchlen);
|
||||
else
|
||||
printf(",?/%u", match->rpm_matchlen);
|
||||
/*(*/
|
||||
printf(")");
|
||||
|
||||
n = match->rpm_len - 3;
|
||||
if (n % 4)
|
||||
goto trunc;
|
||||
n /= 4;
|
||||
while (n-- > 0) {
|
||||
use = (struct rr_pco_use *)cp;
|
||||
cp = (const char *)(use + 1);
|
||||
|
||||
TCHECK(use->rpu_prefix);
|
||||
|
||||
if (vflag)
|
||||
printf("\n\t");
|
||||
else
|
||||
printf(" ");
|
||||
printf("use("); /*)*/
|
||||
if (use->rpu_flags) {
|
||||
#define F(x, y) ((use->rpu_flags) & (x) ? (y) : "")
|
||||
printf("%s%s,",
|
||||
F(ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME, "V"),
|
||||
F(ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME, "P"));
|
||||
#undef F
|
||||
}
|
||||
if (vflag) {
|
||||
printf("mask=0x%x,", use->rpu_ramask);
|
||||
printf("raflags=0x%x,", use->rpu_raflags);
|
||||
if (~use->rpu_vltime == 0)
|
||||
printf("vltime=infty,");
|
||||
else
|
||||
printf("vltime=%u,",
|
||||
(u_int32_t)ntohl(use->rpu_vltime));
|
||||
if (~use->rpu_pltime == 0)
|
||||
printf("pltime=infty,");
|
||||
else
|
||||
printf("pltime=%u,",
|
||||
(u_int32_t)ntohl(use->rpu_pltime));
|
||||
}
|
||||
if (inet_ntop(AF_INET6, &use->rpu_prefix, hbuf,
|
||||
sizeof(hbuf)))
|
||||
printf("%s/%u/%u", hbuf, use->rpu_uselen,
|
||||
use->rpu_keeplen);
|
||||
else
|
||||
printf("?/%u/%u", use->rpu_uselen,
|
||||
use->rpu_keeplen);
|
||||
/*(*/
|
||||
printf(")");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
fputs("[|icmp6]", stdout);
|
||||
}
|
||||
|
||||
#endif /* INET6 */
|
||||
|
307
contrib/tcpdump/print-igmp.c
Normal file
307
contrib/tcpdump/print-igmp.c
Normal file
@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.3 2001/01/09 08:01:18 fenner Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
#ifndef IN_CLASSD
|
||||
#define IN_CLASSD(i) (((int32_t)(i) & 0xf0000000) == 0xe0000000)
|
||||
#endif
|
||||
|
||||
/* (following from ipmulti/mrouted/prune.h) */
|
||||
|
||||
/*
|
||||
* The packet format for a traceroute request.
|
||||
*/
|
||||
struct tr_query {
|
||||
u_int tr_src; /* traceroute source */
|
||||
u_int tr_dst; /* traceroute destination */
|
||||
u_int tr_raddr; /* traceroute response address */
|
||||
u_int tr_rttlqid; /* response ttl and qid */
|
||||
};
|
||||
|
||||
#define TR_GETTTL(x) (int)(((x) >> 24) & 0xff)
|
||||
#define TR_GETQID(x) ((x) & 0x00ffffff)
|
||||
|
||||
/*
|
||||
* Traceroute response format. A traceroute response has a tr_query at the
|
||||
* beginning, followed by one tr_resp for each hop taken.
|
||||
*/
|
||||
struct tr_resp {
|
||||
u_int tr_qarr; /* query arrival time */
|
||||
u_int tr_inaddr; /* incoming interface address */
|
||||
u_int tr_outaddr; /* outgoing interface address */
|
||||
u_int tr_rmtaddr; /* parent address in source tree */
|
||||
u_int tr_vifin; /* input packet count on interface */
|
||||
u_int tr_vifout; /* output packet count on interface */
|
||||
u_int tr_pktcnt; /* total incoming packets for src-grp */
|
||||
u_char tr_rproto; /* routing proto deployed on router */
|
||||
u_char tr_fttl; /* ttl required to forward on outvif */
|
||||
u_char tr_smask; /* subnet mask for src addr */
|
||||
u_char tr_rflags; /* forwarding error codes */
|
||||
};
|
||||
|
||||
/* defs within mtrace */
|
||||
#define TR_QUERY 1
|
||||
#define TR_RESP 2
|
||||
|
||||
/* fields for tr_rflags (forwarding error codes) */
|
||||
#define TR_NO_ERR 0
|
||||
#define TR_WRONG_IF 1
|
||||
#define TR_PRUNED 2
|
||||
#define TR_OPRUNED 3
|
||||
#define TR_SCOPED 4
|
||||
#define TR_NO_RTE 5
|
||||
#define TR_NO_FWD 7
|
||||
#define TR_NO_SPACE 0x81
|
||||
#define TR_OLD_ROUTER 0x82
|
||||
|
||||
/* fields for tr_rproto (routing protocol) */
|
||||
#define TR_PROTO_DVMRP 1
|
||||
#define TR_PROTO_MOSPF 2
|
||||
#define TR_PROTO_PIM 3
|
||||
#define TR_PROTO_CBT 4
|
||||
|
||||
/* igmpv3 report types */
|
||||
static struct tok igmpv3report2str[] = {
|
||||
{ 1, "is_in" },
|
||||
{ 2, "is_ex" },
|
||||
{ 3, "to_in" },
|
||||
{ 4, "to_ex" },
|
||||
{ 5, "allow" },
|
||||
{ 6, "block" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
print_mtrace(register const u_char *bp, register u_int len)
|
||||
{
|
||||
register struct tr_query *tr = (struct tr_query *)(bp + 8);
|
||||
|
||||
printf("mtrace %lu: %s to %s reply-to %s",
|
||||
(u_long)TR_GETQID(ntohl(tr->tr_rttlqid)),
|
||||
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
|
||||
ipaddr_string(&tr->tr_raddr));
|
||||
if (IN_CLASSD(ntohl(tr->tr_raddr)))
|
||||
printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid)));
|
||||
}
|
||||
|
||||
static void
|
||||
print_mresp(register const u_char *bp, register u_int len)
|
||||
{
|
||||
register struct tr_query *tr = (struct tr_query *)(bp + 8);
|
||||
|
||||
printf("mresp %lu: %s to %s reply-to %s",
|
||||
(u_long)TR_GETQID(ntohl(tr->tr_rttlqid)),
|
||||
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
|
||||
ipaddr_string(&tr->tr_raddr));
|
||||
if (IN_CLASSD(ntohl(tr->tr_raddr)))
|
||||
printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid)));
|
||||
}
|
||||
|
||||
static void
|
||||
print_igmpv3_report(register const u_char *bp, register u_int len,
|
||||
register const u_char *bp2)
|
||||
{
|
||||
int group, nsrcs, ngroups;
|
||||
register int i, j;
|
||||
|
||||
/* Minimum len is 16, and should be a multiple of 4 */
|
||||
if (len < 16 || len & 0x03) {
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
}
|
||||
TCHECK2(bp[6], 2);
|
||||
ngroups = EXTRACT_16BITS(&bp[6]);
|
||||
(void)printf(", %d group record(s)", ngroups);
|
||||
if (vflag > 0) {
|
||||
/* Print the group records */
|
||||
group = 8;
|
||||
for (i=0; i<ngroups; i++) {
|
||||
if (len < group+8) {
|
||||
(void)printf(" [invalid number of groups]");
|
||||
return;
|
||||
}
|
||||
TCHECK2(bp[group+4], 4);
|
||||
(void)printf(" [gaddr %s", ipaddr_string(&bp[group+4]));
|
||||
(void)printf(" %s", tok2str(igmpv3report2str, " [v3-report-#%d]",
|
||||
bp[group]));
|
||||
nsrcs = EXTRACT_16BITS(&bp[group+2]);
|
||||
/* Check the number of sources and print them */
|
||||
if (len < group+8+(nsrcs<<2)) {
|
||||
(void)printf(" [invalid number of sources %d]", nsrcs);
|
||||
return;
|
||||
}
|
||||
if (vflag == 1)
|
||||
(void)printf(", %d source(s)", nsrcs);
|
||||
else {
|
||||
/* Print the sources */
|
||||
(void)printf(" {");
|
||||
for (j=0; j<nsrcs; j++) {
|
||||
TCHECK2(bp[group+8+(j<<2)], 4);
|
||||
(void)printf(" %s", ipaddr_string(&bp[group+8+(j<<2)]));
|
||||
}
|
||||
(void)printf(" }");
|
||||
}
|
||||
/* Next group record */
|
||||
group += 8 + (nsrcs << 2);
|
||||
(void)printf("]");
|
||||
}
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|igmp]");
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
print_igmpv3_query(register const u_char *bp, register u_int len,
|
||||
register const u_char *bp2)
|
||||
{
|
||||
int nsrcs;
|
||||
register int i;
|
||||
|
||||
(void)printf(" v3");
|
||||
/* Minimum len is 12, and should be a multiple of 4 */
|
||||
if (len < 12 || len & 0x03) {
|
||||
(void)printf(" [invalid len %d]", len);
|
||||
return;
|
||||
}
|
||||
TCHECK2(bp[4], 4);
|
||||
if (EXTRACT_32BITS(&bp[4]) == 0)
|
||||
return;
|
||||
(void)printf(" [gaddr %s", ipaddr_string(&bp[4]));
|
||||
TCHECK2(bp[10], 2);
|
||||
nsrcs = EXTRACT_16BITS(&bp[10]);
|
||||
if (nsrcs > 0) {
|
||||
if (len < 12 + (nsrcs << 2))
|
||||
(void)printf(" [invalid number of sources]");
|
||||
else if (vflag > 1) {
|
||||
(void)printf(" {");
|
||||
for (i=0; i<nsrcs; i++) {
|
||||
TCHECK2(bp[12+(i<<2)], 4);
|
||||
(void)printf(" %s", ipaddr_string(&bp[12+(i<<2)]));
|
||||
}
|
||||
(void)printf(" }");
|
||||
} else
|
||||
(void)printf(", %d source(s)", nsrcs);
|
||||
}
|
||||
(void)printf("]");
|
||||
return;
|
||||
trunc:
|
||||
(void)printf("[|igmp]");
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
igmp_print(register const u_char *bp, register u_int len,
|
||||
register const u_char *bp2)
|
||||
{
|
||||
if (qflag) {
|
||||
(void)printf("igmp");
|
||||
return;
|
||||
}
|
||||
|
||||
TCHECK2(bp[0], 8);
|
||||
switch (bp[0]) {
|
||||
case 0x11:
|
||||
(void)printf("igmp query");
|
||||
if (len >= 12)
|
||||
print_igmpv3_query(bp, len, bp2);
|
||||
else {
|
||||
if (bp[1]) {
|
||||
(void)printf(" v2");
|
||||
if (bp[1] != 100)
|
||||
(void)printf(" [max resp time %d]", bp[1]);
|
||||
} else
|
||||
(void)printf(" v1");
|
||||
if (EXTRACT_32BITS(&bp[4]))
|
||||
(void)printf(" [gaddr %s]", ipaddr_string(&bp[4]));
|
||||
if (len != 8)
|
||||
(void)printf(" [len %d]", len);
|
||||
}
|
||||
break;
|
||||
case 0x12:
|
||||
(void)printf("igmp v1 report %s", ipaddr_string(&bp[4]));
|
||||
if (len != 8)
|
||||
(void)printf(" [len %d]", len);
|
||||
break;
|
||||
case 0x16:
|
||||
(void)printf("igmp v2 report %s", ipaddr_string(&bp[4]));
|
||||
break;
|
||||
case 0x22:
|
||||
(void)printf("igmp v3 report");
|
||||
print_igmpv3_report(bp, len, bp2);
|
||||
break;
|
||||
case 0x17:
|
||||
(void)printf("igmp leave %s", ipaddr_string(&bp[4]));
|
||||
break;
|
||||
case 0x13:
|
||||
(void)printf("igmp dvmrp");
|
||||
if (len < 8)
|
||||
(void)printf(" [len %d]", len);
|
||||
else
|
||||
dvmrp_print(bp, len);
|
||||
break;
|
||||
case 0x14:
|
||||
(void)printf("igmp pimv1");
|
||||
pimv1_print(bp, len);
|
||||
break;
|
||||
case 0x1e:
|
||||
print_mresp(bp, len);
|
||||
break;
|
||||
case 0x1f:
|
||||
print_mtrace(bp, len);
|
||||
break;
|
||||
default:
|
||||
(void)printf("igmp-%d", bp[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
if (vflag && TTEST2(bp[0], len)) {
|
||||
/* Check the IGMP checksum */
|
||||
if (in_cksum((const u_short*)bp, len, 0))
|
||||
printf(" bad igmp cksum %x!", EXTRACT_16BITS(&bp[2]));
|
||||
}
|
||||
return;
|
||||
trunc:
|
||||
fputs("[|igmp]", stdout);
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.11 1999/11/21 09:36:53 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.15 2000/09/29 04:58:40 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,11 +35,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
@ -47,6 +42,7 @@ static const char rcsid[] =
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "igrp.h"
|
||||
#include "ip.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
static void
|
||||
@ -107,8 +103,8 @@ igrp_print(register const u_char *bp, u_int length, register const u_char *bp2)
|
||||
next = EXTRACT_16BITS(&hdr->ig_nx);
|
||||
|
||||
(void)printf(" %s V%d edit=%d AS=%d (%d/%d/%d)",
|
||||
tok2str(op2str, "op-#%d", hdr->ig_op),
|
||||
hdr->ig_v,
|
||||
tok2str(op2str, "op-#%d", IGRP_OP(hdr->ig_vop)),
|
||||
IGRP_V(hdr->ig_vop),
|
||||
hdr->ig_ed,
|
||||
EXTRACT_16BITS(&hdr->ig_as),
|
||||
nint,
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.2.2.1 2000/01/11 06:58:25 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.8 2000/12/13 07:57:05 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
@ -43,13 +43,86 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip6.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ip6.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
/* items outside of rfc2292bis */
|
||||
#ifndef IP6OPT_MINLEN
|
||||
#define IP6OPT_MINLEN 2
|
||||
#endif
|
||||
#ifndef IP6OPT_RTALERT_LEN
|
||||
#define IP6OPT_RTALERT_LEN 4
|
||||
#endif
|
||||
#ifndef IP6OPT_JUMBO_LEN
|
||||
#define IP6OPT_JUMBO_LEN 6
|
||||
#endif
|
||||
#define IP6OPT_HOMEADDR_MINLEN 18
|
||||
#define IP6OPT_BU_MINLEN 10
|
||||
#define IP6OPT_BA_MINLEN 13
|
||||
#define IP6OPT_BR_MINLEN 2
|
||||
#define IP6SOPT_ALTCOA 0x4
|
||||
#define IP6SOPT_ALTCOA_MINLEN 18
|
||||
#define IP6SOPT_UI 0x2
|
||||
#define IP6SOPT_UI_MINLEN 4
|
||||
|
||||
static void ip6_sopt_print(const u_char *, int);
|
||||
|
||||
static void
|
||||
ip6_sopt_print(const u_char *bp, int len)
|
||||
{
|
||||
int i;
|
||||
int optlen;
|
||||
|
||||
for (i = 0; i < len; i += optlen) {
|
||||
switch (bp[i]) {
|
||||
case IP6OPT_PAD1:
|
||||
printf(", pad1");
|
||||
optlen = 1;
|
||||
break;
|
||||
case IP6OPT_PADN:
|
||||
if (len - i < IP6OPT_MINLEN) {
|
||||
printf(", padn: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf(", padn");
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
case IP6SOPT_ALTCOA:
|
||||
if (len - i < IP6SOPT_ALTCOA_MINLEN) {
|
||||
printf(", altcoa: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf(", alt-CoA: %s", ip6addr_string(&bp[i+2]));
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
case IP6SOPT_UI:
|
||||
if (len - i < IP6SOPT_UI_MINLEN) {
|
||||
printf(", ui: trunc");
|
||||
goto trunc;
|
||||
}
|
||||
printf("(ui: 0x%04x) ", ntohs(*(u_int16_t *)&bp[i + 2]));
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
default:
|
||||
if (len - i < IP6OPT_MINLEN) {
|
||||
printf(", sopt_type %d: trunc)", bp[i]);
|
||||
goto trunc;
|
||||
}
|
||||
printf(", sopt_type 0x%02x: len=%d", bp[i], bp[i + 1]);
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[trunc] ");
|
||||
}
|
||||
|
||||
void
|
||||
ip6_opt_print(const u_char *bp, int len)
|
||||
{
|
||||
@ -59,6 +132,7 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
for (i = 0; i < len; i += optlen) {
|
||||
switch (bp[i]) {
|
||||
case IP6OPT_PAD1:
|
||||
printf("(pad1)");
|
||||
optlen = 1;
|
||||
break;
|
||||
case IP6OPT_PADN:
|
||||
@ -66,9 +140,10 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
printf("(padn: trunc)");
|
||||
goto trunc;
|
||||
}
|
||||
printf("(padn)");
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
case IP6OPT_RTALERT:
|
||||
case IP6OPT_ROUTER_ALERT:
|
||||
if (len - i < IP6OPT_RTALERT_LEN) {
|
||||
printf("(rtalert: trunc)");
|
||||
goto trunc;
|
||||
@ -77,7 +152,7 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
printf("(rtalert: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(rtalert: 0x%04x) ", ntohs(*(u_short *)&bp[i + 2]));
|
||||
printf("(rtalert: 0x%04x) ", ntohs(*(u_int16_t *)&bp[i + 2]));
|
||||
optlen = IP6OPT_RTALERT_LEN;
|
||||
break;
|
||||
case IP6OPT_JUMBO:
|
||||
@ -89,15 +164,103 @@ ip6_opt_print(const u_char *bp, int len)
|
||||
printf("(jumbo: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(jumbo: %u) ", (u_int32_t)ntohl(*(u_int *)&bp[i + 2]));
|
||||
printf("(jumbo: %u) ", (u_int32_t)ntohl(*(u_int32_t *)&bp[i + 2]));
|
||||
optlen = IP6OPT_JUMBO_LEN;
|
||||
break;
|
||||
case IP6OPT_HOME_ADDRESS:
|
||||
if (len - i < IP6OPT_HOMEADDR_MINLEN) {
|
||||
printf("(homeaddr: trunc)");
|
||||
goto trunc;
|
||||
}
|
||||
if (bp[i + 1] < IP6OPT_HOMEADDR_MINLEN - 2) {
|
||||
printf("(homeaddr: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(homeaddr: %s", ip6addr_string(&bp[i + 2]));
|
||||
if (bp[i + 1] > IP6OPT_HOMEADDR_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_HOMEADDR_MINLEN],
|
||||
(optlen-IP6OPT_HOMEADDR_MINLEN));
|
||||
}
|
||||
printf(")");
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
case IP6OPT_BINDING_UPDATE:
|
||||
if (len - i < IP6OPT_BU_MINLEN) {
|
||||
printf("(bu: trunc)");
|
||||
goto trunc;
|
||||
}
|
||||
if (bp[i + 1] < IP6OPT_BU_MINLEN - 2) {
|
||||
printf("(bu: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(bu: ");
|
||||
if (bp[i + 2] & 0x80)
|
||||
printf("A");
|
||||
if (bp[i + 2] & 0x40)
|
||||
printf("H");
|
||||
if (bp[i + 2] & 0x20)
|
||||
printf("R");
|
||||
if (bp[i + 2] & 0x10)
|
||||
printf("D");
|
||||
if (bp[i + 2] & 0x0f)
|
||||
printf("res");
|
||||
printf(", prefixlen: %u", bp[i + 3]);
|
||||
printf(", sequence: %u",
|
||||
(u_int16_t)ntohs(*(u_int16_t *)&bp[i + 4]));
|
||||
printf(", lifetime: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 8]));
|
||||
|
||||
optlen = bp[i + 1] + 2;
|
||||
if (bp[i + 1] > IP6OPT_BU_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BU_MINLEN],
|
||||
(optlen - IP6OPT_BU_MINLEN));
|
||||
}
|
||||
printf(")");
|
||||
break;
|
||||
case IP6OPT_BINDING_ACK:
|
||||
if (len - i < IP6OPT_BA_MINLEN) {
|
||||
printf("(ba: trunc)");
|
||||
goto trunc;
|
||||
}
|
||||
if (bp[i + 1] < IP6OPT_BA_MINLEN - 2) {
|
||||
printf("(ba: invalid len %d)", bp[i + 1]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(ba: ");
|
||||
printf("status: %u", bp[i + 2]);
|
||||
printf(", sequence: %u",
|
||||
(u_int16_t)ntohs(*(u_int16_t *)&bp[i + 3]));
|
||||
printf(", lifetime: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 7]));
|
||||
printf(", refresh: %u",
|
||||
(u_int32_t)ntohs(*(u_int32_t *)&bp[i + 11]));
|
||||
|
||||
if (bp[i + 1] > IP6OPT_BA_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BA_MINLEN],
|
||||
(optlen-IP6OPT_BA_MINLEN));
|
||||
}
|
||||
printf(")");
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
case IP6OPT_BINDING_REQ:
|
||||
if (len - i < IP6OPT_BR_MINLEN) {
|
||||
printf("(br: trunc)");
|
||||
goto trunc;
|
||||
}
|
||||
printf("(br");
|
||||
if (bp[i + 1] > IP6OPT_BR_MINLEN - 2) {
|
||||
ip6_sopt_print(&bp[i + IP6OPT_BR_MINLEN],
|
||||
(optlen-IP6OPT_BR_MINLEN));
|
||||
}
|
||||
printf(")");
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
default:
|
||||
if (len - i < IP6OPT_MINLEN) {
|
||||
printf("(type %d: trunc)", bp[i]);
|
||||
goto trunc;
|
||||
}
|
||||
printf("(type 0x%02x: len=%d) ", bp[i], bp[i + 1]);
|
||||
printf("(opt_type 0x%02x: len=%d) ", bp[i], bp[i + 1]);
|
||||
optlen = bp[i + 1] + 2;
|
||||
break;
|
||||
}
|
||||
@ -119,11 +282,11 @@ hbhopt_print(register const u_char *bp)
|
||||
register const u_char *ep;
|
||||
int hbhlen = 0;
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
TCHECK(dp->ip6h_len);
|
||||
hbhlen = (int)((dp->ip6h_len + 1) << 3);
|
||||
TCHECK2(dp, hbhlen);
|
||||
TCHECK2(*dp, hbhlen);
|
||||
printf("HBH ");
|
||||
if (vflag)
|
||||
ip6_opt_print((const u_char *)dp + sizeof(*dp), hbhlen - sizeof(*dp));
|
||||
@ -142,11 +305,11 @@ dstopt_print(register const u_char *bp)
|
||||
register const u_char *ep;
|
||||
int dstoptlen = 0;
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
TCHECK(dp->ip6d_len);
|
||||
dstoptlen = (int)((dp->ip6d_len + 1) << 3);
|
||||
TCHECK2(dp, dstoptlen);
|
||||
TCHECK2(*dp, dstoptlen);
|
||||
printf("DSTOPT ");
|
||||
if (vflag) {
|
||||
ip6_opt_print((const u_char *)dp + sizeof(*dp),
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.2.2.2 2000/01/25 18:31:10 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipcomp.c,v 1.13 2000/12/12 09:58:41 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -34,25 +34,10 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef INET6
|
||||
#include <netinet/ip6.h>
|
||||
#endif
|
||||
|
||||
struct ipcomp {
|
||||
u_int8_t comp_nxt; /* Next Header */
|
||||
u_int8_t comp_flags; /* Length of data, in 32bit */
|
||||
@ -79,14 +64,14 @@ ipcomp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
ipcomp = (struct ipcomp *)bp;
|
||||
cpi = (u_int16_t)ntohs(ipcomp->comp_cpi);
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
if ((u_char *)(ipcomp + 1) >= ep - sizeof(struct ipcomp)) {
|
||||
fputs("[|IPCOMP]", stdout);
|
||||
goto fail;
|
||||
}
|
||||
printf("IPComp(cpi=%u)", cpi);
|
||||
printf("IPComp(cpi=0x%04x)", cpi);
|
||||
|
||||
#if defined(HAVE_LIBZ) && defined(HAVE_ZLIB_H)
|
||||
if (1)
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.8.2.1 2000/01/14 19:19:56 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.26 2000/12/12 09:20:26 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -43,24 +43,10 @@ static const char rcsid[] =
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#ifdef INET6
|
||||
#include <netinet/ip6.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <netdb.h>
|
||||
@ -72,35 +58,47 @@ struct rtentry;
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
#include "ip.h"
|
||||
#ifdef INET6
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SOCKADDR_STORAGE
|
||||
#define sockaddr_storage sockaddr
|
||||
#endif
|
||||
|
||||
static u_char *isakmp_sa_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_p_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_t_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_ke_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_id_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_hash_print __P((struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_nonce_print __P((struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_n_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_d_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_vid_print __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_sub0_print __P((u_char, struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t));
|
||||
static u_char *isakmp_sub_print __P((u_char, struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t));
|
||||
static char *numstr __P((int));
|
||||
static u_char *isakmp_sa_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_p_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_t_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_ke_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_id_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_cert_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_cr_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_sig_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_hash_print(struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_nonce_print(struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_n_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_d_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_vid_print(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_sub0_print(u_char, struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t);
|
||||
static u_char *isakmp_sub_print(u_char, struct isakmp_gen *, u_char *,
|
||||
u_int32_t, u_int32_t, u_int32_t);
|
||||
static char *numstr(int);
|
||||
static void safememcpy(void *, void *, size_t);
|
||||
|
||||
#define MAXINITIATORS 20
|
||||
int ninitiator = 0;
|
||||
@ -122,18 +120,18 @@ static char *npstr[] = {
|
||||
};
|
||||
|
||||
/* isakmp->np */
|
||||
static u_char *(*npfunc[]) __P((struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t)) = {
|
||||
static u_char *(*npfunc[])(struct isakmp_gen *, u_char *, u_int32_t,
|
||||
u_int32_t, u_int32_t) = {
|
||||
NULL,
|
||||
isakmp_sa_print,
|
||||
isakmp_p_print,
|
||||
isakmp_t_print,
|
||||
isakmp_ke_print,
|
||||
isakmp_id_print,
|
||||
NULL,
|
||||
NULL,
|
||||
isakmp_cert_print,
|
||||
isakmp_cr_print,
|
||||
isakmp_hash_print,
|
||||
NULL,
|
||||
isakmp_sig_print,
|
||||
isakmp_nonce_print,
|
||||
isakmp_n_print,
|
||||
isakmp_d_print,
|
||||
@ -202,7 +200,7 @@ cookie_record(cookie_t *in, const u_char *bp2)
|
||||
}
|
||||
|
||||
ip = (struct ip *)bp2;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4:
|
||||
memset(&cookiecache[ninitiator].iaddr, 0,
|
||||
sizeof(cookiecache[ninitiator].iaddr));
|
||||
@ -268,7 +266,7 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
|
||||
|
||||
memset(&ss, 0, sizeof(ss));
|
||||
ip = (struct ip *)bp2;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4:
|
||||
sin = (struct sockaddr_in *)&ss;
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
@ -351,11 +349,11 @@ struct attrmap {
|
||||
static u_char *
|
||||
isakmp_attrmap_print(u_char *p, u_char *ep, struct attrmap *map, size_t nmap)
|
||||
{
|
||||
u_short *q;
|
||||
u_int16_t *q;
|
||||
int totlen;
|
||||
u_int32_t t, v;
|
||||
|
||||
q = (u_short *)p;
|
||||
q = (u_int16_t *)p;
|
||||
if (p[0] & 0x80)
|
||||
totlen = 4;
|
||||
else
|
||||
@ -389,11 +387,11 @@ isakmp_attrmap_print(u_char *p, u_char *ep, struct attrmap *map, size_t nmap)
|
||||
static u_char *
|
||||
isakmp_attr_print(u_char *p, u_char *ep)
|
||||
{
|
||||
u_short *q;
|
||||
u_int16_t *q;
|
||||
int totlen;
|
||||
u_int32_t t;
|
||||
|
||||
q = (u_short *)p;
|
||||
q = (u_int16_t *)p;
|
||||
if (p[0] & 0x80)
|
||||
totlen = 4;
|
||||
else
|
||||
@ -422,43 +420,47 @@ static u_char *
|
||||
isakmp_sa_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi0, u_int32_t proto0)
|
||||
{
|
||||
struct isakmp_pl_sa *p;
|
||||
struct isakmp_pl_sa *p, sa;
|
||||
u_int32_t *q;
|
||||
u_int32_t doi;
|
||||
u_int32_t sit;
|
||||
u_char *cp;
|
||||
u_int32_t doi, sit, ident;
|
||||
u_char *cp, *np;
|
||||
int t;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_SA));
|
||||
|
||||
p = (struct isakmp_pl_sa *)ext;
|
||||
doi = ntohl(p->doi);
|
||||
safememcpy(&sa, ext, sizeof(sa));
|
||||
doi = ntohl(sa.doi);
|
||||
sit = ntohl(sa.sit);
|
||||
if (doi != 1) {
|
||||
printf(" doi=%d", doi);
|
||||
printf(" situation=%u", (u_int32_t)ntohl(p->sit));
|
||||
printf(" situation=%u", (u_int32_t)ntohl(sa.sit));
|
||||
return (u_char *)(p + 1);
|
||||
}
|
||||
|
||||
printf(" doi=ipsec");
|
||||
q = (u_int32_t *)&p->sit;
|
||||
q = (u_int32_t *)&sa.sit;
|
||||
printf(" situation=");
|
||||
t = 0;
|
||||
if (ntohl(*q) & 0x01) {
|
||||
if (sit & 0x01) {
|
||||
printf("identity");
|
||||
t++;
|
||||
}
|
||||
if (ntohl(*q) & 0x02) {
|
||||
if (sit & 0x02) {
|
||||
printf("%ssecrecy", t ? "+" : "");
|
||||
t++;
|
||||
}
|
||||
if (ntohl(*q) & 0x04)
|
||||
if (sit & 0x04)
|
||||
printf("%sintegrity", t ? "+" : "");
|
||||
sit = htonl(*q++);
|
||||
|
||||
if (sit != 0x01)
|
||||
printf(" ident=%u", (u_int32_t)ntohl(*q++));
|
||||
np = (u_char *)ext + sizeof(sa);
|
||||
if (sit != 0x01) {
|
||||
safememcpy(&ident, ext + 1, sizeof(ident));
|
||||
printf(" ident=%u", (u_int32_t)ntohl(ident));
|
||||
np += sizeof(ident);
|
||||
}
|
||||
|
||||
ext = (struct isakmp_gen *)q;
|
||||
ext = (struct isakmp_gen *)np;
|
||||
|
||||
cp = isakmp_sub_print(ISAKMP_NPTYPE_P, ext, ep, phase, doi, proto0);
|
||||
|
||||
@ -469,23 +471,24 @@ static u_char *
|
||||
isakmp_p_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi0, u_int32_t proto0)
|
||||
{
|
||||
struct isakmp_pl_p *p;
|
||||
struct isakmp_pl_p *p, prop;
|
||||
u_char *cp;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_P));
|
||||
|
||||
p = (struct isakmp_pl_p *)ext;
|
||||
safememcpy(&prop, ext, sizeof(prop));
|
||||
printf(" #%d protoid=%s transform=%d",
|
||||
p->p_no, PROTOIDSTR(p->prot_id), p->num_t);
|
||||
if (p->spi_size) {
|
||||
prop.p_no, PROTOIDSTR(prop.prot_id), prop.num_t);
|
||||
if (prop.spi_size) {
|
||||
printf(" spi=");
|
||||
rawprint((caddr_t)(p + 1), p->spi_size);
|
||||
rawprint((caddr_t)(p + 1), prop.spi_size);
|
||||
}
|
||||
|
||||
ext = (struct isakmp_gen *)((u_char *)(p + 1) + p->spi_size);
|
||||
ext = (struct isakmp_gen *)((u_char *)(p + 1) + prop.spi_size);
|
||||
|
||||
cp = isakmp_sub_print(ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
|
||||
p->prot_id);
|
||||
prop.prot_id);
|
||||
|
||||
return cp;
|
||||
}
|
||||
@ -495,12 +498,13 @@ static char *isakmp_p_map[] = {
|
||||
};
|
||||
|
||||
static char *ah_p_map[] = {
|
||||
NULL, "md5", "sha", "1des",
|
||||
NULL, "(reserved)", "md5", "sha", "1des",
|
||||
"sha2-256", "sha2-384", "sha2-512",
|
||||
};
|
||||
|
||||
static char *esp_p_map[] = {
|
||||
NULL, "1des-iv64", "1des", "3des", "rc5", "idea", "cast",
|
||||
"blowfish", "3idea", "1des-iv32", "rc4", "null"
|
||||
"blowfish", "3idea", "1des-iv32", "rc4", "null", "aes"
|
||||
};
|
||||
|
||||
static char *ipcomp_p_map[] = {
|
||||
@ -523,9 +527,10 @@ struct attrmap ipsec_t_map[] = {
|
||||
|
||||
struct attrmap oakley_t_map[] = {
|
||||
{ NULL, 0 },
|
||||
{ "enc", 7, { NULL, "1des", "idea", "blowfish", "rc5",
|
||||
"3des", "cast"}, },
|
||||
{ "hash", 4, { NULL, "md5", "sha1", "tiger", }, },
|
||||
{ "enc", 8, { NULL, "1des", "idea", "blowfish", "rc5",
|
||||
"3des", "cast", "aes", }, },
|
||||
{ "hash", 7, { NULL, "md5", "sha1", "tiger",
|
||||
"sha2-256", "sha2-384", "sha2-512", }, },
|
||||
{ "auth", 6, { NULL, "preshared", "dss", "rsa sig", "rsa enc",
|
||||
"rsa enc revised", }, },
|
||||
{ "group desc", 5, { NULL, "modp768", "modp1024", "EC2N 2^155",
|
||||
@ -548,7 +553,7 @@ static u_char *
|
||||
isakmp_t_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
struct isakmp_pl_t *p;
|
||||
struct isakmp_pl_t *p, t;
|
||||
u_char *cp;
|
||||
char *idstr;
|
||||
struct attrmap *map;
|
||||
@ -558,25 +563,26 @@ isakmp_t_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_T));
|
||||
|
||||
p = (struct isakmp_pl_t *)ext;
|
||||
safememcpy(&t, ext, sizeof(t));
|
||||
|
||||
switch (proto) {
|
||||
case 1:
|
||||
idstr = STR_OR_ID(p->t_id, isakmp_p_map);
|
||||
idstr = STR_OR_ID(t.t_id, isakmp_p_map);
|
||||
map = oakley_t_map;
|
||||
nmap = sizeof(oakley_t_map)/sizeof(oakley_t_map[0]);
|
||||
break;
|
||||
case 2:
|
||||
idstr = STR_OR_ID(p->t_id, ah_p_map);
|
||||
idstr = STR_OR_ID(t.t_id, ah_p_map);
|
||||
map = ipsec_t_map;
|
||||
nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);
|
||||
break;
|
||||
case 3:
|
||||
idstr = STR_OR_ID(p->t_id, esp_p_map);
|
||||
idstr = STR_OR_ID(t.t_id, esp_p_map);
|
||||
map = ipsec_t_map;
|
||||
nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);
|
||||
break;
|
||||
case 4:
|
||||
idstr = STR_OR_ID(p->t_id, ipcomp_p_map);
|
||||
idstr = STR_OR_ID(t.t_id, ipcomp_p_map);
|
||||
map = ipsec_t_map;
|
||||
nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]);
|
||||
break;
|
||||
@ -588,11 +594,11 @@ isakmp_t_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
}
|
||||
|
||||
if (idstr)
|
||||
printf(" #%d id=%s ", p->t_no, idstr);
|
||||
printf(" #%d id=%s ", t.t_no, idstr);
|
||||
else
|
||||
printf(" #%d id=%d ", p->t_no, p->t_id);
|
||||
printf(" #%d id=%d ", t.t_no, t.t_id);
|
||||
cp = (u_char *)(p + 1);
|
||||
ep2 = (u_char *)p + ntohs(ext->len);
|
||||
ep2 = (u_char *)p + ntohs(t.h.len);
|
||||
while (cp < ep && cp < ep2) {
|
||||
if (map && nmap) {
|
||||
cp = isakmp_attrmap_print(cp, (ep < ep2) ? ep : ep2,
|
||||
@ -609,14 +615,17 @@ static u_char *
|
||||
isakmp_ke_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
struct isakmp_gen e;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_KE));
|
||||
|
||||
printf(" key len=%d", ntohs(ext->len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(ext->len)) {
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
printf(" key len=%d", ntohs(e.len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(e.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(ext->len) - 4);
|
||||
rawprint((caddr_t)(ext + 1), ntohs(e.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(ext->len);
|
||||
return (u_char *)ext + ntohs(e.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
@ -624,7 +633,7 @@ isakmp_id_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
#define USE_IPSECDOI_IN_PHASE1 1
|
||||
struct isakmp_pl_id *p;
|
||||
struct isakmp_pl_id *p, id;
|
||||
static char *idtypestr[] = {
|
||||
"IPv4", "IPv4net", "IPv6", "IPv6net",
|
||||
};
|
||||
@ -639,11 +648,12 @@ isakmp_id_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_ID));
|
||||
|
||||
p = (struct isakmp_pl_id *)ext;
|
||||
if (sizeof(*p) < ext->len)
|
||||
safememcpy(&id, ext, sizeof(id));
|
||||
if (sizeof(*p) < id.h.len)
|
||||
data = (u_char *)(p + 1);
|
||||
else
|
||||
data = NULL;
|
||||
len = ntohs(ext->len) - sizeof(*p);
|
||||
len = ntohs(id.h.len) - sizeof(*p);
|
||||
|
||||
#if 0 /*debug*/
|
||||
printf(" [phase=%d doi=%d proto=%d]", phase, doi, proto);
|
||||
@ -653,9 +663,9 @@ isakmp_id_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
case 1:
|
||||
#endif
|
||||
default:
|
||||
printf(" idtype=%s", STR_OR_ID(p->d.id_type, idtypestr));
|
||||
printf(" idtype=%s", STR_OR_ID(id.d.id_type, idtypestr));
|
||||
printf(" doi_data=%u",
|
||||
(u_int32_t)(ntohl(p->d.doi_data) & 0xffffff));
|
||||
(u_int32_t)(ntohl(id.d.doi_data) & 0xffffff));
|
||||
break;
|
||||
|
||||
#ifdef USE_IPSECDOI_IN_PHASE1
|
||||
@ -663,22 +673,26 @@ isakmp_id_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
#endif
|
||||
case 2:
|
||||
{
|
||||
struct ipsecdoi_id *p;
|
||||
struct ipsecdoi_id *p, id;
|
||||
struct protoent *pe;
|
||||
|
||||
p = (struct ipsecdoi_id *)ext;
|
||||
printf(" idtype=%s", STR_OR_ID(p->type, ipsecidtypestr));
|
||||
setprotoent(1);
|
||||
pe = getprotobynumber(p->proto_id);
|
||||
if (pe)
|
||||
printf(" protoid=%s", pe->p_name);
|
||||
else
|
||||
printf(" protoid=%s", PROTOIDSTR(p->proto_id));
|
||||
endprotoent();
|
||||
printf(" port=%d", ntohs(p->port));
|
||||
safememcpy(&id, ext, sizeof(id));
|
||||
printf(" idtype=%s", STR_OR_ID(id.type, ipsecidtypestr));
|
||||
if (id.proto_id) {
|
||||
setprotoent(1);
|
||||
pe = getprotobynumber(id.proto_id);
|
||||
if (pe)
|
||||
printf(" protoid=%s", pe->p_name);
|
||||
endprotoent();
|
||||
} else {
|
||||
/* it DOES NOT mean IPPROTO_IP! */
|
||||
printf(" protoid=%s", "0");
|
||||
}
|
||||
printf(" port=%d", ntohs(id.port));
|
||||
if (!len)
|
||||
break;
|
||||
switch (p->type) {
|
||||
switch (id.type) {
|
||||
case IPSECDOI_ID_IPV4_ADDR:
|
||||
printf(" len=%d %s", len, ipaddr_string(data));
|
||||
len = 0;
|
||||
@ -752,42 +766,113 @@ isakmp_id_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
rawprint((caddr_t)data, len);
|
||||
}
|
||||
}
|
||||
return (u_char *)ext + ntohs(ext->len);
|
||||
return (u_char *)ext + ntohs(id.h.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_cert_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi0, u_int32_t proto0)
|
||||
{
|
||||
struct isakmp_pl_cert *p, cert;
|
||||
static char *certstr[] = {
|
||||
"none", "pkcs7", "pgp", "dns",
|
||||
"x509sign", "x509ke", "kerberos", "crl",
|
||||
"arl", "spki", "x509attr",
|
||||
};
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_CERT));
|
||||
|
||||
p = (struct isakmp_pl_cert *)ext;
|
||||
safememcpy(&cert, ext, sizeof(cert));
|
||||
printf(" len=%d", ntohs(cert.h.len) - 4);
|
||||
printf(" type=%s", STR_OR_ID((cert.encode), certstr));
|
||||
if (2 < vflag && 4 < ntohs(cert.h.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(cert.h.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(cert.h.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_cr_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi0, u_int32_t proto0)
|
||||
{
|
||||
struct isakmp_pl_cert *p, cert;
|
||||
static char *certstr[] = {
|
||||
"none", "pkcs7", "pgp", "dns",
|
||||
"x509sign", "x509ke", "kerberos", "crl",
|
||||
"arl", "spki", "x509attr",
|
||||
};
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_CR));
|
||||
|
||||
p = (struct isakmp_pl_cert *)ext;
|
||||
safememcpy(&cert, ext, sizeof(cert));
|
||||
printf(" len=%d", ntohs(cert.h.len) - 4);
|
||||
printf(" type=%s", STR_OR_ID((cert.encode), certstr));
|
||||
if (2 < vflag && 4 < ntohs(cert.h.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(cert.h.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(cert.h.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_hash_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
struct isakmp_gen e;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_HASH));
|
||||
|
||||
printf(" len=%d", ntohs(ext->len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(ext->len)) {
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
printf(" len=%d", ntohs(e.len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(e.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(ext->len) - 4);
|
||||
rawprint((caddr_t)(ext + 1), ntohs(e.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(ext->len);
|
||||
return (u_char *)ext + ntohs(e.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_sig_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
struct isakmp_gen e;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_SIG));
|
||||
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
printf(" len=%d", ntohs(e.len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(e.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(e.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(e.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_nonce_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
struct isakmp_gen e;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_NONCE));
|
||||
|
||||
printf(" n len=%d", ntohs(ext->len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(ext->len)) {
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
printf(" n len=%d", ntohs(e.len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(e.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(ext->len) - 4);
|
||||
rawprint((caddr_t)(ext + 1), ntohs(e.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(ext->len);
|
||||
return (u_char *)ext + ntohs(e.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi0, u_int32_t proto0)
|
||||
{
|
||||
struct isakmp_pl_n *p;
|
||||
struct isakmp_pl_n *p, n;
|
||||
u_char *cp;
|
||||
u_char *ep2;
|
||||
u_int32_t doi;
|
||||
@ -823,42 +908,43 @@ isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_N));
|
||||
|
||||
p = (struct isakmp_pl_n *)ext;
|
||||
doi = ntohl(p->doi);
|
||||
proto = p->prot_id;
|
||||
safememcpy(&n, ext, sizeof(n));
|
||||
doi = ntohl(n.doi);
|
||||
proto = n.prot_id;
|
||||
if (doi != 1) {
|
||||
printf(" doi=%d", doi);
|
||||
printf(" proto=%d", proto);
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(p->type)));
|
||||
if (p->spi_size) {
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
|
||||
if (n.spi_size) {
|
||||
printf(" spi=");
|
||||
rawprint((caddr_t)(p + 1), p->spi_size);
|
||||
rawprint((caddr_t)(p + 1), n.spi_size);
|
||||
}
|
||||
return (u_char *)(p + 1) + p->spi_size;
|
||||
return (u_char *)(p + 1) + n.spi_size;
|
||||
}
|
||||
|
||||
printf(" doi=ipsec");
|
||||
printf(" proto=%s", PROTOIDSTR(proto));
|
||||
if (ntohs(p->type) < 8192)
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(p->type)));
|
||||
else if (ntohs(p->type) < 16384)
|
||||
printf(" type=%s", IPSECNOTIFYSTR(ntohs(p->type)));
|
||||
else if (ntohs(p->type) < 24576)
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(p->type)));
|
||||
else if (ntohs(p->type) < 40960)
|
||||
printf(" type=%s", IPSECNOTIFYSTR(ntohs(p->type)));
|
||||
if (ntohs(n.type) < 8192)
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
|
||||
else if (ntohs(n.type) < 16384)
|
||||
printf(" type=%s", IPSECNOTIFYSTR(ntohs(n.type)));
|
||||
else if (ntohs(n.type) < 24576)
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
|
||||
else if (ntohs(n.type) < 40960)
|
||||
printf(" type=%s", IPSECNOTIFYSTR(ntohs(n.type)));
|
||||
else
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(p->type)));
|
||||
if (p->spi_size) {
|
||||
printf(" type=%s", NOTIFYSTR(ntohs(n.type)));
|
||||
if (n.spi_size) {
|
||||
printf(" spi=");
|
||||
rawprint((caddr_t)(p + 1), p->spi_size);
|
||||
rawprint((caddr_t)(p + 1), n.spi_size);
|
||||
}
|
||||
|
||||
cp = (u_char *)(p + 1) + p->spi_size;
|
||||
ep2 = (u_char *)p + ntohs(ext->len);
|
||||
cp = (u_char *)(p + 1) + n.spi_size;
|
||||
ep2 = (u_char *)p + ntohs(n.h.len);
|
||||
|
||||
if (cp < ep) {
|
||||
printf(" orig=(");
|
||||
switch (ntohs(p->type)) {
|
||||
switch (ntohs(n.type)) {
|
||||
case IPSECDOI_NTYPE_RESPONDER_LIFETIME:
|
||||
{
|
||||
struct attrmap *map = oakley_t_map;
|
||||
@ -880,19 +966,19 @@ isakmp_n_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
default:
|
||||
/* NULL is dummy */
|
||||
isakmp_print(cp,
|
||||
ntohs(ext->len) - sizeof(*p) - p->spi_size,
|
||||
ntohs(n.h.len) - sizeof(*p) - n.spi_size,
|
||||
NULL);
|
||||
}
|
||||
printf(")");
|
||||
}
|
||||
return (u_char *)ext + ntohs(ext->len);
|
||||
return (u_char *)ext + ntohs(n.h.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
isakmp_d_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi0, u_int32_t proto0)
|
||||
{
|
||||
struct isakmp_pl_d *p;
|
||||
struct isakmp_pl_d *p, d;
|
||||
u_int8_t *q;
|
||||
u_int32_t doi;
|
||||
u_int32_t proto;
|
||||
@ -901,8 +987,9 @@ isakmp_d_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_D));
|
||||
|
||||
p = (struct isakmp_pl_d *)ext;
|
||||
doi = ntohl(p->doi);
|
||||
proto = p->prot_id;
|
||||
safememcpy(&d, ext, sizeof(d));
|
||||
doi = ntohl(d.doi);
|
||||
proto = d.prot_id;
|
||||
if (doi != 1) {
|
||||
printf(" doi=%u", doi);
|
||||
printf(" proto=%u", proto);
|
||||
@ -910,15 +997,15 @@ isakmp_d_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
printf(" doi=ipsec");
|
||||
printf(" proto=%s", PROTOIDSTR(proto));
|
||||
}
|
||||
printf(" spilen=%u", p->spi_size);
|
||||
printf(" nspi=%u", ntohs(p->num_spi));
|
||||
printf(" spilen=%u", d.spi_size);
|
||||
printf(" nspi=%u", ntohs(d.num_spi));
|
||||
printf(" spi=");
|
||||
q = (u_int8_t *)(p + 1);
|
||||
for (i = 0; i < ntohs(p->num_spi); i++) {
|
||||
for (i = 0; i < ntohs(d.num_spi); i++) {
|
||||
if (i != 0)
|
||||
printf(",");
|
||||
rawprint((caddr_t)q, p->spi_size);
|
||||
q += p->spi_size;
|
||||
rawprint((caddr_t)q, d.spi_size);
|
||||
q += d.spi_size;
|
||||
}
|
||||
return q;
|
||||
}
|
||||
@ -927,14 +1014,17 @@ static u_char *
|
||||
isakmp_vid_print(struct isakmp_gen *ext, u_char *ep, u_int32_t phase,
|
||||
u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
struct isakmp_gen e;
|
||||
|
||||
printf("%s:", NPSTR(ISAKMP_NPTYPE_VID));
|
||||
|
||||
printf(" len=%d", ntohs(ext->len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(ext->len)) {
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
printf(" len=%d", ntohs(e.len) - 4);
|
||||
if (2 < vflag && 4 < ntohs(e.len)) {
|
||||
printf(" ");
|
||||
rawprint((caddr_t)(ext + 1), ntohs(ext->len) - 4);
|
||||
rawprint((caddr_t)(ext + 1), ntohs(e.len) - 4);
|
||||
}
|
||||
return (u_char *)ext + ntohs(ext->len);
|
||||
return (u_char *)ext + ntohs(e.len);
|
||||
}
|
||||
|
||||
static u_char *
|
||||
@ -942,14 +1032,16 @@ isakmp_sub0_print(u_char np, struct isakmp_gen *ext, u_char *ep,
|
||||
u_int32_t phase, u_int32_t doi, u_int32_t proto)
|
||||
{
|
||||
u_char *cp;
|
||||
struct isakmp_gen e;
|
||||
|
||||
cp = (u_char *)ext;
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
|
||||
if (NPFUNC(np))
|
||||
cp = (*NPFUNC(np))(ext, ep, phase, doi, proto);
|
||||
else {
|
||||
printf("%s", NPSTR(np));
|
||||
cp += ntohs(ext->len);
|
||||
cp += ntohs(e.len);
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
@ -961,11 +1053,14 @@ isakmp_sub_print(u_char np, struct isakmp_gen *ext, u_char *ep,
|
||||
u_char *cp;
|
||||
static int depth = 0;
|
||||
int i;
|
||||
struct isakmp_gen e;
|
||||
|
||||
cp = (u_char *)ext;
|
||||
|
||||
while (np) {
|
||||
if (ep < (u_char *)ext + ntohs(ext->len)) {
|
||||
safememcpy(&e, ext, sizeof(e));
|
||||
|
||||
if (ep < (u_char *)ext + ntohs(e.len)) {
|
||||
printf(" [|%s]", NPSTR(np));
|
||||
cp = ep + 1;
|
||||
break;
|
||||
@ -979,7 +1074,7 @@ isakmp_sub_print(u_char np, struct isakmp_gen *ext, u_char *ep,
|
||||
printf(")");
|
||||
depth--;
|
||||
|
||||
np = ext->np;
|
||||
np = e.np;
|
||||
ext = (struct isakmp_gen *)cp;
|
||||
}
|
||||
return cp;
|
||||
@ -989,63 +1084,76 @@ static char *
|
||||
numstr(int x)
|
||||
{
|
||||
static char buf[20];
|
||||
sprintf(buf, "#%d", x);
|
||||
snprintf(buf, sizeof(buf), "#%d", x);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* some compiler tries to optimize memcpy(), using the alignment constraint
|
||||
* on the argument pointer type. by using this function, we try to avoid the
|
||||
* optimization.
|
||||
*/
|
||||
static void
|
||||
safememcpy(void *p, void *q, size_t l)
|
||||
{
|
||||
memcpy(p, q, l);
|
||||
}
|
||||
|
||||
void
|
||||
isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
|
||||
{
|
||||
struct isakmp *base;
|
||||
struct isakmp *p, base;
|
||||
u_char *ep;
|
||||
u_char np;
|
||||
int i;
|
||||
int phase;
|
||||
int major, minor;
|
||||
|
||||
base = (struct isakmp *)bp;
|
||||
p = (struct isakmp *)bp;
|
||||
ep = (u_char *)snapend;
|
||||
|
||||
if ((struct isakmp *)ep < base + 1) {
|
||||
if ((struct isakmp *)ep < p + 1) {
|
||||
printf("[|isakmp]");
|
||||
return;
|
||||
}
|
||||
|
||||
safememcpy(&base, p, sizeof(base));
|
||||
|
||||
printf("isakmp");
|
||||
if (vflag) {
|
||||
major = (base->vers & ISAKMP_VERS_MAJOR)
|
||||
major = (base.vers & ISAKMP_VERS_MAJOR)
|
||||
>> ISAKMP_VERS_MAJOR_SHIFT;
|
||||
minor = (base->vers & ISAKMP_VERS_MINOR)
|
||||
minor = (base.vers & ISAKMP_VERS_MINOR)
|
||||
>> ISAKMP_VERS_MINOR_SHIFT;
|
||||
printf(" %d.%d", major, minor);
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
printf(" msgid ");
|
||||
rawprint((caddr_t)&base->msgid, sizeof(base->msgid));
|
||||
rawprint((caddr_t)&base.msgid, sizeof(base.msgid));
|
||||
}
|
||||
|
||||
if (1 < vflag) {
|
||||
printf(" cookie ");
|
||||
rawprint((caddr_t)&base->i_ck, sizeof(base->i_ck));
|
||||
rawprint((caddr_t)&base.i_ck, sizeof(base.i_ck));
|
||||
printf("->");
|
||||
rawprint((caddr_t)&base->r_ck, sizeof(base->r_ck));
|
||||
rawprint((caddr_t)&base.r_ck, sizeof(base.r_ck));
|
||||
}
|
||||
printf(":");
|
||||
|
||||
phase = (*(u_int32_t *)base->msgid == 0) ? 1 : 2;
|
||||
phase = (*(u_int32_t *)base.msgid == 0) ? 1 : 2;
|
||||
if (phase == 1)
|
||||
printf(" phase %d", phase);
|
||||
else
|
||||
printf(" phase %d/others", phase);
|
||||
|
||||
i = cookie_find(&base->i_ck);
|
||||
i = cookie_find(&base.i_ck);
|
||||
if (i < 0) {
|
||||
if (iszero((u_char *)&base->r_ck, sizeof(base->r_ck))) {
|
||||
if (iszero((u_char *)&base.r_ck, sizeof(base.r_ck))) {
|
||||
/* the first packet */
|
||||
printf(" I");
|
||||
if (bp2)
|
||||
cookie_record(&base->i_ck, bp2);
|
||||
cookie_record(&base.i_ck, bp2);
|
||||
} else
|
||||
printf(" ?");
|
||||
} else {
|
||||
@ -1057,10 +1165,10 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
|
||||
printf(" ?");
|
||||
}
|
||||
|
||||
printf(" %s", ETYPESTR(base->etype));
|
||||
if (base->flags) {
|
||||
printf("[%s%s]", base->flags & ISAKMP_FLAG_E ? "E" : "",
|
||||
base->flags & ISAKMP_FLAG_C ? "C" : "");
|
||||
printf(" %s", ETYPESTR(base.etype));
|
||||
if (base.flags) {
|
||||
printf("[%s%s]", base.flags & ISAKMP_FLAG_E ? "E" : "",
|
||||
base.flags & ISAKMP_FLAG_C ? "C" : "");
|
||||
}
|
||||
printf(":");
|
||||
|
||||
@ -1075,28 +1183,28 @@ isakmp_print(const u_char *bp, u_int length, const u_char *bp2)
|
||||
}
|
||||
|
||||
/* regardless of phase... */
|
||||
if (base->flags & ISAKMP_FLAG_E) {
|
||||
if (base.flags & ISAKMP_FLAG_E) {
|
||||
/*
|
||||
* encrypted, nothing we can do right now.
|
||||
* we hope to decrypt the packet in the future...
|
||||
*/
|
||||
printf(" [|%s]", NPSTR(base->np));
|
||||
printf(" [|%s]", NPSTR(base.np));
|
||||
goto done;
|
||||
}
|
||||
|
||||
nparen = 0;
|
||||
CHECKLEN(base + 1, base->np)
|
||||
CHECKLEN(p + 1, base.np)
|
||||
|
||||
np = base->np;
|
||||
ext = (struct isakmp_gen *)(base + 1);
|
||||
np = base.np;
|
||||
ext = (struct isakmp_gen *)(p + 1);
|
||||
isakmp_sub_print(np, ext, ep, phase, 0, 0);
|
||||
}
|
||||
|
||||
done:
|
||||
if (vflag) {
|
||||
if (ntohl(base->len) != length) {
|
||||
if (ntohl(base.len) != length) {
|
||||
printf(" (len mismatch: isakmp %u/ip %d)",
|
||||
(u_int32_t)ntohl(base->len), length);
|
||||
(u_int32_t)ntohl(base.len), length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.12 1999/11/21 09:36:55 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-krb.c,v 1.15 2000/09/29 04:58:42 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,11 +35,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
@ -18,12 +18,12 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* L2TP support contributed by Motonori Shindo (mshindo@ascend.co.jp)
|
||||
* L2TP support contributed by Motonori Shindo (mshindo@mshindo.net)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.6 1999/12/22 06:27:21 itojun Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.8 2000/08/18 07:44:46 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -303,7 +303,7 @@ l2tp_bearer_cap_print(const u_char *dat, u_int length)
|
||||
static void
|
||||
l2tp_tie_breaker_print(const u_char *dat, u_int length)
|
||||
{
|
||||
printf("%lx", *(u_long *)dat); /* XXX */
|
||||
print_octets(dat, 8); /* Tie Break Value is 64bits long */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -592,23 +592,30 @@ l2tp_avp_print(const u_char *dat, u_int length)
|
||||
}
|
||||
ptr++;
|
||||
|
||||
if (ntohs(*ptr)) { /* IETF == 0 */
|
||||
printf("vendor=%04x", ntohs(*ptr));
|
||||
}
|
||||
ptr++;
|
||||
|
||||
if (ntohs(*ptr) < L2TP_MAX_AVP_INDEX) {
|
||||
printf("%s", l2tp_avp[ntohs(*ptr)].name);
|
||||
if (ntohs(*ptr)) {
|
||||
/* Vendor Specific Attribute */
|
||||
printf("VENDOR%04x:", ntohs(*ptr));
|
||||
ptr++;
|
||||
printf("ATTR%04x", ntohs(*ptr));
|
||||
printf("(");
|
||||
if (!hidden) {
|
||||
(l2tp_avp[ntohs(*ptr)].print)
|
||||
((u_char *)ptr+2, len-6);
|
||||
} else {
|
||||
printf("???");
|
||||
}
|
||||
print_octets((u_char *)ptr+2, len-6);
|
||||
printf(")");
|
||||
} else {
|
||||
printf(" invalid AVP %u", ntohs(*ptr));
|
||||
/* IETF-defined Attribute */
|
||||
ptr++;
|
||||
if (ntohs(*ptr) < L2TP_MAX_AVP_INDEX) {
|
||||
printf("%s", l2tp_avp[ntohs(*ptr)].name);
|
||||
printf("(");
|
||||
if (!hidden) {
|
||||
(l2tp_avp[ntohs(*ptr)].print)
|
||||
((u_char *)ptr+2, len-6);
|
||||
} else {
|
||||
printf("???");
|
||||
}
|
||||
printf(")");
|
||||
} else {
|
||||
printf(" invalid AVP %u", ntohs(*ptr));
|
||||
}
|
||||
}
|
||||
|
||||
l2tp_avp_print(dat + len, length - len);
|
||||
@ -705,12 +712,8 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
l2tp_avp_print((u_char *)ptr, length - cnt);
|
||||
}
|
||||
} else {
|
||||
#if 0
|
||||
printf(" {");
|
||||
ppp_hdlc_print((u_char *)ptr, length - cnt);
|
||||
ppp_print((u_char *)ptr, length - cnt);
|
||||
printf("}");
|
||||
#else
|
||||
printf("[hdlc|]");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.2 1999/11/21 09:36:56 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lane.c,v 1.11 2000/12/22 22:45:11 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -34,28 +34,17 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ether.h"
|
||||
#include "lane.h"
|
||||
|
||||
static const u_char *packetp;
|
||||
static const u_char *snapend;
|
||||
|
||||
static inline void
|
||||
lane_print(register const u_char *bp, int length)
|
||||
{
|
||||
@ -123,10 +112,11 @@ lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
extracted_ethertype = 0;
|
||||
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)==0) {
|
||||
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_print((u_char *)ep, length);
|
||||
lane_print((u_char *)ep, length + sizeof(*ep));
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
@ -134,7 +124,8 @@ lane_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen) == 0) {
|
||||
} else if (ether_encap_print(ether_type, p, length, caplen,
|
||||
&extracted_ethertype) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
lane_print((u_char *)ep, length + sizeof(*ep));
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lcp.c,v 1.3 1999/12/15 07:55:42 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lcp.c,v 1.9 2000/10/06 04:23:12 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -32,18 +32,8 @@ static const char rcsid[] =
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -144,7 +134,7 @@ lcp_print(register const u_char *bp, u_int length)
|
||||
|
||||
printf("LCP %s id=0x%x", tok2str(lcpcode2str, "LCP-#%d", lcp_code), lcp_id);
|
||||
|
||||
switch(lcp_code) {
|
||||
switch (lcp_code) {
|
||||
case LCP_CONFREQ:
|
||||
case LCP_CONFACK:
|
||||
case LCP_CONFNAK:
|
||||
@ -181,7 +171,7 @@ lcp_print(register const u_char *bp, u_int length)
|
||||
case LCP_ASYNCMAP:
|
||||
case LCP_MAGICNUM:
|
||||
if (snapend < p+4) return;
|
||||
printf("%#x",ntohl(*(u_long*)p));
|
||||
printf("%#x", (unsigned)ntohl(*(u_long*)p));
|
||||
if (lcpopt_length != 6) printf(" len=%d!",lcpopt_length);
|
||||
break;
|
||||
case LCP_PCOMP:
|
||||
@ -202,7 +192,7 @@ lcp_print(register const u_char *bp, u_int length)
|
||||
case LCP_ECHOREP:
|
||||
case LCP_DISCARD:
|
||||
if (snapend < lcp_data+4) return;
|
||||
printf(" magic=%#x", ntohl(*(u_long *) lcp_data));
|
||||
printf(" magic=%#x", (unsigned)ntohl(*(u_long *) lcp_data));
|
||||
lcp_data +=4;
|
||||
break;
|
||||
case LCP_PROTREJ:
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.2.2.1 2000/01/11 06:58:26 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.5 2000/09/29 04:58:43 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -51,8 +51,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-netbios.c,v 1.13 1999/11/21 09:36:57 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-netbios.c,v 1.17 2000/09/29 04:58:43 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,17 +35,8 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.27 1999/11/21 09:36:58 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.29 2000/09/29 04:58:45 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,9 +35,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
@ -47,6 +44,8 @@ static const char rcsid[] =
|
||||
|
||||
#include "ospf.h"
|
||||
|
||||
#include "ip.h"
|
||||
|
||||
struct bits {
|
||||
u_int32_t bit;
|
||||
const char *str;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.2 1999/11/21 09:36:58 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ospf6.c,v 1.6 2000/09/29 04:58:45 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,9 +35,6 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
@ -71,6 +68,13 @@ static const struct bits ospf6_rla_flag_bits[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct bits ospf6_asla_flag_bits[] = {
|
||||
{ ASLA_FLAG_EXTERNAL, "E" },
|
||||
{ ASLA_FLAG_FWDADDR, "F" },
|
||||
{ ASLA_FLAG_ROUTETAG, "T" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static struct tok type2str[] = {
|
||||
{ OSPF_TYPE_UMD, "umd" },
|
||||
{ OSPF_TYPE_HELLO, "hello" },
|
||||
@ -241,6 +245,8 @@ ospf6_print_lsaprefix(register const struct lsa_prefix *lsapp)
|
||||
lsapp->lsa_p_len);
|
||||
if (lsapp->lsa_p_opt)
|
||||
printf("(opt=%x)", lsapp->lsa_p_opt);
|
||||
if (lsapp->lsa_p_mbz)
|
||||
printf("(mbz=%x)", ntohs(lsapp->lsa_p_mbz)); /* XXX */
|
||||
return sizeof(*lsapp) - 4 + k * 4;
|
||||
|
||||
trunc:
|
||||
@ -254,7 +260,7 @@ ospf6_print_lsaprefix(register const struct lsa_prefix *lsapp)
|
||||
static int
|
||||
ospf6_print_lsa(register const struct lsa *lsap)
|
||||
{
|
||||
register const u_char *ls_end;
|
||||
register const u_char *ls_end, *ls_opt;
|
||||
register const struct rlalink *rlp;
|
||||
#if 0
|
||||
register const struct tos_metric *tosp;
|
||||
@ -270,6 +276,7 @@ ospf6_print_lsa(register const struct lsa *lsap)
|
||||
register const u_int32_t *lp;
|
||||
#endif
|
||||
register int j, k;
|
||||
u_int32_t flags32;
|
||||
|
||||
if (ospf6_print_lshdr(&lsap->ls_hdr))
|
||||
return (1);
|
||||
@ -342,12 +349,51 @@ ospf6_print_lsa(register const struct lsa *lsap)
|
||||
lsapp = lsap->lsa_un.un_inter_ap.inter_ap_prefix;
|
||||
while (lsapp + sizeof(lsapp) <= (struct lsa_prefix *)ls_end) {
|
||||
k = ospf6_print_lsaprefix(lsapp);
|
||||
if (k < 0)
|
||||
if (k)
|
||||
goto trunc;
|
||||
lsapp = (struct lsa_prefix *)(((u_char *)lsapp) + k);
|
||||
}
|
||||
break;
|
||||
case LS_SCOPE_AS | LS_TYPE_ASE:
|
||||
TCHECK(lsap->lsa_un.un_asla.asla_metric);
|
||||
flags32 = ntohl(lsap->lsa_un.un_asla.asla_metric);
|
||||
ospf6_print_bits(ospf6_asla_flag_bits, flags32);
|
||||
printf(" metric %u",
|
||||
ntohl(lsap->lsa_un.un_asla.asla_metric) &
|
||||
ASLA_MASK_METRIC);
|
||||
lsapp = lsap->lsa_un.un_asla.asla_prefix;
|
||||
k = ospf6_print_lsaprefix(lsapp);
|
||||
if (k < 0)
|
||||
goto trunc;
|
||||
if ((ls_opt = (u_char *)(((u_char *)lsapp) + k)) < ls_end) {
|
||||
struct in6_addr *fwdaddr6;
|
||||
|
||||
if ((flags32 & ASLA_FLAG_FWDADDR) != 0) {
|
||||
fwdaddr6 = (struct in6_addr *)ls_opt;
|
||||
TCHECK(*fwdaddr6);
|
||||
printf(" forward %s",
|
||||
ip6addr_string(fwdaddr6));
|
||||
|
||||
ls_opt += sizeof(struct in6_addr);
|
||||
}
|
||||
|
||||
if ((flags32 & ASLA_FLAG_ROUTETAG) != 0) {
|
||||
TCHECK(*(u_int32_t *)ls_opt);
|
||||
printf(" tag %s",
|
||||
ipaddr_string((u_int32_t *)ls_opt));
|
||||
|
||||
ls_opt += sizeof(u_int32_t);
|
||||
}
|
||||
|
||||
if (lsapp->lsa_p_mbz) {
|
||||
TCHECK(*(u_int32_t *)ls_opt);
|
||||
printf(" RefLSID: %s",
|
||||
ipaddr_string((u_int32_t *)ls_opt));
|
||||
|
||||
ls_opt += sizeof(u_int32_t);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case LS_TYPE_SUM_ABR:
|
||||
TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
|
||||
@ -364,36 +410,6 @@ ospf6_print_lsa(register const struct lsa *lsap)
|
||||
}
|
||||
break;
|
||||
|
||||
case LS_TYPE_ASE:
|
||||
TCHECK(lsap->lsa_un.un_nla.nla_mask);
|
||||
printf(" mask %s",
|
||||
ipaddr_string(&lsap->lsa_un.un_asla.asla_mask));
|
||||
|
||||
TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
|
||||
almp = lsap->lsa_un.un_asla.asla_metric;
|
||||
while ((u_char *)almp < ls_end) {
|
||||
register u_int32_t ul;
|
||||
|
||||
TCHECK(almp->asla_tosmetric);
|
||||
ul = ntohl(almp->asla_tosmetric);
|
||||
printf(" type %d tos %d metric %d",
|
||||
(ul & ASLA_FLAG_EXTERNAL) ? 2 : 1,
|
||||
(ul & ASLA_MASK_TOS) >> ASLA_SHIFT_TOS,
|
||||
(ul & ASLA_MASK_METRIC));
|
||||
TCHECK(almp->asla_forward);
|
||||
if (almp->asla_forward.s_addr) {
|
||||
printf(" forward %s",
|
||||
ipaddr_string(&almp->asla_forward));
|
||||
}
|
||||
TCHECK(almp->asla_tag);
|
||||
if (almp->asla_tag.s_addr) {
|
||||
printf(" tag %s",
|
||||
ipaddr_string(&almp->asla_tag));
|
||||
}
|
||||
++almp;
|
||||
}
|
||||
break;
|
||||
|
||||
case LS_TYPE_GROUP:
|
||||
/* Multicast extensions as of 23 July 1991 */
|
||||
mcp = lsap->lsa_un.un_mcla;
|
||||
@ -432,7 +448,7 @@ ospf6_print_lsa(register const struct lsa *lsap)
|
||||
lsapp = llsap->llsa_prefix;
|
||||
for (j = 0; j < ntohl(llsap->llsa_nprefix); j++) {
|
||||
k = ospf6_print_lsaprefix(lsapp);
|
||||
if (k < 0)
|
||||
if (k)
|
||||
goto trunc;
|
||||
lsapp = (struct lsa_prefix *)(((u_char *)lsapp) + k);
|
||||
}
|
||||
@ -455,7 +471,7 @@ ospf6_print_lsa(register const struct lsa *lsap)
|
||||
j < ntohs(lsap->lsa_un.un_intra_ap.intra_ap_nprefix);
|
||||
j++) {
|
||||
k = ospf6_print_lsaprefix(lsapp);
|
||||
if (k < 0)
|
||||
if (k)
|
||||
goto trunc;
|
||||
lsapp = (struct lsa_prefix *)(((u_char *)lsapp) + k);
|
||||
}
|
||||
@ -624,7 +640,7 @@ ospf6_print(register const u_char *bp, register u_int length)
|
||||
/* value. If it's not valid, say so and return */
|
||||
TCHECK(op->ospf6_type);
|
||||
cp = tok2str(type2str, "type%d", op->ospf6_type);
|
||||
printf(" OSPFv%d-%s %d:", op->ospf6_version, cp, length);
|
||||
printf("OSPFv%d-%s %d:", op->ospf6_version, cp, length);
|
||||
if (*cp == 't')
|
||||
return;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.3 1999/12/15 00:23:06 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.12 2000/10/09 02:59:40 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -32,18 +32,8 @@ static const char rcsid[] =
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -51,6 +41,7 @@ struct rtentry;
|
||||
#include "addrtoname.h"
|
||||
#include "ppp.h"
|
||||
#include "ethertype.h"
|
||||
#include "ether.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
/* Codes */
|
||||
@ -83,7 +74,7 @@ enum {
|
||||
PPPOE_RELAY_SID = 0x0110,
|
||||
PPPOE_SERVICE_NAME_ERROR = 0x0201,
|
||||
PPPOE_AC_SYSTEM_ERROR = 0x0202,
|
||||
PPPOE_GENERIC_ERROR = 0x0203,
|
||||
PPPOE_GENERIC_ERROR = 0x0203
|
||||
};
|
||||
|
||||
static struct tok pppoetag2str[] = {
|
||||
@ -110,7 +101,7 @@ pppoe_print(register const u_char *bp, u_int length)
|
||||
const u_char *pppoe_packet, *pppoe_payload;
|
||||
|
||||
eh = (struct ether_header *)packetp;
|
||||
pppoe_packet = packetp+sizeof(struct ether_header);
|
||||
pppoe_packet = packetp+ETHER_HDRLEN;
|
||||
if (pppoe_packet > snapend) {
|
||||
printf("[|pppoe]");
|
||||
return;
|
||||
@ -157,12 +148,12 @@ pppoe_print(register const u_char *bp, u_int length)
|
||||
|
||||
if (pppoe_code) {
|
||||
/* PPP session packets don't contain tags */
|
||||
u_short tag_type = -1, tag_len;
|
||||
u_short tag_type = 0xffff, tag_len;
|
||||
const u_char *p = pppoe_payload;
|
||||
|
||||
/* loop invariant:
|
||||
p points to next tag,
|
||||
tag_type is previous tag or -1 for first iteration
|
||||
tag_type is previous tag or 0xffff for first iteration
|
||||
*/
|
||||
while (tag_type &&
|
||||
p+4 < pppoe_payload + length &&
|
||||
@ -199,6 +190,10 @@ pppoe_print(register const u_char *bp, u_int length)
|
||||
/* p points to next tag */
|
||||
}
|
||||
} else {
|
||||
#if 0
|
||||
/* We now make use of ppp_print() instead, because it has more
|
||||
comprehensive support for PPP. It also gives us a consistent
|
||||
output with other protocols like L2TP. */
|
||||
u_short ptype;
|
||||
if (pppoe_payload[0] & 0x1) {
|
||||
ptype = pppoe_payload[0];
|
||||
@ -219,6 +214,9 @@ pppoe_print(register const u_char *bp, u_int length)
|
||||
lcp_print(pppoe_payload, pppoe_length);
|
||||
else
|
||||
printf("%s ", tok2str(ppptype2str, "proto-0x%x", ptype));
|
||||
#endif
|
||||
printf(" ");
|
||||
ppp_print(pppoe_payload, pppoe_length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
838
contrib/tcpdump/print-radius.c
Normal file
838
contrib/tcpdump/print-radius.c
Normal file
@ -0,0 +1,838 @@
|
||||
/*
|
||||
* Radius printer routines as specified on:
|
||||
*
|
||||
* RFC 2865:
|
||||
* "Remote Authentication Dial In User Service (RADIUS)"
|
||||
*
|
||||
* RFC 2866:
|
||||
* "RADIUS Accounting"
|
||||
*
|
||||
* RFC 2867:
|
||||
* "RADIUS Accounting Modifications for Tunnel Protocol Support"
|
||||
*
|
||||
* RFC 2868:
|
||||
* "RADIUS Attributes for Tunnel Protocol Support"
|
||||
*
|
||||
* RFC 2869:
|
||||
* "RADIUS Extensions"
|
||||
*
|
||||
* Alfredo Andres Omella (aandres@s21sec.com) v0.1 2000/09/15
|
||||
*
|
||||
* TODO: Among other things to print ok MacIntosh and Vendor values
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id: print-radius.c,v 1.5 2000/12/18 08:16:58 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
#define TAM_SIZE(x) (sizeof(x)/sizeof(x[0]) )
|
||||
|
||||
#define PRINT_HEX(bytes_len, ptr_data) \
|
||||
while(bytes_len) \
|
||||
{ \
|
||||
printf("%02X", *ptr_data ); \
|
||||
ptr_data++; \
|
||||
bytes_len--; \
|
||||
}
|
||||
|
||||
|
||||
/* Radius packet codes */
|
||||
#define RADCMD_ACCESS_REQ 1 /* Access-Request */
|
||||
#define RADCMD_ACCESS_ACC 2 /* Access-Accept */
|
||||
#define RADCMD_ACCESS_REJ 3 /* Access-Reject */
|
||||
#define RADCMD_ACCOUN_REQ 4 /* Accounting-Request */
|
||||
#define RADCMD_ACCOUN_RES 5 /* Accounting-Response */
|
||||
#define RADCMD_ACCESS_CHA 11 /* Access-Challenge */
|
||||
#define RADCMD_STATUS_SER 12 /* Status-Server */
|
||||
#define RADCMD_STATUS_CLI 13 /* Status-Client */
|
||||
#define RADCMD_RESERVED 255 /* Reserved */
|
||||
|
||||
|
||||
/********************************/
|
||||
/* Begin Radius Attribute types */
|
||||
/********************************/
|
||||
#define SERV_TYPE 6
|
||||
#define FRM_IPADDR 8
|
||||
#define LOG_IPHOST 14
|
||||
#define LOG_SERVICE 15
|
||||
#define FRM_IPX 23
|
||||
#define SESSION_TIMEOUT 27
|
||||
#define IDLE_TIMEOUT 28
|
||||
#define FRM_ATALK_LINK 37
|
||||
#define FRM_ATALK_NETWORK 38
|
||||
|
||||
#define ACCT_DELAY 41
|
||||
#define ACCT_SESSION_TIME 46
|
||||
|
||||
#define TUNNEL_TYPE 64
|
||||
#define TUNNEL_MEDIUM 65
|
||||
#define TUNNEL_CLIENT_END 66
|
||||
#define TUNNEL_SERVER_END 67
|
||||
#define TUNNEL_PASS 69
|
||||
|
||||
#define ARAP_PASS 70
|
||||
#define ARAP_FEATURES 71
|
||||
|
||||
#define TUNNEL_PRIV_GROUP 81
|
||||
#define TUNNEL_ASSIGN_ID 82
|
||||
#define TUNNEL_PREFERENCE 83
|
||||
|
||||
#define ARAP_CHALLENGE_RESP 84
|
||||
#define ACCT_INT_INTERVAL 85
|
||||
|
||||
#define TUNNEL_CLIENT_AUTH 90
|
||||
#define TUNNEL_SERVER_AUTH 91
|
||||
/********************************/
|
||||
/* End Radius Attribute types */
|
||||
/********************************/
|
||||
|
||||
|
||||
static void print_attr_string(register u_char *, u_int, u_short );
|
||||
static void print_attr_num(register u_char *, u_int, u_short );
|
||||
static void print_attr_address(register u_char *, u_int, u_short);
|
||||
static void print_attr_time(register u_char *, u_int, u_short);
|
||||
static void print_attr_strange(register u_char *, u_int, u_short);
|
||||
|
||||
|
||||
struct radius_hdr { u_int8_t code; /* Radius packet code */
|
||||
u_int8_t id; /* Radius packet id */
|
||||
u_int16_t len; /* Radius total length */
|
||||
u_int8_t auth[16]; /* Authenticator */
|
||||
};
|
||||
|
||||
|
||||
struct radius_attr { u_int8_t type; /* Attribute type */
|
||||
u_int8_t len; /* Attribute length */
|
||||
};
|
||||
|
||||
|
||||
/* Service-Type Attribute standard values */
|
||||
static const char *serv_type[]={ NULL,
|
||||
"Login",
|
||||
"Framed",
|
||||
"Callback Login",
|
||||
"Callback Framed",
|
||||
"Outbound",
|
||||
"Administrative",
|
||||
"NAS Prompt",
|
||||
"Authenticate Only",
|
||||
"Callback NAS Prompt",
|
||||
"Call Check",
|
||||
"Callback Administrative",
|
||||
};
|
||||
|
||||
/* Framed-Protocol Attribute standard values */
|
||||
static const char *frm_proto[]={ NULL,
|
||||
"PPP",
|
||||
"SLIP",
|
||||
"ARAP",
|
||||
"Gandalf proprietary",
|
||||
"Xylogics IPX/SLIP",
|
||||
"X.75 Synchronous",
|
||||
};
|
||||
|
||||
/* Framed-Routing Attribute standard values */
|
||||
static const char *frm_routing[]={ "None",
|
||||
"Send",
|
||||
"Listen",
|
||||
"Send&Listen",
|
||||
};
|
||||
|
||||
/* Framed-Compression Attribute standard values */
|
||||
static const char *frm_comp[]={ "None",
|
||||
"VJ TCP/IP",
|
||||
"IPX",
|
||||
"Stac-LZS",
|
||||
};
|
||||
|
||||
/* Login-Service Attribute standard values */
|
||||
static const char *login_serv[]={ "Telnet",
|
||||
"Rlogin",
|
||||
"TCP Clear",
|
||||
"PortMaster(proprietary)",
|
||||
"LAT",
|
||||
"X.25-PAD",
|
||||
"X.25-T3POS",
|
||||
"Unassigned",
|
||||
"TCP Clear Quiet",
|
||||
};
|
||||
|
||||
|
||||
/* Termination-Action Attribute standard values */
|
||||
static const char *term_action[]={ "Default",
|
||||
"RADIUS-Request",
|
||||
};
|
||||
|
||||
/* NAS-Port-Type Attribute standard values */
|
||||
static const char *nas_port_type[]={ "Async",
|
||||
"Sync",
|
||||
"ISDN Sync",
|
||||
"ISDN Async V.120",
|
||||
"ISDN Async V.110",
|
||||
"Virtual",
|
||||
"PIAFS",
|
||||
"HDLC Clear Channel",
|
||||
"X.25",
|
||||
"X.75",
|
||||
"G.3 Fax",
|
||||
"SDSL",
|
||||
"ADSL-CAP",
|
||||
"ADSL-DMT",
|
||||
"ISDN-DSL",
|
||||
"Ethernet",
|
||||
"xDSL",
|
||||
"Cable",
|
||||
"Wireless - Other",
|
||||
"Wireless - IEEE 802.11",
|
||||
};
|
||||
|
||||
/* Acct-Status-Type Accounting Attribute standard values */
|
||||
static const char *acct_status[]={ NULL,
|
||||
"Start",
|
||||
"Stop",
|
||||
"Interim-Update",
|
||||
"Unassigned",
|
||||
"Unassigned",
|
||||
"Unassigned",
|
||||
"Accounting-On",
|
||||
"Accounting-Off",
|
||||
"Tunnel-Start",
|
||||
"Tunnel-Stop",
|
||||
"Tunnel-Reject",
|
||||
"Tunnel-Link-Start",
|
||||
"Tunnel-Link-Stop",
|
||||
"Tunnel-Link-Reject",
|
||||
"Failed",
|
||||
};
|
||||
|
||||
/* Acct-Authentic Accounting Attribute standard values */
|
||||
static const char *acct_auth[]={ NULL,
|
||||
"RADIUS",
|
||||
"Local",
|
||||
"Remote",
|
||||
};
|
||||
|
||||
/* Acct-Terminate-Cause Accounting Attribute standard values */
|
||||
static const char *acct_term[]={ NULL,
|
||||
"User Request",
|
||||
"Lost Carrier",
|
||||
"Lost Service",
|
||||
"Idle Timeout",
|
||||
"Session Timeout",
|
||||
"Admin Reset",
|
||||
"Admin Reboot",
|
||||
"Port Error",
|
||||
"NAS Error",
|
||||
"NAS Request",
|
||||
"NAS Reboot",
|
||||
"Port Unneeded",
|
||||
"Port Preempted",
|
||||
"Port Suspended",
|
||||
"Service Unavailable",
|
||||
"Callback",
|
||||
"User Error",
|
||||
"Host Request",
|
||||
};
|
||||
|
||||
/* Tunnel-Type Attribute standard values */
|
||||
static const char *tunnel_type[]={ NULL,
|
||||
"PPTP",
|
||||
"L2F",
|
||||
"L2TP",
|
||||
"ATMP",
|
||||
"VTP",
|
||||
"AH",
|
||||
"IP-IP",
|
||||
"MIN-IP-IP",
|
||||
"ESP",
|
||||
"GRE",
|
||||
"DVS",
|
||||
"IP-in-IP Tunneling",
|
||||
};
|
||||
|
||||
/* Tunnel-Medium-Type Attribute standard values */
|
||||
static const char *tunnel_medium[]={ NULL,
|
||||
"IPv4",
|
||||
"IPv6",
|
||||
"NSAP",
|
||||
"HDLC",
|
||||
"BBN 1822",
|
||||
"802",
|
||||
"E.163",
|
||||
"E.164",
|
||||
"F.69",
|
||||
"X.121",
|
||||
"IPX",
|
||||
"Appletalk",
|
||||
"Decnet IV",
|
||||
"Banyan Vines",
|
||||
"E.164 with NSAP subaddress",
|
||||
};
|
||||
|
||||
/* ARAP-Zone-Access Attribute standard values */
|
||||
static const char *arap_zone[]={ NULL,
|
||||
"Only access to dfl zone",
|
||||
"Use zone filter inc.",
|
||||
"Not used",
|
||||
"Use zone filter exc.",
|
||||
};
|
||||
|
||||
static const char *prompt[]={ "No Echo",
|
||||
"Echo",
|
||||
};
|
||||
|
||||
|
||||
struct attrtype { char *name; /* Attribute name */
|
||||
const char **subtypes; /* Standard Values (if any) */
|
||||
u_char siz_subtypes; /* Size of total standard values */
|
||||
u_char first_subtype; /* First standard value is 0 or 1 */
|
||||
void (*print_func)(register u_char *, u_int, u_short );
|
||||
} attr_type[]=
|
||||
{
|
||||
{ NULL, NULL, 0, 0, NULL },
|
||||
{ "User", NULL, 0, 0, print_attr_string },
|
||||
{ "Pass", NULL, 0, 0, NULL },
|
||||
{ "CHAP-Pass", NULL, 0, 0, NULL },
|
||||
{ "NAS_ipaddr", NULL, 0, 0, print_attr_address },
|
||||
{ "NAS_port", NULL, 0, 0, print_attr_num },
|
||||
{ "Service_type", serv_type, TAM_SIZE(serv_type)-1, 1, print_attr_num },
|
||||
{ "Framed_proto", frm_proto, TAM_SIZE(frm_proto)-1, 1, print_attr_num },
|
||||
{ "Framed_ipaddr", NULL, 0, 0, print_attr_address },
|
||||
{ "Framed_ipnet", NULL, 0, 0, print_attr_address },
|
||||
{ "Framed_routing", frm_routing, TAM_SIZE(frm_routing), 0,
|
||||
print_attr_num },
|
||||
{ "Filter_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Framed_mtu", NULL, 0, 0, print_attr_num },
|
||||
{ "Framed_compress", frm_comp, TAM_SIZE(frm_comp), 0, print_attr_num },
|
||||
{ "Login_iphost", NULL, 0, 0, print_attr_address },
|
||||
{ "Login_service", login_serv, TAM_SIZE(login_serv), 0, print_attr_num },
|
||||
{ "Login_TCP_port", NULL, 0, 0, print_attr_num },
|
||||
/*17*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
{ "Reply", NULL, 0, 0, print_attr_string },
|
||||
{ "Callback-number", NULL, 0, 0, print_attr_string },
|
||||
{ "Callback-id", NULL, 0, 0, print_attr_string },
|
||||
/*21*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
{ "Framed_route", NULL, 0, 0, print_attr_string },
|
||||
{ "Framed_ipx_net", NULL, 0, 0, print_attr_num },
|
||||
{ "State", NULL, 0, 0, print_attr_string },
|
||||
{ "Class", NULL, 0, 0, print_attr_string },
|
||||
{ "Vendor_specific", NULL, 0, 0, print_attr_string },
|
||||
{ "Session_timeout", NULL, 0, 0, print_attr_num },
|
||||
{ "Idle_timeout", NULL, 0, 0, print_attr_num },
|
||||
{ "Term_action", term_action, TAM_SIZE(term_action), 0, print_attr_num },
|
||||
{ "Called_station", NULL, 0, 0, print_attr_string },
|
||||
{ "Calling_station", NULL, 0, 0, print_attr_string },
|
||||
{ "NAS_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Proxy_state", NULL, 0, 0, print_attr_string },
|
||||
{ "Login_LAT_service", NULL, 0, 0, print_attr_string },
|
||||
{ "Login_LAT_node", NULL, 0, 0, print_attr_string },
|
||||
{ "Login_LAT_group", NULL, 0, 0, print_attr_string },
|
||||
{ "Framed_atalk_link", NULL, 0, 0, print_attr_num },
|
||||
{ "Framed_atalk_net", NULL, 0, 0, print_attr_num },
|
||||
{ "Framed_atalk_zone", NULL, 0, 0, print_attr_string },
|
||||
{ "Acct_status", acct_status, TAM_SIZE(acct_status)-1, 1, print_attr_num },
|
||||
{ "Acct_delay", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_in_octets", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_out_octets", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_session_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Acct_authentic", acct_auth, TAM_SIZE(acct_auth)-1, 1, print_attr_num },
|
||||
{ "Acct_session_time", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_in_packets", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_out_packets", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_term_cause", acct_term, TAM_SIZE(acct_term)-1, 1, print_attr_num },
|
||||
{ "Acct_multi_session_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Acct_link_count", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_in_giga", NULL, 0, 0, print_attr_num },
|
||||
{ "Acct_out_giga", NULL, 0, 0, print_attr_num },
|
||||
/*54*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
{ "Event_timestamp", NULL, 0, 0, print_attr_time },
|
||||
/*56*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
/*57*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
/*58*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
/*59*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
{ "CHAP_challenge", NULL, 0, 0, print_attr_string },
|
||||
{ "NAS_port_type", nas_port_type, TAM_SIZE(nas_port_type), 0,
|
||||
print_attr_num },
|
||||
{ "Port_limit", NULL, 0, 0, print_attr_num },
|
||||
/*63*/ { "Login_LAT_port", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_type", tunnel_type, TAM_SIZE(tunnel_type)-1, 1, print_attr_num },
|
||||
{ "Tunnel_medium", tunnel_medium, TAM_SIZE(tunnel_medium)-1, 1,
|
||||
print_attr_num },
|
||||
{ "Tunnel_client_end", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_server_end", NULL, 0, 0, print_attr_string },
|
||||
{ "Acct_tunnel_connect", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_pass", NULL, 0, 0, print_attr_string },
|
||||
{ "ARAP_pass", NULL, 0, 0, print_attr_strange },
|
||||
{ "ARAP_feature", NULL, 0, 0, print_attr_strange },
|
||||
/*72*/ { "ARAP_zone_acces", arap_zone, TAM_SIZE(arap_zone)-1, 1,
|
||||
print_attr_num },
|
||||
{ "ARAP_security", NULL, 0, 0, print_attr_string },
|
||||
{ "ARAP_security_data", NULL, 0, 0, print_attr_string },
|
||||
{ "Password_retry", NULL, 0, 0, print_attr_num },
|
||||
{ "Prompt", prompt, TAM_SIZE(prompt), 0, print_attr_num },
|
||||
{ "Connect_info", NULL, 0, 0, print_attr_string },
|
||||
{ "Config_token", NULL, 0, 0, print_attr_string },
|
||||
{ "EAP_msg", NULL, 0, 0, print_attr_string },
|
||||
/*80*/ { "Message_auth", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_priv_group", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_assign_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_pref", NULL, 0, 0, print_attr_num },
|
||||
{ "ARAP_challenge_resp", NULL, 0, 0, print_attr_strange },
|
||||
{ "Acct_interim_interval", NULL, 0, 0, print_attr_num },
|
||||
/*86*/ { "Acct_tunnel_pack_lost", NULL, 0, 0, print_attr_num },
|
||||
{ "NAS_port_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Framed_pool", NULL, 0, 0, print_attr_string },
|
||||
{ "Unassigned", NULL, 0, 0, NULL },
|
||||
{ "Tunnel_client_auth_id", NULL, 0, 0, print_attr_string },
|
||||
{ "Tunnel_server_auth_id", NULL, 0, 0, print_attr_string },
|
||||
/*92*/ { "Unassigned", NULL, 0, 0, NULL },
|
||||
/*93*/ { "Unassigned", NULL, 0, 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* Print an attribute string */
|
||||
/* value pointed by 'data' */
|
||||
/* and 'length' size. */
|
||||
/*****************************/
|
||||
/* Returns nothing. */
|
||||
/*****************************/
|
||||
static void
|
||||
print_attr_string(register u_char *data, u_int length, u_short attr_code )
|
||||
{
|
||||
register u_int i;
|
||||
|
||||
TCHECK2(data[0],length);
|
||||
|
||||
printf("{");
|
||||
switch(attr_code)
|
||||
{
|
||||
case TUNNEL_PASS:
|
||||
if (*data && (*data <=0x1F) )
|
||||
printf("Tag[%d] ",*data);
|
||||
data++;
|
||||
printf("Salt[%d] ",EXTRACT_16BITS(data) );
|
||||
data+=2;
|
||||
length-=2;
|
||||
break;
|
||||
case TUNNEL_CLIENT_END:
|
||||
case TUNNEL_SERVER_END:
|
||||
case TUNNEL_PRIV_GROUP:
|
||||
case TUNNEL_ASSIGN_ID:
|
||||
case TUNNEL_CLIENT_AUTH:
|
||||
case TUNNEL_SERVER_AUTH:
|
||||
if (*data <= 0x1F)
|
||||
{
|
||||
printf("Tag[%d] ",*data);
|
||||
data++;
|
||||
length--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (i=0; i < length ; i++, data++)
|
||||
printf("%c",(*data < 32 || *data > 128) ? '.' : *data );
|
||||
|
||||
printf("}");
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("|radius");
|
||||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
/* Print an attribute numeric */
|
||||
/* value pointed by 'data' */
|
||||
/* and 'length' size. */
|
||||
/******************************/
|
||||
/* Returns nothing. */
|
||||
/******************************/
|
||||
static void
|
||||
print_attr_num(register u_char *data, u_int length, u_short attr_code )
|
||||
{
|
||||
u_int8_t tag;
|
||||
u_int32_t timeout;
|
||||
|
||||
if (length != 4)
|
||||
{
|
||||
printf("{length %u != 4}", length);
|
||||
return;
|
||||
}
|
||||
|
||||
TCHECK2(data[0],4);
|
||||
/* This attribute has standard values */
|
||||
if (attr_type[attr_code].siz_subtypes)
|
||||
{
|
||||
static const char **table;
|
||||
u_int32_t data_value;
|
||||
table = attr_type[attr_code].subtypes;
|
||||
|
||||
if ( (attr_code == TUNNEL_TYPE) || (attr_code == TUNNEL_MEDIUM) )
|
||||
{
|
||||
if (!*data)
|
||||
printf("{Tag[Unused]");
|
||||
else
|
||||
printf("{Tag[%d]", *data);
|
||||
data++;
|
||||
data_value = EXTRACT_24BITS(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
data++;
|
||||
data_value = EXTRACT_32BITS(data);
|
||||
}
|
||||
if ( data_value <= (attr_type[attr_code].siz_subtypes - 1 +
|
||||
attr_type[attr_code].first_subtype) )
|
||||
printf("{%s}",table[data_value]);
|
||||
else
|
||||
printf("{#%d}",data_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(attr_code) /* Be aware of special cases... */
|
||||
{
|
||||
case FRM_IPX:
|
||||
if (EXTRACT_32BITS( data) == 0xFFFFFFFE )
|
||||
printf("{NAS_select}");
|
||||
else
|
||||
printf("{%d}",EXTRACT_32BITS( data) );
|
||||
break;
|
||||
|
||||
case SESSION_TIMEOUT:
|
||||
case IDLE_TIMEOUT:
|
||||
case ACCT_DELAY:
|
||||
case ACCT_SESSION_TIME:
|
||||
case ACCT_INT_INTERVAL:
|
||||
timeout = EXTRACT_32BITS( data);
|
||||
if ( timeout < 60 )
|
||||
printf( "{%02d secs}", timeout);
|
||||
else
|
||||
{
|
||||
if ( timeout < 3600 )
|
||||
printf( "{%02d:%02d min}",
|
||||
timeout / 60, timeout % 60);
|
||||
else
|
||||
printf( "{%02d:%02d:%02d hours}",
|
||||
timeout / 3600, (timeout % 3600) / 60,
|
||||
timeout % 60);
|
||||
}
|
||||
break;
|
||||
|
||||
case FRM_ATALK_LINK:
|
||||
if (EXTRACT_32BITS(data) )
|
||||
printf("{%d}",EXTRACT_32BITS(data) );
|
||||
else
|
||||
printf("{Unnumbered}" );
|
||||
break;
|
||||
|
||||
case FRM_ATALK_NETWORK:
|
||||
if (EXTRACT_32BITS(data) )
|
||||
printf("{%d}",EXTRACT_32BITS(data) );
|
||||
else
|
||||
printf("{NAS_assign}" );
|
||||
break;
|
||||
|
||||
case TUNNEL_PREFERENCE:
|
||||
tag = *data;
|
||||
data++;
|
||||
if (tag == 0)
|
||||
printf("{Tag[Unused] %d}",EXTRACT_24BITS(data) );
|
||||
else
|
||||
printf("{Tag[%d] %d}", tag, EXTRACT_24BITS(data) );
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("{%d}",EXTRACT_32BITS( data) );
|
||||
break;
|
||||
|
||||
} /* switch */
|
||||
|
||||
} /* if-else */
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("|radius}");
|
||||
}
|
||||
|
||||
|
||||
/*****************************/
|
||||
/* Print an attribute IPv4 */
|
||||
/* address value pointed by */
|
||||
/* 'data' and 'length' size. */
|
||||
/*****************************/
|
||||
/* Returns nothing. */
|
||||
/*****************************/
|
||||
static void
|
||||
print_attr_address(register u_char *data, u_int length, u_short attr_code )
|
||||
{
|
||||
if (length != 4)
|
||||
{
|
||||
printf("{length %u != 4}", length);
|
||||
return;
|
||||
}
|
||||
|
||||
TCHECK2(data[0],4);
|
||||
|
||||
switch(attr_code)
|
||||
{
|
||||
case FRM_IPADDR:
|
||||
case LOG_IPHOST:
|
||||
if (EXTRACT_32BITS(data) == 0xFFFFFFFF )
|
||||
printf("{User_select}");
|
||||
else
|
||||
if (EXTRACT_32BITS(data) == 0xFFFFFFFE )
|
||||
printf("{NAS_select}");
|
||||
else
|
||||
printf("{%s}",ipaddr_string(data));
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("{%s}",ipaddr_string(data) );
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("{|radius}");
|
||||
}
|
||||
|
||||
|
||||
/*************************************/
|
||||
/* Print an attribute of 'secs since */
|
||||
/* January 1, 1970 00:00 UTC' value */
|
||||
/* pointed by 'data' and 'length' */
|
||||
/* size. */
|
||||
/*************************************/
|
||||
/* Returns nothing. */
|
||||
/*************************************/
|
||||
static void print_attr_time(register u_char *data, u_int length, u_short attr_code)
|
||||
{
|
||||
time_t attr_time;
|
||||
char string[26];
|
||||
|
||||
if (length != 4)
|
||||
{
|
||||
printf("{length %u != 4}", length);
|
||||
return;
|
||||
}
|
||||
|
||||
TCHECK2(data[0],4);
|
||||
|
||||
attr_time = EXTRACT_32BITS(data);
|
||||
strcpy(string, ctime(&attr_time));
|
||||
/* Get rid of the newline */
|
||||
string[24] = '\0';
|
||||
printf("{%.24s}", string);
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("{|radius}");
|
||||
}
|
||||
|
||||
|
||||
/***********************************/
|
||||
/* Print an attribute of 'strange' */
|
||||
/* data format pointed by 'data' */
|
||||
/* and 'length' size. */
|
||||
/***********************************/
|
||||
/* Returns nothing. */
|
||||
/***********************************/
|
||||
static void print_attr_strange(register u_char *data, u_int length, u_short attr_code)
|
||||
{
|
||||
u_short len_data;
|
||||
|
||||
switch(attr_code)
|
||||
{
|
||||
case ARAP_PASS:
|
||||
if (length != 16)
|
||||
{
|
||||
printf("{length %u != 16}", length);
|
||||
return;
|
||||
}
|
||||
printf("{User_challenge[");
|
||||
TCHECK2(data[0],8);
|
||||
len_data = 8;
|
||||
PRINT_HEX(len_data, data);
|
||||
printf("] User_resp[");
|
||||
TCHECK2(data[0],8);
|
||||
len_data = 8;
|
||||
PRINT_HEX(len_data, data);
|
||||
printf("]}");
|
||||
break;
|
||||
|
||||
case ARAP_FEATURES:
|
||||
if (length != 14)
|
||||
{
|
||||
printf("{length %u != 14}", length);
|
||||
return;
|
||||
}
|
||||
TCHECK2(data[0],1);
|
||||
if (*data)
|
||||
printf("{User_can_change_pass");
|
||||
else
|
||||
printf("{User_cant_change_pass");
|
||||
data++;
|
||||
TCHECK2(data[0],1);
|
||||
printf(" Min_pass_len[%d]",*data);
|
||||
data++;
|
||||
printf(" Pass_created_at[");
|
||||
TCHECK2(data[0],4);
|
||||
len_data = 4;
|
||||
PRINT_HEX(len_data, data);
|
||||
printf("] Pass_expired_in[");
|
||||
TCHECK2(data[0],4);
|
||||
len_data = 4;
|
||||
PRINT_HEX(len_data, data);
|
||||
printf("] Current_time[");
|
||||
len_data = 4;
|
||||
TCHECK2(data[0],4);
|
||||
PRINT_HEX(len_data, data);
|
||||
printf("]}");
|
||||
break;
|
||||
|
||||
case ARAP_CHALLENGE_RESP:
|
||||
if (length < 8)
|
||||
{
|
||||
printf("{length %u != 8}", length);
|
||||
return;
|
||||
}
|
||||
printf("{");
|
||||
TCHECK2(data[0],8);
|
||||
len_data = 8;
|
||||
PRINT_HEX(len_data, data);
|
||||
printf("}");
|
||||
break;
|
||||
}
|
||||
|
||||
trunc:
|
||||
printf("|radius}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
radius_attr_print(register u_char *attr, u_int length)
|
||||
{
|
||||
register const struct radius_attr *rad_attr = (struct radius_attr *)attr;
|
||||
|
||||
if (length < 3)
|
||||
{
|
||||
printf(" [|radius]");
|
||||
return;
|
||||
}
|
||||
|
||||
printf(" Attr[ ");
|
||||
while (length > 0)
|
||||
{
|
||||
if ( rad_attr->len <= length )
|
||||
{
|
||||
if ( !rad_attr->type || (rad_attr->type > (TAM_SIZE(attr_type)-1)) )
|
||||
printf("#%d",rad_attr->type);
|
||||
else
|
||||
{
|
||||
printf(" %s",attr_type[rad_attr->type].name);
|
||||
|
||||
if (rad_attr->len > 2)
|
||||
{
|
||||
if ( attr_type[rad_attr->type].print_func )
|
||||
(*attr_type[rad_attr->type].print_func)(
|
||||
((u_char *)(rad_attr+1)),
|
||||
rad_attr->len - 2, rad_attr->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(" [|radius]");
|
||||
return;
|
||||
}
|
||||
length-=(rad_attr->len);
|
||||
rad_attr = (struct radius_attr *)( ((char *)(rad_attr))+rad_attr->len);
|
||||
}
|
||||
|
||||
printf(" ]");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
radius_print(const u_char *dat, u_int length)
|
||||
{
|
||||
register const struct radius_hdr *rad;
|
||||
register int i;
|
||||
|
||||
i = min(length, snapend - dat) - sizeof(*rad);
|
||||
|
||||
if (i < 0)
|
||||
{
|
||||
printf(" [|radius]");
|
||||
return;
|
||||
}
|
||||
|
||||
rad = (struct radius_hdr *)dat;
|
||||
|
||||
switch (rad->code)
|
||||
{
|
||||
case RADCMD_ACCESS_REQ:
|
||||
printf(" rad-access-req %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_ACCESS_ACC:
|
||||
printf(" rad-access-accept %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_ACCESS_REJ:
|
||||
printf(" rad-access-reject %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_ACCOUN_REQ:
|
||||
printf(" rad-account-req %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_ACCOUN_RES:
|
||||
printf(" rad-account-resp %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_ACCESS_CHA:
|
||||
printf(" rad-access-cha %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_STATUS_SER:
|
||||
printf(" rad-status-serv %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_STATUS_CLI:
|
||||
printf(" rad-status-cli %d", length);
|
||||
break;
|
||||
|
||||
case RADCMD_RESERVED:
|
||||
printf(" rad-reserved %d", length);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" rad-#%d %d", rad->code, length);
|
||||
break;
|
||||
}
|
||||
printf(" [id %d]", rad->id);
|
||||
|
||||
if (i)
|
||||
radius_attr_print( ((u_char *)(rad+1)), i);
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.25 1999/11/21 09:37:00 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.33 2000/10/06 04:23:13 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -34,20 +34,7 @@ static const char rcsid[] =
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#if __STDC__
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#endif
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <pcap.h>
|
||||
#include <stdio.h>
|
||||
@ -56,10 +43,6 @@ struct rtentry;
|
||||
#include "addrtoname.h"
|
||||
#include "interface.h"
|
||||
|
||||
#ifndef AF_NS
|
||||
#define AF_NS 6 /* XEROX NS protocols */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DLT_RAW packet has no header. It contains a raw IP packet.
|
||||
*/
|
||||
@ -83,7 +66,7 @@ raw_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (eflag)
|
||||
printf("ip: ");
|
||||
|
||||
ip_print(p, length);
|
||||
ipN_print(p, length);
|
||||
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.40 1999/11/22 04:24:28 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.47 2000/10/03 04:19:07 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -33,13 +33,10 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
@ -57,6 +54,8 @@ struct rip {
|
||||
#define RIPCMD_POLL 5 /* want info from everybody */
|
||||
#define RIPCMD_POLLENTRY 6 /* poll for entry */
|
||||
|
||||
#define RIP_AUTHLEN 16
|
||||
|
||||
struct rip_netinfo {
|
||||
u_short rip_family;
|
||||
u_short rip_tag;
|
||||
@ -67,23 +66,83 @@ struct rip_netinfo {
|
||||
};
|
||||
|
||||
static void
|
||||
rip_entry_print(register int vers, register const struct rip_netinfo *ni)
|
||||
rip_printblk(const u_char *cp, const u_char *ep)
|
||||
{
|
||||
register u_char *cp, *ep;
|
||||
for (; cp < ep; cp += 2)
|
||||
printf(" %04x", EXTRACT_16BITS(cp));
|
||||
return;
|
||||
}
|
||||
|
||||
if (EXTRACT_16BITS(&ni->rip_family) != AF_INET) {
|
||||
static void
|
||||
rip_entry_print_v1(register int vers, register const struct rip_netinfo *ni)
|
||||
{
|
||||
register u_short family;
|
||||
|
||||
printf(" [family %d:", EXTRACT_16BITS(&ni->rip_family));
|
||||
cp = (u_char *)&ni->rip_tag;
|
||||
ep = (u_char *)&ni->rip_metric + sizeof(ni->rip_metric);
|
||||
for (; cp < ep; cp += 2)
|
||||
printf(" %04x", EXTRACT_16BITS(cp));
|
||||
/* RFC 1058 */
|
||||
family = EXTRACT_16BITS(&ni->rip_family);
|
||||
if (family != AF_INET) {
|
||||
printf(" [family %d:", family);
|
||||
rip_printblk((u_char *)&ni->rip_tag,
|
||||
(u_char *)&ni->rip_metric +
|
||||
sizeof(ni->rip_metric));
|
||||
printf("]");
|
||||
} else if (vers < 2) {
|
||||
/* RFC 1058 */
|
||||
printf(" %s", ipaddr_string(&ni->rip_dest));
|
||||
} else {
|
||||
/* RFC 1723 */
|
||||
return;
|
||||
}
|
||||
if (ni->rip_tag || ni->rip_dest_mask || ni->rip_router) {
|
||||
/* MBZ fields not zero */
|
||||
printf(" [");
|
||||
rip_printblk((u_char *)&ni->rip_family,
|
||||
(u_char *)&ni->rip_metric +
|
||||
sizeof(ni->rip_metric));
|
||||
printf("]");
|
||||
return;
|
||||
}
|
||||
printf(" {%s}(%d)", ipaddr_string(&ni->rip_dest),
|
||||
EXTRACT_32BITS(&ni->rip_metric));
|
||||
}
|
||||
|
||||
static void
|
||||
rip_entry_print_v2(register int vers, register const struct rip_netinfo *ni)
|
||||
{
|
||||
register u_char *p;
|
||||
register u_short family;
|
||||
u_char buf[RIP_AUTHLEN];
|
||||
|
||||
/* RFC 1723 */
|
||||
family = EXTRACT_16BITS(&ni->rip_family);
|
||||
if (family == 0xFFFF) {
|
||||
if (EXTRACT_16BITS(&ni->rip_tag) == 2) {
|
||||
memcpy(buf, &ni->rip_dest, sizeof(buf));
|
||||
buf[sizeof(buf)-1] = '\0';
|
||||
for (p = buf; *p; p++) {
|
||||
if (!isprint(*p))
|
||||
break;
|
||||
}
|
||||
if (!*p) {
|
||||
printf(" [password %s]", buf);
|
||||
} else {
|
||||
printf(" [password: ");
|
||||
rip_printblk((u_char *)&ni->rip_dest,
|
||||
(u_char *)&ni->rip_metric +
|
||||
sizeof(ni->rip_metric));
|
||||
printf("]");
|
||||
}
|
||||
} else {
|
||||
printf(" [auth %d:",
|
||||
EXTRACT_16BITS(&ni->rip_tag));
|
||||
rip_printblk((u_char *)&ni->rip_dest,
|
||||
(u_char *)&ni->rip_metric +
|
||||
sizeof(ni->rip_metric));
|
||||
printf("]");
|
||||
}
|
||||
} else if (family != AF_INET) {
|
||||
printf(" [family %d:", family);
|
||||
rip_printblk((u_char *)&ni->rip_tag,
|
||||
(u_char *)&ni->rip_metric +
|
||||
sizeof(ni->rip_metric));
|
||||
printf("]");
|
||||
return;
|
||||
} else { /* AF_INET */
|
||||
printf(" {%s", ipaddr_string(&ni->rip_dest));
|
||||
if (ni->rip_dest_mask)
|
||||
printf("/%s", ipaddr_string(&ni->rip_dest_mask));
|
||||
@ -91,9 +150,8 @@ rip_entry_print(register int vers, register const struct rip_netinfo *ni)
|
||||
printf("->%s", ipaddr_string(&ni->rip_router));
|
||||
if (ni->rip_tag)
|
||||
printf(" tag %04x", EXTRACT_16BITS(&ni->rip_tag));
|
||||
printf("}");
|
||||
printf("}(%d)", EXTRACT_32BITS(&ni->rip_metric));
|
||||
}
|
||||
printf("(%d)", EXTRACT_32BITS(&ni->rip_metric));
|
||||
}
|
||||
|
||||
void
|
||||
@ -110,56 +168,68 @@ rip_print(const u_char *dat, u_int length)
|
||||
}
|
||||
|
||||
rp = (struct rip *)dat;
|
||||
switch (rp->rip_cmd) {
|
||||
|
||||
case RIPCMD_REQUEST:
|
||||
printf(" rip-req %d", length);
|
||||
break;
|
||||
|
||||
case RIPCMD_RESPONSE:
|
||||
j = length / sizeof(*ni);
|
||||
if (j * sizeof(*ni) != length - 4)
|
||||
printf(" rip-resp %d[%d]:", j, length);
|
||||
else
|
||||
printf(" rip-resp %d:", j);
|
||||
trunc = (i / sizeof(*ni)) != j;
|
||||
ni = (struct rip_netinfo *)(rp + 1);
|
||||
for (; (i -= sizeof(*ni)) >= 0; ++ni)
|
||||
rip_entry_print(rp->rip_vers, ni);
|
||||
if (trunc)
|
||||
printf("[|rip]");
|
||||
break;
|
||||
|
||||
case RIPCMD_TRACEON:
|
||||
printf(" rip-traceon %d: \"", length);
|
||||
(void)fn_print((const u_char *)(rp + 1), snapend);
|
||||
fputs("\"\n", stdout);
|
||||
break;
|
||||
|
||||
case RIPCMD_TRACEOFF:
|
||||
printf(" rip-traceoff %d", length);
|
||||
break;
|
||||
|
||||
case RIPCMD_POLL:
|
||||
printf(" rip-poll %d", length);
|
||||
break;
|
||||
|
||||
case RIPCMD_POLLENTRY:
|
||||
printf(" rip-pollentry %d", length);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" rip-#%d %d", rp->rip_cmd, length);
|
||||
break;
|
||||
}
|
||||
switch (rp->rip_vers) {
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
case 0:
|
||||
/*
|
||||
* RFC 1058.
|
||||
*
|
||||
* XXX - RFC 1058 says
|
||||
*
|
||||
* 0 Datagrams whose version number is zero are to be ignored.
|
||||
* These are from a previous version of the protocol, whose
|
||||
* packet format was machine-specific.
|
||||
*
|
||||
* so perhaps we should just dump the first few words of
|
||||
* the packet, in hex.
|
||||
*/
|
||||
printf(" RIPv0: ");
|
||||
ni = (struct rip_netinfo *)(rp + 1);
|
||||
rip_printblk((u_char *)&ni->rip_family,
|
||||
(u_char *)&ni->rip_metric +
|
||||
sizeof(ni->rip_metric));
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(" [vers %d]", rp->rip_vers);
|
||||
break;
|
||||
switch (rp->rip_cmd) {
|
||||
case RIPCMD_REQUEST:
|
||||
printf(" RIPv%d-req %d", rp->rip_vers, length);
|
||||
break;
|
||||
case RIPCMD_RESPONSE:
|
||||
j = length / sizeof(*ni);
|
||||
if (j * sizeof(*ni) != length - 4)
|
||||
printf(" RIPv%d-resp [items %d] [%d]:",
|
||||
rp->rip_vers, j, length);
|
||||
else
|
||||
printf(" RIPv%d-resp [items %d]:",
|
||||
rp->rip_vers, j);
|
||||
trunc = (i / sizeof(*ni)) != j;
|
||||
ni = (struct rip_netinfo *)(rp + 1);
|
||||
for (; (i -= sizeof(*ni)) >= 0; ++ni) {
|
||||
if (rp->rip_vers == 1)
|
||||
rip_entry_print_v1(rp->rip_vers, ni);
|
||||
else
|
||||
rip_entry_print_v2(rp->rip_vers, ni);
|
||||
}
|
||||
if (trunc)
|
||||
printf("[|rip]");
|
||||
break;
|
||||
case RIPCMD_TRACEON:
|
||||
printf(" RIPv%d-traceon %d: \"", rp->rip_vers, length);
|
||||
(void)fn_print((const u_char *)(rp + 1), snapend);
|
||||
fputs("\"\n", stdout);
|
||||
break;
|
||||
case RIPCMD_TRACEOFF:
|
||||
printf(" RIPv%d-traceoff %d", rp->rip_vers, length);
|
||||
break;
|
||||
case RIPCMD_POLL:
|
||||
printf(" RIPv%d-poll %d", rp->rip_vers, length);
|
||||
break;
|
||||
case RIPCMD_POLLENTRY:
|
||||
printf(" RIPv%d-pollentry %d", rp->rip_vers, length);
|
||||
break;
|
||||
default:
|
||||
printf(" RIPv%d-#%d %d", rp->rip_vers, rp->rip_cmd,
|
||||
length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ripng.c,v 1.2.2.1 2000/01/11 06:58:26 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ripng.c,v 1.7 2000/10/07 05:46:21 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -36,17 +36,10 @@ static const char rcsid[] =
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <netinet/ip6.h>
|
||||
|
||||
#include "route6d.h"
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.3.2.1 2000/01/11 06:58:26 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.17 2000/12/13 07:57:05 itojun Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,21 +35,12 @@ static const char rcsid[] =
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/udp.h>
|
||||
#include <netinet/udp_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <netinet/ip6.h>
|
||||
#include "ip6.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
@ -62,50 +53,53 @@ rt6_print(register const u_char *bp, register const u_char *bp2)
|
||||
register const struct ip6_hdr *ip;
|
||||
register const u_char *ep;
|
||||
int i, len;
|
||||
register const struct in6_addr *addr;
|
||||
|
||||
dp = (struct ip6_rthdr *)bp;
|
||||
ip = (struct ip6_hdr *)bp2;
|
||||
len = dp->ip6r_len;
|
||||
|
||||
/* 'ep' points to the end of avaible data. */
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
printf("%s > %s: ",
|
||||
#if 0
|
||||
printf("%s > %s: ",
|
||||
ip6addr_string(&ip->ip6_src),
|
||||
ip6addr_string(&ip->ip6_dst));
|
||||
#endif
|
||||
|
||||
TCHECK(dp->ip6r_segleft);
|
||||
|
||||
printf("srcrt (len=%d, ", dp->ip6r_len);
|
||||
printf("type=%d, ", dp->ip6r_type);
|
||||
printf("segleft=%d, ", dp->ip6r_segleft);
|
||||
printf("srcrt (len=%d", dp->ip6r_len); /*)*/
|
||||
printf(", type=%d", dp->ip6r_type);
|
||||
printf(", segleft=%d", dp->ip6r_segleft);
|
||||
|
||||
switch(dp->ip6r_type) {
|
||||
switch (dp->ip6r_type) {
|
||||
#ifndef IPV6_RTHDR_TYPE_0
|
||||
#define IPV6_RTHDR_TYPE_0 0
|
||||
#endif
|
||||
case IPV6_RTHDR_TYPE_0:
|
||||
dp0 = (struct ip6_rthdr0 *)dp;
|
||||
|
||||
TCHECK(dp0->ip6r0_reserved);
|
||||
if (dp0->ip6r0_reserved || vflag) {
|
||||
printf("rsv=0x%0x, ",
|
||||
(u_int32_t)ntohl(dp0->ip6r0_reserved));
|
||||
printf(", rsv=0x%0x",
|
||||
(u_int32_t)ntohl(dp0->ip6r0_reserved));
|
||||
}
|
||||
|
||||
if (len % 2 == 1)
|
||||
goto trunc;
|
||||
len >>= 1;
|
||||
addr = &dp0->ip6r0_addr[0];
|
||||
for (i = 0; i < len; i++) {
|
||||
struct in6_addr *addr;
|
||||
|
||||
addr = ((struct in6_addr *)(dp0 + 1)) + i;
|
||||
if ((u_char *)addr > ep - sizeof(*addr))
|
||||
if ((u_char *)(addr + 1) > ep)
|
||||
goto trunc;
|
||||
|
||||
printf("[%d]%s", i, ip6addr_string((u_char *)addr));
|
||||
if (i != len - 1)
|
||||
printf(", ");
|
||||
|
||||
|
||||
printf(", [%d]%s", i, ip6addr_string(addr));
|
||||
addr++;
|
||||
}
|
||||
printf(")");
|
||||
/*(*/
|
||||
printf(") ");
|
||||
return((dp0->ip6r0_len + 1) << 3);
|
||||
break;
|
||||
default:
|
||||
|
File diff suppressed because it is too large
Load Diff
238
contrib/tcpdump/print-sll.c
Normal file
238
contrib/tcpdump/print-sll.c
Normal file
@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.3 2000/12/23 20:49:34 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "ether.h"
|
||||
#include "sll.h"
|
||||
|
||||
const u_char *packetp;
|
||||
const u_char *snapend;
|
||||
|
||||
static inline void
|
||||
sll_print(register const struct sll_header *sllp, u_int length)
|
||||
{
|
||||
u_short halen;
|
||||
|
||||
switch (ntohs(sllp->sll_pkttype)) {
|
||||
|
||||
case LINUX_SLL_HOST:
|
||||
(void)printf("< ");
|
||||
break;
|
||||
|
||||
case LINUX_SLL_BROADCAST:
|
||||
(void)printf("B ");
|
||||
break;
|
||||
|
||||
case LINUX_SLL_MULTICAST:
|
||||
(void)printf("M ");
|
||||
break;
|
||||
|
||||
case LINUX_SLL_OTHERHOST:
|
||||
(void)printf("P ");
|
||||
break;
|
||||
|
||||
case LINUX_SLL_OUTGOING:
|
||||
(void)printf("> ");
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf("? ");
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX - check the link-layer address type value?
|
||||
* For now, we just assume 6 means Ethernet.
|
||||
* XXX - print others as strings of hex?
|
||||
*/
|
||||
halen = ntohs(sllp->sll_halen);
|
||||
if (halen == 6)
|
||||
(void)printf("%s ", etheraddr_string(sllp->sll_addr));
|
||||
|
||||
if (!qflag)
|
||||
(void)printf("%s ", etherproto_string(sllp->sll_protocol));
|
||||
(void)printf("%d: ", length);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' is the points
|
||||
* to the ether header of the packet, 'h->tv' is the timestamp,
|
||||
* 'h->length' is the length of the packet off the wire, and 'h->caplen'
|
||||
* is the number of bytes actually captured.
|
||||
*/
|
||||
void
|
||||
sll_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
{
|
||||
u_int caplen = h->caplen;
|
||||
u_int length = h->len;
|
||||
register const struct sll_header *sllp;
|
||||
u_short pkttype;
|
||||
struct ether_header ehdr;
|
||||
u_short ether_type;
|
||||
u_short extracted_ethertype;
|
||||
|
||||
ts_print(&h->ts);
|
||||
|
||||
if (caplen < SLL_HDR_LEN) {
|
||||
/*
|
||||
* XXX - this "can't happen" because "pcap-linux.c" always
|
||||
* adds this many bytes of header to every packet in a
|
||||
* cooked socket capture.
|
||||
*/
|
||||
printf("[|sll]");
|
||||
goto out;
|
||||
}
|
||||
|
||||
sllp = (const struct sll_header *)p;
|
||||
|
||||
/*
|
||||
* Fake up an Ethernet header for the benefit of printers that
|
||||
* insist on "packetp" pointing to an Ethernet header.
|
||||
*/
|
||||
pkttype = ntohs(sllp->sll_pkttype);
|
||||
|
||||
/* The source address is in the packet header */
|
||||
memcpy(ehdr.ether_shost, sllp->sll_addr, ETHER_ADDR_LEN);
|
||||
|
||||
if (pkttype != LINUX_SLL_OUTGOING) {
|
||||
/*
|
||||
* We received this packet.
|
||||
*
|
||||
* We don't know the destination address, so
|
||||
* we fake it - all 0's except that the
|
||||
* bottommost bit of the bottommost octet
|
||||
* is set for a unicast packet, all 0's except
|
||||
* that the bottommost bit of the uppermost
|
||||
* octet is set for a multicast packet, all
|
||||
* 1's for a broadcast packet.
|
||||
*/
|
||||
if (pkttype == LINUX_SLL_BROADCAST)
|
||||
memset(ehdr.ether_dhost, 0xFF, ETHER_ADDR_LEN);
|
||||
else {
|
||||
memset(ehdr.ether_dhost, 0, ETHER_ADDR_LEN);
|
||||
if (pkttype == LINUX_SLL_MULTICAST)
|
||||
ehdr.ether_dhost[0] = 1;
|
||||
else
|
||||
ehdr.ether_dhost[ETHER_ADDR_LEN-1] = 1;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We sent this packet; we don't know whether it's
|
||||
* broadcast, multicast, or unicast, so just make
|
||||
* the destination address all 0's.
|
||||
*/
|
||||
memset(ehdr.ether_dhost, 0, ETHER_ADDR_LEN);
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
sll_print(sllp, length);
|
||||
|
||||
/*
|
||||
* Some printers want to get back at the ethernet addresses,
|
||||
* and/or check that they're not walking off the end of the packet.
|
||||
* Rather than pass them all the way down, we set these globals.
|
||||
*/
|
||||
snapend = p + caplen;
|
||||
/*
|
||||
* Actually, the only printers that use packetp are print-arp.c
|
||||
* and print-bootp.c, and they assume that packetp points to an
|
||||
* Ethernet header. The right thing to do is to fix them to know
|
||||
* which link type is in use when they excavate. XXX
|
||||
*/
|
||||
packetp = (u_char *)&ehdr;
|
||||
|
||||
length -= SLL_HDR_LEN;
|
||||
caplen -= SLL_HDR_LEN;
|
||||
p += SLL_HDR_LEN;
|
||||
|
||||
ether_type = ntohs(sllp->sll_protocol);
|
||||
|
||||
/*
|
||||
* Is it (gag) an 802.3 encapsulation, or some non-Ethernet
|
||||
* packet type?
|
||||
*/
|
||||
extracted_ethertype = 0;
|
||||
if (ether_type <= ETHERMTU) {
|
||||
/*
|
||||
* Yes - what type is it?
|
||||
*/
|
||||
switch (ether_type) {
|
||||
|
||||
case LINUX_SLL_P_802_2:
|
||||
/*
|
||||
* 802.2.
|
||||
* Try to print the LLC-layer header & higher layers.
|
||||
*/
|
||||
if (llc_print(p, length, caplen, ESRC(&ehdr),
|
||||
EDST(&ehdr), &extracted_ethertype) == 0)
|
||||
goto unknown; /* unknown LLC type */
|
||||
break;
|
||||
|
||||
default:
|
||||
unknown:
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
sll_print(sllp, length + SLL_HDR_LEN);
|
||||
if (extracted_ethertype) {
|
||||
printf("(LLC %s) ",
|
||||
etherproto_string(htons(extracted_ethertype)));
|
||||
}
|
||||
if (!xflag && !qflag)
|
||||
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 (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
if (xflag)
|
||||
default_print(p, caplen);
|
||||
out:
|
||||
putchar('\n');
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.3.2.1 2000/01/11 06:58:27 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.7 2000/12/05 06:42:47 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -719,6 +719,8 @@ void nbt_tcp_print(const uchar *data,int length)
|
||||
printf("flags=0x%x\n", flags);
|
||||
case 0:
|
||||
data = fdata(data,"NBT Session Packet\nFlags=[rw]\nLength=[rd]\n",data+4);
|
||||
if (data == NULL)
|
||||
break;
|
||||
if (memcmp(data,"\377SMB",4)==0) {
|
||||
if (nbt_len>PTR_DIFF(maxbuf,data))
|
||||
printf("WARNING: Short packet. Try increasing the snap length (%ld)\n",
|
||||
@ -789,15 +791,14 @@ void nbt_udp137_print(const uchar *data, int length)
|
||||
int ancount = RSVAL(data,6);
|
||||
int nscount = RSVAL(data,8);
|
||||
int arcount = RSVAL(data,10);
|
||||
char des[1024];
|
||||
char *opcodestr="OPUNKNOWN";
|
||||
char *opcodestr;
|
||||
const char *p;
|
||||
|
||||
startbuf = data;
|
||||
|
||||
if (maxbuf <= data) return;
|
||||
|
||||
strcpy(des,"\n>>> NBT UDP PACKET(137): ");
|
||||
printf("\n>>> NBT UDP PACKET(137): ");
|
||||
|
||||
switch (opcode) {
|
||||
case 0: opcodestr = "QUERY"; break;
|
||||
@ -806,27 +807,26 @@ void nbt_udp137_print(const uchar *data, int length)
|
||||
case 7: opcodestr = "WACK"; break;
|
||||
case 8: opcodestr = "REFRESH(8)"; break;
|
||||
case 9: opcodestr = "REFRESH"; break;
|
||||
default: opcodestr = "OPUNKNOWN"; break;
|
||||
}
|
||||
strcat(des,opcodestr);
|
||||
printf("%s", opcodestr);
|
||||
if (response) {
|
||||
if (rcode)
|
||||
strcat(des,"; NEGATIVE");
|
||||
printf("; NEGATIVE");
|
||||
else
|
||||
strcat(des,"; POSITIVE");
|
||||
printf("; POSITIVE");
|
||||
}
|
||||
|
||||
if (response)
|
||||
strcat(des,"; RESPONSE");
|
||||
printf("; RESPONSE");
|
||||
else
|
||||
strcat(des,"; REQUEST");
|
||||
printf("; REQUEST");
|
||||
|
||||
if (nm_flags&1)
|
||||
strcat(des,"; BROADCAST");
|
||||
printf("; BROADCAST");
|
||||
else
|
||||
strcat(des,"; UNICAST");
|
||||
printf("; UNICAST");
|
||||
|
||||
printf("%s", des);
|
||||
|
||||
if (vflag == 0) return;
|
||||
|
||||
printf("\nTrnID=0x%X\nOpCode=%d\nNmFlags=0x%X\nRcode=%d\nQueryCount=%d\nAnswerCount=%d\nAuthorityCount=%d\nAddressRecCount=%d\n",
|
||||
@ -847,6 +847,8 @@ void nbt_udp137_print(const uchar *data, int length)
|
||||
printf("QuestionRecords:\n");
|
||||
for (i=0;i<qdcount;i++)
|
||||
p = fdata(p,"|Name=[n1]\nQuestionType=[rw]\nQuestionClass=[rw]\n#",maxbuf);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (total) {
|
||||
@ -855,30 +857,39 @@ void nbt_udp137_print(const uchar *data, int length)
|
||||
int rdlen;
|
||||
int restype;
|
||||
p = fdata(p,"Name=[n1]\n#",maxbuf);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
restype = RSVAL(p,0);
|
||||
p = fdata(p,"ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n",p+8);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
rdlen = RSVAL(p,0);
|
||||
printf("ResourceLength=%d\nResourceData=\n",rdlen);
|
||||
p += 2;
|
||||
if (rdlen == 6) {
|
||||
p = fdata(p,"AddrType=[rw]\nAddress=[b.b.b.b]\n",p+rdlen);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
} else {
|
||||
if (restype == 0x21) {
|
||||
int numnames = CVAL(p,0);
|
||||
p = fdata(p,"NumNames=[B]\n",p+1);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
while (numnames--) {
|
||||
char flags[128]="";
|
||||
p = fdata(p,"Name=[n2]\t#",maxbuf);
|
||||
if (p[0] & 0x80) strcat(flags,"<GROUP> ");
|
||||
if ((p[0] & 0x60) == 0x00) strcat(flags,"B ");
|
||||
if ((p[0] & 0x60) == 0x20) strcat(flags,"P ");
|
||||
if ((p[0] & 0x60) == 0x40) strcat(flags,"M ");
|
||||
if ((p[0] & 0x60) == 0x60) strcat(flags,"_ ");
|
||||
if (p[0] & 0x10) strcat(flags,"<DEREGISTERING> ");
|
||||
if (p[0] & 0x08) strcat(flags,"<CONFLICT> ");
|
||||
if (p[0] & 0x04) strcat(flags,"<ACTIVE> ");
|
||||
if (p[0] & 0x02) strcat(flags,"<PERMANENT> ");
|
||||
printf("%s\n",flags);
|
||||
if (p[0] & 0x80) printf("<GROUP> ");
|
||||
switch (p[0] & 0x60) {
|
||||
case 0x00: printf("B "); break;
|
||||
case 0x20: printf("P "); break;
|
||||
case 0x40: printf("M "); break;
|
||||
case 0x60: printf("_ "); break;
|
||||
}
|
||||
if (p[0] & 0x10) printf("<DEREGISTERING> ");
|
||||
if (p[0] & 0x08) printf("<CONFLICT> ");
|
||||
if (p[0] & 0x04) printf("<ACTIVE> ");
|
||||
if (p[0] & 0x02) printf("<PERMANENT> ");
|
||||
printf("\n");
|
||||
p += 2;
|
||||
}
|
||||
} else {
|
||||
@ -894,6 +905,7 @@ void nbt_udp137_print(const uchar *data, int length)
|
||||
fdata(p,"AdditionalData:\n",maxbuf);
|
||||
}
|
||||
|
||||
out:
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
@ -911,7 +923,8 @@ void nbt_udp138_print(const uchar *data, int length)
|
||||
|
||||
data = fdata(data,"\n>>> NBT UDP PACKET(138) Res=[rw] ID=[rw] IP=[b.b.b.b] Port=[rd] Length=[rd] Res2=[rw]\nSourceName=[n1]\nDestName=[n1]\n#",maxbuf);
|
||||
|
||||
print_smb(data,maxbuf);
|
||||
if (data != NULL)
|
||||
print_smb(data,maxbuf);
|
||||
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
@ -922,15 +935,24 @@ void nbt_udp138_print(const uchar *data, int length)
|
||||
/*
|
||||
print netbeui frames
|
||||
*/
|
||||
void netbeui_print(const uchar *data, const uchar *maxbuf)
|
||||
void netbeui_print(u_short control, const uchar *data, const uchar *maxbuf)
|
||||
{
|
||||
int len = SVAL(data,1);
|
||||
int command = CVAL(data,5);
|
||||
const uchar *data2 = data + 1 + len;
|
||||
int len = SVAL(data,0);
|
||||
int command = CVAL(data,4);
|
||||
const uchar *data2 = data + len;
|
||||
int is_truncated = 0;
|
||||
|
||||
if (data2 >= maxbuf) {
|
||||
data2 = maxbuf;
|
||||
is_truncated = 1;
|
||||
}
|
||||
|
||||
startbuf = data;
|
||||
|
||||
data = fdata(data,"\n>>> NetBeui Packet\nType=[B] Length=[d] Signature=[w] Command=[B]\n#",maxbuf);
|
||||
printf("\n>>> NetBeui Packet\nType=0x%X ", control);
|
||||
data = fdata(data,"Length=[d] Signature=[w] Command=[B]\n#",maxbuf);
|
||||
if (data == NULL)
|
||||
goto out;
|
||||
|
||||
switch (command) {
|
||||
case 0xA:
|
||||
@ -965,16 +987,29 @@ void netbeui_print(const uchar *data, const uchar *maxbuf)
|
||||
data = fdata(data,"SessionEnd:\n[P1]Data2=[w][P4]\nRemoteSessionNumber=[B]\nLocalSessionNumber=[B]\n",data2);
|
||||
break;
|
||||
|
||||
case 0x1f:
|
||||
data = fdata(data,"SessionAlive\n",data2);
|
||||
break;
|
||||
|
||||
default:
|
||||
data = fdata(data,"Unknown Netbios Command ",data2);
|
||||
break;
|
||||
}
|
||||
if (data == NULL)
|
||||
goto out;
|
||||
|
||||
if (is_truncated) {
|
||||
/* data2 was past the end of the buffer */
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (memcmp(data2,"\377SMB",4)==0) {
|
||||
print_smb(data2,maxbuf);
|
||||
} else {
|
||||
int i;
|
||||
for (i=0;i<128;i++) {
|
||||
if (&data2[i] >= maxbuf)
|
||||
break;
|
||||
if (memcmp(&data2[i],"\377SMB",4)==0) {
|
||||
printf("found SMB packet at %d\n", i);
|
||||
print_smb(&data2[i],maxbuf);
|
||||
@ -983,6 +1018,7 @@ void netbeui_print(const uchar *data, const uchar *maxbuf)
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@ -998,7 +1034,8 @@ void ipx_netbios_print(const uchar *data, const uchar *maxbuf)
|
||||
for (i=0;i<128;i++)
|
||||
if (memcmp(&data[i],"\377SMB",4)==0) {
|
||||
fdata(data,"\n>>> IPX transport ",&data[i]);
|
||||
print_smb(&data[i],maxbuf);
|
||||
if (data != NULL)
|
||||
print_smb(&data[i],maxbuf);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
break;
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.39 1999/12/22 06:27:22 itojun Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.44 2000/11/10 17:34:10 fenner Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -56,9 +56,6 @@ static const char rcsid[] =
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -188,7 +185,8 @@ char *ErrorStatus[] = {
|
||||
};
|
||||
#define DECODE_ErrorStatus(e) \
|
||||
( e >= 0 && e < sizeof(ErrorStatus)/sizeof(ErrorStatus[0]) \
|
||||
? ErrorStatus[e] : (sprintf(errbuf, "err=%u", e), errbuf))
|
||||
? ErrorStatus[e] \
|
||||
: (snprintf(errbuf, sizeof(errbuf), "err=%u", e), errbuf))
|
||||
|
||||
/*
|
||||
* generic-trap values in the SNMP Trap-PDU
|
||||
@ -205,7 +203,8 @@ char *GenericTrap[] = {
|
||||
};
|
||||
#define DECODE_GenericTrap(t) \
|
||||
( t >= 0 && t < sizeof(GenericTrap)/sizeof(GenericTrap[0]) \
|
||||
? GenericTrap[t] : (sprintf(buf, "gt=%d", t), buf))
|
||||
? GenericTrap[t] \
|
||||
: (snprintf(buf, sizeof(buf), "gt=%d", t), buf))
|
||||
|
||||
/*
|
||||
* ASN.1 type class table
|
||||
@ -429,13 +428,13 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
|
||||
elem->form = form;
|
||||
elem->class = class;
|
||||
elem->id = id;
|
||||
if (vflag)
|
||||
if (vflag > 1)
|
||||
printf("|%.2x", *p);
|
||||
p++; len--; hdr = 1;
|
||||
/* extended tag field */
|
||||
if (id == ASN_ID_EXT) {
|
||||
for (id = 0; *p & ASN_BIT8 && len > 0; len--, hdr++, p++) {
|
||||
if (vflag)
|
||||
if (vflag > 1)
|
||||
printf("|%.2x", *p);
|
||||
id = (id << 7) | (*p & ~ASN_BIT8);
|
||||
}
|
||||
@ -453,7 +452,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
|
||||
return -1;
|
||||
}
|
||||
elem->asnlen = *p;
|
||||
if (vflag)
|
||||
if (vflag > 1)
|
||||
printf("|%.2x", *p);
|
||||
p++; len--; hdr++;
|
||||
if (elem->asnlen & ASN_BIT8) {
|
||||
@ -464,7 +463,7 @@ asn1_parse(register const u_char *p, u_int len, struct be *elem)
|
||||
return -1;
|
||||
}
|
||||
for (; noct-- > 0; len--, hdr++) {
|
||||
if (vflag)
|
||||
if (vflag > 1)
|
||||
printf("|%.2x", *p);
|
||||
elem->asnlen = (elem->asnlen << ASN_SHIFT8) | *p++;
|
||||
}
|
||||
@ -654,7 +653,7 @@ asn1_print(struct be *elem)
|
||||
switch (elem->type) {
|
||||
|
||||
case BE_OCTET:
|
||||
for (i = asnlen; i-- > 0; p++);
|
||||
for (i = asnlen; i-- > 0; p++)
|
||||
printf("_%.2x", *p);
|
||||
break;
|
||||
|
||||
@ -730,11 +729,12 @@ asn1_print(struct be *elem)
|
||||
}
|
||||
d += (elem->data.uns64.low & 0xfffff000);
|
||||
#if 0 /*is looks illegal, but what is the intention???*/
|
||||
sprintf(first, "%.f", d);
|
||||
snprintf(first, sizeof(first), "%.f", d);
|
||||
#else
|
||||
sprintf(first, "%f", d);
|
||||
snprintf(first, sizeof(first), "%f", d);
|
||||
#endif
|
||||
sprintf(last, "%5.5d", elem->data.uns64.low & 0xfff);
|
||||
snprintf(last, sizeof(last), "%5.5d",
|
||||
elem->data.uns64.low & 0xfff);
|
||||
for (carry = 0, cpf = first+strlen(first)-1, cpl = last+4;
|
||||
cpl >= last;
|
||||
cpf--, cpl--) {
|
||||
@ -837,12 +837,31 @@ asn1_decode(u_char *p, u_int length)
|
||||
|
||||
#ifdef LIBSMI
|
||||
|
||||
#if (SMI_VERSION_MAJOR == 0 && SMI_VERSION_MINOR >= 2) || (SMI_VERSION_MAJOR > 0)
|
||||
#define LIBSMI_API_V2
|
||||
#else
|
||||
#define LIBSMI_API_V1
|
||||
#endif
|
||||
|
||||
#ifdef LIBSMI_API_V1
|
||||
/* Some of the API revisions introduced new calls that can be
|
||||
* represented by macros.
|
||||
*/
|
||||
#define smiGetNodeType(n) smiGetType((n)->typemodule, (n)->typename)
|
||||
|
||||
#else
|
||||
/* These calls in the V1 API were removed in V2. */
|
||||
#define smiFreeRange(r)
|
||||
#define smiFreeType(r)
|
||||
#define smiFreeNode(r)
|
||||
#endif
|
||||
|
||||
struct smi2be {
|
||||
SmiBasetype basetype;
|
||||
int be;
|
||||
};
|
||||
|
||||
struct smi2be smi2betab[] = {
|
||||
static struct smi2be smi2betab[] = {
|
||||
{ SMI_BASETYPE_INTEGER32, BE_INT },
|
||||
{ SMI_BASETYPE_OCTETSTRING, BE_STR },
|
||||
{ SMI_BASETYPE_OCTETSTRING, BE_INETADDR },
|
||||
@ -899,7 +918,7 @@ static int smi_check_type(SmiBasetype basetype, int be)
|
||||
static int smi_check_a_range(SmiType *smiType, SmiRange *smiRange,
|
||||
struct be *elem)
|
||||
{
|
||||
int ok;
|
||||
int ok = 1;
|
||||
|
||||
switch (smiType->basetype) {
|
||||
case SMI_BASETYPE_OBJECTIDENTIFIER:
|
||||
@ -947,22 +966,34 @@ static int smi_check_range(SmiType *smiType, struct be *elem)
|
||||
SmiRange *smiRange;
|
||||
int ok = 1;
|
||||
|
||||
#ifdef LIBSMI_API_V1
|
||||
for (smiRange = smiGetFirstRange(smiType->module, smiType->name);
|
||||
#else
|
||||
for (smiRange = smiGetFirstRange(smiType);
|
||||
#endif
|
||||
smiRange;
|
||||
smiRange = smiGetNextRange(smiRange)) {
|
||||
|
||||
ok = smi_check_a_range(smiType, smiRange, elem);
|
||||
|
||||
|
||||
if (ok) {
|
||||
smiFreeRange(smiRange);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok && smiType->parentmodule && smiType->parentname) {
|
||||
if (ok
|
||||
#ifdef LIBSMI_API_V1
|
||||
&& smiType->parentmodule && smiType->parentname
|
||||
#endif
|
||||
) {
|
||||
SmiType *parentType;
|
||||
#ifdef LIBSMI_API_V1
|
||||
parentType = smiGetType(smiType->parentmodule,
|
||||
smiType->parentname);
|
||||
#else
|
||||
parentType = smiGetParentType(smiType);
|
||||
#endif
|
||||
if (parentType) {
|
||||
ok = smi_check_range(parentType, elem);
|
||||
smiFreeType(parentType);
|
||||
@ -985,7 +1016,11 @@ static SmiNode *smi_print_variable(struct be *elem)
|
||||
return NULL;
|
||||
}
|
||||
if (vflag) {
|
||||
fputs(smiNode->module, stdout);
|
||||
#ifdef LIBSMI_API_V1
|
||||
fputs(smiNode->module, stdout);
|
||||
#else
|
||||
fputs(smiGetNodeModule(smiNode)->name, stdout);
|
||||
#endif
|
||||
fputs("::", stdout);
|
||||
}
|
||||
fputs(smiNode->name, stdout);
|
||||
@ -1010,6 +1045,13 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
|
||||
return;
|
||||
}
|
||||
|
||||
if (elem->type == BE_NOSUCHOBJECT
|
||||
|| elem->type == BE_NOSUCHINST
|
||||
|| elem->type == BE_ENDOFMIBVIEW) {
|
||||
asn1_print(elem);
|
||||
return;
|
||||
}
|
||||
|
||||
if (NOTIFY_CLASS(pduid) && smiNode->access < SMI_ACCESS_NOTIFY) {
|
||||
fputs("[notNotifyable]", stdout);
|
||||
}
|
||||
@ -1027,16 +1069,24 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
|
||||
fputs("[noAccess]", stdout);
|
||||
}
|
||||
|
||||
if (! smi_check_type(smiNode->basetype, elem->type)) {
|
||||
fputs("[wrongType]", stdout);
|
||||
}
|
||||
|
||||
#ifdef LIBSMI_API_V1
|
||||
smiType = smiGetType(smiNode->typemodule, smiNode->typename);
|
||||
#else
|
||||
smiType = smiGetNodeType(smiNode);
|
||||
#endif
|
||||
if (! smiType) {
|
||||
asn1_print(elem);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef LIBSMI_API_V1
|
||||
if (! smi_check_type(smiNode->basetype, elem->type)) {
|
||||
#else
|
||||
if (! smi_check_type(smiType->basetype, elem->type)) {
|
||||
#endif
|
||||
fputs("[wrongType]", stdout);
|
||||
}
|
||||
|
||||
if (! smi_check_range(smiType, elem)) {
|
||||
fputs("[wrongLength]", stdout);
|
||||
}
|
||||
@ -1051,15 +1101,18 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
|
||||
|
||||
switch (elem->type) {
|
||||
case BE_OID:
|
||||
if (smiNode->basetype == SMI_BASETYPE_BITS
|
||||
&& smiNode->typemodule && smiNode->typename) {
|
||||
if (smiType->basetype == SMI_BASETYPE_BITS) {
|
||||
/* print bit labels */
|
||||
} else {
|
||||
smi_decode_oid(elem, oid, &oidlen);
|
||||
smiNode = smiGetNodeByOID(oidlen, oid);
|
||||
if (smiNode) {
|
||||
if (vflag) {
|
||||
fputs(smiNode->module, stdout);
|
||||
#ifdef LIBSMI_API_V1
|
||||
fputs(smiNode->module, stdout);
|
||||
#else
|
||||
fputs(smiGetNodeModule(smiNode)->name, stdout);
|
||||
#endif
|
||||
fputs("::", stdout);
|
||||
}
|
||||
fputs(smiNode->name, stdout);
|
||||
@ -1075,10 +1128,15 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
|
||||
break;
|
||||
|
||||
case BE_INT:
|
||||
#ifdef LIBSMI_API_V1
|
||||
if (smiNode->basetype == SMI_BASETYPE_ENUM
|
||||
&& smiNode->typemodule && smiNode->typename) {
|
||||
for (nn = smiGetFirstNamedNumber(smiNode->typemodule,
|
||||
smiNode->typename);
|
||||
#else
|
||||
if (smiType->basetype == SMI_BASETYPE_ENUM) {
|
||||
for (nn = smiGetFirstNamedNumber(smiType);
|
||||
#endif
|
||||
nn;
|
||||
nn = smiGetNextNamedNumber(nn)) {
|
||||
if (nn->value.value.integer32
|
||||
@ -1098,7 +1156,7 @@ static void smi_print_value(SmiNode *smiNode, u_char pduid, struct be *elem)
|
||||
}
|
||||
|
||||
if (smiType) {
|
||||
smiFreeType(smiType);
|
||||
smiFreeType(smiType);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1244,7 +1302,8 @@ snmppdu_print(u_char pduid, const u_char *np, u_int length)
|
||||
asn1_print(&elem);
|
||||
return;
|
||||
}
|
||||
/* ignore the reqId */
|
||||
if (vflag)
|
||||
printf("R=%d ", elem.data.integer);
|
||||
length -= count;
|
||||
np += count;
|
||||
|
||||
@ -1411,7 +1470,11 @@ pdu_print(const u_char *np, u_int length, int version)
|
||||
}
|
||||
if (count < length)
|
||||
printf("[%d extra after PDU]", length - count);
|
||||
if (vflag) {
|
||||
fputs("{ ", stdout);
|
||||
}
|
||||
asn1_print(&pdu);
|
||||
fputs(" ", stdout);
|
||||
/* descend into PDU */
|
||||
length = pdu.asnlen;
|
||||
np = (u_char *)pdu.data.raw;
|
||||
@ -1443,6 +1506,10 @@ pdu_print(const u_char *np, u_int length, int version)
|
||||
snmppdu_print(pdu.id, np, length);
|
||||
break;
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
fputs("} ", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1646,6 +1713,10 @@ v3msg_print(const u_char *np, u_int length)
|
||||
length = elem.asnlen;
|
||||
np = (u_char *)elem.data.raw;
|
||||
|
||||
if (vflag) {
|
||||
fputs("{ ", stdout);
|
||||
}
|
||||
|
||||
/* msgID (INTEGER) */
|
||||
if ((count = asn1_parse(np, length, &elem)) < 0)
|
||||
return;
|
||||
@ -1710,9 +1781,13 @@ v3msg_print(const u_char *np, u_int length)
|
||||
if (count < length)
|
||||
printf("[%d extra after message SEQ]", length - count);
|
||||
|
||||
if (vflag) {
|
||||
fputs("} ", stdout);
|
||||
}
|
||||
|
||||
if (model == 3) {
|
||||
if (vflag) {
|
||||
fputs("USM ", stdout);
|
||||
fputs("{ USM ", stdout);
|
||||
}
|
||||
} else {
|
||||
printf("[security model %d]", model);
|
||||
@ -1735,13 +1810,20 @@ v3msg_print(const u_char *np, u_int length)
|
||||
|
||||
if (model == 3) {
|
||||
usm_print(elem.data.str, elem.asnlen);
|
||||
if (vflag) {
|
||||
fputs("} ", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
fputs("ScopedPDU ", stdout);
|
||||
fputs("{ ScopedPDU ", stdout);
|
||||
}
|
||||
|
||||
scopedpdu_print(np, length, 3);
|
||||
|
||||
if (vflag) {
|
||||
fputs("} ", stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1792,7 +1874,7 @@ snmp_print(const u_char *np, u_int length)
|
||||
case SNMP_VERSION_2:
|
||||
case SNMP_VERSION_3:
|
||||
if (vflag)
|
||||
printf("%s ", SnmpVersion[elem.data.integer]);
|
||||
printf("{ %s ", SnmpVersion[elem.data.integer]);
|
||||
break;
|
||||
default:
|
||||
printf("[version = %d]", elem.data.integer);
|
||||
@ -1814,4 +1896,8 @@ snmp_print(const u_char *np, u_int length)
|
||||
printf("[version = %d]", elem.data.integer);
|
||||
break;
|
||||
}
|
||||
|
||||
if (vflag) {
|
||||
fputs("} ", stdout);
|
||||
}
|
||||
}
|
||||
|
106
contrib/tcpdump/print-stp.c
Normal file
106
contrib/tcpdump/print-stp.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Lennert Buytenhek
|
||||
*
|
||||
* This software may be distributed either under the terms of the
|
||||
* BSD-style license that accompanies tcpdump or the GNU General
|
||||
* Public License
|
||||
*
|
||||
* Format and print IEEE 802.1d spanning tree protocol packets.
|
||||
* Contributed by Lennert Buytenhek <buytenh@gnu.org>
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.6 2000/09/29 04:58:50 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
static void
|
||||
stp_print_bridge_id(const u_char *p)
|
||||
{
|
||||
printf("%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
|
||||
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
|
||||
}
|
||||
|
||||
static void
|
||||
stp_print_config_bpdu(const u_char *p, u_int length)
|
||||
{
|
||||
printf("config ");
|
||||
if (p[7] & 1)
|
||||
printf("TOP_CHANGE ");
|
||||
if (p[7] & 0x80)
|
||||
printf("TOP_CHANGE_ACK ");
|
||||
|
||||
stp_print_bridge_id(p+20);
|
||||
printf(".%.2x%.2x ", p[28], p[29]);
|
||||
|
||||
printf("root ");
|
||||
stp_print_bridge_id(p+8);
|
||||
|
||||
printf(" pathcost %i ", (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
|
||||
|
||||
printf("age %i ", p[30]);
|
||||
printf("max %i ", p[32]);
|
||||
printf("hello %i ", p[34]);
|
||||
printf("fdelay %i ", p[36]);
|
||||
}
|
||||
|
||||
static void
|
||||
stp_print_tcn_bpdu(const u_char *p, u_int length)
|
||||
{
|
||||
printf("tcn");
|
||||
}
|
||||
|
||||
/*
|
||||
* Print 802.1d packets.
|
||||
*/
|
||||
void
|
||||
stp_print(const u_char *p, u_int length)
|
||||
{
|
||||
if (length < 7)
|
||||
goto trunc;
|
||||
|
||||
printf("802.1d ");
|
||||
if (p[2] != 0x03 || p[3] || p[4] || p[5]) {
|
||||
printf("unknown version");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (p[6])
|
||||
{
|
||||
case 0:
|
||||
if (length < 10)
|
||||
goto trunc;
|
||||
stp_print_config_bpdu(p, length);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
stp_print_tcn_bpdu(p, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("unknown type %i\n", p[6]);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
trunc:
|
||||
printf("[|stp %d]", length);
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.63 1999/12/22 15:44:10 itojun Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.81 2000/12/23 20:55:22 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,28 +31,31 @@ static const char rcsid[] =
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <rpc/rpc.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef INET6
|
||||
#include <netinet/ip6.h>
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "tcp.h"
|
||||
|
||||
#include "ip.h"
|
||||
#ifdef INET6
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
|
||||
static void print_tcp_rst_data(register const u_char *sp, u_int length);
|
||||
|
||||
#define MAX_RST_DATA_LEN 30
|
||||
|
||||
/* Compatibility */
|
||||
#ifndef TCPOPT_WSCALE
|
||||
#define TCPOPT_WSCALE 3 /* window scale factor (rfc1072) */
|
||||
@ -82,6 +85,17 @@ static const char rcsid[] =
|
||||
#define TCPOPT_CCECHO 13 /* T/TCP CC options (rfc1644) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Definitions required for ECN
|
||||
* for use if the OS running tcpdump does not have ECN
|
||||
*/
|
||||
#ifndef TH_ECNECHO
|
||||
#define TH_ECNECHO 0x40 /* ECN Echo in tcp header */
|
||||
#endif
|
||||
#ifndef TH_CWR
|
||||
#define TH_CWR 0x80 /* ECN Cwnd Reduced in tcp header*/
|
||||
#endif
|
||||
|
||||
struct tha {
|
||||
#ifndef INET6
|
||||
struct in_addr src;
|
||||
@ -115,17 +129,114 @@ static struct tcp_seq_hash tcp_seq_hash[TSEQ_HASHSIZE];
|
||||
#define BGP_PORT 179
|
||||
#endif
|
||||
#define NETBIOS_SSN_PORT 139
|
||||
#define BXXP_PORT 10288
|
||||
#ifndef NFS_PORT
|
||||
#define NFS_PORT 2049
|
||||
#endif
|
||||
|
||||
static int tcp_cksum(register const struct ip *ip,
|
||||
register const struct tcphdr *tp,
|
||||
register int len)
|
||||
{
|
||||
int i, tlen;
|
||||
union phu {
|
||||
struct phdr {
|
||||
u_int32_t src;
|
||||
u_int32_t dst;
|
||||
u_char mbz;
|
||||
u_char proto;
|
||||
u_int16_t len;
|
||||
} ph;
|
||||
u_int16_t pa[6];
|
||||
} phu;
|
||||
register const u_int16_t *sp;
|
||||
u_int32_t sum;
|
||||
tlen = ntohs(ip->ip_len) - ((const char *)tp-(const char*)ip);
|
||||
|
||||
/* pseudo-header.. */
|
||||
phu.ph.len = htons(tlen);
|
||||
phu.ph.mbz = 0;
|
||||
phu.ph.proto = IPPROTO_TCP;
|
||||
memcpy(&phu.ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t));
|
||||
memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t));
|
||||
|
||||
sp = &phu.pa[0];
|
||||
sum = sp[0]+sp[1]+sp[2]+sp[3]+sp[4]+sp[5];
|
||||
|
||||
sp = (const u_int16_t *)tp;
|
||||
|
||||
for (i=0; i<(tlen&~1); i+= 2)
|
||||
sum += *sp++;
|
||||
|
||||
if (tlen & 1) {
|
||||
sum += htons( (*(const u_int8_t *)sp) << 8);
|
||||
}
|
||||
|
||||
while (sum > 0xffff)
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
sum = ~sum & 0xffff;
|
||||
|
||||
return (sum);
|
||||
}
|
||||
|
||||
#ifdef INET6
|
||||
static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr *tp,
|
||||
int len)
|
||||
{
|
||||
int i, tlen;
|
||||
register const u_int16_t *sp;
|
||||
u_int32_t sum;
|
||||
union {
|
||||
struct {
|
||||
struct in6_addr ph_src;
|
||||
struct in6_addr ph_dst;
|
||||
u_int32_t ph_len;
|
||||
u_int8_t ph_zero[3];
|
||||
u_int8_t ph_nxt;
|
||||
} ph;
|
||||
u_int16_t pa[20];
|
||||
} phu;
|
||||
|
||||
tlen = ntohs(ip6->ip6_plen) + sizeof(struct ip6_hdr) -
|
||||
((const char *)tp - (const char*)ip6);
|
||||
|
||||
/* 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(tlen);
|
||||
phu.ph.ph_nxt = IPPROTO_TCP;
|
||||
|
||||
sum = 0;
|
||||
for (i = 0; i < sizeof(phu.pa) / sizeof(phu.pa[0]); i++)
|
||||
sum += phu.pa[i];
|
||||
|
||||
sp = (const u_int16_t *)tp;
|
||||
|
||||
for (i = 0; i < (tlen & ~1); i += 2)
|
||||
sum += *sp++;
|
||||
|
||||
if (tlen & 1)
|
||||
sum += htons((*(const u_int8_t *)sp) << 8);
|
||||
|
||||
while (sum > 0xffff)
|
||||
sum = (sum & 0xffff) + (sum >> 16);
|
||||
sum = ~sum & 0xffff;
|
||||
|
||||
return (sum);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
tcp_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2)
|
||||
register const u_char *bp2, int fragmented)
|
||||
{
|
||||
register const struct tcphdr *tp;
|
||||
register const struct ip *ip;
|
||||
register u_char flags;
|
||||
register int hlen;
|
||||
register char ch;
|
||||
u_short sport, dport, win, urp;
|
||||
u_int16_t sport, dport, win, urp;
|
||||
u_int32_t seq, ack, thseq, thack;
|
||||
int threv;
|
||||
#ifdef INET6
|
||||
@ -135,7 +246,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
tp = (struct tcphdr *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
#ifdef INET6
|
||||
if (ip->ip_v == 6)
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
@ -151,6 +262,28 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
sport = ntohs(tp->th_sport);
|
||||
dport = ntohs(tp->th_dport);
|
||||
|
||||
|
||||
hlen = TH_OFF(tp) * 4;
|
||||
|
||||
/*
|
||||
* If data present and NFS port used, assume NFS.
|
||||
* Pass offset of data plus 4 bytes for RPC TCP msg length
|
||||
* to NFS print routines.
|
||||
*/
|
||||
if (!qflag) {
|
||||
if ((u_char *)tp + 4 + sizeof(struct rpc_msg) <= snapend &&
|
||||
dport == NFS_PORT) {
|
||||
nfsreq_print((u_char *)tp + hlen + 4, length-hlen,
|
||||
(u_char *)ip);
|
||||
return;
|
||||
} else if ((u_char *)tp + 4 + sizeof(struct rpc_msg)
|
||||
<= snapend &&
|
||||
sport == NFS_PORT) {
|
||||
nfsreply_print((u_char *)tp + hlen + 4,length-hlen,
|
||||
(u_char *)ip);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
if (ip6->ip6_nxt == IPPROTO_TCP) {
|
||||
@ -180,21 +313,17 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
|
||||
TCHECK(*tp);
|
||||
|
||||
seq = ntohl(tp->th_seq);
|
||||
ack = ntohl(tp->th_ack);
|
||||
seq = (u_int32_t)ntohl(tp->th_seq);
|
||||
ack = (u_int32_t)ntohl(tp->th_ack);
|
||||
win = ntohs(tp->th_win);
|
||||
urp = ntohs(tp->th_urp);
|
||||
|
||||
if (qflag) {
|
||||
(void)printf("tcp %d", length - tp->th_off * 4);
|
||||
(void)printf("tcp %d", length - TH_OFF(tp) * 4);
|
||||
return;
|
||||
}
|
||||
#ifdef TH_ECN
|
||||
if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH|TH_ECN))
|
||||
#else
|
||||
if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH))
|
||||
#endif
|
||||
{
|
||||
if ((flags = tp->th_flags) & (TH_SYN|TH_FIN|TH_RST|TH_PUSH|
|
||||
TH_ECNECHO|TH_CWR)) {
|
||||
if (flags & TH_SYN)
|
||||
putchar('S');
|
||||
if (flags & TH_FIN)
|
||||
@ -203,22 +332,13 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
putchar('R');
|
||||
if (flags & TH_PUSH)
|
||||
putchar('P');
|
||||
#ifdef TH_ECN
|
||||
if (flags & TH_ECN)
|
||||
putchar('C');
|
||||
#endif
|
||||
if (flags & TH_CWR)
|
||||
putchar('W'); /* congestion _W_indow reduced (ECN) */
|
||||
if (flags & TH_ECNECHO)
|
||||
putchar('E'); /* ecn _E_cho sent (ECN) */
|
||||
} else
|
||||
putchar('.');
|
||||
|
||||
if (flags&0xc0) {
|
||||
printf(" [");
|
||||
if (flags&0x40)
|
||||
printf("ECN-Echo");
|
||||
if (flags&0x80)
|
||||
printf("%sCWR", (flags&0x40) ? "," : "");
|
||||
printf("]");
|
||||
}
|
||||
|
||||
if (!Sflag && (flags & TH_ACK)) {
|
||||
register struct tcp_seq_hash *th;
|
||||
register int rev;
|
||||
@ -230,7 +350,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
* both directions).
|
||||
*/
|
||||
#ifdef INET6
|
||||
bzero(&tha, sizeof(tha));
|
||||
memset(&tha, 0, sizeof(tha));
|
||||
rev = 0;
|
||||
if (ip6) {
|
||||
if (sport > dport) {
|
||||
@ -292,7 +412,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
sizeof(th->addr)))
|
||||
break;
|
||||
|
||||
if (!th->nxt || flags & TH_SYN) {
|
||||
if (!th->nxt || (flags & TH_SYN)) {
|
||||
/* didn't find it or new conversation */
|
||||
if (th->nxt == NULL) {
|
||||
th->nxt = (struct tcp_seq_hash *)
|
||||
@ -305,22 +425,48 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
th->ack = seq, th->seq = ack - 1;
|
||||
else
|
||||
th->seq = seq, th->ack = ack - 1;
|
||||
} else {
|
||||
|
||||
thseq = th->seq;
|
||||
thack = th->ack;
|
||||
|
||||
} else {
|
||||
if (rev)
|
||||
seq -= th->ack, ack -= th->seq;
|
||||
else
|
||||
seq -= th->seq, ack -= th->ack;
|
||||
}
|
||||
|
||||
thseq = th->seq;
|
||||
thack = th->ack;
|
||||
} else {
|
||||
/*fool gcc*/
|
||||
thseq = thack = threv = 0;
|
||||
}
|
||||
hlen = tp->th_off * 4;
|
||||
if (hlen > length) {
|
||||
(void)printf(" [bad hdr length]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IP_V(ip) == 4 && vflag && !fragmented) {
|
||||
int sum;
|
||||
if (TTEST2(tp->th_sport, length)) {
|
||||
sum = tcp_cksum(ip, tp, length);
|
||||
if (sum != 0)
|
||||
(void)printf(" [bad tcp cksum %x!]", sum);
|
||||
else
|
||||
(void)printf(" [tcp sum ok]");
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
|
||||
int sum;
|
||||
if (TTEST2(tp->th_sport, length)) {
|
||||
sum = tcp6_cksum(ip6, tp, length);
|
||||
if (sum != 0)
|
||||
(void)printf(" [bad tcp cksum %x!]", sum);
|
||||
else
|
||||
(void)printf(" [tcp sum ok]");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
length -= hlen;
|
||||
if (vflag > 1 || length > 0 || flags & (TH_SYN | TH_FIN | TH_RST))
|
||||
(void)printf(" %u:%u(%d)", seq, seq + length, length);
|
||||
@ -493,14 +639,21 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
/*
|
||||
* Decode payload if necessary.
|
||||
*/
|
||||
bp += (tp->th_off * 4);
|
||||
if (!qflag && vflag && length > 0
|
||||
&& (sport == TELNET_PORT || dport == TELNET_PORT))
|
||||
telnet_print(bp, length);
|
||||
else if (sport == BGP_PORT || dport == BGP_PORT)
|
||||
bgp_print(bp, length);
|
||||
else if (sport == NETBIOS_SSN_PORT || dport == NETBIOS_SSN_PORT)
|
||||
nbt_tcp_print(bp, length);
|
||||
bp += TH_OFF(tp) * 4;
|
||||
if (flags & TH_RST) {
|
||||
if (vflag)
|
||||
print_tcp_rst_data(bp, length);
|
||||
} else {
|
||||
if (sport == TELNET_PORT || dport == TELNET_PORT) {
|
||||
if (!qflag && vflag)
|
||||
telnet_print(bp, length);
|
||||
} else if (sport == BGP_PORT || dport == BGP_PORT)
|
||||
bgp_print(bp, length);
|
||||
else if (sport == NETBIOS_SSN_PORT || dport == NETBIOS_SSN_PORT)
|
||||
nbt_tcp_print(bp, length);
|
||||
else if (sport == BXXP_PORT || dport == BXXP_PORT)
|
||||
bxxp_print(bp, length);
|
||||
}
|
||||
return;
|
||||
bad:
|
||||
fputs("[bad opt]", stdout);
|
||||
@ -513,3 +666,41 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
putchar('>');
|
||||
}
|
||||
|
||||
/*
|
||||
* RFC1122 says the following on data in RST segments:
|
||||
*
|
||||
* 4.2.2.12 RST Segment: RFC-793 Section 3.4
|
||||
*
|
||||
* A TCP SHOULD allow a received RST segment to include data.
|
||||
*
|
||||
* DISCUSSION
|
||||
* It has been suggested that a RST segment could contain
|
||||
* ASCII text that encoded and explained the cause of the
|
||||
* RST. No standard has yet been established for such
|
||||
* data.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
print_tcp_rst_data(register const u_char *sp, u_int length)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (TTEST2(*sp, length))
|
||||
printf(" [RST");
|
||||
else
|
||||
printf(" [!RST");
|
||||
if (length > MAX_RST_DATA_LEN) {
|
||||
length = MAX_RST_DATA_LEN; /* can use -X for longer */
|
||||
putchar('+'); /* indicate we truncate */
|
||||
}
|
||||
putchar(' ');
|
||||
while (length-- && sp <= snapend) {
|
||||
c = *sp++;
|
||||
if (isprint(c))
|
||||
putchar(c);
|
||||
else
|
||||
putchar('.');
|
||||
}
|
||||
putchar(']');
|
||||
}
|
||||
|
@ -51,35 +51,28 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.2.2.2 2000/01/11 06:58:28 fenner Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.12 2000/09/29 04:58:51 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcpip.h>
|
||||
|
||||
#define TELCMDS
|
||||
#define TELOPTS
|
||||
#include <arpa/telnet.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef __STDC__
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
|
||||
#ifndef TELCMD_FIRST
|
||||
# define TELCMD_FIRST SE
|
||||
#endif
|
||||
@ -128,15 +121,16 @@ telnet_print(register const u_char *sp, u_int length)
|
||||
x = *sp++; /* option */
|
||||
length--;
|
||||
if (x >= 0 && x < NTELOPTS) {
|
||||
(void)sprintf(tnet, "%s %s",
|
||||
telcmds[i], telopts[x]);
|
||||
(void)snprintf(tnet, sizeof(tnet),
|
||||
"%s %s", telcmds[i], telopts[x]);
|
||||
} else {
|
||||
(void)sprintf(tnet, "%s %#x",
|
||||
telcmds[i], x);
|
||||
(void)snprintf(tnet, sizeof(tnet),
|
||||
"%s %#x", telcmds[i], x);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
(void)strcpy(tnet, telcmds[i]);
|
||||
(void)snprintf(tnet, sizeof(tnet), "%s",
|
||||
telcmds[i]);
|
||||
}
|
||||
if (c == SB) {
|
||||
c = *sp++;
|
||||
@ -174,11 +168,13 @@ telnet_print(register const u_char *sp, u_int length)
|
||||
hex_print_with_offset(osp, i, off);
|
||||
off += i;
|
||||
if (i > 8)
|
||||
printf("\n\t\t\t\t%s", tnet);
|
||||
printf("\n\t\t\t\t");
|
||||
else
|
||||
printf("%*s\t%s", (8 - i) * 3, "", tnet);
|
||||
printf("%*s\t", (8 - i) * 3, "");
|
||||
safeputs(tnet);
|
||||
} else {
|
||||
printf("%s%s", (first) ? " [telnet " : ", ", tnet);
|
||||
printf("%s", (first) ? " [telnet " : ", ");
|
||||
safeputs(tnet);
|
||||
}
|
||||
first = 0;
|
||||
}
|
||||
|
119
contrib/tcpdump/print-timed.c
Normal file
119
contrib/tcpdump/print-timed.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Ben Smithurst <ben@scientia.demon.co.uk>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-timed.c,v 1.1 2000/10/06 05:35:37 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include "ip.h"
|
||||
#include "udp.h"
|
||||
#include "tcp.h"
|
||||
|
||||
#include "timed.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h" /* must come after interface.h */
|
||||
|
||||
static char *tsptype[TSPTYPENUMBER] =
|
||||
{ "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
|
||||
"SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
|
||||
"DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
|
||||
"TEST", "SETDATE", "SETDATEREQ", "LOOP" };
|
||||
|
||||
void
|
||||
timed_print(register const u_char *bp, u_int length)
|
||||
{
|
||||
#define endof(x) ((u_char *)&(x) + sizeof (x))
|
||||
struct tsp *tsp = (struct tsp *)bp;
|
||||
long sec, usec;
|
||||
const u_char *end;
|
||||
|
||||
if (endof(tsp->tsp_type) > snapend) {
|
||||
fputs("[|timed]", stdout);
|
||||
return;
|
||||
}
|
||||
if (tsp->tsp_type < TSPTYPENUMBER)
|
||||
printf("TSP_%s", tsptype[tsp->tsp_type]);
|
||||
else
|
||||
printf("(tsp_type %#x)", tsp->tsp_type);
|
||||
|
||||
if (endof(tsp->tsp_vers) > snapend) {
|
||||
fputs(" [|timed]", stdout);
|
||||
return;
|
||||
}
|
||||
printf(" vers %d", tsp->tsp_vers);
|
||||
|
||||
if (endof(tsp->tsp_seq) > snapend) {
|
||||
fputs(" [|timed]", stdout);
|
||||
return;
|
||||
}
|
||||
printf(" seq %d", tsp->tsp_seq);
|
||||
|
||||
if (tsp->tsp_type == TSP_LOOP) {
|
||||
if (endof(tsp->tsp_hopcnt) > snapend) {
|
||||
fputs(" [|timed]", stdout);
|
||||
return;
|
||||
}
|
||||
printf(" hopcnt %d", tsp->tsp_hopcnt);
|
||||
} else if (tsp->tsp_type == TSP_SETTIME ||
|
||||
tsp->tsp_type == TSP_ADJTIME ||
|
||||
tsp->tsp_type == TSP_SETDATE ||
|
||||
tsp->tsp_type == TSP_SETDATEREQ) {
|
||||
if (endof(tsp->tsp_time) > snapend) {
|
||||
fputs(" [|timed]", stdout);
|
||||
return;
|
||||
}
|
||||
sec = ntohl((long)tsp->tsp_time.tv_sec);
|
||||
usec = ntohl((long)tsp->tsp_time.tv_usec);
|
||||
if (usec < 0)
|
||||
/* corrupt, skip the rest of the packet */
|
||||
return;
|
||||
fputs(" time ", stdout);
|
||||
if (sec < 0 && usec != 0) {
|
||||
sec++;
|
||||
if (sec == 0)
|
||||
fputc('-', stdout);
|
||||
usec = 1000000 - usec;
|
||||
}
|
||||
printf("%ld.%06ld", sec, usec);
|
||||
}
|
||||
|
||||
end = memchr(tsp->tsp_name, '\0', snapend - (u_char *)tsp->tsp_name);
|
||||
if (end == NULL)
|
||||
fputs(" [|timed]", stdout);
|
||||
else {
|
||||
fputs(" name ", stdout);
|
||||
fwrite(tsp->tsp_name, end - (u_char *)tsp->tsp_name, 1, stdout);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user