Import tcpdump 3.7.2 (fudging for multi-DLT support) from

http://www.tcpdump.org/release/tcpdump-3.7.2.tar.gz
This commit is contained in:
Bill Fenner 2003-03-02 08:22:26 +00:00
parent 0ccd7b511b
commit 9afd0c2902
51 changed files with 1007 additions and 907 deletions

View File

@ -1,4 +1,24 @@
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.81 2002/01/21 11:03:33 mcr Exp $
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.81.2.1 2003/02/26 07:08:58 fenner Exp $
Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release
Fixed infinite loop when parsing malformed isakmp packets.
(reported by iDefense; already fixed in CVS)
Fixed infinite loop when parsing malformed BGP packets.
Fixed buffer overflow with certain malformed NFS packets.
Pretty-print unprintable network names in 802.11 printer.
Handle truncated nbp (appletalk) packets.
Updated DHCPv6 printer to match draft-ietf-dhc-dhcpv6-22.txt
Print IP protocol name even if we don't have a printer for it.
Print IP protocol name or number for fragments.
Print the whole MPLS label stack, not just the top label.
Print request header and file handle for NFS v3 FSINFO and PATHCONF
requests.
Fix NFS packet truncation checks.
Handle "old" DR-Priority and Bidir-Capable PIM HELLO options.
Handle unknown RADIUS attributes properly.
Fix an ASN.1 parsing error that would cause e.g. the OID
2.100.3 to be misrepresented as 4.20.3 .
Monday, January 21, 2002. mcr@sandelman.ottawa.on.ca. Summary for 3.7 release
see http://www.tcpdump.org/cvs-log/2002-01-21.10:16:48.html for commit log.
@ -653,4 +673,4 @@ v2.0 Sun Jan 13 12:20:40 PST 1991
- Initial public release.
@(#) $Header: /tcpdump/master/tcpdump/CHANGES,v 1.81 2002/01/21 11:03:33 mcr Exp $ (LBL)
@(#) $Header: /tcpdump/master/tcpdump/CHANGES,v 1.81.2.1 2003/02/26 07:08:58 fenner Exp $ (LBL)

View File

@ -13,6 +13,7 @@ The current maintainers:
Additional people who have contributed patches:
Alfredo Andres <aandres@s21sec.com>
Andrew Hintz <adhintz@users.sourceforge.net>
Andrew Tridgell <tridge@linuxcare.com>
Arkadiusz Miskiewicz <misiek@pld.org.pl>
Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
@ -46,13 +47,14 @@ Additional people who have contributed patches:
Kazushi Sugyo <sugyo@pb.jp.nec.com>
Kelly Carmichael <kcarmich@ipapp.com>
Ken Hornstein <kenh@cmf.nrl.navy.mil>
Kevin Steves <stevesk@sweden.hp.com>
Kevin Steves <stevesk@pobox.com>
Klaus Klein <kleink@reziprozitaet.de>
Kris Kennaway <kris@freebsd.org>
Larry Lile <lile@stdio.com>
Lennert Buytenhek <buytenh@gnu.org>
Love Hörnquist-Åstrand <lha@stacken.kth.se>
Maciej W. Rozycki <macro@ds2.pg.gda.pl>
Marc A. Lehmann <pcg@goof.com>
Marko Kiiskila <carnil@cs.tut.fi>
Marshall Rose <mrose@dbc.mtview.ca.us>
Martin Husemann <martin@netbsd.org>
@ -72,11 +74,12 @@ Additional people who have contributed patches:
Peter Jeremy <peter.jeremy@alcatel.com.au>
Rafal Maszkowski <rzm@icm.edu.pl>
Rick Jones <raj@cup.hp.com>
Rick Watson <watsonrick@users.sourceforge.net>
Roderick Schertler <roderick@argon.org>
Sebastian Krahmer <krahmer@cs.uni-potsdam.de>
Seth Webster <swebster@sst.ll.mit.edu>
Timo Koskiahde
Tony Li <tli@jnx.com>
Tony Li <tli@procket.com>
Uns Lider <unslider@miranda.org>
Wilbert de Graaf <wilbertdg@hetnet.nl>

View File

@ -23,8 +23,6 @@ config.sub
configure
configure.in
decnet.h
dhcp6.h
dhcp6opt.h
esp.h
ether.h
ethertype.h

View File

@ -1,4 +1,4 @@
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.47 2000/12/16 09:07:45 guy Exp $ (LBL)
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.47.6.1 2002/07/16 04:41:57 guy Exp $ (LBL)
If you have not built libpcap, do so first. See the README
file in this directory for the ftp location.
@ -27,8 +27,8 @@ 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
with 2.0.25 and more modern, and 2.2.x kernels. It is guaranteed not
to work with 1.X kernels.
with 2.0.25 and more modern, and 2.2 and later, 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
@ -43,6 +43,7 @@ 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
LICENSE - the license under which tcpdump is distributed
Makefile.in - compilation rules (input to the configure script)
README - description of distribution
VERSION - version of this release
@ -50,32 +51,40 @@ acconfig.h - autoconf input
aclocal.m4 - autoconf macros
addrtoname.c - address to hostname routines
addrtoname.h - address to hostname definitions
ah.h - IPSEC Authentication Header definitions
appletalk.h - AppleTalk definitions
arcnet.h - ARCNET definitions
atime.awk - TCP ack awk script
bootp.h - BOOTP definitions
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
have them
chdlc.h - Cisco HDLC definitions
config.guess - autoconf support
config.h.in - autoconf input
config.sub - autoconf support
configure - configure script (run this first)
configure.in - configure script source
decnet.h - DECnet definitions
dhcp6.h - IPv6 DHCP definitions
dhcp6opt.h - IPv6 DHCP options
ethertype.h - ethernet definitions
esp.h - IPSEC Encapsulating Security Payload definitions
ether.h - Ethernet definitions
ethertype.h - Ethernet type value definitions
extract.h - alignment definitions
fddi.h - Fiber Distributed Data Interface definitions
gmt2local.c - time conversion routines
gmt2local.h - time conversion prototypes
icmp6.h - ICMPv6 definitiions
ieee802_11.h - IEEE 802.11 definitions
igrp.h - Interior Gateway Routing Protocol definitions
install-sh - BSD style install script
interface.h - globals, prototypes and definitions
ip.h - IP definitions
ip6.h - IPv6 definitions
ipsec_doi.h - ISAKMP packet definitions - RFC2407
ipx.h - IPX definitions
isakmp.h - ISAKMP packet definitions - RFC2408
l2tp.h -
lane.h -
lbl/gnuc.h - gcc macros and defines
lbl/os-*.h - os dependent defines and prototypes
l2tp.h - Layer Two Tunneling Protocol definitions
lane.h - ATM LANE definitions
lbl/os-*.h - OS-dependent defines and prototypes
llc.h - LLC definitions
machdep.c - machine dependent routines
machdep.h - machine dependent definitions
@ -94,14 +103,18 @@ ospf6.h - IPv6 Open Shortest Path First definitions
packetdat.awk - TCP chunk summary awk script
parsenfsfh.c - Network File System file parser routines
ppp.h - Point to Point Protocol definitions
print-802_11.c - IEEE 802.11 printer routines
print-ah.c - IPSEC Authentication Header printer routines
print-arcnet.c - ARCNET printer routines
print-arp.c - Address Resolution Protocol printer routines
print-ascii.c - ASCII packet dump routines
print-atalk.c - AppleTalk printer routines
print-atm.c - atm printer routines
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-beep.c - BEEP printer routines
print-cdp.c - Cisco Discovery Protocol printer routines
print-chdlc.c - Cisco HDLC printer routines
print-cip.c - Classical-IP over ATM routines
print-cnfp.c - Cisco NetFlow printer routines
print-decnet.c - DECnet printer routines
@ -110,65 +123,84 @@ print-domain.c - Domain Name System printer routines
print-dvmrp.c - Distance Vector Multicast Routing Protocol printer routines
print-egp.c - External Gateway Protocol printer routines
print-esp.c - IPSEC Encapsulating Security Payload printer routines
print-ether.c - ethernet printer routines
print-ether.c - Ethernet printer routines
print-fddi.c - Fiber Distributed Data Interface printer routines
print-frag6.c - IPv6 fragmentation header printer routines
print-gre.c - Generic Routing Encapsulation printer routines
print-hsrp.c - Cisco Hot Standby Router Protocol printer routines
print-icmp.c - Internet Control Message Protocol printer routines
print-icmp6.c - IPv6 Internet Control Message Protocol printer routines
print-igmp.c - Internet Group Management Protocol printer routines
print-igrp.c - Interior Gateway Routing Protocol printer routines
print-ip.c - ip printer routines
print-ip.c - IP printer routines
print-ip6.c - IPv6 printer routines
print-ip6opts.c - IPv6 header option printer routines
print-ipcomp.c - IP Payload Compression Protocol printer routines
print-ipx.c - IPX printer routines
print-isakmp.c - Internet Security Association and Key Management Protocol
print-isoclns.c - isoclns printer routines
print-isoclns.c - ISO CLNS, ESIS, and ISIS printer routines
print-krb.c - Kerberos printer routines
print-l2tp.c - Layer Two Tunneling Protocol printer routines
print-lane.c -
print-lcp.c -
print-llc.c - llc printer routines
print-lane.c - ATM LANE printer routines
print-lcp.c - PPP Link Control Protocol printer routines
print-llc.c - IEEE 802.2 LLC printer routines
print-lwres.c - Lightweight Resolver protocol printer routines
print-mobile.c - IPv4 mobility printer routines
print-netbios.c - netbios printer routines
print-mpls.c - Multi-Protocol Label Switching printer routines
print-msdp.c - Multicast Source Discovery Protocol printer routines
print-netbios.c - NetBIOS frame protocol printer routines
print-nfs.c - Network File System printer routines
print-ntp.c - Network Time Protocol printer routines
print-null.c - null printer routines
print-null.c - BSD loopback device printer routines
print-ospf.c - Open Shortest Path First printer routines
print-ospf6.c - IPv6 Open Shortest Path First printer routines
print-pim.c - Protocol Independent Multicast printer routines
print-ppp.c - Point to Point Protocol printer routines
print-pppoe.c -
print-raw.c - raw printer routines
print-pppoe.c - PPP-over-Ethernet printer routines
print-pptp.c - Point-to-Point Tunnelling Protocol printer routines
print-radius.c - Radius protocol printer routines
print-raw.c - Raw IP printer routines
print-rip.c - Routing Information Protocol printer routines
print-ripng.c - IPv6 Routing Information Protocol printer routines
print-rt6.c - IPv6 routing header printer routines
print-rx.c - AFS RX printer routines
print-sctp.c - Stream Control Transmission Protocol printer routines
print-sl.c - Compressed Serial Line Internet Protocol printer routines
print-smb.c - SMB (samba) printer routines
print-sll.c - Linux "cooked" capture printer routines
print-smb.c - SMB/CIFS printer routines
print-snmp.c - Simple Network Management Protocol printer routines
print-stp.c - IEEE 802.1d spanning tree protocol printer routines
print-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-timed.c - BSD time daemon 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-vjc.c - PPP Van Jacobson compression (RFC1144) printer routines
print-vrrp.c - Virtual Router Redundancy Protocol
print-wb.c - white board printer routines
print-wb.c - White Board printer routines
print-zephyr.c - Zephyr printer routines
route6d.h - packet definition for IPv6 Routing Information Protocol
rx.h -
savestr.c - strdup() replacement
savestr.h - savestr prototypes
rx.h - AFS RX definitions
sctpConstants.h - Stream Control Transmission Protocol constant definitions
sctpHeader.h - Stream Control Transmission Protocol packet definitions
send-ack.awk - unidirectional tcp send/ack awk script
setsignal.c - os independent signal routines
setsignal.h - os independent signal prototypes
smb.h -
smbutil.c -
setsignal.c - OS-independent signal routines
setsignal.h - OS-independent signal prototypes
slcompress.h - SLIP/PPP Van Jacobson compression (RFC1144) definitions
slip.h - SLIP definitions
sll.h - Linux "cooked" capture definitions
smb.h - SMB/CIFS definitions
smbutil.c - SMB/CIFS utility routines
stime.awk - TCP send awk script
strcasecmp.c - missing routine
tcp.h - TCP definitions
tcpdump.1 - manual entry
tcpdump.c - main program
telnet.h - Telnet definitions
timed.h - BSD time daemon protocol definitions
token.h - Token Ring definitions
udp.h - UDP definitions
util.c - utility routines
vfprintf.c - emulation routine

View File

@ -1,18 +1,18 @@
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.60 2002/01/21 11:16:33 mcr Exp $ (LBL)
@(#) $Header: /tcpdump/master/tcpdump/README,v 1.60.2.3 2003/02/26 07:08:58 fenner Exp $ (LBL)
TCPDUMP 3.7.1
TCPDUMP 3.7.2
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
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master login
(password "anoncvs")
cvs -d cvs.tcpdump.org:/tcpdump/master checkout tcpdump
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout tcpdump
Version 3.7.1 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_7rel1":
cvs -d cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_7rel1 tcpdump
Version 3.7.2 of TCPDUMP can be retrived with the CVS tag "tcpdump_3_7rel2":
cvs -d :pserver:cvs.tcpdump.org:/tcpdump/master checkout -r tcpdump_3_7rel2 tcpdump
Please send patches against the master copy to patches@tcpdump.org.
@ -66,13 +66,19 @@ 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, etc.
should be sent to the address "tcpdump-workers@tcpdump.org".
Problems, bugs, questions, desirable enhancements, etc. should be sent
to the address "tcpdump-workers@tcpdump.org". Bugs, support requests,
and feature requests may also be submitted on the SourceForge site for
tcpdump at
Source code contributions, etc. should be sent to the email address
"patches@tcpdump.org".
http://sourceforge.net/projects/tcpdump/
Current versions can be found at www.tcpdump.org
Source code contributions, etc. should be sent to the email address
"patches@tcpdump.org", or submitted as patches on the SourceForge site
for tcpdump.
Current versions can be found at www.tcpdump.org, or the SourceForge
site for tcpdump.
- The TCPdump team

View File

@ -1 +1 @@
3.7.1+multidlt
3.7.2+multidlt

View File

@ -1,4 +1,4 @@
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.80 2001/12/10 08:41:15 guy Exp $ (LBL)
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.80.2.4 2002/07/13 09:38:53 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1995, 1996, 1997, 1998
dnl The Regents of the University of California. All rights reserved.
@ -157,6 +157,51 @@ AC_DEFUN(AC_LBL_C_INIT,
fi
])
#
# Try compiling a sample of the type of code that appears in
# gencode.c with "inline", "__inline__", and "__inline".
#
# Autoconf's AC_C_INLINE, at least in autoconf 2.13, isn't good enough,
# as it just tests whether a function returning "int" can be inlined;
# at least some versions of HP's C compiler can inline that, but can't
# inline a function that returns a struct pointer.
#
AC_DEFUN(AC_LBL_C_INLINE,
[AC_MSG_CHECKING(for inline)
AC_CACHE_VAL(ac_cv_lbl_inline, [
ac_cv_lbl_inline=""
ac_lbl_cc_inline=no
for ac_lbl_inline in inline __inline__ __inline
do
AC_TRY_COMPILE(
[#define inline $ac_lbl_inline
static inline struct iltest *foo(void);
struct iltest {
int iltest1;
int iltest2;
};
static inline struct iltest *
foo()
{
static struct iltest xxx;
return &xxx;
}],,ac_lbl_cc_inline=yes,)
if test "$ac_lbl_cc_inline" = yes ; then
break;
fi
done
if test "$ac_lbl_cc_inline" = yes ; then
ac_cv_lbl_inline=$ac_lbl_inline
fi])
if test ! -z "$ac_cv_lbl_inline" ; then
AC_MSG_RESULT($ac_cv_lbl_inline)
else
AC_MSG_RESULT(no)
fi
AC_DEFINE_UNQUOTED(inline, $ac_cv_lbl_inline, [Define as token for inline if inlining supported])])
dnl
dnl Use pfopen.c if available and pfopen() not in standard libraries
dnl Require libpcap

View File

@ -23,7 +23,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.83 2001/09/17 21:57:50 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.83.4.1 2002/06/02 00:08:07 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -34,14 +34,16 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <sys/time.h>
struct mbuf;
struct rtentry;
#include <net/if.h>
#include <netinet/in.h>
#ifdef USE_ETHER_NTOHOST
#ifdef HAVE_NETINET_IF_ETHER_H
struct mbuf; /* Squelch compiler warnings on some platforms for */
struct rtentry; /* declarations in <net/if.h> */
#include <net/if.h> /* for "struct ifnet" in "struct arpcom" on Solaris */
#include <netinet/if_ether.h>
#endif
#endif /* HAVE_NETINET_IF_ETHER_H */
#endif /* USE_ETHER_NTOHOST */
#include <arpa/inet.h>

View File

@ -5,9 +5,6 @@
/* Define to empty if the keyword does not work. */
#undef const
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
@ -189,6 +186,9 @@
/* Define if you have the smi library (-lsmi). */
#undef HAVE_LIBSMI
/* Define as token for inline if inlining supported */
#undef inline
/* define if your compiler has __attribute__ */
#undef HAVE___ATTRIBUTE__

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.145 2002/01/17 05:00:16 guy Exp $ (LBL)
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.145.2.1 2002/06/28 10:48:31 guy Exp $ (LBL)
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
@ -6,14 +6,14 @@ dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_REVISION($Revision: 1.145 $)
AC_REVISION($Revision: 1.145.2.1 $)
AC_PREREQ(2.13)
AC_INIT(tcpdump.c)
AC_CANONICAL_HOST
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_C_INLINE
AC_LBL_C_INLINE
AC_C___ATTRIBUTE__
AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netinet/if_ether.h)

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.4 2000/07/11 00:49:02 assar Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/gmt2local.c,v 1.4.6.1 2002/06/01 23:43:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -29,12 +29,9 @@ static const char rcsid[] =
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#ifdef HAVE_OS_PROTO_H
#include "os-proto.h"

View File

@ -18,7 +18,7 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.178 2002/01/21 11:39:58 mcr Exp $ (LBL)
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.178.4.2 2002/07/10 07:32:17 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@ -81,8 +81,6 @@ extern int xflag; /* print packet in hex */
extern int Xflag; /* print packet in hex/ascii */
extern char *espsecret;
extern struct esp_algorithm *espsecret_xform; /* cache of decoded alg. */
extern char *espsecret_key;
extern int packettype; /* as specified by -T */
#define PT_VAT 1 /* Visual Audio Tool */
@ -135,8 +133,16 @@ extern int snaplen;
extern const u_char *packetp;
extern const u_char *snapend;
/* True if "l" bytes of "var" were captured */
#define TTEST2(var, l) ((const u_char *)&(var) <= snapend - (l))
/*
* True if "l" bytes of "var" were captured.
*
* The "snapend - (l) <= snapend" checks to make sure "l" isn't so large
* that "snapend - (l)" underflows.
*
* The check is for <= rather than < because "l" might be 0.
*/
#define TTEST2(var, l) (snapend - (l) <= snapend && \
(const u_char *)&(var) <= snapend - (l))
/* True if "var" was captured */
#define TTEST(var) TTEST2(var, sizeof(var))

View File

@ -22,7 +22,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.6 2001/09/17 21:57:53 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.6.4.1 2002/05/13 08:34:50 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -47,11 +47,16 @@ static const char rcsid[] =
#include "ieee802_11.h"
#define RATEStoBUF(p, buf) \
#define PRINT_RATES(p) \
do { \
int z = 0; \
for (z = 0 ; z < p.rates.length ; z++) \
snprintf(buf, sizeof(buf), "%s %2.1f", buf, (.5 * (p.rates.rate[z] & 0x7f))); \
int z; \
char *sep = " ["; \
for (z = 0; z < p.rates.length ; z++) { \
printf("%s%2.1f", sep, (.5 * (p.rates.rate[z] & 0x7f))); \
sep = " "; \
} \
if (p.rates.length != 0) \
printf(" Mbit]"); \
} while (0)
static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
@ -131,9 +136,7 @@ static int parse_elements(struct mgmt_body_t *pbody,const u_char *p,int offset)
{
for (;;) {
if (!TTEST2(*(p + offset), 1))
return 0;
if (*(p + offset) == 0xff)
break;
return 1;
switch (*(p + offset)) {
case E_SSID:
if (!TTEST2(*(p+offset), 2))
@ -216,9 +219,7 @@ static int handle_beacon(u_int16_t fc, const struct mgmt_header_t *pmh,
{
struct mgmt_body_t pbody;
int offset = 0;
char buf[128];
memset(buf, 0, sizeof(buf));
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, 12))
@ -233,10 +234,11 @@ static int handle_beacon(u_int16_t fc, const struct mgmt_header_t *pmh,
if (!parse_elements(&pbody,p,offset))
return 0;
RATEStoBUF(pbody, buf);
printf("%s (%s) [%s Mbit] %s CH: %x %s",
subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid, buf,
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
fn_print(pbody.ssid.ssid, NULL);
printf(")");
PRINT_RATES(pbody);
printf(" %s CH: %u %s",
CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS",
pbody.ds.channel,
CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
@ -249,9 +251,7 @@ static int handle_assoc_request(u_int16_t fc, const struct mgmt_header_t *pmh,
{
struct mgmt_body_t pbody;
int offset = 0;
char buf[128];
memset(buf, 0, sizeof(buf));
memset(&pbody, 0, sizeof(pbody));
if (!TTEST2(*p, 4))
@ -264,10 +264,10 @@ static int handle_assoc_request(u_int16_t fc, const struct mgmt_header_t *pmh,
if (!parse_elements(&pbody,p,offset))
return 0;
RATEStoBUF(pbody,buf);
printf("%s (%s) [%s Mbit] ",
subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid,buf);
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
fn_print(pbody.ssid.ssid, NULL);
printf(")");
PRINT_RATES(pbody);
return 1;
}
@ -291,7 +291,7 @@ static int handle_assoc_response(u_int16_t fc, const struct mgmt_header_t *pmh,
if (!parse_elements(&pbody,p,offset))
return 0;
printf("%s AID(%x) :%s: %s ", subtype_text[FC_SUBTYPE(fc)],
printf("%s AID(%x) :%s: %s", subtype_text[FC_SUBTYPE(fc)],
((u_int16_t)(pbody.aid << 2 )) >> 2 ,
CAPABILITY_PRIVACY(pbody.capability_info) ? " PRIVACY " : "",
(pbody.status_code < 19 ? status_text[pbody.status_code] : "n/a"));
@ -320,7 +320,9 @@ static int handle_reassoc_request(u_int16_t fc, const struct mgmt_header_t *pmh,
if (!parse_elements(&pbody,p,offset))
return 0;
printf("%s (%s) AP : %s",subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid, etheraddr_string( pbody.ap ));
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
fn_print(pbody.ssid.ssid, NULL);
printf(") AP : %s", etheraddr_string( pbody.ap ));
return 1;
}
@ -337,19 +339,16 @@ static int handle_probe_request(u_int16_t fc, const struct mgmt_header_t *pmh,
{
struct mgmt_body_t pbody;
int offset = 0;
char buf[128];
memset(buf, 0, sizeof(buf));
memset(&pbody, 0, sizeof(pbody));
if (!parse_elements(&pbody, p, offset))
return 0;
RATEStoBUF(pbody, buf);
printf("%s (%s) [%s Mbit] ", subtype_text[FC_SUBTYPE(fc)],
pbody.ssid.ssid,buf);
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
fn_print(pbody.ssid.ssid, NULL);
printf(")");
PRINT_RATES(pbody);
return 1;
}
@ -359,9 +358,6 @@ static int handle_probe_response(u_int16_t fc, const struct mgmt_header_t *pmh,
{
struct mgmt_body_t pbody;
int offset = 0;
char buf[128];
memset(buf, 0, sizeof(buf));
memset(&pbody, 0, sizeof(pbody));
@ -377,8 +373,12 @@ static int handle_probe_response(u_int16_t fc, const struct mgmt_header_t *pmh,
if (!parse_elements(&pbody, p, offset))
return 0;
printf("%s (%s) CH: %x %s", subtype_text[FC_SUBTYPE(fc)], pbody.ssid.ssid,pbody.ds.channel,
CAPABILITY_PRIVACY(pbody.capability_info) ? ",PRIVACY " : "" );
printf("%s (", subtype_text[FC_SUBTYPE(fc)]);
fn_print(pbody.ssid.ssid, NULL);
printf(") ");
PRINT_RATES(pbody);
printf(" CH: %u%s", pbody.ds.channel,
CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
return 1;
}
@ -404,7 +404,7 @@ static int handle_disassoc(u_int16_t fc, const struct mgmt_header_t *pmh,
pbody.reason_code = EXTRACT_LE_16BITS(p);
offset += 2;
printf("%s: %s ", subtype_text[FC_SUBTYPE(fc)],
printf("%s: %s", subtype_text[FC_SUBTYPE(fc)],
pbody.reason_code < 10 ? reason_text[pbody.reason_code] : "Reserved" );
return 1;

View File

@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.6 2001/09/17 21:57:54 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-arcnet.c,v 1.6.4.1 2002/06/01 23:51:11 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -33,9 +33,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.51 2001/09/17 21:57:54 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-arp.c,v 1.51.4.2 2002/07/10 07:09:53 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -52,7 +52,7 @@ static const char rcsid[] =
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
struct arp_pkthdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
@ -80,10 +80,10 @@ struct arphdr {
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
#define ar_sha(ap) (((const caddr_t)((ap)+1))+0)
#define ar_spa(ap) (((const caddr_t)((ap)+1))+ (ap)->ar_hln)
#define ar_tha(ap) (((const caddr_t)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
#define ar_tpa(ap) (((const caddr_t)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
#define ar_sha(ap) (((const u_char *)((ap)+1))+0)
#define ar_spa(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln)
#define ar_tha(ap) (((const u_char *)((ap)+1))+ (ap)->ar_hln+(ap)->ar_pln)
#define ar_tpa(ap) (((const u_char *)((ap)+1))+2*(ap)->ar_hln+(ap)->ar_pln)
};
#define ARP_HDRLEN 8
@ -103,10 +103,10 @@ static u_char ezero[6];
void
arp_print(const u_char *bp, u_int length, u_int caplen)
{
const struct arphdr *ap;
const struct arp_pkthdr *ap;
u_short pro, hrd, op;
ap = (const struct arphdr *)bp;
ap = (const struct arp_pkthdr *)bp;
TCHECK(*ap);
if ((const u_char *)(ar_tpa(ap) + PLN(ap)) > snapend) {
(void)printf("truncated-arp");

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.70 2001/11/15 08:23:12 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.70.2.1 2002/02/05 10:04:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -112,6 +112,14 @@ llap_print(register const u_char *bp, u_int length)
register const struct atShortDDP *sdp;
u_short snet;
/*
* Our packet is on a 4-byte boundary, as we're either called
* directly from a top-level link-layer printer (ltalk_if_print)
* or from the UDP printer. The LLAP+DDP header is a multiple
* of 4 bytes in length, so the DDP payload is also on a 4-byte
* boundary, and we don't need to align it before calling
* "ddp_print()".
*/
lp = (const struct LAP *)bp;
bp += sizeof(*lp);
length -= sizeof(*lp);
@ -394,6 +402,11 @@ nbp_print(register const struct atNBP *np, u_int length, register u_short snet,
int i;
const u_char *ep;
if (length < nbpHeaderSize) {
(void)printf(" truncated-nbp %d", length);
return;
}
length -= nbpHeaderSize;
if (length < 8) {
/* must be room for at least one tuple */

View File

@ -11,7 +11,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.1 2001/12/10 08:21:24 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-beep.c,v 1.1.2.1 2002/07/11 07:47:01 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -54,19 +54,19 @@ void
beep_print(const u_char *bp, u_int length)
{
if (l_strnstart("MSG", 4, bp, length)) /* A REQuest */
if (l_strnstart("MSG", 4, (const char *)bp, length)) /* A REQuest */
printf(" BEEP MSG");
else if (l_strnstart("RPY ", 4, bp, length))
else if (l_strnstart("RPY ", 4, (const char *)bp, length))
printf(" BEEP RPY");
else if (l_strnstart("ERR ", 4, bp, length))
else if (l_strnstart("ERR ", 4, (const char *)bp, length))
printf(" BEEP ERR");
else if (l_strnstart("ANS ", 4, bp, length))
else if (l_strnstart("ANS ", 4, (const char *)bp, length))
printf(" BEEP ANS");
else if (l_strnstart("NUL ", 4, bp, length))
else if (l_strnstart("NUL ", 4, (const char *)bp, length))
printf(" BEEP NUL");
else if (l_strnstart("SEQ ", 4, bp, length))
else if (l_strnstart("SEQ ", 4, (const char *)bp, length))
printf(" BEEP SEQ");
else if (l_strnstart("END", 4, bp, length))
else if (l_strnstart("END", 4, (const char *)bp, length))
printf(" BEEP END");
else
printf(" BEEP (payload or undecoded)");

View File

@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.27 2001/10/18 09:52:17 itojun Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.27.2.1 2003/02/26 05:51:56 fenner Exp $";
#endif
#include <sys/param.h>
@ -469,11 +469,19 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
switch (af) {
case AFNUM_INET:
advance = decode_prefix4(p, buf, sizeof(buf));
if (advance < 0) {
p = dat + len;
break;
}
printf(" %s", buf);
break;
#ifdef INET6
case AFNUM_INET6:
advance = decode_prefix6(p, buf, sizeof(buf));
if (advance < 0) {
p = dat + len;
break;
}
printf(" %s", buf);
break;
#endif
@ -505,11 +513,19 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *dat, int len)
switch (af) {
case AFNUM_INET:
advance = decode_prefix4(p, buf, sizeof(buf));
if (advance < 0) {
p = dat + len;
break;
}
printf(" %s", buf);
break;
#ifdef INET6
case AFNUM_INET6:
advance = decode_prefix6(p, buf, sizeof(buf));
if (advance < 0) {
p = dat + len;
break;
}
printf(" %s", buf);
break;
#endif
@ -598,6 +614,7 @@ bgp_update_print(const u_char *dat, int length)
printf(" (Withdrawn routes: %d bytes)", len);
#else
char buf[MAXHOSTNAMELEN + 100];
int wpfx;
TCHECK2(p[2], len);
i = 2;
@ -605,7 +622,10 @@ bgp_update_print(const u_char *dat, int length)
printf(" (Withdrawn routes:");
while(i < 2 + len) {
i += decode_prefix4(&p[i], buf, sizeof(buf));
wpfx = decode_prefix4(&p[i], buf, sizeof(buf));
if (wpfx < 0)
break;
i += wpfx;
printf(" %s", buf);
}
printf(")\n");
@ -666,9 +686,9 @@ bgp_update_print(const u_char *dat, int length)
while (dat + length > p) {
char buf[MAXHOSTNAMELEN + 100];
i = decode_prefix4(p, buf, sizeof(buf));
printf(" %s", buf);
if (i < 0)
break;
printf(" %s", buf);
p += i;
}

View File

@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60 2001/09/17 21:57:56 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.60.4.2 2002/06/01 23:51:11 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -33,9 +33,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <ctype.h>
@ -349,13 +346,14 @@ static struct tok arp2str[] = {
static void
rfc1048_print(register const u_char *bp)
{
register u_char tag;
register u_int16_t tag;
register u_int len, size;
register const char *cp;
register char c;
int first;
u_int32_t ul;
u_short us;
u_int16_t us;
u_int8_t uc;
printf(" vend-rfc1048");
@ -376,9 +374,9 @@ rfc1048_print(register const u_char *bp)
* preclude overlap of 1-byte and 2-byte spaces.
* If not, we need to offset tag after this step.
*/
cp = tok2str(xtag2str, "?xT%d", tag);
cp = tok2str(xtag2str, "?xT%u", tag);
} else
cp = tok2str(tag2str, "?T%d", tag);
cp = tok2str(tag2str, "?T%u", tag);
c = *cp++;
printf(" %s:", cp);
@ -394,8 +392,8 @@ rfc1048_print(register const u_char *bp)
}
if (tag == TAG_DHCP_MESSAGE && len == 1) {
c = *bp++;
switch (c) {
uc = *bp++;
switch (uc) {
case DHCPDISCOVER: printf("DISCOVER"); break;
case DHCPOFFER: printf("OFFER"); break;
case DHCPREQUEST: printf("REQUEST"); break;
@ -404,7 +402,7 @@ rfc1048_print(register const u_char *bp)
case DHCPNAK: printf("NACK"); break;
case DHCPRELEASE: printf("RELEASE"); break;
case DHCPINFORM: printf("INFORM"); break;
default: printf("%u", c); break;
default: printf("%u", uc); break;
}
continue;
}
@ -412,8 +410,8 @@ rfc1048_print(register const u_char *bp)
if (tag == TAG_PARM_REQUEST) {
first = 1;
while (len-- > 0) {
c = *bp++;
cp = tok2str(tag2str, "?T%d", c);
uc = *bp++;
cp = tok2str(tag2str, "?T%u", uc);
if (!first)
putchar('+');
printf("%s", cp + 1);
@ -425,9 +423,9 @@ rfc1048_print(register const u_char *bp)
first = 1;
while (len > 1) {
len -= 2;
c = EXTRACT_16BITS(bp);
us = EXTRACT_16BITS(bp);
bp += 2;
cp = tok2str(xtag2str, "?xT%d", c);
cp = tok2str(xtag2str, "?xT%u", us);
if (!first)
putchar('+');
printf("%s", cp + 1);
@ -502,7 +500,7 @@ rfc1048_print(register const u_char *bp)
if (!first)
putchar(',');
us = EXTRACT_16BITS(bp);
printf("%d", us);
printf("%u", us);
bp += sizeof(us);
size -= sizeof(us);
first = 0;
@ -522,7 +520,7 @@ rfc1048_print(register const u_char *bp)
putchar('Y');
break;
default:
printf("%d?", *bp);
printf("%u?", *bp);
break;
}
++bp;
@ -541,7 +539,7 @@ rfc1048_print(register const u_char *bp)
if (c == 'x')
printf("%02x", *bp);
else
printf("%d", *bp);
printf("%u", *bp);
++bp;
--size;
first = 0;
@ -568,7 +566,7 @@ rfc1048_print(register const u_char *bp)
if (*bp++)
printf("[svrreg]");
if (*bp)
printf("%d/%d/", *bp, *(bp+1));
printf("%u/%u/", *bp, *(bp+1));
bp += 2;
putchar('"');
(void)fn_printn(bp, size - 3, NULL);
@ -600,7 +598,7 @@ rfc1048_print(register const u_char *bp)
}
default:
printf("[unknown special tag %d, size %d]",
printf("[unknown special tag %u, size %u]",
tag, size);
bp += size;
size = 0;
@ -610,7 +608,7 @@ rfc1048_print(register const u_char *bp)
}
/* Data left over? */
if (size)
printf("[len %d]", len);
printf("[len %u]", len);
}
return;
trunc:

View File

@ -26,10 +26,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* draft-ietf-dhc-dhcpv6-22.txt
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.14 2001/09/17 21:57:59 fenner Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.14.4.2 2002/06/01 23:51:12 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -40,9 +43,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <ctype.h>
@ -52,172 +52,125 @@ struct rtentry;
#include "interface.h"
#include "addrtoname.h"
#include "dhcp6.h"
#include "dhcp6opt.h"
#if 0
static void dhcp6opttab_init(void);
static struct dhcp6_opt *dhcp6opttab_byname(char *);
#endif
static struct dhcp6_opt *dhcp6opttab_bycode(u_int);
/* Error Values */
#define DH6ERR_FAILURE 16
#define DH6ERR_AUTHFAIL 17
#define DH6ERR_POORLYFORMED 18
#define DH6ERR_UNAVAIL 19
#define DH6ERR_OPTUNAVAIL 20
static const char tstr[] = " [|dhcp6]";
/* Message type */
#define DH6_REPLY 7
#define DH6_INFORM_REQ 11
static struct dhcp6_opt dh6opttab[] = {
/* IP Address Extension */
{ 1, OL6_N, "IP Address", OT6_NONE, },
/* DHCP6 base packet format */
struct dhcp6 {
union {
u_int8_t m;
u_int32_t x;
} dh6_msgtypexid;
struct in6_addr dh6_servaddr;
/* options follow */
} __attribute__ ((__packed__));
#define dh6_msgtype dh6_msgtypexid.m
#define dh6_xid dh6_msgtypexid.x
#define DH6_XIDMASK 0x00ffffff
/* General Extension */
{ 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 */
{ 8203, 4, "TCP Keepalive Interval", OT6_NUM, },
/* DHCPv6 Extensions */
{ 8204, 4, "Maximum DHCPv6 Message Size", OT6_NUM, },
{ 8205, OL6_N, "DHCP Retransmission and Configuration Parameter",
OT6_NONE, },
{ 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, },
{ 8213, OL6_N, "Client-Server Authentication", OT6_NONE, },
{ 8214, 4, "Client Key Selection", OT6_NUM, },
/* End Extension */
{ 65536, OL6_Z, "End", OT6_NONE, },
{ 0 },
};
#if 0
static struct dhcp6_opt *dh6o_pad;
static struct dhcp6_opt *dh6o_end;
/* option */
#define DH6OPT_DUID 1 /* TBD */
#define DH6OPT_DNS 11 /* TBD */
struct dhcp6opt {
u_int16_t dh6opt_type;
u_int16_t dh6opt_len;
/* type-dependent data follows */
} __attribute__ ((__packed__));
static void
dhcp6opttab_init()
dhcp6opt_print(u_char *cp, u_char *ep)
{
dh6o_pad = dhcp6opttab_bycode(0);
dh6o_end = dhcp6opttab_bycode(65536);
}
#endif
#if 0
static struct dhcp6_opt *
dhcp6opttab_byname(name)
char *name;
{
struct dhcp6_opt *p;
for (p = dh6opttab; p->code; p++)
if (strcmp(name, p->name) == 0)
return p;
return NULL;
}
#endif
static struct dhcp6_opt *
dhcp6opttab_bycode(code)
u_int code;
{
struct dhcp6_opt *p;
for (p = dh6opttab; p->code; p++)
if (p->code == code)
return p;
return NULL;
}
static void
dhcp6ext_print(u_char *cp, u_char *ep)
{
u_int16_t code, len;
struct dhcp6_opt *p;
char buf[BUFSIZ];
struct dhcp6opt *dh6o;
u_char *tp;
int i;
size_t optlen;
if (cp == ep)
return;
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);
cp += len + 4;
continue;
}
/* sanity check on length */
switch (p->len) {
case OL6_N:
break;
case OL6_16N:
if (len % 16 != 0)
goto trunc;
break;
case OL6_Z:
if (len != 0)
goto trunc;
break;
default:
if (len != p->len)
goto trunc;
break;
}
if (cp + 4 + len > ep) {
printf(" [|%s]", p->name);
return;
}
printf(" (%s, ", p->name);
switch (p->type) {
case OT6_V6:
for (i = 0; i < len; i += 16) {
inet_ntop(AF_INET6, &cp[4 + i], buf,
sizeof(buf));
if (i != 0)
printf(",");
printf("%s", buf);
if (ep - cp < sizeof(*dh6o))
goto trunc;
dh6o = (struct dhcp6opt *)cp;
optlen = ntohs(dh6o->dh6opt_len);
if (ep - cp < sizeof(*dh6o) + optlen)
goto trunc;
switch (ntohs(dh6o->dh6opt_type)) {
case DH6OPT_DUID:
printf(" (duid"); /*)*/
if (optlen < 2) {
/*(*/
printf(" ??)");
break;
}
tp = (u_char *)(dh6o + 1);
switch (ntohs(*(u_int16_t *)tp)) {
case 1:
if (optlen >= 2 + 6) {
printf(" hwaddr/time time %u type %u ",
ntohl(*(u_int32_t *)&tp[2]),
ntohs(*(u_int16_t *)&tp[6]));
for (i = 8; i < optlen; i++)
printf("%02x", tp[i]);
/*(*/
printf(")");
} else {
/*(*/
printf(" ??)");
}
break;
case 2:
if (optlen >= 2 + 8) {
printf(" vid ");
for (i = 2; i < 2 + 8; i++)
printf("%02x", tp[i]);
/*(*/
printf(")");
} else {
/*(*/
printf(" ??)");
}
break;
case 3:
if (optlen >= 2 + 2) {
printf(" hwaddr type %u ",
ntohs(*(u_int16_t *)&tp[2]));
for (i = 4; i < optlen; i++)
printf("%02x", tp[i]);
/*(*/
printf(")");
} else {
/*(*/
printf(" ??)");
}
}
break;
case OT6_STR:
memset(&buf, 0, sizeof(buf));
strncpy(buf, &cp[4], len);
printf("%s", buf);
break;
case OT6_NUM:
printf("%d", (u_int32_t)ntohl(*(u_int32_t *)&cp[4]));
break;
case DH6OPT_DNS:
printf(" (dnsserver"); /*)*/
if (optlen % 16) {
/*(*/
printf(" ??)");
break;
}
tp = (u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 16)
printf(" %s", ip6addr_string(&tp[i]));
/*(*/
printf(")");
default:
for (i = 0; i < len; i++)
printf("%02x", cp[4 + i] & 0xff);
printf(" (opt-%u)", ntohs(dh6o->dh6opt_type));
break;
}
printf(")");
cp += len + 4;
cp += sizeof(*dh6o) + optlen;
}
return;
@ -226,128 +179,57 @@ dhcp6ext_print(u_char *cp, u_char *ep)
}
/*
* Print dhcp6 requests
* Print dhcp6 packets
*/
void
dhcp6_print(register const u_char *cp, u_int length,
u_int16_t sport, u_int16_t dport)
{
union dhcp6 *dh6;
struct dhcp6 *dh6;
u_char *ep;
u_char *extp;
u_int16_t field16;
const char *name;
printf("dhcp6");
ep = (u_char *)snapend;
dh6 = (union dhcp6 *)cp;
TCHECK(dh6->dh6_msgtype);
dh6 = (struct dhcp6 *)cp;
TCHECK(dh6->dh6_servaddr);
switch (dh6->dh6_msgtype) {
case DH6_SOLICIT:
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 ("); /*)*/
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",
ip6addr_string(&dh6->dh6_adv.dh6adv_relayaddr));
printf(" servaddr=%s",
ip6addr_string(&dh6->dh6_adv.dh6adv_serveraddr));
extp = (u_char *)((&dh6->dh6_adv) + 1);
dhcp6ext_print(extp, ep);
/*(*/
printf(")");
break;
case DH6_REQUEST:
if (!(vflag && TTEST(dh6->dh6_req.dh6req_relayaddr))) {
printf(" request");
break;
}
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));
printf(" relayaddr=%s",
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:
if (!(vflag && TTEST(dh6->dh6_rep.dh6rep_xid))) {
printf(" reply");
break;
}
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_RELAYPRESENT) !=
0) {
printf(" relayaddr=%s", ip6addr_string(extp));
extp += sizeof(struct in6_addr);
}
dhcp6ext_print(extp, ep);
/*(*/
printf(")");
name = "reply";
break;
case DH6_RELEASE:
printf(" release");
case DH6_INFORM_REQ:
name= "inf-req";
break;
case DH6_RECONFIG:
printf(" reconfig");
default:
name = NULL;
break;
}
if (!vflag) {
if (name)
printf(" %s", name);
else
printf(" msgtype-%u", dh6->dh6_msgtype);
return;
}
/* XXX relay agent messages have to be handled differently */
if (name)
printf(" %s (", name); /*)*/
else
printf(" msgtype-%u (", dh6->dh6_msgtype); /*)*/
printf("xid=%x", ntohl(dh6->dh6_xid) & DH6_XIDMASK);
printf(" server=%s", ip6addr_string(&dh6->dh6_servaddr));
extp = (u_char *)(dh6 + 1);
dhcp6opt_print(extp, ep);
/*(*/
printf(")");
return;
trunc:
printf("%s", tstr);
printf("[|dhcp6]");
}

View File

@ -20,7 +20,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.28 2001/09/17 21:58:01 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.28.4.1 2002/06/01 23:51:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -29,7 +29,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.20 2002/01/21 11:39:59 mcr Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.20.4.2 2002/02/22 09:26:27 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -35,6 +35,7 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
@ -50,7 +51,6 @@ static const char rcsid[] =
#endif
#include <stdio.h>
#include <unistd.h>
#include "ip.h"
#include "esp.h"
@ -120,7 +120,7 @@ static int hex2byte(char *hexstring)
}
void esp_print_decodesecret()
static void esp_print_decodesecret(void)
{
char *colon;
int len, i;
@ -359,8 +359,8 @@ esp_print(register const u_char *bp, register const u_char *bp2,
des_check_key = 1;
des_set_odd_parity((void *)secret);
des_set_odd_parity((void *)secret+8);
des_set_odd_parity((void *)secret+16);
des_set_odd_parity((void *)(secret + 8));
des_set_odd_parity((void *)(secret + 16));
if(des_set_key((void *)secret, s1) != 0) {
printf("failed to schedule key 1\n");
}

View File

@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.65 2001/07/04 22:03:14 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.65.4.1 2002/06/01 23:51:12 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -31,9 +31,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.53 2001/11/14 16:46:34 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.53.2.1 2002/06/01 23:51:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -31,8 +31,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>

View File

@ -24,7 +24,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.13 2001/06/15 22:17:31 fenner Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-gre.c,v 1.13.4.1 2002/06/01 23:51:13 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -33,7 +33,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.62 2001/07/24 16:56:11 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.62.4.1 2002/06/01 23:51:13 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -32,9 +32,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.56 2001/06/27 02:48:43 itojun Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.56.4.1 2002/05/31 10:08:31 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -574,7 +574,7 @@ icmp6_opt_print(const u_char *bp, int resid)
printf(")");
break;
default:
printf("(unknwon opt_type=%d, opt_len=%d)",
printf("(unknown opt_type=%d, opt_len=%d)",
op->nd_opt_type, op->nd_opt_len);
break;
}

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.5 2001/09/17 21:58:02 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.5.4.1 2002/06/02 18:25:05 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -32,8 +32,6 @@ static const char rcsid[] =
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <stdio.h>
#include <string.h>

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.100 2001/09/17 21:58:03 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.100.4.1 2002/01/25 05:39:54 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -34,6 +34,7 @@ static const char rcsid[] =
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -257,13 +258,12 @@ ip_print(register const u_char *bp, register u_int length)
register const u_char *cp;
u_char nh;
int advance;
struct protoent *proto;
ip = (const struct ip *)bp;
#ifdef LBL_ALIGN
/*
* If the IP header is not aligned, copy into abuf.
* This will never happen with BPF. It does happen raw packet
* dumps from -r.
*/
if ((long)ip & 3) {
static u_char *abuf = NULL;
@ -461,7 +461,11 @@ ip_print(register const u_char *bp, register u_int length)
break;
default:
(void)printf(" ip-proto-%d %d", nh, len);
if ((proto = getprotobynumber(nh)) != NULL)
(void)printf(" %s", proto->p_name);
else
(void)printf(" ip-proto-%d", nh);
printf(" %d", len);
break;
}
}
@ -480,11 +484,17 @@ ip_print(register const u_char *bp, register u_int length)
if (off & 0x3fff) {
/*
* if this isn't the first frag, we're missing the
* next level protocol header. print the ip addr.
* next level protocol header. print the ip addr
* and the protocol.
*/
if (off & 0x1fff)
if (off & 0x1fff) {
(void)printf("%s > %s:", ipaddr_string(&ip->ip_src),
ipaddr_string(&ip->ip_dst));
if ((proto = getprotobynumber(ip->ip_p)) != NULL)
(void)printf(" %s", proto->p_name);
else
(void)printf(" ip-proto-%d", ip->ip_p);
}
#ifndef IP_MF
#define IP_MF 0x2000
#endif /* IP_MF */

View File

@ -30,7 +30,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.29 2001/10/26 03:41:29 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.29.2.2 2003/02/26 05:58:39 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -43,9 +43,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>
@ -1028,6 +1025,7 @@ isakmp_sub0_print(u_char np, struct isakmp_gen *ext, u_char *ep,
{
u_char *cp;
struct isakmp_gen e;
u_int item_len;
cp = (u_char *)ext;
safememcpy(&e, ext, sizeof(e));
@ -1036,7 +1034,16 @@ isakmp_sub0_print(u_char np, struct isakmp_gen *ext, u_char *ep,
cp = (*NPFUNC(np))(ext, ep, phase, doi, proto);
else {
printf("%s", NPSTR(np));
cp += ntohs(e.len);
item_len = ntohs(e.len);
if (item_len == 0) {
/*
* We don't want to loop forever processing this
* bogus (zero-length) item; return NULL so that
* we stop dissecting.
*/
cp = NULL;
} else
cp += item_len;
}
return cp;
}
@ -1069,6 +1076,11 @@ isakmp_sub_print(u_char np, struct isakmp_gen *ext, u_char *ep,
printf(")");
depth--;
if (cp == NULL) {
/* Zero-length subitem */
return NULL;
}
np = e.np;
ext = (struct isakmp_gen *)cp;
}

View File

@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.36 2002/01/10 09:33:23 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.36.2.2 2002/06/29 04:28:44 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -574,7 +574,7 @@ isis_print_lspid(const u_char *cp)
static int
isis_print_tlv_ip_reach (const u_char *cp, int length)
{
int bitmasks[33] = {
u_int bitmasks[33] = {
0x00000000,
0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
@ -585,7 +585,8 @@ isis_print_tlv_ip_reach (const u_char *cp, int length)
0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff
};
int mask, prefix_len;
u_int mask;
int prefix_len;
const struct isis_tlv_ip_reach *tlv_ip_reach;
tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp;
@ -676,6 +677,7 @@ static int isis_print (const u_char *p, u_int length)
u_char pdu_type, max_area, type, len, tmp, alen, subl, subt, tslen, ttslen;
const u_char *optr, *pptr, *tptr;
u_char subtlv_len;
u_short packet_len,pdu_len;
u_int i,j,bit_length,byte_length,metric;
u_char prefix[4]; /* copy buffer for ipv4 prefixes */
@ -1244,10 +1246,11 @@ static int isis_print (const u_char *p, u_int length)
if (ISIS_MASK_TLV_EXT_IP_SUBTLV(j)) {
if (!TTEST2(*tptr, 1))
return (1);
printf(" (%u)",*tptr); /* no subTLV decoder supported - just print out subTLV length */
i-=*tptr;
tptr+=*tptr++;
return (1);
subtlv_len = *tptr;
printf(" (%u)",subtlv_len); /* no subTLV decoder supported - just print out subTLV length */
i -= subtlv_len;
tptr += subtlv_len + 1;
}
i-=(5+byte_length);
@ -1516,8 +1519,9 @@ static int isis_print (const u_char *p, u_int length)
printf("\n\t\t\tRestart Request bit %s, Restart Acknowledgement bit %s\n\t\t\tRemaining holding time: %us",
ISIS_MASK_RESTART_RR(*tptr) ? "set" : "clear",
ISIS_MASK_RESTART_RA(*tptr++) ? "set" : "clear",
EXTRACT_16BITS(tptr));
ISIS_MASK_RESTART_RA(*tptr) ? "set" : "clear",
EXTRACT_16BITS(tptr+1));
tptr += 3;
break;

View File

@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.10 2001/11/10 21:37:58 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.10.2.1 2002/05/25 09:47:07 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -38,6 +38,7 @@ static const char rcsid[] =
#include "l2tp.h"
#include "interface.h"
#include "extract.h"
static char tstr[] = " [|l2tp]";
@ -263,13 +264,13 @@ print_octets(const u_char *dat, u_int length)
static void
print_16bits_val(const u_int16_t *dat)
{
printf("%u", ntohs(*dat));
printf("%u", EXTRACT_16BITS(dat));
}
static void
print_32bits_val(const u_int32_t *dat)
{
printf("%lu", (u_long)ntohl(*dat));
printf("%lu", (u_long)EXTRACT_32BITS(dat));
}
/***********************************/
@ -280,7 +281,8 @@ l2tp_msgtype_print(const u_char *dat)
{
u_int16_t *ptr = (u_int16_t*)dat;
printf("%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u", ntohs(*ptr)));
printf("%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u",
EXTRACT_16BITS(ptr)));
}
static void
@ -288,11 +290,11 @@ l2tp_result_code_print(const u_char *dat, u_int length)
{
u_int16_t *ptr = (u_int16_t *)dat;
printf("%u", ntohs(*ptr++)); /* Result Code */
if (length > 2) { /* Error Code (opt) */
printf("/%u", ntohs(*ptr++));
printf("%u", EXTRACT_16BITS(ptr)); ptr++; /* Result Code */
if (length > 2) { /* Error Code (opt) */
printf("/%u", EXTRACT_16BITS(ptr)); ptr++;
}
if (length > 4) { /* Error Message (opt) */
if (length > 4) { /* Error Message (opt) */
printf(" ");
print_string((u_char *)ptr, length - 4);
}
@ -301,7 +303,8 @@ l2tp_result_code_print(const u_char *dat, u_int length)
static void
l2tp_proto_ver_print(const u_int16_t *dat)
{
printf("%u.%u", (ntohs(*dat) >> 8), (ntohs(*dat) & 0xff));
printf("%u.%u", (EXTRACT_16BITS(dat) >> 8),
(EXTRACT_16BITS(dat) & 0xff));
}
static void
@ -309,10 +312,10 @@ l2tp_framing_cap_print(const u_char *dat)
{
u_int32_t *ptr = (u_int32_t *)dat;
if (ntohl(*ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_ASYNC_MASK) {
printf("A");
}
if (ntohl(*ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_CAP_SYNC_MASK) {
printf("S");
}
}
@ -322,10 +325,10 @@ l2tp_bearer_cap_print(const u_char *dat)
{
u_int32_t *ptr = (u_int32_t *)dat;
if (ntohl(*ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_ANALOG_MASK) {
printf("A");
}
if (ntohl(*ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_CAP_DIGITAL_MASK) {
printf("D");
}
}
@ -346,10 +349,10 @@ l2tp_bearer_type_print(const u_char *dat)
{
u_int32_t *ptr = (u_int32_t *)dat;
if (ntohl(*ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {
printf("A");
}
if (ntohl(*ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {
printf("D");
}
}
@ -359,10 +362,10 @@ l2tp_framing_type_print(const u_char *dat)
{
u_int32_t *ptr = (u_int32_t *)dat;
if (ntohl(*ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_ASYNC_MASK) {
printf("A");
}
if (ntohl(*ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
if (EXTRACT_32BITS(ptr) & L2TP_FRAMING_TYPE_SYNC_MASK) {
printf("S");
}
}
@ -379,7 +382,7 @@ l2tp_proxy_auth_type_print(const u_char *dat)
u_int16_t *ptr = (u_int16_t *)dat;
printf("%s", tok2str(l2tp_authentype2str,
"AuthType-#%u", ntohs(*ptr)));
"AuthType-#%u", EXTRACT_16BITS(ptr)));
}
static void
@ -387,7 +390,7 @@ l2tp_proxy_auth_id_print(const u_char *dat)
{
u_int16_t *ptr = (u_int16_t *)dat;
printf("%u", ntohs(*ptr) & L2TP_PROXY_AUTH_ID_MASK);
printf("%u", EXTRACT_16BITS(ptr) & L2TP_PROXY_AUTH_ID_MASK);
}
static void
@ -398,28 +401,28 @@ l2tp_call_errors_print(const u_char *dat)
ptr++; /* skip "Reserved" */
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("CRCErr=%u ", (val_h<<16) + val_l);
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("FrameErr=%u ", (val_h<<16) + val_l);
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("HardOver=%u ", (val_h<<16) + val_l);
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("BufOver=%u ", (val_h<<16) + val_l);
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("Timeout=%u ", (val_h<<16) + val_l);
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("AlignErr=%u ", (val_h<<16) + val_l);
}
@ -431,12 +434,12 @@ l2tp_accm_print(const u_char *dat)
ptr++; /* skip "Reserved" */
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("send=%08x ", (val_h<<16) + val_l);
val_h = ntohs(*ptr++);
val_l = ntohs(*ptr++);
val_h = EXTRACT_16BITS(ptr); ptr++;
val_l = EXTRACT_16BITS(ptr); ptr++;
printf("recv=%08x ", (val_h<<16) + val_l);
}
@ -445,8 +448,8 @@ l2tp_ppp_discon_cc_print(const u_char *dat, u_int length)
{
u_int16_t *ptr = (u_int16_t *)dat;
printf("%04x, ", ntohs(*ptr++)); /* Disconnect Code */
printf("%04x ", ntohs(*ptr++)); /* Control Protocol Number */
printf("%04x, ", EXTRACT_16BITS(ptr)); ptr++; /* Disconnect Code */
printf("%04x ", EXTRACT_16BITS(ptr)); ptr++; /* Control Protocol Number */
printf("%s", tok2str(l2tp_cc_direction2str,
"Direction-#%u", *((u_char *)ptr++)));
@ -471,33 +474,33 @@ l2tp_avp_print(const u_char *dat, int length)
printf(" ");
TCHECK(*ptr); /* Flags & Length */
len = ntohs(*ptr) & L2TP_AVP_HDR_LEN_MASK;
len = EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK;
/* If it is not long enough to decode the entire AVP, we'll
abandon. */
TCHECK2(*ptr, len);
/* After this point, no need to worry about truncation */
if (ntohs(*ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) {
printf("*");
}
if (ntohs(*ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) {
hidden = TRUE;
printf("?");
}
ptr++;
if (ntohs(*ptr)) {
if (EXTRACT_16BITS(ptr)) {
/* Vendor Specific Attribute */
printf("VENDOR%04x:", ntohs(*ptr++));
printf("ATTR%04x", ntohs(*ptr++));
printf("VENDOR%04x:", EXTRACT_16BITS(ptr)); ptr++;
printf("ATTR%04x", EXTRACT_16BITS(ptr)); ptr++;
printf("(");
print_octets((u_char *)ptr, len-6);
printf(")");
} else {
/* IETF-defined Attributes */
ptr++;
attr_type = ntohs(*ptr++);
attr_type = EXTRACT_16BITS(ptr); ptr++;
printf("%s", tok2str(l2tp_avp2str, "AVP-#%u", attr_type));
printf("(");
if (hidden) {
@ -613,9 +616,9 @@ l2tp_print(const u_char *dat, u_int length)
flag_t = flag_l = flag_s = flag_o = flag_p = FALSE;
TCHECK(*ptr); /* Flags & Version */
if ((ntohs(*ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
printf(" l2tp:");
} else if ((ntohs(*ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
} else if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2F) {
printf(" l2f:");
return; /* nothing to do */
} else {
@ -624,23 +627,23 @@ l2tp_print(const u_char *dat, u_int length)
}
printf("[");
if (ntohs(*ptr) & L2TP_FLAG_TYPE) {
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_TYPE) {
flag_t = TRUE;
printf("T");
}
if (ntohs(*ptr) & L2TP_FLAG_LENGTH) {
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_LENGTH) {
flag_l = TRUE;
printf("L");
}
if (ntohs(*ptr) & L2TP_FLAG_SEQUENCE) {
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_SEQUENCE) {
flag_s = TRUE;
printf("S");
}
if (ntohs(*ptr) & L2TP_FLAG_OFFSET) {
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_OFFSET) {
flag_o = TRUE;
printf("O");
}
if (ntohs(*ptr) & L2TP_FLAG_PRIORITY) {
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_PRIORITY) {
flag_p = TRUE;
printf("P");
}
@ -651,31 +654,31 @@ l2tp_print(const u_char *dat, u_int length)
if (flag_l) {
TCHECK(*ptr); /* Length */
l2tp_len = ntohs(*ptr++);
l2tp_len = EXTRACT_16BITS(ptr); ptr++;
cnt += 2;
} else {
l2tp_len = 0;
}
TCHECK(*ptr); /* Tunnel ID */
printf("(%u/", ntohs(*ptr++));
printf("(%u/", EXTRACT_16BITS(ptr)); ptr++;
cnt += 2;
TCHECK(*ptr); /* Session ID */
printf("%u)", ntohs(*ptr++));
printf("%u)", EXTRACT_16BITS(ptr)); ptr++;
cnt += 2;
if (flag_s) {
TCHECK(*ptr); /* Ns */
printf("Ns=%u,", ntohs(*ptr++));
printf("Ns=%u,", EXTRACT_16BITS(ptr)); ptr++;
cnt += 2;
TCHECK(*ptr); /* Nr */
printf("Nr=%u", ntohs(*ptr++));
printf("Nr=%u", EXTRACT_16BITS(ptr)); ptr++;
cnt += 2;
}
if (flag_o) {
TCHECK(*ptr); /* Offset Size */
pad = ntohs(*ptr++);
pad = EXTRACT_16BITS(ptr); ptr++;
ptr += pad / sizeof(*ptr);
cnt += (2 + pad);
}

View File

@ -42,12 +42,11 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.7 2001/08/20 17:53:54 fenner Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-mobile.c,v 1.7.4.1 2002/06/01 23:51:14 guy Exp $";
#endif
#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>

View File

@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.2 2001/06/26 06:24:57 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.2.4.1 2002/05/07 18:36:28 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -83,23 +83,24 @@ mpls_print(const u_char *bp, u_int length)
p = bp;
printf("MPLS");
TCHECK2(*p, sizeof(v));
memcpy(&v, p, sizeof(v));
v = (u_int32_t)ntohl(v);
printf(" ("); /*)*/
printf("label 0x%x", MPLS_LABEL(v));
if (vflag &&
MPLS_LABEL(v) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
printf("(%s)", mpls_labelname[MPLS_LABEL(v)]);
if (MPLS_EXP(v))
printf(" exp 0x%x", MPLS_EXP(v));
if (MPLS_STACK(v))
printf("[S]");
printf(" TTL %u", MPLS_TTL(v));
/*(*/
printf(")");
do {
TCHECK2(*p, sizeof(v));
v = EXTRACT_32BITS(p);
printf(" ("); /*)*/
printf("label 0x%x", MPLS_LABEL(v));
if (vflag &&
MPLS_LABEL(v) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
printf("(%s)", mpls_labelname[MPLS_LABEL(v)]);
if (MPLS_EXP(v))
printf(" exp 0x%x", MPLS_EXP(v));
if (MPLS_STACK(v))
printf("[S]");
printf(" TTL %u", MPLS_TTL(v));
/*(*/
printf(")");
p += sizeof(v);
p += sizeof(v);
} while (!MPLS_STACK(v));
switch (MPLS_LABEL(v)) {
case 0: /* IPv4 explicit NULL label */

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.89 2001/07/08 08:01:43 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.89.4.2 2002/06/01 23:51:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -32,9 +32,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <rpc/rpc.h>
@ -716,10 +713,16 @@ nfsreq_print(register const u_char *bp, u_int length,
case NFSPROC_FSINFO:
printf(" fsinfo");
if ((dp = parsereq(rp, length)) != NULL &&
parsefh(dp, v3) != NULL)
return;
break;
case NFSPROC_PATHCONF:
printf(" pathconf");
if ((dp = parsereq(rp, length)) != NULL &&
parsefh(dp, v3) != NULL)
return;
break;
case NFSPROC_COMMIT:
@ -1027,7 +1030,6 @@ parsestatus(const u_int32_t *dp, int *er)
printf(" ERROR: %s",
tok2str(status2str, "unk %d", errnum));
nfserr = 1;
return (NULL);
}
return (dp + 1);
trunc:
@ -1109,8 +1111,10 @@ parseattrstat(const u_int32_t *dp, int verbose, int v3)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || er)
if (dp == NULL)
return (0);
if (er)
return (1);
return (parsefattr(dp, verbose, v3) != NULL);
}
@ -1120,8 +1124,10 @@ parsediropres(const u_int32_t *dp)
{
int er;
if (!(dp = parsestatus(dp, &er)) || er)
if (!(dp = parsestatus(dp, &er)))
return (0);
if (er)
return (1);
dp = parsefh(dp, 0);
if (dp == NULL)
@ -1136,8 +1142,10 @@ parselinkres(const u_int32_t *dp, int v3)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || er)
if (dp == NULL)
return(0);
if (er)
return(1);
if (v3 && !(dp = parse_post_op_attr(dp, vflag)))
return (0);
putchar(' ');
@ -1151,8 +1159,10 @@ parsestatfs(const u_int32_t *dp, int v3)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || (!v3 && er))
if (dp == NULL)
return (0);
if (!v3 && er)
return (1);
if (qflag)
return(1);
@ -1164,7 +1174,7 @@ parsestatfs(const u_int32_t *dp, int v3)
return (0);
}
TCHECK2(dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
sfsp = (const struct nfs_statfs *)dp;
@ -1205,8 +1215,10 @@ parserddires(const u_int32_t *dp)
int er;
dp = parsestatus(dp, &er);
if (dp == NULL || er)
if (dp == NULL)
return (0);
if (er)
return (1);
if (qflag)
return (1);
@ -1242,7 +1254,7 @@ parse_pre_op_attr(const u_int32_t *dp, int verbose)
if (!ntohl(dp[0]))
return (dp + 1);
dp++;
TCHECK2(dp, 24);
TCHECK2(*dp, 24);
if (verbose > 1) {
return parse_wcc_attr(dp);
} else {
@ -1379,9 +1391,9 @@ parsefsinfo(const u_int32_t *dp)
(u_int32_t) ntohl(sfp->fs_timedelta.nfsv3_sec),
(u_int32_t) ntohl(sfp->fs_timedelta.nfsv3_nsec));
}
return (0);
trunc:
return (1);
trunc:
return (0);
}
static int
@ -1409,9 +1421,9 @@ parsepathconf(const u_int32_t *dp)
ntohl(spp->pc_chownrestricted) ? "chownres" : "",
ntohl(spp->pc_caseinsensitive) ? "igncase" : "",
ntohl(spp->pc_casepreserving) ? "keepcase" : "");
return (0);
trunc:
return (1);
trunc:
return (0);
}
static void

View File

@ -25,7 +25,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.32 2001/08/20 15:36:57 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.32.4.1 2002/07/10 07:13:37 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -155,7 +155,7 @@ ntp_print(register const u_char *cp, u_int length)
break;
case PRIM_REF:
fn_printn((char *)&(bp->refid), 4, NULL);
fn_printn((u_char *)&(bp->refid), 4, NULL);
break;
case INFO_QUERY:

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.41 2001/07/05 18:54:15 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.41.4.1 2002/06/01 23:51:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -31,11 +31,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.29 2001/07/04 21:36:15 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.29.4.1 2002/05/07 18:30:19 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -584,7 +584,20 @@ pimv2_print(register const u_char *bp, register u_int len)
(void)printf(")");
break;
case 18: /* Old DR-Priority */
if (olen == 4)
(void)printf(" (OLD-DR-Priority: %d)",
EXTRACT_32BITS(&bp[4]));
else
goto unknown;
break;
case 19: /* DR-Priority */
if (olen == 0) {
(void)printf(" (OLD-bidir-capable)");
break;
}
(void)printf(" (DR-Priority: ");
if (olen != 4) {
(void)printf("!olen=%d!)", olen);
@ -614,6 +627,7 @@ pimv2_print(register const u_char *bp, register u_int len)
break;
default:
unknown:
if (vflag)
(void)printf(" [Hello option %d]", otype);
}

View File

@ -44,7 +44,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: print-radius.c,v 1.10 2001/10/22 06:58:33 itojun Exp $";
"$Id: print-radius.c,v 1.10.2.2 2002/07/03 16:35:04 fenner Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -59,6 +59,10 @@ static const char rcsid[] =
#include <stdio.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#include "interface.h"
#include "addrtoname.h"
#include "extract.h"
@ -522,7 +526,8 @@ print_attr_num(register u_char *data, u_int length, u_short attr_code )
data_value = EXTRACT_32BITS(data);
}
if ( data_value <= (attr_type[attr_code].siz_subtypes - 1 +
attr_type[attr_code].first_subtype) )
attr_type[attr_code].first_subtype) &&
data_value >= attr_type[attr_code].first_subtype )
printf("{%s}",table[data_value]);
else
printf("{#%d}",data_value);

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.34 2001/07/05 18:54:17 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-raw.c,v 1.34.4.1 2002/06/01 23:51:15 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -31,8 +31,6 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <netinet/in.h>

View File

@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.27 2001/10/20 07:41:55 itojun Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.27.2.2 2002/07/10 07:17:57 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -44,7 +44,9 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
@ -755,15 +757,15 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, int sport,
* This is the sickest one of all
*/
#define VECOUT(MAX) { char *sp; \
char s[AFSNAMEMAX]; \
#define VECOUT(MAX) { u_char *sp; \
u_char s[AFSNAMEMAX]; \
int k; \
if ((MAX) + 1 > sizeof(s)) \
goto trunc; \
TCHECK2(bp[0], (MAX) * sizeof(int32_t)); \
sp = s; \
for (k = 0; k < (MAX); k++) { \
*sp++ = (char) EXTRACT_32BITS(bp); \
*sp++ = (u_char) EXTRACT_32BITS(bp); \
bp += sizeof(int32_t); \
} \
s[(MAX)] = '\0'; \
@ -1128,7 +1130,7 @@ acl_print(u_char *s, int maxsize, u_char *end)
goto finish;
s += n;
printf(" +{");
fn_print(user, NULL);
fn_print((u_char *)user, NULL);
printf(" ");
ACLOUT(acl);
printf("}");
@ -1141,7 +1143,7 @@ acl_print(u_char *s, int maxsize, u_char *end)
goto finish;
s += n;
printf(" -{");
fn_print(user, NULL);
fn_print((u_char *)user, NULL);
printf(" ");
ACLOUT(acl);
printf("}");

View File

@ -35,7 +35,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.7 2001/12/12 07:16:40 guy Exp $ (NETLAB/PEL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.7.2.1 2002/07/10 07:20:57 guy Exp $ (NETLAB/PEL)";
#endif
#ifdef HAVE_CONFIG_H
@ -74,25 +74,25 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
const struct ip6_hdr *ip6;
#endif
const u_char *cp;
void *endPacketPtr;
const void *endPacketPtr;
u_short sourcePort, destPort;
int chunkCount;
struct sctpChunkDesc *chunkDescPtr;
void *nextChunk;
const struct sctpChunkDesc *chunkDescPtr;
const void *nextChunk;
sctpPktHdr = (struct sctpHeader*) bp;
endPacketPtr = ((u_char*)((u_char*)sctpPktHdr+sctpPacketLength));
sctpPktHdr = (const struct sctpHeader*) bp;
endPacketPtr = (const u_char*)sctpPktHdr+sctpPacketLength;
if( (u_long) endPacketPtr > (u_long) snapend)
endPacketPtr = (void *) snapend;
endPacketPtr = (const void *) snapend;
ip = (struct ip *)bp2;
#ifdef INET6
if (IP_V(ip) == 6)
ip6 = (struct ip6_hdr *)bp2;
ip6 = (const struct ip6_hdr *)bp2;
else
ip6 = NULL;
#endif /*INET6*/
cp = (u_char *)(sctpPktHdr + 1);
cp = (const u_char *)(sctpPktHdr + 1);
if (cp > snapend)
{
printf("[|sctp]");
@ -145,31 +145,32 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
/* cycle through all chunks, printing information on each one */
for (chunkCount = 0,
chunkDescPtr = (struct sctpChunkDesc *) ( (u_char*) sctpPktHdr +
sizeof(struct sctpHeader));
chunkDescPtr = (const struct sctpChunkDesc *)
((const u_char*) sctpPktHdr + sizeof(struct sctpHeader));
chunkDescPtr != NULL &&
( (void *) ((u_char *) chunkDescPtr + sizeof(struct sctpChunkDesc))
( (const void *)
((const u_char *) chunkDescPtr + sizeof(struct sctpChunkDesc))
<= endPacketPtr);
chunkDescPtr = (struct sctpChunkDesc *) nextChunk, chunkCount++)
chunkDescPtr = (const struct sctpChunkDesc *) nextChunk, chunkCount++)
{
u_short align;
u_char *chunkEnd;
const u_char *chunkEnd;
chunkEnd = ((u_char*)chunkDescPtr + ntohs(chunkDescPtr->chunkLength));
chunkEnd = ((const u_char*)chunkDescPtr + ntohs(chunkDescPtr->chunkLength));
align=ntohs(chunkDescPtr->chunkLength) % 4;
if (align != 0)
align = 4 - align;
nextChunk = (void *) (chunkEnd + align);
nextChunk = (const void *) (chunkEnd + align);
printf("\n\t%d) ", chunkCount+1);
switch (chunkDescPtr->chunkID)
{
case SCTP_DATA :
{
struct sctpDataPart *dataHdrPtr;
const struct sctpDataPart *dataHdrPtr;
printf("[DATA] ");
@ -195,7 +196,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
== SCTP_DATA_LAST_FRAG) )
printf(" ");
dataHdrPtr=(struct sctpDataPart*)(chunkDescPtr+1);
dataHdrPtr=(const struct sctpDataPart*)(chunkDescPtr+1);
printf("[TSN: %u] ", (u_int32_t)ntohl(dataHdrPtr->TSN));
printf("[SID: %u] ", ntohs(dataHdrPtr->streamId));
@ -205,12 +206,12 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
if (vflag) /* if verbose output is specified */
{ /* at the command line */
char *payloadPtr;
const u_char *payloadPtr;
printf("[Payload");
if (!xflag && !qflag) {
payloadPtr = (char *) (++dataHdrPtr);
payloadPtr = (const u_char *) (++dataHdrPtr);
printf(":");
default_print(payloadPtr,
htons(chunkDescPtr->chunkLength)-1 -
@ -222,10 +223,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
}
case SCTP_INITIATION :
{
struct sctpInitiation *init;
const struct sctpInitiation *init;
printf("[INIT] ");
init=(struct sctpInitiation*)(chunkDescPtr+1);
init=(const struct sctpInitiation*)(chunkDescPtr+1);
printf("[init tag: %u] ", (u_int32_t)ntohl(init->initTag));
printf("[rwnd: %u] ", (u_int32_t)ntohl(init->rcvWindowCredit));
printf("[OS: %u] ", ntohs(init->NumPreopenStreams));
@ -241,10 +242,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
}
case SCTP_INITIATION_ACK :
{
struct sctpInitiation *init;
const struct sctpInitiation *init;
printf("[INIT ACK] ");
init=(struct sctpInitiation*)(chunkDescPtr+1);
init=(const struct sctpInitiation*)(chunkDescPtr+1);
printf("[init tag: %u] ", (u_int32_t)ntohl(init->initTag));
printf("[rwnd: %u] ", (u_int32_t)ntohl(init->rcvWindowCredit));
printf("[OS: %u] ", ntohs(init->NumPreopenStreams));
@ -260,13 +261,13 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
}
case SCTP_SELECTIVE_ACK:
{
struct sctpSelectiveAck *sack;
struct sctpSelectiveFrag *frag;
const struct sctpSelectiveAck *sack;
const struct sctpSelectiveFrag *frag;
int fragNo, tsnNo;
u_long *dupTSN;
const u_long *dupTSN;
printf("[SACK] ");
sack=(struct sctpSelectiveAck*)(chunkDescPtr+1);
sack=(const struct sctpSelectiveAck*)(chunkDescPtr+1);
printf("[cum ack %u] ", (u_int32_t)ntohl(sack->highestConseqTSN));
printf("[a_rwnd %u] ", (u_int32_t)ntohl(sack->updatedRwnd));
printf("[#gap acks %u] ", ntohs(sack->numberOfdesc));
@ -274,10 +275,10 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
/* print gaps */
for (frag = ( (struct sctpSelectiveFrag *)
((struct sctpSelectiveAck *) sack+1)),
for (frag = ( (const struct sctpSelectiveFrag *)
((const struct sctpSelectiveAck *) sack+1)),
fragNo=0;
(void *)frag < nextChunk && fragNo < ntohs(sack->numberOfdesc);
(const void *)frag < nextChunk && fragNo < ntohs(sack->numberOfdesc);
frag++, fragNo++)
printf("\n\t\t[gap ack block #%d: start = %u, end = %u] ",
fragNo+1,
@ -286,8 +287,8 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
/* print duplicate TSNs */
for (dupTSN = (u_long*)frag, tsnNo=0;
(void *) dupTSN < nextChunk && tsnNo<ntohs(sack->numDupTsns);
for (dupTSN = (const u_long*)frag, tsnNo=0;
(const void *) dupTSN < nextChunk && tsnNo<ntohs(sack->numDupTsns);
dupTSN++, tsnNo++)
printf("\n\t\t[dup TSN #%u: %u] ", tsnNo+1,
(u_int32_t)ntohl(*dupTSN));
@ -296,9 +297,9 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
}
case SCTP_HEARTBEAT_REQUEST :
{
struct sctpHBsender *hb;
const struct sctpHBsender *hb;
hb=(struct sctpHBsender*)chunkDescPtr;
hb=(const struct sctpHBsender*)chunkDescPtr;
printf("[HB REQ] ");

View File

@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.6 2001/07/05 18:54:18 guy Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.6.4.1 2002/06/01 23:51:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -31,9 +31,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <stdio.h>

View File

@ -12,13 +12,15 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.20 2002/01/17 04:38:29 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.20.2.4 2002/07/11 07:47:01 guy Exp $";
#endif
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "interface.h"
#include "extract.h"
#include "smb.h"
@ -173,7 +175,7 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
static struct smbfnsint *fn = &trans2_fns[0];
const u_char *data, *param;
const u_char *w = words + 1;
const u_char *f1 = NULL, *f2 = NULL;
const char *f1 = NULL, *f2 = NULL;
int pcnt, dcnt;
TCHECK(words[0]);
@ -224,8 +226,8 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
if (fn->descript.fn)
(*fn->descript.fn)(param, data, pcnt, dcnt);
else {
smb_fdata(param, f1 ? f1 : (u_char *)"Paramaters=\n", param + pcnt);
smb_fdata(data, f2 ? f2 : (u_char *)"Data=\n", data + dcnt);
smb_fdata(param, f1 ? f1 : "Parameters=\n", param + pcnt);
smb_fdata(data, f2 ? f2 : "Data=\n", data + dcnt);
}
return;
trunc:
@ -329,7 +331,7 @@ print_ipc(const u_char *param, int paramlen, const u_char *data, int datalen)
static void
print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u_char *maxbuf)
{
const u_char *f1, *f2, *f3, *f4;
const char *f1, *f2, *f3, *f4;
const u_char *data, *param;
const u_char *w = words + 1;
int datalen, paramlen;
@ -359,12 +361,12 @@ print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u
smb_fdata(words + 1, f1, SMBMIN(words + 1 + 2 * words[0], maxbuf));
smb_fdata(data1 + 2, f2, maxbuf - (paramlen + datalen));
if (!strcmp(data1 + 2, "\\MAILSLOT\\BROWSE")) {
if (strcmp((const char *)(data1 + 2), "\\MAILSLOT\\BROWSE") == 0) {
print_browse(param, paramlen, data, datalen);
return;
}
if (!strcmp(data1 + 2, "\\PIPE\\LANMAN")) {
if (strcmp((const char *)(data1 + 2), "\\PIPE\\LANMAN") == 0) {
print_ipc(param, paramlen, data, datalen);
return;
}
@ -383,7 +385,7 @@ print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u
static void
print_negprot(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
{
u_char *f1 = NULL, *f2 = NULL;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
if (request)
@ -418,7 +420,7 @@ static void
print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
{
int wcnt;
u_char *f1 = NULL, *f2 = NULL;
const char *f1 = NULL, *f2 = NULL;
TCHECK(words[0]);
wcnt = words[0];
@ -762,7 +764,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
TCHECK(words[0]);
for (;;) {
const u_char *f1, *f2;
const char *f1, *f2;
int wct;
int bcc;
@ -857,9 +859,9 @@ nbt_tcp_print(const u_char *data, int length)
return;
if (vflag > 1)
printf ("\n>>> ");
printf ("\n>>>");
printf("NBT Packet");
printf(" NBT Packet");
if (vflag < 2)
return;
@ -949,7 +951,7 @@ nbt_udp137_print(const u_char *data, int length)
int name_trn_id, response, opcode, nm_flags, rcode;
int qdcount, ancount, nscount, arcount;
char *opcodestr;
const char *p;
const u_char *p;
int total, i;
TCHECK2(data[10], 2);
@ -1078,14 +1080,14 @@ nbt_udp137_print(const u_char *data, int length)
p += 2;
}
} else {
print_data(p, min(rdlen, length - ((const u_char *)p - data)));
print_data(p, min(rdlen, length - (p - data)));
p += rdlen;
}
}
}
}
if ((u_char*)p < maxbuf)
if (p < maxbuf)
smb_fdata(p, "AdditionalData:\n", maxbuf);
out:

View File

@ -58,7 +58,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.50 2001/09/17 22:16:53 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.50.4.2 2002/07/20 23:33:08 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -688,13 +688,17 @@ asn1_print(struct be *elem)
/*
* first subitem encodes two items with 1st*OIDMUX+2nd
* (see X.690:1997 clause 8.19 for the details)
*/
if (first < 0) {
int s;
if (!nflag)
objp = mibroot;
first = 0;
OBJ_PRINT(o/OIDMUX, first);
o %= OIDMUX;
s = o / OIDMUX;
if (s > 2) s = 2;
OBJ_PRINT(s, first);
o -= s * OIDMUX;
}
OBJ_PRINT(o, first);
if (--first < 0)
@ -875,16 +879,19 @@ static void smi_decode_oid(struct be *elem, unsigned int *oid,
/*
* first subitem encodes two items with 1st*OIDMUX+2nd
* (see X.690:1997 clause 8.19 for the details)
*/
if (first < 0) {
first = 0;
if (*oidlen < oidsize) {
oid[(*oidlen)++] = o/OIDMUX;
oid[*oidlen] = o / OIDMUX;
if (oid[*oidlen] > 2) oid[*oidlen] = 2;
}
o %= OIDMUX;
o -= oid[*oidlen] * OIDMUX;
if (*oidlen < oidsize) (*oidlen)++;
}
if (*oidlen < oidsize) {
oid[(*oidlen)++] = o;
oid[(*oidlen)++] = o;
}
o = 0;
}
@ -1530,8 +1537,9 @@ community_print(const u_char *np, u_int length, int version)
return;
}
/* default community */
if (strncmp((char *)elem.data.str, DEF_COMMUNITY,
sizeof(DEF_COMMUNITY) - 1))
if (!(elem.asnlen == sizeof(DEF_COMMUNITY) - 1 &&
strncmp((char *)elem.data.str, DEF_COMMUNITY,
sizeof(DEF_COMMUNITY) - 1) == 0))
/* ! "public" */
printf("C=%.*s ", (int)elem.asnlen, elem.data.str);
length -= count;

View File

@ -11,7 +11,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.6 2000/09/29 04:58:50 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.6.6.1 2002/05/29 10:00:00 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -96,7 +96,7 @@ stp_print(const u_char *p, u_int length)
break;
default:
printf("unknown type %i\n", p[6]);
printf("unknown type %i", p[6]);
break;
}

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.39 2000/10/07 05:53:13 itojun Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.39.6.1 2002/06/01 23:51:16 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -32,9 +32,6 @@ static const char rcsid[] =
#include <sys/time.h>
#include <sys/socket.h>
struct mbuf;
struct rtentry;
#include <netinet/in.h>
#include <rpc/rpc.h>

View File

@ -20,7 +20,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.2 2001/09/11 02:37:12 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.2.4.2 2002/07/11 07:49:19 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@ -56,7 +56,7 @@ struct z_packet {
/* Other fields follow here.. */
};
enum {
enum z_packet_type {
Z_PACKET_UNSAFE = 0,
Z_PACKET_UNACKED,
Z_PACKET_ACKED,
@ -66,7 +66,7 @@ enum {
Z_PACKET_SERVNAK,
Z_PACKET_CLIENTACK,
Z_PACKET_STAT
} z_packet_type;
};
static struct tok z_types[] = {
{ Z_PACKET_UNSAFE, "unsafe" },
@ -122,7 +122,7 @@ str_to_lower(char *string)
string = z_buf;
while (*string) {
*string = tolower(*string);
*string = tolower((unsigned char)(*string));
string++;
}

View File

@ -12,7 +12,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.18 2002/01/17 04:38:29 guy Exp $";
"@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.18.2.3 2002/07/10 07:29:23 guy Exp $";
#endif
#include <sys/param.h>
@ -26,7 +26,9 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#include "interface.h"
#include "extract.h"
@ -336,7 +338,7 @@ write_bits(unsigned int val, char *fmt)
/* convert a UCS2 string into iso-8859-1 string */
static const char *
unistr(const char *s, int *len)
unistr(const u_char *s, int *len)
{
static char buf[1000];
int l=0;
@ -352,8 +354,8 @@ unistr(const char *s, int *len)
/* maybe it isn't unicode - a cheap trick */
if (!use_unicode || (s[0] && s[1])) {
*len = strlen(s) + 1;
return s;
*len = strlen((const char *)s) + 1;
return (const char *)s;
}
*len = 0;
@ -398,8 +400,11 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
case '{':
{
char bitfmt[128];
char *p = strchr(++fmt, '}');
int l = PTR_DIFF(p, fmt);
char *p;
int l;
p = strchr(++fmt, '}');
l = PTR_DIFF(p, fmt);
strncpy(bitfmt, fmt, l);
bitfmt[l] = 0;
fmt = p + 1;
@ -413,7 +418,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
int l = atoi(fmt + 1);
buf += l;
fmt++;
while (isdigit(*fmt))
while (isdigit((unsigned char)*fmt))
fmt++;
break;
}
@ -527,7 +532,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
printf("%-*.*s", l, l, buf);
buf += l;
fmt++;
while (isdigit(*fmt))
while (isdigit((unsigned char)*fmt))
fmt++;
break;
}
@ -537,7 +542,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
while (l--)
printf("%02x", *buf++);
fmt++;
while (isdigit(*fmt))
while (isdigit((unsigned char)*fmt))
fmt++;
break;
}
@ -569,7 +574,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
break;
}
fmt++;
while (isdigit(*fmt))
while (isdigit((unsigned char)*fmt))
fmt++;
break;
}
@ -601,7 +606,7 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
}
printf("%s", t ? asctime(localtime(&t)) : "NULL\n");
fmt++;
while (isdigit(*fmt))
while (isdigit((unsigned char)*fmt))
fmt++;
break;
}

View File

@ -21,7 +21,7 @@
#ifndef lint
static const char rcsid[] =
"@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.72 2001/10/08 16:12:13 fenner Exp $ (LBL)";
"@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.72.2.2 2002/07/16 04:03:54 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@ -354,8 +354,8 @@ safeputchar(int c)
unsigned char ch;
ch = (unsigned char)(c & 0xff);
if (c < 0x80 && isprint(c))
printf("%c", c & 0xff);
if (ch < 0x80 && isprint(ch))
printf("%c", ch);
else
printf("\\%03o", c & 0xff);
printf("\\%03o", ch);
}