Virgin import of tcpdump v3.9.1 (release) from tcpdump.org
Approved by: re (scottl)
This commit is contained in:
parent
cc157742d1
commit
f4d0c64a1d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/tcpdump/dist/; revision=147899
@ -1,4 +1,40 @@
|
||||
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.87 2004/03/30 14:42:38 mcr Exp $
|
||||
$Header: /tcpdump/master/tcpdump/CHANGES,v 1.87.2.1 2005/07/05 21:08:01 mcr Exp $
|
||||
|
||||
Tue. July 5, 2005. ken@xelerance.com. Summary for 3.9.x tcpdump
|
||||
|
||||
Option to chroot() when dropping privs
|
||||
Fixes for compiling on nearly every platform,
|
||||
including improved 64bit support
|
||||
Many new testcases
|
||||
Support for sending packets
|
||||
Many compliation fixes on most platforms
|
||||
Fixes for recent version of GCC to eliminate warnings
|
||||
Improved Unicode support
|
||||
|
||||
Decoders & DLT Changes, Updates and New:
|
||||
AES ESP support
|
||||
Juniper ATM, FRF.15, FRF.16, PPPoE,
|
||||
ML-FR, ML-PIC, ML-PPP, PL-PPP, LS-PIC
|
||||
GGSN,ES,MONITOR,SERVICES
|
||||
L2VPN
|
||||
Axent Raptor/Symantec Firewall
|
||||
TCP-MD5 (RFC 2385)
|
||||
ESP-in-UDP (RFC 3948)
|
||||
ATM OAM
|
||||
LMP, LMP Service Discovery
|
||||
IP over FC
|
||||
IP over IEEE 1394
|
||||
BACnet MS/TP
|
||||
SS7
|
||||
LDP over TCP
|
||||
PGM (RFC 3208)
|
||||
LSP-PING
|
||||
G.7041/Y.1303 Generic Framing Procedure
|
||||
EIGRP-IP, EIGRP-IPX
|
||||
ICMP6
|
||||
Radio - via radiotap
|
||||
DHCPv6
|
||||
HDLC over PPP
|
||||
|
||||
Tue. March 30, 2004. mcr@sandelman.ottawa.on.ca. Summary for 3.8.3 release
|
||||
|
||||
|
@ -17,6 +17,7 @@ Additional people who have contributed patches:
|
||||
Andrew Church <andrew@users.sourceforge.net>
|
||||
Andrew Hintz <adhintz@users.sourceforge.net>
|
||||
Andrew Tridgell <tridge@linuxcare.com>
|
||||
Andy Heffernan <ahh@juniper.net>
|
||||
Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
||||
Armando L. Caro Jr. <acaro@mail.eecis.udel.edu>
|
||||
Atsushi Onoe <onoe@netbsd.org>
|
||||
@ -76,6 +77,7 @@ Additional people who have contributed patches:
|
||||
Loris Degioanni <loris@netgroup-serv.polito.it>
|
||||
Love Hörnquist-Åstrand <lha@stacken.kth.se>
|
||||
Maciej W. Rozycki <macro@ds2.pg.gda.pl>
|
||||
Manu Pathak <mapathak@cisco.com>
|
||||
Marc A. Lehmann <pcg@goof.com>
|
||||
Mark Ellzey Thomas <mark@ackers.net>
|
||||
Marko Kiiskila <carnil@cs.tut.fi>
|
||||
@ -93,6 +95,7 @@ Additional people who have contributed patches:
|
||||
Niels Provos <provos@openbsd.org>
|
||||
Nickolai Zeldovich <kolya@MIT.EDU>
|
||||
Nicolas Ferrero <toorop@babylo.net>
|
||||
Noritoshi Demizu <demizu@users.sourceforge.net>
|
||||
Olaf Kirch <okir@caldera.de>
|
||||
Onno van der Linden <onno@simplex.nl>
|
||||
Pascal Hennequin <pascal.hennequin@int-evry.fr>
|
||||
|
@ -103,6 +103,7 @@ oui.c
|
||||
oui.h
|
||||
packetdat.awk
|
||||
parsenfsfh.c
|
||||
pcap_dump_ftell.c
|
||||
pcap-missing.h
|
||||
pf.h
|
||||
pmap_prot.h
|
||||
@ -171,6 +172,7 @@ print-null.c
|
||||
print-ospf.c
|
||||
print-ospf6.c
|
||||
print-pflog.c
|
||||
print-pgm.c
|
||||
print-pim.c
|
||||
print-ppp.c
|
||||
print-pppoe.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.63 2004/12/27 00:41:29 guy Exp $ (LBL)
|
||||
@(#) $Header: /tcpdump/master/tcpdump/INSTALL,v 1.63.2.2 2005/06/03 22:10:15 guy Exp $ (LBL)
|
||||
|
||||
If you have not built libpcap, do so first. See the README
|
||||
file in this directory for the ftp location.
|
||||
@ -124,6 +124,8 @@ ospf.h - Open Shortest Path First definitions
|
||||
ospf6.h - IPv6 Open Shortest Path First definitions
|
||||
packetdat.awk - TCP chunk summary awk script
|
||||
parsenfsfh.c - Network File System file parser routines
|
||||
pcap_dump_ftell.c - pcap_dump_ftell() implementation, in case libpcap
|
||||
doesn't have it
|
||||
pcap-missing.h - declarations of functions possibly missing from libpcap
|
||||
pf.h - OpenBSD PF definitions
|
||||
pmap_prot.h - definitions for ONC RPC portmapper protocol
|
||||
@ -186,6 +188,7 @@ print-null.c - BSD loopback device printer routines
|
||||
print-ospf.c - Open Shortest Path First printer routines
|
||||
print-ospf6.c - IPv6 Open Shortest Path First printer routines
|
||||
print-pflog.c - OpenBSD packet filter log file printer routines
|
||||
print-pgm.c - Pragmatic General Multicast printer routines
|
||||
print-pim.c - Protocol Independent Multicast printer routines
|
||||
print-ppp.c - Point to Point Protocol printer routines
|
||||
print-pppoe.c - PPP-over-Ethernet printer routines
|
||||
|
@ -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.293 2004/10/29 11:42:53 hannes Exp $ (LBL)
|
||||
# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.293.2.1 2005/05/20 21:15:45 hannes Exp $ (LBL)
|
||||
|
||||
#
|
||||
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
||||
@ -81,7 +81,7 @@ CSRC = addrtoname.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \
|
||||
print-lmp.c print-lspping.c \
|
||||
print-lwres.c print-mobile.c print-mpls.c print-msdp.c \
|
||||
print-nfs.c print-ntp.c print-null.c print-ospf.c \
|
||||
print-pflog.c print-pim.c print-ppp.c print-pppoe.c \
|
||||
print-pflog.c print-pgm.c print-pim.c print-ppp.c print-pppoe.c \
|
||||
print-pptp.c print-radius.c print-raw.c print-rip.c \
|
||||
print-rsvp.c print-rx.c print-sctp.c print-sip.c print-sl.c print-sll.c \
|
||||
print-snmp.c print-stp.c print-sunatm.c print-sunrpc.c \
|
||||
|
@ -1 +1 @@
|
||||
3.9-PRE-CVS
|
||||
3.9.1
|
||||
|
@ -20,9 +20,6 @@
|
||||
/* define if your struct __res_state has the nsort member */
|
||||
#undef HAVE_NEW_RES_STATE
|
||||
|
||||
/* define if <inttypes.h> defines PRI[doxu]64 macros */
|
||||
#undef INTTYPES_H_DEFINES_FORMATS
|
||||
|
||||
/*
|
||||
* define if struct ether_header.ether_dhost is a struct with ether_addr_octet
|
||||
*/
|
||||
@ -88,6 +85,9 @@
|
||||
/* define if libpcap has pcap_datalink_val_to_description() */
|
||||
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
|
||||
/* define if libpcap has pcap_dump_ftell() */
|
||||
#undef HAVE_PCAP_DUMP_FTELL
|
||||
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
@ -106,17 +106,6 @@
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
/* Workaround for missing sized types */
|
||||
/* XXX this should move to the more standard uint*_t */
|
||||
#undef int8_t
|
||||
#undef int16_t
|
||||
#undef int32_t
|
||||
#undef int64_t
|
||||
#undef u_int8_t
|
||||
#undef u_int16_t
|
||||
#undef u_int32_t
|
||||
#undef u_int64_t
|
||||
|
||||
/* Workaround for missing 64-bit formats */
|
||||
#undef PRId64
|
||||
#undef PRIo64
|
||||
|
79
contrib/tcpdump/aclocal.m4
vendored
79
contrib/tcpdump/aclocal.m4
vendored
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106 2005/03/27 03:31:01 guy Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106.2.6 2005/06/03 22:10:16 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,7 @@ 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".
|
||||
@ -166,13 +167,8 @@ AC_DEFUN(AC_LBL_C_INIT,
|
||||
# at least some versions of HP's C compiler can inline that, but can't
|
||||
# inline a function that returns a struct pointer.
|
||||
#
|
||||
# Make sure we use the V_CCOPT flags, because some of those might
|
||||
# disable inlining.
|
||||
#
|
||||
AC_DEFUN(AC_LBL_C_INLINE,
|
||||
[AC_MSG_CHECKING(for inline)
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$V_CCOPT"
|
||||
AC_CACHE_VAL(ac_cv_lbl_inline, [
|
||||
ac_cv_lbl_inline=""
|
||||
ac_lbl_cc_inline=no
|
||||
@ -200,7 +196,6 @@ AC_DEFUN(AC_LBL_C_INLINE,
|
||||
if test "$ac_lbl_cc_inline" = yes ; then
|
||||
ac_cv_lbl_inline=$ac_lbl_inline
|
||||
fi])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
if test ! -z "$ac_cv_lbl_inline" ; then
|
||||
AC_MSG_RESULT($ac_cv_lbl_inline)
|
||||
else
|
||||
@ -329,11 +324,13 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
dnl
|
||||
dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()",
|
||||
dnl and "pcap_datalink_name_to_val()", and use substitute versions
|
||||
dnl if they're not present
|
||||
dnl if they're not present.
|
||||
dnl
|
||||
AC_CHECK_FUNC(pcap_list_datalinks,
|
||||
AC_DEFINE(HAVE_PCAP_LIST_DATALINKS),
|
||||
AC_LIBOBJ(datalinks))
|
||||
[
|
||||
AC_LIBOBJ(datalinks)
|
||||
])
|
||||
AC_CHECK_FUNC(pcap_set_datalink,
|
||||
AC_DEFINE(HAVE_PCAP_SET_DATALINK))
|
||||
AC_CHECK_FUNC(pcap_datalink_name_to_val,
|
||||
@ -341,9 +338,13 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL)
|
||||
AC_CHECK_FUNC(pcap_datalink_val_to_description,
|
||||
AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION),
|
||||
AC_LIBOBJ(dlnames))
|
||||
[
|
||||
AC_LIBOBJ(dlnames)
|
||||
])
|
||||
],
|
||||
AC_LIBOBJ(dlnames))
|
||||
[
|
||||
AC_LIBOBJ(dlnames)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Check for "pcap_breakloop()"; you can't substitute for it if
|
||||
@ -351,6 +352,15 @@ AC_DEFUN(AC_LBL_LIBPCAP,
|
||||
dnl so just define the HAVE_ value if it's there.
|
||||
dnl
|
||||
AC_CHECK_FUNCS(pcap_breakloop)
|
||||
|
||||
dnl
|
||||
dnl Check for "pcap_dump_ftell()" and use a substitute version
|
||||
dnl if it's not present.
|
||||
AC_CHECK_FUNC(pcap_dump_ftell,
|
||||
AC_DEFINE(HAVE_PCAP_DUMP_FTELL),
|
||||
[
|
||||
AC_LIBOBJ(pcap_dump_ftell)
|
||||
])
|
||||
])
|
||||
|
||||
dnl
|
||||
@ -562,36 +572,6 @@ AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_run_path)
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Due to the stupid way it's implemented, AC_CHECK_TYPE is nearly useless.
|
||||
dnl
|
||||
dnl usage:
|
||||
dnl
|
||||
dnl AC_LBL_CHECK_TYPE
|
||||
dnl
|
||||
dnl results:
|
||||
dnl
|
||||
dnl int32_t (defined)
|
||||
dnl u_int32_t (defined)
|
||||
dnl
|
||||
AC_DEFUN(AC_LBL_CHECK_TYPE,
|
||||
[AC_MSG_CHECKING(for $1 using $CC)
|
||||
AC_CACHE_VAL(ac_cv_lbl_have_$1,
|
||||
AC_TRY_COMPILE([
|
||||
# include "confdefs.h"
|
||||
# include <sys/types.h>
|
||||
# if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
# endif],
|
||||
[$1 i],
|
||||
ac_cv_lbl_have_$1=yes,
|
||||
ac_cv_lbl_have_$1=no))
|
||||
AC_MSG_RESULT($ac_cv_lbl_have_$1)
|
||||
if test $ac_cv_lbl_have_$1 = no ; then
|
||||
AC_DEFINE($1, $2)
|
||||
fi])
|
||||
|
||||
dnl
|
||||
dnl Check whether a given format can be used to print 64-bit integers
|
||||
dnl
|
||||
@ -604,6 +584,9 @@ AC_DEFUN(AC_LBL_CHECK_64BIT_FORMAT,
|
||||
[[
|
||||
# ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
# endif
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
@ -1243,10 +1226,10 @@ dnl
|
||||
AC_DEFUN(AC_C___ATTRIBUTE__, [
|
||||
AC_MSG_CHECKING(for __attribute__)
|
||||
AC_CACHE_VAL(ac_cv___attribute__, [
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE(
|
||||
AC_LANG_SOURCE([[
|
||||
#include <stdlib.h>
|
||||
],
|
||||
[
|
||||
|
||||
static void foo(void) __attribute__ ((noreturn));
|
||||
|
||||
static void
|
||||
@ -1254,7 +1237,13 @@ foo(void)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
],
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
foo();
|
||||
}
|
||||
]]),
|
||||
ac_cv___attribute__=yes,
|
||||
ac_cv___attribute__=no)])
|
||||
if test "$ac_cv___attribute__" = "yes"; then
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108 2005/03/27 22:38:09 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.5 2005/04/25 08:43:05 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -42,12 +42,18 @@ struct rtentry; /* declarations in <net/if.h> */
|
||||
#ifdef NETINET_ETHER_H_DECLARES_ETHER_NTOHOST
|
||||
#include <netinet/ether.h>
|
||||
#endif /* NETINET_ETHER_H_DECLARES_ETHER_NTOHOST */
|
||||
#endif /* USE_ETHER_NTOHOST */
|
||||
|
||||
#if !defined(HAVE_DECL_ETHER_NTOHOST) || !HAVE_DECL_ETHER_NTOHOST
|
||||
#ifndef HAVE_STRUCT_ETHER_ADDR
|
||||
struct ether_addr {
|
||||
unsigned char ether_addr_octet[6];
|
||||
};
|
||||
#endif
|
||||
extern int ether_ntohost(char *, const struct ether_addr *);
|
||||
#endif
|
||||
|
||||
#endif /* USE_ETHER_NTOHOST */
|
||||
|
||||
#include <pcap.h>
|
||||
#include <pcap-namedb.h>
|
||||
#include <signal.h>
|
||||
@ -59,6 +65,8 @@ extern int ether_ntohost(char *, const struct ether_addr *);
|
||||
#include "addrtoname.h"
|
||||
#include "llc.h"
|
||||
#include "setsignal.h"
|
||||
#include "extract.h"
|
||||
#include "oui.h"
|
||||
|
||||
/*
|
||||
* hash tables for whatever-to-name translations
|
||||
@ -67,6 +75,7 @@ extern int ether_ntohost(char *, const struct ether_addr *);
|
||||
*/
|
||||
|
||||
#define HASHNAMESIZE 4096
|
||||
#define BUFSIZE 128
|
||||
|
||||
struct hnamemem {
|
||||
u_int32_t addr;
|
||||
@ -167,7 +176,7 @@ intoa(u_int32_t addr)
|
||||
static char buf[sizeof(".xxx.xxx.xxx.xxx")];
|
||||
|
||||
NTOHL(addr);
|
||||
cp = &buf[sizeof buf];
|
||||
cp = buf + sizeof(buf);
|
||||
*--cp = '\0';
|
||||
|
||||
n = 4;
|
||||
@ -452,17 +461,17 @@ lookup_protoid(const u_char *pi)
|
||||
const char *
|
||||
etheraddr_string(register const u_char *ep)
|
||||
{
|
||||
register u_int i;
|
||||
register u_int i, oui;
|
||||
register char *cp;
|
||||
register struct enamemem *tp;
|
||||
char buf[sizeof("00:00:00:00:00:00")];
|
||||
char buf[BUFSIZE];
|
||||
|
||||
tp = lookup_emem(ep);
|
||||
if (tp->e_name)
|
||||
return (tp->e_name);
|
||||
#ifdef USE_ETHER_NTOHOST
|
||||
if (!nflag) {
|
||||
char buf2[128];
|
||||
char buf2[BUFSIZE];
|
||||
|
||||
/*
|
||||
* We don't cast it to "const struct ether_addr *"
|
||||
@ -477,14 +486,20 @@ etheraddr_string(register const u_char *ep)
|
||||
}
|
||||
#endif
|
||||
cp = buf;
|
||||
oui=EXTRACT_24BITS(ep);
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
for (i = 5; (int)--i >= 0;) {
|
||||
*cp++ = ':';
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
}
|
||||
*cp = '\0';
|
||||
for (i = 5; (int)--i >= 0;) {
|
||||
*cp++ = ':';
|
||||
*cp++ = hex[*ep >> 4 ];
|
||||
*cp++ = hex[*ep++ & 0xf];
|
||||
}
|
||||
|
||||
if (!nflag) {
|
||||
snprintf(cp,BUFSIZE," (oui %s)",
|
||||
tok2str(oui_values,"Unknown",oui));
|
||||
} else
|
||||
*cp = '\0';
|
||||
tp->e_name = strdup(buf);
|
||||
return (tp->e_name);
|
||||
}
|
||||
@ -598,7 +613,7 @@ isonsap_string(const u_char *nsap, register u_int nsap_length)
|
||||
register struct enamemem *tp;
|
||||
|
||||
if (nsap_length < 1 || nsap_length > ISONSAP_MAX_LENGTH)
|
||||
error("isonsap_string: illegal length");
|
||||
return ("isonsap_string: illegal length");
|
||||
|
||||
tp = lookup_nsap(nsap);
|
||||
if (tp->e_name)
|
||||
|
@ -14,7 +14,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.1 2002/07/11 09:17:22 guy Exp $
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/atm.h,v 1.1.4.1 2005/06/20 07:45:05 hannes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -23,3 +23,10 @@
|
||||
#define ATM_UNKNOWN 0 /* Unknown */
|
||||
#define ATM_LANE 1 /* LANE */
|
||||
#define ATM_LLC 2 /* LLC encapsulation */
|
||||
|
||||
/*
|
||||
* some OAM cell captures (most notably Juniper's)
|
||||
* do not deliver a heading HEC byte
|
||||
*/
|
||||
#define ATM_OAM_NOHEC 0
|
||||
#define ATM_OAM_HEC 1
|
||||
|
@ -20,9 +20,6 @@
|
||||
/* define if your struct __res_state has the nsort member */
|
||||
#undef HAVE_NEW_RES_STATE
|
||||
|
||||
/* define if <inttypes.h> defines PRI[doxu]64 macros */
|
||||
#undef INTTYPES_H_DEFINES_FORMATS
|
||||
|
||||
/*
|
||||
* define if struct ether_header.ether_dhost is a struct with ether_addr_octet
|
||||
*/
|
||||
@ -88,6 +85,9 @@
|
||||
/* define if libpcap has pcap_datalink_val_to_description() */
|
||||
#undef HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION
|
||||
|
||||
/* define if libpcap has pcap_dump_ftell() */
|
||||
#undef HAVE_PCAP_DUMP_FTELL
|
||||
|
||||
/* define if you have getrpcbynumber() */
|
||||
#undef HAVE_GETRPCBYNUMBER
|
||||
|
||||
@ -106,17 +106,6 @@
|
||||
/* AIX hack. */
|
||||
#undef _SUN
|
||||
|
||||
/* Workaround for missing sized types */
|
||||
/* XXX this should move to the more standard uint*_t */
|
||||
#undef int8_t
|
||||
#undef int16_t
|
||||
#undef int32_t
|
||||
#undef int64_t
|
||||
#undef u_int8_t
|
||||
#undef u_int16_t
|
||||
#undef u_int32_t
|
||||
#undef u_int64_t
|
||||
|
||||
/* Workaround for missing 64-bit formats */
|
||||
#undef PRId64
|
||||
#undef PRIo64
|
||||
@ -261,6 +250,12 @@
|
||||
/* Define to 1 if you have the `strsep' function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define to 1 if the system has the type `struct ether_addr'. */
|
||||
#undef HAVE_STRUCT_ETHER_ADDR
|
||||
|
||||
/* Define to 1 if you have the <sys/bitypes.h> header file. */
|
||||
#undef HAVE_SYS_BITYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
@ -326,3 +321,27 @@
|
||||
|
||||
/* Define as token for inline if inlining supported */
|
||||
#undef inline
|
||||
|
||||
/* Define to `short' if int16_t not defined. */
|
||||
#undef int16_t
|
||||
|
||||
/* Define to `int' if int32_t not defined. */
|
||||
#undef int32_t
|
||||
|
||||
/* Define to `long long' if int64_t not defined. */
|
||||
#undef int64_t
|
||||
|
||||
/* Define to `signed char' if int8_t not defined. */
|
||||
#undef int8_t
|
||||
|
||||
/* Define to `unsigned short' if u_int16_t not defined. */
|
||||
#undef u_int16_t
|
||||
|
||||
/* Define to `unsigned int' if u_int32_t not defined. */
|
||||
#undef u_int32_t
|
||||
|
||||
/* Define to `unsigned long long' if u_int64_t not defined. */
|
||||
#undef u_int64_t
|
||||
|
||||
/* Define to `unsigned char' if u_int8_t not defined. */
|
||||
#undef u_int8_t
|
||||
|
763
contrib/tcpdump/configure
vendored
763
contrib/tcpdump/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.188 2005/03/27 23:16:08 guy Exp $ (LBL)
|
||||
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.188.2.6 2005/04/24 01:36:19 guy Exp $ (LBL)
|
||||
dnl
|
||||
dnl Copyright (c) 1994, 1995, 1996, 1997
|
||||
dnl The Regents of the University of California. All rights reserved.
|
||||
@ -6,7 +6,7 @@ dnl
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_REVISION($Revision: 1.188 $)
|
||||
AC_REVISION($Revision: 1.188.2.6 $)
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(tcpdump.c)
|
||||
|
||||
@ -619,7 +619,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
|
||||
#
|
||||
# Yes. Does it declare ether_ntohost()?
|
||||
#
|
||||
AC_CHECK_DECLS(ether_ntohost,
|
||||
AC_CHECK_DECL(ether_ntohost,
|
||||
[
|
||||
AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
|
||||
[Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
|
||||
@ -628,6 +628,7 @@ if test "$ac_cv_func_ether_ntohost" = yes -a \
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#include <net/if.h>
|
||||
@ -650,7 +651,7 @@ struct rtentry;
|
||||
# suppress the next test.
|
||||
#
|
||||
unset ac_cv_have_decl_ether_ntohost
|
||||
AC_CHECK_DECLS(ether_ntohost,
|
||||
AC_CHECK_DECL(ether_ntohost,
|
||||
[
|
||||
AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
|
||||
[Define to 1 if netinet/ether.h declares `ether_ntohost'])
|
||||
@ -660,6 +661,33 @@ struct rtentry;
|
||||
])
|
||||
fi
|
||||
fi
|
||||
#
|
||||
# Is ether_ntohost() declared?
|
||||
#
|
||||
if test "$ac_cv_have_decl_ether_ntohost" != yes; then
|
||||
#
|
||||
# No, we'll have to declare it ourselves.
|
||||
# Do we have "struct ether_addr"?
|
||||
#
|
||||
AC_CHECK_TYPES(struct ether_addr,,,
|
||||
[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
struct mbuf;
|
||||
struct rtentry;
|
||||
#include <net/if.h>
|
||||
#include <netinet/if_ether.h>
|
||||
])
|
||||
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
|
||||
[Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
|
||||
don't.])
|
||||
else
|
||||
AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
|
||||
[Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
|
||||
don't.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl portability macros for getaddrinfo/getnameinfo
|
||||
@ -761,14 +789,48 @@ if test -f /dev/bpf0 ; then
|
||||
V_GROUP=bpf
|
||||
fi
|
||||
|
||||
AC_LBL_CHECK_TYPE(int8_t, signed char)
|
||||
AC_LBL_CHECK_TYPE(u_int8_t, u_char)
|
||||
AC_LBL_CHECK_TYPE(int16_t, short)
|
||||
AC_LBL_CHECK_TYPE(u_int16_t, u_short)
|
||||
AC_LBL_CHECK_TYPE(int32_t, int)
|
||||
AC_LBL_CHECK_TYPE(u_int32_t, u_int)
|
||||
AC_LBL_CHECK_TYPE(int64_t, long long)
|
||||
AC_LBL_CHECK_TYPE(u_int64_t, unsigned long long)
|
||||
AC_CHECK_HEADERS(sys/bitypes.h)
|
||||
|
||||
AC_CHECK_TYPE([int8_t], ,
|
||||
[AC_DEFINE([int8_t], [signed char],
|
||||
[Define to `signed char' if int8_t not defined.])])
|
||||
AC_CHECK_TYPE([u_int8_t], ,
|
||||
[AC_DEFINE([u_int8_t], [unsigned char],
|
||||
[Define to `unsigned char' if u_int8_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([int16_t], ,
|
||||
[AC_DEFINE([int16_t], [short],
|
||||
[Define to `short' if int16_t not defined.])])
|
||||
AC_CHECK_TYPE([u_int16_t], ,
|
||||
[AC_DEFINE([u_int16_t], [unsigned short],
|
||||
[Define to `unsigned short' if u_int16_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([int32_t], ,
|
||||
[AC_DEFINE([int32_t], [int],
|
||||
[Define to `int' if int32_t not defined.])])
|
||||
AC_CHECK_TYPE([u_int32_t], ,
|
||||
[AC_DEFINE([u_int32_t], [unsigned int],
|
||||
[Define to `unsigned int' if u_int32_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
AC_CHECK_TYPE([int64_t], ,
|
||||
[AC_DEFINE([int64_t], [long long],
|
||||
[Define to `long long' if int64_t not defined.])])
|
||||
AC_CHECK_TYPE([u_int64_t], ,
|
||||
[AC_DEFINE([u_int64_t], [unsigned long long],
|
||||
[Define to `unsigned long long' if u_int64_t not defined.])],
|
||||
[AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif])
|
||||
|
||||
#
|
||||
# We can't just check for <inttypes.h> - some systems have one that
|
||||
@ -787,6 +849,9 @@ AC_CHECK_HEADERS(inttypes.h,
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif
|
||||
|
||||
main()
|
||||
{
|
||||
@ -813,16 +878,17 @@ AC_CHECK_HEADERS(inttypes.h,
|
||||
#
|
||||
ac_lbl_inttypes_h_defines_formats=no
|
||||
])
|
||||
if test "$ac_lbl_inttypes_h_defines_formats" = yes; then
|
||||
AC_DEFINE(INTTYPES_H_DEFINES_FORMATS)
|
||||
else
|
||||
AC_LBL_CHECK_64BIT_FORMAT(ll,
|
||||
if test "$ac_lbl_inttypes_h_defines_formats" = no; then
|
||||
AC_LBL_CHECK_64BIT_FORMAT(l,
|
||||
[
|
||||
AC_LBL_CHECK_64BIT_FORMAT(L,
|
||||
[
|
||||
AC_LBL_CHECK_64BIT_FORMAT(q,
|
||||
AC_LBL_CHECK_64BIT_FORMAT(ll,
|
||||
[
|
||||
AC_LBL_CHECK_64BIT_FORMAT(L,
|
||||
[
|
||||
AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
|
||||
AC_LBL_CHECK_64BIT_FORMAT(q,
|
||||
[
|
||||
AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/gmpls.c,v 1.5 2004/09/15 17:54:10 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/gmpls.c,v 1.5.2.1 2005/05/19 06:44:02 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -133,6 +133,50 @@ struct tok gmpls_payload_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Link Type values used by LMP Service Discovery (specifically, the Client
|
||||
* Port Service Attributes Object). See UNI 1.0 section 9.4.2 for details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_link_type_values[] = {
|
||||
{ 5, "SDH ITU-T G.707"},
|
||||
{ 6, "SONET ANSI T1.105"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Signal Type values for SDH links used by LMP Service Discovery (specifically,
|
||||
* the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
|
||||
* details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[] = {
|
||||
{ 5, "VC-3"},
|
||||
{ 6, "VC-4"},
|
||||
{ 7, "STM-0"},
|
||||
{ 8, "STM-1"},
|
||||
{ 9, "STM-4"},
|
||||
{ 10, "STM-16"},
|
||||
{ 11, "STM-64"},
|
||||
{ 12, "STM-256"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Signal Type values for SONET links used by LMP Service Discovery (specifically,
|
||||
* the Client Port Service Attributes Object). See UNI 1.0 section 9.4.2 for
|
||||
* details.
|
||||
*/
|
||||
struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[] = {
|
||||
{ 5, "STS-1 SPE"},
|
||||
{ 6, "STS-3c SPE"},
|
||||
{ 7, "STS-1"},
|
||||
{ 8, "STM-3"},
|
||||
{ 9, "STM-12"},
|
||||
{ 10, "STM-48"},
|
||||
{ 11, "STM-192"},
|
||||
{ 12, "STM-768"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
#define DIFFSERV_BC_MODEL_RDM 0 /* draft-ietf-tewg-diff-te-proto-07 */
|
||||
#define DIFFSERV_BC_MODEL_MAM 1 /* draft-ietf-tewg-diff-te-proto-07 */
|
||||
#define DIFFSERV_BC_MODEL_EXTD_MAM 254 /* experimental */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.3 2004/09/15 17:54:11 hannes Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/gmpls.h,v 1.3.2.1 2005/05/19 06:44:03 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
@ -19,3 +19,6 @@ extern struct tok gmpls_switch_cap_values[];
|
||||
extern struct tok gmpls_encoding_values[];
|
||||
extern struct tok gmpls_payload_values[];
|
||||
extern struct tok diffserv_te_bc_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_link_type_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_signal_type_sdh_values[];
|
||||
extern struct tok lmp_sd_service_config_cpsa_signal_type_sonet_values[];
|
||||
|
@ -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.244 2005/04/06 21:33:27 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244.2.11 2005/06/20 07:45:04 hannes Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_interface_h
|
||||
@ -36,6 +36,10 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SNPRINTF)
|
||||
int snprintf(char *, size_t, const char *, ...)
|
||||
__attribute__((format(printf, 3, 4)));
|
||||
@ -133,6 +137,7 @@ extern void relts_print(int);
|
||||
|
||||
extern int fn_print(const u_char *, const u_char *);
|
||||
extern int fn_printn(const u_char *, u_int, const u_char *);
|
||||
extern int fn_printzp(const u_char *, u_int, const u_char *);
|
||||
extern int mask2plen(u_int32_t);
|
||||
extern const char *tok2strary_internal(const char **, int, const char *, int);
|
||||
#define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i)
|
||||
@ -169,15 +174,14 @@ extern void hex_print(const char *, const u_char *, u_int);
|
||||
extern int ether_encap_print(u_short, const u_char *, u_int, u_int, u_short *);
|
||||
extern int llc_print(const u_char *, u_int, u_int, const u_char *,
|
||||
const u_char *, u_short *);
|
||||
extern int snap_print(const u_char *, u_int, u_int, u_short *, u_int32_t,
|
||||
u_short, u_int);
|
||||
extern int snap_print(const u_char *, u_int, u_int, u_short *, u_int);
|
||||
extern void aarp_print(const u_char *, u_int);
|
||||
extern void aodv_print(const u_char *, u_int, int);
|
||||
extern void atalk_print(const u_char *, u_int);
|
||||
extern void atm_print(u_int, u_int, u_int, const u_char *, u_int, u_int);
|
||||
extern u_int atm_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sunatm_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern int oam_print(const u_char *, u_int);
|
||||
extern int oam_print(const u_char *, u_int, u_int);
|
||||
extern void bootp_print(const u_char *, u_int);
|
||||
extern void bgp_print(const u_char *, int);
|
||||
extern void beep_print(const u_char *, u_int);
|
||||
@ -197,6 +201,7 @@ extern u_int token_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void fddi_print(const u_char *, u_int, u_int);
|
||||
extern u_int fddi_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int fr_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int fr_print(register const u_char *, u_int);
|
||||
extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int ieee802_11_radio_if_print(const struct pcap_pkthdr *,
|
||||
const u_char *);
|
||||
@ -247,8 +252,15 @@ extern u_int sl_bsdos_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int chdlc_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm1_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_atm2_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mfr_print(const struct pcap_pkthdr *, register const u_char *);
|
||||
extern u_int juniper_mlfr_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_mlppp_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_pppoe_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_pppoe_atm_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_ggsn_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_es_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_monitor_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int juniper_services_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern u_int sll_if_print(const struct pcap_pkthdr *, const u_char *);
|
||||
extern void snmp_print(const u_char *, u_int);
|
||||
extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
|
||||
@ -271,6 +283,7 @@ extern const char *nt_errstr(u_int32_t);
|
||||
extern void print_data(const unsigned char *, int);
|
||||
extern void l2tp_print(const u_char *, u_int);
|
||||
extern void vrrp_print(const u_char *, u_int, int);
|
||||
extern void pgm_print(const u_char *, u_int, const u_char *);
|
||||
extern void cdp_print(const u_char *, u_int, u_int);
|
||||
extern void stp_print(const u_char *, u_int);
|
||||
extern void radius_print(const u_char *, u_int);
|
||||
@ -312,7 +325,7 @@ extern void bpf_dump(struct bpf_program *, int);
|
||||
|
||||
/* forward compatibility */
|
||||
|
||||
netdissect_options *gndo;
|
||||
extern netdissect_options *gndo;
|
||||
|
||||
#define eflag gndo->ndo_eflag
|
||||
#define fflag gndo->ndo_fflag
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.6 2002/12/11 22:29:21 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip6.h,v 1.6.4.1 2005/04/20 10:04:37 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 $ */
|
||||
|
||||
@ -95,9 +95,6 @@ struct ip6_hdr {
|
||||
#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) */
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/ipproto.c,v 1.3 2004/12/15 08:41:26 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/ipproto.c,v 1.3.2.2 2005/05/20 21:15:45 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -24,8 +24,8 @@ static const char rcsid[] _U_ =
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include "ipproto.h"
|
||||
#include "interface.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
struct tok ipproto_values[] = {
|
||||
{ IPPROTO_HOPOPTS, "Options" },
|
||||
@ -51,6 +51,7 @@ struct tok ipproto_values[] = {
|
||||
{ IPPROTO_PIM, "PIM" },
|
||||
{ IPPROTO_IPCOMP, "Compressed IP" },
|
||||
{ IPPROTO_VRRP, "VRRP" },
|
||||
{ IPPROTO_PGM, "PGM" },
|
||||
{ IPPROTO_SCTP, "SCTP" },
|
||||
{ IPPROTO_MOBILITY, "Mobility" },
|
||||
{ 0, NULL }
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.4 2004/04/28 22:02:23 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipproto.h,v 1.4.2.1 2005/05/20 21:15:46 hannes Exp $ (LBL)
|
||||
*
|
||||
* From:
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
@ -130,6 +130,9 @@ extern struct tok ipproto_values[];
|
||||
#ifndef IPPROTO_VRRP
|
||||
#define IPPROTO_VRRP 112
|
||||
#endif
|
||||
#ifndef IPPROTO_PGM
|
||||
#define IPPROTO_PGM 113
|
||||
#endif
|
||||
#ifndef IPPROTO_SCTP
|
||||
#define IPPROTO_SCTP 132
|
||||
#endif
|
||||
|
@ -18,44 +18,13 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.17 2005/04/06 20:09:07 hannes Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.17.2.1 2005/04/26 07:27:16 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
* This stuff should come from a system header file, but there's no
|
||||
* obviously portable way to do that and it's not really going
|
||||
* to change from system to system.
|
||||
* Definitions for information in the LLC header.
|
||||
*/
|
||||
|
||||
/*
|
||||
* A somewhat abstracted view of the LLC header
|
||||
*/
|
||||
|
||||
struct llc {
|
||||
u_int8_t dsap;
|
||||
u_int8_t ssap;
|
||||
union {
|
||||
u_int8_t u_ctl;
|
||||
u_int16_t is_ctl;
|
||||
struct {
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_pi[5];
|
||||
} snap;
|
||||
struct {
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_orgcode[3];
|
||||
u_int8_t snap_ethertype[2];
|
||||
} snap_ether;
|
||||
} ctl;
|
||||
};
|
||||
|
||||
#define llcui ctl.snap.snap_ui
|
||||
#define llcpi ctl.snap.snap_pi
|
||||
#define llc_orgcode ctl.snap_ether.snap_orgcode
|
||||
#define llc_ethertype ctl.snap_ether.snap_ethertype
|
||||
#define llcis ctl.is_ctl
|
||||
#define llcu ctl.u_ctl
|
||||
|
||||
#define LLC_U_FMT 3
|
||||
#define LLC_GSAP 1
|
||||
#define LLC_S_FMT 1
|
||||
@ -144,4 +113,3 @@ struct llc {
|
||||
#define PID_RFC2684_802_6_FCS 0x0005 /* 802.6, with FCS */
|
||||
#define PID_RFC2684_802_6_NOFCS 0x000b /* 802.6, without FCS */
|
||||
#define PID_RFC2684_BPDU 0x000e /* BPDUs */
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.4 2005/04/06 20:13:13 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/oui.c,v 1.4.2.1 2005/04/17 01:20:56 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -31,20 +31,39 @@ static const char rcsid[] _U_ =
|
||||
struct tok oui_values[] = {
|
||||
{ OUI_ENCAP_ETHER, "Ethernet" },
|
||||
{ OUI_CISCO, "Cisco" },
|
||||
{ OUI_NORTEL, "Nortel Networks SONMP" },
|
||||
{ OUI_CISCO_90, "Cisco bridged" },
|
||||
{ OUI_RFC2684, "Ethernet bridged" },
|
||||
{ OUI_ATM_FORUM, "ATM Forum" },
|
||||
{ OUI_CABLE_BPDU, "DOCSIS Spanning Tree" },
|
||||
{ OUI_APPLETALK, "Appletalk" },
|
||||
{ OUI_JUNIPER, "Juniper"},
|
||||
{ OUI_JUNIPER, "Juniper" },
|
||||
{ OUI_HP, "Hewlett-Packard" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* list taken from ethereal/packet-radius.c */
|
||||
|
||||
/*
|
||||
* SMI Network Management Private Enterprise Codes for organizations.
|
||||
*
|
||||
* XXX - these also appear in FreeRadius dictionary files, with items such
|
||||
* as
|
||||
*
|
||||
* VENDOR Cisco 9
|
||||
*
|
||||
* List taken from Ethereal's epan/sminmpec.c.
|
||||
*/
|
||||
struct tok smi_values[] = {
|
||||
{ SMI_IETF, "IETF (reserved)"},
|
||||
{ SMI_ACC, "ACC"},
|
||||
{ SMI_CISCO, "Cisco"},
|
||||
{ SMI_HEWLETT_PACKARD, "Hewlett Packard"},
|
||||
{ SMI_SUN_MICROSYSTEMS, "Sun Microsystems"},
|
||||
{ SMI_MERIT, "Merit"},
|
||||
{ SMI_SHIVA, "Shiva"},
|
||||
{ SMI_MICROSOFT, "Microsoft"},
|
||||
{ SMI_ERICSSON, "Ericsson AB"},
|
||||
{ SMI_CISCO_VPN5000, "Cisco VPN 5000"},
|
||||
{ SMI_LIVINGSTON, "Livingston"},
|
||||
{ SMI_MICROSOFT, "Microsoft"},
|
||||
{ SMI_3COM, "3Com"},
|
||||
{ SMI_ASCEND, "Ascend"},
|
||||
{ SMI_BAY, "Bay Networks"},
|
||||
@ -53,14 +72,24 @@ struct tok smi_values[] = {
|
||||
{ SMI_REDBACK, "Redback"},
|
||||
{ SMI_JUNIPER, "Juniper Networks"},
|
||||
{ SMI_APTIS, "Aptis"},
|
||||
{ SMI_CISCO_VPN3000, "Cisco VPN 3000"},
|
||||
{ SMI_COSINE, "CoSine Communications"},
|
||||
{ SMI_NETSCREEN, "Netscreen"},
|
||||
{ SMI_SHASTA, "Shasta"},
|
||||
{ SMI_NOMADIX, "Nomadix"},
|
||||
{ SMI_SIEMENS, "Siemens"},
|
||||
{ SMI_CABLELABS, "CableLabs"},
|
||||
{ SMI_UNISPHERE, "Unisphere Networks"},
|
||||
{ SMI_CISCO_BBSM, "Cisco BBSM"},
|
||||
{ SMI_THE3GPP2, "3rd Generation Partnership Project 2 (3GPP2)"},
|
||||
{ SMI_IP_UNPLUGGED, "ipUnplugged"},
|
||||
{ SMI_ISSANNI, "Issanni Communications"},
|
||||
{ SMI_QUINTUM, "Quintum"},
|
||||
{ SMI_INTERLINK, "Interlink"},
|
||||
{ SMI_COLUBRIS, "Colubris"},
|
||||
{ SMI_COLUMBIA_UNIVERSITY, "Columbia University"},
|
||||
{ SMI_THE3GPP, "3GPP"},
|
||||
{ 0, NULL }
|
||||
{ SMI_GEMTEK_SYSTEMS, "Gemtek-Systems"},
|
||||
{ SMI_WIFI_ALLIANCE, "Wi-Fi Alliance"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.3 2005/04/06 20:13:13 hannes Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/oui.h,v 1.3.2.1 2005/04/17 01:20:56 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
@ -19,14 +19,34 @@ extern struct tok smi_values[];
|
||||
|
||||
#define OUI_ENCAP_ETHER 0x000000 /* encapsulated Ethernet */
|
||||
#define OUI_CISCO 0x00000c /* Cisco protocols */
|
||||
#define OUI_NORTEL 0x000081 /* Nortel SONMP */
|
||||
#define OUI_CISCO_90 0x0000f8 /* Cisco bridging */
|
||||
#define OUI_RFC2684 0x0080c2 /* RFC 2684 bridged Ethernet */
|
||||
#define OUI_RFC2684 0x0080c2 /* RFC 2427/2684 bridged Ethernet */
|
||||
#define OUI_ATM_FORUM 0x00A03E /* ATM Forum */
|
||||
#define OUI_CABLE_BPDU 0x00E02F /* DOCSIS spanning tree BPDU */
|
||||
#define OUI_APPLETALK 0x080007 /* Appletalk */
|
||||
#define OUI_JUNIPER 0x009069 /* Juniper */
|
||||
#define OUI_HP 0x080009 /* Hewlett-Packard */
|
||||
|
||||
/*
|
||||
* These are SMI Network Management Private Enterprise Codes for
|
||||
* organizations; see
|
||||
*
|
||||
* http://www.iana.org/assignments/enterprise-numbers
|
||||
*
|
||||
* for a list.
|
||||
*
|
||||
* List taken from Ethereal's epan/sminmpec.h.
|
||||
*/
|
||||
#define SMI_IETF 0 /* reserved - used by the IETF in L2TP? */
|
||||
#define SMI_ACC 5
|
||||
#define SMI_CISCO 9
|
||||
#define SMI_HEWLETT_PACKARD 11
|
||||
#define SMI_SUN_MICROSYSTEMS 42
|
||||
#define SMI_MERIT 61
|
||||
#define SMI_SHIVA 166
|
||||
#define SMI_ERICSSON 193
|
||||
#define SMI_CISCO_VPN5000 255
|
||||
#define SMI_LIVINGSTON 307
|
||||
#define SMI_MICROSOFT 311
|
||||
#define SMI_3COM 429
|
||||
@ -37,12 +57,22 @@ extern struct tok smi_values[];
|
||||
#define SMI_REDBACK 2352
|
||||
#define SMI_JUNIPER 2636
|
||||
#define SMI_APTIS 2637
|
||||
#define SMI_CISCO_VPN3000 3076
|
||||
#define SMI_COSINE 3085
|
||||
#define SMI_SHASTA 3199
|
||||
#define SMI_NETSCREEN 3224
|
||||
#define SMI_NOMADIX 3309
|
||||
#define SMI_SIEMENS 4329
|
||||
#define SMI_CABLELABS 4491
|
||||
#define SMI_UNISPHERE 4874
|
||||
#define SMI_CISCO_BBSM 5263
|
||||
#define SMI_THE3GPP2 5535
|
||||
#define SMI_IP_UNPLUGGED 5925
|
||||
#define SMI_ISSANNI 5948
|
||||
#define SMI_QUINTUM 6618
|
||||
#define SMI_INTERLINK 6728
|
||||
#define SMI_COLUBRIS 8744
|
||||
#define SMI_COLUMBIA_UNIVERSITY 11862
|
||||
#define SMI_THE3GPP 10415
|
||||
#define SMI_GEMTEK_SYSTEMS 10529
|
||||
#define SMI_WIFI_ALLIANCE 14122
|
||||
|
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.2 2003/11/18 23:09:42 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/pcap-missing.h,v 1.2.2.1 2005/06/03 22:10:16 guy Exp $ (LBL)
|
||||
*/
|
||||
|
||||
#ifndef tcpdump_pcap_missing_h
|
||||
@ -44,6 +44,10 @@ extern const char *pcap_datalink_val_to_name(int);
|
||||
extern const char *pcap_datalink_val_to_description(int);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PCAP_DUMP_FTELL
|
||||
extern long pcap_dump_ftell(pcap_dumper_t *);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
36
contrib/tcpdump/pcap_dump_ftell.c
Normal file
36
contrib/tcpdump/pcap_dump_ftell.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code distributions
|
||||
* retain the above copyright notice and this paragraph in its entirety, (2)
|
||||
* distributions including binary code include the above copyright notice and
|
||||
* this paragraph in its entirety in the documentation or other materials
|
||||
* provided with the distribution, and (3) all advertising materials mentioning
|
||||
* features or use of this software display the following acknowledgement:
|
||||
* ``This product includes software developed by the University of California,
|
||||
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
||||
* the University nor the names of its contributors may be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/pcap_dump_ftell.c,v 1.1.2.1 2005/06/03 22:10:17 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
#include "pcap-missing.h"
|
||||
|
||||
long
|
||||
pcap_dump_ftell(pcap_dumper_t *p)
|
||||
{
|
||||
return (ftell((FILE *)p));
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.1 2004/12/27 00:41:30 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/pmap_prot.h,v 1.1.2.2 2005/04/27 21:44:06 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
@ -69,26 +69,21 @@
|
||||
* The service supports remote procedure calls on udp/ip or tcp/ip socket 111.
|
||||
*/
|
||||
|
||||
#ifndef _RPC_PMAPPROT_H
|
||||
#define _RPC_PMAPPROT_H
|
||||
#define SUNRPC_PMAPPORT ((u_int16_t)111)
|
||||
#define SUNRPC_PMAPPROG ((u_int32_t)100000)
|
||||
#define SUNRPC_PMAPVERS ((u_int32_t)2)
|
||||
#define SUNRPC_PMAPVERS_PROTO ((u_int32_t)2)
|
||||
#define SUNRPC_PMAPVERS_ORIG ((u_int32_t)1)
|
||||
#define SUNRPC_PMAPPROC_NULL ((u_int32_t)0)
|
||||
#define SUNRPC_PMAPPROC_SET ((u_int32_t)1)
|
||||
#define SUNRPC_PMAPPROC_UNSET ((u_int32_t)2)
|
||||
#define SUNRPC_PMAPPROC_GETPORT ((u_int32_t)3)
|
||||
#define SUNRPC_PMAPPROC_DUMP ((u_int32_t)4)
|
||||
#define SUNRPC_PMAPPROC_CALLIT ((u_int32_t)5)
|
||||
|
||||
#define PMAPPORT ((u_int16_t)111)
|
||||
#define PMAPPROG ((u_int32_t)100000)
|
||||
#define PMAPVERS ((u_int32_t)2)
|
||||
#define PMAPVERS_PROTO ((u_int32_t)2)
|
||||
#define PMAPVERS_ORIG ((u_int32_t)1)
|
||||
#define PMAPPROC_NULL ((u_int32_t)0)
|
||||
#define PMAPPROC_SET ((u_int32_t)1)
|
||||
#define PMAPPROC_UNSET ((u_int32_t)2)
|
||||
#define PMAPPROC_GETPORT ((u_int32_t)3)
|
||||
#define PMAPPROC_DUMP ((u_int32_t)4)
|
||||
#define PMAPPROC_CALLIT ((u_int32_t)5)
|
||||
|
||||
struct pmap {
|
||||
struct sunrpc_pmap {
|
||||
u_int32_t pm_prog;
|
||||
u_int32_t pm_vers;
|
||||
u_int32_t pm_prot;
|
||||
u_int32_t pm_port;
|
||||
};
|
||||
|
||||
#endif /* !_RPC_PMAPPROT_H */
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31 2004/11/04 07:35:53 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.1 2005/04/20 19:32:41 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -1100,7 +1100,8 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
|
||||
next_present = present & (present - 1);
|
||||
|
||||
/* extract the least significant bit that is set */
|
||||
bit = bit0 + BITNO_32(present ^ next_present);
|
||||
bit = (enum ieee80211_radiotap_type)
|
||||
(bit0 + BITNO_32(present ^ next_present));
|
||||
|
||||
if (print_radiotap_field(&cpacker, bit) != 0)
|
||||
goto out;
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38 2005/01/19 16:46:27 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38.2.2 2005/06/20 07:45:06 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -257,7 +257,7 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
|
||||
|
||||
case OAMF4SC: /* fall through */
|
||||
case OAMF4EC:
|
||||
oam_print(p, length);
|
||||
oam_print(p, length, ATM_OAM_HEC);
|
||||
return;
|
||||
|
||||
case METAC:
|
||||
@ -288,13 +288,13 @@ atm_print(u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length,
|
||||
}
|
||||
|
||||
int
|
||||
oam_print (const u_char *p, u_int length) {
|
||||
oam_print (const u_char *p, u_int length, u_int hec) {
|
||||
|
||||
u_int16_t cell_header, cell_type, func_type,vpi,vci,payload,clp;
|
||||
|
||||
cell_header = EXTRACT_32BITS(p);
|
||||
cell_type = ((*(p+4))>>4) & 0x0f;
|
||||
func_type = *(p) & 0x0f;
|
||||
cell_type = ((*(p+4+hec))>>4) & 0x0f;
|
||||
func_type = *(p+4+hec) & 0x0f;
|
||||
|
||||
vpi = (cell_header>>20)&0xff;
|
||||
vci = (cell_header>>4)&0xffff;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bfd.c,v 1.5 2003/11/16 09:36:14 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bfd.c,v 1.5.2.4 2005/04/28 09:28:47 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -34,7 +34,7 @@ static const char rcsid[] _U_ =
|
||||
#include "udp.h"
|
||||
|
||||
/*
|
||||
* Control packet, draft-katz-ward-bfd-01.txt
|
||||
* Control packet, BFDv0, draft-katz-ward-bfd-01.txt
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
@ -53,6 +53,26 @@ static const char rcsid[] _U_ =
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
/*
|
||||
* Control packet, BFDv1, draft-ietf-bfd-base-02.txt
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* |Vers | Diag |Sta|P|F|C|A|D|R| Detect Mult | Length |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | My Discriminator |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Your Discriminator |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Desired Min TX Interval |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Required Min RX Interval |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Required Min Echo RX Interval |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
struct bfd_header_t {
|
||||
u_int8_t version_diag;
|
||||
u_int8_t flags;
|
||||
@ -65,6 +85,32 @@ struct bfd_header_t {
|
||||
u_int8_t required_min_echo_interval[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* An optional Authentication Header may be present
|
||||
*
|
||||
* 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
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Auth Type | Auth Len | Authentication Data... |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
struct bfd_auth_header_t {
|
||||
u_int8_t auth_type;
|
||||
u_int8_t auth_len;
|
||||
u_int8_t auth_data;
|
||||
};
|
||||
|
||||
static const struct tok bfd_v1_authentication_values[] = {
|
||||
{ 0, "Reserved" },
|
||||
{ 1, "Simple Password" },
|
||||
{ 2, "Keyed MD5" },
|
||||
{ 3, "Meticulous Keyed MD5" },
|
||||
{ 4, "Keyed SHA1" },
|
||||
{ 5, "Meticulous Keyed SHA1" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define BFD_EXTRACT_VERSION(x) (((x)&0xe0)>>5)
|
||||
#define BFD_EXTRACT_DIAG(x) ((x)&0x1f)
|
||||
|
||||
@ -84,10 +130,11 @@ static const struct tok bfd_diag_values[] = {
|
||||
{ 5, "Path Down" },
|
||||
{ 6, "Concatenated Path Down" },
|
||||
{ 7, "Administratively Down" },
|
||||
{ 8, "Reverse Concatenated Path Down" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok bfd_flag_values[] = {
|
||||
static const struct tok bfd_v0_flag_values[] = {
|
||||
{ 0x80, "I Hear You" },
|
||||
{ 0x40, "Demand" },
|
||||
{ 0x20, "Poll" },
|
||||
@ -99,34 +146,58 @@ static const struct tok bfd_flag_values[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define BFD_FLAG_AUTH 0x04
|
||||
|
||||
static const struct tok bfd_v1_flag_values[] = {
|
||||
{ 0x20, "Poll" },
|
||||
{ 0x10, "Final" },
|
||||
{ 0x08, "Control Plane Independent" },
|
||||
{ BFD_FLAG_AUTH, "Authentication Present" },
|
||||
{ 0x02, "Demand" },
|
||||
{ 0x01, "Reserved" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok bfd_v1_state_values[] = {
|
||||
{ 0, "AdminDown" },
|
||||
{ 1, "Down" },
|
||||
{ 2, "Init" },
|
||||
{ 3, "Up" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
void
|
||||
bfd_print(register const u_char *pptr, register u_int len, register u_int port)
|
||||
{
|
||||
const struct bfd_header_t *bfd_header;
|
||||
const struct bfd_auth_header_t *bfd_auth_header;
|
||||
u_int8_t version;
|
||||
|
||||
bfd_header = (const struct bfd_header_t *)pptr;
|
||||
TCHECK(*bfd_header);
|
||||
version = BFD_EXTRACT_VERSION(bfd_header->version_diag);
|
||||
|
||||
switch (port) {
|
||||
switch (port << 8 | version) {
|
||||
|
||||
case BFD_CONTROL_PORT:
|
||||
/* BFDv0 */
|
||||
case (BFD_CONTROL_PORT << 8):
|
||||
if (vflag < 1 )
|
||||
{
|
||||
printf("BFDv%u, %s, Flags: [%s], length: %u",
|
||||
BFD_EXTRACT_VERSION(bfd_header->version_diag),
|
||||
version,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
bittok2str(bfd_flag_values, "none", bfd_header->flags),
|
||||
bittok2str(bfd_v0_flag_values, "none", bfd_header->flags),
|
||||
len);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("BFDv%u, length: %u\n\t%s, Flags: [%s], Diagnostic: %s (0x%02x)",
|
||||
BFD_EXTRACT_VERSION(bfd_header->version_diag),
|
||||
version,
|
||||
len,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
bittok2str(bfd_flag_values, "none", bfd_header->flags),
|
||||
bittok2str(bfd_v0_flag_values, "none", bfd_header->flags),
|
||||
tok2str(bfd_diag_values,"unknown",BFD_EXTRACT_DIAG(bfd_header->version_diag)),
|
||||
BFD_EXTRACT_DIAG(bfd_header->version_diag));
|
||||
BFD_EXTRACT_DIAG(bfd_header->version_diag));
|
||||
|
||||
printf("\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
|
||||
bfd_header->detect_time_multiplier,
|
||||
@ -141,7 +212,55 @@ bfd_print(register const u_char *pptr, register u_int len, register u_int port)
|
||||
printf("\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000);
|
||||
break;
|
||||
|
||||
case BFD_ECHO_PORT: /* not yet supported - fall through */
|
||||
/* BFDv1 */
|
||||
case (BFD_CONTROL_PORT << 8 | 1):
|
||||
if (vflag < 1 )
|
||||
{
|
||||
printf("BFDv%u, %s, State %s, Flags: [%s], length: %u",
|
||||
version,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
tok2str(bfd_v1_state_values, "unknown (%u)", bfd_header->flags & 0xc0),
|
||||
bittok2str(bfd_v1_flag_values, "none", bfd_header->flags & 0x3f),
|
||||
len);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("BFDv%u, length: %u\n\t%s, State %s, Flags: [%s], Diagnostic: %s (0x%02x)",
|
||||
version,
|
||||
len,
|
||||
tok2str(bfd_port_values, "unknown (%u)", port),
|
||||
tok2str(bfd_v1_state_values, "unknown (%u)", (bfd_header->flags & 0xc0) >> 6),
|
||||
bittok2str(bfd_v1_flag_values, "none", bfd_header->flags & 0x3f),
|
||||
tok2str(bfd_diag_values,"unknown",BFD_EXTRACT_DIAG(bfd_header->version_diag)),
|
||||
BFD_EXTRACT_DIAG(bfd_header->version_diag));
|
||||
|
||||
printf("\n\tDetection Timer Multiplier: %u (%u ms Detection time), BFD Length: %u",
|
||||
bfd_header->detect_time_multiplier,
|
||||
bfd_header->detect_time_multiplier * EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000,
|
||||
bfd_header->length);
|
||||
|
||||
|
||||
printf("\n\tMy Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->my_discriminator));
|
||||
printf(", Your Discriminator: 0x%08x", EXTRACT_32BITS(bfd_header->your_discriminator));
|
||||
printf("\n\t Desired min Tx Interval: %4u ms", EXTRACT_32BITS(bfd_header->desired_min_tx_interval)/1000);
|
||||
printf("\n\t Required min Rx Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_rx_interval)/1000);
|
||||
printf("\n\t Required min Echo Interval: %4u ms", EXTRACT_32BITS(bfd_header->required_min_echo_interval)/1000);
|
||||
|
||||
if (bfd_header->flags & BFD_FLAG_AUTH) {
|
||||
pptr += sizeof (const struct bfd_header_t);
|
||||
bfd_auth_header = (const struct bfd_auth_header_t *)pptr;
|
||||
TCHECK2(*bfd_auth_header, sizeof(const struct bfd_auth_header_t));
|
||||
printf("\n\t%s (%u) Authentication, length %u present",
|
||||
tok2str(bfd_v1_authentication_values,"Unknown",bfd_auth_header->auth_type),
|
||||
bfd_auth_header->auth_type,
|
||||
bfd_auth_header->auth_len);
|
||||
}
|
||||
break;
|
||||
|
||||
/* BFDv0 */
|
||||
case (BFD_ECHO_PORT << 8): /* not yet supported - fall through */
|
||||
/* BFDv1 */
|
||||
case (BFD_ECHO_PORT << 8 | 1):
|
||||
|
||||
default:
|
||||
printf("BFD, %s, length: %u",
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.91 2005/03/27 01:31:25 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.91.2.6 2005/06/03 07:31:43 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
@ -772,14 +772,13 @@ decode_labeled_vpn_prefix6(const u_char *pptr, char *buf, u_int buflen)
|
||||
#endif
|
||||
|
||||
static int
|
||||
decode_labeled_clnp_prefix(const u_char *pptr, char *buf, u_int buflen)
|
||||
decode_clnp_prefix(const u_char *pptr, char *buf, u_int buflen)
|
||||
{
|
||||
u_int8_t addr[19];
|
||||
u_int plen;
|
||||
|
||||
TCHECK(pptr[0]);
|
||||
plen = pptr[0]; /* get prefix length */
|
||||
plen-=24; /* adjust prefixlen - labellength */
|
||||
|
||||
if (152 < plen)
|
||||
return -1;
|
||||
@ -791,14 +790,11 @@ decode_labeled_clnp_prefix(const u_char *pptr, char *buf, u_int buflen)
|
||||
addr[(plen + 7) / 8 - 1] &=
|
||||
((0xff00 >> (plen % 8)) & 0xff);
|
||||
}
|
||||
/* the label may get offsetted by 4 bits so lets shift it right */
|
||||
snprintf(buf, buflen, "%s/%d, label:%u %s",
|
||||
isonsap_string(addr,(plen + 7) / 8 - 1),
|
||||
plen,
|
||||
EXTRACT_24BITS(pptr+1)>>4,
|
||||
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
|
||||
snprintf(buf, buflen, "%s/%d",
|
||||
isonsap_string(addr,(plen + 7) / 8),
|
||||
plen);
|
||||
|
||||
return 4 + (plen + 7) / 8;
|
||||
return 1 + (plen + 7) / 8;
|
||||
|
||||
trunc:
|
||||
return -2;
|
||||
@ -828,7 +824,7 @@ decode_labeled_vpn_clnp_prefix(const u_char *pptr, char *buf, u_int buflen)
|
||||
/* the label may get offsetted by 4 bits so lets shift it right */
|
||||
snprintf(buf, buflen, "RD: %s, %s/%d, label:%u %s",
|
||||
bgp_vpn_rd_print(pptr+4),
|
||||
isonsap_string(addr,(plen + 7) / 8 - 1),
|
||||
isonsap_string(addr,(plen + 7) / 8),
|
||||
plen,
|
||||
EXTRACT_24BITS(pptr+1)>>4,
|
||||
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
|
||||
@ -844,7 +840,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
{
|
||||
int i;
|
||||
u_int16_t af;
|
||||
u_int8_t safi, snpa;
|
||||
u_int8_t safi, snpa, nhlen;
|
||||
union { /* copy buffer for bandwidth values */
|
||||
float f;
|
||||
u_int32_t i;
|
||||
@ -1024,6 +1020,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
case (AFNUM_L2VPN<<8 | SAFNUM_VPNUNIMULTICAST):
|
||||
break;
|
||||
default:
|
||||
TCHECK2(tptr[0], tlen);
|
||||
printf("\n\t no AFI %u / SAFI %u decoder",af,safi);
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(tptr,"\n\t ",tlen);
|
||||
@ -1034,7 +1031,8 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
tptr +=3;
|
||||
|
||||
TCHECK(tptr[0]);
|
||||
tlen = tptr[0];
|
||||
nhlen = tptr[0];
|
||||
tlen = nhlen;
|
||||
tptr++;
|
||||
|
||||
if (tlen) {
|
||||
@ -1160,6 +1158,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(", nh-length: %u", nhlen);
|
||||
tptr += tlen;
|
||||
|
||||
TCHECK(tptr[0]);
|
||||
@ -1275,7 +1274,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
|
||||
case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
|
||||
case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
|
||||
advance = decode_labeled_clnp_prefix(tptr, buf, sizeof(buf));
|
||||
advance = decode_clnp_prefix(tptr, buf, sizeof(buf));
|
||||
if (advance == -1)
|
||||
printf("\n\t (illegal prefix length)");
|
||||
else if (advance == -2)
|
||||
@ -1303,8 +1302,8 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
tptr = pptr + len;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
if (advance < 0)
|
||||
break;
|
||||
tptr += advance;
|
||||
}
|
||||
done:
|
||||
@ -1409,7 +1408,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
|
||||
case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
|
||||
case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
|
||||
advance = decode_labeled_clnp_prefix(tptr, buf, sizeof(buf));
|
||||
advance = decode_clnp_prefix(tptr, buf, sizeof(buf));
|
||||
if (advance == -1)
|
||||
printf("\n\t (illegal prefix length)");
|
||||
else if (advance == -2)
|
||||
@ -1437,7 +1436,8 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
tptr = pptr + len;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
if (advance < 0)
|
||||
break;
|
||||
tptr += advance;
|
||||
}
|
||||
break;
|
||||
@ -1518,6 +1518,7 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
EXTRACT_16BITS(tptr+4));
|
||||
break;
|
||||
default:
|
||||
TCHECK2(*tptr,8);
|
||||
print_unknown_data(tptr,"\n\t ",8);
|
||||
break;
|
||||
}
|
||||
@ -1575,8 +1576,10 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
|
||||
print_unknown_data(pptr,"\n\t ",len);
|
||||
break;
|
||||
}
|
||||
if (vflag > 1 && len) /* omit zero length attributes*/
|
||||
if (vflag > 1 && len) { /* omit zero length attributes*/
|
||||
TCHECK2(*pptr,len);
|
||||
print_unknown_data(pptr,"\n\t ",len);
|
||||
}
|
||||
return 1;
|
||||
|
||||
trunc:
|
||||
@ -1588,7 +1591,6 @@ bgp_open_print(const u_char *dat, int length)
|
||||
{
|
||||
struct bgp_open bgpo;
|
||||
struct bgp_opt bgpopt;
|
||||
int hlen;
|
||||
const u_char *opt;
|
||||
int i,cap_type,cap_len,tcap_len,cap_offset;
|
||||
char tokbuf[TOKBUFSIZE];
|
||||
@ -1596,7 +1598,6 @@ bgp_open_print(const u_char *dat, int length)
|
||||
|
||||
TCHECK2(dat[0], BGP_OPEN_SIZE);
|
||||
memcpy(&bgpo, dat, BGP_OPEN_SIZE);
|
||||
hlen = ntohs(bgpo.bgpo_len);
|
||||
|
||||
printf("\n\t Version %d, ", bgpo.bgpo_version);
|
||||
printf("my AS %u, ", ntohs(bgpo.bgpo_myas));
|
||||
@ -1676,14 +1677,17 @@ bgp_open_print(const u_char *dat, int length)
|
||||
case BGP_CAPCODE_RR_CISCO:
|
||||
break;
|
||||
default:
|
||||
TCHECK2(opt[i+BGP_OPT_SIZE+2],cap_len);
|
||||
printf("\n\t\tno decoder for Capability %u",
|
||||
cap_type);
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(&opt[i+BGP_OPT_SIZE+2],"\n\t\t",cap_len);
|
||||
break;
|
||||
}
|
||||
if (vflag > 1)
|
||||
if (vflag > 1) {
|
||||
TCHECK2(opt[i+BGP_OPT_SIZE+2],cap_len);
|
||||
print_unknown_data(&opt[i+BGP_OPT_SIZE+2],"\n\t\t",cap_len);
|
||||
}
|
||||
break;
|
||||
case BGP_OPT_AUTH:
|
||||
default:
|
||||
@ -1704,7 +1708,6 @@ bgp_update_print(const u_char *dat, int length)
|
||||
{
|
||||
struct bgp bgp;
|
||||
struct bgp_attr bgpa;
|
||||
int hlen;
|
||||
const u_char *p;
|
||||
int len;
|
||||
int i;
|
||||
@ -1712,7 +1715,6 @@ bgp_update_print(const u_char *dat, int length)
|
||||
|
||||
TCHECK2(dat[0], BGP_SIZE);
|
||||
memcpy(&bgp, dat, BGP_SIZE);
|
||||
hlen = ntohs(bgp.bgp_len);
|
||||
p = dat + BGP_SIZE; /*XXX*/
|
||||
|
||||
/* Unfeasible routes */
|
||||
@ -1794,7 +1796,7 @@ bgp_update_print(const u_char *dat, int length)
|
||||
p += 2 + len;
|
||||
|
||||
if (dat + length > p) {
|
||||
printf("\n\t Updated routes:");
|
||||
printf("\n\t Updated routes:");
|
||||
while (dat + length > p) {
|
||||
char buf[MAXHOSTNAMELEN + 100];
|
||||
i = decode_prefix4(p, buf, sizeof(buf));
|
||||
@ -1818,14 +1820,12 @@ static void
|
||||
bgp_notification_print(const u_char *dat, int length)
|
||||
{
|
||||
struct bgp_notification bgpn;
|
||||
int hlen;
|
||||
const u_char *tptr;
|
||||
char tokbuf[TOKBUFSIZE];
|
||||
char tokbuf2[TOKBUFSIZE];
|
||||
|
||||
TCHECK2(dat[0], BGP_NOTIFICATION_SIZE);
|
||||
memcpy(&bgpn, dat, BGP_NOTIFICATION_SIZE);
|
||||
hlen = ntohs(bgpn.bgpn_len);
|
||||
|
||||
/* some little sanity checking */
|
||||
if (length<BGP_NOTIFICATION_SIZE)
|
||||
@ -1899,6 +1899,12 @@ bgp_route_refresh_print(const u_char *pptr, int len) {
|
||||
char tokbuf[TOKBUFSIZE];
|
||||
char tokbuf2[TOKBUFSIZE];
|
||||
|
||||
TCHECK2(pptr[0], BGP_ROUTE_REFRESH_SIZE);
|
||||
|
||||
/* some little sanity checking */
|
||||
if (len<BGP_ROUTE_REFRESH_SIZE)
|
||||
return;
|
||||
|
||||
bgp_route_refresh_header = (const struct bgp_route_refresh *)pptr;
|
||||
|
||||
printf("\n\t AFI %s (%u), SAFI %s (%u)",
|
||||
@ -1913,10 +1919,14 @@ bgp_route_refresh_print(const u_char *pptr, int len) {
|
||||
tokbuf2, sizeof(tokbuf2)),
|
||||
bgp_route_refresh_header->safi);
|
||||
|
||||
if (vflag > 1)
|
||||
if (vflag > 1) {
|
||||
TCHECK2(*pptr, len);
|
||||
print_unknown_data(pptr,"\n\t ", len);
|
||||
}
|
||||
|
||||
return;
|
||||
trunc:
|
||||
printf("[|BGP]");
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1949,9 +1959,10 @@ bgp_header_print(const u_char *dat, int length)
|
||||
bgp_route_refresh_print(dat, length);
|
||||
break;
|
||||
default:
|
||||
/* we have no decoder for the BGP message */
|
||||
printf("\n\t no Message %u decoder",bgp.bgp_type);
|
||||
print_unknown_data(dat,"\n\t ",length);
|
||||
/* we have no decoder for the BGP message */
|
||||
TCHECK2(*dat, length);
|
||||
printf("\n\t no Message %u decoder",bgp.bgp_type);
|
||||
print_unknown_data(dat,"\n\t ",length);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
@ -1985,7 +1996,7 @@ bgp_print(const u_char *dat, int length)
|
||||
|
||||
p = dat;
|
||||
start = p;
|
||||
while (p < snapend) {
|
||||
while (p < ep) {
|
||||
if (!TTEST2(p[0], 1))
|
||||
break;
|
||||
if (p[0] != 0xff) {
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78 2004/03/02 07:38:10 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78.2.2 2005/05/06 04:19:39 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -444,7 +444,10 @@ rfc1048_print(register const u_char *bp)
|
||||
case 'a':
|
||||
/* ascii strings */
|
||||
putchar('"');
|
||||
(void)fn_printn(bp, size, NULL);
|
||||
if (fn_printn(bp, size, snapend)) {
|
||||
putchar('"');
|
||||
goto trunc;
|
||||
}
|
||||
putchar('"');
|
||||
bp += size;
|
||||
size = 0;
|
||||
@ -557,16 +560,20 @@ rfc1048_print(register const u_char *bp)
|
||||
|
||||
case TAG_CLIENT_FQDN:
|
||||
/* option 81 should be at least 4 bytes long */
|
||||
if (len < 4)
|
||||
if (len < 4) {
|
||||
printf("ERROR: options 81 len %u < 4 bytes", len);
|
||||
break;
|
||||
}
|
||||
if (*bp++)
|
||||
printf("[svrreg]");
|
||||
if (*bp)
|
||||
printf("%u/%u/", *bp, *(bp+1));
|
||||
bp += 2;
|
||||
putchar('"');
|
||||
(void)fn_printn(bp, size - 3, NULL);
|
||||
if (fn_printn(bp, size - 3, snapend)) {
|
||||
putchar('"');
|
||||
goto trunc;
|
||||
}
|
||||
putchar('"');
|
||||
bp += size - 3;
|
||||
size = 0;
|
||||
@ -577,7 +584,10 @@ rfc1048_print(register const u_char *bp)
|
||||
size--;
|
||||
if (type == 0) {
|
||||
putchar('"');
|
||||
(void)fn_printn(bp, size, NULL);
|
||||
if (fn_printn(bp, size, snapend)) {
|
||||
putchar('"');
|
||||
goto trunc;
|
||||
}
|
||||
putchar('"');
|
||||
bp += size;
|
||||
size = 0;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32 2005/04/06 21:32:38 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-chdlc.c,v 1.32.2.7 2005/04/27 14:35:56 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -112,45 +112,54 @@ chdlc_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
return (CHDLC_HDRLEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* The fixed-length portion of a SLARP packet.
|
||||
*/
|
||||
struct cisco_slarp {
|
||||
u_int32_t code;
|
||||
u_int8_t code[4];
|
||||
#define SLARP_REQUEST 0
|
||||
#define SLARP_REPLY 1
|
||||
#define SLARP_KEEPALIVE 2
|
||||
union {
|
||||
struct {
|
||||
struct in_addr addr;
|
||||
struct in_addr mask;
|
||||
u_int16_t unused[3];
|
||||
u_int8_t addr[4];
|
||||
u_int8_t mask[4];
|
||||
} addr;
|
||||
struct {
|
||||
u_int32_t myseq;
|
||||
u_int32_t yourseq;
|
||||
u_int16_t rel;
|
||||
u_int16_t t1;
|
||||
u_int16_t t2;
|
||||
u_int8_t myseq[4];
|
||||
u_int8_t yourseq[4];
|
||||
u_int8_t rel[2];
|
||||
} keep;
|
||||
} un;
|
||||
};
|
||||
|
||||
#define SLARP_LEN 18
|
||||
#define SLARP_MIN_LEN 14
|
||||
#define SLARP_MAX_LEN 18
|
||||
|
||||
static void
|
||||
chdlc_slarp_print(const u_char *cp, u_int length)
|
||||
{
|
||||
const struct cisco_slarp *slarp;
|
||||
u_int sec,min,hrs,days;
|
||||
|
||||
if (length < SLARP_LEN)
|
||||
printf("SLARP (length: %u), ",length);
|
||||
if (length < SLARP_MIN_LEN)
|
||||
goto trunc;
|
||||
|
||||
slarp = (const struct cisco_slarp *)cp;
|
||||
TCHECK(*slarp);
|
||||
printf("SLARP (length: %u), ",length);
|
||||
TCHECK2(*slarp, SLARP_MIN_LEN);
|
||||
switch (EXTRACT_32BITS(&slarp->code)) {
|
||||
case SLARP_REQUEST:
|
||||
printf("request");
|
||||
/* ok we do not know it - but lets at least dump it */
|
||||
print_unknown_data(cp+4,"\n\t",length-4);
|
||||
/*
|
||||
* At least according to William "Chops" Westfield's
|
||||
* message in
|
||||
*
|
||||
* http://www.nethelp.no/net/cisco-hdlc.txt
|
||||
*
|
||||
* the address and mask aren't used in requests -
|
||||
* they're just zero.
|
||||
*/
|
||||
break;
|
||||
case SLARP_REPLY:
|
||||
printf("reply %s/%s",
|
||||
@ -158,13 +167,21 @@ chdlc_slarp_print(const u_char *cp, u_int length)
|
||||
ipaddr_string(&slarp->un.addr.mask));
|
||||
break;
|
||||
case SLARP_KEEPALIVE:
|
||||
printf("keepalive: mineseen=0x%08x, yourseen=0x%08x",
|
||||
EXTRACT_32BITS(&slarp->un.keep.myseq),
|
||||
EXTRACT_32BITS(&slarp->un.keep.yourseq));
|
||||
printf(", reliability=0x%04x, t1=%d.%d",
|
||||
EXTRACT_16BITS(&slarp->un.keep.rel),
|
||||
EXTRACT_16BITS(&slarp->un.keep.t1),
|
||||
EXTRACT_16BITS(&slarp->un.keep.t2));
|
||||
printf("keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x",
|
||||
EXTRACT_32BITS(&slarp->un.keep.myseq),
|
||||
EXTRACT_32BITS(&slarp->un.keep.yourseq),
|
||||
EXTRACT_16BITS(&slarp->un.keep.rel));
|
||||
|
||||
if (length >= SLARP_MAX_LEN) { /* uptime-stamp is optional */
|
||||
cp += SLARP_MIN_LEN;
|
||||
if (!TTEST2(*cp, 4))
|
||||
goto trunc;
|
||||
sec = EXTRACT_32BITS(cp) / 1000;
|
||||
min = sec / 60; sec -= min * 60;
|
||||
hrs = min / 60; min -= hrs * 60;
|
||||
days = hrs / 24; hrs -= days * 24;
|
||||
printf(", link uptime=%ud%uh%um%us",days,hrs,min,sec);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("0x%02x unknown", EXTRACT_32BITS(&slarp->code));
|
||||
@ -173,8 +190,8 @@ chdlc_slarp_print(const u_char *cp, u_int length)
|
||||
break;
|
||||
}
|
||||
|
||||
if (SLARP_LEN < length && vflag)
|
||||
printf(", (trailing junk: %d bytes)", length - SLARP_LEN);
|
||||
if (SLARP_MAX_LEN < length && vflag)
|
||||
printf(", (trailing junk: %d bytes)", length - SLARP_MAX_LEN);
|
||||
if (vflag > 1)
|
||||
print_unknown_data(cp+4,"\n\t",length-4);
|
||||
return;
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.16 2003/11/16 09:36:16 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-cnfp.c,v 1.16.2.1 2005/04/20 20:53:39 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -79,16 +79,16 @@ struct nfrec {
|
||||
};
|
||||
|
||||
void
|
||||
cnfp_print(const u_char *cp, const u_char *bp)
|
||||
cnfp_print(const u_char *cp, const u_char *bp _U_)
|
||||
{
|
||||
register const struct nfhdr *nh;
|
||||
register const struct nfrec *nr;
|
||||
register const struct ip *ip;
|
||||
struct protoent *pent;
|
||||
int nrecs, ver;
|
||||
#if 0
|
||||
time_t t;
|
||||
#endif
|
||||
|
||||
ip = (const struct ip *)bp;
|
||||
nh = (const struct nfhdr *)cp;
|
||||
|
||||
if ((const u_char *)(nh + 1) > snapend)
|
||||
@ -96,8 +96,14 @@ cnfp_print(const u_char *cp, const u_char *bp)
|
||||
|
||||
nrecs = EXTRACT_32BITS(&nh->ver_cnt) & 0xffff;
|
||||
ver = (EXTRACT_32BITS(&nh->ver_cnt) & 0xffff0000) >> 16;
|
||||
#if 0
|
||||
/*
|
||||
* This is seconds since the UN*X epoch, and is followed by
|
||||
* nanoseconds. XXX - format it, rather than just dumping the
|
||||
* raw seconds-since-the-Epoch.
|
||||
*/
|
||||
t = EXTRACT_32BITS(&nh->utc_sec);
|
||||
/* (p = ctime(&t))[24] = '\0'; */
|
||||
#endif
|
||||
|
||||
printf("NetFlow v%x, %u.%03u uptime, %u.%09u, ", ver,
|
||||
EXTRACT_32BITS(&nh->msys_uptime)/1000,
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.38 2003/11/16 09:36:17 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-decnet.c,v 1.38.2.1 2005/05/06 02:16:53 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -47,13 +47,13 @@ struct rtentry;
|
||||
#include "addrtoname.h"
|
||||
|
||||
/* Forwards */
|
||||
static void print_decnet_ctlmsg(const union routehdr *, u_int);
|
||||
static int print_decnet_ctlmsg(const union routehdr *, u_int, u_int);
|
||||
static void print_t_info(int);
|
||||
static void print_l1_routes(const char *, u_int);
|
||||
static void print_l2_routes(const char *, u_int);
|
||||
static int print_l1_routes(const char *, u_int);
|
||||
static int print_l2_routes(const char *, u_int);
|
||||
static void print_i_info(int);
|
||||
static void print_elist(const char *, u_int);
|
||||
static void print_nsp(const u_char *, u_int);
|
||||
static int print_elist(const char *, u_int);
|
||||
static int print_nsp(const u_char *, u_int);
|
||||
static void print_reason(int);
|
||||
#ifdef PRINT_NSPDATA
|
||||
static void pdata(u_char *, int);
|
||||
@ -67,11 +67,10 @@ void
|
||||
decnet_print(register const u_char *ap, register u_int length,
|
||||
register u_int caplen)
|
||||
{
|
||||
static union routehdr rhcopy;
|
||||
register union routehdr *rhp = &rhcopy;
|
||||
register const union routehdr *rhp;
|
||||
register int mflags;
|
||||
int dst, src, hops;
|
||||
u_int rhlen, nsplen, pktlen;
|
||||
u_int nsplen, pktlen;
|
||||
const u_char *nspp;
|
||||
|
||||
if (length < sizeof(struct shorthdr)) {
|
||||
@ -79,12 +78,20 @@ decnet_print(register const u_char *ap, register u_int length,
|
||||
return;
|
||||
}
|
||||
|
||||
TCHECK2(*ap, sizeof(short));
|
||||
pktlen = EXTRACT_LE_16BITS(ap);
|
||||
if (pktlen < sizeof(struct shorthdr)) {
|
||||
(void)printf("[|decnet]");
|
||||
return;
|
||||
}
|
||||
if (pktlen > length) {
|
||||
(void)printf("[|decnet]");
|
||||
return;
|
||||
}
|
||||
length = pktlen;
|
||||
|
||||
rhlen = min(length, caplen);
|
||||
rhlen = min(rhlen, sizeof(*rhp));
|
||||
memcpy((char *)rhp, (char *)&(ap[sizeof(short)]), rhlen);
|
||||
|
||||
rhp = (const union routehdr *)&(ap[sizeof(short)]);
|
||||
TCHECK(rhp->rh_short.sh_flags);
|
||||
mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags);
|
||||
|
||||
if (mflags & RMF_PAD) {
|
||||
@ -92,49 +99,57 @@ decnet_print(register const u_char *ap, register u_int length,
|
||||
u_int padlen = mflags & RMF_PADMASK;
|
||||
if (vflag)
|
||||
(void) printf("[pad:%d] ", padlen);
|
||||
if (length < padlen + 2) {
|
||||
(void)printf("[|decnet]");
|
||||
return;
|
||||
}
|
||||
TCHECK2(ap[sizeof(short)], padlen);
|
||||
ap += padlen;
|
||||
length -= padlen;
|
||||
caplen -= padlen;
|
||||
rhlen = min(length, caplen);
|
||||
rhlen = min(rhlen, sizeof(*rhp));
|
||||
memcpy((char *)rhp, (char *)&(ap[sizeof(short)]), rhlen);
|
||||
rhp = (const union routehdr *)&(ap[sizeof(short)]);
|
||||
mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags);
|
||||
}
|
||||
|
||||
if (mflags & RMF_FVER) {
|
||||
(void) printf("future-version-decnet");
|
||||
default_print(ap, length);
|
||||
default_print(ap, min(length, caplen));
|
||||
return;
|
||||
}
|
||||
|
||||
/* is it a control message? */
|
||||
if (mflags & RMF_CTLMSG) {
|
||||
print_decnet_ctlmsg(rhp, min(length, caplen));
|
||||
if (!print_decnet_ctlmsg(rhp, length, caplen))
|
||||
goto trunc;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mflags & RMF_MASK) {
|
||||
case RMF_LONG:
|
||||
if (length < sizeof(struct longhdr)) {
|
||||
(void)printf("[|decnet]");
|
||||
return;
|
||||
}
|
||||
TCHECK(rhp->rh_long);
|
||||
dst =
|
||||
EXTRACT_LE_16BITS(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr);
|
||||
src =
|
||||
EXTRACT_LE_16BITS(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr);
|
||||
hops = EXTRACT_LE_8BITS(rhp->rh_long.lg_visits);
|
||||
nspp = &(ap[sizeof(short) + sizeof(struct longhdr)]);
|
||||
nsplen = min((length - sizeof(struct longhdr)),
|
||||
(caplen - sizeof(struct longhdr)));
|
||||
nsplen = length - sizeof(struct longhdr);
|
||||
break;
|
||||
case RMF_SHORT:
|
||||
TCHECK(rhp->rh_short);
|
||||
dst = EXTRACT_LE_16BITS(rhp->rh_short.sh_dst);
|
||||
src = EXTRACT_LE_16BITS(rhp->rh_short.sh_src);
|
||||
hops = (EXTRACT_LE_8BITS(rhp->rh_short.sh_visits) & VIS_MASK)+1;
|
||||
nspp = &(ap[sizeof(short) + sizeof(struct shorthdr)]);
|
||||
nsplen = min((length - sizeof(struct shorthdr)),
|
||||
(caplen - sizeof(struct shorthdr)));
|
||||
nsplen = length - sizeof(struct shorthdr);
|
||||
break;
|
||||
default:
|
||||
(void) printf("unknown message flags under mask");
|
||||
default_print((u_char *)ap, length);
|
||||
default_print((u_char *)ap, min(length, caplen));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,11 +165,18 @@ decnet_print(register const u_char *ap, register u_int length,
|
||||
(void)printf("%d hops ", hops);
|
||||
}
|
||||
|
||||
print_nsp(nspp, nsplen);
|
||||
if (!print_nsp(nspp, nsplen))
|
||||
goto trunc;
|
||||
return;
|
||||
|
||||
trunc:
|
||||
(void)printf("[|decnet]");
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
print_decnet_ctlmsg(register const union routehdr *rhp, u_int length)
|
||||
static int
|
||||
print_decnet_ctlmsg(register const union routehdr *rhp, u_int length,
|
||||
u_int caplen)
|
||||
{
|
||||
int mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags);
|
||||
register union controlmsg *cmp = (union controlmsg *)rhp;
|
||||
@ -162,10 +184,14 @@ print_decnet_ctlmsg(register const union routehdr *rhp, u_int length)
|
||||
etheraddr srcea, rtea;
|
||||
int priority;
|
||||
char *rhpx = (char *)rhp;
|
||||
int ret;
|
||||
|
||||
switch (mflags & RMF_CTLMASK) {
|
||||
case RMF_INIT:
|
||||
(void)printf("init ");
|
||||
if (length < sizeof(struct initmsg))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_init);
|
||||
src = EXTRACT_LE_16BITS(cmp->cm_init.in_src);
|
||||
info = EXTRACT_LE_8BITS(cmp->cm_init.in_info);
|
||||
blksize = EXTRACT_LE_16BITS(cmp->cm_init.in_blksize);
|
||||
@ -178,35 +204,53 @@ print_decnet_ctlmsg(register const union routehdr *rhp, u_int length)
|
||||
"src %sblksize %d vers %d eco %d ueco %d hello %d",
|
||||
dnaddr_string(src), blksize, vers, eco, ueco,
|
||||
hello);
|
||||
ret = 1;
|
||||
break;
|
||||
case RMF_VER:
|
||||
(void)printf("verification ");
|
||||
if (length < sizeof(struct verifmsg))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_ver);
|
||||
src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src);
|
||||
other = EXTRACT_LE_8BITS(cmp->cm_ver.ve_fcnval);
|
||||
(void)printf("src %s fcnval %o", dnaddr_string(src), other);
|
||||
ret = 1;
|
||||
break;
|
||||
case RMF_TEST:
|
||||
(void)printf("test ");
|
||||
if (length < sizeof(struct testmsg))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_test);
|
||||
src = EXTRACT_LE_16BITS(cmp->cm_test.te_src);
|
||||
other = EXTRACT_LE_8BITS(cmp->cm_test.te_data);
|
||||
(void)printf("src %s data %o", dnaddr_string(src), other);
|
||||
ret = 1;
|
||||
break;
|
||||
case RMF_L1ROUT:
|
||||
(void)printf("lev-1-routing ");
|
||||
if (length < sizeof(struct l1rout))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_l1rou);
|
||||
src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src);
|
||||
(void)printf("src %s ", dnaddr_string(src));
|
||||
print_l1_routes(&(rhpx[sizeof(struct l1rout)]),
|
||||
ret = print_l1_routes(&(rhpx[sizeof(struct l1rout)]),
|
||||
length - sizeof(struct l1rout));
|
||||
break;
|
||||
case RMF_L2ROUT:
|
||||
(void)printf("lev-2-routing ");
|
||||
if (length < sizeof(struct l2rout))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_l2rout);
|
||||
src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src);
|
||||
(void)printf("src %s ", dnaddr_string(src));
|
||||
print_l2_routes(&(rhpx[sizeof(struct l2rout)]),
|
||||
ret = print_l2_routes(&(rhpx[sizeof(struct l2rout)]),
|
||||
length - sizeof(struct l2rout));
|
||||
break;
|
||||
case RMF_RHELLO:
|
||||
(void)printf("router-hello ");
|
||||
if (length < sizeof(struct rhellomsg))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_rhello);
|
||||
vers = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_vers);
|
||||
eco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_eco);
|
||||
ueco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_ueco);
|
||||
@ -222,11 +266,14 @@ print_decnet_ctlmsg(register const union routehdr *rhp, u_int length)
|
||||
"vers %d eco %d ueco %d src %s blksize %d pri %d hello %d",
|
||||
vers, eco, ueco, dnaddr_string(src),
|
||||
blksize, priority, hello);
|
||||
print_elist(&(rhpx[sizeof(struct rhellomsg)]),
|
||||
ret = print_elist(&(rhpx[sizeof(struct rhellomsg)]),
|
||||
length - sizeof(struct rhellomsg));
|
||||
break;
|
||||
case RMF_EHELLO:
|
||||
(void)printf("endnode-hello ");
|
||||
if (length < sizeof(struct ehellomsg))
|
||||
goto trunc;
|
||||
TCHECK(cmp->cm_ehello);
|
||||
vers = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_vers);
|
||||
eco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_eco);
|
||||
ueco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_ueco);
|
||||
@ -246,13 +293,19 @@ print_decnet_ctlmsg(register const union routehdr *rhp, u_int length)
|
||||
"vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o",
|
||||
vers, eco, ueco, dnaddr_string(src),
|
||||
blksize, dnaddr_string(dst), hello, other);
|
||||
ret = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf("unknown control message");
|
||||
default_print((u_char *)rhp, length);
|
||||
default_print((u_char *)rhp, min(length, caplen));
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
return (ret);
|
||||
|
||||
trunc:
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -271,7 +324,7 @@ print_t_info(int info)
|
||||
(void)printf("blo ");
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_l1_routes(const char *rp, u_int len)
|
||||
{
|
||||
int count;
|
||||
@ -280,9 +333,10 @@ print_l1_routes(const char *rp, u_int len)
|
||||
|
||||
/* The last short is a checksum */
|
||||
while (len > (3 * sizeof(short))) {
|
||||
TCHECK2(*rp, 3 * sizeof(short));
|
||||
count = EXTRACT_LE_16BITS(rp);
|
||||
if (count > 1024)
|
||||
return; /* seems to be bogus from here on */
|
||||
return (1); /* seems to be bogus from here on */
|
||||
rp += sizeof(short);
|
||||
len -= sizeof(short);
|
||||
id = EXTRACT_LE_16BITS(rp);
|
||||
@ -294,9 +348,13 @@ print_l1_routes(const char *rp, u_int len)
|
||||
(void)printf("{ids %d-%d cost %d hops %d} ", id, id + count,
|
||||
RI_COST(info), RI_HOPS(info));
|
||||
}
|
||||
return (1);
|
||||
|
||||
trunc:
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_l2_routes(const char *rp, u_int len)
|
||||
{
|
||||
int count;
|
||||
@ -305,9 +363,10 @@ print_l2_routes(const char *rp, u_int len)
|
||||
|
||||
/* The last short is a checksum */
|
||||
while (len > (3 * sizeof(short))) {
|
||||
TCHECK2(*rp, 3 * sizeof(short));
|
||||
count = EXTRACT_LE_16BITS(rp);
|
||||
if (count > 1024)
|
||||
return; /* seems to be bogus from here on */
|
||||
return (1); /* seems to be bogus from here on */
|
||||
rp += sizeof(short);
|
||||
len -= sizeof(short);
|
||||
area = EXTRACT_LE_16BITS(rp);
|
||||
@ -319,6 +378,10 @@ print_l2_routes(const char *rp, u_int len)
|
||||
(void)printf("{areas %d-%d cost %d hops %d} ", area, area + count,
|
||||
RI_COST(info), RI_HOPS(info));
|
||||
}
|
||||
return (1);
|
||||
|
||||
trunc:
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -339,18 +402,22 @@ print_i_info(int info)
|
||||
(void)printf("blo ");
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
print_elist(const char *elp _U_, u_int len _U_)
|
||||
{
|
||||
/* Not enough examples available for me to debug this */
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
static int
|
||||
print_nsp(const u_char *nspp, u_int nsplen)
|
||||
{
|
||||
const struct nsphdr *nsphp = (struct nsphdr *)nspp;
|
||||
int dst, src, flags;
|
||||
|
||||
if (nsplen < sizeof(struct nsphdr))
|
||||
goto trunc;
|
||||
TCHECK(*nsphp);
|
||||
flags = EXTRACT_LE_8BITS(nsphp->nh_flags);
|
||||
dst = EXTRACT_LE_16BITS(nsphp->nh_dst);
|
||||
src = EXTRACT_LE_16BITS(nsphp->nh_src);
|
||||
@ -371,27 +438,39 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
#endif
|
||||
u_int data_off = sizeof(struct minseghdr);
|
||||
|
||||
if (nsplen < data_off)
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[0]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
(void)printf("nak %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("ack %d ", ack & SGQ_MASK);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
|
||||
data_off += sizeof(short);
|
||||
if (nsplen < data_off)
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[1]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
|
||||
if (ack & SGQ_OACK) { /* ackoth field */
|
||||
if ((ack & SGQ_ONAK) == SGQ_ONAK)
|
||||
(void)printf("onak %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("oack %d ", ack & SGQ_MASK);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
|
||||
data_off += sizeof(short);
|
||||
if (nsplen < data_off)
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[2]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
|
||||
}
|
||||
}
|
||||
(void)printf("seg %d ", ack & SGQ_MASK);
|
||||
#ifdef PRINT_NSPDATA
|
||||
dp = &(nspp[data_off]);
|
||||
pdata(dp, 10);
|
||||
if (nsplen > data_off) {
|
||||
dp = &(nspp[data_off]);
|
||||
TCHECK2(*dp, nsplen - data_off);
|
||||
pdata(dp, nsplen - data_off);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@ -405,27 +484,39 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
#endif
|
||||
u_int data_off = sizeof(struct minseghdr);
|
||||
|
||||
if (nsplen < data_off)
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[0]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
(void)printf("nak %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("ack %d ", ack & SGQ_MASK);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
|
||||
data_off += sizeof(short);
|
||||
if (nsplen < data_off)
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[1]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
|
||||
if (ack & SGQ_OACK) { /* ackdat field */
|
||||
if ((ack & SGQ_ONAK) == SGQ_ONAK)
|
||||
(void)printf("nakdat %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("ackdat %d ", ack & SGQ_MASK);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
|
||||
data_off += sizeof(short);
|
||||
if (nsplen < data_off)
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[2]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
|
||||
}
|
||||
}
|
||||
(void)printf("seg %d ", ack & SGQ_MASK);
|
||||
#ifdef PRINT_NSPDATA
|
||||
dp = &(nspp[data_off]);
|
||||
pdata(dp, 10);
|
||||
if (nsplen > data_off) {
|
||||
dp = &(nspp[data_off]);
|
||||
TCHECK2(*dp, nsplen - data_off);
|
||||
pdata(dp, nsplen - data_off);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@ -438,22 +529,28 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
int ack;
|
||||
int lsflags, fcval;
|
||||
|
||||
if (nsplen < sizeof(struct seghdr) + sizeof(struct lsmsg))
|
||||
goto trunc;
|
||||
TCHECK(shp->sh_seq[0]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
(void)printf("nak %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("ack %d ", ack & SGQ_MASK);
|
||||
TCHECK(shp->sh_seq[1]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[1]);
|
||||
if (ack & SGQ_OACK) { /* ackdat field */
|
||||
if ((ack & SGQ_ONAK) == SGQ_ONAK)
|
||||
(void)printf("nakdat %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("ackdat %d ", ack & SGQ_MASK);
|
||||
TCHECK(shp->sh_seq[2]);
|
||||
ack = EXTRACT_LE_16BITS(shp->sh_seq[2]);
|
||||
}
|
||||
}
|
||||
(void)printf("seg %d ", ack & SGQ_MASK);
|
||||
TCHECK(*lsmp);
|
||||
lsflags = EXTRACT_LE_8BITS(lsmp->ls_lsflags);
|
||||
fcval = EXTRACT_LE_8BITS(lsmp->ls_fcval);
|
||||
switch (lsflags & LSI_MASK) {
|
||||
@ -495,6 +592,9 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
struct ackmsg *amp = (struct ackmsg *)nspp;
|
||||
int ack;
|
||||
|
||||
if (nsplen < sizeof(struct ackmsg))
|
||||
goto trunc;
|
||||
TCHECK(*amp);
|
||||
ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
@ -517,12 +617,16 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
struct ackmsg *amp = (struct ackmsg *)nspp;
|
||||
int ack;
|
||||
|
||||
if (nsplen < sizeof(struct ackmsg))
|
||||
goto trunc;
|
||||
TCHECK(*amp);
|
||||
ack = EXTRACT_LE_16BITS(amp->ak_acknum[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
(void)printf("nak %d ", ack & SGQ_MASK);
|
||||
else
|
||||
(void)printf("ack %d ", ack & SGQ_MASK);
|
||||
TCHECK(amp->ak_acknum[1]);
|
||||
ack = EXTRACT_LE_16BITS(amp->ak_acknum[1]);
|
||||
if (ack & SGQ_OACK) { /* ackdat field */
|
||||
if ((ack & SGQ_ONAK) == SGQ_ONAK)
|
||||
@ -557,6 +661,9 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
u_char *dp;
|
||||
#endif
|
||||
|
||||
if (nsplen < sizeof(struct cimsg))
|
||||
goto trunc;
|
||||
TCHECK(*cimp);
|
||||
services = EXTRACT_LE_8BITS(cimp->ci_services);
|
||||
info = EXTRACT_LE_8BITS(cimp->ci_info);
|
||||
segsize = EXTRACT_LE_16BITS(cimp->ci_segsize);
|
||||
@ -590,8 +697,11 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
}
|
||||
(void)printf("segsize %d ", segsize);
|
||||
#ifdef PRINT_NSPDATA
|
||||
dp = &(nspp[sizeof(struct cimsg)]);
|
||||
pdata(dp, nsplen - sizeof(struct cimsg));
|
||||
if (nsplen > sizeof(struct cimsg)) {
|
||||
dp = &(nspp[sizeof(struct cimsg)]);
|
||||
TCHECK2(*dp, nsplen - sizeof(struct cimsg));
|
||||
pdata(dp, nsplen - sizeof(struct cimsg));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
@ -605,6 +715,9 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
u_char *dp;
|
||||
#endif
|
||||
|
||||
if (nsplen < sizeof(struct ccmsg))
|
||||
goto trunc;
|
||||
TCHECK(*ccmp);
|
||||
services = EXTRACT_LE_8BITS(ccmp->cc_services);
|
||||
info = EXTRACT_LE_8BITS(ccmp->cc_info);
|
||||
segsize = EXTRACT_LE_16BITS(ccmp->cc_segsize);
|
||||
@ -641,8 +754,10 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
if (optlen) {
|
||||
(void)printf("optlen %d ", optlen);
|
||||
#ifdef PRINT_NSPDATA
|
||||
optlen = min(optlen, nsplen - sizeof(struct ccmsg));
|
||||
if (optlen > nsplen - sizeof(struct ccmsg))
|
||||
goto trunc;
|
||||
dp = &(nspp[sizeof(struct ccmsg)]);
|
||||
TCHECK2(*dp, optlen);
|
||||
pdata(dp, optlen);
|
||||
#endif
|
||||
}
|
||||
@ -658,6 +773,9 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
u_char *dp;
|
||||
#endif
|
||||
|
||||
if (nsplen < sizeof(struct dimsg))
|
||||
goto trunc;
|
||||
TCHECK(*dimp);
|
||||
reason = EXTRACT_LE_16BITS(dimp->di_reason);
|
||||
optlen = EXTRACT_LE_8BITS(dimp->di_optlen);
|
||||
|
||||
@ -665,8 +783,10 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
if (optlen) {
|
||||
(void)printf("optlen %d ", optlen);
|
||||
#ifdef PRINT_NSPDATA
|
||||
optlen = min(optlen, nsplen - sizeof(struct dimsg));
|
||||
if (optlen > nsplen - sizeof(struct dimsg))
|
||||
goto trunc;
|
||||
dp = &(nspp[sizeof(struct dimsg)]);
|
||||
TCHECK2(*dp, optlen);
|
||||
pdata(dp, optlen);
|
||||
#endif
|
||||
}
|
||||
@ -678,6 +798,7 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
struct dcmsg *dcmp = (struct dcmsg *)nspp;
|
||||
int reason;
|
||||
|
||||
TCHECK(*dcmp);
|
||||
reason = EXTRACT_LE_16BITS(dcmp->dc_reason);
|
||||
|
||||
print_reason(reason);
|
||||
@ -692,6 +813,10 @@ print_nsp(const u_char *nspp, u_int nsplen _U_)
|
||||
(void)printf("reserved-type? %x %d > %d", flags, src, dst);
|
||||
break;
|
||||
}
|
||||
return (1);
|
||||
|
||||
trunc:
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct tok reason2str[] = {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89 2004/03/23 19:03:03 fenner Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.1 2005/04/20 20:59:00 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -131,9 +131,10 @@ labellen(const u_char *cp)
|
||||
i = *cp;
|
||||
if ((i & INDIR_MASK) == EDNS0_MASK) {
|
||||
int bitlen, elt;
|
||||
|
||||
if ((elt = (i & ~INDIR_MASK)) != EDNS0_ELT_BITLABEL)
|
||||
if ((elt = (i & ~INDIR_MASK)) != EDNS0_ELT_BITLABEL) {
|
||||
printf("<ELT %d>", elt);
|
||||
return(-1);
|
||||
}
|
||||
if (!TTEST2(*(cp + 1), 1))
|
||||
return(-1);
|
||||
if ((bitlen = *(cp + 1)) == 0)
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-eigrp.c,v 1.5 2004/05/12 22:22:40 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-eigrp.c,v 1.5.2.2 2005/05/06 02:53:41 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -216,7 +216,7 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
const struct eigrp_common_header *eigrp_com_header;
|
||||
const struct eigrp_tlv_header *eigrp_tlv_header;
|
||||
const u_char *tptr,*tlv_tptr;
|
||||
int tlen,eigrp_tlv_len,eigrp_tlv_type,tlv_tlen,byte_length, bit_length;
|
||||
u_int tlen,eigrp_tlv_len,eigrp_tlv_type,tlv_tlen, byte_length, bit_length;
|
||||
u_int8_t prefix[4];
|
||||
|
||||
union {
|
||||
@ -271,15 +271,15 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
while(tlen>0) {
|
||||
/* did we capture enough for fully decoding the object header ? */
|
||||
if (!TTEST2(*tptr, sizeof(struct eigrp_tlv_header)))
|
||||
goto trunc;
|
||||
TCHECK2(*tptr, sizeof(struct eigrp_tlv_header));
|
||||
|
||||
eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
|
||||
eigrp_tlv_len=EXTRACT_16BITS(&eigrp_tlv_header->length);
|
||||
eigrp_tlv_type=EXTRACT_16BITS(&eigrp_tlv_header->type);
|
||||
|
||||
|
||||
if (eigrp_tlv_len == 0 || eigrp_tlv_len > tlen) {
|
||||
if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) ||
|
||||
eigrp_tlv_len > tlen) {
|
||||
print_unknown_data(tptr+sizeof(sizeof(struct eigrp_tlv_header)),"\n\t ",tlen);
|
||||
return;
|
||||
}
|
||||
@ -295,8 +295,7 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
tlv_tlen=eigrp_tlv_len-sizeof(struct eigrp_tlv_header);
|
||||
|
||||
/* did we capture enough for fully decoding the object ? */
|
||||
if (!TTEST2(*tptr, eigrp_tlv_len))
|
||||
goto trunc;
|
||||
TCHECK2(*tptr, eigrp_tlv_len);
|
||||
|
||||
switch(eigrp_tlv_type) {
|
||||
|
||||
@ -326,7 +325,7 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
tlv_ptr.eigrp_tlv_ip_int = (const struct eigrp_tlv_ip_int_t *)tlv_tptr;
|
||||
|
||||
bit_length = tlv_ptr.eigrp_tlv_ip_int->plen;
|
||||
if (bit_length < 0 || bit_length > 32) {
|
||||
if (bit_length > 32) {
|
||||
printf("\n\t illegal prefix length %u",bit_length);
|
||||
break;
|
||||
}
|
||||
@ -340,7 +339,7 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
|
||||
printf("self");
|
||||
else
|
||||
printf("%s",ipaddr_string(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop)));
|
||||
printf("%s",ipaddr_string(&tlv_ptr.eigrp_tlv_ip_int->nexthop));
|
||||
|
||||
printf("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
|
||||
(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
|
||||
@ -355,7 +354,7 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
tlv_ptr.eigrp_tlv_ip_ext = (const struct eigrp_tlv_ip_ext_t *)tlv_tptr;
|
||||
|
||||
bit_length = tlv_ptr.eigrp_tlv_ip_ext->plen;
|
||||
if (bit_length < 0 || bit_length > 32) {
|
||||
if (bit_length > 32) {
|
||||
printf("\n\t illegal prefix length %u",bit_length);
|
||||
break;
|
||||
}
|
||||
@ -369,7 +368,7 @@ eigrp_print(register const u_char *pptr, register u_int len) {
|
||||
if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
|
||||
printf("self");
|
||||
else
|
||||
printf("%s",ipaddr_string(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop)));
|
||||
printf("%s",ipaddr_string(&tlv_ptr.eigrp_tlv_ip_ext->nexthop));
|
||||
|
||||
printf("\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
|
||||
ipaddr_string(tlv_ptr.eigrp_tlv_ip_ext->origin_router),
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.55 2004/07/21 22:00:11 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.55.2.1 2005/04/21 06:44:57 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -75,7 +75,7 @@ struct sa_list {
|
||||
const EVP_CIPHER *evp;
|
||||
int ivlen;
|
||||
int authlen;
|
||||
char secret[256]; /* is that big enough for all secrets? */
|
||||
u_char secret[256]; /* is that big enough for all secrets? */
|
||||
int secretlen;
|
||||
};
|
||||
|
||||
@ -100,7 +100,7 @@ static void esp_print_addsa(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
|
||||
static int hexdigit(netdissect_options *ndo, char hex)
|
||||
static u_int hexdigit(netdissect_options *ndo, char hex)
|
||||
{
|
||||
if (hex >= '0' && hex <= '9')
|
||||
return (hex - '0');
|
||||
@ -114,9 +114,9 @@ static int hexdigit(netdissect_options *ndo, char hex)
|
||||
}
|
||||
}
|
||||
|
||||
static int hex2byte(netdissect_options *ndo, char *hexstring)
|
||||
static u_int hex2byte(netdissect_options *ndo, char *hexstring)
|
||||
{
|
||||
int byte;
|
||||
u_int byte;
|
||||
|
||||
byte = (hexdigit(ndo, hexstring[0]) << 4) + hexdigit(ndo, hexstring[1]);
|
||||
return byte;
|
||||
@ -219,7 +219,7 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line)
|
||||
|
||||
if (decode) {
|
||||
char *colon, *p;
|
||||
char espsecret_key[256];
|
||||
u_char espsecret_key[256];
|
||||
int len;
|
||||
size_t i;
|
||||
const EVP_CIPHER *evp;
|
||||
@ -353,7 +353,7 @@ esp_print(netdissect_options *ndo,
|
||||
#endif
|
||||
int advance;
|
||||
int len;
|
||||
char *secret;
|
||||
u_char *secret;
|
||||
int ivlen = 0;
|
||||
u_char *ivoff;
|
||||
u_char *p;
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95 2005/04/06 21:32:39 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95.2.2 2005/07/01 16:16:30 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -37,24 +37,8 @@ static const char rcsid[] _U_ =
|
||||
#include "ethertype.h"
|
||||
|
||||
#include "ether.h"
|
||||
#include "llc.h"
|
||||
|
||||
const struct tok ethertype_values[] = {
|
||||
/* not really ethertypes but PIDs that are used
|
||||
in the SNAP printer - its more convenient
|
||||
to put them into a single tokentable */
|
||||
{ PID_RFC2684_ETH_FCS, "Ethernet + FCS" },
|
||||
{ PID_RFC2684_ETH_NOFCS, "Ethernet no FCS" },
|
||||
{ PID_RFC2684_802_4_FCS, "802.4 + FCS" },
|
||||
{ PID_RFC2684_802_4_NOFCS, "w/o FCS" },
|
||||
{ PID_RFC2684_802_5_FCS, "Tokenring + FCS" },
|
||||
{ PID_RFC2684_802_5_NOFCS, "Tokenring no FCS" },
|
||||
{ PID_RFC2684_FDDI_FCS, "FDDI + FCS" },
|
||||
{ PID_RFC2684_FDDI_NOFCS, "FDDI no FCS" },
|
||||
{ PID_RFC2684_802_6_FCS, "802.6 + FCS" },
|
||||
{ PID_RFC2684_802_6_NOFCS, "802.6 no FCS" },
|
||||
{ PID_RFC2684_BPDU, "BPDU" },
|
||||
/* the real Ethertypes */
|
||||
{ ETHERTYPE_IP, "IPv4" },
|
||||
{ ETHERTYPE_MPLS, "MPLS unicast" },
|
||||
{ ETHERTYPE_MPLS_MULTI, "MPLS multicast" },
|
||||
@ -312,7 +296,7 @@ ether_encap_print(u_short ether_type, const u_char *p,
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_LOOPBACK:
|
||||
return (0);
|
||||
return (1);
|
||||
|
||||
case ETHERTYPE_MPLS:
|
||||
case ETHERTYPE_MPLS_MULTI:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32 2005/04/06 21:32:39 mcr Exp $ (LBL)";
|
||||
"@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32.2.4 2005/05/27 14:56:52 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -149,10 +149,9 @@ static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *sdlcore,
|
||||
*/
|
||||
|
||||
static u_int
|
||||
fr_hdrlen(const u_char *p, u_int addr_len, u_int caplen)
|
||||
fr_hdrlen(const u_char *p, u_int addr_len)
|
||||
{
|
||||
if ((caplen > addr_len + 1 /* UI */ + 1 /* pad */) &&
|
||||
!p[addr_len + 1] /* pad exist */)
|
||||
if (!p[addr_len + 1] /* pad exist */)
|
||||
return addr_len + 1 /* UI */ + 1 /* pad */ + 1 /* NLPID */;
|
||||
else
|
||||
return addr_len + 1 /* UI */ + 1 /* NLPID */;
|
||||
@ -190,9 +189,22 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
|
||||
TCHECK2(*p, 4); /* minimum frame header length */
|
||||
|
||||
if ((length = fr_print(p, length)) == 0)
|
||||
return (0);
|
||||
else
|
||||
return length;
|
||||
trunc:
|
||||
printf("[|fr]");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
u_int
|
||||
fr_print(register const u_char *p, u_int length)
|
||||
{
|
||||
u_int16_t extracted_ethertype;
|
||||
u_int32_t orgcode;
|
||||
register u_short et;
|
||||
u_int dlci;
|
||||
u_int sdlcore;
|
||||
u_int addr_len;
|
||||
@ -200,22 +212,14 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
u_int hdr_len;
|
||||
u_int8_t flags[4];
|
||||
|
||||
if (caplen < 4) { /* minimum frame header length */
|
||||
printf("[|fr]");
|
||||
return caplen;
|
||||
}
|
||||
|
||||
if (parse_q922_addr(p, &dlci, &sdlcore, &addr_len, flags)) {
|
||||
printf("Q.922, invalid address");
|
||||
return caplen;
|
||||
return 0;
|
||||
}
|
||||
|
||||
hdr_len = fr_hdrlen(p, addr_len, caplen);
|
||||
|
||||
if (caplen < hdr_len) {
|
||||
printf("[|fr]");
|
||||
return caplen;
|
||||
}
|
||||
TCHECK2(*p,addr_len+1+1);
|
||||
hdr_len = fr_hdrlen(p, addr_len);
|
||||
TCHECK2(*p,hdr_len);
|
||||
|
||||
if (p[addr_len] != 0x03 && dlci != 0) {
|
||||
|
||||
@ -228,7 +232,7 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
if (ether_encap_print(extracted_ethertype,
|
||||
p+addr_len+ETHERTYPE_LEN,
|
||||
length-addr_len-ETHERTYPE_LEN,
|
||||
caplen-addr_len-ETHERTYPE_LEN,
|
||||
length-addr_len-ETHERTYPE_LEN,
|
||||
&extracted_ethertype) == 0)
|
||||
/* ether_type not known, probably it wasn't one */
|
||||
printf("UI %02x! ", p[addr_len]);
|
||||
@ -249,7 +253,6 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
|
||||
p += hdr_len;
|
||||
length -= hdr_len;
|
||||
caplen -= hdr_len;
|
||||
|
||||
switch (nlpid) {
|
||||
case NLPID_IP:
|
||||
@ -264,29 +267,17 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
case NLPID_CLNP:
|
||||
case NLPID_ESIS:
|
||||
case NLPID_ISIS:
|
||||
isoclns_print(p-1, length+1, caplen+1); /* OSI printers need the NLPID field */
|
||||
isoclns_print(p-1, length+1, length+1); /* OSI printers need the NLPID field */
|
||||
break;
|
||||
|
||||
case NLPID_SNAP:
|
||||
orgcode = EXTRACT_24BITS(p);
|
||||
et = EXTRACT_16BITS(p + 3);
|
||||
|
||||
if (eflag)
|
||||
(void)printf("SNAP, oui %s (0x%06x), ethertype %s (0x%04x): ",
|
||||
tok2str(oui_values,"Unknown",orgcode),
|
||||
orgcode,
|
||||
tok2str(ethertype_values,"Unknown", et),
|
||||
et);
|
||||
|
||||
if (snap_print((const u_char *)(p + 5), length - 5,
|
||||
caplen - 5, &extracted_ethertype, orgcode, et,
|
||||
0) == 0) {
|
||||
if (snap_print(p, length, length, &extracted_ethertype, 0) == 0) {
|
||||
/* ether_type not known, print raw packet */
|
||||
if (!eflag)
|
||||
fr_hdr_print(length + hdr_len, hdr_len,
|
||||
dlci, flags, nlpid);
|
||||
if (!xflag && !qflag)
|
||||
default_print(p - hdr_len, caplen + hdr_len);
|
||||
default_print(p - hdr_len, length + hdr_len);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -303,10 +294,15 @@ fr_if_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
fr_hdr_print(length + hdr_len, addr_len,
|
||||
dlci, flags, nlpid);
|
||||
if (!xflag)
|
||||
default_print(p, caplen);
|
||||
default_print(p, length);
|
||||
}
|
||||
|
||||
return hdr_len;
|
||||
|
||||
trunc:
|
||||
printf("[|fr]");
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* an NLPID of 0xb1 indicates a 2-byte
|
||||
@ -482,6 +478,32 @@ struct common_ie_header {
|
||||
u_int8_t ie_len;
|
||||
};
|
||||
|
||||
static int fr_q933_print_ie_codeset5(const struct common_ie_header *ie_p,
|
||||
const u_char *p);
|
||||
|
||||
typedef int (*codeset_pr_func_t)(const struct common_ie_header *ie_p,
|
||||
const u_char *p);
|
||||
|
||||
/* array of 16 codepages - currently we only support codepage 5 */
|
||||
static codeset_pr_func_t fr_q933_print_ie_codeset[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
fr_q933_print_ie_codeset5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
q933_print(const u_char *p, u_int length)
|
||||
{
|
||||
@ -489,7 +511,7 @@ q933_print(const u_char *p, u_int length)
|
||||
struct common_ie_header *ie_p;
|
||||
int olen;
|
||||
int is_ansi = 0;
|
||||
u_int dlci,codeset;
|
||||
u_int codeset;
|
||||
|
||||
if (length < 9) { /* shortest: Q.933a LINK VERIFY */
|
||||
printf("[|q.933]");
|
||||
@ -504,7 +526,7 @@ q933_print(const u_char *p, u_int length)
|
||||
printf("%s", eflag ? "" : "Q.933, ");
|
||||
|
||||
/* printing out header part */
|
||||
printf(is_ansi ? "ANSI" : "CCITT ");
|
||||
printf(is_ansi ? "ANSI" : "CCITT");
|
||||
|
||||
if (p[0])
|
||||
printf(", Call Ref: 0x%02x", p[0]);
|
||||
@ -548,53 +570,10 @@ q933_print(const u_char *p, u_int length)
|
||||
ie_p->ie_id,
|
||||
ie_p->ie_len);
|
||||
|
||||
switch (ie_p->ie_id) {
|
||||
|
||||
case FR_LMI_ANSI_REPORT_TYPE_IE: /* fall through */
|
||||
case FR_LMI_CCITT_REPORT_TYPE_IE:
|
||||
if (vflag)
|
||||
printf("%s (%u)",
|
||||
tok2str(fr_lmi_report_type_ie_values,"unknown",ptemp[2]),
|
||||
ptemp[2]);
|
||||
break;
|
||||
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE: /* fall through */
|
||||
case FR_LMI_CCITT_LINK_VERIFY_IE:
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE_91:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
printf("TX Seq: %3d, RX Seq: %3d", ptemp[2], ptemp[3]);
|
||||
break;
|
||||
case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
|
||||
case FR_LMI_CCITT_PVC_STATUS_IE:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
/* now parse the DLCI information element. */
|
||||
if ((ie_p->ie_len < 3) ||
|
||||
(ptemp[2] & 0x80) ||
|
||||
((ie_p->ie_len == 3) && !(ptemp[3] & 0x80)) ||
|
||||
((ie_p->ie_len == 4) && ((ptemp[3] & 0x80) || !(ptemp[4] & 0x80))) ||
|
||||
((ie_p->ie_len == 5) && ((ptemp[3] & 0x80) || (ptemp[4] & 0x80) ||
|
||||
!(ptemp[5] & 0x80))) ||
|
||||
(ie_p->ie_len > 5) ||
|
||||
!(ptemp[ie_p->ie_len + 1] & 0x80))
|
||||
printf("Invalid DLCI IE");
|
||||
|
||||
dlci = ((ptemp[2] & 0x3F) << 4) | ((ptemp[3] & 0x78) >> 3);
|
||||
if (ie_p->ie_len == 4)
|
||||
dlci = (dlci << 6) | ((ptemp[4] & 0x7E) >> 1);
|
||||
else if (ie_p->ie_len == 5)
|
||||
dlci = (dlci << 13) | (ptemp[4] & 0x7F) | ((ptemp[5] & 0x7E) >> 1);
|
||||
|
||||
printf("DLCI %u: status %s%s", dlci,
|
||||
ptemp[ie_p->ie_len + 1] & 0x8 ? "New, " : "",
|
||||
ptemp[ie_p->ie_len + 1] & 0x2 ? "Active" : "Inactive");
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!fr_q933_print_ie_codeset[codeset] ||
|
||||
(*fr_q933_print_ie_codeset[codeset])(ie_p, ptemp)) {
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(ptemp+2,"\n\t",ie_p->ie_len);
|
||||
break;
|
||||
}
|
||||
|
||||
/* do we want to see a hexdump of the IE ? */
|
||||
@ -607,3 +586,56 @@ q933_print(const u_char *p, u_int length)
|
||||
if (!vflag)
|
||||
printf(", length %u",olen);
|
||||
}
|
||||
|
||||
static int
|
||||
fr_q933_print_ie_codeset5(const struct common_ie_header *ie_p, const u_char *p)
|
||||
{
|
||||
u_int dlci;
|
||||
|
||||
switch (ie_p->ie_id) {
|
||||
|
||||
case FR_LMI_ANSI_REPORT_TYPE_IE: /* fall through */
|
||||
case FR_LMI_CCITT_REPORT_TYPE_IE:
|
||||
if (vflag)
|
||||
printf("%s (%u)",
|
||||
tok2str(fr_lmi_report_type_ie_values,"unknown",p[2]),
|
||||
p[2]);
|
||||
return 1;
|
||||
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE: /* fall through */
|
||||
case FR_LMI_CCITT_LINK_VERIFY_IE:
|
||||
case FR_LMI_ANSI_LINK_VERIFY_IE_91:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
printf("TX Seq: %3d, RX Seq: %3d", p[2], p[3]);
|
||||
return 1;
|
||||
|
||||
case FR_LMI_ANSI_PVC_STATUS_IE: /* fall through */
|
||||
case FR_LMI_CCITT_PVC_STATUS_IE:
|
||||
if (!vflag)
|
||||
printf(", ");
|
||||
/* now parse the DLCI information element. */
|
||||
if ((ie_p->ie_len < 3) ||
|
||||
(p[2] & 0x80) ||
|
||||
((ie_p->ie_len == 3) && !(p[3] & 0x80)) ||
|
||||
((ie_p->ie_len == 4) && ((p[3] & 0x80) || !(p[4] & 0x80))) ||
|
||||
((ie_p->ie_len == 5) && ((p[3] & 0x80) || (p[4] & 0x80) ||
|
||||
!(p[5] & 0x80))) ||
|
||||
(ie_p->ie_len > 5) ||
|
||||
!(p[ie_p->ie_len + 1] & 0x80))
|
||||
printf("Invalid DLCI IE");
|
||||
|
||||
dlci = ((p[2] & 0x3F) << 4) | ((p[3] & 0x78) >> 3);
|
||||
if (ie_p->ie_len == 4)
|
||||
dlci = (dlci << 6) | ((p[4] & 0x7E) >> 1);
|
||||
else if (ie_p->ie_len == 5)
|
||||
dlci = (dlci << 13) | (p[4] & 0x7F) | ((p[5] & 0x7E) >> 1);
|
||||
|
||||
printf("DLCI %u: status %s%s", dlci,
|
||||
p[ie_p->ie_len + 1] & 0x8 ? "New, " : "",
|
||||
p[ie_p->ie_len + 1] & 0x2 ? "Active" : "Inactive");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.19 2003/11/19 00:36:07 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-frag6.c,v 1.19.2.1 2005/04/20 22:33:21 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -45,14 +45,10 @@ frag6_print(register const u_char *bp, register const u_char *bp2)
|
||||
{
|
||||
register const struct ip6_frag *dp;
|
||||
register const struct ip6_hdr *ip6;
|
||||
register const u_char *ep;
|
||||
|
||||
dp = (const struct ip6_frag *)bp;
|
||||
ip6 = (const struct ip6_hdr *)bp2;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
TCHECK(dp->ip6f_offlg);
|
||||
|
||||
if (vflag) {
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.9 2003/11/16 09:36:22 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-hsrp.c,v 1.9.2.1 2005/05/06 07:57:17 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -127,7 +127,11 @@ hsrp_print(register const u_int8_t *bp, register u_int len)
|
||||
relts_print(hp->hsrp_holdtime);
|
||||
printf(" priority=%d", hp->hsrp_priority);
|
||||
printf(" auth=\"");
|
||||
fn_printn(hp->hsrp_authdata, sizeof(hp->hsrp_authdata), NULL);
|
||||
if (fn_printn(hp->hsrp_authdata, sizeof(hp->hsrp_authdata),
|
||||
snapend)) {
|
||||
printf("\"");
|
||||
goto trunc;
|
||||
}
|
||||
printf("\"");
|
||||
}
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81 2005/04/06 21:32:40 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81.2.2 2005/07/01 16:13:37 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -289,6 +289,24 @@ static const struct tok icmp_mpls_ext_obj_values[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
const char *icmp_tstamp_print(u_int);
|
||||
|
||||
/* print the milliseconds since midnight UTC */
|
||||
const char *
|
||||
icmp_tstamp_print(u_int tstamp) {
|
||||
u_int msec,sec,min,hrs;
|
||||
|
||||
static char buf[64];
|
||||
|
||||
msec = tstamp % 1000;
|
||||
sec = tstamp / 1000;
|
||||
min = sec / 60; sec -= min * 60;
|
||||
hrs = min / 60; min -= hrs * 60;
|
||||
snprintf(buf, sizeof(buf), "%02u:%02u:%02u.%03u",hrs,min,sec,msec);
|
||||
return buf;
|
||||
}
|
||||
|
||||
void
|
||||
icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
{
|
||||
@ -314,10 +332,11 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
case ICMP_ECHO:
|
||||
case ICMP_ECHOREPLY:
|
||||
TCHECK(dp->icmp_seq);
|
||||
(void)snprintf(buf, sizeof(buf), "echo %s seq %u",
|
||||
dp->icmp_type == ICMP_ECHO ?
|
||||
"request" : "reply",
|
||||
EXTRACT_16BITS(&dp->icmp_seq));
|
||||
(void)snprintf(buf, sizeof(buf), "echo %s, id %u, seq %u",
|
||||
dp->icmp_type == ICMP_ECHO ?
|
||||
"request" : "reply",
|
||||
EXTRACT_16BITS(&dp->icmp_id),
|
||||
EXTRACT_16BITS(&dp->icmp_seq));
|
||||
break;
|
||||
|
||||
case ICMP_UNREACH:
|
||||
@ -497,13 +516,16 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
|
||||
case ICMP_TSTAMPREPLY:
|
||||
TCHECK(dp->icmp_ttime);
|
||||
(void)snprintf(buf, sizeof(buf),
|
||||
"time stamp reply id %u seq %u : org 0x%x recv 0x%x xmit 0x%x",
|
||||
EXTRACT_16BITS(&dp->icmp_id),
|
||||
EXTRACT_16BITS(&dp->icmp_seq),
|
||||
EXTRACT_32BITS(&dp->icmp_otime),
|
||||
EXTRACT_32BITS(&dp->icmp_rtime),
|
||||
EXTRACT_32BITS(&dp->icmp_ttime));
|
||||
break;
|
||||
"time stamp reply id %u seq %u: org %s",
|
||||
EXTRACT_16BITS(&dp->icmp_id),
|
||||
EXTRACT_16BITS(&dp->icmp_seq),
|
||||
icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_otime)));
|
||||
|
||||
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", recv %s",
|
||||
icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_rtime)));
|
||||
(void)snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),", xmit %s",
|
||||
icmp_tstamp_print(EXTRACT_32BITS(&dp->icmp_ttime)));
|
||||
break;
|
||||
|
||||
default:
|
||||
str = tok2str(icmp2str, "type-#%d", dp->icmp_type);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.79 2005/01/14 10:41:50 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.79.2.4 2005/05/14 00:42:54 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -35,14 +35,14 @@ static const char rcsid[] _U_ =
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ip6.h"
|
||||
#include "icmp6.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
|
||||
#include "ip6.h"
|
||||
#include "icmp6.h"
|
||||
#include "ipproto.h"
|
||||
|
||||
#include "udp.h"
|
||||
#include "ah.h"
|
||||
|
||||
@ -69,10 +69,10 @@ static struct tok icmp6_type_values[] = {
|
||||
{ ICMP6_PARAM_PROB, "parameter problem"},
|
||||
{ ICMP6_ECHO_REQUEST, "echo request"},
|
||||
{ ICMP6_ECHO_REPLY, "echo reply"},
|
||||
{ MLD6_LISTENER_QUERY, "multicast listener query "},
|
||||
{ MLD6_LISTENER_REPORT, "multicast listener report "},
|
||||
{ MLD6_LISTENER_DONE, "multicast listener done "},
|
||||
{ ND_ROUTER_SOLICIT, "router solicitation "},
|
||||
{ MLD6_LISTENER_QUERY, "multicast listener query"},
|
||||
{ MLD6_LISTENER_REPORT, "multicast listener report"},
|
||||
{ MLD6_LISTENER_DONE, "multicast listener done"},
|
||||
{ ND_ROUTER_SOLICIT, "router solicitation"},
|
||||
{ ND_ROUTER_ADVERT, "router advertisement"},
|
||||
{ ND_NEIGHBOR_SOLICIT, "neighbor solicitation"},
|
||||
{ ND_NEIGHBOR_ADVERT, "neighbor advertisment"},
|
||||
@ -80,7 +80,7 @@ static struct tok icmp6_type_values[] = {
|
||||
{ ICMP6_ROUTER_RENUMBERING, "router renumbering"},
|
||||
{ IND_SOLICIT, "inverse neighbor solicitation"},
|
||||
{ IND_ADVERT, "inverse neighbor advertisement"},
|
||||
{ MLDV2_LISTENER_REPORT, "multicast listener report v2 "},
|
||||
{ MLDV2_LISTENER_REPORT, "multicast listener report v2"},
|
||||
{ ICMP6_HADISCOV_REQUEST, "ha discovery request"},
|
||||
{ ICMP6_HADISCOV_REPLY, "ha discovery reply"},
|
||||
{ ICMP6_MOBILEPREFIX_SOLICIT, "mobile router solicitation"},
|
||||
@ -237,18 +237,15 @@ icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
|
||||
{
|
||||
const struct icmp6_hdr *dp;
|
||||
const struct ip6_hdr *ip;
|
||||
const char *str;
|
||||
const struct ip6_hdr *oip;
|
||||
const struct udphdr *ouh;
|
||||
int dport;
|
||||
const u_char *ep;
|
||||
char buf[256];
|
||||
u_int prot;
|
||||
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
ip = (struct ip6_hdr *)bp2;
|
||||
oip = (struct ip6_hdr *)(dp + 1);
|
||||
str = buf;
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
||||
@ -542,7 +539,7 @@ get_upperlayer(u_char *bp, u_int *prot)
|
||||
nh = ip6->ip6_nxt;
|
||||
hlen = sizeof(struct ip6_hdr);
|
||||
|
||||
while (bp < snapend) {
|
||||
while (bp < ep) {
|
||||
bp += hlen;
|
||||
|
||||
switch(nh) {
|
||||
@ -1153,8 +1150,6 @@ static void
|
||||
icmp6_rrenum_print(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;
|
||||
@ -1163,9 +1158,7 @@ icmp6_rrenum_print(const u_char *bp, const u_char *ep)
|
||||
|
||||
if (ep < bp)
|
||||
return;
|
||||
dp = (struct icmp6_hdr *)bp;
|
||||
rr6 = (struct icmp6_router_renum *)bp;
|
||||
siz = ep - bp;
|
||||
cp = (const char *)(rr6 + 1);
|
||||
|
||||
TCHECK(rr6->rr_reserved);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.20 2003/11/16 09:36:23 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-igrp.c,v 1.20.2.1 2005/04/20 21:02:15 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -77,15 +77,13 @@ static struct tok op2str[] = {
|
||||
};
|
||||
|
||||
void
|
||||
igrp_print(register const u_char *bp, u_int length, register const u_char *bp2)
|
||||
igrp_print(register const u_char *bp, u_int length, const u_char *bp2 _U_)
|
||||
{
|
||||
register struct igrphdr *hdr;
|
||||
register struct ip *ip;
|
||||
register u_char *cp;
|
||||
u_int nint, nsys, next;
|
||||
|
||||
hdr = (struct igrphdr *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
cp = (u_char *)(hdr + 1);
|
||||
(void)printf("igrp:");
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149 2005/04/07 00:28:17 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.1 2005/05/20 21:15:46 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -502,6 +502,10 @@ ip_print_demux(netdissect_options *ndo,
|
||||
vrrp_print(ipds->cp, ipds->len, ipds->ip->ip_ttl);
|
||||
break;
|
||||
|
||||
case IPPROTO_PGM:
|
||||
pgm_print(ipds->cp, ipds->len, (const u_char *)ipds->ip);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((proto = getprotobynumber(ipds->nh)) != NULL)
|
||||
ND_PRINT((ndo, " %s", proto->p_name));
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47 2005/04/06 21:32:40 mcr Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.2 2005/07/03 20:36:33 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -192,6 +192,7 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
case IPPROTO_PIM:
|
||||
pim_print(cp, len);
|
||||
return;
|
||||
|
||||
case IPPROTO_OSPF:
|
||||
ospf6_print(cp, len);
|
||||
return;
|
||||
@ -204,6 +205,18 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
ip_print(gndo, cp, len);
|
||||
return;
|
||||
|
||||
case IPPROTO_PGM:
|
||||
pgm_print(cp, len, (const u_char *)ip6);
|
||||
return;
|
||||
|
||||
case IPPROTO_GRE:
|
||||
gre_print(cp, len);
|
||||
return;
|
||||
|
||||
case IPPROTO_RSVP:
|
||||
rsvp_print(cp, len);
|
||||
return;
|
||||
|
||||
case IPPROTO_NONE:
|
||||
(void)printf("no next header");
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.17 2003/11/19 00:36:08 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6opts.c,v 1.17.2.1 2005/04/20 22:19:06 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
@ -289,11 +289,8 @@ int
|
||||
hbhopt_print(register const u_char *bp)
|
||||
{
|
||||
const struct ip6_hbh *dp = (struct ip6_hbh *)bp;
|
||||
register const u_char *ep;
|
||||
int hbhlen = 0;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
TCHECK(dp->ip6h_len);
|
||||
hbhlen = (int)((dp->ip6h_len + 1) << 3);
|
||||
TCHECK2(*dp, hbhlen);
|
||||
@ -312,11 +309,8 @@ int
|
||||
dstopt_print(register const u_char *bp)
|
||||
{
|
||||
const struct ip6_dest *dp = (struct ip6_dest *)bp;
|
||||
register const u_char *ep;
|
||||
int dstoptlen = 0;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
TCHECK(dp->ip6d_len);
|
||||
dstoptlen = (int)((dp->ip6d_len + 1) << 3);
|
||||
TCHECK2(*dp, dstoptlen);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.40 2004/05/26 19:57:57 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ipx.c,v 1.40.2.2 2005/05/06 08:27:00 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -159,9 +159,13 @@ ipx_sap_print(const u_short *ipx, u_int length)
|
||||
(void)printf("ipx-sap-nearest-resp");
|
||||
|
||||
for (i = 0; i < 8 && length > 0; i++) {
|
||||
TCHECK2(ipx[25], 10);
|
||||
TCHECK(ipx[0]);
|
||||
(void)printf(" %s '", ipxsap_string(htons(EXTRACT_16BITS(&ipx[0]))));
|
||||
fn_print((u_char *)&ipx[1], (u_char *)&ipx[1] + 48);
|
||||
if (fn_printzp((u_char *)&ipx[1], 48, snapend)) {
|
||||
printf("'");
|
||||
goto trunc;
|
||||
}
|
||||
TCHECK2(ipx[25], 10);
|
||||
printf("' addr %s",
|
||||
ipxaddr_string(EXTRACT_32BITS(&ipx[25]), (u_char *)&ipx[27]));
|
||||
ipx += 32;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133 2005/04/06 21:32:40 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133.2.12 2005/06/16 01:14:52 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -127,7 +127,7 @@ static struct tok isis_pdu_values[] = {
|
||||
#define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
|
||||
#define ISIS_TLV_NORTEL_PRIVATE1 176
|
||||
#define ISIS_TLV_NORTEL_PRIVATE2 177
|
||||
#define ISIS_TLV_RESTART_SIGNALING 211 /* draft-ietf-isis-restart-01 */
|
||||
#define ISIS_TLV_RESTART_SIGNALING 211 /* rfc3847 */
|
||||
#define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
|
||||
#define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
|
||||
#define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
|
||||
@ -201,12 +201,20 @@ static struct tok esis_option_values[] = {
|
||||
|
||||
#define CLNP_OPTION_DISCARD_REASON 193
|
||||
#define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
|
||||
#define CLNP_OPTION_SECURITY 197 /* iso8473 */
|
||||
#define CLNP_OPTION_SOURCE_ROUTING 200 /* iso8473 */
|
||||
#define CLNP_OPTION_ROUTE_RECORDING 203 /* iso8473 */
|
||||
#define CLNP_OPTION_PADDING 204 /* iso8473 */
|
||||
#define CLNP_OPTION_PRIORITY 205 /* iso8473 */
|
||||
|
||||
static struct tok clnp_option_values[] = {
|
||||
{ CLNP_OPTION_DISCARD_REASON, "Discard Reason"},
|
||||
{ CLNP_OPTION_PRIORITY, "Priority"},
|
||||
{ CLNP_OPTION_QOS_MAINTENANCE, "QoS Maintenance"},
|
||||
{ CLNP_OPTION_SECURITY, "Security"},
|
||||
{ CLNP_OPTION_SOURCE_ROUTING, "Source Routing"},
|
||||
{ CLNP_OPTION_ROUTE_RECORDING, "Route Recording"},
|
||||
{ CLNP_OPTION_PADDING, "Padding"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -286,6 +294,40 @@ static struct tok *clnp_option_rfd_error_class[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
#define CLNP_OPTION_OPTION_QOS_MASK 0x3f
|
||||
#define CLNP_OPTION_SCOPE_MASK 0xc0
|
||||
#define CLNP_OPTION_SCOPE_SA_SPEC 0x40
|
||||
#define CLNP_OPTION_SCOPE_DA_SPEC 0x80
|
||||
#define CLNP_OPTION_SCOPE_GLOBAL 0xc0
|
||||
|
||||
static struct tok clnp_option_scope_values[] = {
|
||||
{ CLNP_OPTION_SCOPE_SA_SPEC, "Source Address Specific"},
|
||||
{ CLNP_OPTION_SCOPE_DA_SPEC, "Destination Address Specific"},
|
||||
{ CLNP_OPTION_SCOPE_GLOBAL, "Globally unique"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static struct tok clnp_option_sr_rr_values[] = {
|
||||
{ 0x0, "partial"},
|
||||
{ 0x1, "complete"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static struct tok clnp_option_sr_rr_string_values[] = {
|
||||
{ CLNP_OPTION_SOURCE_ROUTING, "source routing"},
|
||||
{ CLNP_OPTION_ROUTE_RECORDING, "recording of route in progress"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static struct tok clnp_option_qos_global_values[] = {
|
||||
{ 0x20, "reserved"},
|
||||
{ 0x10, "sequencing vs. delay"},
|
||||
{ 0x08, "congested"},
|
||||
{ 0x04, "delay vs. cost"},
|
||||
{ 0x02, "error vs. delay"},
|
||||
{ 0x01, "error vs. cost"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
|
||||
#define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* draft-ietf-isis-gmpls-extensions */
|
||||
@ -487,6 +529,7 @@ static struct tok isis_is_reach_virtual_values[] = {
|
||||
static struct tok isis_restart_flag_values[] = {
|
||||
{ 0x1, "Restart Request"},
|
||||
{ 0x2, "Restart Acknowledgement"},
|
||||
{ 0x4, "Suppress adjacency advertisement"},
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
@ -586,7 +629,9 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen)
|
||||
break;
|
||||
|
||||
case NLPID_NULLNS:
|
||||
(void)printf(", length: %u", length);
|
||||
(void)printf("%slength: %u",
|
||||
eflag ? "" : ", ",
|
||||
length);
|
||||
break;
|
||||
|
||||
case NLPID_Q933:
|
||||
@ -610,7 +655,9 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen)
|
||||
default:
|
||||
if (!eflag)
|
||||
printf("OSI NLPID 0x%02x unknown",*p);
|
||||
(void)printf(", length: %u", length);
|
||||
(void)printf("%slength: %u",
|
||||
eflag ? "" : ", ",
|
||||
length);
|
||||
if (caplen > 1)
|
||||
print_unknown_data(p,"\n\t",caplen);
|
||||
break;
|
||||
@ -656,7 +703,7 @@ struct clnp_segment_header_t {
|
||||
static int clnp_print (const u_int8_t *pptr, u_int length)
|
||||
{
|
||||
const u_int8_t *optr,*source_address,*dest_address;
|
||||
u_int li,source_address_length,dest_address_length, clnp_pdu_type, clnp_flags;
|
||||
u_int li,tlen,nsap_offset,source_address_length,dest_address_length, clnp_pdu_type, clnp_flags;
|
||||
const struct clnp_header_t *clnp_header;
|
||||
const struct clnp_segment_header_t *clnp_segment_header;
|
||||
u_int8_t rfd_error_major,rfd_error_minor;
|
||||
@ -746,8 +793,7 @@ static int clnp_print (const u_int8_t *pptr, u_int length)
|
||||
u_int op, opli;
|
||||
const u_int8_t *tptr;
|
||||
|
||||
if (snapend - pptr < 2)
|
||||
return (0);
|
||||
TCHECK2(*pptr, 2);
|
||||
if (li < 2) {
|
||||
printf(", bad opts/li");
|
||||
return (0);
|
||||
@ -755,15 +801,14 @@ static int clnp_print (const u_int8_t *pptr, u_int length)
|
||||
op = *pptr++;
|
||||
opli = *pptr++;
|
||||
li -= 2;
|
||||
TCHECK2(*pptr, opli);
|
||||
if (opli > li) {
|
||||
printf(", opt (%d) too long", op);
|
||||
return (0);
|
||||
}
|
||||
li -= opli;
|
||||
tptr = pptr;
|
||||
|
||||
if (snapend < pptr)
|
||||
return(0);
|
||||
tlen = opli;
|
||||
|
||||
printf("\n\t %s Option #%u, length %u, value: ",
|
||||
tok2str(clnp_option_values,"Unknown",op),
|
||||
@ -772,9 +817,61 @@ static int clnp_print (const u_int8_t *pptr, u_int length)
|
||||
|
||||
switch (op) {
|
||||
|
||||
|
||||
case CLNP_OPTION_ROUTE_RECORDING: /* those two options share the format */
|
||||
case CLNP_OPTION_SOURCE_ROUTING:
|
||||
printf("%s %s",
|
||||
tok2str(clnp_option_sr_rr_values,"Unknown",*tptr),
|
||||
tok2str(clnp_option_sr_rr_string_values,"Unknown Option %u",op));
|
||||
nsap_offset=*(tptr+1);
|
||||
if (nsap_offset == 0) {
|
||||
printf(" Bad NSAP offset (0)");
|
||||
break;
|
||||
}
|
||||
nsap_offset-=1; /* offset to nsap list */
|
||||
if (nsap_offset > tlen) {
|
||||
printf(" Bad NSAP offset (past end of option)");
|
||||
break;
|
||||
}
|
||||
tptr+=nsap_offset;
|
||||
tlen-=nsap_offset;
|
||||
while (tlen > 0) {
|
||||
source_address_length=*tptr;
|
||||
if (tlen < source_address_length+1) {
|
||||
printf("\n\t NSAP address goes past end of option");
|
||||
break;
|
||||
}
|
||||
if (source_address_length > 0) {
|
||||
source_address=(tptr+1);
|
||||
TCHECK2(*source_address, source_address_length);
|
||||
printf("\n\t NSAP address (length %u): %s",
|
||||
source_address_length,
|
||||
isonsap_string(source_address, source_address_length));
|
||||
}
|
||||
tlen-=source_address_length+1;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLNP_OPTION_PRIORITY:
|
||||
printf("%u", *tptr);
|
||||
break;
|
||||
printf("0x%1x", *tptr&0x0f);
|
||||
break;
|
||||
|
||||
case CLNP_OPTION_QOS_MAINTENANCE:
|
||||
printf("\n\t Format Code: %s",
|
||||
tok2str(clnp_option_scope_values,"Reserved",*tptr&CLNP_OPTION_SCOPE_MASK));
|
||||
|
||||
if ((*tptr&CLNP_OPTION_SCOPE_MASK) == CLNP_OPTION_SCOPE_GLOBAL)
|
||||
printf("\n\t QoS Flags [%s]",
|
||||
bittok2str(clnp_option_qos_global_values,
|
||||
"none",
|
||||
*tptr&CLNP_OPTION_OPTION_QOS_MASK));
|
||||
break;
|
||||
|
||||
case CLNP_OPTION_SECURITY:
|
||||
printf("\n\t Format Code: %s, Security-Level %u",
|
||||
tok2str(clnp_option_scope_values,"Reserved",*tptr&CLNP_OPTION_SCOPE_MASK),
|
||||
*(tptr+1));
|
||||
break;
|
||||
|
||||
case CLNP_OPTION_DISCARD_REASON:
|
||||
rfd_error_major = (*tptr&0xf0) >> 4;
|
||||
@ -786,6 +883,10 @@ static int clnp_print (const u_int8_t *pptr, u_int length)
|
||||
rfd_error_minor);
|
||||
break;
|
||||
|
||||
case CLNP_OPTION_PADDING:
|
||||
printf("padding data");
|
||||
break;
|
||||
|
||||
/*
|
||||
* FIXME those are the defined Options that lack a decoder
|
||||
* you are welcome to contribute code ;-)
|
||||
@ -804,6 +905,7 @@ static int clnp_print (const u_int8_t *pptr, u_int length)
|
||||
|
||||
case CLNP_PDU_ER: /* fall through */
|
||||
case CLNP_PDU_ERP:
|
||||
TCHECK(*pptr);
|
||||
if (*(pptr) == NLPID_CLNP) {
|
||||
printf("\n\t-----original packet-----\n\t");
|
||||
/* FIXME recursion protection */
|
||||
@ -872,6 +974,7 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
}
|
||||
|
||||
esis_header = (const struct esis_header_t *) pptr;
|
||||
TCHECK(*esis_header);
|
||||
li = esis_header->length_indicator;
|
||||
optr = pptr;
|
||||
|
||||
@ -921,7 +1024,8 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
/* do not attempt to verify the checksum if it is zero */
|
||||
if (EXTRACT_16BITS(esis_header->cksum) == 0)
|
||||
printf("(unverified)");
|
||||
else printf("(%s)", osi_cksum(pptr, li) ? "incorrect" : "correct");
|
||||
else
|
||||
printf("(%s)", osi_cksum(pptr, li) ? "incorrect" : "correct");
|
||||
|
||||
printf(", holding time: %us, length indicator: %u",EXTRACT_16BITS(esis_header->holdtime),li);
|
||||
|
||||
@ -933,25 +1037,72 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
|
||||
switch (esis_pdu_type) {
|
||||
case ESIS_PDU_REDIRECT: {
|
||||
const u_int8_t *dst, *snpa, *tptr;
|
||||
const u_int8_t *dst, *snpa, *neta;
|
||||
u_int dstl, snpal, netal;
|
||||
|
||||
dst = pptr; pptr += *pptr + 1;
|
||||
if (pptr > snapend)
|
||||
TCHECK(*pptr);
|
||||
if (li < 1) {
|
||||
printf(", bad redirect/li");
|
||||
return;
|
||||
printf("\n\t %s", isonsap_string(dst+1,*dst));
|
||||
snpa = pptr; pptr += *pptr + 1;
|
||||
tptr = pptr; pptr += *pptr + 1;
|
||||
if (pptr > snapend)
|
||||
}
|
||||
dstl = *pptr;
|
||||
pptr++;
|
||||
li--;
|
||||
TCHECK2(*pptr, dstl);
|
||||
if (li < dstl) {
|
||||
printf(", bad redirect/li");
|
||||
return;
|
||||
}
|
||||
dst = pptr;
|
||||
pptr += dstl;
|
||||
li -= dstl;
|
||||
printf("\n\t %s", isonsap_string(dst,dstl));
|
||||
|
||||
if (tptr[0] == 0)
|
||||
printf("\n\t %s", etheraddr_string(&snpa[1]));
|
||||
TCHECK(*pptr);
|
||||
if (li < 1) {
|
||||
printf(", bad redirect/li");
|
||||
return;
|
||||
}
|
||||
snpal = *pptr;
|
||||
pptr++;
|
||||
li--;
|
||||
TCHECK2(*pptr, snpal);
|
||||
if (li < snpal) {
|
||||
printf(", bad redirect/li");
|
||||
return;
|
||||
}
|
||||
snpa = pptr;
|
||||
pptr += snpal;
|
||||
li -= snpal;
|
||||
TCHECK(*pptr);
|
||||
if (li < 1) {
|
||||
printf(", bad redirect/li");
|
||||
return;
|
||||
}
|
||||
netal = *pptr;
|
||||
pptr++;
|
||||
TCHECK2(*pptr, netal);
|
||||
if (li < netal) {
|
||||
printf(", bad redirect/li");
|
||||
return;
|
||||
}
|
||||
neta = pptr;
|
||||
pptr += netal;
|
||||
li -= netal;
|
||||
|
||||
if (netal == 0)
|
||||
printf("\n\t %s", etheraddr_string(snpa));
|
||||
else
|
||||
printf("\n\t %s", isonsap_string(tptr+1,*tptr));
|
||||
printf("\n\t %s", isonsap_string(neta,netal));
|
||||
break;
|
||||
}
|
||||
|
||||
case ESIS_PDU_ESH:
|
||||
TCHECK(*pptr);
|
||||
if (li < 1) {
|
||||
printf(", bad esh/li");
|
||||
return;
|
||||
}
|
||||
source_address_number = *pptr;
|
||||
pptr++;
|
||||
li--;
|
||||
@ -959,23 +1110,47 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
printf("\n\t Number of Source Addresses: %u", source_address_number);
|
||||
|
||||
while (source_address_number > 0) {
|
||||
TCHECK(*pptr);
|
||||
if (li < 1) {
|
||||
printf(", bad esh/li");
|
||||
return;
|
||||
}
|
||||
source_address_length = *pptr;
|
||||
pptr++;
|
||||
li--;
|
||||
|
||||
TCHECK2(*pptr, source_address_length);
|
||||
if (li < source_address_length) {
|
||||
printf(", bad esh/li");
|
||||
return;
|
||||
}
|
||||
printf("\n\t NET (length: %u): %s",
|
||||
source_address_length,
|
||||
isonsap_string(pptr+1,source_address_length));
|
||||
|
||||
pptr += source_address_length+1;
|
||||
li -= source_address_length+1;
|
||||
isonsap_string(pptr,source_address_length));
|
||||
pptr += source_address_length;
|
||||
li -= source_address_length;
|
||||
source_address_number--;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ESIS_PDU_ISH: {
|
||||
TCHECK(*pptr);
|
||||
if (li < 1) {
|
||||
printf(", bad ish/li");
|
||||
return;
|
||||
}
|
||||
source_address_length = *pptr;
|
||||
printf("\n\t NET (length: %u): %s", source_address_length, isonsap_string(pptr+1, source_address_length));
|
||||
pptr += source_address_length+1;
|
||||
li -= source_address_length +1;
|
||||
pptr++;
|
||||
li--;
|
||||
TCHECK2(*pptr, source_address_length);
|
||||
if (li < source_address_length) {
|
||||
printf(", bad ish/li");
|
||||
return;
|
||||
}
|
||||
printf("\n\t NET (length: %u): %s", source_address_length, isonsap_string(pptr, source_address_length));
|
||||
pptr += source_address_length;
|
||||
li -= source_address_length;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -992,8 +1167,7 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
u_int op, opli;
|
||||
const u_int8_t *tptr;
|
||||
|
||||
if (snapend - pptr < 2)
|
||||
return;
|
||||
TCHECK2(*pptr, 2);
|
||||
if (li < 2) {
|
||||
printf(", bad opts/li");
|
||||
return;
|
||||
@ -1008,9 +1182,6 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
li -= opli;
|
||||
tptr = pptr;
|
||||
|
||||
if (snapend < pptr)
|
||||
return;
|
||||
|
||||
printf("\n\t %s Option #%u, length %u, value: ",
|
||||
tok2str(esis_option_values,"Unknown",op),
|
||||
op,
|
||||
@ -1019,12 +1190,13 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
switch (op) {
|
||||
|
||||
case ESIS_OPTION_ES_CONF_TIME:
|
||||
TCHECK2(*pptr, 2);
|
||||
printf("%us", EXTRACT_16BITS(tptr));
|
||||
break;
|
||||
|
||||
|
||||
case ESIS_OPTION_PROTOCOLS:
|
||||
while (opli>0) {
|
||||
TCHECK(*pptr);
|
||||
printf("%s (0x%02x)",
|
||||
tok2str(nlpid_values,
|
||||
"unknown",
|
||||
@ -1056,6 +1228,8 @@ esis_print(const u_int8_t *pptr, u_int length)
|
||||
print_unknown_data(pptr,"\n\t ",opli);
|
||||
pptr += opli;
|
||||
}
|
||||
trunc:
|
||||
return;
|
||||
}
|
||||
|
||||
/* shared routine for printing system, node and lsp-ids */
|
||||
@ -1327,7 +1501,7 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
|
||||
not specified so just lets hexdump what is left */
|
||||
if(subl>0){
|
||||
if(!print_unknown_data(tptr,"\n\t\t ",
|
||||
subl-36))
|
||||
subl))
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@ -1940,7 +2114,11 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
case ISIS_TLV_ISNEIGH_VARLEN:
|
||||
if (!TTEST2(*tptr, 1) || tmp < 3) /* min. TLV length */
|
||||
goto trunctlv;
|
||||
lan_alen = *tptr++; /* LAN adress length */
|
||||
lan_alen = *tptr++; /* LAN address length */
|
||||
if (lan_alen == 0) {
|
||||
printf("\n\t LAN address length 0 bytes (invalid)");
|
||||
break;
|
||||
}
|
||||
tmp --;
|
||||
printf("\n\t LAN address length %u bytes ",lan_alen);
|
||||
while (tmp >= lan_alen) {
|
||||
@ -2084,7 +2262,7 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_IP6ADDR:
|
||||
while (tmp>0) {
|
||||
while (tmp>=16) {
|
||||
if (!TTEST2(*tptr, 16))
|
||||
goto trunctlv;
|
||||
|
||||
@ -2188,7 +2366,7 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_IPADDR:
|
||||
while (tmp>0) {
|
||||
while (tmp>=4) {
|
||||
if (!TTEST2(*tptr, 4))
|
||||
goto trunctlv;
|
||||
printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr));
|
||||
@ -2208,30 +2386,38 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_SHARED_RISK_GROUP:
|
||||
if (tmp < NODE_ID_LEN)
|
||||
break;
|
||||
if (!TTEST2(*tptr, NODE_ID_LEN))
|
||||
goto trunctlv;
|
||||
printf("\n\t IS Neighbor: %s", isis_print_id(tptr, NODE_ID_LEN));
|
||||
tptr+=(NODE_ID_LEN);
|
||||
tmp-=(NODE_ID_LEN);
|
||||
|
||||
if (tmp < 1)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 1))
|
||||
goto trunctlv;
|
||||
printf(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered");
|
||||
tmp--;
|
||||
|
||||
if (tmp < 4)
|
||||
break;
|
||||
if (!TTEST2(*tptr,4))
|
||||
goto trunctlv;
|
||||
printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr));
|
||||
tptr+=4;
|
||||
tmp-=4;
|
||||
|
||||
if (tmp < 4)
|
||||
break;
|
||||
if (!TTEST2(*tptr,4))
|
||||
goto trunctlv;
|
||||
printf("\n\t IPv4 neighbor address: %s", ipaddr_string(tptr));
|
||||
tptr+=4;
|
||||
tmp-=4;
|
||||
|
||||
while (tmp>0) {
|
||||
while (tmp>=4) {
|
||||
if (!TTEST2(*tptr, 4))
|
||||
goto trunctlv;
|
||||
printf("\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr));
|
||||
@ -2242,7 +2428,7 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
|
||||
case ISIS_TLV_LSP:
|
||||
tlv_lsp = (const struct isis_tlv_lsp *)tptr;
|
||||
while(tmp>0) {
|
||||
while(tmp>=sizeof(struct isis_tlv_lsp)) {
|
||||
if (!TTEST((tlv_lsp->lsp_id)[LSP_ID_LEN-1]))
|
||||
goto trunctlv;
|
||||
printf("\n\t lsp-id: %s",
|
||||
@ -2262,6 +2448,8 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_CHECKSUM:
|
||||
if (tmp < 2)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 2))
|
||||
goto trunctlv;
|
||||
printf("\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr));
|
||||
@ -2293,15 +2481,29 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_RESTART_SIGNALING:
|
||||
if (tmp < 3)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 3))
|
||||
goto trunctlv;
|
||||
printf("\n\t Flags [%s], Remaining holding time %us",
|
||||
bittok2str(isis_restart_flag_values, "none", *tptr),
|
||||
EXTRACT_16BITS(tptr+1));
|
||||
tptr+=3;
|
||||
tmp-=3;
|
||||
if (tmp == SYSTEM_ID_LEN) {
|
||||
if (!TTEST2(*tptr, SYSTEM_ID_LEN))
|
||||
goto trunctlv;
|
||||
printf(", for %s",isis_print_id(tptr,SYSTEM_ID_LEN));
|
||||
} else if (tmp == NODE_ID_LEN) {
|
||||
if (!TTEST2(*tptr, NODE_ID_LEN))
|
||||
goto trunctlv;
|
||||
printf(", for %s",isis_print_id(tptr,NODE_ID_LEN));
|
||||
}
|
||||
break;
|
||||
|
||||
case ISIS_TLV_IDRP_INFO:
|
||||
if (tmp < 1)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 1))
|
||||
goto trunctlv;
|
||||
printf("\n\t Inter-Domain Information Type: %s",
|
||||
@ -2324,6 +2526,8 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_LSP_BUFFERSIZE:
|
||||
if (tmp < 2)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 2))
|
||||
goto trunctlv;
|
||||
printf("\n\t LSP Buffersize: %u",EXTRACT_16BITS(tptr));
|
||||
@ -2340,6 +2544,8 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_PREFIX_NEIGH:
|
||||
if (tmp < sizeof(struct isis_metric_block))
|
||||
break;
|
||||
if (!TTEST2(*tptr, sizeof(struct isis_metric_block)))
|
||||
goto trunctlv;
|
||||
printf("\n\t Metric Block");
|
||||
@ -2351,7 +2557,13 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
if (!TTEST2(*tptr, 1))
|
||||
goto trunctlv;
|
||||
prefix_len=*tptr++; /* read out prefix length in semioctets*/
|
||||
if (prefix_len < 2) {
|
||||
printf("\n\t\tAddress: prefix length %u < 2", prefix_len);
|
||||
break;
|
||||
}
|
||||
tmp--;
|
||||
if (tmp < prefix_len/2)
|
||||
break;
|
||||
if (!TTEST2(*tptr, prefix_len/2))
|
||||
goto trunctlv;
|
||||
printf("\n\t\tAddress: %s/%u",
|
||||
@ -2363,12 +2575,16 @@ static int isis_print (const u_int8_t *p, u_int length)
|
||||
break;
|
||||
|
||||
case ISIS_TLV_IIH_SEQNR:
|
||||
if (tmp < 4)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 4)) /* check if four bytes are on the wire */
|
||||
goto trunctlv;
|
||||
printf("\n\t Sequence number: %u", EXTRACT_32BITS(tptr) );
|
||||
break;
|
||||
|
||||
case ISIS_TLV_VENDOR_PRIVATE:
|
||||
if (tmp < 3)
|
||||
break;
|
||||
if (!TTEST2(*tptr, 3)) /* check if enough byte for a full oui */
|
||||
goto trunctlv;
|
||||
vendor_id = EXTRACT_24BITS(tptr);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8 2005/04/06 21:32:41 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-juniper.c,v 1.8.2.13 2005/06/20 07:45:05 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -28,131 +28,476 @@ static const char rcsid[] _U_ =
|
||||
#include <stdio.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "addrtoname.h"
|
||||
#include "extract.h"
|
||||
#include "ppp.h"
|
||||
#include "llc.h"
|
||||
#include "nlpid.h"
|
||||
#include "ethertype.h"
|
||||
#include "atm.h"
|
||||
|
||||
#define JUNIPER_BPF_OUT 0 /* Outgoing packet */
|
||||
#define JUNIPER_BPF_IN 1 /* Incoming packet */
|
||||
#define JUNIPER_BPF_PKT_IN 0x1 /* Incoming packet */
|
||||
#define JUNIPER_BPF_NO_L2 0x2 /* L2 header stripped */
|
||||
#define JUNIPER_MGC_NUMBER 0x4d4743 /* = "MGC" */
|
||||
|
||||
#define JUNIPER_LSQ_L3_PROTO_SHIFT 4
|
||||
#define JUNIPER_LSQ_L3_PROTO_MASK (0x17 << JUNIPER_LSQ_L3_PROTO_SHIFT)
|
||||
#define JUNIPER_LSQ_L3_PROTO_IPV4 (0 << JUNIPER_LSQ_L3_PROTO_SHIFT)
|
||||
#define JUNIPER_LSQ_L3_PROTO_IPV6 (1 << JUNIPER_LSQ_L3_PROTO_SHIFT)
|
||||
#define JUNIPER_LSQ_L3_PROTO_MPLS (2 << JUNIPER_LSQ_L3_PROTO_SHIFT)
|
||||
#define JUNIPER_LSQ_L3_PROTO_ISO (3 << JUNIPER_LSQ_L3_PROTO_SHIFT)
|
||||
|
||||
#define JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE 1
|
||||
#define JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE 2
|
||||
#define JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE 3
|
||||
#define JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE 4
|
||||
#define JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE 5
|
||||
|
||||
static struct tok juniper_ipsec_type_values[] = {
|
||||
{ JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE, "ESP ENCR-AUTH" },
|
||||
{ JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE, "ESP ENCR-AH AUTH" },
|
||||
{ JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE, "ESP AUTH" },
|
||||
{ JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE, "AH AUTH" },
|
||||
{ JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE, "ESP ENCR" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
static struct tok juniper_direction_values[] = {
|
||||
{ JUNIPER_BPF_IN, "In"},
|
||||
{ JUNIPER_BPF_OUT, "Out"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
struct juniper_cookie_table_t {
|
||||
u_int32_t pictype; /* pic type */
|
||||
u_int8_t cookie_len; /* cookie len */
|
||||
const char *s; /* pic name */
|
||||
};
|
||||
|
||||
static struct juniper_cookie_table_t juniper_cookie_table[] = {
|
||||
#ifdef DLT_JUNIPER_ATM1
|
||||
{ DLT_JUNIPER_ATM1, 4, "ATM1"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_ATM2
|
||||
{ DLT_JUNIPER_ATM2, 8, "ATM2"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MLPPP
|
||||
{ DLT_JUNIPER_MLPPP, 2, "MLPPP"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MLFR
|
||||
{ DLT_JUNIPER_MLFR, 2, "MLFR"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MFR
|
||||
{ DLT_JUNIPER_MFR, 4, "MFR"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_PPPOE
|
||||
{ DLT_JUNIPER_PPPOE, 0, "PPPoE"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_PPPOE_ATM
|
||||
{ DLT_JUNIPER_PPPOE_ATM, 0, "PPPoE ATM"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_GGSN
|
||||
{ DLT_JUNIPER_GGSN, 8, "GGSN"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MONITOR
|
||||
{ DLT_JUNIPER_MONITOR, 8, "MONITOR"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_SERVICES
|
||||
{ DLT_JUNIPER_SERVICES, 8, "AS"},
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_ES
|
||||
{ DLT_JUNIPER_ES, 0, "ES"},
|
||||
#endif
|
||||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
struct juniper_l2info_t {
|
||||
u_int32_t length;
|
||||
u_int32_t caplen;
|
||||
u_int32_t pictype;
|
||||
u_int8_t direction;
|
||||
u_int8_t header_len;
|
||||
u_int8_t cookie_len;
|
||||
u_int8_t cookie_type;
|
||||
u_int8_t cookie[8];
|
||||
u_int8_t bundle;
|
||||
u_int16_t proto;
|
||||
};
|
||||
|
||||
#define LS_COOKIE_ID 0x54
|
||||
#define LS_MLFR_LEN 4
|
||||
#define ML_MLFR_LEN 2
|
||||
#define AS_COOKIE_ID 0x47
|
||||
#define LS_MLFR_COOKIE_LEN 4
|
||||
#define ML_MLFR_COOKIE_LEN 2
|
||||
#define LS_MFR_COOKIE_LEN 6
|
||||
#define ATM1_COOKIE_LEN 4
|
||||
#define ATM2_COOKIE_LEN 8
|
||||
|
||||
#define ATM2_PKT_TYPE_MASK 0x70
|
||||
#define ATM2_GAP_COUNT_MASK 0x3F
|
||||
|
||||
#define JUNIPER_PROTO_NULL 1
|
||||
#define JUNIPER_PROTO_IPV4 2
|
||||
#define JUNIPER_PROTO_IPV6 6
|
||||
|
||||
static struct tok juniper_protocol_values[] = {
|
||||
{ JUNIPER_PROTO_NULL, "Null" },
|
||||
{ JUNIPER_PROTO_IPV4, "IPv4" },
|
||||
{ JUNIPER_PROTO_IPV6, "IPv6" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
int ip_heuristic_guess(register const u_char *, u_int);
|
||||
int juniper_ppp_heuristic_guess(register const u_char *, u_int);
|
||||
static int juniper_parse_header (const u_char *, u_int8_t *, u_int);
|
||||
static int juniper_parse_header (const u_char *, const struct pcap_pkthdr *, struct juniper_l2info_t *);
|
||||
|
||||
#ifdef DLT_JUNIPER_GGSN
|
||||
u_int
|
||||
juniper_ggsn_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
struct juniper_ggsn_header {
|
||||
u_int8_t svc_id;
|
||||
u_int8_t flags_len;
|
||||
u_int8_t proto;
|
||||
u_int8_t flags;
|
||||
u_int8_t vlan_id[2];
|
||||
u_int8_t res[2];
|
||||
};
|
||||
const struct juniper_ggsn_header *gh;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_GGSN;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
gh = (struct juniper_ggsn_header *)p;
|
||||
|
||||
if (eflag)
|
||||
printf("proto %s (%u), vlan %u: ",
|
||||
tok2str(juniper_protocol_values,"Unknown",gh->proto),
|
||||
gh->proto,
|
||||
EXTRACT_16BITS(&gh->vlan_id[0]));
|
||||
|
||||
switch (gh->proto) {
|
||||
case JUNIPER_PROTO_IPV4:
|
||||
ip_print(gndo, p, l2info.length);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case JUNIPER_PROTO_IPV6:
|
||||
ip6_print(p, l2info.length);
|
||||
break;
|
||||
#endif /* INET6 */
|
||||
default:
|
||||
if (!eflag)
|
||||
printf("unknown GGSN proto (%u)", gh->proto);
|
||||
}
|
||||
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_ES
|
||||
u_int
|
||||
juniper_es_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
struct juniper_ipsec_header {
|
||||
u_int8_t sa_index[2];
|
||||
u_int8_t ttl;
|
||||
u_int8_t type;
|
||||
u_int8_t spi[4];
|
||||
u_int8_t src_ip[4];
|
||||
u_int8_t dst_ip[4];
|
||||
};
|
||||
u_int rewrite_len,es_type_bundle;
|
||||
const struct juniper_ipsec_header *ih;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_ES;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
ih = (struct juniper_ipsec_header *)p;
|
||||
|
||||
switch (ih->type) {
|
||||
case JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE:
|
||||
case JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE:
|
||||
rewrite_len = 0;
|
||||
es_type_bundle = 1;
|
||||
break;
|
||||
case JUNIPER_IPSEC_O_ESP_AUTHENTICATION_TYPE:
|
||||
case JUNIPER_IPSEC_O_AH_AUTHENTICATION_TYPE:
|
||||
case JUNIPER_IPSEC_O_ESP_ENCRYPTION_TYPE:
|
||||
rewrite_len = 16;
|
||||
es_type_bundle = 0;
|
||||
default:
|
||||
printf("ES Invalid type %u, length %u",
|
||||
ih->type,
|
||||
l2info.length);
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
l2info.length-=rewrite_len;
|
||||
p+=rewrite_len;
|
||||
|
||||
if (eflag) {
|
||||
if (!es_type_bundle) {
|
||||
printf("ES SA, index %u, ttl %u type %s (%u), spi %u, Tunnel %s > %s, length %u\n",
|
||||
EXTRACT_16BITS(&ih->sa_index),
|
||||
ih->ttl,
|
||||
tok2str(juniper_ipsec_type_values,"Unknown",ih->type),
|
||||
ih->type,
|
||||
EXTRACT_32BITS(&ih->spi),
|
||||
ipaddr_string(EXTRACT_32BITS(&ih->src_ip)),
|
||||
ipaddr_string(EXTRACT_32BITS(&ih->dst_ip)),
|
||||
l2info.length);
|
||||
} else {
|
||||
printf("ES SA, index %u, ttl %u type %s (%u), length %u\n",
|
||||
EXTRACT_16BITS(&ih->sa_index),
|
||||
ih->ttl,
|
||||
tok2str(juniper_ipsec_type_values,"Unknown",ih->type),
|
||||
ih->type,
|
||||
l2info.length);
|
||||
}
|
||||
}
|
||||
|
||||
ip_print(gndo, p, l2info.length);
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_MONITOR
|
||||
u_int
|
||||
juniper_monitor_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
struct juniper_monitor_header {
|
||||
u_int8_t pkt_type;
|
||||
u_int8_t padding;
|
||||
u_int8_t iif[2];
|
||||
u_int8_t service_id[4];
|
||||
};
|
||||
const struct juniper_monitor_header *mh;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_MONITOR;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
mh = (struct juniper_monitor_header *)p;
|
||||
|
||||
if (eflag)
|
||||
printf("service-id %u, iif %u, pkt-type %u: ",
|
||||
EXTRACT_32BITS(&mh->service_id),
|
||||
EXTRACT_16BITS(&mh->iif),
|
||||
mh->pkt_type);
|
||||
|
||||
/* no proto field - lets guess by first byte of IP header*/
|
||||
ip_heuristic_guess(p, l2info.length);
|
||||
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_SERVICES
|
||||
u_int
|
||||
juniper_services_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
struct juniper_services_header {
|
||||
u_int8_t svc_id;
|
||||
u_int8_t flags_len;
|
||||
u_int8_t svc_set_id[2];
|
||||
u_int8_t dir_iif[4];
|
||||
};
|
||||
const struct juniper_services_header *sh;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_SERVICES;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
sh = (struct juniper_services_header *)p;
|
||||
|
||||
if (eflag)
|
||||
printf("service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
|
||||
sh->svc_id,
|
||||
sh->flags_len,
|
||||
EXTRACT_16BITS(&sh->svc_set_id),
|
||||
EXTRACT_24BITS(&sh->dir_iif[1]));
|
||||
|
||||
/* no proto field - lets guess by first byte of IP header*/
|
||||
ip_heuristic_guess(p, l2info.length);
|
||||
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_PPPOE
|
||||
u_int
|
||||
juniper_pppoe_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_PPPOE;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
/* this DLT contains nothing but raw ethernet frames */
|
||||
ether_print(p, l2info.length, l2info.caplen);
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_PPPOE_ATM
|
||||
u_int
|
||||
juniper_pppoe_atm_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
u_int16_t extracted_ethertype;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_PPPOE_ATM;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
|
||||
extracted_ethertype = EXTRACT_16BITS(p);
|
||||
/* this DLT contains nothing but raw PPPoE frames,
|
||||
* prepended with a type field*/
|
||||
if (ether_encap_print(extracted_ethertype,
|
||||
p+ETHERTYPE_LEN,
|
||||
l2info.length-ETHERTYPE_LEN,
|
||||
l2info.caplen-ETHERTYPE_LEN,
|
||||
&extracted_ethertype) == 0)
|
||||
/* ether_type not known, probably it wasn't one */
|
||||
printf("unknown ethertype 0x%04x", extracted_ethertype);
|
||||
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_MLPPP
|
||||
u_int
|
||||
juniper_mlppp_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_int8_t direction,bundle,cookie_len;
|
||||
u_int32_t cookie,proto;
|
||||
|
||||
if(juniper_parse_header(p, &direction,length) == 0)
|
||||
return 0;
|
||||
struct juniper_l2info_t l2info;
|
||||
|
||||
p+=4;
|
||||
length-=4;
|
||||
caplen-=4;
|
||||
|
||||
if (p[0] == LS_COOKIE_ID) {
|
||||
cookie=EXTRACT_32BITS(p);
|
||||
if (eflag) printf("LSPIC-MLPPP cookie 0x%08x, ",cookie);
|
||||
cookie_len = LS_MLFR_LEN;
|
||||
bundle = cookie & 0xff;
|
||||
} else {
|
||||
cookie=EXTRACT_16BITS(p);
|
||||
if (eflag) printf("MLPIC-MLPPP cookie 0x%04x, ",cookie);
|
||||
cookie_len = ML_MLFR_LEN;
|
||||
bundle = (cookie >> 8) & 0xff;
|
||||
}
|
||||
|
||||
proto = EXTRACT_16BITS(p+cookie_len);
|
||||
p += cookie_len;
|
||||
length-= cookie_len;
|
||||
caplen-= cookie_len;
|
||||
l2info.pictype = DLT_JUNIPER_MLPPP;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
/* suppress Bundle-ID if frame was captured on a child-link
|
||||
* this may be the case if the cookie looks like a proto */
|
||||
* best indicator if the cookie looks like a proto */
|
||||
if (eflag &&
|
||||
cookie != PPP_OSI &&
|
||||
cookie != (PPP_ADDRESS << 8 | PPP_CONTROL))
|
||||
printf("Bundle-ID %u, ",bundle);
|
||||
EXTRACT_16BITS(&l2info.cookie) != PPP_OSI &&
|
||||
EXTRACT_16BITS(&l2info.cookie) != (PPP_ADDRESS << 8 | PPP_CONTROL))
|
||||
printf("Bundle-ID %u: ",l2info.bundle);
|
||||
|
||||
switch (cookie) {
|
||||
p+=l2info.header_len;
|
||||
|
||||
/* first try the LSQ protos */
|
||||
switch(l2info.proto) {
|
||||
case JUNIPER_LSQ_L3_PROTO_IPV4:
|
||||
ip_print(gndo, p, l2info.length);
|
||||
return l2info.header_len;
|
||||
#ifdef INET6
|
||||
case JUNIPER_LSQ_L3_PROTO_IPV6:
|
||||
ip6_print(p,l2info.length);
|
||||
return l2info.header_len;
|
||||
#endif
|
||||
case JUNIPER_LSQ_L3_PROTO_MPLS:
|
||||
mpls_print(p,l2info.length);
|
||||
return l2info.header_len;
|
||||
case JUNIPER_LSQ_L3_PROTO_ISO:
|
||||
isoclns_print(p,l2info.length,l2info.caplen);
|
||||
return l2info.header_len;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* zero length cookie ? */
|
||||
switch (EXTRACT_16BITS(&l2info.cookie)) {
|
||||
case PPP_OSI:
|
||||
ppp_print(p-2,length+2);
|
||||
ppp_print(p-2,l2info.length+2);
|
||||
break;
|
||||
case (PPP_ADDRESS << 8 | PPP_CONTROL): /* fall through */
|
||||
default:
|
||||
ppp_print(p,length);
|
||||
ppp_print(p,l2info.length);
|
||||
break;
|
||||
}
|
||||
|
||||
return cookie_len;
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DLT_JUNIPER_MFR
|
||||
u_int
|
||||
juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
juniper_mfr_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_int8_t direction,bundle,cookie_len;
|
||||
u_int32_t cookie,proto,frelay_len = 0;
|
||||
struct juniper_l2info_t l2info;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_MFR;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
if(juniper_parse_header(p, &direction,length) == 0)
|
||||
return 0;
|
||||
|
||||
p+=4;
|
||||
length-=4;
|
||||
caplen-=4;
|
||||
|
||||
if (p[0] == LS_COOKIE_ID) {
|
||||
cookie=EXTRACT_32BITS(p);
|
||||
if (eflag) printf("LSPIC-MLFR cookie 0x%08x, ",cookie);
|
||||
cookie_len = LS_MLFR_LEN;
|
||||
bundle = cookie & 0xff;
|
||||
} else {
|
||||
cookie=EXTRACT_16BITS(p);
|
||||
if (eflag) printf("MLPIC-MLFR cookie 0x%04x, ",cookie);
|
||||
cookie_len = ML_MLFR_LEN;
|
||||
bundle = (cookie >> 8) & 0xff;
|
||||
}
|
||||
|
||||
proto = EXTRACT_16BITS(p+cookie_len);
|
||||
p += cookie_len+2;
|
||||
length-= cookie_len+2;
|
||||
caplen-= cookie_len+2;
|
||||
|
||||
p+=l2info.header_len;
|
||||
/* suppress Bundle-ID if frame was captured on a child-link */
|
||||
if (eflag && cookie != 1) printf("Bundle-ID %u, ",bundle);
|
||||
|
||||
switch (proto) {
|
||||
case (LLC_UI):
|
||||
case (LLC_UI<<8):
|
||||
isoclns_print(p, length, caplen);
|
||||
if (eflag && EXTRACT_32BITS(l2info.cookie) != 1) printf("Bundle-ID %u, ",l2info.bundle);
|
||||
switch (l2info.proto) {
|
||||
case (LLCSAP_ISONS<<8 | LLCSAP_ISONS):
|
||||
isoclns_print(p+1, l2info.length-1, l2info.caplen-1);
|
||||
break;
|
||||
case (LLC_UI<<8 | NLPID_Q933):
|
||||
case (LLC_UI<<8 | NLPID_IP):
|
||||
case (LLC_UI<<8 | NLPID_IP6):
|
||||
isoclns_print(p-1, length+1, caplen+1); /* pass IP{4,6} to the OSI layer for proper link-layer printing */
|
||||
/* pass IP{4,6} to the OSI layer for proper link-layer printing */
|
||||
isoclns_print(p-1, l2info.length+1, l2info.caplen+1);
|
||||
break;
|
||||
default:
|
||||
printf("unknown protocol 0x%04x, length %u",proto, length);
|
||||
printf("unknown protocol 0x%04x, length %u",l2info.proto, l2info.length);
|
||||
}
|
||||
|
||||
return cookie_len + frelay_len;
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DLT_JUNIPER_MLFR
|
||||
u_int
|
||||
juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
struct juniper_l2info_t l2info;
|
||||
|
||||
l2info.pictype = DLT_JUNIPER_MLFR;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
p+=l2info.header_len;
|
||||
|
||||
/* suppress Bundle-ID if frame was captured on a child-link */
|
||||
if (eflag && EXTRACT_32BITS(l2info.cookie) != 1) printf("Bundle-ID %u, ",l2info.bundle);
|
||||
switch (l2info.proto) {
|
||||
case (LLC_UI):
|
||||
case (LLC_UI<<8):
|
||||
isoclns_print(p, l2info.length, l2info.caplen);
|
||||
break;
|
||||
case (LLC_UI<<8 | NLPID_Q933):
|
||||
case (LLC_UI<<8 | NLPID_IP):
|
||||
case (LLC_UI<<8 | NLPID_IP6):
|
||||
/* pass IP{4,6} to the OSI layer for proper link-layer printing */
|
||||
isoclns_print(p-1, l2info.length+1, l2info.caplen+1);
|
||||
break;
|
||||
default:
|
||||
printf("unknown protocol 0x%04x, length %u",l2info.proto, l2info.length);
|
||||
}
|
||||
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ATM1 PIC cookie format
|
||||
@ -162,59 +507,45 @@ juniper_mlfr_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
* +-----+-------------------------+-------------------------------+
|
||||
*/
|
||||
|
||||
#ifdef DLT_JUNIPER_ATM1
|
||||
u_int
|
||||
juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_int16_t extracted_ethertype;
|
||||
u_int8_t direction;
|
||||
u_int32_t cookie1;
|
||||
|
||||
if(juniper_parse_header(p, &direction,length) == 0)
|
||||
return 0;
|
||||
struct juniper_l2info_t l2info;
|
||||
|
||||
p+=4;
|
||||
length-=4;
|
||||
caplen-=4;
|
||||
l2info.pictype = DLT_JUNIPER_ATM1;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
cookie1=EXTRACT_32BITS(p);
|
||||
p+=l2info.header_len;
|
||||
|
||||
if (eflag) {
|
||||
/* FIXME decode channel-id, vc-index, fmt-id
|
||||
for once lets just hexdump the cookie */
|
||||
|
||||
printf("ATM1 cookie 0x%08x, ", cookie1);
|
||||
}
|
||||
|
||||
p+=4;
|
||||
length-=4;
|
||||
caplen-=4;
|
||||
|
||||
if ((cookie1 >> 24) == 0x80) { /* OAM cell ? */
|
||||
oam_print(p,length);
|
||||
return 0;
|
||||
if (l2info.cookie[0] == 0x80) { /* OAM cell ? */
|
||||
oam_print(p,l2info.length,ATM_OAM_NOHEC);
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
|
||||
EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
|
||||
|
||||
if (llc_print(p, length, caplen, NULL, NULL,
|
||||
if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL,
|
||||
&extracted_ethertype) != 0)
|
||||
return 8;
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */
|
||||
isoclns_print(p + 1, length - 1, caplen - 1);
|
||||
isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1);
|
||||
/* FIXME check if frame was recognized */
|
||||
return 8;
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if(ip_heuristic_guess(p, length) != 0) /* last try - vcmux encaps ? */
|
||||
return 0;
|
||||
if(ip_heuristic_guess(p, l2info.length) != 0) /* last try - vcmux encaps ? */
|
||||
return l2info.header_len;
|
||||
|
||||
return (8);
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ATM2 PIC cookie format
|
||||
@ -224,71 +555,61 @@ juniper_atm1_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
* +-------------------------------+---------+---+-----+-----------+
|
||||
*/
|
||||
|
||||
#ifdef DLT_JUNIPER_ATM2
|
||||
u_int
|
||||
juniper_atm2_print(const struct pcap_pkthdr *h, register const u_char *p)
|
||||
{
|
||||
register u_int length = h->len;
|
||||
register u_int caplen = h->caplen;
|
||||
u_int16_t extracted_ethertype;
|
||||
u_int8_t direction;
|
||||
u_int32_t cookie1,cookie2;
|
||||
u_int32_t control_word;
|
||||
|
||||
if(juniper_parse_header(p, &direction,length) == 0)
|
||||
return 0;
|
||||
struct juniper_l2info_t l2info;
|
||||
|
||||
p+=4;
|
||||
length-=4;
|
||||
caplen-=4;
|
||||
l2info.pictype = DLT_JUNIPER_ATM2;
|
||||
if(juniper_parse_header(p, h, &l2info) == 0)
|
||||
return l2info.header_len;
|
||||
|
||||
cookie1=EXTRACT_32BITS(p);
|
||||
cookie2=EXTRACT_32BITS(p+4);
|
||||
p+=l2info.header_len;
|
||||
|
||||
if (eflag) {
|
||||
/* FIXME decode channel, fmt-id, ccrq, aal, gap cnt
|
||||
for once lets just hexdump the cookie */
|
||||
|
||||
printf("ATM2 cookie 0x%08x%08x, ",
|
||||
EXTRACT_32BITS(p),
|
||||
EXTRACT_32BITS(p+4));
|
||||
}
|
||||
|
||||
p+=8;
|
||||
length-=8;
|
||||
caplen-=8;
|
||||
|
||||
if (cookie2 & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */
|
||||
oam_print(p,length);
|
||||
return 12;
|
||||
if (l2info.cookie[7] & ATM2_PKT_TYPE_MASK) { /* OAM cell ? */
|
||||
control_word = EXTRACT_32BITS(p);
|
||||
if(control_word == 0 || control_word == 0x08000000) {
|
||||
l2info.header_len += 4;
|
||||
l2info.length -= 4;
|
||||
p += 4;
|
||||
}
|
||||
oam_print(p,l2info.length,ATM_OAM_NOHEC);
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
|
||||
EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
|
||||
|
||||
if (llc_print(p, length, caplen, NULL, NULL,
|
||||
if (llc_print(p, l2info.length, l2info.caplen, NULL, NULL,
|
||||
&extracted_ethertype) != 0)
|
||||
return 12;
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if (direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
|
||||
(cookie1 & ATM2_GAP_COUNT_MASK)) {
|
||||
ether_print(p, length, caplen);
|
||||
return 12;
|
||||
if (l2info.direction != JUNIPER_BPF_PKT_IN && /* ether-over-1483 encaps ? */
|
||||
(EXTRACT_32BITS(l2info.cookie) & ATM2_GAP_COUNT_MASK)) {
|
||||
ether_print(p, l2info.length, l2info.caplen);
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if (p[0] == 0x03) { /* Cisco style NLPID encaps ? */
|
||||
isoclns_print(p + 1, length - 1, caplen - 1);
|
||||
isoclns_print(p + 1, l2info.length - 1, l2info.caplen - 1);
|
||||
/* FIXME check if frame was recognized */
|
||||
return 12;
|
||||
return l2info.header_len;
|
||||
}
|
||||
|
||||
if(juniper_ppp_heuristic_guess(p, length) != 0) /* PPPoA vcmux encaps ? */
|
||||
return 12;
|
||||
if(juniper_ppp_heuristic_guess(p, l2info.length) != 0) /* PPPoA vcmux encaps ? */
|
||||
return l2info.header_len;
|
||||
|
||||
if(ip_heuristic_guess(p, length) != 0) /* last try - vcmux encaps ? */
|
||||
return 12;
|
||||
if(ip_heuristic_guess(p, l2info.length) != 0) /* last try - vcmux encaps ? */
|
||||
return l2info.header_len;
|
||||
|
||||
return (12);
|
||||
return l2info.header_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* try to guess, based on all PPP protos that are supported in
|
||||
@ -367,21 +688,28 @@ ip_heuristic_guess(register const u_char *p, u_int length) {
|
||||
}
|
||||
|
||||
static int
|
||||
juniper_parse_header (const u_char *p, u_int8_t *direction, u_int length) {
|
||||
juniper_parse_header (const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) {
|
||||
|
||||
*direction = p[3]&JUNIPER_BPF_PKT_IN;
|
||||
struct juniper_cookie_table_t *lp = juniper_cookie_table;
|
||||
u_int idx;
|
||||
|
||||
l2info->header_len = 0;
|
||||
l2info->cookie_len = 0;
|
||||
l2info->proto = 0;
|
||||
|
||||
|
||||
l2info->length = h->len;
|
||||
l2info->caplen = h->caplen;
|
||||
l2info->direction = p[3]&JUNIPER_BPF_PKT_IN;
|
||||
|
||||
if (EXTRACT_24BITS(p) != 0x4d4743) /* magic number found ? */
|
||||
return -1;
|
||||
|
||||
if (*direction == JUNIPER_BPF_PKT_IN) {
|
||||
if (eflag)
|
||||
printf("%3s ", "In");
|
||||
}
|
||||
else {
|
||||
if (eflag)
|
||||
printf("%3s ", "Out");
|
||||
}
|
||||
TCHECK2(p[0],4);
|
||||
if (EXTRACT_24BITS(p) != JUNIPER_MGC_NUMBER) /* magic number found ? */
|
||||
return 0;
|
||||
else
|
||||
l2info->header_len = 4;
|
||||
|
||||
if (eflag) /* print direction */
|
||||
printf("%3s ",tok2str(juniper_direction_values,"---",l2info->direction));
|
||||
|
||||
if ((p[3] & JUNIPER_BPF_NO_L2 ) == JUNIPER_BPF_NO_L2 ) {
|
||||
if (eflag)
|
||||
@ -391,19 +719,129 @@ juniper_parse_header (const u_char *p, u_int8_t *direction, u_int length) {
|
||||
* perform the v4/v6 heuristics
|
||||
* to figure out what it is
|
||||
*/
|
||||
if(ip_heuristic_guess(p+8,length-8) == 0)
|
||||
TCHECK2(p[8],1);
|
||||
if(ip_heuristic_guess(p+8,l2info->length-8) == 0)
|
||||
printf("no IP-hdr found!");
|
||||
|
||||
l2info->header_len+=4;
|
||||
return 0; /* stop parsing the output further */
|
||||
|
||||
}
|
||||
|
||||
p+=l2info->header_len;
|
||||
l2info->length -= l2info->header_len;
|
||||
l2info->caplen -= l2info->header_len;
|
||||
|
||||
/* search through the cookie table and copy values matching for our PIC type */
|
||||
while (lp->s != NULL) {
|
||||
if (lp->pictype == l2info->pictype) {
|
||||
|
||||
l2info->cookie_len = lp->cookie_len;
|
||||
l2info->header_len += lp->cookie_len;
|
||||
|
||||
switch (p[0]) {
|
||||
case LS_COOKIE_ID:
|
||||
l2info->cookie_type = LS_COOKIE_ID;
|
||||
l2info->cookie_len += 2;
|
||||
l2info->header_len += 2;
|
||||
break;
|
||||
case AS_COOKIE_ID:
|
||||
l2info->cookie_type = AS_COOKIE_ID;
|
||||
l2info->cookie_len += 6;
|
||||
l2info->header_len += 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
l2info->bundle = l2info->cookie[0];
|
||||
break;
|
||||
}
|
||||
|
||||
if (eflag)
|
||||
printf("%s-PIC, cookie-len %u",
|
||||
lp->s,
|
||||
l2info->cookie_len);
|
||||
|
||||
if (l2info->cookie_len > 0) {
|
||||
TCHECK2(p[0],l2info->cookie_len);
|
||||
if (eflag)
|
||||
printf(", cookie 0x");
|
||||
for (idx = 0; idx < l2info->cookie_len; idx++) {
|
||||
l2info->cookie[idx] = p[idx]; /* copy cookie data */
|
||||
if (eflag) printf("%02x",p[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
if (eflag) printf(": "); /* print demarc b/w L2/L3*/
|
||||
|
||||
|
||||
l2info->proto = EXTRACT_16BITS(p+l2info->cookie_len);
|
||||
break;
|
||||
}
|
||||
++lp;
|
||||
}
|
||||
p+=l2info->cookie_len;
|
||||
|
||||
/* DLT_ specific parsing */
|
||||
switch(l2info->pictype) {
|
||||
case DLT_JUNIPER_MLPPP:
|
||||
switch (l2info->cookie_type) {
|
||||
case LS_COOKIE_ID:
|
||||
l2info->bundle = l2info->cookie[1];
|
||||
break;
|
||||
case AS_COOKIE_ID:
|
||||
l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff;
|
||||
l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK;
|
||||
break;
|
||||
default:
|
||||
l2info->bundle = l2info->cookie[0];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DLT_JUNIPER_MLFR: /* fall through */
|
||||
case DLT_JUNIPER_MFR:
|
||||
switch (l2info->cookie_type) {
|
||||
case LS_COOKIE_ID:
|
||||
l2info->bundle = l2info->cookie[1];
|
||||
break;
|
||||
case AS_COOKIE_ID:
|
||||
l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff;
|
||||
break;
|
||||
default:
|
||||
l2info->bundle = l2info->cookie[0];
|
||||
break;
|
||||
}
|
||||
l2info->proto = EXTRACT_16BITS(p);
|
||||
l2info->header_len += 2;
|
||||
l2info->length -= 2;
|
||||
l2info->caplen -= 2;
|
||||
break;
|
||||
case DLT_JUNIPER_ATM2:
|
||||
TCHECK2(p[0],4);
|
||||
/* ATM cell relay control word present ? */
|
||||
if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK && *p & 0x08) {
|
||||
l2info->header_len += 4;
|
||||
if (eflag)
|
||||
printf("control-word 0x%08x ",EXTRACT_32BITS(p));
|
||||
}
|
||||
break;
|
||||
case DLT_JUNIPER_ATM1:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (eflag > 1)
|
||||
printf("hlen %u, proto 0x%04x, ",l2info->header_len,l2info->proto);
|
||||
|
||||
return 1; /* everything went ok so far. continue parsing */
|
||||
trunc:
|
||||
printf("[|juniper_hdr], length %u",h->len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* c-style: whitesmith
|
||||
* c-basic-offset: 8
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.17 2003/12/26 23:20:58 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-l2tp.c,v 1.17.2.2 2005/04/20 21:50:16 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -617,10 +617,10 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
const u_int16_t *ptr = (u_int16_t *)dat;
|
||||
u_int cnt = 0; /* total octets consumed */
|
||||
u_int16_t pad;
|
||||
int flag_t, flag_l, flag_s, flag_o, flag_p;
|
||||
int flag_t, flag_l, flag_s, flag_o;
|
||||
u_int16_t l2tp_len;
|
||||
|
||||
flag_t = flag_l = flag_s = flag_o = flag_p = FALSE;
|
||||
flag_t = flag_l = flag_s = flag_o = FALSE;
|
||||
|
||||
TCHECK(*ptr); /* Flags & Version */
|
||||
if ((EXTRACT_16BITS(ptr) & L2TP_VERSION_MASK) == L2TP_VERSION_L2TP) {
|
||||
@ -650,10 +650,8 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
flag_o = TRUE;
|
||||
printf("O");
|
||||
}
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_PRIORITY) {
|
||||
flag_p = TRUE;
|
||||
if (EXTRACT_16BITS(ptr) & L2TP_FLAG_PRIORITY)
|
||||
printf("P");
|
||||
}
|
||||
printf("]");
|
||||
|
||||
ptr++;
|
||||
@ -690,7 +688,22 @@ l2tp_print(const u_char *dat, u_int length)
|
||||
cnt += (2 + pad);
|
||||
}
|
||||
|
||||
if (flag_l) {
|
||||
if (length < l2tp_len) {
|
||||
printf(" Length %u larger than packet", l2tp_len);
|
||||
return;
|
||||
}
|
||||
length = l2tp_len;
|
||||
}
|
||||
if (length < cnt) {
|
||||
printf(" Length %u smaller than header length", length);
|
||||
return;
|
||||
}
|
||||
if (flag_t) {
|
||||
if (!flag_l) {
|
||||
printf(" No length");
|
||||
return;
|
||||
}
|
||||
if (length - cnt == 0) {
|
||||
printf(" ZLB");
|
||||
} else {
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.8 2004/06/15 09:42:42 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.8.2.5 2005/06/16 01:10:35 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -187,6 +187,33 @@ static const struct tok ldp_fec_values[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
#define LDP_FEC_MARTINI_IFPARM_MTU 0x01
|
||||
#define LDP_FEC_MARTINI_IFPARM_DESC 0x03
|
||||
#define LDP_FEC_MARTINI_IFPARM_VCCV 0x0c
|
||||
|
||||
static const struct tok ldp_fec_martini_ifparm_values[] = {
|
||||
{ LDP_FEC_MARTINI_IFPARM_MTU, "MTU" },
|
||||
{ LDP_FEC_MARTINI_IFPARM_DESC, "Description" },
|
||||
{ LDP_FEC_MARTINI_IFPARM_VCCV, "VCCV" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* draft-ietf-pwe3-vccv-04.txt */
|
||||
static const struct tok ldp_fec_martini_ifparm_vccv_cc_values[] = {
|
||||
{ 0x01, "PWE3 control word" },
|
||||
{ 0x02, "MPLS Router Alert Label" },
|
||||
{ 0x04, "MPLS inner label TTL = 1" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* draft-ietf-pwe3-vccv-04.txt */
|
||||
static const struct tok ldp_fec_martini_ifparm_vccv_cv_values[] = {
|
||||
{ 0x01, "ICMP Ping" },
|
||||
{ 0x02, "LSP Ping" },
|
||||
{ 0x04, "BFD" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* RFC1700 address family numbers, same definition in print-bgp.c */
|
||||
#define AFNUM_INET 1
|
||||
#define AFNUM_INET6 2
|
||||
@ -194,6 +221,7 @@ static const struct tok ldp_fec_values[] = {
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
int ldp_msg_print(register const u_char *);
|
||||
int ldp_tlv_print(register const u_char *);
|
||||
|
||||
/*
|
||||
@ -224,7 +252,7 @@ ldp_tlv_print(register const u_char *tptr) {
|
||||
const struct ldp_tlv_header *ldp_tlv_header;
|
||||
u_short tlv_type,tlv_len,tlv_tlen,af,ft_flags;
|
||||
u_char fec_type;
|
||||
u_int ui;
|
||||
u_int ui,vc_info_len, vc_info_tlv_type, vc_info_tlv_len,idx;
|
||||
char buf[100];
|
||||
int i;
|
||||
|
||||
@ -324,10 +352,65 @@ ldp_tlv_print(register const u_char *tptr) {
|
||||
case LDP_FEC_HOSTADDRESS:
|
||||
break;
|
||||
case LDP_FEC_MARTINI_VC:
|
||||
printf(": %s, %scontrol word, VC %u",
|
||||
if (!TTEST2(*tptr, 11))
|
||||
goto trunc;
|
||||
vc_info_len = *(tptr+2);
|
||||
|
||||
printf(": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u",
|
||||
tok2str(l2vpn_encaps_values, "Unknown", EXTRACT_16BITS(tptr)&0x7fff),
|
||||
EXTRACT_16BITS(tptr)&0x8000 ? "" : "no ",
|
||||
EXTRACT_32BITS(tptr+7));
|
||||
EXTRACT_32BITS(tptr+3),
|
||||
EXTRACT_32BITS(tptr+7),
|
||||
vc_info_len);
|
||||
|
||||
if (vc_info_len == 0) /* infinite loop protection */
|
||||
break;
|
||||
|
||||
tptr+=11;
|
||||
if (!TTEST2(*tptr, vc_info_len))
|
||||
goto trunc;
|
||||
|
||||
while (vc_info_len > 2) {
|
||||
vc_info_tlv_type = *tptr;
|
||||
vc_info_tlv_len = *(tptr+1);
|
||||
if (vc_info_tlv_len < 2)
|
||||
break;
|
||||
if (vc_info_len < vc_info_tlv_len)
|
||||
break;
|
||||
|
||||
printf("\n\t\tInterface Parameter: %s (0x%02x), len %u",
|
||||
tok2str(ldp_fec_martini_ifparm_values,"Unknown",vc_info_tlv_type),
|
||||
vc_info_tlv_type,
|
||||
vc_info_tlv_len);
|
||||
|
||||
switch(vc_info_tlv_type) {
|
||||
case LDP_FEC_MARTINI_IFPARM_MTU:
|
||||
printf(": %u",EXTRACT_16BITS(tptr+2));
|
||||
break;
|
||||
|
||||
case LDP_FEC_MARTINI_IFPARM_DESC:
|
||||
printf(": ");
|
||||
for (idx = 2; idx < vc_info_tlv_len; idx++)
|
||||
safeputchar(*(tptr+idx));
|
||||
break;
|
||||
|
||||
case LDP_FEC_MARTINI_IFPARM_VCCV:
|
||||
printf("\n\t\t Control Channels (0x%02x) = [%s]",
|
||||
*(tptr+2),
|
||||
bittok2str(ldp_fec_martini_ifparm_vccv_cc_values,"none",*(tptr+2)));
|
||||
printf("\n\t\t CV Types (0x%02x) = [%s]",
|
||||
*(tptr+3),
|
||||
bittok2str(ldp_fec_martini_ifparm_vccv_cv_values,"none",*(tptr+3)));
|
||||
break;
|
||||
|
||||
default:
|
||||
print_unknown_data(tptr+2,"\n\t\t ",vc_info_tlv_len-2);
|
||||
break;
|
||||
}
|
||||
|
||||
vc_info_len -= vc_info_tlv_len;
|
||||
tptr += vc_info_tlv_len;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -391,16 +474,34 @@ ldp_tlv_print(register const u_char *tptr) {
|
||||
break;
|
||||
}
|
||||
return(tlv_len+4); /* Type & Length fields not included */
|
||||
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ldp_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
int processed;
|
||||
while (len > (sizeof(struct ldp_common_header) + sizeof(struct ldp_msg_header))) {
|
||||
processed = ldp_msg_print(pptr);
|
||||
if (processed == 0)
|
||||
return;
|
||||
len -= processed;
|
||||
pptr += processed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ldp_msg_print(register const u_char *pptr) {
|
||||
|
||||
const struct ldp_common_header *ldp_com_header;
|
||||
const struct ldp_msg_header *ldp_msg_header;
|
||||
const u_char *tptr,*msg_tptr;
|
||||
u_short tlen;
|
||||
u_short msg_len,msg_type,msg_tlen;
|
||||
u_short pdu_len,msg_len,msg_type,msg_tlen;
|
||||
int hexdump,processed;
|
||||
|
||||
tptr=pptr;
|
||||
@ -411,24 +512,26 @@ ldp_print(register const u_char *pptr, register u_int len) {
|
||||
* Sanity checking of the header.
|
||||
*/
|
||||
if (EXTRACT_16BITS(&ldp_com_header->version) != LDP_VERSION) {
|
||||
printf("LDP version %u packet not supported",
|
||||
printf("%sLDP version %u packet not supported",
|
||||
(vflag < 1) ? "" : "\n\t",
|
||||
EXTRACT_16BITS(&ldp_com_header->version));
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* print the LSR-ID, label-space & length */
|
||||
printf("%sLDP, Label-Space-ID: %s:%u, length: %u",
|
||||
pdu_len = EXTRACT_16BITS(&ldp_com_header->pdu_length);
|
||||
printf("%sLDP, Label-Space-ID: %s:%u, pdu-length: %u",
|
||||
(vflag < 1) ? "" : "\n\t",
|
||||
ipaddr_string(&ldp_com_header->lsr_id),
|
||||
EXTRACT_16BITS(&ldp_com_header->label_space),
|
||||
len);
|
||||
pdu_len);
|
||||
|
||||
/* bail out if non-verbose */
|
||||
if (vflag < 1)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* ok they seem to want to know everything - lets fully decode it */
|
||||
tlen=EXTRACT_16BITS(ldp_com_header->pdu_length);
|
||||
tlen=pdu_len;
|
||||
|
||||
tptr += sizeof(const struct ldp_common_header);
|
||||
tlen -= sizeof(const struct ldp_common_header)-4; /* Type & Length fields not included */
|
||||
@ -452,6 +555,9 @@ ldp_print(register const u_char *pptr, register u_int len) {
|
||||
EXTRACT_32BITS(&ldp_msg_header->id),
|
||||
LDP_MASK_U_BIT(EXTRACT_16BITS(&ldp_msg_header->type)) ? "continue processing" : "ignore");
|
||||
|
||||
if (msg_len == 0) /* infinite loop protection */
|
||||
return 0;
|
||||
|
||||
msg_tptr=tptr+sizeof(struct ldp_msg_header);
|
||||
msg_tlen=msg_len-sizeof(struct ldp_msg_header)+4; /* Type & Length fields not included */
|
||||
|
||||
@ -501,8 +607,9 @@ ldp_print(register const u_char *pptr, register u_int len) {
|
||||
tptr += msg_len+4;
|
||||
tlen -= msg_len+4;
|
||||
}
|
||||
return;
|
||||
return pdu_len+4;
|
||||
trunc:
|
||||
printf("\n\t\t packet exceeded snapshot");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61 2005/04/06 21:32:41 mcr Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.4 2005/04/26 07:27:16 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -59,6 +59,7 @@ static struct tok llc_values[] = {
|
||||
{ LLCSAP_IPX, "IPX" },
|
||||
{ LLCSAP_NETBEUI, "NetBeui" },
|
||||
{ LLCSAP_ISONS, "OSI" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
static struct tok cmd2str[] = {
|
||||
@ -73,6 +74,40 @@ static struct tok cmd2str[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok cisco_values[] = {
|
||||
{ PID_CISCO_CDP, "CDP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct tok bridged_values[] = {
|
||||
{ PID_RFC2684_ETH_FCS, "Ethernet + FCS" },
|
||||
{ PID_RFC2684_ETH_NOFCS, "Ethernet w/o FCS" },
|
||||
{ PID_RFC2684_802_4_FCS, "802.4 + FCS" },
|
||||
{ PID_RFC2684_802_4_NOFCS, "802.4 w/o FCS" },
|
||||
{ PID_RFC2684_802_5_FCS, "Token Ring + FCS" },
|
||||
{ PID_RFC2684_802_5_NOFCS, "Token Ring w/o FCS" },
|
||||
{ PID_RFC2684_FDDI_FCS, "FDDI + FCS" },
|
||||
{ PID_RFC2684_FDDI_NOFCS, "FDDI w/o FCS" },
|
||||
{ PID_RFC2684_802_6_FCS, "802.6 + FCS" },
|
||||
{ PID_RFC2684_802_6_NOFCS, "802.6 w/o FCS" },
|
||||
{ PID_RFC2684_BPDU, "BPDU" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
struct oui_tok {
|
||||
u_int32_t oui;
|
||||
const struct tok *tok;
|
||||
};
|
||||
|
||||
static const struct oui_tok oui_to_tok[] = {
|
||||
{ OUI_ENCAP_ETHER, ethertype_values },
|
||||
{ OUI_CISCO_90, ethertype_values }, /* uses some Ethertype values */
|
||||
{ OUI_APPLETALK, ethertype_values }, /* uses some Ethertype values */
|
||||
{ OUI_CISCO, cisco_values },
|
||||
{ OUI_RFC2684, bridged_values }, /* bridged, RFC 2427 FR or RFC 2864 ATM */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns non-zero IFF it succeeds in printing the header
|
||||
*/
|
||||
@ -80,9 +115,9 @@ int
|
||||
llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
const u_char *esrc, const u_char *edst, u_short *extracted_ethertype)
|
||||
{
|
||||
struct llc llc;
|
||||
register u_short et;
|
||||
u_int8_t dsap, ssap;
|
||||
u_int16_t control;
|
||||
int is_u;
|
||||
register int ret;
|
||||
|
||||
if (caplen < 3) {
|
||||
@ -91,18 +126,40 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Watch out for possible alignment problems */
|
||||
memcpy((char *)&llc, (char *)p, min(caplen, sizeof(llc)));
|
||||
dsap = *p;
|
||||
ssap = *(p + 1);
|
||||
|
||||
if (eflag)
|
||||
printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x: ",
|
||||
tok2str(llc_values,"Unknown",llc.dsap),
|
||||
llc.dsap,
|
||||
tok2str(llc_values,"Unknown",llc.ssap),
|
||||
llc.ssap,
|
||||
llc.llcu);
|
||||
/*
|
||||
* OK, what type of LLC frame is this? The length
|
||||
* of the control field depends on that - I frames
|
||||
* have a two-byte control field, and U frames have
|
||||
* a one-byte control field.
|
||||
*/
|
||||
control = *(p + 2);
|
||||
if ((control & LLC_U_FMT) == LLC_U_FMT) {
|
||||
/*
|
||||
* U frame.
|
||||
*/
|
||||
is_u = 1;
|
||||
} else {
|
||||
/*
|
||||
* The control field in I and S frames is
|
||||
* 2 bytes...
|
||||
*/
|
||||
if (caplen < 4) {
|
||||
(void)printf("[|llc]");
|
||||
default_print((u_char *)p, caplen);
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_GLOBAL && llc.dsap == LLCSAP_GLOBAL) {
|
||||
/*
|
||||
* ...and is little-endian.
|
||||
*/
|
||||
control = EXTRACT_LE_16BITS(p + 2);
|
||||
is_u = 0;
|
||||
}
|
||||
|
||||
if (ssap == LLCSAP_GLOBAL && dsap == LLCSAP_GLOBAL) {
|
||||
/*
|
||||
* This is an Ethernet_802.3 IPX frame; it has an
|
||||
* 802.3 header (i.e., an Ethernet header where the
|
||||
@ -125,18 +182,38 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_8021D && llc.dsap == LLCSAP_8021D) {
|
||||
stp_print(p, length);
|
||||
if (eflag) {
|
||||
if (is_u) {
|
||||
printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%02x: ",
|
||||
tok2str(llc_values, "Unknown", dsap),
|
||||
dsap,
|
||||
tok2str(llc_values, "Unknown", ssap),
|
||||
ssap,
|
||||
control);
|
||||
} else {
|
||||
printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x), cmd 0x%04x: ",
|
||||
tok2str(llc_values, "Unknown", dsap),
|
||||
dsap,
|
||||
tok2str(llc_values, "Unknown", ssap),
|
||||
ssap,
|
||||
control);
|
||||
}
|
||||
}
|
||||
|
||||
if (ssap == LLCSAP_8021D && dsap == LLCSAP_8021D &&
|
||||
control == LLC_UI) {
|
||||
stp_print(p+3, length-3);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_IP && llc.dsap == LLCSAP_IP) {
|
||||
if (ssap == LLCSAP_IP && dsap == LLCSAP_IP &&
|
||||
control == LLC_UI) {
|
||||
ip_print(gndo, p+4, length-4);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_IPX && llc.dsap == LLCSAP_IPX &&
|
||||
llc.llcui == LLC_UI) {
|
||||
if (ssap == LLCSAP_IPX && dsap == LLCSAP_IPX &&
|
||||
control == LLC_UI) {
|
||||
/*
|
||||
* This is an Ethernet_802.2 IPX frame, with an 802.3
|
||||
* header and an 802.2 LLC header with the source and
|
||||
@ -145,16 +222,13 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
* Skip DSAP, LSAP, and control field.
|
||||
*/
|
||||
printf("(NOV-802.2) ");
|
||||
p += 3;
|
||||
length -= 3;
|
||||
caplen -= 3;
|
||||
ipx_print(p, length);
|
||||
ipx_print(p+3, length-3);
|
||||
return (1);
|
||||
}
|
||||
|
||||
#ifdef TCPDUMP_DO_SMB
|
||||
if (llc.ssap == LLCSAP_NETBEUI && llc.dsap == LLCSAP_NETBEUI
|
||||
&& (!(llc.llcu & LLC_S_FMT) || llc.llcu == LLC_U_FMT)) {
|
||||
if (ssap == LLCSAP_NETBEUI && dsap == LLCSAP_NETBEUI
|
||||
&& (!(control & LLC_S_FMT) || control == LLC_U_FMT)) {
|
||||
/*
|
||||
* we don't actually have a full netbeui parser yet, but the
|
||||
* smb parser can handle many smb-in-netbeui packets, which
|
||||
@ -167,107 +241,69 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
*/
|
||||
|
||||
/*
|
||||
* Skip the DSAP and LSAP.
|
||||
* Skip the LLC header.
|
||||
*/
|
||||
p += 2;
|
||||
length -= 2;
|
||||
caplen -= 2;
|
||||
|
||||
/*
|
||||
* OK, what type of LLC frame is this? The length
|
||||
* of the control field depends on that - I frames
|
||||
* have a two-byte control field, and U frames have
|
||||
* a one-byte control field.
|
||||
*/
|
||||
if (llc.llcu == LLC_U_FMT) {
|
||||
control = llc.llcu;
|
||||
p += 1;
|
||||
length -= 1;
|
||||
caplen -= 1;
|
||||
if (is_u) {
|
||||
p += 3;
|
||||
length -= 3;
|
||||
caplen -= 3;
|
||||
} else {
|
||||
/*
|
||||
* The control field in I and S frames is
|
||||
* little-endian.
|
||||
*/
|
||||
control = EXTRACT_LE_16BITS(&llc.llcu);
|
||||
p += 2;
|
||||
length -= 2;
|
||||
caplen -= 2;
|
||||
p += 4;
|
||||
length -= 4;
|
||||
caplen -= 4;
|
||||
}
|
||||
netbeui_print(control, p, length);
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
if (llc.ssap == LLCSAP_ISONS && llc.dsap == LLCSAP_ISONS
|
||||
&& llc.llcui == LLC_UI) {
|
||||
if (ssap == LLCSAP_ISONS && dsap == LLCSAP_ISONS
|
||||
&& control == LLC_UI) {
|
||||
isoclns_print(p + 3, length - 3, caplen - 3);
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (llc.ssap == LLCSAP_SNAP && llc.dsap == LLCSAP_SNAP
|
||||
&& llc.llcui == LLC_UI) {
|
||||
u_int32_t orgcode;
|
||||
|
||||
if (caplen < sizeof(llc)) {
|
||||
(void)printf("[|llc-snap]");
|
||||
default_print((u_char *)p, caplen);
|
||||
return (0);
|
||||
}
|
||||
|
||||
caplen -= sizeof(llc);
|
||||
length -= sizeof(llc);
|
||||
p += sizeof(llc);
|
||||
|
||||
orgcode = EXTRACT_24BITS(&llc.llc_orgcode[0]);
|
||||
et = EXTRACT_16BITS(&llc.llc_ethertype[0]);
|
||||
|
||||
if (eflag)
|
||||
(void)printf("oui %s (0x%06x), ethertype %s (0x%04x): ",
|
||||
tok2str(oui_values,"Unknown",orgcode),
|
||||
orgcode,
|
||||
tok2str(ethertype_values,"Unknown", et),
|
||||
et);
|
||||
|
||||
if (ssap == LLCSAP_SNAP && dsap == LLCSAP_SNAP
|
||||
&& control == LLC_UI) {
|
||||
/*
|
||||
* XXX - what *is* the right bridge pad value here?
|
||||
* Does anybody ever bridge one form of LAN traffic
|
||||
* over a networking type that uses 802.2 LLC?
|
||||
*/
|
||||
ret = snap_print(p, length, caplen, extracted_ethertype,
|
||||
orgcode, et, 2);
|
||||
ret = snap_print(p+3, length-3, caplen-3, extracted_ethertype,
|
||||
2);
|
||||
if (ret)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
if ((llc.ssap & ~LLC_GSAP) == llc.dsap) {
|
||||
if (eflag || esrc == NULL || edst == NULL)
|
||||
(void)printf("%s ", llcsap_string(llc.dsap));
|
||||
else
|
||||
(void)printf("%s > %s %s ",
|
||||
if (!eflag) {
|
||||
if ((ssap & ~LLC_GSAP) == dsap) {
|
||||
if (esrc == NULL || edst == NULL)
|
||||
(void)printf("%s ", llcsap_string(dsap));
|
||||
else
|
||||
(void)printf("%s > %s %s ",
|
||||
etheraddr_string(esrc),
|
||||
etheraddr_string(edst),
|
||||
llcsap_string(dsap));
|
||||
} else {
|
||||
if (esrc == NULL || edst == NULL)
|
||||
(void)printf("%s > %s ",
|
||||
llcsap_string(ssap & ~LLC_GSAP),
|
||||
llcsap_string(dsap));
|
||||
else
|
||||
(void)printf("%s %s > %s %s ",
|
||||
etheraddr_string(esrc),
|
||||
llcsap_string(ssap & ~LLC_GSAP),
|
||||
etheraddr_string(edst),
|
||||
llcsap_string(llc.dsap));
|
||||
} else {
|
||||
if (eflag || esrc == NULL || edst == NULL)
|
||||
(void)printf("%s > %s ",
|
||||
llcsap_string(llc.ssap & ~LLC_GSAP),
|
||||
llcsap_string(llc.dsap));
|
||||
else
|
||||
(void)printf("%s %s > %s %s ",
|
||||
etheraddr_string(esrc),
|
||||
llcsap_string(llc.ssap & ~LLC_GSAP),
|
||||
etheraddr_string(edst),
|
||||
llcsap_string(llc.dsap));
|
||||
llcsap_string(dsap));
|
||||
}
|
||||
}
|
||||
|
||||
if ((llc.llcu & LLC_U_FMT) == LLC_U_FMT) {
|
||||
u_int16_t cmd;
|
||||
if (is_u) {
|
||||
const char *m;
|
||||
char f;
|
||||
|
||||
cmd = LLC_U_CMD(llc.llcu);
|
||||
m = tok2str(cmd2str, "%02x", cmd);
|
||||
switch ((llc.ssap & LLC_GSAP) | (llc.llcu & LLC_U_POLL)) {
|
||||
m = tok2str(cmd2str, "%02x", LLC_U_CMD(control));
|
||||
switch ((ssap & LLC_GSAP) | (control & LLC_U_POLL)) {
|
||||
case 0: f = 'C'; break;
|
||||
case LLC_GSAP: f = 'R'; break;
|
||||
case LLC_U_POLL: f = 'P'; break;
|
||||
@ -281,7 +317,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
length -= 3;
|
||||
caplen -= 3;
|
||||
|
||||
if ((llc.llcu & ~LLC_U_POLL) == LLC_XID) {
|
||||
if ((control & ~LLC_U_POLL) == LLC_XID) {
|
||||
if (*p == LLC_XID_FI) {
|
||||
printf(": %02x %02x", p[1], p[2]);
|
||||
p += 3;
|
||||
@ -292,11 +328,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
} else {
|
||||
char f;
|
||||
|
||||
/*
|
||||
* The control field in I and S frames is little-endian.
|
||||
*/
|
||||
control = EXTRACT_LE_16BITS(&llc.llcu);
|
||||
switch ((llc.ssap & LLC_GSAP) | (control & LLC_IS_POLL)) {
|
||||
switch ((ssap & LLC_GSAP) | (control & LLC_IS_POLL)) {
|
||||
case 0: f = 'C'; break;
|
||||
case LLC_GSAP: f = 'R'; break;
|
||||
case LLC_IS_POLL: f = 'P'; break;
|
||||
@ -325,11 +357,37 @@ llc_print(const u_char *p, u_int length, u_int caplen,
|
||||
|
||||
int
|
||||
snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
u_short *extracted_ethertype, u_int32_t orgcode, u_short et,
|
||||
u_int bridge_pad)
|
||||
u_short *extracted_ethertype, u_int bridge_pad)
|
||||
{
|
||||
u_int32_t orgcode;
|
||||
register u_short et;
|
||||
register int ret;
|
||||
|
||||
TCHECK2(*p, 5);
|
||||
orgcode = EXTRACT_24BITS(p);
|
||||
et = EXTRACT_16BITS(p + 3);
|
||||
|
||||
if (eflag) {
|
||||
const struct tok *tok = NULL;
|
||||
const struct oui_tok *otp;
|
||||
|
||||
for (otp = &oui_to_tok[0]; otp->tok != NULL; otp++) {
|
||||
if (otp->oui == orgcode) {
|
||||
tok = otp->tok;
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void)printf("oui %s (0x%06x), %s %s (0x%04x): ",
|
||||
tok2str(oui_values, "Unknown", orgcode),
|
||||
orgcode,
|
||||
(orgcode == 0x000000 ? "ethertype" : "pid"),
|
||||
tok2str(tok, "Unknown", et),
|
||||
et);
|
||||
}
|
||||
p += 5;
|
||||
length -= 5;
|
||||
caplen -= 5;
|
||||
|
||||
switch (orgcode) {
|
||||
case OUI_ENCAP_ETHER:
|
||||
case OUI_CISCO_90:
|
||||
@ -381,6 +439,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
/*
|
||||
* Skip the padding.
|
||||
*/
|
||||
TCHECK2(*p, bridge_pad);
|
||||
caplen -= bridge_pad;
|
||||
length -= bridge_pad;
|
||||
p += bridge_pad;
|
||||
@ -401,6 +460,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
* Skip the padding, but not the Access
|
||||
* Control field.
|
||||
*/
|
||||
TCHECK2(*p, bridge_pad);
|
||||
caplen -= bridge_pad;
|
||||
length -= bridge_pad;
|
||||
p += bridge_pad;
|
||||
@ -421,6 +481,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
/*
|
||||
* Skip the padding.
|
||||
*/
|
||||
TCHECK2(*p, bridge_pad + 1);
|
||||
caplen -= bridge_pad + 1;
|
||||
length -= bridge_pad + 1;
|
||||
p += bridge_pad + 1;
|
||||
@ -437,6 +498,10 @@ snap_print(const u_char *p, u_int length, u_int caplen,
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
||||
trunc:
|
||||
(void)printf("[|snap]");
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,11 +11,13 @@
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Original code by Hannes Gredler (hannes@juniper.net)
|
||||
* Support for LMP service discovery extensions (defined by UNI 1.0) added
|
||||
* by Manu Pathak (mapathak@cisco.com), May 2005
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.5 2004/04/27 14:03:44 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lmp.c,v 1.5.2.1 2005/05/19 06:44:03 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -107,6 +109,48 @@ static const struct tok lmp_obj_link_summary_error_values[] = {
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Supported Protocols Flags */
|
||||
static const struct tok lmp_obj_service_config_sp_flag_values[] = {
|
||||
{ 0x01, "RSVP Supported"},
|
||||
{ 0x02, "LDP Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Client Port Service Attribute Transparency Flags */
|
||||
static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
|
||||
{ 0x01, "Path/VC Overhead Transparency Supported"},
|
||||
{ 0x02, "Line/MS Overhead Transparency Supported"},
|
||||
{ 0x04, "Section/RS Overhead Transparency Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
|
||||
static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
|
||||
{ 0x01, "Contiguous Concatenation Types Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Network Service Attributes Transparency Flags */
|
||||
static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
|
||||
{ 0x01, "Standard SOH/RSOH Transparency Supported"},
|
||||
{ 0x02, "Standard LOH/MSOH Transparency Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Service Config Network Service Attributes TCM Monitoring Flags */
|
||||
static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
|
||||
{ 0x01, "Transparent Tandem Connection Monitoring Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
/* Network Service Attributes Network Diversity Flags */
|
||||
static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
|
||||
{ 0x01, "Node Diversity Supported"},
|
||||
{ 0x02, "Link Diversity Supported"},
|
||||
{ 0x04, "SRLG Diversity Supported"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
#define LMP_MSGTYPE_CONFIG 1
|
||||
#define LMP_MSGTYPE_CONFIG_ACK 2
|
||||
#define LMP_MSGTYPE_CONFIG_NACK 3
|
||||
@ -127,6 +171,10 @@ static const struct tok lmp_obj_link_summary_error_values[] = {
|
||||
#define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
|
||||
#define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
|
||||
#define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
|
||||
/* LMP Service Discovery message types defined by UNI 1.0 */
|
||||
#define LMP_MSGTYPE_SERVICE_CONFIG 50
|
||||
#define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
|
||||
#define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
|
||||
|
||||
static const struct tok lmp_msg_type_values[] = {
|
||||
{ LMP_MSGTYPE_CONFIG, "Config"},
|
||||
@ -149,6 +197,9 @@ static const struct tok lmp_msg_type_values[] = {
|
||||
{ LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
|
||||
{ LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
|
||||
{ LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
|
||||
{ LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
|
||||
{ LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
|
||||
{ LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -188,6 +239,8 @@ struct lmp_object_header {
|
||||
#define LMP_OBJ_CHANNEL_STATUS_REQ 14
|
||||
#define LMP_OBJ_ERROR_CODE 20
|
||||
|
||||
#define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
|
||||
|
||||
static const struct tok lmp_obj_values[] = {
|
||||
{ LMP_OBJ_CC_ID, "Control Channel ID" },
|
||||
{ LMP_OBJ_NODE_ID, "Node ID" },
|
||||
@ -204,6 +257,8 @@ static const struct tok lmp_obj_values[] = {
|
||||
{ LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
|
||||
{ LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
|
||||
{ LMP_OBJ_ERROR_CODE, "Error Code" },
|
||||
{ LMP_OBJ_SERVICE_CONFIG, "Service Config" },
|
||||
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -239,6 +294,19 @@ static const struct tok lmp_data_link_subobj[] = {
|
||||
#define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
|
||||
#define LMP_CTYPE_LINK_SUMMARY_ERROR 2
|
||||
|
||||
/* C-Types for Service Config Object */
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_SP 1
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
|
||||
#define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
|
||||
|
||||
/*
|
||||
* Different link types allowed in the Client Port Service Attributes
|
||||
* subobject defined for LMP Service Discovery in the UNI 1.0 spec
|
||||
*/
|
||||
#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
|
||||
#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
@ -286,6 +354,10 @@ static const struct tok lmp_ctype_values[] = {
|
||||
{ 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
|
||||
{ 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
|
||||
{ 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
|
||||
{ 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
@ -298,6 +370,7 @@ lmp_print(register const u_char *pptr, register u_int len) {
|
||||
int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen;
|
||||
int hexdump;
|
||||
int offset,subobj_type,subobj_len,total_subobj_len;
|
||||
int link_type;
|
||||
|
||||
union { /* int to float conversion buffer */
|
||||
float f;
|
||||
@ -693,7 +766,105 @@ lmp_print(register const u_char *pptr, register u_int len) {
|
||||
hexdump=TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case LMP_OBJ_SERVICE_CONFIG:
|
||||
switch (lmp_obj_ctype) {
|
||||
case LMP_CTYPE_SERVICE_CONFIG_SP:
|
||||
|
||||
printf("\n\t Flags: %s",
|
||||
bittok2str(lmp_obj_service_config_sp_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr)>>8));
|
||||
|
||||
printf("\n\t UNI Version: %u",
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF);
|
||||
|
||||
break;
|
||||
|
||||
case LMP_CTYPE_SERVICE_CONFIG_CPSA:
|
||||
|
||||
link_type = EXTRACT_16BITS(obj_tptr)>>8;
|
||||
|
||||
printf("\n\t Link Type: %s (%u)",
|
||||
tok2str(lmp_sd_service_config_cpsa_link_type_values,
|
||||
"Unknown", link_type),
|
||||
link_type);
|
||||
|
||||
if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH) {
|
||||
printf("\n\t Signal Type: %s (%u)",
|
||||
tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
|
||||
"Unknown",
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF),
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF);
|
||||
}
|
||||
|
||||
if (link_type == LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET) {
|
||||
printf("\n\t Signal Type: %s (%u)",
|
||||
tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
|
||||
"Unknown",
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF),
|
||||
EXTRACT_16BITS(obj_tptr) & 0x00FF);
|
||||
}
|
||||
|
||||
printf("\n\t Transparency: %s",
|
||||
bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+2)>>8));
|
||||
|
||||
printf("\n\t Contiguous Concatenation Types: %s",
|
||||
bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+2)>>8 & 0x00FF));
|
||||
|
||||
printf("\n\t Minimum NCC: %u",
|
||||
EXTRACT_16BITS(obj_tptr+4));
|
||||
|
||||
printf("\n\t Maximum NCC: %u",
|
||||
EXTRACT_16BITS(obj_tptr+6));
|
||||
|
||||
printf("\n\t Minimum NVC:%u",
|
||||
EXTRACT_16BITS(obj_tptr+8));
|
||||
|
||||
printf("\n\t Maximum NVC:%u",
|
||||
EXTRACT_16BITS(obj_tptr+10));
|
||||
|
||||
printf("\n\t Local Interface ID: %s (0x%08x)",
|
||||
ipaddr_string(obj_tptr+12),
|
||||
EXTRACT_32BITS(obj_tptr+12));
|
||||
|
||||
break;
|
||||
|
||||
case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
|
||||
|
||||
printf("\n\t Transparency Flags: %s",
|
||||
bittok2str(
|
||||
lmp_obj_service_config_nsa_transparency_flag_values,
|
||||
"none",
|
||||
EXTRACT_32BITS(obj_tptr)));
|
||||
|
||||
printf("\n\t TCM Monitoring Flags: %s",
|
||||
bittok2str(
|
||||
lmp_obj_service_config_nsa_tcm_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+6) & 0x00FF));
|
||||
|
||||
break;
|
||||
|
||||
case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
|
||||
|
||||
printf("\n\t Diversity: Flags: %s",
|
||||
bittok2str(
|
||||
lmp_obj_service_config_nsa_network_diversity_flag_values,
|
||||
"none",
|
||||
EXTRACT_16BITS(obj_tptr+2) & 0x00FF));
|
||||
break;
|
||||
|
||||
default:
|
||||
hexdump = TRUE;
|
||||
};
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(obj_tptr,"\n\t ",obj_tlen);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.12 2004/11/11 12:02:31 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.12.2.3 2005/05/03 08:12:31 hannes Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -137,7 +137,7 @@ struct lspping_tlv_header {
|
||||
#define LSPPING_TLV_DOWNSTREAM_MAPPING 2
|
||||
#define LSPPING_TLV_PAD 3
|
||||
#define LSPPING_TLV_ERROR_CODE 4
|
||||
#define LSPPING_TLV_VENDOR_PRIVATE 5
|
||||
#define LSPPING_TLV_VENDOR_PRIVATE 0xfc00
|
||||
|
||||
static const struct tok lspping_tlv_values[] = {
|
||||
{ LSPPING_TLV_TARGET_FEC_STACK, "Target FEC Stack" },
|
||||
@ -515,10 +515,11 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
|
||||
tlen=len;
|
||||
|
||||
printf("\n\tLSP-PINGv%u, msg-type: %s (%u), reply-mode: %s (%u)",
|
||||
printf("\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
|
||||
EXTRACT_16BITS(&lspping_com_header->version[0]),
|
||||
tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
|
||||
lspping_com_header->msg_type,
|
||||
len,
|
||||
tok2str(lspping_reply_mode_values, "unknown",lspping_com_header->reply_mode),
|
||||
lspping_com_header->reply_mode);
|
||||
|
||||
@ -532,13 +533,13 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
lspping_com_header->return_code == 10 ||
|
||||
lspping_com_header->return_code == 11 ||
|
||||
lspping_com_header->return_code == 12 )
|
||||
printf("\n\t Return Code: %s %u (%u), Return Subcode: (%u)",
|
||||
printf("\n\t Return Code: %s %u (%u)\n\t Return Subcode: (%u)",
|
||||
tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
|
||||
lspping_com_header->return_subcode,
|
||||
lspping_com_header->return_code,
|
||||
lspping_com_header->return_subcode);
|
||||
else
|
||||
printf("\n\t Return Code: %s (%u), Return Subcode: (%u)",
|
||||
printf("\n\t Return Code: %s (%u)\n\t Return Subcode: (%u)",
|
||||
tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
|
||||
lspping_com_header->return_code,
|
||||
lspping_com_header->return_subcode);
|
||||
@ -850,7 +851,7 @@ lspping_print(register const u_char *pptr, register u_int len) {
|
||||
print_unknown_data(tptr+sizeof(sizeof(struct lspping_tlv_header)),"\n\t ",
|
||||
lspping_tlv_len);
|
||||
|
||||
tptr+=lspping_tlv_len;
|
||||
tptr+=lspping_tlv_len+sizeof(struct lspping_tlv_header);
|
||||
tlen-=lspping_tlv_len+sizeof(struct lspping_tlv_header);
|
||||
}
|
||||
return;
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.11 2003/11/16 09:36:28 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-mobility.c,v 1.11.2.1 2005/04/20 22:21:16 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
@ -168,15 +168,13 @@ mobility_opt_print(const u_char *bp, int len)
|
||||
* Mobility Header
|
||||
*/
|
||||
int
|
||||
mobility_print(const u_char *bp, const u_char *bp2)
|
||||
mobility_print(const u_char *bp, const u_char *bp2 _U_)
|
||||
{
|
||||
const struct ip6_mobility *mh;
|
||||
const struct ip6_hdr *ip6;
|
||||
const u_char *ep;
|
||||
int mhlen, hlen, type;
|
||||
|
||||
mh = (struct ip6_mobility *)bp;
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
|
||||
/* 'ep' points to the end of available data. */
|
||||
ep = snapend;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.13 2005/04/06 21:32:41 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-mpls.c,v 1.13.2.1 2005/07/05 09:39:29 hannes Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -61,36 +61,45 @@ void
|
||||
mpls_print(const u_char *bp, u_int length)
|
||||
{
|
||||
const u_char *p;
|
||||
u_int32_t v;
|
||||
u_int32_t label_entry;
|
||||
u_int16_t label_stack_depth = 0;
|
||||
|
||||
p = bp;
|
||||
printf("MPLS");
|
||||
do {
|
||||
TCHECK2(*p, sizeof(v));
|
||||
v = EXTRACT_32BITS(p);
|
||||
printf(" ("); /*)*/
|
||||
printf("label %u", MPLS_LABEL(v));
|
||||
TCHECK2(*p, sizeof(label_entry));
|
||||
label_entry = EXTRACT_32BITS(p);
|
||||
printf("%s(label %u",
|
||||
label_stack_depth ? "\n\t" : " ",
|
||||
MPLS_LABEL(label_entry));
|
||||
label_stack_depth++;
|
||||
if (vflag &&
|
||||
MPLS_LABEL(v) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
|
||||
printf(" (%s)", mpls_labelname[MPLS_LABEL(v)]);
|
||||
printf(", exp %u", MPLS_EXP(v));
|
||||
if (MPLS_STACK(v))
|
||||
MPLS_LABEL(label_entry) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0]))
|
||||
printf(" (%s)", mpls_labelname[MPLS_LABEL(label_entry)]);
|
||||
printf(", exp %u", MPLS_EXP(label_entry));
|
||||
if (MPLS_STACK(label_entry))
|
||||
printf(", [S]");
|
||||
printf(", ttl %u", MPLS_TTL(v));
|
||||
/*(*/
|
||||
printf(")");
|
||||
printf(", ttl %u)", MPLS_TTL(label_entry));
|
||||
|
||||
p += sizeof(v);
|
||||
} while (!MPLS_STACK(v));
|
||||
p += sizeof(label_entry);
|
||||
} while (!MPLS_STACK(label_entry));
|
||||
|
||||
switch (MPLS_LABEL(v)) {
|
||||
switch (MPLS_LABEL(label_entry)) {
|
||||
case 0: /* IPv4 explicit NULL label */
|
||||
case 3: /* IPv4 implicit NULL label */
|
||||
ip_print(gndo, p, length - (p - bp));
|
||||
if (vflag>0) {
|
||||
printf("\n\t");
|
||||
ip_print(gndo, p, length - (p - bp));
|
||||
}
|
||||
else printf(", IP, length: %u",length);
|
||||
break;
|
||||
#ifdef INET6
|
||||
case 2: /* IPv6 explicit NULL label */
|
||||
ip6_print(p, length - (p - bp));
|
||||
if (vflag>0) {
|
||||
printf("\n\t");
|
||||
ip6_print(p, length - (p - bp));
|
||||
}
|
||||
else printf(", IPv6, length: %u",length);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -107,7 +116,7 @@ mpls_print(const u_char *bp, u_int length)
|
||||
* which cisco by default sends MPLS encapsulated
|
||||
*/
|
||||
|
||||
if (MPLS_STACK(v)) { /* only do this if the stack bit is set */
|
||||
if (MPLS_STACK(label_entry)) { /* only do this if the stack bit is set */
|
||||
switch(*p) {
|
||||
case 0x45:
|
||||
case 0x46:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.106 2005/01/05 08:16:45 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.106.2.2 2005/05/06 07:57:18 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -388,9 +388,11 @@ parsefn(register const u_int32_t *dp)
|
||||
cp = (u_char *)dp;
|
||||
/* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
|
||||
dp += ((len + 3) & ~3) / sizeof(*dp);
|
||||
/* XXX seems like we should be checking the length */
|
||||
putchar('"');
|
||||
(void) fn_printn(cp, len, NULL);
|
||||
if (fn_printn(cp, len, snapend)) {
|
||||
putchar('"');
|
||||
goto trunc;
|
||||
}
|
||||
putchar('"');
|
||||
|
||||
return (dp);
|
||||
@ -961,7 +963,7 @@ parserep(register const struct sunrpc_msg *rp, register u_int length)
|
||||
/*
|
||||
* now we can check the ar_stat field
|
||||
*/
|
||||
astat = EXTRACT_32BITS(dp);
|
||||
astat = (enum sunrpc_accept_stat) EXTRACT_32BITS(dp);
|
||||
switch (astat) {
|
||||
|
||||
case SUNRPC_SUCCESS:
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.41 2004/01/28 14:54:50 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ntp.c,v 1.41.2.1 2005/05/06 07:57:18 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -133,7 +133,8 @@ ntp_print(register const u_char *cp, u_int length)
|
||||
break;
|
||||
|
||||
case PRIM_REF:
|
||||
fn_printn((u_char *)&(bp->refid), 4, NULL);
|
||||
if (fn_printn((u_char *)&(bp->refid), 4, snapend))
|
||||
goto trunc;
|
||||
break;
|
||||
|
||||
case INFO_QUERY:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53 2005/04/06 21:32:41 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53.2.2 2005/05/19 07:26:18 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -70,49 +70,18 @@ static const char rcsid[] _U_ =
|
||||
#define BSD_AF_INET6_FREEBSD 28
|
||||
#define BSD_AF_INET6_DARWIN 30
|
||||
|
||||
static void
|
||||
null_print(u_int family, u_int length)
|
||||
{
|
||||
if (nflag)
|
||||
printf("AF %u ", family);
|
||||
else {
|
||||
switch (family) {
|
||||
const struct tok bsd_af_values[] = {
|
||||
{ BSD_AF_INET, "IPv4" },
|
||||
{ BSD_AF_NS, "NS" },
|
||||
{ BSD_AF_ISO, "ISO" },
|
||||
{ BSD_AF_APPLETALK, "Appletalk" },
|
||||
{ BSD_AF_IPX, "IPX" },
|
||||
{ BSD_AF_INET6_BSD, "IPv6" },
|
||||
{ BSD_AF_INET6_FREEBSD, "IPv6" },
|
||||
{ BSD_AF_INET6_DARWIN, "IPv6" },
|
||||
{ 0, NULL}
|
||||
};
|
||||
|
||||
case BSD_AF_INET:
|
||||
printf("ip ");
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
case BSD_AF_INET6_BSD:
|
||||
case BSD_AF_INET6_FREEBSD:
|
||||
case BSD_AF_INET6_DARWIN:
|
||||
printf("ip6 ");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case BSD_AF_NS:
|
||||
printf("ns ");
|
||||
break;
|
||||
|
||||
case BSD_AF_ISO:
|
||||
printf("osi ");
|
||||
break;
|
||||
|
||||
case BSD_AF_APPLETALK:
|
||||
printf("atalk ");
|
||||
break;
|
||||
|
||||
case BSD_AF_IPX:
|
||||
printf("ipx ");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("AF %u ", family);
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("%d: ", length);
|
||||
}
|
||||
|
||||
/*
|
||||
* Byte-swap a 32-bit number.
|
||||
@ -122,6 +91,20 @@ null_print(u_int family, u_int length)
|
||||
#define SWAPLONG(y) \
|
||||
((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
|
||||
|
||||
static inline void
|
||||
null_hdr_print(u_int family, u_int length)
|
||||
{
|
||||
if (!qflag) {
|
||||
(void)printf("AF %s (%u)",
|
||||
tok2str(bsd_af_values,"Unknown",family),family);
|
||||
} else {
|
||||
(void)printf("%s",
|
||||
tok2str(bsd_af_values,"Unknown AF %u",family));
|
||||
}
|
||||
|
||||
(void)printf(", length %u: ", length);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the top level routine of the printer. 'p' points
|
||||
* to the ether header of the packet, 'h->ts' is the timestamp,
|
||||
@ -153,17 +136,17 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
if ((family & 0xFFFF0000) != 0)
|
||||
family = SWAPLONG(family);
|
||||
|
||||
if (eflag)
|
||||
null_hdr_print(family, length);
|
||||
|
||||
length -= NULL_HDRLEN;
|
||||
caplen -= NULL_HDRLEN;
|
||||
p += NULL_HDRLEN;
|
||||
|
||||
if (eflag)
|
||||
null_print(family, length);
|
||||
|
||||
switch (family) {
|
||||
|
||||
case BSD_AF_INET:
|
||||
ip_print(gndo, p, length);
|
||||
ip_print(gndo, p, length);
|
||||
break;
|
||||
|
||||
#ifdef INET6
|
||||
@ -189,7 +172,7 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p)
|
||||
default:
|
||||
/* unknown AF_ value */
|
||||
if (!eflag)
|
||||
null_print(family, length + NULL_HDRLEN);
|
||||
null_hdr_print(family, length + NULL_HDRLEN);
|
||||
if (!xflag && !qflag)
|
||||
default_print(p, caplen);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.56 2004/09/29 16:49:31 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.56.2.2 2005/05/06 07:57:19 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -873,15 +873,13 @@ ospf_decode_v2(register const struct ospfhdr *op,
|
||||
|
||||
void
|
||||
ospf_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2)
|
||||
const u_char *bp2 _U_)
|
||||
{
|
||||
register const struct ospfhdr *op;
|
||||
register const struct ip *ip;
|
||||
register const u_char *dataend;
|
||||
register const char *cp;
|
||||
|
||||
op = (struct ospfhdr *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
|
||||
/* XXX Before we do anything else, strip off the MD5 trailer */
|
||||
TCHECK(op->ospf_authtype);
|
||||
@ -934,8 +932,11 @@ ospf_print(register const u_char *bp, register u_int length,
|
||||
break;
|
||||
|
||||
case OSPF_AUTH_SIMPLE:
|
||||
(void)fn_printn(op->ospf_authdata,
|
||||
sizeof(op->ospf_authdata), NULL);
|
||||
if (fn_printn(op->ospf_authdata,
|
||||
sizeof(op->ospf_authdata), snapend)) {
|
||||
printf("\"");
|
||||
goto trunc;
|
||||
}
|
||||
printf("\"");
|
||||
break;
|
||||
|
||||
|
759
contrib/tcpdump/print-pgm.c
Normal file
759
contrib/tcpdump/print-pgm.c
Normal file
@ -0,0 +1,759 @@
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that: (1) source code
|
||||
* distributions retain the above copyright notice and this paragraph
|
||||
* in its entirety, and (2) distributions including binary code include
|
||||
* the above copyright notice and this paragraph in its entirety in
|
||||
* the documentation or other materials provided with the distribution.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
||||
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Original code by Andy Heffernan (ahh@juniper.net)
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pgm.c,v 1.1.2.5 2005/06/07 22:06:16 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "extract.h"
|
||||
#include "addrtoname.h"
|
||||
|
||||
#include "ip.h"
|
||||
#ifdef INET6
|
||||
#include "ip6.h"
|
||||
#endif
|
||||
#include "ipproto.h"
|
||||
|
||||
/*
|
||||
* PGM header (RFC 3208)
|
||||
*/
|
||||
struct pgm_header {
|
||||
u_int16_t pgm_sport;
|
||||
u_int16_t pgm_dport;
|
||||
u_int8_t pgm_type;
|
||||
u_int8_t pgm_options;
|
||||
u_int16_t pgm_sum;
|
||||
u_int8_t pgm_gsid[6];
|
||||
u_int16_t pgm_length;
|
||||
};
|
||||
|
||||
struct pgm_spm {
|
||||
u_int32_t pgms_seq;
|
||||
u_int32_t pgms_trailseq;
|
||||
u_int32_t pgms_leadseq;
|
||||
u_int16_t pgms_nla_afi;
|
||||
u_int16_t pgms_reserved;
|
||||
/* ... u_int8_t pgms_nla[0]; */
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_nak {
|
||||
u_int32_t pgmn_seq;
|
||||
u_int16_t pgmn_source_afi;
|
||||
u_int16_t pgmn_reserved;
|
||||
/* ... u_int8_t pgmn_source[0]; */
|
||||
/* ... u_int16_t pgmn_group_afi */
|
||||
/* ... u_int16_t pgmn_reserved2; */
|
||||
/* ... u_int8_t pgmn_group[0]; */
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_poll {
|
||||
u_int32_t pgmp_seq;
|
||||
u_int16_t pgmp_round;
|
||||
u_int16_t pgmp_reserved;
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_polr {
|
||||
u_int32_t pgmp_seq;
|
||||
u_int16_t pgmp_round;
|
||||
u_int16_t pgmp_subtype;
|
||||
u_int16_t pgmp_nla_afi;
|
||||
u_int16_t pgmp_reserved;
|
||||
/* ... u_int8_t pgmp_nla[0]; */
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
struct pgm_data {
|
||||
u_int32_t pgmd_seq;
|
||||
u_int32_t pgmd_trailseq;
|
||||
/* ... options */
|
||||
};
|
||||
|
||||
typedef enum _pgm_type {
|
||||
PGM_SPM = 0, /* source path message */
|
||||
PGM_POLL = 1, /* POLL Request */
|
||||
PGM_POLR = 2, /* POLL Response */
|
||||
PGM_ODATA = 4, /* original data */
|
||||
PGM_RDATA = 5, /* repair data */
|
||||
PGM_NAK = 8, /* NAK */
|
||||
PGM_NULLNAK = 9, /* Null NAK */
|
||||
PGM_NCF = 10, /* NAK Confirmation */
|
||||
PGM_ACK = 11, /* ACK for congestion control */
|
||||
PGM_SPMR = 12, /* SPM request */
|
||||
PGM_MAX = 255
|
||||
} pgm_type;
|
||||
|
||||
#define PGM_OPT_BIT_PRESENT 0x01
|
||||
#define PGM_OPT_BIT_NETWORK 0x02
|
||||
#define PGM_OPT_BIT_VAR_PKTLEN 0x40
|
||||
#define PGM_OPT_BIT_PARITY 0x80
|
||||
|
||||
#define PGM_OPT_LENGTH 0x00
|
||||
#define PGM_OPT_FRAGMENT 0x01
|
||||
#define PGM_OPT_NAK_LIST 0x02
|
||||
#define PGM_OPT_JOIN 0x03
|
||||
#define PGM_OPT_NAK_BO_IVL 0x04
|
||||
#define PGM_OPT_NAK_BO_RNG 0x05
|
||||
|
||||
#define PGM_OPT_REDIRECT 0x07
|
||||
#define PGM_OPT_PARITY_PRM 0x08
|
||||
#define PGM_OPT_PARITY_GRP 0x09
|
||||
#define PGM_OPT_CURR_TGSIZE 0x0A
|
||||
#define PGM_OPT_NBR_UNREACH 0x0B
|
||||
#define PGM_OPT_PATH_NLA 0x0C
|
||||
|
||||
#define PGM_OPT_SYN 0x0D
|
||||
#define PGM_OPT_FIN 0x0E
|
||||
#define PGM_OPT_RST 0x0F
|
||||
#define PGM_OPT_CR 0x10
|
||||
#define PGM_OPT_CRQST 0x11
|
||||
|
||||
#define PGM_OPT_MASK 0x7f
|
||||
|
||||
#define PGM_OPT_END 0x80 /* end of options marker */
|
||||
|
||||
#define PGM_MIN_OPT_LEN 4
|
||||
|
||||
#ifndef AFI_IP
|
||||
#define AFI_IP 1
|
||||
#define AFI_IP6 2
|
||||
#endif
|
||||
|
||||
void
|
||||
pgm_print(register const u_char *bp, register u_int length,
|
||||
register const u_char *bp2)
|
||||
{
|
||||
register const struct pgm_header *pgm;
|
||||
register const struct ip *ip;
|
||||
register char ch;
|
||||
u_int16_t sport, dport;
|
||||
int addr_size;
|
||||
const void *nla;
|
||||
int nla_af;
|
||||
#ifdef INET6
|
||||
char nla_buf[INET6_ADDRSTRLEN];
|
||||
register const struct ip6_hdr *ip6;
|
||||
#else
|
||||
char nla_buf[INET_ADDRSTRLEN];
|
||||
#endif
|
||||
u_int8_t opt_type, opt_len, flags1, flags2;
|
||||
u_int32_t seq, opts_len, len, offset;
|
||||
|
||||
pgm = (struct pgm_header *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
#ifdef INET6
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
#else /* INET6 */
|
||||
if (IP_V(ip) == 6) {
|
||||
(void)printf("Can't handle IPv6");
|
||||
return;
|
||||
}
|
||||
#endif /* INET6 */
|
||||
ch = '\0';
|
||||
if (!TTEST(pgm->pgm_dport)) {
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
(void)printf("%s > %s: [|pgm]",
|
||||
ip6addr_string(&ip6->ip6_src),
|
||||
ip6addr_string(&ip6->ip6_dst));
|
||||
return;
|
||||
} else
|
||||
#endif /* INET6 */
|
||||
{
|
||||
(void)printf("%s > %s: [|pgm]",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
ipaddr_string(&ip->ip_dst));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sport = EXTRACT_16BITS(&pgm->pgm_sport);
|
||||
dport = EXTRACT_16BITS(&pgm->pgm_dport);
|
||||
|
||||
#ifdef INET6
|
||||
if (ip6) {
|
||||
if (ip6->ip6_nxt == IPPROTO_PGM) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ip6addr_string(&ip6->ip6_src),
|
||||
tcpport_string(sport),
|
||||
ip6addr_string(&ip6->ip6_dst),
|
||||
tcpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
tcpport_string(sport), tcpport_string(dport));
|
||||
}
|
||||
} else
|
||||
#endif /*INET6*/
|
||||
{
|
||||
if (ip->ip_p == IPPROTO_PGM) {
|
||||
(void)printf("%s.%s > %s.%s: ",
|
||||
ipaddr_string(&ip->ip_src),
|
||||
tcpport_string(sport),
|
||||
ipaddr_string(&ip->ip_dst),
|
||||
tcpport_string(dport));
|
||||
} else {
|
||||
(void)printf("%s > %s: ",
|
||||
tcpport_string(sport), tcpport_string(dport));
|
||||
}
|
||||
}
|
||||
|
||||
TCHECK(*pgm);
|
||||
|
||||
(void)printf("PGM, length %u", pgm->pgm_length);
|
||||
|
||||
if (!vflag)
|
||||
return;
|
||||
|
||||
if (length > pgm->pgm_length)
|
||||
length = pgm->pgm_length;
|
||||
|
||||
(void)printf(" 0x%02x%02x%02x%02x%02x%02x ",
|
||||
pgm->pgm_gsid[0],
|
||||
pgm->pgm_gsid[1],
|
||||
pgm->pgm_gsid[2],
|
||||
pgm->pgm_gsid[3],
|
||||
pgm->pgm_gsid[4],
|
||||
pgm->pgm_gsid[5]);
|
||||
switch (pgm->pgm_type) {
|
||||
case PGM_SPM: {
|
||||
struct pgm_spm *spm;
|
||||
|
||||
spm = (struct pgm_spm *)(pgm + 1);
|
||||
TCHECK(*spm);
|
||||
|
||||
switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
nla_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
nla_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp = (u_char *) (spm + 1);
|
||||
TCHECK2(*bp, addr_size);
|
||||
nla = bp;
|
||||
bp += addr_size;
|
||||
|
||||
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
||||
(void)printf("SPM seq %u trail %u lead %u nla %s",
|
||||
EXTRACT_32BITS(&spm->pgms_seq),
|
||||
EXTRACT_32BITS(&spm->pgms_trailseq),
|
||||
EXTRACT_32BITS(&spm->pgms_leadseq),
|
||||
nla_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_POLL: {
|
||||
struct pgm_poll *poll;
|
||||
|
||||
poll = (struct pgm_poll *)(pgm + 1);
|
||||
TCHECK(*poll);
|
||||
(void)printf("POLL seq %u round %u",
|
||||
EXTRACT_32BITS(&poll->pgmp_seq),
|
||||
EXTRACT_16BITS(&poll->pgmp_round));
|
||||
bp = (u_char *) (poll + 1);
|
||||
break;
|
||||
}
|
||||
case PGM_POLR: {
|
||||
struct pgm_polr *polr;
|
||||
u_int32_t ivl, rnd, mask;
|
||||
|
||||
polr = (struct pgm_polr *)(pgm + 1);
|
||||
TCHECK(*polr);
|
||||
|
||||
switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
nla_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
nla_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp = (u_char *) (polr + 1);
|
||||
TCHECK2(*bp, addr_size);
|
||||
nla = bp;
|
||||
bp += addr_size;
|
||||
|
||||
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
||||
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
ivl = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
rnd = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
mask = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
|
||||
(void)printf("POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
|
||||
"mask 0x%08x", EXTRACT_32BITS(&polr->pgmp_seq),
|
||||
EXTRACT_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask);
|
||||
break;
|
||||
}
|
||||
case PGM_ODATA: {
|
||||
struct pgm_data *odata;
|
||||
|
||||
odata = (struct pgm_data *)(pgm + 1);
|
||||
TCHECK(*odata);
|
||||
(void)printf("ODATA trail %u seq %u",
|
||||
EXTRACT_32BITS(&odata->pgmd_trailseq),
|
||||
EXTRACT_32BITS(&odata->pgmd_seq));
|
||||
bp = (u_char *) (odata + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_RDATA: {
|
||||
struct pgm_data *rdata;
|
||||
|
||||
rdata = (struct pgm_data *)(pgm + 1);
|
||||
TCHECK(*rdata);
|
||||
(void)printf("RDATA trail %u seq %u",
|
||||
EXTRACT_32BITS(&rdata->pgmd_trailseq),
|
||||
EXTRACT_32BITS(&rdata->pgmd_seq));
|
||||
bp = (u_char *) (rdata + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_NAK:
|
||||
case PGM_NULLNAK:
|
||||
case PGM_NCF: {
|
||||
struct pgm_nak *nak;
|
||||
const void *source, *group;
|
||||
int source_af, group_af;
|
||||
#ifdef INET6
|
||||
char source_buf[INET6_ADDRSTRLEN], group_buf[INET6_ADDRSTRLEN];
|
||||
#else
|
||||
char source_buf[INET_ADDRSTRLEN], group_buf[INET_ADDRSTRLEN];
|
||||
#endif
|
||||
|
||||
nak = (struct pgm_nak *)(pgm + 1);
|
||||
TCHECK(*nak);
|
||||
|
||||
/*
|
||||
* Skip past the source, saving info along the way
|
||||
* and stopping if we don't have enough.
|
||||
*/
|
||||
switch (EXTRACT_16BITS(&nak->pgmn_source_afi)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
source_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
source_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp = (u_char *) (nak + 1);
|
||||
TCHECK2(*bp, addr_size);
|
||||
source = bp;
|
||||
bp += addr_size;
|
||||
|
||||
/*
|
||||
* Skip past the group, saving info along the way
|
||||
* and stopping if we don't have enough.
|
||||
*/
|
||||
switch (EXTRACT_16BITS(bp)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
group_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
group_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp += (2 * sizeof(u_int16_t));
|
||||
TCHECK2(*bp, addr_size);
|
||||
group = bp;
|
||||
bp += addr_size;
|
||||
|
||||
/*
|
||||
* Options decoding can go here.
|
||||
*/
|
||||
inet_ntop(source_af, source, source_buf, sizeof(source_buf));
|
||||
inet_ntop(group_af, group, group_buf, sizeof(group_buf));
|
||||
switch (pgm->pgm_type) {
|
||||
case PGM_NAK:
|
||||
(void)printf("NAK ");
|
||||
break;
|
||||
case PGM_NULLNAK:
|
||||
(void)printf("NNAK ");
|
||||
break;
|
||||
case PGM_NCF:
|
||||
(void)printf("NCF ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
(void)printf("(%s -> %s), seq %u",
|
||||
source_buf, group_buf, EXTRACT_32BITS(&nak->pgmn_seq));
|
||||
break;
|
||||
}
|
||||
|
||||
case PGM_SPMR:
|
||||
(void)printf("SPMR");
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf("UNKNOWN type %0x02x", pgm->pgm_type);
|
||||
break;
|
||||
|
||||
}
|
||||
if (pgm->pgm_options & PGM_OPT_BIT_PRESENT) {
|
||||
|
||||
/*
|
||||
* make sure there's enough for the first option header
|
||||
*/
|
||||
if (!TTEST2(*bp, PGM_MIN_OPT_LEN)) {
|
||||
(void)printf("[|OPT]");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* That option header MUST be an OPT_LENGTH option
|
||||
* (see the first paragraph of section 9.1 in RFC 3208).
|
||||
*/
|
||||
opt_type = *bp++;
|
||||
if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) {
|
||||
(void)printf("[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type & PGM_OPT_MASK);
|
||||
return;
|
||||
}
|
||||
opt_len = *bp++;
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_LENGTH option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
opts_len = EXTRACT_16BITS(bp);
|
||||
if (opts_len < 4) {
|
||||
(void)printf("[Bad total option length %u < 4]", opts_len);
|
||||
return;
|
||||
}
|
||||
bp += sizeof(u_int16_t);
|
||||
(void)printf(" OPTS LEN %d", opts_len);
|
||||
opts_len -= 4;
|
||||
|
||||
while (opts_len) {
|
||||
if (opts_len < PGM_MIN_OPT_LEN) {
|
||||
(void)printf("[Total option length leaves no room for final option]");
|
||||
return;
|
||||
}
|
||||
opt_type = *bp++;
|
||||
opt_len = *bp++;
|
||||
if (opt_len < PGM_MIN_OPT_LEN) {
|
||||
(void)printf("[Bad option, length %u < %u]", opt_len,
|
||||
PGM_MIN_OPT_LEN);
|
||||
break;
|
||||
}
|
||||
if (opts_len < opt_len) {
|
||||
(void)printf("[Total option length leaves no room for final option]");
|
||||
return;
|
||||
}
|
||||
if (!TTEST2(*bp, opt_len - 2)) {
|
||||
(void)printf(" [|OPT]");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (opt_type & PGM_OPT_MASK) {
|
||||
case PGM_OPT_LENGTH:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_LENGTH option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
(void)printf(" OPTS LEN (extra?) %d", EXTRACT_16BITS(bp));
|
||||
bp += sizeof(u_int16_t);
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_FRAGMENT:
|
||||
if (opt_len != 16) {
|
||||
(void)printf("[Bad OPT_FRAGMENT option, length %u != 16]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
offset = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
len = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" FRAG seq %u off %u len %u", seq, offset, len);
|
||||
opts_len -= 16;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NAK_LIST:
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
opt_len -= sizeof(u_int32_t); /* option header */
|
||||
(void)printf(" NAK LIST");
|
||||
while (opt_len) {
|
||||
if (opt_len < sizeof(u_int32_t)) {
|
||||
(void)printf("[Option length not a multiple of 4]");
|
||||
return;
|
||||
}
|
||||
TCHECK2(*bp, sizeof(u_int32_t));
|
||||
(void)printf(" %u", EXTRACT_32BITS(bp));
|
||||
bp += sizeof(u_int32_t);
|
||||
opt_len -= sizeof(u_int32_t);
|
||||
opts_len -= sizeof(u_int32_t);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGM_OPT_JOIN:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_JOIN option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" JOIN %u", seq);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NAK_BO_IVL:
|
||||
if (opt_len != 12) {
|
||||
(void)printf("[Bad OPT_NAK_BO_IVL option, length %u != 12]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
offset = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" BACKOFF ivl %u ivlseq %u", offset, seq);
|
||||
opts_len -= 12;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NAK_BO_RNG:
|
||||
if (opt_len != 12) {
|
||||
(void)printf("[Bad OPT_NAK_BO_RNG option, length %u != 12]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
offset = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" BACKOFF max %u min %u", offset, seq);
|
||||
opts_len -= 12;
|
||||
break;
|
||||
|
||||
case PGM_OPT_REDIRECT:
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
switch (EXTRACT_16BITS(bp)) {
|
||||
case AFI_IP:
|
||||
addr_size = sizeof(struct in_addr);
|
||||
nla_af = AF_INET;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AFI_IP6:
|
||||
addr_size = sizeof(struct in6_addr);
|
||||
nla_af = AF_INET6;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
goto trunc;
|
||||
break;
|
||||
}
|
||||
bp += (2 * sizeof(u_int16_t));
|
||||
if (opt_len != 4 + addr_size) {
|
||||
(void)printf("[Bad OPT_REDIRECT option, length %u != 4 + address size]", opt_len);
|
||||
return;
|
||||
}
|
||||
TCHECK2(*bp, addr_size);
|
||||
nla = bp;
|
||||
bp += addr_size;
|
||||
|
||||
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
||||
(void)printf(" REDIRECT %s", (char *)nla);
|
||||
opts_len -= 4 + addr_size;
|
||||
break;
|
||||
|
||||
case PGM_OPT_PARITY_PRM:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_PARITY_PRM option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
len = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" PARITY MAXTGS %u", len);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_PARITY_GRP:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_PARITY_GRP option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
seq = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" PARITY GROUP %u", seq);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_CURR_TGSIZE:
|
||||
if (opt_len != 8) {
|
||||
(void)printf("[Bad OPT_CURR_TGSIZE option, length %u != 8]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
len = EXTRACT_32BITS(bp);
|
||||
bp += sizeof(u_int32_t);
|
||||
(void)printf(" PARITY ATGS %u", len);
|
||||
opts_len -= 8;
|
||||
break;
|
||||
|
||||
case PGM_OPT_NBR_UNREACH:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_NBR_UNREACH option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" NBR_UNREACH");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_PATH_NLA:
|
||||
(void)printf(" PATH_NLA [%d]", opt_len);
|
||||
bp += opt_len;
|
||||
opts_len -= opt_len;
|
||||
break;
|
||||
|
||||
case PGM_OPT_SYN:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_SYN option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" SYN");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_FIN:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_FIN option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" FIN");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_RST:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_RST option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" RST");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
case PGM_OPT_CR:
|
||||
(void)printf(" CR");
|
||||
bp += opt_len;
|
||||
opts_len -= opt_len;
|
||||
break;
|
||||
|
||||
case PGM_OPT_CRQST:
|
||||
if (opt_len != 4) {
|
||||
(void)printf("[Bad OPT_CRQST option, length %u != 4]", opt_len);
|
||||
return;
|
||||
}
|
||||
flags1 = *bp++;
|
||||
flags2 = *bp++;
|
||||
(void)printf(" CRQST");
|
||||
opts_len -= 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
(void)printf(" OPT_%02X [%d] ", opt_type, opt_len);
|
||||
bp += opt_len;
|
||||
opts_len -= opt_len;
|
||||
break;
|
||||
}
|
||||
|
||||
if (opt_type & PGM_OPT_END)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(void)printf(" [%u]", EXTRACT_16BITS(&pgm->pgm_length));
|
||||
|
||||
return;
|
||||
|
||||
trunc:
|
||||
fputs("[|pgm]", stdout);
|
||||
if (ch != '\0')
|
||||
putchar('>');
|
||||
}
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45 2005/04/06 21:32:42 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45.2.2 2005/04/20 22:08:44 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -161,6 +161,10 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len)
|
||||
bp += 4;
|
||||
len -= 4;
|
||||
while (ngroups--) {
|
||||
/*
|
||||
* XXX - does the address have length "addrlen" and the
|
||||
* mask length "maddrlen"?
|
||||
*/
|
||||
TCHECK2(bp[0], 4);
|
||||
(void)printf("\n\tGroup: %s", ipaddr_string(bp));
|
||||
TCHECK2(bp[4], 4);
|
||||
@ -507,7 +511,6 @@ static int
|
||||
pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
|
||||
{
|
||||
int af;
|
||||
const char *afstr;
|
||||
int len, hdrlen;
|
||||
|
||||
TCHECK(bp[0]);
|
||||
@ -517,13 +520,11 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
|
||||
switch (bp[0]) {
|
||||
case 1:
|
||||
af = AF_INET;
|
||||
afstr = "IPv4";
|
||||
len = 4;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case 2:
|
||||
af = AF_INET6;
|
||||
afstr = "IPv6";
|
||||
len = 16;
|
||||
break;
|
||||
#endif
|
||||
@ -537,12 +538,10 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
|
||||
switch (pimv2_addr_len) {
|
||||
case 4:
|
||||
af = AF_INET;
|
||||
afstr = "IPv4";
|
||||
break;
|
||||
#ifdef INET6
|
||||
case 16:
|
||||
af = AF_INET6;
|
||||
afstr = "IPv6";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108 2005/04/06 21:32:42 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108.2.4 2005/06/18 23:56:40 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -243,43 +243,35 @@ static const char *lcpconfopts[] = {
|
||||
/* 27-254 unassigned */
|
||||
#define CCPOPT_RESV 255 /* RFC1962 */
|
||||
|
||||
#define CCPOPT_MIN CCPOPT_OUI
|
||||
#define CCPOPT_MAX CCPOPT_DEFLATE /* XXX: should be CCPOPT_RESV but... */
|
||||
|
||||
static const char *ccpconfopts[] = {
|
||||
"OUI", /* (0) */
|
||||
"Pred-1", /* (1) */
|
||||
"Pred-2", /* (2) */
|
||||
"Puddle", /* (3) */
|
||||
"unassigned(4)", /* (4) */
|
||||
"unassigned(5)", /* (5) */
|
||||
"unassigned(6)", /* (6) */
|
||||
"unassigned(7)", /* (7) */
|
||||
"unassigned(8)", /* (8) */
|
||||
"unassigned(9)", /* (9) */
|
||||
"unassigned(10)", /* (10) */
|
||||
"unassigned(11)", /* (11) */
|
||||
"unassigned(12)", /* (12) */
|
||||
"unassigned(13)", /* (13) */
|
||||
"unassigned(14)", /* (14) */
|
||||
"unassigned(15)", /* (15) */
|
||||
"HP-PPC", /* (16) */
|
||||
"Stac-LZS", /* (17) */
|
||||
"MPPC", /* (18) */
|
||||
"Gand-FZA", /* (19) */
|
||||
"V.42bis", /* (20) */
|
||||
"BSD-Comp", /* (21) */
|
||||
"unassigned(22)", /* (22) */
|
||||
"LZS-DCP", /* (23) */
|
||||
"MVRCA", /* (24) */
|
||||
"DEC", /* (25) */
|
||||
"Deflate", /* (26) */
|
||||
const struct tok ccpconfopts_values[] = {
|
||||
{ CCPOPT_OUI, "OUI" },
|
||||
{ CCPOPT_PRED1, "Pred-1" },
|
||||
{ CCPOPT_PRED2, "Pred-2" },
|
||||
{ CCPOPT_PJUMP, "Puddle" },
|
||||
{ CCPOPT_HPPPC, "HP-PPC" },
|
||||
{ CCPOPT_STACLZS, "Stac-LZS" },
|
||||
{ CCPOPT_MPPC, "MPPC" },
|
||||
{ CCPOPT_GFZA, "Gand-FZA" },
|
||||
{ CCPOPT_V42BIS, "V.42bis" },
|
||||
{ CCPOPT_BSDCOMP, "BSD-Comp" },
|
||||
{ CCPOPT_LZSDCP, "LZS-DCP" },
|
||||
{ CCPOPT_MVRCA, "MVRCA" },
|
||||
{ CCPOPT_DEC, "DEC" },
|
||||
{ CCPOPT_DEFLATE, "Deflate" },
|
||||
{ CCPOPT_RESV, "Reserved"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
/* BACP Config Options */
|
||||
|
||||
#define BACPOPT_FPEER 1 /* RFC2125 */
|
||||
|
||||
const struct tok bacconfopts_values[] = {
|
||||
{ BACPOPT_FPEER, "Favored-Peer" },
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
/* SDCP - to be supported */
|
||||
|
||||
/* IPCP Config Options */
|
||||
@ -352,6 +344,16 @@ struct tok authalg_values[] = {
|
||||
#define CALLBACK_X500 4 /* X.500 distinguished name */
|
||||
#define CALLBACK_CBCP 6 /* Location is determined during CBCP nego */
|
||||
|
||||
struct tok ppp_callback_values[] = {
|
||||
{ CALLBACK_AUTH, "UserAuth" },
|
||||
{ CALLBACK_DSTR, "DialString" },
|
||||
{ CALLBACK_LID, "LocalID" },
|
||||
{ CALLBACK_E164, "E.164" },
|
||||
{ CALLBACK_X500, "X.500" },
|
||||
{ CALLBACK_CBCP, "CBCP" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* CHAP */
|
||||
|
||||
#define CHAP_CHAL 1
|
||||
@ -424,24 +426,34 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
|
||||
|
||||
code = *tptr++;
|
||||
|
||||
printf("%s (0x%02x), id %u",
|
||||
printf("%s (0x%02x), id %u, length %u",
|
||||
tok2str(cpcodes, "Unknown Opcode",code),
|
||||
code,
|
||||
*tptr++); /* ID */
|
||||
code,
|
||||
*tptr++, /* ID */
|
||||
length+2);
|
||||
|
||||
if (!vflag)
|
||||
return;
|
||||
|
||||
if (length <= 4)
|
||||
return; /* there may be a NULL confreq etc. */
|
||||
|
||||
TCHECK2(*tptr, 2);
|
||||
len = EXTRACT_16BITS(tptr);
|
||||
tptr += 2;
|
||||
|
||||
if (length <= 4)
|
||||
goto print_len_and_return; /* there may be a NULL confreq etc. */
|
||||
printf("\n\tencoded length %u (=Option(s) length %u)",len,len-4);
|
||||
|
||||
if (vflag>1)
|
||||
print_unknown_data(pptr-2,"\n\t",6);
|
||||
|
||||
|
||||
switch (code) {
|
||||
case CPCODES_VEXT:
|
||||
if (length < 11)
|
||||
break;
|
||||
TCHECK2(*tptr, 4);
|
||||
printf(", Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
printf("\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
tptr += 4;
|
||||
TCHECK2(*tptr, 3);
|
||||
printf(" Vendor: %s (%u)",
|
||||
@ -501,26 +513,44 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
|
||||
if (length < 6)
|
||||
break;
|
||||
TCHECK2(*tptr, 2);
|
||||
printf(", Rejected %s Protocol (0x%04x)",
|
||||
printf("\n\t Rejected %s Protocol (0x%04x)",
|
||||
tok2str(ppptype2str,"unknown", EXTRACT_16BITS(tptr)),
|
||||
EXTRACT_16BITS(tptr));
|
||||
/* XXX: need to decode Rejected-Information? */
|
||||
/* XXX: need to decode Rejected-Information? - hexdump for now */
|
||||
if (len > 6) {
|
||||
printf("\n\t Rejected Packet");
|
||||
print_unknown_data(tptr+2,"\n\t ",len-2);
|
||||
}
|
||||
break;
|
||||
case CPCODES_ECHO_REQ:
|
||||
case CPCODES_ECHO_RPL:
|
||||
case CPCODES_DISC_REQ:
|
||||
if (length < 8)
|
||||
break;
|
||||
TCHECK2(*tptr, 4);
|
||||
printf("\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
/* XXX: need to decode Data? - hexdump for now */
|
||||
if (len > 8) {
|
||||
printf("\n\t Data");
|
||||
print_unknown_data(tptr+4,"\n\t ",len-4);
|
||||
}
|
||||
break;
|
||||
case CPCODES_ID:
|
||||
if (length < 8)
|
||||
break;
|
||||
TCHECK2(*tptr, 4);
|
||||
printf(", Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
/* XXX: need to decode Data? */
|
||||
printf("\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
/* RFC 1661 says this is intended to be human readable */
|
||||
if (len > 8) {
|
||||
printf("\n\t Message\n\t ");
|
||||
fn_printn(tptr+4,len-4,snapend);
|
||||
}
|
||||
break;
|
||||
case CPCODES_TIME_REM:
|
||||
if (length < 12)
|
||||
break;
|
||||
TCHECK2(*tptr, 4);
|
||||
printf(", Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
printf("\n\t Magic-Num 0x%08x", EXTRACT_32BITS(tptr));
|
||||
TCHECK2(*(tptr + 4), 4);
|
||||
printf(", Seconds-Remaining %us", EXTRACT_32BITS(tptr + 4));
|
||||
/* XXX: need to decode Message? */
|
||||
@ -530,15 +560,9 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
|
||||
* original pointer passed to the begin
|
||||
* the PPP packet */
|
||||
if (vflag <= 1)
|
||||
print_unknown_data(pptr-2,"\n\t",length+2);
|
||||
print_unknown_data(pptr-2,"\n\t ",length+2);
|
||||
break;
|
||||
}
|
||||
|
||||
print_len_and_return:
|
||||
printf(", length %u", length);
|
||||
|
||||
if (vflag >1)
|
||||
print_unknown_data(pptr-2,"\n\t",length+2);
|
||||
return;
|
||||
|
||||
trunc:
|
||||
@ -558,10 +582,17 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
opt = p[0];
|
||||
if (length < len)
|
||||
return 0;
|
||||
if (len < 2) {
|
||||
if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX))
|
||||
printf("\n\t %s Option (0x%02x), length %u (bogus, should be >= 2)", lcpconfopts[opt],opt,len);
|
||||
else
|
||||
printf("\n\tunknown LCP option 0x%02x", opt);
|
||||
return 0;
|
||||
}
|
||||
if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX))
|
||||
printf(", %s (%u)", lcpconfopts[opt],opt);
|
||||
printf("\n\t %s Option (0x%02x), length %u: ", lcpconfopts[opt],opt,len);
|
||||
else {
|
||||
printf(", unknown LCP option 0x%02x", opt);
|
||||
printf("\n\tunknown LCP option 0x%02x", opt);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -569,7 +600,7 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
case LCPOPT_VEXT:
|
||||
if (len >= 6) {
|
||||
TCHECK2(*(p + 2), 3);
|
||||
printf(" Vendor: %s (%u)",
|
||||
printf("Vendor: %s (%u)",
|
||||
tok2str(oui_values,"Unknown",EXTRACT_24BITS(p+2)),
|
||||
EXTRACT_24BITS(p+2));
|
||||
#if 0
|
||||
@ -586,19 +617,19 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
case LCPOPT_MRU:
|
||||
if (len == 4) {
|
||||
TCHECK2(*(p + 2), 2);
|
||||
printf(" %u", EXTRACT_16BITS(p + 2));
|
||||
printf("%u", EXTRACT_16BITS(p + 2));
|
||||
}
|
||||
break;
|
||||
case LCPOPT_ACCM:
|
||||
if (len == 6) {
|
||||
TCHECK2(*(p + 2), 4);
|
||||
printf(" 0x%08x", EXTRACT_32BITS(p + 2));
|
||||
printf("0x%08x", EXTRACT_32BITS(p + 2));
|
||||
}
|
||||
break;
|
||||
case LCPOPT_AP:
|
||||
if (len >= 4) {
|
||||
TCHECK2(*(p + 2), 2);
|
||||
printf(" %s", tok2str(ppptype2str,"Unknown Auth Proto (0x04x)",EXTRACT_16BITS(p+2)));
|
||||
printf("%s", tok2str(ppptype2str,"Unknown Auth Proto (0x04x)",EXTRACT_16BITS(p+2)));
|
||||
|
||||
switch (EXTRACT_16BITS(p+2)) {
|
||||
case PPP_CHAP:
|
||||
@ -627,7 +658,7 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
case LCPOPT_MN:
|
||||
if (len == 6) {
|
||||
TCHECK2(*(p + 2), 4);
|
||||
printf(" 0x%08x", EXTRACT_32BITS(p + 2));
|
||||
printf("0x%08x", EXTRACT_32BITS(p + 2));
|
||||
}
|
||||
break;
|
||||
case LCPOPT_PFC:
|
||||
@ -637,41 +668,21 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
case LCPOPT_LD:
|
||||
if (len == 4) {
|
||||
TCHECK2(*(p + 2), 2);
|
||||
printf(" 0x%04x", EXTRACT_16BITS(p + 2));
|
||||
printf("0x%04x", EXTRACT_16BITS(p + 2));
|
||||
}
|
||||
break;
|
||||
case LCPOPT_CBACK:
|
||||
if (len < 3)
|
||||
break;
|
||||
TCHECK(p[2]);
|
||||
switch (p[2]) { /* Operation */
|
||||
case CALLBACK_AUTH:
|
||||
printf(" UserAuth");
|
||||
break;
|
||||
case CALLBACK_DSTR:
|
||||
printf(" DialString");
|
||||
break;
|
||||
case CALLBACK_LID:
|
||||
printf(" LocalID");
|
||||
break;
|
||||
case CALLBACK_E164:
|
||||
printf(" E.164");
|
||||
break;
|
||||
case CALLBACK_X500:
|
||||
printf(" X.500");
|
||||
break;
|
||||
case CALLBACK_CBCP:
|
||||
printf(" CBCP");
|
||||
break;
|
||||
default:
|
||||
printf(" unknown-operation=%u", p[2]);
|
||||
break;
|
||||
}
|
||||
printf("Callback Operation %s (%u)",
|
||||
tok2str(ppp_callback_values,"Unknown",p[2]),
|
||||
p[2]);
|
||||
break;
|
||||
case LCPOPT_MLMRRU:
|
||||
if (len == 4) {
|
||||
TCHECK2(*(p + 2), 2);
|
||||
printf(" %u", EXTRACT_16BITS(p + 2));
|
||||
printf("%u", EXTRACT_16BITS(p + 2));
|
||||
}
|
||||
break;
|
||||
case LCPOPT_MLED:
|
||||
@ -680,29 +691,29 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
TCHECK(p[2]);
|
||||
switch (p[2]) { /* class */
|
||||
case MEDCLASS_NULL:
|
||||
printf(" Null");
|
||||
printf("Null");
|
||||
break;
|
||||
case MEDCLASS_LOCAL:
|
||||
printf(" Local"); /* XXX */
|
||||
printf("Local"); /* XXX */
|
||||
break;
|
||||
case MEDCLASS_IPV4:
|
||||
if (len != 7)
|
||||
break;
|
||||
TCHECK2(*(p + 3), 4);
|
||||
printf(" IPv4 %s", ipaddr_string(p + 3));
|
||||
printf("IPv4 %s", ipaddr_string(p + 3));
|
||||
break;
|
||||
case MEDCLASS_MAC:
|
||||
if (len != 9)
|
||||
break;
|
||||
TCHECK(p[8]);
|
||||
printf(" MAC %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
printf("MAC %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
p[3], p[4], p[5], p[6], p[7], p[8]);
|
||||
break;
|
||||
case MEDCLASS_MNB:
|
||||
printf(" Magic-Num-Block"); /* XXX */
|
||||
printf("Magic-Num-Block"); /* XXX */
|
||||
break;
|
||||
case MEDCLASS_PSNDN:
|
||||
printf(" PSNDN"); /* XXX */
|
||||
printf("PSNDN"); /* XXX */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -730,7 +741,15 @@ print_lcp_config_options(const u_char *p, int length)
|
||||
case LCPOPT_PPPMUX:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
if(vflag<2)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (vflag>1)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2); /* exclude TLV header */
|
||||
|
||||
return len;
|
||||
|
||||
trunc:
|
||||
@ -872,6 +891,16 @@ handle_pap(const u_char *p, int length)
|
||||
len = EXTRACT_16BITS(p);
|
||||
p += 2;
|
||||
|
||||
if ((int)len > length) {
|
||||
printf(", length %u > packet size", len);
|
||||
return;
|
||||
}
|
||||
length = len;
|
||||
if (length < (p - p0)) {
|
||||
printf(", length %u < PAP header length", length);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case PAP_AREQ:
|
||||
if (length - (p - p0) < 1)
|
||||
@ -943,10 +972,18 @@ print_ipcp_config_options(const u_char *p, int length)
|
||||
opt = p[0];
|
||||
if (length < len)
|
||||
return 0;
|
||||
if (len < 2) {
|
||||
printf("\n\t %s Option (0x%02x), length %u (bogus, should be >= 2)",
|
||||
tok2str(ipcpopt_values,"unknown",opt),
|
||||
opt,
|
||||
len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf(", %s (0x%02x) ",
|
||||
printf("\n\t %s Option (0x%02x), length %u: ",
|
||||
tok2str(ipcpopt_values,"unknown",opt),
|
||||
opt);
|
||||
opt,
|
||||
len);
|
||||
|
||||
switch (opt) {
|
||||
case IPCPOPT_2ADDR: /* deprecated */
|
||||
@ -980,9 +1017,12 @@ print_ipcp_config_options(const u_char *p, int length)
|
||||
printf("%s", ipaddr_string(p + 2));
|
||||
break;
|
||||
default:
|
||||
printf(", unknown-%d", opt);
|
||||
if(vflag<2)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2);
|
||||
break;
|
||||
}
|
||||
if (vflag>1)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2); /* exclude TLV header */
|
||||
return len;
|
||||
|
||||
invlen:
|
||||
@ -1007,10 +1047,18 @@ print_ip6cp_config_options(const u_char *p, int length)
|
||||
opt = p[0];
|
||||
if (length < len)
|
||||
return 0;
|
||||
if (len < 2) {
|
||||
printf("\n\t %s Option (0x%02x), length %u (bogus, should be >= 2)",
|
||||
tok2str(ip6cpopt_values,"unknown",opt),
|
||||
opt,
|
||||
len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf(", %s (0x%02x) ",
|
||||
printf("\n\t %s Option (0x%02x), length %u: ",
|
||||
tok2str(ip6cpopt_values,"unknown",opt),
|
||||
opt);
|
||||
opt,
|
||||
len);
|
||||
|
||||
switch (opt) {
|
||||
case IP6CP_IFID:
|
||||
@ -1024,9 +1072,13 @@ print_ip6cp_config_options(const u_char *p, int length)
|
||||
EXTRACT_16BITS(p + 8));
|
||||
break;
|
||||
default:
|
||||
printf(", unknown-%d", opt);
|
||||
if(vflag<2)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2);
|
||||
break;
|
||||
}
|
||||
if (vflag>1)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2); /* exclude TLV header */
|
||||
|
||||
return len;
|
||||
|
||||
invlen:
|
||||
@ -1052,10 +1104,21 @@ print_ccp_config_options(const u_char *p, int length)
|
||||
opt = p[0];
|
||||
if (length < len)
|
||||
return 0;
|
||||
if ((opt >= CCPOPT_MIN) && (opt <= CCPOPT_MAX))
|
||||
printf(", %s", ccpconfopts[opt]);
|
||||
#if 0 /* XXX */
|
||||
if (len < 2) {
|
||||
printf("\n\t %s Option (0x%02x), length %u (bogus, should be >= 2)",
|
||||
tok2str(ccpconfopts_values, "Unknown", opt),
|
||||
opt,
|
||||
len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("\n\t %s Option (0x%02x), length %u:",
|
||||
tok2str(ccpconfopts_values, "Unknown", opt),
|
||||
opt,
|
||||
len);
|
||||
|
||||
switch (opt) {
|
||||
/* fall through --> default: nothing supported yet */
|
||||
case CCPOPT_OUI:
|
||||
case CCPOPT_PRED1:
|
||||
case CCPOPT_PRED2:
|
||||
@ -1071,13 +1134,14 @@ print_ccp_config_options(const u_char *p, int length)
|
||||
case CCPOPT_DEC:
|
||||
case CCPOPT_DEFLATE:
|
||||
case CCPOPT_RESV:
|
||||
break;
|
||||
|
||||
default:
|
||||
printf(", unknown-%d", opt);
|
||||
if(vflag<2)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (vflag>1)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2); /* exclude TLV header */
|
||||
|
||||
return len;
|
||||
|
||||
trunc:
|
||||
@ -1098,13 +1162,32 @@ print_bacp_config_options(const u_char *p, int length)
|
||||
opt = p[0];
|
||||
if (length < len)
|
||||
return 0;
|
||||
if (opt == BACPOPT_FPEER) {
|
||||
if (len < 2) {
|
||||
printf("\n\t %s Option (0x%02x), length %u (bogus, should be >= 2)",
|
||||
tok2str(bacconfopts_values, "Unknown", opt),
|
||||
opt,
|
||||
len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("\n\t %s Option (0x%02x), length %u:",
|
||||
tok2str(bacconfopts_values, "Unknown", opt),
|
||||
opt,
|
||||
len);
|
||||
|
||||
switch (opt) {
|
||||
case BACPOPT_FPEER:
|
||||
TCHECK2(*(p + 2), 4);
|
||||
printf(", Favored-Peer");
|
||||
printf(", Magic-Num 0x%08x", EXTRACT_32BITS(p + 2));
|
||||
} else {
|
||||
printf(", unknown-option-%d", opt);
|
||||
break;
|
||||
default:
|
||||
if(vflag<2)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2);
|
||||
break;
|
||||
}
|
||||
if (vflag>1)
|
||||
print_unknown_data(&p[2],"\n\t ",len-2); /* exclude TLV header */
|
||||
|
||||
return len;
|
||||
|
||||
trunc:
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.30 2004/08/27 03:57:41 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.30.2.1 2005/04/26 19:48:56 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -138,21 +138,6 @@ pppoe_print(register const u_char *bp, u_int length)
|
||||
printf(" [ses 0x%x]", pppoe_sessionid);
|
||||
}
|
||||
|
||||
if (pppoe_length < length && length + ETHER_HDRLEN > 60) {
|
||||
/* (small packets are probably just padded up to the ethernet
|
||||
minimum of 60 bytes of data + 4 bytes of CRC) */
|
||||
printf(" [length %u (%u extra bytes)]",
|
||||
pppoe_length, length - pppoe_length);
|
||||
#if RESPECT_PAYLOAD_LENGTH
|
||||
if (snaplend > pppoe_payload+pppoe_length)
|
||||
snapend = pppoe_payload+pppoe_length;
|
||||
#else
|
||||
/* Actual PPPoE implementations appear to ignore the payload
|
||||
length and use the full ethernet frame anyways */
|
||||
pppoe_length = length;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (pppoe_code) {
|
||||
/* PPP session packets don't contain tags */
|
||||
u_short tag_type = 0xffff, tag_len;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33 2005/01/13 07:08:54 hannes Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33.2.3 2005/06/16 00:50:12 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -548,7 +548,7 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
} bw;
|
||||
u_int8_t namelen;
|
||||
|
||||
while(tlen>0) {
|
||||
while(tlen>=sizeof(struct rsvp_object_header)) {
|
||||
/* did we capture enough for fully decoding the object header ? */
|
||||
if (!TTEST2(*tptr, sizeof(struct rsvp_object_header)))
|
||||
goto trunc;
|
||||
@ -557,7 +557,11 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length);
|
||||
rsvp_obj_ctype=rsvp_obj_header->ctype;
|
||||
|
||||
if(rsvp_obj_len % 4 || rsvp_obj_len < sizeof(struct rsvp_object_header)) {
|
||||
if(rsvp_obj_len % 4) {
|
||||
printf("%sERROR: object header size %u not a multiple of 4", ident, rsvp_obj_len);
|
||||
return -1;
|
||||
}
|
||||
if(rsvp_obj_len < sizeof(struct rsvp_object_header)) {
|
||||
printf("%sERROR: object header too short %u < %lu", ident, rsvp_obj_len,
|
||||
(unsigned long)sizeof(const struct rsvp_object_header));
|
||||
return -1;
|
||||
@ -582,6 +586,11 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
rsvp_obj_ctype,
|
||||
rsvp_obj_len);
|
||||
|
||||
if(tlen < rsvp_obj_len) {
|
||||
printf("%sERROR: object goes past end of objects TLV", ident);
|
||||
return -1;
|
||||
}
|
||||
|
||||
obj_tptr=tptr+sizeof(struct rsvp_object_header);
|
||||
obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header);
|
||||
|
||||
@ -1268,6 +1277,8 @@ rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
|
||||
*(obj_tptr+1));
|
||||
if (obj_tlen < *(obj_tptr+1))
|
||||
return-1;
|
||||
if (*(obj_tptr+1) < 2)
|
||||
return -1;
|
||||
print_unknown_data(obj_tptr+2,"\n\t\t",*(obj_tptr+1)-2);
|
||||
obj_tlen-=*(obj_tptr+1);
|
||||
obj_tptr+=*(obj_tptr+1);
|
||||
@ -1422,6 +1433,12 @@ rsvp_print(register const u_char *pptr, register u_int len) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tlen < subtlen) {
|
||||
printf("ERROR: common header too large %u > %u", subtlen,
|
||||
tlen);
|
||||
return;
|
||||
}
|
||||
|
||||
subtptr+=sizeof(const struct rsvp_common_header);
|
||||
subtlen-=sizeof(const struct rsvp_common_header);
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.26 2003/11/19 00:36:08 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-rt6.c,v 1.26.2.1 2005/04/20 22:35:11 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -41,17 +41,15 @@ static const char rcsid[] _U_ =
|
||||
#include "extract.h"
|
||||
|
||||
int
|
||||
rt6_print(register const u_char *bp, register const u_char *bp2)
|
||||
rt6_print(register const u_char *bp, const u_char *bp2 _U_)
|
||||
{
|
||||
register const struct ip6_rthdr *dp;
|
||||
register const struct ip6_rthdr0 *dp0;
|
||||
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 available data. */
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.16 2004/12/15 08:43:23 guy Exp $ (NETLAB/PEL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.16.2.3 2005/05/06 10:53:20 guy Exp $ (NETLAB/PEL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -68,7 +68,6 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
#ifdef INET6
|
||||
const struct ip6_hdr *ip6;
|
||||
#endif
|
||||
const u_char *cp;
|
||||
const void *endPacketPtr;
|
||||
u_short sourcePort, destPort;
|
||||
int chunkCount;
|
||||
@ -88,12 +87,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
else
|
||||
ip6 = NULL;
|
||||
#endif /*INET6*/
|
||||
cp = (const u_char *)(sctpPktHdr + 1);
|
||||
if (cp > snapend)
|
||||
{
|
||||
printf("[|sctp]");
|
||||
return;
|
||||
}
|
||||
TCHECK(*sctpPktHdr);
|
||||
|
||||
if (sctpPacketLength < sizeof(struct sctpHeader))
|
||||
{
|
||||
@ -141,12 +135,21 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
|
||||
chunkDescPtr = (const struct sctpChunkDesc *) nextChunk, chunkCount++)
|
||||
{
|
||||
u_short align;
|
||||
u_int16_t chunkLength;
|
||||
const u_char *chunkEnd;
|
||||
u_int16_t align;
|
||||
|
||||
chunkEnd = ((const u_char*)chunkDescPtr + EXTRACT_16BITS(&chunkDescPtr->chunkLength));
|
||||
TCHECK(*chunkDescPtr);
|
||||
chunkLength = EXTRACT_16BITS(&chunkDescPtr->chunkLength);
|
||||
if (chunkLength < sizeof(*chunkDescPtr)) {
|
||||
printf("%s%d) [Bad chunk length %u]", sep, chunkCount+1, chunkLength);
|
||||
break;
|
||||
}
|
||||
|
||||
align=EXTRACT_16BITS(&chunkDescPtr->chunkLength) % 4;
|
||||
TCHECK2(*((u_int8_t *)chunkDescPtr), chunkLength);
|
||||
chunkEnd = ((const u_char*)chunkDescPtr + chunkLength);
|
||||
|
||||
align=chunkLength % 4;
|
||||
if (align != 0)
|
||||
align = 4 - align;
|
||||
|
||||
@ -259,7 +262,7 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
const struct sctpSelectiveAck *sack;
|
||||
const struct sctpSelectiveFrag *frag;
|
||||
int fragNo, tsnNo;
|
||||
const u_long *dupTSN;
|
||||
const u_char *dupTSN;
|
||||
|
||||
printf("[SACK] ");
|
||||
sack=(const struct sctpSelectiveAck*)(chunkDescPtr+1);
|
||||
@ -282,9 +285,9 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
|
||||
|
||||
/* print duplicate TSNs */
|
||||
for (dupTSN = (const u_long*)frag, tsnNo=0;
|
||||
for (dupTSN = (const u_char *)frag, tsnNo=0;
|
||||
(const void *) dupTSN < nextChunk && tsnNo<EXTRACT_16BITS(&sack->numDupTsns);
|
||||
dupTSN++, tsnNo++)
|
||||
dupTSN += 4, tsnNo++)
|
||||
printf("\n\t\t[dup TSN #%u: %u] ", tsnNo+1,
|
||||
EXTRACT_32BITS(dupTSN));
|
||||
|
||||
@ -347,4 +350,9 @@ void sctp_print(const u_char *bp, /* beginning of sctp packet */
|
||||
if (vflag < 2)
|
||||
sep = ", (";
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("[|sctp]");
|
||||
return;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.16 2004/10/28 00:34:29 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sll.c,v 1.16.2.1 2005/04/26 00:16:43 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -53,6 +53,8 @@ const struct tok sll_pkttype_values[] = {
|
||||
static inline void
|
||||
sll_print(register const struct sll_header *sllp, u_int length)
|
||||
{
|
||||
u_short ether_type;
|
||||
|
||||
printf("%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_16BITS(&sllp->sll_pkttype)));
|
||||
|
||||
/*
|
||||
@ -63,11 +65,44 @@ sll_print(register const struct sll_header *sllp, u_int length)
|
||||
if (EXTRACT_16BITS(&sllp->sll_halen) == 6)
|
||||
(void)printf("%s ", etheraddr_string(sllp->sll_addr));
|
||||
|
||||
if (!qflag)
|
||||
(void)printf("ethertype %s (0x%04x), length %u: ",
|
||||
tok2str(ethertype_values,"Unknown", EXTRACT_16BITS(&sllp->sll_protocol)),
|
||||
EXTRACT_16BITS(&sllp->sll_protocol),
|
||||
length);
|
||||
if (!qflag) {
|
||||
ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
|
||||
|
||||
if (ether_type <= ETHERMTU) {
|
||||
/*
|
||||
* Not an Ethernet type; what type is it?
|
||||
*/
|
||||
switch (ether_type) {
|
||||
|
||||
case LINUX_SLL_P_802_3:
|
||||
/*
|
||||
* Ethernet_802.3 IPX frame.
|
||||
*/
|
||||
(void)printf("802.3");
|
||||
break;
|
||||
|
||||
case LINUX_SLL_P_802_2:
|
||||
/*
|
||||
* 802.2.
|
||||
*/
|
||||
(void)printf("802.3");
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* What is it?
|
||||
*/
|
||||
(void)printf("ethertype Unknown (0x%04x)",
|
||||
ether_type);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
(void)printf("ethertype %s (0x%04x)",
|
||||
tok2str(ethertype_values, "Unknown", ether_type),
|
||||
ether_type);
|
||||
}
|
||||
(void)printf(", length %u: ", length);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.41 2004/12/30 03:36:51 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.41.2.2 2005/05/08 20:01:09 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
@ -925,17 +925,25 @@ print_smb(const u_char *buf, const u_char *maxbuf)
|
||||
void
|
||||
nbt_tcp_print(const u_char *data, int length)
|
||||
{
|
||||
const u_char *maxbuf = data + length;
|
||||
int caplen;
|
||||
int type;
|
||||
u_int nbt_len;
|
||||
const u_char *maxbuf;
|
||||
|
||||
TCHECK2(data[2], 2);
|
||||
if (length < 4)
|
||||
goto trunc;
|
||||
if (snapend < data)
|
||||
goto trunc;
|
||||
caplen = snapend - data;
|
||||
if (caplen < 4)
|
||||
goto trunc;
|
||||
maxbuf = data + caplen;
|
||||
type = data[0];
|
||||
nbt_len = EXTRACT_16BITS(data + 2);
|
||||
length -= 4;
|
||||
caplen -= 4;
|
||||
|
||||
startbuf = data;
|
||||
if (maxbuf <= data)
|
||||
return;
|
||||
|
||||
if (vflag < 2) {
|
||||
printf(" NBT Session Packet: ");
|
||||
@ -956,7 +964,12 @@ nbt_tcp_print(const u_char *data, int length)
|
||||
{
|
||||
int ecode;
|
||||
|
||||
TCHECK(data[4]);
|
||||
if (nbt_len < 4)
|
||||
goto trunc;
|
||||
if (length < 4)
|
||||
goto trunc;
|
||||
if (caplen < 4)
|
||||
goto trunc;
|
||||
ecode = data[4];
|
||||
|
||||
printf("Session Reject, ");
|
||||
@ -996,13 +1009,17 @@ nbt_tcp_print(const u_char *data, int length)
|
||||
data + 4, 0);
|
||||
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 (%lu)\n",
|
||||
(unsigned long)PTR_DIFF(maxbuf, data));
|
||||
if (nbt_len >= 4 && caplen >= 4 && memcmp(data,"\377SMB",4) == 0) {
|
||||
if ((int)nbt_len > caplen) {
|
||||
if ((int)nbt_len > length)
|
||||
printf("WARNING: Packet is continued in later TCP segments\n");
|
||||
else
|
||||
printf("WARNING: Short packet. Try increasing the snap length by %d\n",
|
||||
nbt_len - caplen);
|
||||
}
|
||||
print_smb(data, maxbuf > data + nbt_len ? data + nbt_len : maxbuf);
|
||||
} else
|
||||
printf("Session packet:(raw data?)\n");
|
||||
printf("Session packet:(raw data or continuation?)\n");
|
||||
break;
|
||||
|
||||
case 0x81:
|
||||
@ -1017,29 +1034,33 @@ nbt_tcp_print(const u_char *data, int length)
|
||||
|
||||
case 0x83:
|
||||
{
|
||||
const u_char *origdata;
|
||||
int ecode;
|
||||
|
||||
TCHECK(data[4]);
|
||||
ecode = data[4];
|
||||
|
||||
origdata = data;
|
||||
data = smb_fdata(data, "[P1]NBT SessionReject\nFlags=[B]\nLength=[rd]\nReason=[B]\n",
|
||||
maxbuf, 0);
|
||||
switch (ecode) {
|
||||
case 0x80:
|
||||
printf("Not listening on called name\n");
|
||||
break;
|
||||
case 0x81:
|
||||
printf("Not listening for calling name\n");
|
||||
break;
|
||||
case 0x82:
|
||||
printf("Called name not present\n");
|
||||
break;
|
||||
case 0x83:
|
||||
printf("Called name present, but insufficient resources\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unspecified error 0x%X\n", ecode);
|
||||
if (data == NULL)
|
||||
break;
|
||||
if (nbt_len >= 1 && caplen >= 1) {
|
||||
ecode = origdata[4];
|
||||
switch (ecode) {
|
||||
case 0x80:
|
||||
printf("Not listening on called name\n");
|
||||
break;
|
||||
case 0x81:
|
||||
printf("Not listening for calling name\n");
|
||||
break;
|
||||
case 0x82:
|
||||
printf("Called name not present\n");
|
||||
break;
|
||||
case 0x83:
|
||||
printf("Called name present, but insufficient resources\n");
|
||||
break;
|
||||
default:
|
||||
printf("Unspecified error 0x%X\n", ecode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1141,12 +1162,13 @@ nbt_udp137_print(const u_char *data, int length)
|
||||
|
||||
if (qdcount) {
|
||||
printf("QuestionRecords:\n");
|
||||
for (i = 0; i < qdcount; i++)
|
||||
for (i = 0; i < qdcount; i++) {
|
||||
p = smb_fdata(p,
|
||||
"|Name=[n1]\nQuestionType=[rw]\nQuestionClass=[rw]\n#",
|
||||
maxbuf, 0);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (total) {
|
||||
@ -1180,6 +1202,8 @@ nbt_udp137_print(const u_char *data, int length)
|
||||
goto out;
|
||||
while (numnames--) {
|
||||
p = smb_fdata(p, "Name=[n2]\t#", maxbuf, 0);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
TCHECK(*p);
|
||||
if (p[0] & 0x80)
|
||||
printf("<GROUP> ");
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.62 2005/01/05 04:05:04 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-snmp.c,v 1.62.2.2 2005/05/06 07:57:19 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -786,7 +786,10 @@ asn1_print(struct be *elem)
|
||||
p = elem->data.str;
|
||||
if (printable) {
|
||||
putchar('"');
|
||||
(void)fn_print(p, p + asnlen);
|
||||
if (fn_printn(p, asnlen, snapend)) {
|
||||
putchar('"');
|
||||
goto trunc;
|
||||
}
|
||||
putchar('"');
|
||||
} else
|
||||
for (i = asnlen; i-- > 0; p++) {
|
||||
@ -1320,13 +1323,13 @@ snmppdu_print(u_short pduid, const u_char *np, u_int length)
|
||||
if ((pduid == GETREQ || pduid == GETNEXTREQ || pduid == SETREQ
|
||||
|| pduid == INFORMREQ || pduid == V2TRAP || pduid == REPORT)
|
||||
&& elem.data.integer != 0) {
|
||||
char errbuf[10];
|
||||
char errbuf[20];
|
||||
printf("[errorStatus(%s)!=0]",
|
||||
DECODE_ErrorStatus(elem.data.integer));
|
||||
} else if (pduid == GETBULKREQ) {
|
||||
printf(" N=%d", elem.data.integer);
|
||||
} else if (elem.data.integer != 0) {
|
||||
char errbuf[10];
|
||||
char errbuf[20];
|
||||
printf(" %s", DECODE_ErrorStatus(elem.data.integer));
|
||||
error = elem.data.integer;
|
||||
}
|
||||
@ -1415,7 +1418,7 @@ trappdu_print(const u_char *np, u_int length)
|
||||
}
|
||||
generic = elem.data.integer;
|
||||
{
|
||||
char buf[10];
|
||||
char buf[20];
|
||||
printf(" %s", DECODE_GenericTrap(generic));
|
||||
}
|
||||
length -= count;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.13 2003/11/16 09:36:38 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-stp.c,v 1.13.2.1 2005/04/26 07:27:17 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -39,23 +39,23 @@ static void
|
||||
stp_print_config_bpdu(const u_char *p)
|
||||
{
|
||||
printf("config ");
|
||||
if (p[7] & 1)
|
||||
if (p[4] & 1)
|
||||
printf("TOP_CHANGE ");
|
||||
if (p[7] & 0x80)
|
||||
if (p[4] & 0x80)
|
||||
printf("TOP_CHANGE_ACK ");
|
||||
|
||||
stp_print_bridge_id(p+20);
|
||||
printf(".%.2x%.2x ", p[28], p[29]);
|
||||
stp_print_bridge_id(p+17);
|
||||
printf(".%.2x%.2x ", p[25], p[26]);
|
||||
|
||||
printf("root ");
|
||||
stp_print_bridge_id(p+8);
|
||||
stp_print_bridge_id(p+5);
|
||||
|
||||
printf(" pathcost %i ", (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
|
||||
printf(" pathcost %i ", (p[13] << 24) | (p[14] << 16) | (p[15] << 8) | p[16]);
|
||||
|
||||
printf("age %i ", p[30]);
|
||||
printf("max %i ", p[32]);
|
||||
printf("hello %i ", p[34]);
|
||||
printf("fdelay %i ", p[36]);
|
||||
printf("age %i ", p[27]);
|
||||
printf("max %i ", p[29]);
|
||||
printf("hello %i ", p[31]);
|
||||
printf("fdelay %i ", p[33]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -70,16 +70,16 @@ stp_print_tcn_bpdu(void)
|
||||
void
|
||||
stp_print(const u_char *p, u_int length)
|
||||
{
|
||||
if (length < 7)
|
||||
if (length < 4)
|
||||
goto trunc;
|
||||
|
||||
printf("802.1d ");
|
||||
if (p[2] != 0x03 || p[3] || p[4] || p[5]) {
|
||||
if (p[0] || p[1] || p[2]) {
|
||||
printf("unknown version");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (p[6])
|
||||
switch (p[3])
|
||||
{
|
||||
case 0x00:
|
||||
if (length < 10)
|
||||
@ -92,7 +92,7 @@ stp_print(const u_char *p, u_int length)
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("unknown type %i", p[6]);
|
||||
printf("unknown type %i", p[3]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.46 2004/12/27 00:41:31 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.46.2.1 2005/04/27 21:44:06 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -54,13 +54,13 @@ static const char rcsid[] _U_ =
|
||||
#include "pmap_prot.h"
|
||||
|
||||
static struct tok proc2str[] = {
|
||||
{ PMAPPROC_NULL, "null" },
|
||||
{ PMAPPROC_SET, "set" },
|
||||
{ PMAPPROC_UNSET, "unset" },
|
||||
{ PMAPPROC_GETPORT, "getport" },
|
||||
{ PMAPPROC_DUMP, "dump" },
|
||||
{ PMAPPROC_CALLIT, "call" },
|
||||
{ 0, NULL }
|
||||
{ SUNRPC_PMAPPROC_NULL, "null" },
|
||||
{ SUNRPC_PMAPPROC_SET, "set" },
|
||||
{ SUNRPC_PMAPPROC_UNSET, "unset" },
|
||||
{ SUNRPC_PMAPPROC_GETPORT, "getport" },
|
||||
{ SUNRPC_PMAPPROC_DUMP, "dump" },
|
||||
{ SUNRPC_PMAPPROC_CALLIT, "call" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* Forwards */
|
||||
@ -87,7 +87,7 @@ sunrpcrequest_print(register const u_char *bp, register u_int length,
|
||||
} else {
|
||||
snprintf(srcid, sizeof(srcid), "0x%x",
|
||||
EXTRACT_32BITS(&rp->rm_xid));
|
||||
snprintf(dstid, sizeof(dstid), "0x%x", PMAPPORT);
|
||||
snprintf(dstid, sizeof(dstid), "0x%x", SUNRPC_PMAPPORT);
|
||||
}
|
||||
|
||||
switch (IP_V((struct ip *)bp2)) {
|
||||
@ -118,10 +118,10 @@ sunrpcrequest_print(register const u_char *bp, register u_int length,
|
||||
|
||||
switch (EXTRACT_32BITS(&rp->rm_call.cb_proc)) {
|
||||
|
||||
case PMAPPROC_SET:
|
||||
case PMAPPROC_UNSET:
|
||||
case PMAPPROC_GETPORT:
|
||||
case PMAPPROC_CALLIT:
|
||||
case SUNRPC_PMAPPROC_SET:
|
||||
case SUNRPC_PMAPPROC_UNSET:
|
||||
case SUNRPC_PMAPPROC_GETPORT:
|
||||
case SUNRPC_PMAPPROC_CALLIT:
|
||||
x = EXTRACT_32BITS(&rp->rm_call.cb_prog);
|
||||
if (!nflag)
|
||||
printf(" %s", progstr(x));
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.120 2005/04/06 18:53:56 mcr Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.120.2.2 2005/04/21 06:36:05 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -520,14 +520,13 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
break;
|
||||
|
||||
case TCPOPT_SACK:
|
||||
(void)printf("sack");
|
||||
datalen = len - 2;
|
||||
if (datalen % 8 != 0) {
|
||||
(void)printf(" malformed sack ");
|
||||
(void)printf("malformed sack");
|
||||
} else {
|
||||
u_int32_t s, e;
|
||||
|
||||
(void)printf(" sack %d ", datalen / 8);
|
||||
(void)printf("sack %d ", datalen / 8);
|
||||
for (i = 0; i < datalen; i += 8) {
|
||||
LENCHECK(i + 4);
|
||||
s = EXTRACT_32BITS(cp + i);
|
||||
@ -542,7 +541,6 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
}
|
||||
(void)printf("{%u:%u}", s, e);
|
||||
}
|
||||
(void)printf(" ");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -738,7 +736,7 @@ tcp_verify_signature(const struct ip *ip, const struct tcphdr *tp,
|
||||
const u_char *data, int length, const u_char *rcvsig)
|
||||
{
|
||||
struct tcphdr tp1;
|
||||
char sig[TCP_SIGLEN];
|
||||
u_char sig[TCP_SIGLEN];
|
||||
char zero_proto = 0;
|
||||
MD5_CTX ctx;
|
||||
u_int16_t savecsum, tlen;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-vrrp.c,v 1.9 2003/11/16 09:36:41 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-vrrp.c,v 1.9.2.1 2005/05/06 07:57:20 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -128,7 +128,10 @@ vrrp_print(register const u_char *bp, register u_int len, int ttl)
|
||||
if (auth_type == VRRP_AUTH_SIMPLE) { /* simple text password */
|
||||
TCHECK(bp[7]);
|
||||
printf(" auth \"");
|
||||
fn_printn(bp, 8, NULL);
|
||||
if (fn_printn(bp, 8, snapend)) {
|
||||
printf("\"");
|
||||
goto trunc;
|
||||
}
|
||||
printf("\"");
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
/*
|
||||
* Decode and print Zephyr packets.
|
||||
*
|
||||
* http://web.mit.edu/zephyr/doc/protocol
|
||||
*
|
||||
* Copyright (c) 2001 Nickolai Zeldovich <kolya@MIT.EDU>
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -20,7 +22,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.8 2003/11/16 09:36:42 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.8.2.1 2005/04/21 06:51:24 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/rpc_auth.h,v 1.1 2004/12/27 00:41:32 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/rpc_auth.h,v 1.1.2.1 2005/04/27 21:44:07 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
@ -42,9 +42,6 @@
|
||||
* "sessions".
|
||||
*/
|
||||
|
||||
#ifndef __RPC_AUTH_H_
|
||||
#define __RPC_AUTH_H_
|
||||
|
||||
/*
|
||||
* Status returned from authentication check
|
||||
*/
|
||||
@ -80,5 +77,3 @@ struct sunrpc_opaque_auth {
|
||||
#define SUNRPC_AUTH_SYS 1 /* forward compatibility */
|
||||
#define SUNRPC_AUTH_SHORT 2 /* short hand unix style */
|
||||
#define SUNRPC_AUTH_DES 3 /* des style (encrypted timestamps) */
|
||||
|
||||
#endif /* !__RPC_AUTH_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/rpc_msg.h,v 1.1 2004/12/27 00:41:32 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/rpc_msg.h,v 1.1.2.1 2005/04/27 21:44:07 guy Exp $ (LBL) */
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
* unrestricted use provided that this legend is included on all tape
|
||||
@ -39,9 +39,6 @@
|
||||
* Copyright (C) 1984, Sun Microsystems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __RPC_MSG_H_
|
||||
#define __RPC_MSG_H_
|
||||
|
||||
#define SUNRPC_MSG_VERSION ((u_int32_t) 2)
|
||||
|
||||
/*
|
||||
@ -129,5 +126,3 @@ struct sunrpc_msg {
|
||||
};
|
||||
#define acpted_rply ru.RM_rmb.ru.RP_ar
|
||||
#define rjcted_rply ru.RM_rmb.ru.RP_dr
|
||||
|
||||
#endif /* !__RPC_MSG_H_ */
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.36 2005/01/29 10:37:02 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.36.2.1 2005/04/21 04:09:58 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
@ -428,7 +428,6 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf,
|
||||
{
|
||||
int reverse = 0;
|
||||
const char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
|
||||
int len;
|
||||
|
||||
while (*fmt && buf<maxbuf) {
|
||||
switch (*fmt) {
|
||||
@ -608,6 +607,8 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf,
|
||||
{
|
||||
/*XXX unistr() */
|
||||
const char *s;
|
||||
u_int32_t len;
|
||||
|
||||
len = 0;
|
||||
s = unistr(buf, &len, (*fmt == 'R') ? 0 : unicodestr);
|
||||
if (s == NULL)
|
||||
@ -621,6 +622,8 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf,
|
||||
case 'Y': /* like 'Z', but always ASCII */
|
||||
{
|
||||
const char *s;
|
||||
u_int32_t len;
|
||||
|
||||
TCHECK(*buf);
|
||||
if (*buf != 4 && *buf != 2) {
|
||||
printf("Error! ASCIIZ buffer of type %u", *buf);
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12 2005/03/27 01:35:45 guy Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12.2.3 2005/05/04 19:20:20 risso Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -55,6 +55,20 @@
|
||||
#include <sys/types.h>
|
||||
#include <net/netdb.h> /* in wpcap's Win32/include */
|
||||
|
||||
#if !defined(__MINGW32__) && !defined(__WATCOMC__)
|
||||
#undef toascii
|
||||
#define isascii __isascii
|
||||
#define toascii __toascii
|
||||
#define stat _stat
|
||||
#define open _open
|
||||
#define fstat _fstat
|
||||
#define read _read
|
||||
#define close _close
|
||||
#define O_RDONLY _O_RDONLY
|
||||
|
||||
typedef short ino_t;
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
@ -89,8 +103,15 @@ typedef char* caddr_t;
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#ifdef INTTYPES_H_DEFINES_FORMATS
|
||||
#if HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h>
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h> /* concession to AIX */
|
||||
@ -122,7 +143,7 @@ typedef char* caddr_t;
|
||||
#define FOPEN_WRITE_BIN FOPEN_WRITE_TXT
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
#if defined(__GNUC__) && defined(__i386__) && !defined(__ntohl)
|
||||
#undef ntohl
|
||||
#undef ntohs
|
||||
#undef htonl
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167 2004/12/28 22:31:25 guy Exp $ (LBL)
|
||||
.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167.2.4 2005/05/02 21:27:34 guy Exp $ (LBL)
|
||||
.\"
|
||||
.\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $
|
||||
.\"
|
||||
@ -22,7 +22,7 @@
|
||||
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.\"
|
||||
.TH TCPDUMP 1 "22 March 2004"
|
||||
.TH TCPDUMP 1 "18 April 2005"
|
||||
.SH NAME
|
||||
tcpdump \- dump traffic on a network
|
||||
.SH SYNOPSIS
|
||||
@ -596,10 +596,11 @@ different kinds of qualifier:
|
||||
qualifiers say what kind of thing the id name or number refers to.
|
||||
Possible types are
|
||||
.BR host ,
|
||||
.B net
|
||||
.B net ,
|
||||
.B port
|
||||
and
|
||||
.BR port .
|
||||
E.g., `host foo', `net 128.3', `port 20'.
|
||||
.BR portrange .
|
||||
E.g., `host foo', `net 128.3', `port 20', `portrange 6000-6008'.
|
||||
If there is no type
|
||||
qualifier,
|
||||
.B host
|
||||
@ -641,7 +642,8 @@ protos are:
|
||||
.B tcp
|
||||
and
|
||||
.BR udp .
|
||||
E.g., `ether src foo', `arp net 128.3', `tcp port 21'.
|
||||
E.g., `ether src foo', `arp net 128.3', `tcp port 21', `udp portrange
|
||||
7000-7009'.
|
||||
If there is
|
||||
no proto qualifier, all protocols consistent with the type are
|
||||
assumed.
|
||||
@ -693,6 +695,7 @@ which may be either an address or a name.
|
||||
True if the IPv4/v6 source field of the packet is \fIhost\fP.
|
||||
.IP "\fBhost \fIhost\fP
|
||||
True if either the IPv4/v6 source or destination of the packet is \fIhost\fP.
|
||||
.IP
|
||||
Any of the above host expressions can be prepended with the keywords,
|
||||
\fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:
|
||||
.in +.5i
|
||||
@ -747,7 +750,7 @@ number of \fInet\fP.
|
||||
True if either the IPv4/v6 source or destination address of the packet has a network
|
||||
number of \fInet\fP.
|
||||
.IP "\fBnet \fInet\fR \fBmask \fInetmask\fR"
|
||||
True if the IP address matches \fInet\fR with the specific \fInetmask\fR.
|
||||
True if the IPv4 address matches \fInet\fR with the specific \fInetmask\fR.
|
||||
May be qualified with \fBsrc\fR or \fBdst\fR.
|
||||
Note that this syntax is not valid for IPv6 \fInet\fR.
|
||||
.IP "\fBnet \fInet\fR/\fIlen\fR"
|
||||
@ -771,8 +774,25 @@ both tcp/domain and udp/domain traffic).
|
||||
True if the packet has a source port value of \fIport\fP.
|
||||
.IP "\fBport \fIport\fR"
|
||||
True if either the source or destination port of the packet is \fIport\fP.
|
||||
Any of the above port expressions can be prepended with the keywords,
|
||||
\fBtcp\fP or \fBudp\fP, as in:
|
||||
.IP "\fBdst portrange \fIport1\fB-\fIport2\fR"
|
||||
True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has a
|
||||
destination port value between \fIport1\fP and \fIport2\fP.
|
||||
.I port1
|
||||
and
|
||||
.I port2
|
||||
are interpreted in the same fashion as the
|
||||
.I port
|
||||
parameter for
|
||||
.BR port .
|
||||
.IP "\fBsrc portrange \fIport1\fB-\fIport2\fR"
|
||||
True if the packet has a source port value between \fIport1\fP and
|
||||
\fIport2\fP.
|
||||
.IP "\fBportrange \fIport1\fB-\fIport2\fR"
|
||||
True if either the source or destination port of the packet is between
|
||||
\fIport1\fP and \fIport2\fP.
|
||||
.IP
|
||||
Any of the above port or port range expressions can be prepended with
|
||||
the keywords, \fBtcp\fP or \fBudp\fP, as in:
|
||||
.in +.5i
|
||||
.nf
|
||||
\fBtcp src port \fIport\fR
|
||||
@ -796,7 +816,7 @@ This is equivalent to:
|
||||
.fi
|
||||
.in -.5i
|
||||
.IP "\fBip proto \fIprotocol\fR"
|
||||
True if the packet is an IP packet (see
|
||||
True if the packet is an IPv4 packet (see
|
||||
.IR ip (4P))
|
||||
of protocol type \fIprotocol\fP.
|
||||
\fIProtocol\fP can be a number or one of the names
|
||||
@ -848,7 +868,7 @@ The \fBether\fP
|
||||
keyword is optional.
|
||||
This is shorthand for `\fBether[0] & 1 != 0\fP'.
|
||||
.IP "\fBip multicast\fR"
|
||||
True if the packet is an IP multicast packet.
|
||||
True if the packet is an IPv4 multicast packet.
|
||||
.IP "\fBip6 multicast\fR"
|
||||
True if the packet is an IPv6 multicast packet.
|
||||
.IP "\fBether proto \fIprotocol\fR"
|
||||
@ -998,6 +1018,15 @@ If \fI[vlan_id]\fR is specified, only true is the packet has the specified
|
||||
Note that the first \fBvlan\fR keyword encountered in \fIexpression\fR
|
||||
changes the decoding offsets for the remainder of \fIexpression\fR
|
||||
on the assumption that the packet is a VLAN packet.
|
||||
the \fI[vlan_id]\fR statement may be used more than once, to filter on vlan hierarchies.
|
||||
each use of the \fI[vlan_id]\fR \fIexpression\fR increments the filter offsets by 4.
|
||||
.fi
|
||||
example(s):
|
||||
.fi
|
||||
"vlan 100 && vlan 200" filters on vlan 200 encapsulated within vlan 100
|
||||
.fi
|
||||
"vlan && vlan 300 && ip" filters IPv4 protocols encapsulated in vlan 300 encapsulated within any higher order vlan
|
||||
.fi
|
||||
.IP "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"
|
||||
Abbreviations for:
|
||||
.in +.5i
|
||||
@ -1087,10 +1116,11 @@ data inside the packet, use the following syntax:
|
||||
.fi
|
||||
.in -.5i
|
||||
\fIProto\fR is one of \fBether, fddi, tr, wlan, ppp, slip, link,
|
||||
ip, arp, rarp, tcp, udp, icmp\fR or \fBip6\fR, and
|
||||
ip, arp, rarp, tcp, udp, icmp, ip6\fR or \fBradio\fR, and
|
||||
indicates the protocol layer for the index operation.
|
||||
(\fBether, fddi, wlan, tr, ppp, slip\fR and \fBlink\fR all refer to the
|
||||
link layer.)
|
||||
link layer. \fBradio\fR refers to the "radio header" added to some
|
||||
802.11 captures.)
|
||||
Note that \fItcp, udp\fR and other upper-layer protocol types only
|
||||
apply to IPv4, not IPv6 (this will be fixed in the future).
|
||||
The byte offset, relative to the indicated protocol layer, is
|
||||
@ -1102,10 +1132,11 @@ length of the packet.
|
||||
|
||||
For example, `\fBether[0] & 1 != 0\fP' catches all multicast traffic.
|
||||
The expression `\fBip[0] & 0xf != 5\fP'
|
||||
catches all IP packets with options.
|
||||
catches all IPv4 packets with options.
|
||||
The expression
|
||||
`\fBip[6:2] & 0x1fff = 0\fP'
|
||||
catches only unfragmented datagrams and frag zero of fragmented datagrams.
|
||||
catches only unfragmented IPv4 datagrams and frag zero of fragmented
|
||||
IPv4 datagrams.
|
||||
This check is implicitly applied to the \fBtcp\fP and \fBudp\fP
|
||||
index operations.
|
||||
For instance, \fBtcp[0]\fP always means the first
|
||||
|
@ -30,7 +30,7 @@ static const char copyright[] _U_ =
|
||||
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253 2005/01/27 18:30:36 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253.2.8 2005/07/05 21:09:05 mcr Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -226,11 +226,32 @@ static struct printer printers[] = {
|
||||
#ifdef DLT_JUNIPER_ATM2
|
||||
{ juniper_atm2_print, DLT_JUNIPER_ATM2 },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MFR
|
||||
{ juniper_mfr_print, DLT_JUNIPER_MFR },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MLFR
|
||||
{ juniper_mlfr_print, DLT_JUNIPER_MLFR },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MLPPP
|
||||
{ juniper_mlppp_print, DLT_JUNIPER_MLPPP },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_PPPOE
|
||||
{ juniper_pppoe_print, DLT_JUNIPER_PPPOE },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_PPPOE_ATM
|
||||
{ juniper_pppoe_atm_print, DLT_JUNIPER_PPPOE_ATM },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_GGSN
|
||||
{ juniper_ggsn_print, DLT_JUNIPER_GGSN },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_ES
|
||||
{ juniper_es_print, DLT_JUNIPER_ES },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_MONITOR
|
||||
{ juniper_monitor_print, DLT_JUNIPER_MONITOR },
|
||||
#endif
|
||||
#ifdef DLT_JUNIPER_SERVICES
|
||||
{ juniper_services_print, DLT_JUNIPER_SERVICES },
|
||||
#endif
|
||||
{ NULL, 0 },
|
||||
};
|
||||
@ -1130,7 +1151,7 @@ dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *s
|
||||
* larger than Cflag - the last packet written to the
|
||||
* file could put it over Cflag.
|
||||
*/
|
||||
if (ftell((FILE *)dump_info->p) > Cflag) {
|
||||
if (pcap_dump_ftell(dump_info->p) > Cflag) {
|
||||
/*
|
||||
* Close the current file and open a new one.
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.95 2005/03/21 11:35:55 hannes Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.95.2.5 2005/06/16 01:19:57 guy Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -45,7 +45,7 @@ static const char rcsid[] _U_ =
|
||||
#include "interface.h"
|
||||
|
||||
/*
|
||||
* Print out a filename (or other ascii string).
|
||||
* Print out a null-terminated filename (or other ascii string).
|
||||
* If ep is NULL, assume no truncation check is needed.
|
||||
* Return true if truncated.
|
||||
*/
|
||||
@ -104,6 +104,40 @@ fn_printn(register const u_char *s, register u_int n,
|
||||
return (n == 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out a null-padded filename (or other ascii string).
|
||||
* If ep is NULL, assume no truncation check is needed.
|
||||
* Return true if truncated.
|
||||
*/
|
||||
int
|
||||
fn_printzp(register const u_char *s, register u_int n,
|
||||
register const u_char *ep)
|
||||
{
|
||||
register int ret;
|
||||
register u_char c;
|
||||
|
||||
ret = 1; /* assume truncated */
|
||||
while (n > 0 && (ep == NULL || s < ep)) {
|
||||
n--;
|
||||
c = *s++;
|
||||
if (c == '\0') {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (!isascii(c)) {
|
||||
c = toascii(c);
|
||||
putchar('M');
|
||||
putchar('-');
|
||||
}
|
||||
if (!isprint(c)) {
|
||||
c ^= 0x40; /* DEL to ?, others to alpha */
|
||||
putchar('^');
|
||||
}
|
||||
putchar(c);
|
||||
}
|
||||
return (n == 0) ? 0 : ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the timestamp
|
||||
*/
|
||||
@ -208,6 +242,18 @@ relts_print(int secs)
|
||||
int
|
||||
print_unknown_data(const u_char *cp,const char *ident,int len)
|
||||
{
|
||||
if (len < 0) {
|
||||
printf("%sDissector error: print_unknown_data called with negative length",
|
||||
ident);
|
||||
return(0);
|
||||
}
|
||||
if (snapend - cp < len)
|
||||
len = snapend - cp;
|
||||
if (len < 0) {
|
||||
printf("%sDissector error: print_unknown_data called with pointer past end of packet",
|
||||
ident);
|
||||
return(0);
|
||||
}
|
||||
hex_print(ident,cp,len);
|
||||
return(1); /* everything is ok */
|
||||
}
|
||||
@ -219,10 +265,12 @@ const char *
|
||||
tok2strbuf(register const struct tok *lp, register const char *fmt,
|
||||
register int v, char *buf, size_t bufsize)
|
||||
{
|
||||
while (lp->s != NULL && lp != NULL) {
|
||||
if (lp->v == v)
|
||||
return (lp->s);
|
||||
++lp;
|
||||
if (lp != NULL) {
|
||||
while (lp->s != NULL) {
|
||||
if (lp->v == v)
|
||||
return (lp->s);
|
||||
++lp;
|
||||
}
|
||||
}
|
||||
if (fmt == NULL)
|
||||
fmt = "#%d";
|
||||
|
Loading…
Reference in New Issue
Block a user