summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2001-04-03 07:45:48 +0000
committerfenner <fenner@FreeBSD.org>2001-04-03 07:45:48 +0000
commitf7d9a5e270bfcbb075a637a52416185441d33d8d (patch)
treee79d9e6f58638911260708c956a0d44069782cda
parent04f715925eb0f85e1b7d21424cdbb3f6f1fa0b41 (diff)
parentace14a2b50f2cc05c079d0b9137b49066dbb1206 (diff)
downloadFreeBSD-src-f7d9a5e270bfcbb075a637a52416185441d33d8d.zip
FreeBSD-src-f7d9a5e270bfcbb075a637a52416185441d33d8d.tar.gz
This commit was generated by cvs2svn to compensate for changes in r75115,
which included commits to RCS files with non-trunk default branches.
-rw-r--r--contrib/tcpdump/.cvsignore11
-rw-r--r--contrib/tcpdump/CHANGES41
-rw-r--r--contrib/tcpdump/CREDITS59
-rw-r--r--contrib/tcpdump/FILES95
-rw-r--r--contrib/tcpdump/INSTALL65
-rw-r--r--contrib/tcpdump/LICENSE19
-rw-r--r--contrib/tcpdump/Makefile-devel-adds22
-rw-r--r--contrib/tcpdump/Makefile.in62
-rw-r--r--contrib/tcpdump/PLATFORMS8
-rw-r--r--contrib/tcpdump/README58
-rw-r--r--contrib/tcpdump/TODO6
-rw-r--r--contrib/tcpdump/VERSION2
-rw-r--r--contrib/tcpdump/acconfig.h28
-rw-r--r--contrib/tcpdump/ah.h57
-rw-r--r--contrib/tcpdump/appletalk.h60
-rw-r--r--contrib/tcpdump/bootp.h220
-rw-r--r--contrib/tcpdump/bpf_dump.c4
-rw-r--r--contrib/tcpdump/chdlc.h27
-rwxr-xr-xcontrib/tcpdump/config.guess905
-rw-r--r--contrib/tcpdump/config.h.in85
-rwxr-xr-xcontrib/tcpdump/config.sub565
-rwxr-xr-xcontrib/tcpdump/configure1432
-rwxr-xr-xcontrib/tcpdump/configure.in233
-rw-r--r--contrib/tcpdump/decnet.h18
-rw-r--r--contrib/tcpdump/dhcp6.h35
-rw-r--r--contrib/tcpdump/dhcp6opt.h7
-rw-r--r--contrib/tcpdump/esp.h68
-rw-r--r--contrib/tcpdump/ether.h59
-rw-r--r--contrib/tcpdump/extract.h34
-rw-r--r--contrib/tcpdump/fddi.h9
-rw-r--r--contrib/tcpdump/gmt2local.c3
-rw-r--r--contrib/tcpdump/icmp6.h412
-rw-r--r--contrib/tcpdump/igrp.h37
-rw-r--r--contrib/tcpdump/ip.h159
-rw-r--r--contrib/tcpdump/ip6.h195
-rw-r--r--contrib/tcpdump/ipsec_doi.h39
-rw-r--r--contrib/tcpdump/ipx.h22
-rw-r--r--contrib/tcpdump/isakmp.h71
-rw-r--r--contrib/tcpdump/l2tp.h25
-rw-r--r--contrib/tcpdump/lane.h10
-rw-r--r--contrib/tcpdump/lbl/os-solaris2.h26
-rw-r--r--contrib/tcpdump/llc.h34
-rw-r--r--contrib/tcpdump/machdep.c6
-rw-r--r--contrib/tcpdump/machdep.h4
-rw-r--r--contrib/tcpdump/missing/addrinfo.h24
-rw-r--r--contrib/tcpdump/missing/getaddrinfo.c42
-rw-r--r--contrib/tcpdump/missing/getnameinfo.c18
-rw-r--r--contrib/tcpdump/missing/inet_aton.c4
-rw-r--r--contrib/tcpdump/missing/inet_ntop.c4
-rw-r--r--contrib/tcpdump/missing/inet_pton.c4
-rw-r--r--contrib/tcpdump/missing/snprintf.c628
-rw-r--r--contrib/tcpdump/missing/strlcat.c78
-rw-r--r--contrib/tcpdump/missing/strlcpy.c75
-rw-r--r--contrib/tcpdump/nameser.h254
-rw-r--r--contrib/tcpdump/ntp.h6
-rw-r--r--contrib/tcpdump/ospf.h53
-rw-r--r--contrib/tcpdump/ospf6.h26
-rw-r--r--contrib/tcpdump/print-ah.c35
-rw-r--r--contrib/tcpdump/print-ascii.c8
-rw-r--r--contrib/tcpdump/print-bgp.c129
-rw-r--r--contrib/tcpdump/print-bxxp.c82
-rw-r--r--contrib/tcpdump/print-cdp.c187
-rw-r--r--contrib/tcpdump/print-chdlc.c43
-rw-r--r--contrib/tcpdump/print-cip.c91
-rw-r--r--contrib/tcpdump/print-cnfp.c181
-rw-r--r--contrib/tcpdump/print-decnet.c13
-rw-r--r--contrib/tcpdump/print-dhcp6.c173
-rw-r--r--contrib/tcpdump/print-dvmrp.c8
-rw-r--r--contrib/tcpdump/print-egp.c6
-rw-r--r--contrib/tcpdump/print-esp.c70
-rw-r--r--contrib/tcpdump/print-frag6.c17
-rw-r--r--contrib/tcpdump/print-gre.c9
-rw-r--r--contrib/tcpdump/print-icmp6.c713
-rw-r--r--contrib/tcpdump/print-igmp.c307
-rw-r--r--contrib/tcpdump/print-igrp.c12
-rw-r--r--contrib/tcpdump/print-ip6opts.c185
-rw-r--r--contrib/tcpdump/print-ipcomp.c21
-rw-r--r--contrib/tcpdump/print-isakmp.c458
-rw-r--r--contrib/tcpdump/print-krb.c7
-rw-r--r--contrib/tcpdump/print-l2tp.c47
-rw-r--r--contrib/tcpdump/print-lane.c23
-rw-r--r--contrib/tcpdump/print-lcp.c18
-rw-r--r--contrib/tcpdump/print-mobile.c4
-rw-r--r--contrib/tcpdump/print-netbios.c13
-rw-r--r--contrib/tcpdump/print-ospf.c7
-rw-r--r--contrib/tcpdump/print-ospf6.c94
-rw-r--r--contrib/tcpdump/print-pppoe.c28
-rw-r--r--contrib/tcpdump/print-radius.c838
-rw-r--r--contrib/tcpdump/print-raw.c21
-rw-r--r--contrib/tcpdump/print-rip.c208
-rw-r--r--contrib/tcpdump/print-ripng.c9
-rw-r--r--contrib/tcpdump/print-rt6.c52
-rw-r--r--contrib/tcpdump/print-rx.c611
-rw-r--r--contrib/tcpdump/print-sll.c238
-rw-r--r--contrib/tcpdump/print-smb.c99
-rw-r--r--contrib/tcpdump/print-snmp.c148
-rw-r--r--contrib/tcpdump/print-stp.c106
-rw-r--r--contrib/tcpdump/print-tcp.c295
-rw-r--r--contrib/tcpdump/print-telnet.c30
-rw-r--r--contrib/tcpdump/print-timed.c119
-rw-r--r--contrib/tcpdump/print-vjc.c30
-rw-r--r--contrib/tcpdump/print-vrrp.c120
-rw-r--r--contrib/tcpdump/route6d.h16
-rw-r--r--contrib/tcpdump/rx.h35
-rw-r--r--contrib/tcpdump/savestr.c6
-rw-r--r--contrib/tcpdump/savestr.h2
-rw-r--r--contrib/tcpdump/setsignal.c6
-rw-r--r--contrib/tcpdump/slcompress.h87
-rw-r--r--contrib/tcpdump/slip.h34
-rw-r--r--contrib/tcpdump/sll.h127
-rw-r--r--contrib/tcpdump/smb.h1
-rw-r--r--contrib/tcpdump/smbutil.c111
-rw-r--r--contrib/tcpdump/strcasecmp.c5
-rw-r--r--contrib/tcpdump/tcp.h75
-rw-r--r--contrib/tcpdump/timed.h92
-rw-r--r--contrib/tcpdump/udp.h46
-rw-r--r--contrib/tcpdump/util.c151
-rw-r--r--contrib/tcpdump/vfprintf.c6
118 files changed, 10356 insertions, 2910 deletions
diff --git a/contrib/tcpdump/.cvsignore b/contrib/tcpdump/.cvsignore
new file mode 100644
index 0000000..f07c8e4
--- /dev/null
+++ b/contrib/tcpdump/.cvsignore
@@ -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
diff --git a/contrib/tcpdump/CHANGES b/contrib/tcpdump/CHANGES
index c11b9d3..4616fb3 100644
--- a/contrib/tcpdump/CHANGES
+++ b/contrib/tcpdump/CHANGES
@@ -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)
diff --git a/contrib/tcpdump/CREDITS b/contrib/tcpdump/CREDITS
new file mode 100644
index 0000000..3538157
--- /dev/null
+++ b/contrib/tcpdump/CREDITS
@@ -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
diff --git a/contrib/tcpdump/FILES b/contrib/tcpdump/FILES
index 47ffa71..987589e 100644
--- a/contrib/tcpdump/FILES
+++ b/contrib/tcpdump/FILES
@@ -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
diff --git a/contrib/tcpdump/INSTALL b/contrib/tcpdump/INSTALL
index 8a39565..5e5af94 100644
--- a/contrib/tcpdump/INSTALL
+++ b/contrib/tcpdump/INSTALL
@@ -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 -
diff --git a/contrib/tcpdump/LICENSE b/contrib/tcpdump/LICENSE
new file mode 100644
index 0000000..dea5f7d
--- /dev/null
+++ b/contrib/tcpdump/LICENSE
@@ -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.
diff --git a/contrib/tcpdump/Makefile-devel-adds b/contrib/tcpdump/Makefile-devel-adds
new file mode 100644
index 0000000..512a119
--- /dev/null
+++ b/contrib/tcpdump/Makefile-devel-adds
@@ -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
diff --git a/contrib/tcpdump/Makefile.in b/contrib/tcpdump/Makefile.in
index 57a4bc2..486e59f 100644
--- a/contrib/tcpdump/Makefile.in
+++ b/contrib/tcpdump/Makefile.in
@@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.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)
diff --git a/contrib/tcpdump/PLATFORMS b/contrib/tcpdump/PLATFORMS
new file mode 100644
index 0000000..49291176
--- /dev/null
+++ b/contrib/tcpdump/PLATFORMS
@@ -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)
+
+
diff --git a/contrib/tcpdump/README b/contrib/tcpdump/README
index 644181a..03fe3cf 100644
--- a/contrib/tcpdump/README
+++ b/contrib/tcpdump/README
@@ -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".
-
diff --git a/contrib/tcpdump/TODO b/contrib/tcpdump/TODO
new file mode 100644
index 0000000..12c8b3f
--- /dev/null
+++ b/contrib/tcpdump/TODO
@@ -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
diff --git a/contrib/tcpdump/VERSION b/contrib/tcpdump/VERSION
index 5a95802..d70c8f8 100644
--- a/contrib/tcpdump/VERSION
+++ b/contrib/tcpdump/VERSION
@@ -1 +1 @@
-3.5
+3.6
diff --git a/contrib/tcpdump/acconfig.h b/contrib/tcpdump/acconfig.h
index 5721258..6a03387 100644
--- a/contrib/tcpdump/acconfig.h
+++ b/contrib/tcpdump/acconfig.h
@@ -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
diff --git a/contrib/tcpdump/ah.h b/contrib/tcpdump/ah.h
new file mode 100644
index 0000000..c22806a
--- /dev/null
+++ b/contrib/tcpdump/ah.h
@@ -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_*/
diff --git a/contrib/tcpdump/appletalk.h b/contrib/tcpdump/appletalk.h
index 766982e..73b2e4e 100644
--- a/contrib/tcpdump/appletalk.h
+++ b/contrib/tcpdump/appletalk.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
diff --git a/contrib/tcpdump/bootp.h b/contrib/tcpdump/bootp.h
index bea254e..49899de 100644
--- a/contrib/tcpdump/bootp.h
+++ b/contrib/tcpdump/bootp.h
@@ -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 */
};
diff --git a/contrib/tcpdump/bpf_dump.c b/contrib/tcpdump/bpf_dump.c
index 8e799ce..4d7f81f 100644
--- a/contrib/tcpdump/bpf_dump.c
+++ b/contrib/tcpdump/bpf_dump.c
@@ -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)
{
diff --git a/contrib/tcpdump/chdlc.h b/contrib/tcpdump/chdlc.h
new file mode 100644
index 0000000..4fb6e1d
--- /dev/null
+++ b/contrib/tcpdump/chdlc.h
@@ -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
diff --git a/contrib/tcpdump/config.guess b/contrib/tcpdump/config.guess
index e9e4455..980ea5b 100755
--- a/contrib/tcpdump/config.guess
+++ b/contrib/tcpdump/config.guess
@@ -1,7 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
-#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+
+timestamp='2000-12-15'
+
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -22,19 +25,97 @@
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to <config-patches@gnu.org>.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
+# don't specify an explicit build system type.
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+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.guess ($timestamp)
+
+Originally written by Per Bothner.
+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" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c
+ for c in cc gcc c89 ; do
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
+ if test $? = 0 ; then
+ CC_FOR_BUILD="$c"; break
+ fi
+ done
+ rm -f $dummy.c $dummy.o
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac
+
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
@@ -43,37 +124,162 @@ fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # Netbsd (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ # Determine the machine/vendor (is the vendor relevant).
+ case "${UNAME_MACHINE}" in
+ amiga) machine=m68k-unknown ;;
+ arm32) machine=arm-unknown ;;
+ atari*) machine=m68k-atari ;;
+ sun3*) machine=m68k-sun ;;
+ mac68k) machine=m68k-apple ;;
+ macppc) machine=powerpc-apple ;;
+ hp3[0-9][05]) machine=m68k-hp ;;
+ ibmrt|romp-ibm) machine=romp-ibm ;;
+ *) machine=${UNAME_MACHINE}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE}" in
+ i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
- echo m68k-cbm-sysv4
+ echo m68k-unknown-sysv4
exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
amiga:OpenBSD:*:*)
- echo m68k-cbm-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
- Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
@@ -81,9 +287,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo pyramid-pyramid-bsd
fi
exit 0 ;;
- NILE:*:*:dcosx)
+ NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -108,26 +317,61 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
atari*:OpenBSD:*:*)
- echo m68k-atari-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
sun3*:OpenBSD:*:*)
- echo m68k-sun-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
- echo m68k-apple-openbsd${UNAME_RELEASE}
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
@@ -141,9 +385,17 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >dummy.c
- int main (argc, argv) int argc; char **argv; {
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -158,10 +410,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit (-1);
}
EOF
- ${CC-cc} dummy.c -o dummy \
- && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
@@ -179,15 +431,18 @@ EOF
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
- -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
echo m88k-dg-dgux${UNAME_RELEASE}
- else
+ else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
fi
- else echo i586-dg-dgux${UNAME_RELEASE}
- fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
@@ -213,7 +468,7 @@ EOF
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >dummy.c
+ sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
@@ -224,8 +479,8 @@ EOF
exit(0);
}
EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@@ -234,7 +489,8 @@ EOF
fi
exit 0 ;;
*:AIX:*:4)
- if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
@@ -246,13 +502,26 @@ EOF
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
+ *:AIX:*:5)
+ case "`lsattr -El proc0 -a type -F value`" in
+ PowerPC*) IBM_ARCH=powerpc
+ IBM_MANUF=ibm ;;
+ Itanium) IBM_ARCH=ia64
+ IBM_MANUF=unknown ;;
+ POWER*) IBM_ARCH=power
+ IBM_MANUF=ibm ;;
+ *) IBM_ARCH=powerpc
+ IBM_MANUF=ibm ;;
+ esac
+ echo ${IBM_ARCH}-${IBM_MANUF}-aix${UNAME_VERSION}.${UNAME_RELEASE}
+ exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
@@ -267,18 +536,71 @@ EOF
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
- 9000/[3478]??:HP-UX:*:*)
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
- 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ 9000/[678][0-9][0-9])
+ case "${HPUX_REV}" in
+ 11.[0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ esac ;;
+ esac
+ fi ;;
+ esac
+ if [ "${HP_ARCH}" = "" ]; then
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
esac
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >dummy.c
+ sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
@@ -303,8 +625,8 @@ EOF
exit (0);
}
EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -313,6 +635,9 @@ EOF
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
+ *9??*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
@@ -329,6 +654,9 @@ EOF
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
@@ -359,101 +687,334 @@ EOF
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
- exit 0 ;;
- hp3[0-9][05]:OpenBSD:*:*)
- echo m68k-hp-openbsd${UNAME_RELEASE}
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
- echo i386-pc-cygwin32
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin32
+ echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
exit 0 ;;
*:Linux:*:*)
+
# The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
- if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
- echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
- echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
- echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
- echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
- echo "powerpc-unknown-linux-gnu" ; exit 0
- elif test "${UNAME_MACHINE}" = "alpha" ; then
- echo alpha-unknown-linux-gnu ; exit 0
- elif test "${UNAME_MACHINE}" = "sparc" ; then
- echo sparc-unknown-linux-gnu ; exit 0
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_supported_emulations=`cd /; ld --help 2>&1 \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ *ia64)
+ echo "${UNAME_MACHINE}-unknown-linux"
+ exit 0
+ ;;
+ i?86linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0
+ ;;
+ elf_i?86)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ i?86coff)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0
+ ;;
+ sparclinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32_sparc)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
+ armlinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32arm*)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
+ exit 0
+ ;;
+ armelf_linux*)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
+ m68klinux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
+ exit 0
+ ;;
+ elf32ppc | elf32ppclinux)
+ # Determine Lib Version
+ cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#if defined(__GLIBC__)
+ printf("%s %s\n", __libc_version, __libc_release);
+#else
+ printf("unkown\n");
+#endif
+ return 0;
+}
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy | grep 1\.99 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.c $dummy
+ echo powerpc-unknown-linux-gnu${LIBC}
+ exit 0
+ ;;
+ shelf_linux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ cat <<EOF >$dummy.s
+ .data
+ \$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+ main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ esac
+
+ objdump --private-headers $dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ elif test "${UNAME_MACHINE}" = "s390"; then
+ echo s390-ibm-linux && exit 0
+ elif test "${UNAME_MACHINE}" = "x86_64"; then
+ echo x86_64-unknown-linux-gnu && exit 0
+ elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*)
+ echo hppa1.1-unknown-linux-gnu
+ ;;
+ PA8*)
+ echo hppa2.0-unknown-linux-gnu
+ ;;
+ *)
+ echo hppa-unknown-linux-gnu
+ ;;
+ esac
+ exit 0
else
- # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
- # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
- test ! -d /usr/lib/ldscripts/. \
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ test -z "$ld_supported_emulations" \
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
# Determine whether the default compiler is a.out or elf
- cat >dummy.c <<EOF
-main(argc, argv)
-int argc;
-char *argv[];
-{
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
#ifdef __ELF__
- printf ("%s-pc-linux-gnu\n", argv[1]);
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
#else
- printf ("%s-pc-linux-gnuaout\n", argv[1]);
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i?86:*:5:7*)
+ # Fixed at (any) Pentium or better
+ UNAME_MACHINE=i586
+ if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
+ echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
@@ -465,11 +1026,24 @@ EOF
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
+ i?86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
@@ -489,7 +1063,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -506,7 +1080,7 @@ EOF
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
- i?86:LynxOS:2.*:*)
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
@@ -518,6 +1092,9 @@ EOF
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
@@ -529,6 +1106,10 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@@ -541,23 +1122,83 @@ EOF
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
- R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ if test "${UNAME_MACHINE}" = "x86pc"; then
+ UNAME_MACHINE=pc
+ fi
+ echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[KW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i?86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-cat >dummy.c <<EOF
+cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
@@ -595,7 +1236,10 @@ main ()
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
@@ -655,8 +1299,8 @@ main ()
}
EOF
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
@@ -688,6 +1332,47 @@ then
esac
fi
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
+
+The $version version of this script cannot recognize your system type.
+Please download the most up to date version of the config scripts:
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess version = $version
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/contrib/tcpdump/config.h.in b/contrib/tcpdump/config.h.in
index f07e42a..3692681 100644
--- a/contrib/tcpdump/config.h.in
+++ b/contrib/tcpdump/config.h.in
@@ -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__
+
diff --git a/contrib/tcpdump/config.sub b/contrib/tcpdump/config.sub
index 0432524..4849dfd 100755
--- a/contrib/tcpdump/config.sub
+++ b/contrib/tcpdump/config.sub
@@ -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 | 6x86 | athlon)
+ basic_machine=i686-pc
;;
- pentiumpro | p6)
- basic_machine=i686-intel
+ pentiumii | pentium2)
+ basic_machine=i686-pc
;;
- pentium-* | p5-*)
+ 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:
diff --git a/contrib/tcpdump/configure b/contrib/tcpdump/configure
index 3c5cfa4..bb8eb99 100755
--- a/contrib/tcpdump/configure
+++ b/contrib/tcpdump/configure
@@ -1,5 +1,67 @@
#! /bin/sh
+# From configure.in Revision: 1.132.4.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
@@ -16,6 +78,8 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-ipv6 enable ipv6 (with ipv4) support
--disable-ipv6 disable ipv6 support"
+ac_help="$ac_help
+ --without-crypto disable crypto support"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -574,7 +638,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:578: checking host system type" >&5
+echo "configure:642: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -595,7 +659,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:599: checking target system type" >&5
+echo "configure:663: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -613,7 +677,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:617: checking build system type" >&5
+echo "configure:681: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -636,12 +700,6 @@ test "$host_alias" != "$target_alias" &&
program_prefix=${target_alias}-
-umask 002
-
-if test -z "$PWD" ; then
- PWD=`pwd`
-fi
-
@@ -667,7 +725,7 @@ fi
# Extract the first word of "shlicc2", so it can be a program name with args.
set dummy shlicc2; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:671: checking for $ac_word" >&5
+echo "configure:729: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_SHLICC2'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -708,7 +766,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:712: checking for $ac_word" >&5
+echo "configure:770: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -738,7 +796,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:742: checking for $ac_word" >&5
+echo "configure:800: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -789,7 +847,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:793: checking for $ac_word" >&5
+echo "configure:851: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -821,7 +879,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:825: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:883: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -832,12 +890,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 836 "configure"
+#line 894 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -863,12 +921,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:867: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:925: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:872: checking whether we are using GNU C" >&5
+echo "configure:930: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -877,7 +935,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -896,7 +954,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:900: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:958: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -933,7 +991,7 @@ fi
V_CCOPT="-O2"
else
echo $ac_n "checking gcc version""... $ac_c" 1>&6
-echo "configure:937: checking gcc version" >&5
+echo "configure:995: checking gcc version" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_gcc_vers'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -951,19 +1009,19 @@ fi
fi
else
echo $ac_n "checking that $CC handles ansi prototypes""... $ac_c" 1>&6
-echo "configure:955: checking that $CC handles ansi prototypes" >&5
+echo "configure:1013: checking that $CC handles ansi prototypes" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_cc_ansi_prototypes'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 960 "configure"
+#line 1018 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
int frob(int, char *)
; return 0; }
EOF
-if { (eval echo configure:967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_cc_ansi_prototypes=yes
else
@@ -981,21 +1039,21 @@ fi
hpux*)
echo $ac_n "checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)""... $ac_c" 1>&6
-echo "configure:985: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5
+echo "configure:1043: checking for HP-UX ansi compiler ($CC -Aa -D_HPUX_SOURCE)" >&5
savedcflags="$CFLAGS"
CFLAGS="-Aa -D_HPUX_SOURCE $CFLAGS"
if eval "test \"`echo '$''{'ac_cv_lbl_cc_hpux_cc_aa'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 992 "configure"
+#line 1050 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
int frob(int, char *)
; return 0; }
EOF
-if { (eval echo configure:999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_cc_hpux_cc_aa=yes
else
@@ -1039,12 +1097,12 @@ EOF
ultrix*)
echo $ac_n "checking that Ultrix $CC hacks const in prototypes""... $ac_c" 1>&6
-echo "configure:1043: checking that Ultrix $CC hacks const in prototypes" >&5
+echo "configure:1101: checking that Ultrix $CC hacks const in prototypes" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_cc_const_proto'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1048 "configure"
+#line 1106 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
@@ -1052,7 +1110,7 @@ struct a { int b; };
void c(const struct a *)
; return 0; }
EOF
-if { (eval echo configure:1056: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_cc_const_proto=yes
else
@@ -1076,21 +1134,21 @@ EOF
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1080: checking for inline" >&5
+echo "configure:1138: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 1087 "configure"
+#line 1145 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:1094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -1116,8 +1174,53 @@ EOF
esac
+echo $ac_n "checking for __attribute__""... $ac_c" 1>&6
+echo "configure:1179: checking for __attribute__" >&5
+if eval "test \"`echo '$''{'ac_cv___attribute__'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+cat > conftest.$ac_ext <<EOF
+#line 1185 "configure"
+#include "confdefs.h"
+
+#include <stdlib.h>
+
+int main() {
+
+static void foo(void) __attribute__ ((noreturn));
+
+static void
+foo(void)
+{
+ exit(1);
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv___attribute__=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv___attribute__=no
+fi
+rm -f conftest*
+fi
+
+if test "$ac_cv___attribute__" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE___ATTRIBUTE__ 1
+EOF
+
+fi
+echo "$ac_t""$ac_cv___attribute__" 1>&6
+
+
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1121: checking how to run the C preprocessor" >&5
+echo "configure:1224: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1132,13 +1235,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1136 "configure"
+#line 1239 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1142: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1149,13 +1252,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1153 "configure"
+#line 1256 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1166,13 +1269,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1170 "configure"
+#line 1273 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1196,21 +1299,21 @@ else
fi
echo "$ac_t""$CPP" 1>&6
-for ac_hdr in fcntl.h malloc.h memory.h rpc/rpcent.h
+for ac_hdr in fcntl.h rpc/rpcent.h netinet/if_ether.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1204: checking for $ac_hdr" >&5
+echo "configure:1307: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1209 "configure"
+#line 1312 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1237,12 +1340,12 @@ fi
done
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1241: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1344: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1246 "configure"
+#line 1349 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -1251,7 +1354,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:1255: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -1276,65 +1379,33 @@ case "$target_os" in
linux*)
echo $ac_n "checking Linux kernel version""... $ac_c" 1>&6
-echo "configure:1280: checking Linux kernel version" >&5
- if eval "test \"`echo '$''{'ac_cv_linux_vers'+set}'`\" = set"; then
+echo "configure:1383: checking Linux kernel version" >&5
+ if test "$cross_compiling" = yes; then
+ if eval "test \"`echo '$''{'ac_cv_linux_vers'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_linux_vers=unknown
+fi
+
+ else
+ if eval "test \"`echo '$''{'ac_cv_linux_vers'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_linux_vers=`uname -r 2>&1 | \
- sed -n -e '$s/.* //' -e '$s/\..*//p'`
+ sed -n -e '$s/.* //' -e '$s/\..*//p'`
fi
+ fi
echo "$ac_t""$ac_cv_linux_vers" 1>&6
+ if test $ac_cv_linux_vers = unknown ; then
+ { echo "configure: error: cannot determine linux version when cross-compiling" 1>&2; exit 1; }
+ fi
if test $ac_cv_linux_vers -lt 2 ; then
{ echo "configure: error: version 2 or higher required; see the INSTALL doc for more info" 1>&2; exit 1; }
fi
- cat >> confdefs.h <<\EOF
-#define HAVE_NET_SLIP_H 1
-EOF
-
;;
*)
- for ac_hdr in net/slip.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1303: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1308 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
;;
esac
@@ -1343,17 +1414,17 @@ for ac_hdr in smi.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1347: checking for $ac_hdr" >&5
+echo "configure:1418: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1352 "configure"
+#line 1423 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1357: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1379,23 +1450,27 @@ else
fi
done
-echo $ac_n "checking for main in -lsmi""... $ac_c" 1>&6
-echo "configure:1384: checking for main in -lsmi" >&5
-ac_lib_var=`echo smi'_'main | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for smiInit in -lsmi""... $ac_c" 1>&6
+echo "configure:1455: checking for smiInit in -lsmi" >&5
+ac_lib_var=`echo smi'_'smiInit | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
LIBS="-lsmi $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1392 "configure"
+#line 1463 "configure"
#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char smiInit();
int main() {
-main()
+smiInit()
; return 0; }
EOF
-if { (eval echo configure:1399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1423,25 +1498,35 @@ else
fi
echo $ac_n "checking whether to enable libsmi""... $ac_c" 1>&6
-echo "configure:1427: checking whether to enable libsmi" >&5
+echo "configure:1502: checking whether to enable libsmi" >&5
if test "$cross_compiling" = yes; then
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+ echo "$ac_t""not when cross-compiling" 1>&6
+ libsmi=no
+
else
cat > conftest.$ac_ext <<EOF
-#line 1432 "configure"
+#line 1509 "configure"
#include "confdefs.h"
/* 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", &current, &revision, &age);
+ if (n != 3)
+ exit(3);
+ if (required < current - age || required > current)
+ exit(4);
+ exit(0);
}
EOF
-if { (eval echo configure:1445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
@@ -1455,7 +1540,6 @@ else
rm -fr conftest*
echo "$ac_t""no" 1>&6
libsmi=no
-
fi
rm -fr conftest*
fi
@@ -1464,16 +1548,12 @@ fi
CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6
-echo "configure:1468: checking whether to enable ipv6" >&5
+echo "configure:1552: checking whether to enable ipv6" >&5
# Check whether --enable-ipv6 or --disable-ipv6 was given.
if test "${enable_ipv6+set}" = set; then
enableval="$enable_ipv6"
case "$enableval" in
yes) echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define ENABLE_IPV6 1
-EOF
-
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"
cat >> confdefs.h <<\EOF
#define INET6 1
@@ -1493,7 +1573,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1497 "configure"
+#line 1577 "configure"
#include "confdefs.h"
/* AF_INET6 available check */
#include <sys/types.h>
@@ -1507,13 +1587,9 @@ main()
}
EOF
-if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define ENABLE_IPV6 1
-EOF
-
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"
cat >> confdefs.h <<\EOF
#define INET6 1
@@ -1539,12 +1615,12 @@ ipv6trylibc=no
if test "$ipv6" = "yes"; then
echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
-echo "configure:1543: checking ipv6 stack type" >&5
+echo "configure:1619: checking ipv6 stack type" >&5
for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
case $i in
inria)
cat > conftest.$ac_ext <<EOF
-#line 1548 "configure"
+#line 1624 "configure"
#include "confdefs.h"
dnl
#include <netinet/in.h>
@@ -1563,7 +1639,7 @@ rm -f conftest*
;;
kame)
cat > conftest.$ac_ext <<EOF
-#line 1567 "configure"
+#line 1643 "configure"
#include "confdefs.h"
dnl
#include <netinet/in.h>
@@ -1585,7 +1661,7 @@ rm -f conftest*
;;
linux-glibc)
cat > conftest.$ac_ext <<EOF
-#line 1589 "configure"
+#line 1665 "configure"
#include "confdefs.h"
dnl
#include <features.h>
@@ -1613,7 +1689,7 @@ rm -f conftest*
;;
toshiba)
cat > conftest.$ac_ext <<EOF
-#line 1617 "configure"
+#line 1693 "configure"
#include "confdefs.h"
dnl
#include <sys/param.h>
@@ -1634,7 +1710,7 @@ rm -f conftest*
;;
v6d)
cat > conftest.$ac_ext <<EOF
-#line 1638 "configure"
+#line 1714 "configure"
#include "confdefs.h"
dnl
#include </usr/local/v6/include/sys/v6config.h>
@@ -1655,7 +1731,7 @@ rm -f conftest*
;;
zeta)
cat > conftest.$ac_ext <<EOF
-#line 1659 "configure"
+#line 1735 "configure"
#include "confdefs.h"
dnl
#include <sys/param.h>
@@ -1700,63 +1776,72 @@ fi
if test "$ipv6" = "yes"; then
- for ac_func in getaddrinfo
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1707: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+
+echo $ac_n "checking for library containing getaddrinfo""... $ac_c" 1>&6
+echo "configure:1782: checking for library containing getaddrinfo" >&5
+if eval "test \"`echo '$''{'ac_cv_search_getaddrinfo'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1712 "configure"
+ ac_func_search_save_LIBS="$LIBS"
+ac_cv_search_getaddrinfo="no"
+cat > conftest.$ac_ext <<EOF
+#line 1789 "configure"
#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char $ac_func();
+char getaddrinfo();
int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+getaddrinfo()
; return 0; }
EOF
-if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
+ ac_cv_search_getaddrinfo="none required"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+test "$ac_cv_search_getaddrinfo" = "no" && for i in socket; do
+LIBS="-l$i $ac_func_search_save_LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1811 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char getaddrinfo();
+
+int main() {
+getaddrinfo()
+; return 0; }
+EOF
+if { (eval echo configure:1822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
+ ac_cv_search_getaddrinfo="-l$i"
+break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
fi
rm -f conftest*
+done
+LIBS="$ac_func_search_save_LIBS"
fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- echo $ac_n "checking getaddrinfo bug""... $ac_c" 1>&6
-echo "configure:1754: checking getaddrinfo bug" >&5
+echo "$ac_t""$ac_cv_search_getaddrinfo" 1>&6
+if test "$ac_cv_search_getaddrinfo" != "no"; then
+ test "$ac_cv_search_getaddrinfo" = "none required" || LIBS="$ac_cv_search_getaddrinfo $LIBS"
+ echo $ac_n "checking getaddrinfo bug""... $ac_c" 1>&6
+echo "configure:1839: checking getaddrinfo bug" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""buggy" 1>&6
buggygetaddrinfo=yes
else
cat > conftest.$ac_ext <<EOF
-#line 1760 "configure"
+#line 1845 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -1853,7 +1938,7 @@ main()
}
EOF
-if { (eval echo configure:1857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""good" 1>&6
buggygetaddrinfo=no
@@ -1867,12 +1952,9 @@ fi
rm -fr conftest*
fi
-else
- echo "$ac_t""no" 1>&6
-buggygetaddrinfo=yes
+else :
+ buggygetaddrinfo=yes
fi
-done
-
if test "$buggygetaddrinfo" = "yes"; then
if test "$ipv6type" != "linux"; then
@@ -1888,12 +1970,12 @@ done
for ac_func in getaddrinfo getnameinfo
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1892: checking for $ac_func" >&5
+echo "configure:1974: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1897 "configure"
+#line 1979 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1916,7 +1998,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1943,15 +2025,37 @@ done
fi
-for ac_func in inet_ntop inet_pton inet_aton
+echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
+echo "configure:2030: checking for inet_ntop" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2032 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+int main() {
+char src[4], dst[128];
+inet_ntop(AF_INET, src, dst, sizeof(dst));
+; return 0; }
+EOF
+if { (eval echo configure:2043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ for ac_func in inet_ntop
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1950: checking for $ac_func" >&5
+echo "configure:2054: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1955 "configure"
+#line 2059 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1974,7 +2078,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2000,88 +2104,213 @@ fi
done
+fi
+rm -f conftest*
+echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
+echo "configure:2111: checking for inet_pton" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2113 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+int main() {
+char src[128], dst[4];
+inet_pton(AF_INET, src, dst);
+; return 0; }
+EOF
+if { (eval echo configure:2124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ for ac_func in inet_pton
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2135: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2140 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:2163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
- echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
-echo "configure:2007: checking if sockaddr struct has sa_len member" >&5
- if eval "test \"`echo '$''{'ac_cv_sockaddr_has_sa_len'+set}'`\" = set"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+fi
+rm -f conftest*
+echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
+echo "configure:2192: checking for inet_aton" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2194 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+int main() {
+char src[128];
+struct in_addr dst;
+inet_aton(src, &dst);
+; return 0; }
+EOF
+if { (eval echo configure:2205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+ for ac_func in inet_aton
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2216: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2012 "configure"
+#line 2221 "configure"
#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
-# include <sys/types.h>
-# include <sys/socket.h>
int main() {
-u_int i = sizeof(((struct sockaddr *)0)->sa_len)
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
; return 0; }
EOF
-if { (eval echo configure:2021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- ac_cv_sockaddr_has_sa_len=yes
+ eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_sockaddr_has_sa_len=no
+ eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
- echo "$ac_t""$ac_cv_sockaddr_has_sa_len" 1>&6
- if test $ac_cv_sockaddr_has_sa_len = yes ; then
- cat >> confdefs.h <<\EOF
-#define HAVE_SOCKADDR_SA_LEN 1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
- fi
-if test "$ac_cv_sockaddr_has_sa_len" = no; then
- missing_includes=yes
fi
+rm -f conftest*
- echo $ac_n "checking for __P""... $ac_c" 1>&6
-echo "configure:2047: checking for __P" >&5
- if eval "test \"`echo '$''{'ac_cv_portable_proto'+set}'`\" = set"; then
+ echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
+echo "configure:2275: checking if sockaddr struct has sa_len member" >&5
+ if eval "test \"`echo '$''{'ac_cv_sockaddr_has_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2052 "configure"
+#line 2280 "configure"
#include "confdefs.h"
-# include <unistd.h>
+# include <sys/types.h>
+# include <sys/socket.h>
int main() {
-int f __P(())
+u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
EOF
-if { (eval echo configure:2060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- ac_cv_portable_proto=yes
+ ac_cv_sockaddr_has_sa_len=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_portable_proto=no
+ ac_cv_sockaddr_has_sa_len=no
fi
rm -f conftest*
fi
- echo "$ac_t""$ac_cv_portable_proto" 1>&6
- if test $ac_cv_portable_proto = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_PORTABLE_PROTOTYPE 1
+ echo "$ac_t""$ac_cv_sockaddr_has_sa_len" 1>&6
+ if test $ac_cv_sockaddr_has_sa_len = yes ; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SOCKADDR_SA_LEN 1
EOF
fi
-if test "$ac_cv_portable_proto" = no; then
+if test "$ac_cv_sockaddr_has_sa_len" = no; then
missing_includes=yes
fi
echo $ac_n "checking size of char""... $ac_c" 1>&6
-echo "configure:2085: checking size of char" >&5
+echo "configure:2314: checking size of char" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2089,7 +2318,7 @@ else
ac_cv_sizeof_char=1
else
cat > conftest.$ac_ext <<EOF
-#line 2093 "configure"
+#line 2322 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -2100,7 +2329,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:2104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_char=`cat conftestval`
else
@@ -2120,7 +2349,7 @@ EOF
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:2124: checking size of short" >&5
+echo "configure:2353: checking size of short" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2128,7 +2357,7 @@ else
ac_cv_sizeof_short=2
else
cat > conftest.$ac_ext <<EOF
-#line 2132 "configure"
+#line 2361 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -2139,7 +2368,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_short=`cat conftestval`
else
@@ -2159,7 +2388,7 @@ EOF
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:2163: checking size of int" >&5
+echo "configure:2392: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2167,7 +2396,7 @@ else
ac_cv_sizeof_int=4
else
cat > conftest.$ac_ext <<EOF
-#line 2171 "configure"
+#line 2400 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -2178,7 +2407,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:2182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
@@ -2198,7 +2427,7 @@ EOF
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:2202: checking size of long" >&5
+echo "configure:2431: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2206,7 +2435,7 @@ else
ac_cv_sizeof_long=4
else
cat > conftest.$ac_ext <<EOF
-#line 2210 "configure"
+#line 2439 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -2217,7 +2446,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:2221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
@@ -2240,12 +2469,12 @@ EOF
echo $ac_n "checking for addrinfo""... $ac_c" 1>&6
-echo "configure:2244: checking for addrinfo" >&5
+echo "configure:2473: checking for addrinfo" >&5
if eval "test \"`echo '$''{'ac_cv_addrinfo'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2249 "configure"
+#line 2478 "configure"
#include "confdefs.h"
# include <netdb.h>
@@ -2253,7 +2482,7 @@ int main() {
struct addrinfo a
; return 0; }
EOF
-if { (eval echo configure:2257: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2486: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_addrinfo=yes
else
@@ -2284,12 +2513,12 @@ fi
echo $ac_n "checking for NI_MAXSERV""... $ac_c" 1>&6
-echo "configure:2288: checking for NI_MAXSERV" >&5
+echo "configure:2517: checking for NI_MAXSERV" >&5
if eval "test \"`echo '$''{'ac_cv_maxserv'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2293 "configure"
+#line 2522 "configure"
#include "confdefs.h"
#include <netdb.h>
#ifdef NI_MAXSERV
@@ -2322,12 +2551,12 @@ fi
echo $ac_n "checking for NI_NAMEREQD""... $ac_c" 1>&6
-echo "configure:2326: checking for NI_NAMEREQD" >&5
+echo "configure:2555: checking for NI_NAMEREQD" >&5
if eval "test \"`echo '$''{'ac_cv_namereqd'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2331 "configure"
+#line 2560 "configure"
#include "confdefs.h"
#include <netdb.h>
#ifdef NI_NOFQDN
@@ -2360,12 +2589,12 @@ fi
echo $ac_n "checking for sockaddr_storage""... $ac_c" 1>&6
-echo "configure:2364: checking for sockaddr_storage" >&5
+echo "configure:2593: checking for sockaddr_storage" >&5
if eval "test \"`echo '$''{'ac_cv_sa_storage'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2369 "configure"
+#line 2598 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2374,7 +2603,7 @@ int main() {
struct sockaddr_storage s
; return 0; }
EOF
-if { (eval echo configure:2378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_sa_storage=yes
else
@@ -2401,12 +2630,12 @@ fi
ac_cv_addrsz=yes
echo $ac_n "checking for INADDRSZ""... $ac_c" 1>&6
-echo "configure:2405: checking for INADDRSZ" >&5
+echo "configure:2634: checking for INADDRSZ" >&5
if eval "test \"`echo '$''{'ac_cv_inaddrsz'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2410 "configure"
+#line 2639 "configure"
#include "confdefs.h"
# include <arpa/nameser.h>
@@ -2414,7 +2643,7 @@ int main() {
int a = INADDRSZ
; return 0; }
EOF
-if { (eval echo configure:2418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2647: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_inaddrsz=yes
else
@@ -2436,12 +2665,12 @@ EOF
ac_cv_addrsz=no
fi
echo $ac_n "checking for IN6ADDRSZ""... $ac_c" 1>&6
-echo "configure:2440: checking for IN6ADDRSZ" >&5
+echo "configure:2669: checking for IN6ADDRSZ" >&5
if eval "test \"`echo '$''{'ac_cv_in6addrsz'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2445 "configure"
+#line 2674 "configure"
#include "confdefs.h"
# include <arpa/nameser.h>
@@ -2449,7 +2678,7 @@ int main() {
int a = IN6ADDRSZ
; return 0; }
EOF
-if { (eval echo configure:2453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_in6addrsz=yes
else
@@ -2477,12 +2706,12 @@ fi
echo $ac_n "checking for RES_USE_INET6""... $ac_c" 1>&6
-echo "configure:2481: checking for RES_USE_INET6" >&5
+echo "configure:2710: checking for RES_USE_INET6" >&5
if eval "test \"`echo '$''{'ac_cv_res_inet6'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2486 "configure"
+#line 2715 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2492,7 +2721,7 @@ int main() {
int a = RES_USE_INET6
; return 0; }
EOF
-if { (eval echo configure:2496: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_res_inet6=yes
else
@@ -2517,56 +2746,13 @@ if test "$ac_cv_res_inet6" = no; then
fi
- echo $ac_n "checking for AAAA""... $ac_c" 1>&6
-echo "configure:2522: checking for AAAA" >&5
- if eval "test \"`echo '$''{'ac_cv_aaaa'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2527 "configure"
-#include "confdefs.h"
-
-# include <sys/types.h>
-# include <arpa/nameser.h>
-int main() {
-int a = T_AAAA
-; return 0; }
-EOF
-if { (eval echo configure:2536: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_aaaa=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_aaaa=no
-fi
-rm -f conftest*
-fi
-
- echo "$ac_t""$ac_cv_aaaa" 1>&6
- if test $ac_cv_aaaa = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_AAAA 1
-EOF
-
- fi
-
-if test "$ac_cv_aaaa" = no; then
- cat >> confdefs.h <<\EOF
-#define T_AAAA 28
-EOF
-
-fi
-
-
echo $ac_n "checking for res_state_ext""... $ac_c" 1>&6
-echo "configure:2565: checking for res_state_ext" >&5
+echo "configure:2751: checking for res_state_ext" >&5
if eval "test \"`echo '$''{'ac_cv_res_state_ext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2570 "configure"
+#line 2756 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2577,7 +2763,7 @@ int main() {
struct __res_state_ext e
; return 0; }
EOF
-if { (eval echo configure:2581: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_res_state_ext=yes
else
@@ -2603,12 +2789,12 @@ fi
echo $ac_n "checking for nsort in res_state""... $ac_c" 1>&6
-echo "configure:2607: checking for nsort in res_state" >&5
+echo "configure:2793: checking for nsort in res_state" >&5
if eval "test \"`echo '$''{'ac_cv_res_state'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2612 "configure"
+#line 2798 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -2619,7 +2805,7 @@ int main() {
struct __res_state e; e.nsort = 0
; return 0; }
EOF
-if { (eval echo configure:2623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2809: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_res_state=yes
else
@@ -2646,15 +2832,15 @@ if test "$missing_includes" = "yes"; then
fi
-for ac_func in vfprintf strcasecmp
+for ac_func in vfprintf strcasecmp strlcat strlcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2653: checking for $ac_func" >&5
+echo "configure:2839: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2658 "configure"
+#line 2844 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2677,7 +2863,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2703,15 +2889,15 @@ fi
done
-for ac_func in ether_ntohost setlinebuf gethostbyname2
+for ac_func in ether_ntohost setlinebuf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2710: checking for $ac_func" >&5
+echo "configure:2896: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2715 "configure"
+#line 2901 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2734,7 +2920,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2759,15 +2945,140 @@ fi
done
+usegetipnodeby=yes
+for ac_func in getipnodebyname getipnodebyaddr freeaddrinfo
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2953: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2958 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+usegetipnodeby=no
+fi
+done
+
+if test $usegetipnodeby = yes; then
+ cat >> confdefs.h <<\EOF
+#define USE_GETIPNODEBY 1
+EOF
+
+fi
+
+needsnprintf=no
+for ac_func in vsnprintf snprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3017: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3022 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+needsnprintf=yes
+fi
+done
+
+if test $needsnprintf = yes; then
+ LIBOBJS="$LIBOBJS snprintf.o"
+fi
+
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:2764: checking whether byte ordering is bigendian" >&5
+echo "configure:3075: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 2771 "configure"
+#line 3082 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -2778,11 +3089,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:2782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
-#line 2786 "configure"
+#line 3097 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -2793,7 +3104,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:2797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -2813,7 +3124,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2817 "configure"
+#line 3128 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -2826,7 +3137,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:2830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -2851,7 +3162,7 @@ fi
echo $ac_n "checking for main in -ldnet""... $ac_c" 1>&6
-echo "configure:2855: checking for main in -ldnet" >&5
+echo "configure:3166: checking for main in -ldnet" >&5
ac_lib_var=`echo dnet'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2859,14 +3170,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2863 "configure"
+#line 3174 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2894,7 +3205,7 @@ else
fi
echo $ac_n "checking for main in -lrpc""... $ac_c" 1>&6
-echo "configure:2898: checking for main in -lrpc" >&5
+echo "configure:3209: checking for main in -lrpc" >&5
ac_lib_var=`echo rpc'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2902,14 +3213,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lrpc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2906 "configure"
+#line 3217 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2936,27 +3247,27 @@ else
echo "$ac_t""no" 1>&6
fi
-echo $ac_n "checking for uncompress in -lz""... $ac_c" 1>&6
-echo "configure:2941: checking for uncompress in -lz" >&5
-ac_lib_var=`echo z'_'uncompress | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for getrpcbynumber in -lnsl""... $ac_c" 1>&6
+echo "configure:3252: checking for getrpcbynumber in -lnsl" >&5
+ac_lib_var=`echo nsl'_'getrpcbynumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_save_LIBS="$LIBS"
-LIBS="-lz $LIBS"
+LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2949 "configure"
+#line 3260 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char uncompress();
+char getrpcbynumber();
int main() {
-uncompress()
+getrpcbynumber()
; return 0; }
EOF
-if { (eval echo configure:2960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2971,67 +3282,27 @@ LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo z | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
cat >> confdefs.h <<EOF
#define $ac_tr_lib 1
EOF
- LIBS="-lz $LIBS"
+ LIBS="-lnsl $LIBS"
else
echo "$ac_t""no" 1>&6
fi
-for ac_hdr in zlib.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2991: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2996 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3030: checking return type of signal handlers" >&5
+echo "configure:3301: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3035 "configure"
+#line 3306 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -3048,7 +3319,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:3052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -3090,12 +3361,12 @@ EOF
for ac_func in sigset
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3094: checking for $ac_func" >&5
+echo "configure:3365: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3099 "configure"
+#line 3370 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3118,7 +3389,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3146,12 +3417,12 @@ done
for ac_func in sigaction
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3150: checking for $ac_func" >&5
+echo "configure:3421: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3155 "configure"
+#line 3426 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3174,7 +3445,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3206,12 +3477,12 @@ done
# Most operating systems have gethostbyname() in the default searched
# libraries (i.e. libc):
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:3210: checking for gethostbyname" >&5
+echo "configure:3481: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3215 "configure"
+#line 3486 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -3234,7 +3505,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:3238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -3253,7 +3524,7 @@ else
echo "$ac_t""no" 1>&6
# Some OSes (eg. Solaris) place it in libnsl:
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3257: checking for gethostbyname in -lnsl" >&5
+echo "configure:3528: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname'_' | sed 'y%./+- %__p__%'`
if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3261,7 +3532,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3265 "configure"
+#line 3536 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3272,7 +3543,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lbl_lib_$ac_lib_var=yes"
else
@@ -3299,7 +3570,7 @@ else
echo "$ac_t""no" 1>&6
# Some strange OSes (SINIX) have it in libsocket:
echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6
-echo "configure:3303: checking for gethostbyname in -lsocket" >&5
+echo "configure:3574: checking for gethostbyname in -lsocket" >&5
ac_lib_var=`echo socket'_'gethostbyname'_' | sed 'y%./+- %__p__%'`
if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3307,7 +3578,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3311 "configure"
+#line 3582 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3318,7 +3589,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lbl_lib_$ac_lib_var=yes"
else
@@ -3347,7 +3618,7 @@ else
# AC_CHECK_LIB's API is essentially broken so the
# following ugliness is necessary:
echo $ac_n "checking for gethostbyname in -lsocket""... $ac_c" 1>&6
-echo "configure:3351: checking for gethostbyname in -lsocket" >&5
+echo "configure:3622: checking for gethostbyname in -lsocket" >&5
ac_lib_var=`echo socket'_'gethostbyname'_'-lnsl | sed 'y%./+- %__p__%'`
if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3355,7 +3626,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket -lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3359 "configure"
+#line 3630 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3366,7 +3637,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lbl_lib_$ac_lib_var=yes"
else
@@ -3385,7 +3656,7 @@ if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for gethostbyname in -lresolv""... $ac_c" 1>&6
-echo "configure:3389: checking for gethostbyname in -lresolv" >&5
+echo "configure:3660: checking for gethostbyname in -lresolv" >&5
ac_lib_var=`echo resolv'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3393,7 +3664,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3397 "configure"
+#line 3668 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3404,7 +3675,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:3408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3440,12 +3711,12 @@ fi
fi
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:3444: checking for socket" >&5
+echo "configure:3715: checking for socket" >&5
if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3449 "configure"
+#line 3720 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
@@ -3468,7 +3739,7 @@ socket();
; return 0; }
EOF
-if { (eval echo configure:3472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
@@ -3486,7 +3757,7 @@ if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:3490: checking for socket in -lsocket" >&5
+echo "configure:3761: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3494,7 +3765,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3498 "configure"
+#line 3769 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3505,7 +3776,7 @@ int main() {
socket()
; return 0; }
EOF
-if { (eval echo configure:3509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3531,7 +3802,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:3535: checking for socket in -lsocket" >&5
+echo "configure:3806: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket'_'-lnsl | sed 'y%./+- %__p__%'`
if eval "test \"`echo '$''{'ac_cv_lbl_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3539,7 +3810,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket -lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3543 "configure"
+#line 3814 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3550,7 +3821,7 @@ int main() {
socket()
; return 0; }
EOF
-if { (eval echo configure:3554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lbl_lib_$ac_lib_var=yes"
else
@@ -3576,7 +3847,7 @@ fi
# DLPI needs putmsg under HPUX so test for -lstr while we're at it
echo $ac_n "checking for putmsg in -lstr""... $ac_c" 1>&6
-echo "configure:3580: checking for putmsg in -lstr" >&5
+echo "configure:3851: checking for putmsg in -lstr" >&5
ac_lib_var=`echo str'_'putmsg | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3584,7 +3855,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lstr $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3588 "configure"
+#line 3859 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3595,7 +3866,7 @@ int main() {
putmsg()
; return 0; }
EOF
-if { (eval echo configure:3599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3630,12 +3901,12 @@ fi
for ac_func in pfopen
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3634: checking for $ac_func" >&5
+echo "configure:3905: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3639 "configure"
+#line 3910 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3658,7 +3929,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3688,11 +3959,11 @@ done
fi
fi
echo $ac_n "checking for local pcap library""... $ac_c" 1>&6
-echo "configure:3692: checking for local pcap library" >&5
+echo "configure:3963: checking for local pcap library" >&5
libpcap=FAIL
lastdir=FAIL
places=`ls .. | sed -e 's,/$,,' -e 's,^,../,' | \
- egrep '/libpcap-[0-9]*\.[0-9]*(\.[0-9]*)?([ab][0-9]*)?$'`
+ egrep '/libpcap-[0-9]*.[0-9]*(.[0-9]*)?([ab][0-9]*)?$'`
for dir in $places ../libpcap libpcap ; do
basedir=`echo $dir | sed -e 's/[ab][0-9]*$//'`
if test $lastdir = $basedir ; then
@@ -3707,7 +3978,7 @@ echo "configure:3692: checking for local pcap library" >&5
if test $libpcap = FAIL ; then
echo "$ac_t""not found" 1>&6
echo $ac_n "checking for main in -lpcap""... $ac_c" 1>&6
-echo "configure:3711: checking for main in -lpcap" >&5
+echo "configure:3982: checking for main in -lpcap" >&5
ac_lib_var=`echo pcap'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3715,14 +3986,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3719 "configure"
+#line 3990 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:3726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3748,7 +4019,7 @@ fi
else
V_PCAPDEP=$libpcap
if test -r $d/pcap.h; then
- V_INCLS="-I$d $V_INCLS"
+ V_INCLS="-I$d $V_INCLS"
elif test -r $srcdir/../libpcap/pcap.h; then
V_INCLS="-I$d -I$srcdir/../libpcap $V_INCLS"
else
@@ -3762,7 +4033,7 @@ fi
aix*)
pseexe="/lib/pse.exp"
echo $ac_n "checking for $pseexe""... $ac_c" 1>&6
-echo "configure:3766: checking for $pseexe" >&5
+echo "configure:4037: checking for $pseexe" >&5
if test -f $pseexe ; then
echo "$ac_t""yes" 1>&6
LIBS="$LIBS -I:$pseexe"
@@ -3770,6 +4041,63 @@ echo "configure:3766: checking for $pseexe" >&5
;;
esac
+for ac_func in bpf_dump
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4048: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4053 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
V_GROUP=0
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
V_GROUP=wheel
@@ -3787,16 +4115,8 @@ irix*)
V_GROUP=sys
;;
-linux*)
- V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
- ;;
-
osf*)
V_GROUP=system
- cat >> confdefs.h <<\EOF
-#define __STDC__ 2
-EOF
-
;;
solaris*)
@@ -3809,12 +4129,12 @@ if test -f /dev/bpf0 ; then
fi
echo $ac_n "checking for u_int8_t using $CC""... $ac_c" 1>&6
-echo "configure:3813: checking for u_int8_t using $CC" >&5
+echo "configure:4133: checking for u_int8_t using $CC" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int8_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3818 "configure"
+#line 4138 "configure"
#include "confdefs.h"
# include "confdefs.h"
@@ -3827,7 +4147,7 @@ int main() {
u_int8_t i
; return 0; }
EOF
-if { (eval echo configure:3831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_have_u_int8_t=yes
else
@@ -3847,12 +4167,12 @@ EOF
fi
echo $ac_n "checking for int16_t using $CC""... $ac_c" 1>&6
-echo "configure:3851: checking for int16_t using $CC" >&5
+echo "configure:4171: checking for int16_t using $CC" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_have_int16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3856 "configure"
+#line 4176 "configure"
#include "confdefs.h"
# include "confdefs.h"
@@ -3865,7 +4185,7 @@ int main() {
int16_t i
; return 0; }
EOF
-if { (eval echo configure:3869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_have_int16_t=yes
else
@@ -3885,12 +4205,12 @@ EOF
fi
echo $ac_n "checking for u_int16_t using $CC""... $ac_c" 1>&6
-echo "configure:3889: checking for u_int16_t using $CC" >&5
+echo "configure:4209: checking for u_int16_t using $CC" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3894 "configure"
+#line 4214 "configure"
#include "confdefs.h"
# include "confdefs.h"
@@ -3903,7 +4223,7 @@ int main() {
u_int16_t i
; return 0; }
EOF
-if { (eval echo configure:3907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_have_u_int16_t=yes
else
@@ -3923,12 +4243,12 @@ EOF
fi
echo $ac_n "checking for int32_t using $CC""... $ac_c" 1>&6
-echo "configure:3927: checking for int32_t using $CC" >&5
+echo "configure:4247: checking for int32_t using $CC" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_have_int32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3932 "configure"
+#line 4252 "configure"
#include "confdefs.h"
# include "confdefs.h"
@@ -3941,7 +4261,7 @@ int main() {
int32_t i
; return 0; }
EOF
-if { (eval echo configure:3945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_have_int32_t=yes
else
@@ -3961,12 +4281,12 @@ EOF
fi
echo $ac_n "checking for u_int32_t using $CC""... $ac_c" 1>&6
-echo "configure:3965: checking for u_int32_t using $CC" >&5
+echo "configure:4285: checking for u_int32_t using $CC" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_have_u_int32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3970 "configure"
+#line 4290 "configure"
#include "confdefs.h"
# include "confdefs.h"
@@ -3979,7 +4299,7 @@ int main() {
u_int32_t i
; return 0; }
EOF
-if { (eval echo configure:3983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_have_u_int32_t=yes
else
@@ -4039,12 +4359,12 @@ EOF
fi
echo $ac_n "checking if sockaddr struct has sa_len member""... $ac_c" 1>&6
-echo "configure:4043: checking if sockaddr struct has sa_len member" >&5
+echo "configure:4363: checking if sockaddr struct has sa_len member" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_sockaddr_has_sa_len'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4048 "configure"
+#line 4368 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -4053,7 +4373,7 @@ int main() {
u_int i = sizeof(((struct sockaddr *)0)->sa_len)
; return 0; }
EOF
-if { (eval echo configure:4057: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4377: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_lbl_sockaddr_has_sa_len=yes
else
@@ -4073,154 +4393,15 @@ EOF
fi
-echo $ac_n "checking if ether_header uses ether_addr structs""... $ac_c" 1>&6
-echo "configure:4078: checking if ether_header uses ether_addr structs" >&5
-if eval "test \"`echo '$''{'ac_cv_ether_header_has_ea'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- LBL_SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $V_INCLS"
- cat > conftest.$ac_ext <<EOF
-#line 4085 "configure"
-#include "confdefs.h"
-
-# 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>
-int main() {
-u_int i =
- sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)
-; return 0; }
-EOF
-if { (eval echo configure:4103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_ether_header_has_ea=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_ether_header_has_ea=no
-fi
-rm -f conftest*
- CFLAGS="$LBL_SAVE_CFLAGS"
-fi
-
-echo "$ac_t""$ac_cv_ether_header_has_ea" 1>&6
-if test $ac_cv_ether_header_has_ea = yes ; then
- cat >> confdefs.h <<\EOF
-#define ETHER_HEADER_HAS_EA 1
-EOF
-
-fi
-
-echo $ac_n "checking if ether_arp uses ether_addr structs""... $ac_c" 1>&6
-echo "configure:4125: checking if ether_arp uses ether_addr structs" >&5
-if eval "test \"`echo '$''{'ac_cv_ether_arp_has_ea'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- LBL_SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $V_INCLS"
- cat > conftest.$ac_ext <<EOF
-#line 4132 "configure"
-#include "confdefs.h"
-
-# 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>
-int main() {
-u_int i =
- sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)
-; return 0; }
-EOF
-if { (eval echo configure:4150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_ether_arp_has_ea=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_ether_arp_has_ea=no
-fi
-rm -f conftest*
- CFLAGS="$LBL_SAVE_CFLAGS"
-fi
-
-echo "$ac_t""$ac_cv_ether_arp_has_ea" 1>&6
-if test $ac_cv_ether_arp_has_ea = yes ; then
- cat >> confdefs.h <<\EOF
-#define ETHER_ARP_HAS_EA 1
-EOF
-
-fi
-
-echo $ac_n "checking if ether_arp uses erp_xsha member""... $ac_c" 1>&6
-echo "configure:4172: checking if ether_arp uses erp_xsha member" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_ether_arp_x'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- LBL_SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $V_INCLS"
- cat > conftest.$ac_ext <<EOF
-#line 4179 "configure"
-#include "confdefs.h"
-
-# 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>
-int main() {
-u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)
-; return 0; }
-EOF
-if { (eval echo configure:4196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_struct_ether_arp_x=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_struct_ether_arp_x=no
-fi
-rm -f conftest*
- CFLAGS="$LBL_SAVE_CFLAGS"
-fi
-
-echo "$ac_t""$ac_cv_struct_ether_arp_x" 1>&6
-if test $ac_cv_struct_ether_arp_x = yes ; then
- cat >> confdefs.h <<\EOF
-#define ETHER_ARP_HAS_X 1
-EOF
-
-fi
-
echo $ac_n "checking if unaligned accesses fail""... $ac_c" 1>&6
-echo "configure:4218: checking if unaligned accesses fail" >&5
+echo "configure:4398: checking if unaligned accesses fail" >&5
if eval "test \"`echo '$''{'ac_cv_lbl_unaligned_fail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
case "$target_cpu" in
- alpha|hp*|mips|sparc)
+ # XXX: should also check that they don't do weird things (like on arm)
+ alpha*|arm*|hp*|mips|sparc)
ac_cv_lbl_unaligned_fail=yes
;;
@@ -4278,12 +4459,12 @@ EOF
echo $ac_n "checking for h_errno""... $ac_c" 1>&6
-echo "configure:4282: checking for h_errno" >&5
+echo "configure:4463: checking for h_errno" >&5
if eval "test \"`echo '$''{'ac_cv_var_h_errno'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4287 "configure"
+#line 4468 "configure"
#include "confdefs.h"
# include <sys/types.h>
@@ -4292,7 +4473,7 @@ int main() {
int foo = h_errno;
; return 0; }
EOF
-if { (eval echo configure:4296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_var_h_errno=yes
else
@@ -4313,22 +4494,26 @@ EOF
fi
+# Check whether --with-crypto or --without-crypto was given.
+if test "${with_crypto+set}" = set; then
+ withval="$with_crypto"
+ :
+else
+
echo $ac_n "checking for SSLeay""... $ac_c" 1>&6
-echo "configure:4318: checking for SSLeay" >&5
+echo "configure:4505: checking for SSLeay" >&5
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;
@@ -4340,7 +4525,7 @@ done
echo "$ac_t""$ac_cv_ssleay_path" 1>&6
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
@@ -4348,7 +4533,7 @@ if test "$ac_cv_ssleay_path" != no; then
LIBS="$LIBS -lrsaref"
fi
echo $ac_n "checking for des_cbc_encrypt in -lcrypto""... $ac_c" 1>&6
-echo "configure:4352: checking for des_cbc_encrypt in -lcrypto" >&5
+echo "configure:4537: checking for des_cbc_encrypt in -lcrypto" >&5
ac_lib_var=`echo crypto'_'des_cbc_encrypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4356,7 +4541,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcrypto $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4360 "configure"
+#line 4545 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4367,7 +4552,7 @@ int main() {
des_cbc_encrypt()
; return 0; }
EOF
-if { (eval echo configure:4371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4394,28 +4579,24 @@ else
echo "$ac_t""no" 1>&6
fi
- cat >> confdefs.h <<\EOF
-#define CRYPTO 1
-EOF
-
bak_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $V_INCLS"
- for ac_hdr in cast.h rc5.h
+ for ac_hdr in cast.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4409: checking for $ac_hdr" >&5
+echo "configure:4590: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4414 "configure"
+#line 4595 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4419: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4444,12 +4625,12 @@ done
if test "$ac_cv_header_cast_h" = "yes"; then
echo $ac_n "checking for buggy CAST128""... $ac_c" 1>&6
-echo "configure:4448: checking for buggy CAST128" >&5
+echo "configure:4629: checking for buggy CAST128" >&5
if test "$cross_compiling" = yes; then
buggy_cast128="cross-compiling, assume yes"
else
cat > conftest.$ac_ext <<EOF
-#line 4453 "configure"
+#line 4634 "configure"
#include "confdefs.h"
#include <cast.h>
@@ -4468,7 +4649,7 @@ main()
return 1;
}
EOF
-if { (eval echo configure:4472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
buggy_cast128=yes
else
@@ -4494,11 +4675,49 @@ EOF
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
+for ac_hdr in rc5.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:4685: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4690 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
@@ -4517,7 +4736,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:4521: checking for a BSD compatible install" >&5
+echo "configure:4740: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4572,6 +4791,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -4942,8 +5162,14 @@ fi; done
EOF
cat >> $CONFIG_STATUS <<EOF
+
EOF
cat >> $CONFIG_STATUS <<\EOF
+if test -f .devel; then
+ echo timestamp > stamp-h
+ cat Makefile-devel-adds >> Makefile
+ make depend
+fi
exit 0
EOF
@@ -4951,8 +5177,4 @@ chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
-if test -f .devel ; then
- make depend
-fi
exit 0
diff --git a/contrib/tcpdump/configure.in b/contrib/tcpdump/configure.in
index 6161766..43f6777 100755
--- a/contrib/tcpdump/configure.in
+++ b/contrib/tcpdump/configure.in
@@ -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", &current, &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
@@ -340,13 +375,6 @@ if test "$ac_cv_sockaddr_has_sa_len" = no; then
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.
AC_CHECK_SIZEOF(char, 1)
@@ -404,13 +432,6 @@ if test "$ac_cv_res_inet6" = no; then
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)
if test "$ac_cv_res_state_ext" = no; then
@@ -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
diff --git a/contrib/tcpdump/decnet.h b/contrib/tcpdump/decnet.h
index 86dea61..c356bcb 100644
--- a/contrib/tcpdump/decnet.h
+++ b/contrib/tcpdump/decnet.h
@@ -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 */
};
/*
diff --git a/contrib/tcpdump/dhcp6.h b/contrib/tcpdump/dhcp6.h
index 161796f..a451bbf 100644
--- a/contrib/tcpdump/dhcp6.h
+++ b/contrib/tcpdump/dhcp6.h
@@ -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;
diff --git a/contrib/tcpdump/dhcp6opt.h b/contrib/tcpdump/dhcp6opt.h
index a9177c6..b4ec2e4 100644
--- a/contrib/tcpdump/dhcp6opt.h
+++ b/contrib/tcpdump/dhcp6opt.h
@@ -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*/
diff --git a/contrib/tcpdump/esp.h b/contrib/tcpdump/esp.h
new file mode 100644
index 0000000..56cdada
--- /dev/null
+++ b/contrib/tcpdump/esp.h
@@ -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_*/
diff --git a/contrib/tcpdump/ether.h b/contrib/tcpdump/ether.h
new file mode 100644
index 0000000..5c3dff0
--- /dev/null
+++ b/contrib/tcpdump/ether.h
@@ -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
diff --git a/contrib/tcpdump/extract.h b/contrib/tcpdump/extract.h
index e4fb6f2..9e5bb9b 100644
--- a/contrib/tcpdump/extract.h
+++ b/contrib/tcpdump/extract.h
@@ -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))
diff --git a/contrib/tcpdump/fddi.h b/contrib/tcpdump/fddi.h
index 894cee3..64ebfb3 100644
--- a/contrib/tcpdump/fddi.h
+++ b/contrib/tcpdump/fddi.h
@@ -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 */
diff --git a/contrib/tcpdump/gmt2local.c b/contrib/tcpdump/gmt2local.c
index 2310dbc..d68c4bf 100644
--- a/contrib/tcpdump/gmt2local.c
+++ b/contrib/tcpdump/gmt2local.c
@@ -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
diff --git a/contrib/tcpdump/icmp6.h b/contrib/tcpdump/icmp6.h
new file mode 100644
index 0000000..7f66c2e
--- /dev/null
+++ b/contrib/tcpdump/icmp6.h
@@ -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_ */
diff --git a/contrib/tcpdump/igrp.h b/contrib/tcpdump/igrp.h
index 1d84b54..f94ba3f 100644
--- a/contrib/tcpdump/igrp.h
+++ b/contrib/tcpdump/igrp.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 ! */
diff --git a/contrib/tcpdump/ip.h b/contrib/tcpdump/ip.h
new file mode 100644
index 0000000..77cf2f6
--- /dev/null
+++ b/contrib/tcpdump/ip.h
@@ -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 */
diff --git a/contrib/tcpdump/ip6.h b/contrib/tcpdump/ip6.h
new file mode 100644
index 0000000..6e383dd
--- /dev/null
+++ b/contrib/tcpdump/ip6.h
@@ -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_ */
diff --git a/contrib/tcpdump/ipsec_doi.h b/contrib/tcpdump/ipsec_doi.h
index b2a9c93..f39f0dc 100644
--- a/contrib/tcpdump/ipsec_doi.h
+++ b/contrib/tcpdump/ipsec_doi.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_) */
diff --git a/contrib/tcpdump/ipx.h b/contrib/tcpdump/ipx.h
index 7d7fbc5..c65582a 100644
--- a/contrib/tcpdump/ipx.h
+++ b/contrib/tcpdump/ipx.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
diff --git a/contrib/tcpdump/isakmp.h b/contrib/tcpdump/isakmp.h
index fbd9a1d..b12145f 100644
--- a/contrib/tcpdump/isakmp.h
+++ b/contrib/tcpdump/isakmp.h
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* YIPS @(#)$Id: isakmp.h,v 1.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
diff --git a/contrib/tcpdump/l2tp.h b/contrib/tcpdump/l2tp.h
index 008491e..5c8f98d 100644
--- a/contrib/tcpdump/l2tp.h
+++ b/contrib/tcpdump/l2tp.h
@@ -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;
};
diff --git a/contrib/tcpdump/lane.h b/contrib/tcpdump/lane.h
index 1e17103..f83e904 100644
--- a/contrib/tcpdump/lane.h
+++ b/contrib/tcpdump/lane.h
@@ -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;
};
diff --git a/contrib/tcpdump/lbl/os-solaris2.h b/contrib/tcpdump/lbl/os-solaris2.h
index 9a8b831..de481c2 100644
--- a/contrib/tcpdump/lbl/os-solaris2.h
+++ b/contrib/tcpdump/lbl/os-solaris2.h
@@ -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 *);
diff --git a/contrib/tcpdump/llc.h b/contrib/tcpdump/llc.h
index cd6ea20..5f0b981 100644
--- a/contrib/tcpdump/llc.h
+++ b/contrib/tcpdump/llc.h
@@ -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
diff --git a/contrib/tcpdump/machdep.c b/contrib/tcpdump/machdep.c
index 1ed3fd4..3080f85 100644
--- a/contrib/tcpdump/machdep.c
+++ b/contrib/tcpdump/machdep.c
@@ -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
diff --git a/contrib/tcpdump/machdep.h b/contrib/tcpdump/machdep.h
index 4cac15b..8d49a7a 100644
--- a/contrib/tcpdump/machdep.h
+++ b/contrib/tcpdump/machdep.h
@@ -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
diff --git a/contrib/tcpdump/missing/addrinfo.h b/contrib/tcpdump/missing/addrinfo.h
index 954b0b2..7a32937 100644
--- a/contrib/tcpdump/missing/addrinfo.h
+++ b/contrib/tcpdump/missing/addrinfo.h
@@ -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 */
/*
diff --git a/contrib/tcpdump/missing/getaddrinfo.c b/contrib/tcpdump/missing/getaddrinfo.c
index 87fd652..89b812d 100644
--- a/contrib/tcpdump/missing/getaddrinfo.c
+++ b/contrib/tcpdump/missing/getaddrinfo.c
@@ -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",
diff --git a/contrib/tcpdump/missing/getnameinfo.c b/contrib/tcpdump/missing/getnameinfo.c
index 2d23425..502ac7f 100644
--- a/contrib/tcpdump/missing/getnameinfo.c
+++ b/contrib/tcpdump/missing/getnameinfo.c
@@ -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);
}
diff --git a/contrib/tcpdump/missing/inet_aton.c b/contrib/tcpdump/missing/inet_aton.c
index 355b6a1..3d4ebf9 100644
--- a/contrib/tcpdump/missing/inet_aton.c
+++ b/contrib/tcpdump/missing/inet_aton.c
@@ -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>
diff --git a/contrib/tcpdump/missing/inet_ntop.c b/contrib/tcpdump/missing/inet_ntop.c
index 09506fd..a43c429 100644
--- a/contrib/tcpdump/missing/inet_ntop.c
+++ b/contrib/tcpdump/missing/inet_ntop.c
@@ -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>
diff --git a/contrib/tcpdump/missing/inet_pton.c b/contrib/tcpdump/missing/inet_pton.c
index 1138627..34ec0af 100644
--- a/contrib/tcpdump/missing/inet_pton.c
+++ b/contrib/tcpdump/missing/inet_pton.c
@@ -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>
diff --git a/contrib/tcpdump/missing/snprintf.c b/contrib/tcpdump/missing/snprintf.c
new file mode 100644
index 0000000..176636f
--- /dev/null
+++ b/contrib/tcpdump/missing/snprintf.c
@@ -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
+
diff --git a/contrib/tcpdump/missing/strlcat.c b/contrib/tcpdump/missing/strlcat.c
new file mode 100644
index 0000000..92f46a9
--- /dev/null
+++ b/contrib/tcpdump/missing/strlcat.c
@@ -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 */
+}
diff --git a/contrib/tcpdump/missing/strlcpy.c b/contrib/tcpdump/missing/strlcpy.c
new file mode 100644
index 0000000..f55121d
--- /dev/null
+++ b/contrib/tcpdump/missing/strlcpy.c
@@ -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 */
+}
diff --git a/contrib/tcpdump/nameser.h b/contrib/tcpdump/nameser.h
new file mode 100644
index 0000000..9963dd0
--- /dev/null
+++ b/contrib/tcpdump/nameser.h
@@ -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_ */
diff --git a/contrib/tcpdump/ntp.h b/contrib/tcpdump/ntp.h
index e92408f2..3a574ed 100644
--- a/contrib/tcpdump/ntp.h
+++ b/contrib/tcpdump/ntp.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 ================= */
diff --git a/contrib/tcpdump/ospf.h b/contrib/tcpdump/ospf.h
index eee7944..69e474e 100644
--- a/contrib/tcpdump/ospf.h
+++ b/contrib/tcpdump/ospf.h
@@ -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;
diff --git a/contrib/tcpdump/ospf6.h b/contrib/tcpdump/ospf6.h
index 85e81d7..3d810cf 100644
--- a/contrib/tcpdump/ospf6.h
+++ b/contrib/tcpdump/ospf6.h
@@ -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;
diff --git a/contrib/tcpdump/print-ah.c b/contrib/tcpdump/print-ah.c
index 9a36ff4..c7a4fab 100644
--- a/contrib/tcpdump/print-ah.c
+++ b/contrib/tcpdump/print-ah.c
@@ -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)));
diff --git a/contrib/tcpdump/print-ascii.c b/contrib/tcpdump/print-ascii.c
index 29f57b8..8c086d2 100644
--- a/contrib/tcpdump/print-ascii.c
+++ b/contrib/tcpdump/print-ascii.c
@@ -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;
diff --git a/contrib/tcpdump/print-bgp.c b/contrib/tcpdump/print-bgp.c
index 23c3faf..71f20c3 100644
--- a/contrib/tcpdump/print-bgp.c
+++ b/contrib/tcpdump/print-bgp.c
@@ -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)
diff --git a/contrib/tcpdump/print-bxxp.c b/contrib/tcpdump/print-bxxp.c
new file mode 100644
index 0000000..56be54f
--- /dev/null
+++ b/contrib/tcpdump/print-bxxp.c
@@ -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)");
+
+}
diff --git a/contrib/tcpdump/print-cdp.c b/contrib/tcpdump/print-cdp.c
new file mode 100644
index 0000000..53eff98
--- /dev/null
+++ b/contrib/tcpdump/print-cdp.c
@@ -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;
+ }
+}
diff --git a/contrib/tcpdump/print-chdlc.c b/contrib/tcpdump/print-chdlc.c
index f9c5ecf..09c58ab 100644
--- a/contrib/tcpdump/print-chdlc.c
+++ b/contrib/tcpdump/print-chdlc.c
@@ -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 @@ out:
}
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;
};
diff --git a/contrib/tcpdump/print-cip.c b/contrib/tcpdump/print-cip.c
index 5021bc0..1d244c2 100644
--- a/contrib/tcpdump/print-cip.c
+++ b/contrib/tcpdump/print-cip.c
@@ -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;
-
- 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);
- }
- }
+ 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);
+ }
+ }
}
/*
@@ -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);
diff --git a/contrib/tcpdump/print-cnfp.c b/contrib/tcpdump/print-cnfp.c
new file mode 100644
index 0000000..265599c
--- /dev/null
+++ b/contrib/tcpdump/print-cnfp.c
@@ -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));
+ }
+}
diff --git a/contrib/tcpdump/print-decnet.c b/contrib/tcpdump/print-decnet.c
index c2c5c5a..d589bc9 100644
--- a/contrib/tcpdump/print-decnet.c
+++ b/contrib/tcpdump/print-decnet.c
@@ -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);
}
diff --git a/contrib/tcpdump/print-dhcp6.c b/contrib/tcpdump/print-dhcp6.c
index 411f166..c9848f0 100644
--- a/contrib/tcpdump/print-dhcp6.c
+++ b/contrib/tcpdump/print-dhcp6.c
@@ -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, },
-
- /* 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, },
+ { 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, },
+
+ { 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 @@ trunc:
*/
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:
diff --git a/contrib/tcpdump/print-dvmrp.c b/contrib/tcpdump/print-dvmrp.c
index 6727c36..04abc2c 100644
--- a/contrib/tcpdump/print-dvmrp.c
+++ b/contrib/tcpdump/print-dvmrp.c
@@ -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>
diff --git a/contrib/tcpdump/print-egp.c b/contrib/tcpdump/print-egp.c
index af52023..5adb9ee 100644
--- a/contrib/tcpdump/print-egp.c
+++ b/contrib/tcpdump/print-egp.c
@@ -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
diff --git a/contrib/tcpdump/print-esp.c b/contrib/tcpdump/print-esp.c
index bc5b7b7..7ebad59 100644
--- a/contrib/tcpdump/print-esp.c
+++ b/contrib/tcpdump/print-esp.c
@@ -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:
diff --git a/contrib/tcpdump/print-frag6.c b/contrib/tcpdump/print-frag6.c
index a043e8f..abf0cc6 100644
--- a/contrib/tcpdump/print-frag6.c
+++ b/contrib/tcpdump/print-frag6.c
@@ -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;
diff --git a/contrib/tcpdump/print-gre.c b/contrib/tcpdump/print-gre.c
index 8584595..e79d300 100644
--- a/contrib/tcpdump/print-gre.c
+++ b/contrib/tcpdump/print-gre.c
@@ -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;
diff --git a/contrib/tcpdump/print-icmp6.c b/contrib/tcpdump/print-icmp6.c
index f6bc864..a983bbb 100644
--- a/contrib/tcpdump/print-icmp6.c
+++ b/contrib/tcpdump/print-icmp6.c
@@ -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 @@ trunc:
#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 */
diff --git a/contrib/tcpdump/print-igmp.c b/contrib/tcpdump/print-igmp.c
new file mode 100644
index 0000000..c79244e
--- /dev/null
+++ b/contrib/tcpdump/print-igmp.c
@@ -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);
+}
diff --git a/contrib/tcpdump/print-igrp.c b/contrib/tcpdump/print-igrp.c
index edbc1f1..cecee14 100644
--- a/contrib/tcpdump/print-igrp.c
+++ b/contrib/tcpdump/print-igrp.c
@@ -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,
diff --git a/contrib/tcpdump/print-ip6opts.c b/contrib/tcpdump/print-ip6opts.c
index 756f098..22d017e 100644
--- a/contrib/tcpdump/print-ip6opts.c
+++ b/contrib/tcpdump/print-ip6opts.c
@@ -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),
diff --git a/contrib/tcpdump/print-ipcomp.c b/contrib/tcpdump/print-ipcomp.c
index 8b2dd47..9975e54 100644
--- a/contrib/tcpdump/print-ipcomp.c
+++ b/contrib/tcpdump/print-ipcomp.c
@@ -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)
diff --git a/contrib/tcpdump/print-isakmp.c b/contrib/tcpdump/print-isakmp.c
index f3c38ac..66df93a 100644
--- a/contrib/tcpdump/print-isakmp.c
+++ b/contrib/tcpdump/print-isakmp.c
@@ -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(e.len) - 4);
+ }
+ 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(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_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);
}
}
}
diff --git a/contrib/tcpdump/print-krb.c b/contrib/tcpdump/print-krb.c
index 694e5b5..67f440a 100644
--- a/contrib/tcpdump/print-krb.c
+++ b/contrib/tcpdump/print-krb.c
@@ -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>
diff --git a/contrib/tcpdump/print-l2tp.c b/contrib/tcpdump/print-l2tp.c
index 94d7188..d054308 100644
--- a/contrib/tcpdump/print-l2tp.c
+++ b/contrib/tcpdump/print-l2tp.c
@@ -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
}
}
diff --git a/contrib/tcpdump/print-lane.c b/contrib/tcpdump/print-lane.c
index 19061de..db38ef7 100644
--- a/contrib/tcpdump/print-lane.c
+++ b/contrib/tcpdump/print-lane.c
@@ -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));
diff --git a/contrib/tcpdump/print-lcp.c b/contrib/tcpdump/print-lcp.c
index 78f353a..ddea9c6 100644
--- a/contrib/tcpdump/print-lcp.c
+++ b/contrib/tcpdump/print-lcp.c
@@ -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:
diff --git a/contrib/tcpdump/print-mobile.c b/contrib/tcpdump/print-mobile.c
index 4c09ace..a6116f6 100644
--- a/contrib/tcpdump/print-mobile.c
+++ b/contrib/tcpdump/print-mobile.c
@@ -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>
diff --git a/contrib/tcpdump/print-netbios.c b/contrib/tcpdump/print-netbios.c
index fbf22fb..c834729 100644
--- a/contrib/tcpdump/print-netbios.c
+++ b/contrib/tcpdump/print-netbios.c
@@ -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>
diff --git a/contrib/tcpdump/print-ospf.c b/contrib/tcpdump/print-ospf.c
index f69eb84..f5e452f 100644
--- a/contrib/tcpdump/print-ospf.c
+++ b/contrib/tcpdump/print-ospf.c
@@ -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;
diff --git a/contrib/tcpdump/print-ospf6.c b/contrib/tcpdump/print-ospf6.c
index f368346..f52b462 100644
--- a/contrib/tcpdump/print-ospf6.c
+++ b/contrib/tcpdump/print-ospf6.c
@@ -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 @@ trunc:
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;
diff --git a/contrib/tcpdump/print-pppoe.c b/contrib/tcpdump/print-pppoe.c
index 1aaa0da..81475cd 100644
--- a/contrib/tcpdump/print-pppoe.c
+++ b/contrib/tcpdump/print-pppoe.c
@@ -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;
}
diff --git a/contrib/tcpdump/print-radius.c b/contrib/tcpdump/print-radius.c
new file mode 100644
index 0000000..32c8575
--- /dev/null
+++ b/contrib/tcpdump/print-radius.c
@@ -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);
+}
diff --git a/contrib/tcpdump/print-raw.c b/contrib/tcpdump/print-raw.c
index 114ff09..b6e421c 100644
--- a/contrib/tcpdump/print-raw.c
+++ b/contrib/tcpdump/print-raw.c
@@ -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);
diff --git a/contrib/tcpdump/print-rip.c b/contrib/tcpdump/print-rip.c
index 72e6cfb..1f02c23 100644
--- a/contrib/tcpdump/print-rip.c
+++ b/contrib/tcpdump/print-rip.c
@@ -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;
+
+ /* 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("]");
+ 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));
+}
- 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));
+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("]");
- } else if (vers < 2) {
- /* RFC 1058 */
- printf(" %s", ipaddr_string(&ni->rip_dest));
- } else {
- /* RFC 1723 */
+ 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;
+ }
}
}
diff --git a/contrib/tcpdump/print-ripng.c b/contrib/tcpdump/print-ripng.c
index 7a4aee6..e4d11a4 100644
--- a/contrib/tcpdump/print-ripng.c
+++ b/contrib/tcpdump/print-ripng.c
@@ -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"
diff --git a/contrib/tcpdump/print-rt6.c b/contrib/tcpdump/print-rt6.c
index f8a7fcb..ea464e2 100644
--- a/contrib/tcpdump/print-rt6.c
+++ b/contrib/tcpdump/print-rt6.c
@@ -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:
diff --git a/contrib/tcpdump/print-rx.c b/contrib/tcpdump/print-rx.c
index 5f42ce7..aa36124 100644
--- a/contrib/tcpdump/print-rx.c
+++ b/contrib/tcpdump/print-rx.c
@@ -13,7 +13,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.5.2.1 2000/01/11 06:58:27 fenner Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.20 2001/01/10 08:12:01 fenner Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -21,24 +21,27 @@ static const char rcsid[] =
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
#include <arpa/inet.h>
#include "interface.h"
#include "addrtoname.h"
+#include "extract.h"
#undef NOERROR /* Solaris sucks */
#include <arpa/nameser.h>
#include "rx.h"
+#include "ip.h"
+
static struct tok rx_types[] = {
{ RX_PACKET_TYPE_DATA, "data" },
{ RX_PACKET_TYPE_ACK, "ack" },
@@ -315,6 +318,39 @@ static struct tok ubik_lock_types[] = {
static char *voltype[] = { "read-write", "read-only", "backup" };
+static struct tok afs_fs_errors[] = {
+ { 101, "salvage volume" },
+ { 102, "no such vnode" },
+ { 103, "no such volume" },
+ { 104, "volume exist" },
+ { 105, "no service" },
+ { 106, "volume offline" },
+ { 107, "voline online" },
+ { 108, "diskfull" },
+ { 109, "diskquota exceeded" },
+ { 110, "volume busy" },
+ { 111, "volume moved" },
+ { 112, "AFS IO error" },
+ { -100, "restarting fileserver" },
+ { 0, NULL }
+};
+
+/*
+ * Reasons for acknowledging a packet
+ */
+
+static struct tok rx_ack_reasons[] = {
+ { 1, "ack requested" },
+ { 2, "duplicate packet" },
+ { 3, "out of sequence" },
+ { 4, "exceeds window" },
+ { 5, "no buffer space" },
+ { 6, "ping" },
+ { 7, "ping response" },
+ { 8, "delay" },
+ { 0, NULL },
+};
+
/*
* Cache entries we keep around so we can figure out the RX opcode
* numbers for replies. This allows us to make sense of RX reply packets.
@@ -339,9 +375,10 @@ static void rx_cache_insert(const u_char *, const struct ip *, int, int);
static int rx_cache_find(const struct rx_header *, const struct ip *,
int, int32_t *);
+static void ack_print(const u_char *, int);
static void fs_print(const u_char *, int);
static void fs_reply_print(const u_char *, int, int32_t);
-static void acl_print(u_char *, u_char *);
+static void acl_print(u_char *, int, u_char *);
static void cb_print(const u_char *, int);
static void cb_reply_print(const u_char *, int, int32_t);
static void prot_print(const u_char *, int);
@@ -357,6 +394,8 @@ static void bos_reply_print(const u_char *, int, int32_t);
static void ubik_print(const u_char *, int);
static void ubik_reply_print(const u_char *, int, int32_t);
+static void rx_ack_print(const u_char *, int);
+
static int is_ubik(u_int32_t);
/*
@@ -381,28 +420,35 @@ rx_print(register const u_char *bp, int length, int sport, int dport,
printf(" rx %s", tok2str(rx_types, "type %d", rxh->type));
- if (vflag > 1) {
+ if (vflag) {
int firstflag = 0;
- printf(" cid %08x call# %d seq %d ser %d",
- (int) ntohl(rxh->cid),
- (int) ntohl(rxh->callNumber),
- (int) ntohl(rxh->seq),
- (int) ntohl(rxh->serial));
+
+ if (vflag > 1)
+ printf(" cid %08x call# %d",
+ (int) EXTRACT_32BITS(&rxh->cid),
+ (int) EXTRACT_32BITS(&rxh->callNumber));
+
+ printf(" seq %d ser %d",
+ (int) EXTRACT_32BITS(&rxh->seq),
+ (int) EXTRACT_32BITS(&rxh->serial));
+
if (vflag > 2)
printf(" secindex %d serviceid %hu",
(int) rxh->securityIndex,
- ntohs(rxh->serviceId));
- for (i = 0; i < NUM_RX_FLAGS; i++) {
- if (rxh->flags & rx_flags[i].v) {
- if (!firstflag) {
- firstflag = 1;
- printf(" ");
- } else {
- printf(",");
+ EXTRACT_16BITS(&rxh->serviceId));
+
+ if (vflag > 1)
+ for (i = 0; i < NUM_RX_FLAGS; i++) {
+ if (rxh->flags & rx_flags[i].v) {
+ if (!firstflag) {
+ firstflag = 1;
+ printf(" ");
+ } else {
+ printf(",");
+ }
+ printf("<%s>", rx_flags[i].s);
}
- printf("<%s>", rx_flags[i].s);
}
- }
}
/*
@@ -414,7 +460,10 @@ rx_print(register const u_char *bp, int length, int sport, int dport,
* as well.
*/
- if (rxh->type == RX_PACKET_TYPE_DATA && ntohl(rxh->seq) == 1 &&
+ if (rxh->type == RX_PACKET_TYPE_ACK)
+ ack_print(bp, length);
+ else if (rxh->type == RX_PACKET_TYPE_DATA &&
+ EXTRACT_32BITS(&rxh->seq) == 1 &&
rxh->flags & RX_CLIENT_INITIATED) {
/*
@@ -458,7 +507,7 @@ rx_print(register const u_char *bp, int length, int sport, int dport,
*/
} else if (((rxh->type == RX_PACKET_TYPE_DATA &&
- ntohl(rxh->seq) == 1) ||
+ EXTRACT_32BITS(&rxh->seq) == 1) ||
rxh->type == RX_PACKET_TYPE_ABORT) &&
(rxh->flags & RX_CLIENT_INITIATED) == 0 &&
rx_cache_find(rxh, (const struct ip *) bp2,
@@ -489,7 +538,15 @@ rx_print(register const u_char *bp, int length, int sport, int dport,
default:
;
}
- }
+
+ /*
+ * If it's an RX ack packet, then use the appropriate ack decoding
+ * function (there isn't any service-specific information in the
+ * ack packet, so we can use one for all AFS services)
+ */
+
+ } else if (rxh->type == RX_PACKET_TYPE_ACK)
+ rx_ack_print(bp, length);
printf(" (%d)", length);
@@ -519,7 +576,7 @@ rx_cache_insert(const u_char *bp, const struct ip *ip, int dport,
rxent->server = ip->ip_dst;
rxent->dport = dport;
rxent->serviceId = rxh->serviceId;
- rxent->opcode = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ rxent->opcode = EXTRACT_32BITS(bp + sizeof(struct rx_header));
}
/*
@@ -567,46 +624,45 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
* These extrememly grody macros handle the printing of various AFS stuff.
*/
-#define TRUNC(n) if (snapend - bp + 1 <= n) goto trunc;
#define FIDOUT() { unsigned long n1, n2, n3; \
- TRUNC(sizeof(int32_t) * 3); \
- n1 = ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], sizeof(int32_t) * 3); \
+ n1 = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
- n2 = ntohl(*((int *) bp)); \
+ n2 = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
- n3 = ntohl(*((int *) bp)); \
+ n3 = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
printf(" fid %d/%d/%d", (int) n1, (int) n2, (int) n3); \
}
#define STROUT(MAX) { int i; \
- TRUNC(sizeof(int32_t)); \
- i = (int) ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
+ i = (int) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
- TRUNC(i); \
- strncpy(s, bp, min(MAX, i)); \
+ TCHECK2(bp[0], i); \
+ strncpy(s, (char *) bp, min(MAX, i)); \
s[i] = '\0'; \
printf(" \"%s\"", s); \
bp += ((i + sizeof(int32_t) - 1) / sizeof(int32_t)) * sizeof(int32_t); \
}
#define INTOUT() { int i; \
- TRUNC(sizeof(int32_t)); \
- i = (int) ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
+ i = (int) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
printf(" %d", i); \
}
#define UINTOUT() { unsigned long i; \
- TRUNC(sizeof(int32_t)); \
- i = ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
+ i = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
printf(" %lu", i); \
}
#define DATEOUT() { time_t t; struct tm *tm; char str[256]; \
- TRUNC(sizeof(int32_t)); \
- t = (time_t) ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], sizeof(int32_t)); \
+ t = (time_t) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
tm = localtime(&t); \
strftime(str, 256, "%Y/%m/%d %T", tm); \
@@ -614,45 +670,45 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
}
#define STOREATTROUT() { unsigned long mask, i; \
- TRUNC((sizeof(int32_t)*6)); \
- mask = ntohl(*((int *) bp)); bp += sizeof(int32_t); \
+ TCHECK2(bp[0], (sizeof(int32_t)*6)); \
+ mask = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
if (mask) printf (" StoreStatus"); \
if (mask & 1) { printf(" date"); DATEOUT(); } \
else bp += sizeof(int32_t); \
- i = ntohl(*((int *) bp)); bp += sizeof(int32_t); \
+ i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 2) printf(" owner %lu", i); \
- i = ntohl(*((int32_t *) bp)); bp += sizeof(int32_t); \
+ i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 4) printf(" group %lu", i); \
- i = ntohl(*((int32_t *) bp)); bp += sizeof(int32_t); \
+ i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 8) printf(" mode %lo", i & 07777); \
- i = ntohl(*((int32_t *) bp)); bp += sizeof(int32_t); \
+ i = EXTRACT_32BITS(bp); bp += sizeof(int32_t); \
if (mask & 16) printf(" segsize %lu", i); \
/* undocumented in 3.3 docu */ \
if (mask & 1024) printf(" fsync"); \
}
#define UBIK_VERSIONOUT() {int32_t epoch; int32_t counter; \
- TRUNC(sizeof(int32_t) * 2); \
- epoch = ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], sizeof(int32_t) * 2); \
+ epoch = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
- counter = ntohl(*((int *) bp)); \
+ counter = EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
printf(" %d.%d", epoch, counter); \
}
#define AFSUUIDOUT() {u_int32_t temp; int i; \
- TRUNC(11*sizeof(u_int32_t)); \
- temp = ntohl(*((int *) bp)); \
+ TCHECK2(bp[0], 11*sizeof(u_int32_t)); \
+ temp = EXTRACT_32BITS(bp); \
bp += sizeof(u_int32_t); \
printf(" %08x", temp); \
- temp = ntohl(*((int *) bp)); \
+ temp = EXTRACT_32BITS(bp); \
bp += sizeof(u_int32_t); \
printf("%04x", temp); \
- temp = ntohl(*((int *) bp)); \
+ temp = EXTRACT_32BITS(bp); \
bp += sizeof(u_int32_t); \
printf("%04x", temp); \
for (i = 0; i < 8; i++) { \
- temp = ntohl(*((int *) bp)); \
+ temp = EXTRACT_32BITS(bp); \
bp += sizeof(u_int32_t); \
printf("%02x", (unsigned char) temp); \
} \
@@ -664,21 +720,90 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
#define VECOUT(MAX) { char *sp; \
int k; \
- TRUNC(MAX * sizeof(int32_t)); \
+ TCHECK2(bp[0], MAX * sizeof(int32_t)); \
sp = s; \
for (k = 0; k < MAX; k++) { \
- *sp++ = (char) ntohl(*((int *) bp)); \
+ *sp++ = (char) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
} \
s[MAX] = '\0'; \
printf(" \"%s\"", s); \
}
+static void
+ack_print(register const u_char *bp, int length)
+{
+ u_char nAcks;
+ int i;
+
+ if (vflag <= 1)
+ return;
+
+ if (length <= sizeof(struct rx_header))
+ return;
+
+ bp += sizeof(struct rx_header);
+
+ /*
+ * Packets < firstPacket are implicitly acknowledged and may
+ * be discarded by the sender.
+ *
+ * Packets >= firstPacket+nAcks are implicitly NOT acknowledged.
+ *
+ * No packets with sequence numbers >= firstPacket should be
+ * discarded by the sender (they may thrown out at any time by
+ * the receiver)
+ */
+#define RX_ACK_REASONS "RDOXSprn"
+ /* Requested, Duplicate, Out_of_sequence, eXceeds_window, no_Space,
+ * Ping, ping_Response, No_{progress, particular_reason}.
+ */
+#if 0
+ struct rx_ackPacket {
+ u_short bufferSpace; /* Skip! */
+ u_short maxSkew; /* Skip! */
+ u_long firstPacket;
+ u_long previousPacket; /* Obsolete! */
+ u_long serial; /* Serial that prompted the ack, */
+ u_char reason; /* and the reason why. */
+ u_char nAcks;
+ u_char acks[RX_MAXACKS]; /* Selective acks (not a bitmap). */
+ };
+#endif
+#define RX_ACK_TYPE_NACK 0
+
+ TCHECK2(bp[0], 8); /* bufferSpace and maxSkew */
+ bp += 4;
+ printf(" fir %u", (unsigned)EXTRACT_32BITS(bp));
+ bp += 4;
+ TCHECK2(bp[0], 8); /* previousPacket and serial */
+ bp += 4;
+ printf(" %u", (unsigned)EXTRACT_32BITS(bp));
+ bp += 4;
+ TCHECK2(bp[0], 1);
+ printf("%c", RX_ACK_REASONS[(*bp - 1) & 07u]);
+ bp += 1; /* reason */
+ TCHECK2(bp[0], 1);
+ nAcks = *bp;
+ bp += 1; /* nAcks */
+
+ for (i = 0; i < nAcks; i++) {
+ TCHECK2(bp[0], 1);
+ putchar(*bp == RX_ACK_TYPE_NACK? '-' : '*');
+ bp += 1;
+ }
+
+ return;
+
+trunc:
+ printf(" [|ack]");
+}
+
/*
* Handle calls to the AFS file service (fs)
*/
-void
+static void
fs_print(register const u_char *bp, int length)
{
int fs_op;
@@ -697,7 +822,7 @@ fs_print(register const u_char *bp, int length)
* gleaned from fsint/afsint.xg
*/
- fs_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ fs_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" fs call %s", tok2str(fs_req, "op#%d", fs_op));
@@ -746,15 +871,16 @@ fs_print(register const u_char *bp, int length)
break;
case 134: /* Store ACL */
{
- char a[AFSOPAQUEMAX];
+ char a[AFSOPAQUEMAX+1];
FIDOUT();
- TRUNC(4);
- i = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
- TRUNC(i);
- strncpy(a, bp, min(AFSOPAQUEMAX, i));
+ TCHECK2(bp[0], i);
+ i = min(AFSOPAQUEMAX, i);
+ strncpy(a, (char *) bp, i);
a[i] = '\0';
- acl_print((u_char *) a, (u_char *) a + i);
+ acl_print((u_char *) a, sizeof(a), (u_char *) a + i);
break;
}
case 137: /* Create file */
@@ -803,8 +929,8 @@ fs_print(register const u_char *bp, int length)
case 155: /* Bulk stat */
{
unsigned long j;
- TRUNC(4);
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
@@ -854,18 +980,19 @@ fs_reply_print(register const u_char *bp, int length, int32_t opcode)
* If it was a data packet, interpret the response
*/
- if (rxh->type == RX_PACKET_TYPE_DATA)
+ if (rxh->type == RX_PACKET_TYPE_DATA) {
switch (opcode) {
case 131: /* Fetch ACL */
{
- char a[AFSOPAQUEMAX];
- TRUNC(4);
- i = ntohl(*((int *) bp));
+ char a[AFSOPAQUEMAX+1];
+ TCHECK2(bp[0], 4);
+ i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
- TRUNC(i);
- strncpy(a, bp, min(AFSOPAQUEMAX, i));
+ TCHECK2(bp[0], i);
+ i = min(AFSOPAQUEMAX, i);
+ strncpy(a, (char *) bp, i);
a[i] = '\0';
- acl_print((u_char *) a, (u_char *) a + i);
+ acl_print((u_char *) a, sizeof(a), (u_char *) a + i);
break;
}
case 137: /* Create file */
@@ -883,12 +1010,19 @@ fs_reply_print(register const u_char *bp, int length, int32_t opcode)
default:
;
}
- else {
- /*
- * Otherwise, just print out the return code
- */
- printf(" errcode");
- INTOUT();
+ } else if (rxh->type == RX_PACKET_TYPE_ABORT) {
+ int i;
+
+ /*
+ * Otherwise, just print out the return code
+ */
+ TCHECK2(bp[0], sizeof(int32_t));
+ i = (int) EXTRACT_32BITS(bp);
+ bp += sizeof(int32_t);
+
+ printf(" error %s", tok2str(afs_fs_errors, "#%d", i));
+ } else {
+ printf(" strange fs reply of type %d", rxh->type);
}
return;
@@ -912,19 +1046,22 @@ trunc:
*/
static void
-acl_print(u_char *s, u_char *end)
+acl_print(u_char *s, int maxsize, u_char *end)
{
int pos, neg, acl;
int n, i;
- char user[128];
+ char *user;
- if (sscanf((char *) s, "%d %d\n%n", &pos, &neg, &n) != 2)
+ if ((user = (char *)malloc(maxsize)) == NULL)
return;
+
+ if (sscanf((char *) s, "%d %d\n%n", &pos, &neg, &n) != 2)
+ goto finish;
s += n;
if (s > end)
- return;
+ goto finish;
/*
* This wacky order preserves the order used by the "fs" command
@@ -948,25 +1085,29 @@ acl_print(u_char *s, u_char *end)
for (i = 0; i < pos; i++) {
if (sscanf((char *) s, "%s %d\n%n", user, &acl, &n) != 2)
- return;
+ goto finish;
s += n;
printf(" +{%s ", user);
ACLOUT(acl);
printf("}");
if (s > end)
- return;
+ goto finish;
}
for (i = 0; i < neg; i++) {
if (sscanf((char *) s, "%s %d\n%n", user, &acl, &n) != 2)
- return;
+ goto finish;
s += n;
printf(" -{%s ", user);
ACLOUT(acl);
printf("}");
if (s > end)
- return;
+ goto finish;
}
+
+finish:
+ free(user);
+ return;
}
#undef ACLOUT
@@ -993,7 +1134,7 @@ cb_print(register const u_char *bp, int length)
* gleaned from fsint/afscbint.xg
*/
- cb_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ cb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" cb call %s", tok2str(cb_req, "op#%d", cb_op));
@@ -1008,8 +1149,8 @@ cb_print(register const u_char *bp, int length)
case 204: /* Callback */
{
unsigned long j, t;
- TRUNC(4);
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
@@ -1021,7 +1162,7 @@ cb_print(register const u_char *bp, int length)
if (j == 0)
printf(" <none!>");
- j = ntohl(*((int *) bp));
+ j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
if (j != 0)
@@ -1032,8 +1173,8 @@ cb_print(register const u_char *bp, int length)
INTOUT();
printf(" expires");
DATEOUT();
- TRUNC(4);
- t = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ t = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
tok2str(cb_types, "type %d", t);
}
@@ -1125,7 +1266,7 @@ prot_print(register const u_char *bp, int length)
* gleaned from ptserver/ptint.xg
*/
- pt_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ pt_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" pt");
@@ -1176,8 +1317,8 @@ prot_print(register const u_char *bp, int length)
case 504: /* Name to ID */
{
unsigned long j;
- TRUNC(4);
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
/*
@@ -1198,8 +1339,8 @@ prot_print(register const u_char *bp, int length)
{
unsigned long j;
printf(" ids:");
- TRUNC(4);
- i = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (j = 0; j < i; j++)
INTOUT();
@@ -1288,8 +1429,8 @@ prot_reply_print(register const u_char *bp, int length, int32_t opcode)
{
unsigned long j;
printf(" ids:");
- TRUNC(4);
- i = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (j = 0; j < i; j++)
INTOUT();
@@ -1300,8 +1441,8 @@ prot_reply_print(register const u_char *bp, int length, int32_t opcode)
case 505: /* ID to name */
{
unsigned long j;
- TRUNC(4);
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
/*
@@ -1325,8 +1466,8 @@ prot_reply_print(register const u_char *bp, int length, int32_t opcode)
case 519: /* Get host CPS */
{
unsigned long j;
- TRUNC(4);
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ j = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
for (i = 0; i < j; i++) {
INTOUT();
@@ -1381,7 +1522,7 @@ vldb_print(register const u_char *bp, int length)
* gleaned from vlserver/vldbint.xg
*/
- vldb_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ vldb_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" vldb");
@@ -1410,8 +1551,8 @@ vldb_print(register const u_char *bp, int length)
case 518: /* Get entry by ID N */
printf(" volid");
INTOUT();
- TRUNC(sizeof(int32_t));
- i = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
if (i <= 2)
printf(" type %s", voltype[i]);
@@ -1430,8 +1571,8 @@ vldb_print(register const u_char *bp, int length)
case 520: /* Replace entry N */
printf(" volid");
INTOUT();
- TRUNC(sizeof(int32_t));
- i = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ i = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
if (i <= 2)
printf(" type %s", voltype[i]);
@@ -1500,16 +1641,16 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
case 504: /* Get entry by name */
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
bp += sizeof(int32_t);
printf(" numservers");
- TRUNC(sizeof(int32_t));
- nservers = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" %lu", nservers);
printf(" servers");
for (i = 0; i < 8; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
printf(" %s",
inet_ntoa(*((struct in_addr *) bp)));
@@ -1517,15 +1658,15 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
}
printf(" partitions");
for (i = 0; i < 8; i++) {
- TRUNC(sizeof(int32_t));
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
printf(" %c", 'a' + (int)j);
else if (i < nservers)
printf(" %lu", j);
bp += sizeof(int32_t);
}
- TRUNC(8 * sizeof(int32_t));
+ TCHECK2(bp[0], 8 * sizeof(int32_t));
bp += 8 * sizeof(int32_t);
printf(" rwvol");
UINTOUT();
@@ -1550,13 +1691,13 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
printf(" numservers");
- TRUNC(sizeof(int32_t));
- nservers = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" %lu", nservers);
printf(" servers");
for (i = 0; i < 13; i++) {
- TRUNC(sizeof(int32_t));
+ TCHECK2(bp[0], sizeof(int32_t));
if (i < nservers)
printf(" %s",
inet_ntoa(*((struct in_addr *) bp)));
@@ -1564,15 +1705,15 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
}
printf(" partitions");
for (i = 0; i < 13; i++) {
- TRUNC(sizeof(int32_t));
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
printf(" %c", 'a' + (int)j);
else if (i < nservers)
printf(" %lu", j);
bp += sizeof(int32_t);
}
- TRUNC(13 * sizeof(int32_t));
+ TCHECK2(bp[0], 13 * sizeof(int32_t));
bp += 13 * sizeof(int32_t);
printf(" rwvol");
UINTOUT();
@@ -1587,8 +1728,8 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
{ unsigned long nservers, j;
VECOUT(VLNAMEMAX);
printf(" numservers");
- TRUNC(sizeof(int32_t));
- nservers = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ nservers = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" %lu", nservers);
printf(" servers");
@@ -1597,23 +1738,23 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode)
printf(" afsuuid");
AFSUUIDOUT();
} else {
- TRUNC(44);
+ TCHECK2(bp[0], 44);
bp += 44;
}
}
- TRUNC(4 * 13);
+ TCHECK2(bp[0], 4 * 13);
bp += 4 * 13;
printf(" partitions");
for (i = 0; i < 13; i++) {
- TRUNC(sizeof(int32_t));
- j = ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ j = EXTRACT_32BITS(bp);
if (i < nservers && j <= 26)
printf(" %c", 'a' + (int)j);
else if (i < nservers)
printf(" %lu", j);
bp += sizeof(int32_t);
}
- TRUNC(13 * sizeof(int32_t));
+ TCHECK2(bp[0], 13 * sizeof(int32_t));
bp += 13 * sizeof(int32_t);
printf(" rwvol");
UINTOUT();
@@ -1662,7 +1803,7 @@ kauth_print(register const u_char *bp, int length)
* gleaned from kauth/kauth.rg
*/
- kauth_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ kauth_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" kauth");
@@ -1703,10 +1844,10 @@ kauth_print(register const u_char *bp, int length)
INTOUT();
printf(" domain");
STROUT(KANAMEMAX);
- TRUNC(sizeof(int32_t));
- i = (int) ntohl(*((int *) bp));
+ TCHECK2(bp[0], sizeof(int32_t));
+ i = (int) EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
- TRUNC(i);
+ TCHECK2(bp[0], i);
bp += i;
printf(" principal");
STROUT(KANAMEMAX);
@@ -1806,7 +1947,7 @@ vol_print(register const u_char *bp, int length)
* gleaned from volser/volint.xg
*/
- vol_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ vol_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" vol call %s", tok2str(vol_req, "op#%d", vol_op));
@@ -1889,7 +2030,7 @@ bos_print(register const u_char *bp, int length)
* gleaned from bozo/bosint.xg
*/
- bos_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ bos_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" bos call %s", tok2str(bos_req, "op#%d", bos_op));
@@ -2032,7 +2173,7 @@ ubik_print(register const u_char *bp, int length)
* gleaned from ubik/ubik_int.xg
*/
- ubik_op = ntohl(*((int *) (bp + sizeof(struct rx_header))));
+ ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
printf(" ubik call %s", tok2str(ubik_req, "op#%d", ubik_op));
@@ -2044,8 +2185,8 @@ ubik_print(register const u_char *bp, int length)
switch (ubik_op) {
case 10000: /* Beacon */
- TRUNC(4);
- temp = ntohl(*((int *) bp));
+ TCHECK2(bp[0], 4);
+ temp = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
printf(" syncsite %s", temp ? "yes" : "no");
printf(" votestart");
@@ -2076,7 +2217,7 @@ ubik_print(register const u_char *bp, int length)
INTOUT();
printf(" length");
INTOUT();
- temp = ntohl(*((int *) bp));
+ temp = EXTRACT_32BITS(bp);
bp += sizeof(int32_t);
tok2str(ubik_lock_types, "type %d", temp);
break;
@@ -2188,3 +2329,197 @@ ubik_reply_print(register const u_char *bp, int length, int32_t opcode)
trunc:
printf(" [|ubik]");
}
+
+/*
+ * Handle RX ACK packets.
+ */
+
+static void
+rx_ack_print(register const u_char *bp, int length)
+{
+ struct rx_ackPacket *rxa;
+ int i, start, last;
+
+ if (length < sizeof(struct rx_header))
+ return;
+
+ bp += sizeof(struct rx_header);
+
+ /*
+ * This may seem a little odd .... the rx_ackPacket structure
+ * contains an array of individual packet acknowledgements
+ * (used for selective ack/nack), but since it's variable in size,
+ * we don't want to truncate based on the size of the whole
+ * rx_ackPacket structure.
+ */
+
+ TCHECK2(bp[0], sizeof(struct rx_ackPacket) - RX_MAXACKS);
+
+ rxa = (struct rx_ackPacket *) bp;
+ bp += (sizeof(struct rx_ackPacket) - RX_MAXACKS);
+
+ /*
+ * Print out a few useful things from the ack packet structure
+ */
+
+ if (vflag > 2)
+ printf(" bufspace %d maxskew %d",
+ (int) EXTRACT_16BITS(&rxa->bufferSpace),
+ (int) EXTRACT_16BITS(&rxa->maxSkew));
+
+ printf(" first %d serial %d reason %s",
+ EXTRACT_32BITS(&rxa->firstPacket), EXTRACT_32BITS(&rxa->serial),
+ tok2str(rx_ack_reasons, "#%d", (int) rxa->reason));
+
+ /*
+ * Okay, now we print out the ack array. The way _this_ works
+ * is that we start at "first", and step through the ack array.
+ * If we have a contiguous range of acks/nacks, try to
+ * collapse them into a range.
+ *
+ * If you're really clever, you might have noticed that this
+ * doesn't seem quite correct. Specifically, due to structure
+ * padding, sizeof(struct rx_ackPacket) - RX_MAXACKS won't actually
+ * yield the start of the ack array (because RX_MAXACKS is 255
+ * and the structure will likely get padded to a 2 or 4 byte
+ * boundary). However, this is the way it's implemented inside
+ * of AFS - the start of the extra fields are at
+ * sizeof(struct rx_ackPacket) - RX_MAXACKS + nAcks, which _isn't_
+ * the exact start of the ack array. Sigh. That's why we aren't
+ * using bp, but instead use rxa->acks[]. But nAcks gets added
+ * to bp after this, so bp ends up at the right spot. Go figure.
+ */
+
+ if (rxa->nAcks != 0) {
+
+ TCHECK2(bp[0], rxa->nAcks);
+
+ /*
+ * Sigh, this is gross, but it seems to work to collapse
+ * ranges correctly.
+ */
+
+ for (i = 0, start = last = -2; i < rxa->nAcks; i++)
+ if (rxa->acks[i] == RX_ACK_TYPE_ACK) {
+
+ /*
+ * I figured this deserved _some_ explanation.
+ * First, print "acked" and the packet seq
+ * number if this is the first time we've
+ * seen an acked packet.
+ */
+
+ if (last == -2) {
+ printf(" acked %d",
+ rxa->firstPacket + i);
+ start = i;
+ }
+
+ /*
+ * Otherwise, if the there is a skip in
+ * the range (such as an nacked packet in
+ * the middle of some acked packets),
+ * then print the current packet number
+ * seperated from the last number by
+ * a comma.
+ */
+
+ else if (last != i - 1) {
+ printf(",%d", rxa->firstPacket + i);
+ start = i;
+ }
+
+ /*
+ * We always set last to the value of
+ * the last ack we saw. Conversely, start
+ * is set to the value of the first ack
+ * we saw in a range.
+ */
+
+ last = i;
+
+ /*
+ * Okay, this bit a code gets executed when
+ * we hit a nack ... in _this_ case we
+ * want to print out the range of packets
+ * that were acked, so we need to print
+ * the _previous_ packet number seperated
+ * from the first by a dash (-). Since we
+ * already printed the first packet above,
+ * just print the final packet. Don't
+ * do this if there will be a single-length
+ * range.
+ */
+ } else if (last == i - 1 && start != last)
+ printf("-%d", rxa->firstPacket + i - 1);
+
+ /*
+ * So, what's going on here? We ran off the end of the
+ * ack list, and if we got a range we need to finish it up.
+ * So we need to determine if the last packet in the list
+ * was an ack (if so, then last will be set to it) and
+ * we need to see if the last range didn't start with the
+ * last packet (because if it _did_, then that would mean
+ * that the packet number has already been printed and
+ * we don't need to print it again).
+ */
+
+ if (last == i - 1 && start != last)
+ printf("-%d", rxa->firstPacket + i - 1);
+
+ /*
+ * Same as above, just without comments
+ */
+
+ for (i = 0, start = last = -2; i < rxa->nAcks; i++)
+ if (rxa->acks[i] == RX_ACK_TYPE_NACK) {
+ if (last == -2) {
+ printf(" nacked %d",
+ rxa->firstPacket + i);
+ start = i;
+ } else if (last != i - 1) {
+ printf(",%d", rxa->firstPacket + i);
+ start = i;
+ }
+ last = i;
+ } else if (last == i - 1 && start != last)
+ printf("-%d", rxa->firstPacket + i - 1);
+
+ if (last == i - 1 && start != last)
+ printf("-%d", rxa->firstPacket + i - 1);
+
+ bp += rxa->nAcks;
+ }
+
+
+ /*
+ * These are optional fields; depending on your version of AFS,
+ * you may or may not see them
+ */
+
+#define TRUNCRET(n) if (snapend - bp + 1 <= n) return;
+
+ if (vflag > 1) {
+ TRUNCRET(4);
+ printf(" ifmtu");
+ INTOUT();
+
+ TRUNCRET(4);
+ printf(" maxmtu");
+ INTOUT();
+
+ TRUNCRET(4);
+ printf(" rwind");
+ INTOUT();
+
+ TRUNCRET(4);
+ printf(" maxpackets");
+ INTOUT();
+ }
+
+ return;
+
+trunc:
+ printf(" [|ack]");
+}
+#undef TRUNCRET
diff --git a/contrib/tcpdump/print-sll.c b/contrib/tcpdump/print-sll.c
new file mode 100644
index 0000000..8f2803a
--- /dev/null
+++ b/contrib/tcpdump/print-sll.c
@@ -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');
+}
diff --git a/contrib/tcpdump/print-smb.c b/contrib/tcpdump/print-smb.c
index 0a14f59..e5a3da5 100644
--- a/contrib/tcpdump/print-smb.c
+++ b/contrib/tcpdump/print-smb.c
@@ -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;
diff --git a/contrib/tcpdump/print-snmp.c b/contrib/tcpdump/print-snmp.c
index 5013952..2e2a276 100644
--- a/contrib/tcpdump/print-snmp.c
+++ b/contrib/tcpdump/print-snmp.c
@@ -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);
+ }
}
diff --git a/contrib/tcpdump/print-stp.c b/contrib/tcpdump/print-stp.c
new file mode 100644
index 0000000..9281663
--- /dev/null
+++ b/contrib/tcpdump/print-stp.c
@@ -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);
+}
diff --git a/contrib/tcpdump/print-tcp.c b/contrib/tcpdump/print-tcp.c
index 451bab6..40d3f49 100644
--- a/contrib/tcpdump/print-tcp.c
+++ b/contrib/tcpdump/print-tcp.c
@@ -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 <rpc/rpc.h>
+
#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_var.h>
-#include <netinet/tcp.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 @@ trunc:
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(']');
+}
diff --git a/contrib/tcpdump/print-telnet.c b/contrib/tcpdump/print-telnet.c
index bb0f4ab..bad4e7d 100644
--- a/contrib/tcpdump/print-telnet.c
+++ b/contrib/tcpdump/print-telnet.c
@@ -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;
}
diff --git a/contrib/tcpdump/print-timed.c b/contrib/tcpdump/print-timed.c
new file mode 100644
index 0000000..d683c40
--- /dev/null
+++ b/contrib/tcpdump/print-timed.c
@@ -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);
+ }
+}
diff --git a/contrib/tcpdump/print-vjc.c b/contrib/tcpdump/print-vjc.c
index 1b8847f..4283da6 100644
--- a/contrib/tcpdump/print-vjc.c
+++ b/contrib/tcpdump/print-vjc.c
@@ -23,48 +23,27 @@
#include "config.h"
#endif
-#if defined(__bsdi__)
-
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.2.2.1 2000/01/11 06:58:28 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.9 2000/10/09 01:53:21 guy Exp $ (LBL)";
#endif
#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>
-#if defined(__NetBSD__)
-#include <sys/mbuf.h>
-#include <net/ppp_defs.h>
-#endif
-
-#if defined(__bsdi__) || defined(__NetBSD__)
-#include <net/if_ppp.h>
-#include <net/slcompress.h>
-#endif
-
#include "interface.h"
#include "addrtoname.h"
+#include "slcompress.h"
+#include "ppp.h"
+
int
vjc_print(register const char *bp, register u_int length, u_short proto)
{
@@ -101,4 +80,3 @@ vjc_print(register const char *bp, register u_int length, u_short proto)
return -1;
}
}
-#endif /* defined(__bsdi__) || defined(__NetBSD__) */
diff --git a/contrib/tcpdump/print-vrrp.c b/contrib/tcpdump/print-vrrp.c
new file mode 100644
index 0000000..6b7ac94
--- /dev/null
+++ b/contrib/tcpdump/print-vrrp.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2000 William C. Fenner.
+ * All rights reserved.
+ *
+ * Kevin Steves <ks@hp.se> July 2000
+ * Modified to:
+ * - print version, type string and packet length
+ * - print IP address count if > 1 (-v)
+ * - verify checksum (-v)
+ * - print authentication string (-v)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code
+ * distributions retain the above copyright notice and this paragraph
+ * in its entirety, and (2) distributions including binary code include
+ * the above copyright notice and this paragraph in its entirety in
+ * the documentation or other materials provided with the distribution.
+ * The name of William C. Fenner 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.
+ */
+
+#ifndef lint
+static const char rcsid[] =
+ "@(#) $Header: /tcpdump/master/tcpdump/print-vrrp.c,v 1.3 2000/10/10 05:05:08 guy Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <netinet/in.h>
+
+#include "interface.h"
+#include "extract.h"
+#include "addrtoname.h"
+
+/*
+ * RFC 2338:
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |Version| Type | Virtual Rtr ID| Priority | Count IP Addrs|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Auth Type | Adver Int | Checksum |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IP Address (1) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | IP Address (n) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Authentication Data (1) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Authentication Data (2) |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+void
+vrrp_print(register const u_char *bp, register u_int len, int ttl)
+{
+ int version, type, auth_type;
+ char *type_s;
+
+ TCHECK(bp[0]);
+ version = (bp[0] & 0xf0) >> 4;
+ type = bp[0] & 0x0f;
+ if (type == 1)
+ type_s = "advertise";
+ else
+ type_s = "unknown";
+ printf("VRRPv%d-%s %d: ", version, type_s, len);
+ if (ttl != 255)
+ printf("[ttl=%d!] ", ttl);
+ if (version != 2 || type != 1)
+ return;
+ TCHECK(bp[2]);
+ printf("vrid=%d prio=%d", bp[1], bp[2]);
+ TCHECK(bp[5]);
+ auth_type = bp[4];
+ if (auth_type != 0)
+ printf(" authtype=%d", auth_type);
+ printf(" intvl=%d", bp[5]);
+ if (vflag) {
+ int naddrs = bp[3];
+ int i;
+ char c;
+
+ if (TTEST2(bp[0], len) && in_cksum((const u_short*)bp, len, 0))
+ printf(" (bad vrrp cksum %x!)",
+ EXTRACT_16BITS(&bp[6]));
+ printf(" addrs");
+ if (naddrs > 1)
+ printf("(%d)", naddrs);
+ printf(":");
+ c = ' ';
+ bp += 8;
+ for (i = 0; i < naddrs; i++) {
+ TCHECK(bp[3]);
+ printf("%c%s", c, ipaddr_string(bp));
+ c = ',';
+ bp += 4;
+ }
+ if (auth_type == 1) { /* simple text password */
+ TCHECK(bp[7]);
+ printf(" auth %.8s", bp);
+ }
+ }
+ return;
+trunc:
+ printf("[|vrrp]");
+}
diff --git a/contrib/tcpdump/route6d.h b/contrib/tcpdump/route6d.h
index f9cc3dd..dba49fb 100644
--- a/contrib/tcpdump/route6d.h
+++ b/contrib/tcpdump/route6d.h
@@ -1,5 +1,5 @@
/*
- * $Header: /tcpdump/master/tcpdump/route6d.h,v 1.1 1999/10/30 05:11:22 itojun Exp $
+ * $Header: /tcpdump/master/tcpdump/route6d.h,v 1.2 2000/04/28 11:14:49 itojun Exp $
*/
#define RIP6_VERSION 1
@@ -8,16 +8,16 @@
#define RIP6_RESPONSE 2
struct netinfo6 {
- struct in6_addr rip6_dest;
- u_short rip6_tag;
- u_char rip6_plen;
- u_char rip6_metric;
+ struct in6_addr rip6_dest;
+ u_int16_t rip6_tag;
+ u_int8_t rip6_plen;
+ u_int8_t rip6_metric;
};
struct rip6 {
- u_char rip6_cmd;
- u_char rip6_vers;
- u_char rip6_res1[2];
+ u_int8_t rip6_cmd;
+ u_int8_t rip6_vers;
+ u_int8_t rip6_res1[2];
union {
struct netinfo6 ru6_nets[1];
char ru6_tracefile[1];
diff --git a/contrib/tcpdump/rx.h b/contrib/tcpdump/rx.h
index 5435beb..fe6f963 100644
--- a/contrib/tcpdump/rx.h
+++ b/contrib/tcpdump/rx.h
@@ -1,7 +1,7 @@
/*
* Rx protocol format
*
- * $Id: rx.h,v 1.1 1999/11/17 05:45:58 assar Exp $
+ * $Id: rx.h,v 1.3 2000/10/03 02:55:02 itojun Exp $
*/
#define FS_RX_PORT 7000
@@ -40,7 +40,7 @@ struct rx_header {
u_int32_t callNumber;
u_int32_t seq;
u_int32_t serial;
- u_char type;
+ u_int8_t type;
#define RX_PACKET_TYPE_DATA 1
#define RX_PACKET_TYPE_ACK 2
#define RX_PACKET_TYPE_BUSY 3
@@ -51,18 +51,39 @@ struct rx_header {
#define RX_PACKET_TYPE_DEBUG 8
#define RX_PACKET_TYPE_PARAMS 9
#define RX_PACKET_TYPE_VERSION 13
- u_char flags;
+ u_int8_t flags;
#define RX_CLIENT_INITIATED 1
#define RX_REQUEST_ACK 2
#define RX_LAST_PACKET 4
#define RX_MORE_PACKETS 8
#define RX_FREE_PACKET 16
- u_char userStatus;
- u_char securityIndex;
- u_short spare; /* How clever: even though the AFS */
- u_short serviceId; /* header files indicate that the */
+ u_int8_t userStatus;
+ u_int8_t securityIndex;
+ u_int16_t spare; /* How clever: even though the AFS */
+ u_int16_t serviceId; /* header files indicate that the */
}; /* serviceId is first, it's really */
/* encoded _after_ the spare field */
/* I wasted a day figuring that out! */
#define NUM_RX_FLAGS 5
+
+#define RX_MAXACKS 255
+
+struct rx_ackPacket {
+ u_int16_t bufferSpace; /* Number of packet buffers available */
+ u_int16_t maxSkew; /* Max diff between ack'd packet and */
+ /* highest packet received */
+ u_int32_t firstPacket; /* The first packet in ack list */
+ u_int32_t previousPacket; /* Previous packet recv'd (obsolete) */
+ u_int32_t serial; /* # of packet that prompted the ack */
+ u_int8_t reason; /* Reason for acknowledgement */
+ u_int8_t nAcks; /* Number of acknowledgements */
+ u_int8_t acks[RX_MAXACKS]; /* Up to RX_MAXACKS acknowledgements */
+};
+
+/*
+ * Values for the acks array
+ */
+
+#define RX_ACK_TYPE_NACK 0 /* Don't have this packet */
+#define RX_ACK_TYPE_ACK 1 /* I have this packet */
diff --git a/contrib/tcpdump/savestr.c b/contrib/tcpdump/savestr.c
index a148802..a81227c 100644
--- a/contrib/tcpdump/savestr.c
+++ b/contrib/tcpdump/savestr.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/savestr.c,v 1.4 1999/11/21 09:37:04 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/Attic/savestr.c,v 1.6 2000/07/11 00:49:02 assar Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,14 +30,10 @@ static const char rcsid[] =
#include <sys/types.h>
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "gnuc.h"
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
#endif
diff --git a/contrib/tcpdump/savestr.h b/contrib/tcpdump/savestr.h
index 26f9c21..8fe995e 100644
--- a/contrib/tcpdump/savestr.h
+++ b/contrib/tcpdump/savestr.h
@@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/savestr.h,v 1.1.1.1 1999/10/07 23:47:12 mcr Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/Attic/savestr.h,v 1.1.1.1 1999/10/07 23:47:12 mcr Exp $ (LBL)
*/
extern char *savestr(const char *);
diff --git a/contrib/tcpdump/setsignal.c b/contrib/tcpdump/setsignal.c
index 756d1fe..eff2727 100644
--- a/contrib/tcpdump/setsignal.c
+++ b/contrib/tcpdump/setsignal.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/setsignal.c,v 1.5 1999/11/21 09:37:04 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/setsignal.c,v 1.7 2000/07/11 00:49:03 assar Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -30,15 +30,11 @@ static const char rcsid[] =
#include <sys/types.h>
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
#include <signal.h>
#ifdef HAVE_SIGACTION
#include <string.h>
#endif
-#include "gnuc.h"
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"
#endif
diff --git a/contrib/tcpdump/slcompress.h b/contrib/tcpdump/slcompress.h
new file mode 100644
index 0000000..d8a596c
--- /dev/null
+++ b/contrib/tcpdump/slcompress.h
@@ -0,0 +1,87 @@
+/*
+ * Definitions for tcp compression routines.
+ *
+ * @(#) $Header: /tcpdump/master/tcpdump/slcompress.h,v 1.2 2000/10/09 02:03:44 guy Exp $ (LBL)
+ *
+ * Copyright (c) 1989, 1990, 1992, 1993 Regents of the University of
+ * California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Van Jacobson (van@ee.lbl.gov), Dec 31, 1989:
+ * - Initial distribution.
+ */
+
+/*
+ * Compressed packet format:
+ *
+ * The first octet contains the packet type (top 3 bits), TCP
+ * 'push' bit, and flags that indicate which of the 4 TCP sequence
+ * numbers have changed (bottom 5 bits). The next octet is a
+ * conversation number that associates a saved IP/TCP header with
+ * the compressed packet. The next two octets are the TCP checksum
+ * from the original datagram. The next 0 to 15 octets are
+ * sequence number changes, one change per bit set in the header
+ * (there may be no changes and there are two special cases where
+ * the receiver implicitly knows what changed -- see below).
+ *
+ * There are 5 numbers which can change (they are always inserted
+ * in the following order): TCP urgent pointer, window,
+ * acknowlegement, sequence number and IP ID. (The urgent pointer
+ * is different from the others in that its value is sent, not the
+ * change in value.) Since typical use of SLIP links is biased
+ * toward small packets (see comments on MTU/MSS below), changes
+ * use a variable length coding with one octet for numbers in the
+ * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
+ * range 256 - 65535 or 0. (If the change in sequence number or
+ * ack is more than 65535, an uncompressed packet is sent.)
+ */
+
+/*
+ * Packet types (must not conflict with IP protocol version)
+ *
+ * The top nibble of the first octet is the packet type. There are
+ * three possible types: IP (not proto TCP or tcp with one of the
+ * control flags set); uncompressed TCP (a normal IP/TCP packet but
+ * with the 8-bit protocol field replaced by an 8-bit connection id --
+ * this type of packet syncs the sender & receiver); and compressed
+ * TCP (described above).
+ *
+ * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
+ * is logically part of the 4-bit "changes" field that follows. Top
+ * three bits are actual packet type. For backward compatibility
+ * and in the interest of conserving bits, numbers are chosen so the
+ * IP protocol version number (4) which normally appears in this nibble
+ * means "IP packet".
+ */
+
+/* packet types */
+#define TYPE_IP 0x40
+#define TYPE_UNCOMPRESSED_TCP 0x70
+#define TYPE_COMPRESSED_TCP 0x80
+#define TYPE_ERROR 0x00
+
+/* Bits in first octet of compressed packet */
+#define NEW_C 0x40 /* flag bits for what changed in a packet */
+#define NEW_I 0x20
+#define NEW_S 0x08
+#define NEW_A 0x04
+#define NEW_W 0x02
+#define NEW_U 0x01
+
+/* reserved, special-case values of above */
+#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */
+#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */
+#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
+
+#define TCP_PUSH_BIT 0x10
diff --git a/contrib/tcpdump/slip.h b/contrib/tcpdump/slip.h
new file mode 100644
index 0000000..e64f301
--- /dev/null
+++ b/contrib/tcpdump/slip.h
@@ -0,0 +1,34 @@
+/*
+ * Definitions that user level programs might need to know to interact
+ * with serial line IP (slip) lines.
+ *
+ * @(#) $Header: /tcpdump/master/tcpdump/slip.h,v 1.1 2000/10/09 01:53:21 guy Exp $
+ *
+ * Copyright (c) 1990 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/*
+ * definitions of the pseudo- link-level header attached to slip
+ * packets grabbed by the packet filter (bpf) traffic monitor.
+ */
+#define SLIP_HDRLEN 16
+
+#define SLX_DIR 0
+#define SLX_CHDR 1
+#define CHDR_LEN 15
+
+#define SLIPDIR_IN 0
+#define SLIPDIR_OUT 1
diff --git a/contrib/tcpdump/sll.h b/contrib/tcpdump/sll.h
new file mode 100644
index 0000000..821a845
--- /dev/null
+++ b/contrib/tcpdump/sll.h
@@ -0,0 +1,127 @@
+/*-
+ * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
+ * Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#) $Header: /tcpdump/master/tcpdump/sll.h,v 1.4 2000/12/23 07:52:11 guy Exp $ (LBL)
+ */
+
+/*
+ * For captures on Linux cooked sockets, we construct a fake header
+ * that includes:
+ *
+ * a 2-byte "packet type" which is one of:
+ *
+ * LINUX_SLL_HOST packet was sent to us
+ * LINUX_SLL_BROADCAST packet was broadcast
+ * LINUX_SLL_MULTICAST packet was multicast
+ * LINUX_SLL_OTHERHOST packet was sent to somebody else
+ * LINUX_SLL_OUTGOING packet was sent *by* us;
+ *
+ * a 2-byte Ethernet protocol field;
+ *
+ * a 2-byte link-layer type;
+ *
+ * a 2-byte link-layer address length;
+ *
+ * an 8-byte source link-layer address, whose actual length is
+ * specified by the previous value.
+ *
+ * All fields except for the link-layer address are in network byte order.
+ *
+ * DO NOT change the layout of this structure, or change any of the
+ * LINUX_SLL_ values below. If you must change the link-layer header
+ * for a "cooked" Linux capture, introduce a new DLT_ type (ask
+ * "tcpdump-workers@tcpdump.org" for one, so that you don't give it a
+ * value that collides with a value already being used), and use the
+ * new header in captures of that type, so that programs that can
+ * handle DLT_LINUX_SLL captures will continue to handle them correctly
+ * without any change, and so that capture files with different headers
+ * can be told apart and programs that read them can dissect the
+ * packets in them.
+ *
+ * This structure, and the #defines below, must be the same in the
+ * libpcap and tcpdump versions of "sll.h".
+ */
+
+/*
+ * A DLT_LINUX_SLL fake link-layer header.
+ */
+#define SLL_HDR_LEN 16 /* total header length */
+#define SLL_ADDRLEN 8 /* length of address field */
+
+struct sll_header {
+ u_int16_t sll_pkttype; /* packet type */
+ u_int16_t sll_hatype; /* link-layer address type */
+ u_int16_t sll_halen; /* link-layer address length */
+ u_int8_t sll_addr[SLL_ADDRLEN]; /* link-layer address */
+ u_int16_t sll_protocol; /* protocol */
+};
+
+/*
+ * The LINUX_SLL_ values for "sll_pkttype"; these correspond to the
+ * PACKET_ values on Linux, but are defined here so that they're
+ * available even on systems other than Linux, and so that they
+ * don't change even if the PACKET_ values change.
+ */
+#define LINUX_SLL_HOST 0
+#define LINUX_SLL_BROADCAST 1
+#define LINUX_SLL_MULTICAST 2
+#define LINUX_SLL_OTHERHOST 3
+#define LINUX_SLL_OUTGOING 4
+
+/*
+ * The LINUX_SLL_ values for "sll_protocol"; these correspond to the
+ * ETH_P_ values on Linux, but are defined here so that they're
+ * available even on systems other than Linux. We assume, for now,
+ * that the ETH_P_ values won't change in Linux; if they do, then:
+ *
+ * if we don't translate them in "pcap-linux.c", capture files
+ * won't necessarily be readable if captured on a system that
+ * defines ETH_P_ values that don't match these values;
+ *
+ * if we do translate them in "pcap-linux.c", that makes life
+ * unpleasant for the BPF code generator, as the values you test
+ * for in the kernel aren't the values that you test for when
+ * reading a capture file, so the fixup code run on BPF programs
+ * handed to the kernel ends up having to do more work.
+ *
+ * Add other values here as necessary, for handling packet types that
+ * might show up on non-Ethernet, non-802.x networks. (Not all the ones
+ * in the Linux "if_ether.h" will, I suspect, actually show up in
+ * captures.)
+ */
+#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */
+#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */
diff --git a/contrib/tcpdump/smb.h b/contrib/tcpdump/smb.h
index 0c5461a..63be64b 100644
--- a/contrib/tcpdump/smb.h
+++ b/contrib/tcpdump/smb.h
@@ -1,3 +1,4 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/smb.h,v 1.3 2000/12/17 23:07:50 guy Exp $ (LBL) */
/*
Copyright (C) Andrew Tridgell 1995-1999
diff --git a/contrib/tcpdump/smbutil.c b/contrib/tcpdump/smbutil.c
index 2ddd3f6..898345d 100644
--- a/contrib/tcpdump/smbutil.c
+++ b/contrib/tcpdump/smbutil.c
@@ -11,7 +11,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.4.2.1 2000/01/11 06:58:28 fenner Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.12 2000/12/04 00:35:45 guy Exp $";
#endif
#include <sys/param.h>
@@ -19,20 +19,19 @@ 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 <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "interface.h"
#include "smb.h"
-extern uchar *startbuf;
+extern const uchar *startbuf;
/*******************************************************************
interpret a 32 bit dos packed date/time to some parameters
@@ -115,12 +114,18 @@ static time_t interpret_long_date(const char *p)
/****************************************************************************
-interpret the weird netbios "name". Return the name type
+interpret the weird netbios "name". Return the name type, or -1 if
+we run past the end of the buffer
****************************************************************************/
-static int name_interpret(char *in,char *out)
+static int name_interpret(const uchar *in,const uchar *maxbuf,char *out)
{
int ret;
- int len = (*in++) / 2;
+ int len;
+
+ if (in >= maxbuf)
+ return(-1); /* name goes past the end of the buffer */
+ TCHECK2(*in, 1);
+ len = (*in++) / 2;
*out=0;
@@ -128,6 +133,9 @@ static int name_interpret(char *in,char *out)
while (len--)
{
+ if (in + 1 >= maxbuf)
+ return(-1); /* name goes past the end of the buffer */
+ TCHECK2(*in, 2);
if (in[0] < 'A' || in[0] > 'P' || in[1] < 'A' || in[1] > 'P') {
*out = 0;
return(0);
@@ -140,46 +148,86 @@ static int name_interpret(char *in,char *out)
ret = out[-1];
return(ret);
+
+trunc:
+ return(-1);
}
/****************************************************************************
find a pointer to a netbios name
****************************************************************************/
-static char *name_ptr(char *buf,int ofs)
+static const uchar *name_ptr(const uchar *buf,int ofs,const uchar *maxbuf)
{
- unsigned char c = *(unsigned char *)(buf+ofs);
+ const uchar *p;
+ uchar c;
+
+ p = buf+ofs;
+ if (p >= maxbuf)
+ return(NULL); /* name goes past the end of the buffer */
+ TCHECK2(*p, 1);
+ c = *p;
+
+ /* XXX - this should use the same code that the DNS dissector does */
if ((c & 0xC0) == 0xC0)
{
uint16 l = RSVAL(buf, ofs) & 0x3FFF;
+ if (l == 0)
+ {
+ /* We have a pointer that points to itself. */
+ return(NULL);
+ }
+ p = buf + l;
+ if (p >= maxbuf)
+ return(NULL); /* name goes past the end of the buffer */
+ TCHECK2(*p, 1);
return(buf + l);
}
else
return(buf+ofs);
+
+trunc:
+ return(NULL); /* name goes past the end of the buffer */
}
/****************************************************************************
extract a netbios name from a buf
****************************************************************************/
-static int name_extract(char *buf,int ofs,char *name)
+static int name_extract(const uchar *buf,int ofs,const uchar *maxbuf,char *name)
{
- char *p = name_ptr(buf,ofs);
+ const uchar *p = name_ptr(buf,ofs,maxbuf);
+ if (p == NULL)
+ return(-1); /* error (probably name going past end of buffer) */
strcpy(name,"");
- return(name_interpret(p,name));
+ return(name_interpret(p,maxbuf,name));
}
/****************************************************************************
return the total storage length of a mangled name
****************************************************************************/
-static int name_len(const unsigned char *s)
+static int name_len(const unsigned char *s, const unsigned char *maxbuf)
{
- const char *s0 = s;
- unsigned char c = *(unsigned char *)s;
+ const unsigned char *s0 = s;
+ unsigned char c;
+
+ if (s >= maxbuf)
+ return(-1); /* name goes past the end of the buffer */
+ TCHECK2(*s, 1);
+ c = *s;
if ((c & 0xC0) == 0xC0)
- return(2);
- while (*s) s += (*s)+1;
+ return(2);
+ while (*s)
+ {
+ if (s >= maxbuf)
+ return(-1); /* name goes past the end of the buffer */
+ TCHECK2(*s, 1);
+ s += (*s)+1;
+ }
return(PTR_DIFF(s,s0)+1);
+
+trunc:
+ return(-1); /* name goes past the end of the buffer */
}
static void print_asc(const unsigned char *buf,int len)
@@ -429,10 +477,17 @@ static const uchar *fdata1(const uchar *buf, const char *fmt, const uchar *maxbu
int t = atoi(fmt+1);
char nbuf[255];
int name_type;
+ int len;
switch (t) {
case 1:
- name_type = name_extract(startbuf,PTR_DIFF(buf,startbuf),nbuf);
- buf += name_len(buf);
+ name_type = name_extract(startbuf,PTR_DIFF(buf,startbuf),maxbuf,
+ nbuf);
+ if (name_type < 0)
+ goto trunc;
+ len = name_len(buf,maxbuf);
+ if (len < 0)
+ goto trunc;
+ buf += len;
printf("%-15.15s NameType=0x%02X (%s)",
nbuf,name_type,name_type_str(name_type));
break;
@@ -485,6 +540,11 @@ static const uchar *fdata1(const uchar *buf, const char *fmt, const uchar *maxbu
printf("END OF BUFFER\n");
return(buf);
+
+trunc:
+ printf("\n");
+ printf("WARNING: Short packet. Try increasing the snap length\n");
+ return(NULL);
}
const uchar *fdata(const uchar *buf, const char *fmt, const uchar *maxbuf)
@@ -525,11 +585,13 @@ const uchar *fdata(const uchar *buf, const char *fmt, const uchar *maxbuf)
case '[':
fmt++;
if (buf>=maxbuf) return(buf);
- bzero(s,sizeof(s));
+ memset(s, 0, sizeof(s));
p = strchr(fmt,']');
strncpy(s,fmt,p-fmt);
fmt = p+1;
buf = fdata1(buf,s,maxbuf);
+ if (buf == NULL)
+ return(NULL);
break;
default:
@@ -680,19 +742,16 @@ char *smb_errstr(int class,int num)
for (j=0;err[j].name;j++)
if (num == err[j].code)
{
- sprintf(ret,"%s - %s (%s)",err_classes[i].class,
+ snprintf(ret,sizeof(ret),"%s - %s (%s)",err_classes[i].class,
err[j].name,err[j].message);
return ret;
}
}
- sprintf(ret,"%s - %d",err_classes[i].class,num);
+ snprintf(ret,sizeof(ret),"%s - %d",err_classes[i].class,num);
return ret;
}
- sprintf(ret,"ERROR: Unknown error (%d,%d)",class,num);
+ snprintf(ret,sizeof(ret),"ERROR: Unknown error (%d,%d)",class,num);
return(ret);
}
-
-
-
diff --git a/contrib/tcpdump/strcasecmp.c b/contrib/tcpdump/strcasecmp.c
index 78d5ae7..acba36a 100644
--- a/contrib/tcpdump/strcasecmp.c
+++ b/contrib/tcpdump/strcasecmp.c
@@ -14,6 +14,11 @@
#include "config.h"
#endif
+#ifndef lint
+static const char rcsid[] =
+ "@(#) $Header: /tcpdump/master/tcpdump/strcasecmp.c,v 1.3 2000/01/09 21:34:21 fenner Exp $";
+#endif
+
#include <sys/types.h>
#include "interface.h"
diff --git a/contrib/tcpdump/tcp.h b/contrib/tcpdump/tcp.h
new file mode 100644
index 0000000..a93c14f
--- /dev/null
+++ b/contrib/tcpdump/tcp.h
@@ -0,0 +1,75 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.7 2000/10/03 09:17:41 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.
+ *
+ * @(#)tcp.h 8.1 (Berkeley) 6/10/93
+ */
+
+typedef u_int32_t tcp_seq;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+struct tcphdr {
+ u_int16_t th_sport; /* source port */
+ u_int16_t th_dport; /* destination port */
+ tcp_seq th_seq; /* sequence number */
+ tcp_seq th_ack; /* acknowledgement number */
+ u_int8_t th_offx2; /* data offset, rsvd */
+#define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4)
+ u_int8_t th_flags;
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+ u_int16_t th_win; /* window */
+ u_int16_t th_sum; /* checksum */
+ u_int16_t th_urp; /* urgent pointer */
+};
+
+#define TCPOPT_EOL 0
+#define TCPOPT_NOP 1
+#define TCPOPT_MAXSEG 2
+#define TCPOLEN_MAXSEG 4
+#define TCPOPT_WINDOW 3
+#define TCPOLEN_WINDOW 3
+#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
+#define TCPOLEN_SACK_PERMITTED 2
+#define TCPOPT_SACK 5 /* Experimental */
+#define TCPOPT_TIMESTAMP 8
+#define TCPOLEN_TIMESTAMP 10
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+#define TCPOPT_TSTAMP_HDR \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
diff --git a/contrib/tcpdump/timed.h b/contrib/tcpdump/timed.h
new file mode 100644
index 0000000..136e55e
--- /dev/null
+++ b/contrib/tcpdump/timed.h
@@ -0,0 +1,92 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/timed.h,v 1.3 2000/12/17 23:07:51 guy Exp $ (LBL) */
+/*
+ * Copyright (c) 1983, 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.
+ *
+ * @(#)timed.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _PROTOCOLS_TIMED_H_
+#define _PROTOCOLS_TIMED_H_
+
+/*
+ * Time Synchronization Protocol
+ */
+
+#define TSPVERSION 1
+#define ANYADDR NULL
+
+struct tsp {
+ u_char tsp_type;
+ u_char tsp_vers;
+ u_short tsp_seq;
+ union {
+ struct timeval tspu_time;
+ char tspu_hopcnt;
+ } tsp_u;
+ char tsp_name[256];
+};
+
+#define tsp_time tsp_u.tspu_time
+#define tsp_hopcnt tsp_u.tspu_hopcnt
+
+/*
+ * Command types.
+ */
+#define TSP_ANY 0 /* match any types */
+#define TSP_ADJTIME 1 /* send adjtime */
+#define TSP_ACK 2 /* generic acknowledgement */
+#define TSP_MASTERREQ 3 /* ask for master's name */
+#define TSP_MASTERACK 4 /* acknowledge master request */
+#define TSP_SETTIME 5 /* send network time */
+#define TSP_MASTERUP 6 /* inform slaves that master is up */
+#define TSP_SLAVEUP 7 /* slave is up but not polled */
+#define TSP_ELECTION 8 /* advance candidature for master */
+#define TSP_ACCEPT 9 /* support candidature of master */
+#define TSP_REFUSE 10 /* reject candidature of master */
+#define TSP_CONFLICT 11 /* two or more masters present */
+#define TSP_RESOLVE 12 /* masters' conflict resolution */
+#define TSP_QUIT 13 /* reject candidature if master is up */
+#define TSP_DATE 14 /* reset the time (date command) */
+#define TSP_DATEREQ 15 /* remote request to reset the time */
+#define TSP_DATEACK 16 /* acknowledge time setting */
+#define TSP_TRACEON 17 /* turn tracing on */
+#define TSP_TRACEOFF 18 /* turn tracing off */
+#define TSP_MSITE 19 /* find out master's site */
+#define TSP_MSITEREQ 20 /* remote master's site request */
+#define TSP_TEST 21 /* for testing election algo */
+#define TSP_SETDATE 22 /* New from date command */
+#define TSP_SETDATEREQ 23 /* New remote for above */
+#define TSP_LOOP 24 /* loop detection packet */
+
+#define TSPTYPENUMBER 25
+
+#endif /* !_TIMED_H_ */
diff --git a/contrib/tcpdump/udp.h b/contrib/tcpdump/udp.h
new file mode 100644
index 0000000..089ca01
--- /dev/null
+++ b/contrib/tcpdump/udp.h
@@ -0,0 +1,46 @@
+/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.2 2000/10/03 02:55:03 itojun 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.
+ *
+ * @(#)udp.h 8.1 (Berkeley) 6/10/93
+ */
+
+/*
+ * Udp protocol header.
+ * Per RFC 768, September, 1981.
+ */
+struct udphdr {
+ u_int16_t uh_sport; /* source port */
+ u_int16_t uh_dport; /* destination port */
+ u_int16_t uh_ulen; /* udp length */
+ u_int16_t uh_sum; /* udp checksum */
+};
diff --git a/contrib/tcpdump/util.c b/contrib/tcpdump/util.c
index 3a3094c..57e3a03 100644
--- a/contrib/tcpdump/util.c
+++ b/contrib/tcpdump/util.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.62 1999/12/15 06:58:03 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.69 2000/07/11 00:49:03 assar Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -38,16 +38,9 @@ static const char rcsid[] =
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
#include <pcap.h>
#include <stdio.h>
-#if __STDC__
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdlib.h>
#include <string.h>
#ifdef TIME_WITH_SYS_TIME
@@ -129,37 +122,51 @@ void
ts_print(register const struct timeval *tvp)
{
register int s;
+ struct tm *tm;
+ time_t Time;
+ static unsigned b_sec;
+ static unsigned b_usec;
- if (tflag > 0) {
- /* Default */
+ switch(tflag) {
+ case 1: /* Default */
s = (tvp->tv_sec + thiszone) % 86400;
(void)printf("%02d:%02d:%02d.%06u ",
- s / 3600, (s % 3600) / 60, s % 60, (u_int32_t)tvp->tv_usec);
- } else if (tflag < 0) {
- if (tflag < -1) {
- static unsigned b_sec;
- static unsigned b_usec;
- if (b_sec == 0) {
- printf("000000 ");
- } else {
- int d_usec = tvp->tv_usec - b_usec;
- int d_sec = tvp->tv_sec - b_sec;
-
- while (d_usec < 0) {
- d_usec += 1000000;
- d_sec--;
- }
- if (d_sec)
- printf("%d. ", d_sec);
- printf("%06d ", d_usec);
- }
- b_sec = tvp->tv_sec;
- b_usec = tvp->tv_usec;
+ s / 3600, (s % 3600) / 60, s % 60,
+ (unsigned)tvp->tv_usec);
+ break;
+ case -1: /* Unix timeval style */
+ (void)printf("%u.%06u ",
+ (unsigned)tvp->tv_sec,
+ (unsigned)tvp->tv_usec);
+ break;
+ case -2:
+ if (b_sec == 0) {
+ printf("000000 ");
} else {
- /* Unix timeval style */
- (void)printf("%u.%06u ",
- (u_int32_t)tvp->tv_sec, (u_int32_t)tvp->tv_usec);
+ int d_usec = tvp->tv_usec - b_usec;
+ int d_sec = tvp->tv_sec - b_sec;
+
+ while (d_usec < 0) {
+ d_usec += 1000000;
+ d_sec--;
+ }
+ if (d_sec)
+ printf("%d. ", d_sec);
+ printf("%06d ", d_usec);
}
+ b_sec = tvp->tv_sec;
+ b_usec = tvp->tv_usec;
+ break;
+ case -3: /* Default + Date*/
+ s = (tvp->tv_sec + thiszone) % 86400;
+ Time = (tvp->tv_sec + thiszone) - s;
+ tm = gmtime (&Time);
+ (void)printf("%02d/%02d/%04d %02d:%02d:%02d.%06u ",
+ tm->tm_mon+1, tm->tm_mday,
+ tm->tm_year+1900,
+ s / 3600, (s % 3600) / 60,
+ s % 60, (unsigned)tvp->tv_usec);
+ break;
}
}
@@ -171,22 +178,23 @@ ts_print(register const struct timeval *tvp)
void
relts_print(int secs)
{
- static char *lengths[]={"y","w","d","h","m","s"};
- static int seconds[]={31536000,604800,86400,3600,60,1};
- char **l = lengths;
- int *s = seconds;
-
- if (secs == 0) {
- (void)printf("0s");
- return;
- }
- while (secs) {
- if (secs >= *s) {
- (void)printf("%d%s", secs / *s, *l);
- secs -= (secs / *s) * *s;
+ static char *lengths[] = {"y", "w", "d", "h", "m", "s"};
+ static int seconds[] = {31536000, 604800, 86400, 3600, 60, 1};
+ char **l = lengths;
+ int *s = seconds;
+
+ if (secs <= 0) {
+ (void)printf("0s");
+ return;
+ }
+ while (secs > 0) {
+ if (secs >= *s) {
+ (void)printf("%d%s", secs / *s, *l);
+ secs -= (secs / *s) * *s;
+ }
+ s++;
+ l++;
}
- s++; l++;
- }
}
/*
@@ -205,29 +213,19 @@ tok2str(register const struct tok *lp, register const char *fmt,
}
if (fmt == NULL)
fmt = "#%d";
- (void)sprintf(buf, fmt, v);
+ (void)snprintf(buf, sizeof(buf), fmt, v);
return (buf);
}
/* VARARGS */
-__dead void
-#if __STDC__
+void
error(const char *fmt, ...)
-#else
-error(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list ap;
(void)fprintf(stderr, "%s: ", program_name);
-#if __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
if (*fmt) {
@@ -241,22 +239,12 @@ error(fmt, va_alist)
/* VARARGS */
void
-#if __STDC__
warning(const char *fmt, ...)
-#else
-warning(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
{
va_list ap;
(void)fprintf(stderr, "%s: WARNING: ", program_name);
-#if __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
if (*fmt) {
@@ -324,3 +312,24 @@ read_infile(char *fname)
return (cp);
}
+
+void
+safeputs(const char *s)
+{
+ while (*s) {
+ safeputchar(*s);
+ s++;
+ }
+}
+
+void
+safeputchar(int c)
+{
+ unsigned char ch;
+
+ ch = (unsigned char)(c & 0xff);
+ if (c < 0x80 && isprint(c))
+ printf("%c", c & 0xff);
+ else
+ printf("\\%03o", c & 0xff);
+}
diff --git a/contrib/tcpdump/vfprintf.c b/contrib/tcpdump/vfprintf.c
index 51fa63e..9fea58e 100644
--- a/contrib/tcpdump/vfprintf.c
+++ b/contrib/tcpdump/vfprintf.c
@@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/vfprintf.c,v 1.3 1999/11/21 09:37:05 fenner Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/vfprintf.c,v 1.4 2000/07/01 03:39:12 assar Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -31,11 +31,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <stdio.h>
-#if __STDC__
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <stdlib.h>
#include <unistd.h>
OpenPOWER on IntegriCloud