summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2007-10-16 02:31:48 +0000
committermlaier <mlaier@FreeBSD.org>2007-10-16 02:31:48 +0000
commit7407d685ab0d1977958bae143bdcc3b53dacea31 (patch)
tree8c8221dcf086879544da49d1342bacd303933fa6 /contrib/tcpdump
parentf0e5d335e38c264eb2fca7e15e417b70c8908f54 (diff)
downloadFreeBSD-src-7407d685ab0d1977958bae143bdcc3b53dacea31.zip
FreeBSD-src-7407d685ab0d1977958bae143bdcc3b53dacea31.tar.gz
Resolve merge conflicts
Approved by: re (kensmith) Obtained from: tcpdump.org
Diffstat (limited to 'contrib/tcpdump')
-rw-r--r--contrib/tcpdump/addrtoname.c8
-rw-r--r--contrib/tcpdump/ieee802_11.h56
-rw-r--r--contrib/tcpdump/ieee802_11_radio.h14
-rw-r--r--contrib/tcpdump/interface.h11
-rw-r--r--contrib/tcpdump/parsenfsfh.c30
-rw-r--r--contrib/tcpdump/pf.h77
-rw-r--r--contrib/tcpdump/print-802_11.c298
-rw-r--r--contrib/tcpdump/print-atm.c39
-rw-r--r--contrib/tcpdump/print-bootp.c405
-rw-r--r--contrib/tcpdump/print-domain.c66
-rw-r--r--contrib/tcpdump/print-ether.c20
-rw-r--r--contrib/tcpdump/print-fddi.c3
-rw-r--r--contrib/tcpdump/print-fr.c26
-rw-r--r--contrib/tcpdump/print-icmp.c116
-rw-r--r--contrib/tcpdump/print-ip.c71
-rw-r--r--contrib/tcpdump/print-ip6.c6
-rw-r--r--contrib/tcpdump/print-isoclns.c52
-rw-r--r--contrib/tcpdump/print-llc.c49
-rw-r--r--contrib/tcpdump/print-nfs.c90
-rw-r--r--contrib/tcpdump/print-null.c45
-rw-r--r--contrib/tcpdump/print-pim.c57
-rw-r--r--contrib/tcpdump/print-ppp.c81
-rw-r--r--contrib/tcpdump/print-token.c3
-rw-r--r--contrib/tcpdump/print-udp.c4
-rw-r--r--contrib/tcpdump/tcpdump-stdinc.h11
-rw-r--r--contrib/tcpdump/tcpdump.142
-rw-r--r--contrib/tcpdump/tcpdump.c7
27 files changed, 1130 insertions, 557 deletions
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c
index d2e7b48..db9a93c 100644
--- a/contrib/tcpdump/addrtoname.c
+++ b/contrib/tcpdump/addrtoname.c
@@ -25,7 +25,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.7 2005/09/29 07:46:45 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/addrtoname.c,v 1.108.2.9 2007/09/14 00:26:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -70,6 +70,10 @@ extern int ether_ntohost(char *, const struct ether_addr *);
#include "extract.h"
#include "oui.h"
+#ifndef ETHER_ADDR_LEN
+#define ETHER_ADDR_LEN 6
+#endif
+
/*
* hash tables for whatever-to-name translations
*
@@ -513,7 +517,7 @@ linkaddr_string(const u_char *ep, const unsigned int len)
register char *cp;
register struct enamemem *tp;
- if (len == 6) /* XXX not totally correct... */
+ if (len == ETHER_ADDR_LEN) /* XXX not totally correct... */
return etheraddr_string(ep);
tp = lookup_bytestring(ep, len);
diff --git a/contrib/tcpdump/ieee802_11.h b/contrib/tcpdump/ieee802_11.h
index 7d5c7fc..d98f979 100644
--- a/contrib/tcpdump/ieee802_11.h
+++ b/contrib/tcpdump/ieee802_11.h
@@ -1,5 +1,5 @@
/* $FreeBSD$ */
-/* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.9 2003/07/22 17:36:57 guy Exp $ (LBL) */
+/* @(#) $Header: /tcpdump/master/tcpdump/ieee802_11.h,v 1.9.4.3 2007/07/22 20:01:16 guy Exp $ (LBL) */
/*
* Copyright (c) 2001
* Fortress Technologies
@@ -82,14 +82,32 @@
#define CTRL_CF_END 0xE
#define CTRL_END_ACK 0xF
-#define DATA_DATA 0x0
-#define DATA_DATA_CF_ACK 0x1
-#define DATA_DATA_CF_POLL 0x2
-#define DATA_DATA_CF_ACK_POLL 0x3
-#define DATA_NODATA 0x4
-#define DATA_NODATA_CF_ACK 0x5
-#define DATA_NODATA_CF_POLL 0x6
-#define DATA_NODATA_CF_ACK_POLL 0x7
+#define DATA_DATA 0x0
+#define DATA_DATA_CF_ACK 0x1
+#define DATA_DATA_CF_POLL 0x2
+#define DATA_DATA_CF_ACK_POLL 0x3
+#define DATA_NODATA 0x4
+#define DATA_NODATA_CF_ACK 0x5
+#define DATA_NODATA_CF_POLL 0x6
+#define DATA_NODATA_CF_ACK_POLL 0x7
+
+#define DATA_QOS_DATA 0x8
+#define DATA_QOS_DATA_CF_ACK 0x9
+#define DATA_QOS_DATA_CF_POLL 0xA
+#define DATA_QOS_DATA_CF_ACK_POLL 0xB
+#define DATA_QOS_NODATA 0xC
+#define DATA_QOS_CF_POLL_NODATA 0xE
+#define DATA_QOS_CF_ACK_POLL_NODATA 0xF
+
+/*
+ * The subtype field of a data frame is, in effect, composed of 4 flag
+ * bits - CF-Ack, CF-Poll, Null (means the frame doesn't actually have
+ * any data), and QoS.
+ */
+#define DATA_FRAME_IS_CF_ACK(x) ((x) & 0x01)
+#define DATA_FRAME_IS_CF_POLL(x) ((x) & 0x02)
+#define DATA_FRAME_IS_NULL(x) ((x) & 0x04)
+#define DATA_FRAME_IS_QOS(x) ((x) & 0x08)
/*
* Bits in the frame control field.
@@ -125,6 +143,12 @@ struct mgmt_header_t {
#define CAPABILITY_CFP_REQ(cap) ((cap) & 0x0008)
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
+typedef enum {
+ NOT_PRESENT,
+ PRESENT,
+ TRUNCATED
+} elem_status_t;
+
struct ssid_t {
u_int8_t element_id;
u_int8_t length;
@@ -134,7 +158,7 @@ struct ssid_t {
struct rates_t {
u_int8_t element_id;
u_int8_t length;
- u_int8_t rate[8];
+ u_int8_t rate[16];
};
struct challenge_t {
@@ -142,6 +166,7 @@ struct challenge_t {
u_int8_t length;
u_int8_t text[254]; /* 1-253 + 1 for null */
};
+
struct fh_t {
u_int8_t element_id;
u_int8_t length;
@@ -202,22 +227,29 @@ struct tim_t {
struct mgmt_body_t {
- u_int8_t timestamp[8];
+ u_int8_t timestamp[IEEE802_11_TSTAMP_LEN];
u_int16_t beacon_interval;
u_int16_t listen_interval;
u_int16_t status_code;
u_int16_t aid;
- u_char ap[6];
+ u_char ap[IEEE802_11_AP_LEN];
u_int16_t reason_code;
u_int16_t auth_alg;
u_int16_t auth_trans_seq_num;
+ elem_status_t challenge_status;
struct challenge_t challenge;
u_int16_t capability_info;
+ elem_status_t ssid_status;
struct ssid_t ssid;
+ elem_status_t rates_status;
struct rates_t rates;
+ elem_status_t ds_status;
struct ds_t ds;
+ elem_status_t cf_status;
struct cf_t cf;
+ elem_status_t fh_status;
struct fh_t fh;
+ elem_status_t tim_status;
struct tim_t tim;
};
diff --git a/contrib/tcpdump/ieee802_11_radio.h b/contrib/tcpdump/ieee802_11_radio.h
index a2b2f16..82eb97b 100644
--- a/contrib/tcpdump/ieee802_11_radio.h
+++ b/contrib/tcpdump/ieee802_11_radio.h
@@ -1,6 +1,6 @@
/* $FreeBSD$ */
-/* $NetBSD: ieee80211_radiotap.h,v 1.3 2003/11/16 09:02:42 dyoung Exp $ */
-/* $Header: /tcpdump/master/tcpdump/ieee802_11_radio.h,v 1.1 2004/09/23 21:33:10 dyoung Exp $ */
+/* $NetBSD: ieee802_11_radio.h,v 1.2 2006/02/26 03:04:03 dyoung Exp $ */
+/* $Header: /tcpdump/master/tcpdump/ieee802_11_radio.h,v 1.1.2.1 2006/06/13 22:24:45 guy Exp $ */
/*-
* Copyright (c) 2003, 2004 David Young. All rights reserved.
@@ -47,11 +47,11 @@
* function of...") that I cannot set false expectations for lawyerly
* readers.
*/
-#ifdef _KERNEL
+#if defined(__KERNEL__) || defined(_KERNEL)
#ifndef DLT_IEEE802_11_RADIO
#define DLT_IEEE802_11_RADIO 127 /* 802.11 plus WLAN header */
#endif
-#endif /* _KERNEL */
+#endif /* defined(__KERNEL__) || defined(_KERNEL) */
/*
* The radio capture header precedes the 802.11 header.
@@ -127,7 +127,7 @@ struct ieee80211_radiotap_header {
* RF noise power at the antenna, decibel difference from an
* arbitrary, fixed reference point.
*
- * IEEE80211_RADIOTAP_BARKER_CODE_LOCK u_int16_t unitless
+ * IEEE80211_RADIOTAP_LOCK_QUALITY u_int16_t unitless
*
* Quality of Barker code lock. Unitless. Monotonically
* nondecreasing with "better" lock strength. Called "Signal
@@ -173,6 +173,10 @@ struct ieee80211_radiotap_header {
* finally the maximum regulatory transmit power cap in .5 dBm
* units. This property supersedes IEEE80211_RADIOTAP_CHANNEL
* and only one of the two should be present.
+ *
+ * IEEE80211_RADIOTAP_FCS u_int32_t data
+ *
+ * FCS from frame in network byte order.
*/
enum ieee80211_radiotap_type {
IEEE80211_RADIOTAP_TSFT = 0,
diff --git a/contrib/tcpdump/interface.h b/contrib/tcpdump/interface.h
index d26eb1c..302d2ea 100644
--- a/contrib/tcpdump/interface.h
+++ b/contrib/tcpdump/interface.h
@@ -18,9 +18,8 @@
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244.2.18 2005/09/29 07:46:45 hannes Exp $ (LBL)
* $FreeBSD$
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.244.2.21 2007/03/28 07:45:46 hannes Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
@@ -110,6 +109,10 @@ extern char *strsep(char **, const char *);
#endif
#endif
+#ifndef MIN
+#define MIN(a,b) ((a)<(b)?(a):(b))
+#endif
+
extern char *program_name; /* used to generate self-identifying messages */
extern int32_t thiszone; /* seconds offset from gmt to local time */
@@ -154,7 +157,7 @@ extern char *read_infile(char *);
extern char *copy_argv(char **);
extern void safeputchar(int);
-extern void safeputs(const char *);
+extern void safeputs(const char *, int);
extern const char *isonsap_string(const u_char *, register u_int);
extern const char *protoid_string(const u_char *);
@@ -204,6 +207,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 mfr_if_print(const struct pcap_pkthdr *, const u_char *);
extern u_int fr_print(register const u_char *, u_int);
extern u_int mfr_print(register const u_char *, u_int);
extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *);
@@ -228,6 +232,7 @@ extern void ns_print(const u_char *, u_int, int);
extern void ntp_print(const u_char *, u_int);
extern u_int null_if_print(const struct pcap_pkthdr *, const u_char *);
extern void ospf_print(const u_char *, u_int, const u_char *);
+extern void olsr_print (const u_char *, u_int);
extern void pimv1_print(const u_char *, u_int);
extern void cisco_autorp_print(const u_char *, u_int);
extern void rsvp_print(const u_char *, u_int);
diff --git a/contrib/tcpdump/parsenfsfh.c b/contrib/tcpdump/parsenfsfh.c
index 2e3da02..4aa8191 100644
--- a/contrib/tcpdump/parsenfsfh.c
+++ b/contrib/tcpdump/parsenfsfh.c
@@ -44,7 +44,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.28 2004/03/25 03:30:55 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/parsenfsfh.c,v 1.28.2.1 2007/06/15 19:15:04 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -81,6 +81,7 @@ static const char rcsid[] _U_ =
#define FHT_SUNOS5 9
#define FHT_AIX32 10
#define FHT_HPUX9 11
+#define FHT_BSD44 12
#ifdef ultrix
/* Nasty hack to keep the Ultrix C compiler from emitting bogus warnings */
@@ -148,6 +149,10 @@ int ourself; /* true if file handle was generated on this host */
#if defined(__osf__)
fhtype = FHT_DECOSF;
#endif
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \
+ || defined(__OpenBSD__)
+ fhtype = FHT_BSD44;
+#endif
}
/*
* This is basically a big decision tree
@@ -198,8 +203,11 @@ int ourself; /* true if file handle was generated on this host */
* could be Ultrix, IRIX5, AIX, or SUNOS5
* might be HP-UX (depends on their values for minor devs)
*/
+ if ((fhp[6] == 0) && (fhp[7] == 0)) {
+ fhtype = FHT_BSD44;
+ }
/*XXX we probably only need to test of these two bytes */
- if ((fhp[21] == 0) && (fhp[23] == 0)) {
+ else if ((fhp[21] == 0) && (fhp[23] == 0)) {
fhtype = FHT_ULTRIX;
}
else {
@@ -265,6 +273,18 @@ int ourself; /* true if file handle was generated on this host */
*osnamep = "Auspex";
break;
+ case FHT_BSD44:
+ fsidp->Fsid_dev.Minor = fhp[0];
+ fsidp->Fsid_dev.Major = fhp[1];
+ fsidp->fsid_code = 0;
+
+ temp = make_uint32(fhp[15], fhp[14], fhp[13], fhp[12]);
+ *inop = temp;
+
+ if (osnamep)
+ *osnamep = "BSD 4.4";
+ break;
+
case FHT_DECOSF:
fsidp->fsid_code = make_uint32(fhp[7], fhp[6], fhp[5], fhp[4]);
/* XXX could ignore 3 high-order bytes */
@@ -303,10 +323,16 @@ int ourself; /* true if file handle was generated on this host */
*osnamep = "IRIX5";
break;
+#ifdef notdef
case FHT_SUNOS3:
+ /*
+ * XXX - none of the heuristics above return this.
+ * Are there any SunOS 3.x systems around to care about?
+ */
if (osnamep)
*osnamep = "SUNOS3";
break;
+#endif
case FHT_SUNOS4:
fsidp->Fsid_dev.Minor = fhp[3];
diff --git a/contrib/tcpdump/pf.h b/contrib/tcpdump/pf.h
deleted file mode 100644
index c2d332a..0000000
--- a/contrib/tcpdump/pf.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2001 Daniel Hartmeier
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @(#) $Header: /tcpdump/master/tcpdump/pf.h,v 1.2 2004/04/02 06:36:25 guy Exp $ (LBL)
- */
-
-/* from $OpenBSD: pfvar.h,v 1.170 2003/08/22 21:50:34 david Exp $ */
-
-enum { PF_INOUT=0, PF_IN=1, PF_OUT=2 };
-enum { PF_PASS=0, PF_DROP=1, PF_SCRUB=2, PF_NAT=3, PF_NONAT=4,
- PF_BINAT=5, PF_NOBINAT=6, PF_RDR=7, PF_NORDR=8, PF_SYNPROXY_DROP=9 };
-
-/* Reasons code for passing/dropping a packet */
-#define PFRES_MATCH 0 /* Explicit match of a rule */
-#define PFRES_BADOFF 1 /* Bad offset for pull_hdr */
-#define PFRES_FRAG 2 /* Dropping following fragment */
-#define PFRES_SHORT 3 /* Dropping short packet */
-#define PFRES_NORM 4 /* Dropping by normalizer */
-#define PFRES_MEMORY 5 /* Dropped due to lacking mem */
-#define PFRES_MAX 6 /* total+1 */
-
-#define PFRES_NAMES { \
- "match", \
- "bad-offset", \
- "fragment", \
- "short", \
- "normalize", \
- "memory", \
- NULL \
-}
-
-#define PF_RULESET_NAME_SIZE 16
-
-/* from $OpenBSD: if_pflog.h,v 1.9 2003/07/15 20:27:27 dhartmei Exp $ */
-
-#ifndef IFNAMSIZ
-#define IFNAMSIZ 16
-#endif
-
-struct pfloghdr {
- u_int8_t length;
- u_int8_t af;
- u_int8_t action;
- u_int8_t reason;
- char ifname[IFNAMSIZ];
- char ruleset[PF_RULESET_NAME_SIZE];
- u_int32_t rulenr;
- u_int32_t subrulenr;
- u_int8_t dir;
- u_int8_t pad[3];
-};
-#define PFLOG_HDRLEN sizeof(struct pfloghdr)
diff --git a/contrib/tcpdump/print-802_11.c b/contrib/tcpdump/print-802_11.c
index 4ce21ec..1046fda 100644
--- a/contrib/tcpdump/print-802_11.c
+++ b/contrib/tcpdump/print-802_11.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.5 2005/07/30 21:37:50 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.31.2.15 2007/07/22 23:14:14 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -47,20 +47,54 @@ static const char rcsid[] _U_ =
#include "ieee802_11.h"
#include "ieee802_11_radio.h"
+#define PRINT_SSID(p) \
+ switch (p.ssid_status) { \
+ case TRUNCATED: \
+ return 0; \
+ case PRESENT: \
+ printf(" ("); \
+ fn_print(p.ssid.ssid, NULL); \
+ printf(")"); \
+ break; \
+ case NOT_PRESENT: \
+ break; \
+ }
+
#define PRINT_RATE(_sep, _r, _suf) \
printf("%s%2.1f%s", _sep, (.5 * ((_r) & 0x7f)), _suf)
#define PRINT_RATES(p) \
-do { \
- int z; \
- const char *sep = " ["; \
- for (z = 0; z < p.rates.length ; z++) { \
- PRINT_RATE(sep, p.rates.rate[z], \
- (p.rates.rate[z] & 0x80 ? "*" : "")); \
- sep = " "; \
+ switch (p.rates_status) { \
+ case TRUNCATED: \
+ return 0; \
+ case PRESENT: \
+ do { \
+ int z; \
+ const char *sep = " ["; \
+ for (z = 0; z < p.rates.length ; z++) { \
+ PRINT_RATE(sep, p.rates.rate[z], \
+ (p.rates.rate[z] & 0x80 ? "*" : "")); \
+ sep = " "; \
+ } \
+ if (p.rates.length != 0) \
+ printf(" Mbit]"); \
+ } while (0); \
+ break; \
+ case NOT_PRESENT: \
+ break; \
+ }
+
+#define PRINT_DS_CHANNEL(p) \
+ switch (p.ds_status) { \
+ case TRUNCATED: \
+ return 0; \
+ case PRESENT: \
+ printf(" CH: %u", p.ds.channel); \
+ break; \
+ case NOT_PRESENT: \
+ break; \
} \
- if (p.rates.length != 0) \
- printf(" Mbit]"); \
-} while (0)
+ printf("%s", \
+ CAPABILITY_PRIVACY(p.capability_info) ? ", PRIVACY" : "" );
static const int ieee80211_htrates[16] = {
13, /* IFM_IEEE80211_MCS0 */
@@ -140,94 +174,141 @@ wep_print(const u_char *p)
return 1;
}
-static int
+static void
parse_elements(struct mgmt_body_t *pbody, const u_char *p, int offset)
{
+ /*
+ * We haven't seen any elements yet.
+ */
+ pbody->challenge_status = NOT_PRESENT;
+ pbody->ssid_status = NOT_PRESENT;
+ pbody->rates_status = NOT_PRESENT;
+ pbody->ds_status = NOT_PRESENT;
+ pbody->cf_status = NOT_PRESENT;
+ pbody->tim_status = NOT_PRESENT;
+
for (;;) {
if (!TTEST2(*(p + offset), 1))
- return 1;
+ return;
switch (*(p + offset)) {
case E_SSID:
+ /* Present, possibly truncated */
+ pbody->ssid_status = TRUNCATED;
if (!TTEST2(*(p + offset), 2))
- return 0;
+ return;
memcpy(&pbody->ssid, p + offset, 2);
offset += 2;
- if (pbody->ssid.length <= 0)
- break;
- if (!TTEST2(*(p + offset), pbody->ssid.length))
- return 0;
- memcpy(&pbody->ssid.ssid, p + offset,
- pbody->ssid.length);
- offset += pbody->ssid.length;
+ if (pbody->ssid.length != 0) {
+ if (pbody->ssid.length >
+ sizeof(pbody->ssid.ssid) - 1)
+ return;
+ if (!TTEST2(*(p + offset), pbody->ssid.length))
+ return;
+ memcpy(&pbody->ssid.ssid, p + offset,
+ pbody->ssid.length);
+ offset += pbody->ssid.length;
+ }
pbody->ssid.ssid[pbody->ssid.length] = '\0';
+ /* Present and not truncated */
+ pbody->ssid_status = PRESENT;
break;
case E_CHALLENGE:
+ /* Present, possibly truncated */
+ pbody->challenge_status = TRUNCATED;
if (!TTEST2(*(p + offset), 2))
- return 0;
+ return;
memcpy(&pbody->challenge, p + offset, 2);
offset += 2;
- if (pbody->challenge.length <= 0)
- break;
- if (!TTEST2(*(p + offset), pbody->challenge.length))
- return 0;
- memcpy(&pbody->challenge.text, p + offset,
- pbody->challenge.length);
- offset += pbody->challenge.length;
+ if (pbody->challenge.length != 0) {
+ if (pbody->challenge.length >
+ sizeof(pbody->challenge.text) - 1)
+ return;
+ if (!TTEST2(*(p + offset), pbody->challenge.length))
+ return;
+ memcpy(&pbody->challenge.text, p + offset,
+ pbody->challenge.length);
+ offset += pbody->challenge.length;
+ }
pbody->challenge.text[pbody->challenge.length] = '\0';
+ /* Present and not truncated */
+ pbody->challenge_status = PRESENT;
break;
case E_RATES:
+ /* Present, possibly truncated */
+ pbody->rates_status = TRUNCATED;
if (!TTEST2(*(p + offset), 2))
- return 0;
+ return;
memcpy(&(pbody->rates), p + offset, 2);
offset += 2;
- if (pbody->rates.length <= 0)
- break;
- if (!TTEST2(*(p + offset), pbody->rates.length))
- return 0;
- memcpy(&pbody->rates.rate, p + offset,
- pbody->rates.length);
- offset += pbody->rates.length;
+ if (pbody->rates.length != 0) {
+ if (pbody->rates.length > sizeof pbody->rates.rate)
+ return;
+ if (!TTEST2(*(p + offset), pbody->rates.length))
+ return;
+ memcpy(&pbody->rates.rate, p + offset,
+ pbody->rates.length);
+ offset += pbody->rates.length;
+ }
+ /* Present and not truncated */
+ pbody->rates_status = PRESENT;
break;
case E_DS:
+ /* Present, possibly truncated */
+ pbody->ds_status = TRUNCATED;
if (!TTEST2(*(p + offset), 3))
- return 0;
+ return;
memcpy(&pbody->ds, p + offset, 3);
offset += 3;
+ /* Present and not truncated */
+ pbody->ds_status = PRESENT;
break;
case E_CF:
+ /* Present, possibly truncated */
+ pbody->cf_status = TRUNCATED;
if (!TTEST2(*(p + offset), 8))
- return 0;
+ return;
memcpy(&pbody->cf, p + offset, 8);
offset += 8;
+ /* Present and not truncated */
+ pbody->cf_status = PRESENT;
break;
case E_TIM:
+ /* Present, possibly truncated */
+ pbody->tim_status = TRUNCATED;
if (!TTEST2(*(p + offset), 2))
- return 0;
+ return;
memcpy(&pbody->tim, p + offset, 2);
offset += 2;
if (!TTEST2(*(p + offset), 3))
- return 0;
+ return;
memcpy(&pbody->tim.count, p + offset, 3);
offset += 3;
if (pbody->tim.length <= 3)
break;
+ if (pbody->tim.length - 3 > sizeof pbody->tim.bitmap)
+ return;
if (!TTEST2(*(p + offset), pbody->tim.length - 3))
- return 0;
+ return;
memcpy(pbody->tim.bitmap, p + (pbody->tim.length - 3),
(pbody->tim.length - 3));
offset += pbody->tim.length - 3;
+ /* Present and not truncated */
+ pbody->tim_status = PRESENT;
break;
default:
#if 0
printf("(1) unhandled element_id (%d) ",
*(p + offset) );
#endif
+ if (!TTEST2(*(p + offset), 2))
+ return;
+ if (!TTEST2(*(p + offset + 2), *(p + offset + 1)))
+ return;
offset += *(p + offset + 1) + 2;
break;
}
}
- return 1;
}
/*********************************************************************************
@@ -245,24 +326,20 @@ handle_beacon(const u_char *p)
if (!TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
IEEE802_11_CAPINFO_LEN))
return 0;
- memcpy(&pbody.timestamp, p, 8);
+ memcpy(&pbody.timestamp, p, IEEE802_11_TSTAMP_LEN);
offset += IEEE802_11_TSTAMP_LEN;
pbody.beacon_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_BCNINT_LEN;
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
- printf(" (");
- fn_print(pbody.ssid.ssid, NULL);
- printf(")");
+ PRINT_SSID(pbody);
PRINT_RATES(pbody);
- printf(" %s CH: %u%s",
- CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS",
- pbody.ds.channel,
- CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
+ printf(" %s",
+ CAPABILITY_ESS(pbody.capability_info) ? "ESS" : "IBSS");
+ PRINT_DS_CHANNEL(pbody);
return 1;
}
@@ -282,12 +359,9 @@ handle_assoc_request(const u_char *p)
pbody.listen_interval = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_LISTENINT_LEN;
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
- printf(" (");
- fn_print(pbody.ssid.ssid, NULL);
- printf(")");
+ PRINT_SSID(pbody);
PRINT_RATES(pbody);
return 1;
}
@@ -310,8 +384,7 @@ handle_assoc_response(const u_char *p)
pbody.aid = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_AID_LEN;
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
printf(" AID(%x) :%s: %s", ((u_int16_t)(pbody.aid << 2 )) >> 2 ,
CAPABILITY_PRIVACY(pbody.capability_info) ? " PRIVACY " : "",
@@ -340,12 +413,10 @@ handle_reassoc_request(const u_char *p)
memcpy(&pbody.ap, p+offset, IEEE802_11_AP_LEN);
offset += IEEE802_11_AP_LEN;
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
- printf(" (");
- fn_print(pbody.ssid.ssid, NULL);
- printf(") AP : %s", etheraddr_string( pbody.ap ));
+ PRINT_SSID(pbody);
+ printf(" AP : %s", etheraddr_string( pbody.ap ));
return 1;
}
@@ -365,12 +436,9 @@ handle_probe_request(const u_char *p)
memset(&pbody, 0, sizeof(pbody));
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
- printf(" (");
- fn_print(pbody.ssid.ssid, NULL);
- printf(")");
+ PRINT_SSID(pbody);
PRINT_RATES(pbody);
return 1;
@@ -395,15 +463,11 @@ handle_probe_response(const u_char *p)
pbody.capability_info = EXTRACT_LE_16BITS(p+offset);
offset += IEEE802_11_CAPINFO_LEN;
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
- printf(" (");
- fn_print(pbody.ssid.ssid, NULL);
- printf(") ");
+ PRINT_SSID(pbody);
PRINT_RATES(pbody);
- printf(" CH: %u%s", pbody.ds.channel,
- CAPABILITY_PRIVACY(pbody.capability_info) ? ", PRIVACY" : "" );
+ PRINT_DS_CHANNEL(pbody);
return 1;
}
@@ -451,8 +515,7 @@ handle_auth(const u_char *p)
pbody.status_code = EXTRACT_LE_16BITS(p + offset);
offset += 2;
- if (!parse_elements(&pbody, p, offset))
- return 0;
+ parse_elements(&pbody, p, offset);
if ((pbody.auth_alg == 1) &&
((pbody.auth_trans_seq_num == 2) ||
@@ -657,22 +720,23 @@ static void
data_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
const u_int8_t **dstp)
{
- switch (FC_SUBTYPE(fc)) {
- case DATA_DATA:
- case DATA_NODATA:
- break;
- case DATA_DATA_CF_ACK:
- case DATA_NODATA_CF_ACK:
- printf("CF Ack ");
- break;
- case DATA_DATA_CF_POLL:
- case DATA_NODATA_CF_POLL:
- printf("CF Poll ");
- break;
- case DATA_DATA_CF_ACK_POLL:
- case DATA_NODATA_CF_ACK_POLL:
- printf("CF Ack/Poll ");
- break;
+ u_int subtype = FC_SUBTYPE(fc);
+
+ if (DATA_FRAME_IS_CF_ACK(subtype) || DATA_FRAME_IS_CF_POLL(subtype) ||
+ DATA_FRAME_IS_QOS(subtype)) {
+ printf("CF ");
+ if (DATA_FRAME_IS_CF_ACK(subtype)) {
+ if (DATA_FRAME_IS_CF_POLL(subtype))
+ printf("Ack/Poll");
+ else
+ printf("Ack");
+ } else {
+ if (DATA_FRAME_IS_CF_POLL(subtype))
+ printf("Poll");
+ }
+ if (DATA_FRAME_IS_QOS(subtype))
+ printf("+QoS");
+ printf(" ");
}
#define ADDR1 (p + 4)
@@ -802,6 +866,8 @@ ctrl_header_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
static int
extract_header_length(u_int16_t fc)
{
+ int len;
+
switch (FC_TYPE(fc)) {
case T_MGMT:
return MGMT_HDRLEN;
@@ -825,7 +891,10 @@ extract_header_length(u_int16_t fc)
return 0;
}
case T_DATA:
- return (FC_TO_DS(fc) && FC_FROM_DS(fc)) ? 30 : 24;
+ len = (FC_TO_DS(fc) && FC_FROM_DS(fc)) ? 30 : 24;
+ if (DATA_FRAME_IS_QOS(FC_SUBTYPE(fc)))
+ len += 2;
+ return len;
default:
printf("unknown IEEE802.11 frame type (%d)", FC_TYPE(fc));
return 0;
@@ -879,8 +948,12 @@ ieee_802_11_hdr_print(u_int16_t fc, const u_char *p, const u_int8_t **srcp,
}
}
+#ifndef roundup2
+#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
+#endif
+
static u_int
-ieee802_11_print(const u_char *p, u_int length, u_int caplen)
+ieee802_11_print(const u_char *p, u_int length, u_int caplen, int pad)
{
u_int16_t fc;
u_int hdrlen;
@@ -894,6 +967,8 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
fc = EXTRACT_LE_16BITS(p);
hdrlen = extract_header_length(fc);
+ if (pad)
+ hdrlen = roundup2(hdrlen, 4);
if (caplen < hdrlen) {
printf("[|802.11]");
@@ -924,6 +999,8 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
}
break;
case T_DATA:
+ if (DATA_FRAME_IS_NULL(FC_SUBTYPE(fc)))
+ return hdrlen; /* no-data frame */
/* There may be a problem w/ AP not having this bit set */
if (FC_WEP(fc)) {
if (!wep_print(p)) {
@@ -964,7 +1041,7 @@ ieee802_11_print(const u_char *p, u_int length, u_int caplen)
u_int
ieee802_11_if_print(const struct pcap_pkthdr *h, const u_char *p)
{
- return ieee802_11_print(p, h->len, h->caplen);
+ return ieee802_11_print(p, h->len, h->caplen, 0);
}
#define IEEE80211_CHAN_FHSS \
@@ -1026,7 +1103,7 @@ print_chaninfo(int freq, int flags)
}
static int
-print_radiotap_field(struct cpack_state *s, u_int32_t bit)
+print_radiotap_field(struct cpack_state *s, u_int32_t bit, int *pad)
{
union {
int8_t i8;
@@ -1040,6 +1117,10 @@ print_radiotap_field(struct cpack_state *s, u_int32_t bit)
switch (bit) {
case IEEE80211_RADIOTAP_FLAGS:
+ rc = cpack_uint8(s, &u.u8);
+ if (u.u8 & IEEE80211_RADIOTAP_F_DATAPAD)
+ *pad = 1;
+ break;
case IEEE80211_RADIOTAP_RATE:
case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
case IEEE80211_RADIOTAP_DB_ANTNOISE:
@@ -1142,14 +1223,8 @@ print_radiotap_field(struct cpack_state *s, u_int32_t bit)
printf("wep ");
if (u.u8 & IEEE80211_RADIOTAP_F_FRAG)
printf("fragmented ");
-#if 0
- if (u.u8 & IEEE80211_RADIOTAP_F_FCS)
- printf("fcs ");
- if (u.u8 & IEEE80211_RADIOTAP_F_DATAPAD)
- printf("datapad ");
-#endif
if (u.u8 & IEEE80211_RADIOTAP_F_BADFCS)
- printf("badfcs ");
+ printf("bad-fcs ");
break;
case IEEE80211_RADIOTAP_ANTENNA:
printf("antenna %d ", u.u8);
@@ -1184,6 +1259,7 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
int bit0;
const u_char *iter;
u_int len;
+ int pad;
if (caplen < sizeof(*hdr)) {
printf("[|802.11]");
@@ -1217,6 +1293,8 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
return caplen;
}
+ /* Assume no Atheros padding between 802.11 header and body */
+ pad = 0;
for (bit0 = 0, presentp = &hdr->it_present; presentp <= last_presentp;
presentp++, bit0 += 32) {
for (present = EXTRACT_LE_32BITS(presentp); present;
@@ -1228,12 +1306,12 @@ ieee802_11_radio_print(const u_char *p, u_int length, u_int caplen)
bit = (enum ieee80211_radiotap_type)
(bit0 + BITNO_32(present ^ next_present));
- if (print_radiotap_field(&cpacker, bit) != 0)
+ if (print_radiotap_field(&cpacker, bit, &pad) != 0)
goto out;
}
}
out:
- return len + ieee802_11_print(p + len, length - len, caplen - len);
+ return len + ieee802_11_print(p + len, length - len, caplen - len, pad);
#undef BITNO_32
#undef BITNO_16
#undef BITNO_8
@@ -1264,7 +1342,7 @@ ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
}
return caphdr_len + ieee802_11_print(p + caphdr_len,
- length - caphdr_len, caplen - caphdr_len);
+ length - caphdr_len, caplen - caphdr_len, 0);
}
#define PRISM_HDR_LEN 144
@@ -1303,7 +1381,7 @@ prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
}
return PRISM_HDR_LEN + ieee802_11_print(p + PRISM_HDR_LEN,
- length - PRISM_HDR_LEN, caplen - PRISM_HDR_LEN);
+ length - PRISM_HDR_LEN, caplen - PRISM_HDR_LEN, 0);
}
/*
diff --git a/contrib/tcpdump/print-atm.c b/contrib/tcpdump/print-atm.c
index 1fdae6e..03ca34b 100644
--- a/contrib/tcpdump/print-atm.c
+++ b/contrib/tcpdump/print-atm.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38.2.3 2005/07/07 01:24:34 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-atm.c,v 1.38.2.6 2006/01/25 13:27:24 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -45,6 +45,12 @@ static const char rcsid[] _U_ =
#include "ether.h"
+struct tok oam_f_values[] = {
+ { OAMF4SC, "OAM F4 (segment)" },
+ { OAMF4EC, "OAM F4 (end)" },
+ { 0, NULL }
+};
+
struct tok oam_celltype_values[] = {
{ 0x1, "Fault Management" },
{ 0x2, "Performance Management" },
@@ -137,6 +143,15 @@ atm_if_print(const struct pcap_pkthdr *h, const u_char *p)
printf("[|atm]");
return (caplen);
}
+
+ /* Cisco Style NLPID ? */
+ if (*p == LLC_UI) {
+ if (eflag)
+ printf("CNLPID ");
+ isoclns_print(p+1, length-1, caplen-1);
+ return hdrlen;
+ }
+
/*
* Extract the presumed LLC header into a variable, for quick
* testing.
@@ -291,9 +306,10 @@ 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, u_int hec) {
- u_int16_t cell_header, cell_type, func_type,vpi,vci,payload,clp;
+ u_int32_t cell_header;
+ u_int16_t cell_type, func_type,vpi,vci,payload,clp;
- cell_header = EXTRACT_32BITS(p);
+ cell_header = EXTRACT_32BITS(p+hec);
cell_type = ((*(p+4+hec))>>4) & 0x0f;
func_type = *(p+4+hec) & 0x0f;
@@ -302,20 +318,9 @@ oam_print (const u_char *p, u_int length, u_int hec) {
payload = (cell_header>>1)&0x7;
clp = cell_header&0x1;
- switch (vci) {
- case OAMF4SC:
- printf("OAM F4 (segment), ");
- break;
- case OAMF4EC:
- printf("OAM F4 (end), ");
- break;
- default:
- printf("OAM F5, ");
- break;
- }
-
- if (eflag)
- printf("vpi %u, vci %u, payload %u, clp %u, ",vpi,vci,payload,clp);
+ printf("%s, vpi %u, vci %u, payload %u, clp %u, ",
+ tok2str(oam_f_values, "OAM F5", vci),
+ vpi, vci, payload, clp);
printf("cell-type %s (%u)",
tok2str(oam_celltype_values, "unknown", cell_type),
diff --git a/contrib/tcpdump/print-bootp.c b/contrib/tcpdump/print-bootp.c
index 844aecc..b7e2cda 100644
--- a/contrib/tcpdump/print-bootp.c
+++ b/contrib/tcpdump/print-bootp.c
@@ -24,7 +24,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78.2.2 2005/05/06 04:19:39 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.78.2.9 2007/08/21 22:02:08 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -44,6 +44,7 @@ static const char rcsid[] _U_ =
static void rfc1048_print(const u_char *);
static void cmu_print(const u_char *);
+static char *client_fqdn_flags(u_int flags);
static char tstr[] = " [|bootp]";
@@ -79,7 +80,7 @@ bootp_print(register const u_char *cp, u_int length)
printf(" from %s", etheraddr_string(bp->bp_chaddr));
}
- printf(", length: %u", length);
+ printf(", length %u", length);
if (!vflag)
return;
@@ -88,49 +89,49 @@ bootp_print(register const u_char *cp, u_int length)
/* The usual hardware address type is 1 (10Mb Ethernet) */
if (bp->bp_htype != 1)
- printf(", htype-#%d", bp->bp_htype);
+ printf(", htype %d", bp->bp_htype);
/* The usual length for 10Mb Ethernet address is 6 bytes */
if (bp->bp_htype != 1 || bp->bp_hlen != 6)
- printf(", hlen:%d", bp->bp_hlen);
+ printf(", hlen %d", bp->bp_hlen);
/* Only print interesting fields */
if (bp->bp_hops)
- printf(", hops:%d", bp->bp_hops);
+ printf(", hops %d", bp->bp_hops);
if (bp->bp_xid)
- printf(", xid:0x%x", EXTRACT_32BITS(&bp->bp_xid));
+ printf(", xid 0x%x", EXTRACT_32BITS(&bp->bp_xid));
if (bp->bp_secs)
- printf(", secs:%d", EXTRACT_16BITS(&bp->bp_secs));
+ printf(", secs %d", EXTRACT_16BITS(&bp->bp_secs));
- printf(", flags: [%s]",
- bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags)));
- if (vflag>1)
- printf( " (0x%04x)", EXTRACT_16BITS(&bp->bp_flags));
+ printf(", Flags [%s]",
+ bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags)));
+ if (vflag > 1)
+ printf(" (0x%04x)", EXTRACT_16BITS(&bp->bp_flags));
/* Client's ip address */
TCHECK(bp->bp_ciaddr);
if (bp->bp_ciaddr.s_addr)
- printf("\n\t Client IP: %s", ipaddr_string(&bp->bp_ciaddr));
+ printf("\n\t Client-IP %s", ipaddr_string(&bp->bp_ciaddr));
/* 'your' ip address (bootp client) */
TCHECK(bp->bp_yiaddr);
if (bp->bp_yiaddr.s_addr)
- printf("\n\t Your IP: %s", ipaddr_string(&bp->bp_yiaddr));
+ printf("\n\t Your-IP %s", ipaddr_string(&bp->bp_yiaddr));
/* Server's ip address */
TCHECK(bp->bp_siaddr);
if (bp->bp_siaddr.s_addr)
- printf("\n\t Server IP: %s", ipaddr_string(&bp->bp_siaddr));
+ printf("\n\t Server-IP %s", ipaddr_string(&bp->bp_siaddr));
/* Gateway's ip address */
TCHECK(bp->bp_giaddr);
if (bp->bp_giaddr.s_addr)
- printf("\n\t Gateway IP: %s", ipaddr_string(&bp->bp_giaddr));
+ printf("\n\t Gateway-IP %s", ipaddr_string(&bp->bp_giaddr));
/* Client's Ethernet address */
if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
TCHECK2(bp->bp_chaddr[0], 6);
- printf("\n\t Client Ethernet Address: %s", etheraddr_string(bp->bp_chaddr));
+ printf("\n\t Client-Ethernet-Address %s", etheraddr_string(bp->bp_chaddr));
}
TCHECK2(bp->bp_sname[0], 1); /* check first char only */
@@ -191,23 +192,23 @@ trunc:
static struct tok tag2str[] = {
/* RFC1048 tags */
{ TAG_PAD, " PAD" },
- { TAG_SUBNET_MASK, "iSM" }, /* subnet mask (RFC950) */
- { TAG_TIME_OFFSET, "LTZ" }, /* seconds from UTC */
- { TAG_GATEWAY, "iDG" }, /* default gateway */
- { TAG_TIME_SERVER, "iTS" }, /* time servers (RFC868) */
- { TAG_NAME_SERVER, "iIEN" }, /* IEN name servers (IEN116) */
- { TAG_DOMAIN_SERVER, "iNS" }, /* domain name (RFC1035) */
+ { TAG_SUBNET_MASK, "iSubnet-Mask" }, /* subnet mask (RFC950) */
+ { TAG_TIME_OFFSET, "LTime-Zone" }, /* seconds from UTC */
+ { TAG_GATEWAY, "iDefault-Gateway" }, /* default gateway */
+ { TAG_TIME_SERVER, "iTime-Server" }, /* time servers (RFC868) */
+ { TAG_NAME_SERVER, "iIEN-Name-Server" }, /* IEN name servers (IEN116) */
+ { TAG_DOMAIN_SERVER, "iDomain-Name-Server" }, /* domain name (RFC1035) */
{ TAG_LOG_SERVER, "iLOG" }, /* MIT log servers */
{ TAG_COOKIE_SERVER, "iCS" }, /* cookie servers (RFC865) */
- { TAG_LPR_SERVER, "iLPR" }, /* lpr server (RFC1179) */
+ { TAG_LPR_SERVER, "iLPR-Server" }, /* lpr server (RFC1179) */
{ TAG_IMPRESS_SERVER, "iIM" }, /* impress servers (Imagen) */
{ TAG_RLP_SERVER, "iRL" }, /* resource location (RFC887) */
- { TAG_HOSTNAME, "aHN" }, /* ascii hostname */
+ { TAG_HOSTNAME, "aHostname" }, /* ascii hostname */
{ TAG_BOOTSIZE, "sBS" }, /* 512 byte blocks */
{ TAG_END, " END" },
/* RFC1497 tags */
{ TAG_DUMPPATH, "aDP" },
- { TAG_DOMAINNAME, "aDN" },
+ { TAG_DOMAINNAME, "aDomain-Name" },
{ TAG_SWAP_SERVER, "iSS" },
{ TAG_ROOTPATH, "aRP" },
{ TAG_EXTPATH, "aEP" },
@@ -217,16 +218,16 @@ static struct tok tag2str[] = {
{ TAG_PFILTERS, "pPF" },
{ TAG_REASS_SIZE, "sRSZ" },
{ TAG_DEF_TTL, "bTTL" },
- { TAG_MTU_TIMEOUT, "lMA" },
- { TAG_MTU_TABLE, "sMT" },
+ { TAG_MTU_TIMEOUT, "lMTU-Timeout" },
+ { TAG_MTU_TABLE, "sMTU-Table" },
{ TAG_INT_MTU, "sMTU" },
{ TAG_LOCAL_SUBNETS, "BLSN" },
{ TAG_BROAD_ADDR, "iBR" },
{ TAG_DO_MASK_DISC, "BMD" },
{ TAG_SUPPLY_MASK, "BMS" },
- { TAG_DO_RDISC, "BRD" },
+ { TAG_DO_RDISC, "BRouter-Discovery" },
{ TAG_RTR_SOL_ADDR, "iRSA" },
- { TAG_STATIC_ROUTE, "pSR" },
+ { TAG_STATIC_ROUTE, "pStatic-Route" },
{ TAG_USE_TRAILERS, "BUT" },
{ TAG_ARP_TIMEOUT, "lAT" },
{ TAG_ETH_ENCAP, "BIE" },
@@ -236,11 +237,11 @@ static struct tok tag2str[] = {
{ TAG_NIS_DOMAIN, "aYD" },
{ TAG_NIS_SERVERS, "iYS" },
{ TAG_NTP_SERVERS, "iNTP" },
- { TAG_VENDOR_OPTS, "bVO" },
- { TAG_NETBIOS_NS, "iWNS" },
+ { TAG_VENDOR_OPTS, "bVendor-Option" },
+ { TAG_NETBIOS_NS, "iNetbios-Name-Server" },
{ TAG_NETBIOS_DDS, "iWDD" },
- { TAG_NETBIOS_NODE, "$WNT" },
- { TAG_NETBIOS_SCOPE, "aWSC" },
+ { TAG_NETBIOS_NODE, "$Netbios-Node" },
+ { TAG_NETBIOS_SCOPE, "aNetbios-Scope" },
{ TAG_XWIN_FS, "iXFS" },
{ TAG_XWIN_DM, "iXDM" },
{ TAG_NIS_P_DOMAIN, "sN+D" },
@@ -254,20 +255,20 @@ static struct tok tag2str[] = {
{ TAG_IRC_SERVER, "iIRC" },
{ TAG_STREETTALK_SRVR, "iSTS" },
{ TAG_STREETTALK_STDA, "iSTDA" },
- { TAG_REQUESTED_IP, "iRQ" },
- { TAG_IP_LEASE, "lLT" },
+ { TAG_REQUESTED_IP, "iRequested-IP" },
+ { TAG_IP_LEASE, "lLease-Time" },
{ TAG_OPT_OVERLOAD, "$OO" },
{ TAG_TFTP_SERVER, "aTFTP" },
{ TAG_BOOTFILENAME, "aBF" },
- { TAG_DHCP_MESSAGE, " DHCP" },
- { TAG_SERVER_ID, "iSID" },
- { TAG_PARM_REQUEST, "bPR" },
+ { TAG_DHCP_MESSAGE, " DHCP-Message" },
+ { TAG_SERVER_ID, "iServer-ID" },
+ { TAG_PARM_REQUEST, "bParameter-Request" },
{ TAG_MESSAGE, "aMSG" },
{ TAG_MAX_MSG_SIZE, "sMSZ" },
{ TAG_RENEWAL_TIME, "lRN" },
{ TAG_REBIND_TIME, "lRB" },
- { TAG_VENDOR_CLASS, "aVC" },
- { TAG_CLIENT_ID, "$CID" },
+ { TAG_VENDOR_CLASS, "aVendor-Class" },
+ { TAG_CLIENT_ID, "$Client-ID" },
/* RFC 2485 */
{ TAG_OPEN_GROUP_UAP, "aUAP" },
/* RFC 2563 */
@@ -279,11 +280,14 @@ static struct tok tag2str[] = {
{ TAG_NS_SEARCH, "sNSSEARCH" }, /* XXX 's' */
/* RFC 3011 */
{ TAG_IP4_SUBNET_SELECT, "iSUBNET" },
+/* RFC 3442 */
+ { TAG_CLASSLESS_STATIC_RT, "$Classless-Static-Route" },
+ { TAG_CLASSLESS_STA_RT_MS, "$Classless-Static-Route-Microsoft" },
/* http://www.iana.org/assignments/bootp-dhcp-extensions/index.htm */
{ TAG_USER_CLASS, "aCLASS" },
{ TAG_SLP_NAMING_AUTH, "aSLP-NA" },
{ TAG_CLIENT_FQDN, "$FQDN" },
- { TAG_AGENT_CIRCUIT, "bACKT" },
+ { TAG_AGENT_CIRCUIT, "$Agent-Information" },
{ TAG_AGENT_REMOTE, "bARMT" },
{ TAG_AGENT_MASK, "bAMSK" },
{ TAG_TZ_STRING, "aTZSTR" },
@@ -338,29 +342,49 @@ static struct tok arp2str[] = {
{ 0, NULL }
};
+static struct tok dhcp_msg_values[] = {
+ { DHCPDISCOVER, "Discover" },
+ { DHCPOFFER, "Offer" },
+ { DHCPREQUEST, "Request" },
+ { DHCPDECLINE, "Decline" },
+ { DHCPACK, "ACK" },
+ { DHCPNAK, "NACK" },
+ { DHCPRELEASE, "Release" },
+ { DHCPINFORM, "Inform" },
+ { 0, NULL }
+};
+
+#define AGENT_SUBOPTION_CIRCUIT_ID 1
+static struct tok agent_suboption_values[] = {
+ { AGENT_SUBOPTION_CIRCUIT_ID, "Circuit-ID" },
+ { 0, NULL }
+};
+
+
static void
rfc1048_print(register const u_char *bp)
{
register u_int16_t tag;
- register u_int len, size;
+ register u_int len;
register const char *cp;
register char c;
- int first;
+ int first, idx;
u_int32_t ul;
u_int16_t us;
- u_int8_t uc;
+ u_int8_t uc, subopt, suboptlen;
- printf("\n\t Vendor-rfc1048:");
+ printf("\n\t Vendor-rfc1048 Extensions");
/* Step over magic cookie */
+ printf("\n\t Magic Cookie 0x%08x", EXTRACT_32BITS(bp));
bp += sizeof(int32_t);
/* Loop while we there is a tag left in the buffer */
- while (bp + 1 < snapend) {
+ while (TTEST2(*bp, 1)) {
tag = *bp++;
- if (tag == TAG_PAD)
+ if (tag == TAG_PAD && vflag < 3)
continue;
- if (tag == TAG_END)
+ if (tag == TAG_END && vflag < 3)
return;
if (tag == TAG_EXTENDED_OPTION) {
TCHECK2(*(bp + 1), 2);
@@ -373,47 +397,54 @@ rfc1048_print(register const u_char *bp)
} else
cp = tok2str(tag2str, "?T%u", tag);
c = *cp++;
- printf("\n\t %s:", cp);
- /* Get the length; check for truncation */
- if (bp + 1 >= snapend) {
- fputs(tstr, stdout);
- return;
+ if (tag == TAG_PAD || tag == TAG_END)
+ len = 0;
+ else {
+ /* Get the length; check for truncation */
+ TCHECK2(*bp, 1);
+ len = *bp++;
}
- len = *bp++;
- if (bp + len >= snapend) {
- printf("[|bootp %u]", len);
+
+ printf("\n\t %s Option %u, length %u%s", cp, tag, len,
+ len > 0 ? ": " : "");
+
+ if (tag == TAG_PAD && vflag > 2) {
+ u_int ntag = 1;
+ while (TTEST2(*bp, 1) && *bp == TAG_PAD) {
+ bp++;
+ ntag++;
+ }
+ if (ntag > 1)
+ printf(", occurs %u", ntag);
+ }
+
+ if (!TTEST2(*bp, len)) {
+ printf("[|rfc1048 %u]", len);
return;
}
if (tag == TAG_DHCP_MESSAGE && len == 1) {
uc = *bp++;
- switch (uc) {
- case DHCPDISCOVER: printf("DISCOVER"); break;
- case DHCPOFFER: printf("OFFER"); break;
- case DHCPREQUEST: printf("REQUEST"); break;
- case DHCPDECLINE: printf("DECLINE"); break;
- case DHCPACK: printf("ACK"); break;
- case DHCPNAK: printf("NACK"); break;
- case DHCPRELEASE: printf("RELEASE"); break;
- case DHCPINFORM: printf("INFORM"); break;
- default: printf("%u", uc); break;
- }
- continue;
+ printf("%s", tok2str(dhcp_msg_values, "Unknown (%u)", uc));
+ continue;
}
if (tag == TAG_PARM_REQUEST) {
- first = 1;
+ idx = 0;
while (len-- > 0) {
uc = *bp++;
- cp = tok2str(tag2str, "?T%u", uc);
- if (!first)
- putchar('+');
+ cp = tok2str(tag2str, "?Option %u", uc);
+ if (idx % 4 == 0)
+ printf("\n\t ");
+ else
+ printf(", ");
printf("%s", cp + 1);
- first = 0;
+ idx++;
}
continue;
}
+
if (tag == TAG_EXTENDED_REQUEST) {
first = 1;
while (len > 1) {
@@ -430,12 +461,11 @@ rfc1048_print(register const u_char *bp)
}
/* Print data */
- size = len;
if (c == '?') {
/* Base default formats for unknown tags on data size */
- if (size & 1)
+ if (len & 1)
c = 'b';
- else if (size & 2)
+ else if (len & 2)
c = 's';
else
c = 'l';
@@ -446,20 +476,20 @@ rfc1048_print(register const u_char *bp)
case 'a':
/* ascii strings */
putchar('"');
- if (fn_printn(bp, size, snapend)) {
+ if (fn_printn(bp, len, snapend)) {
putchar('"');
goto trunc;
}
putchar('"');
- bp += size;
- size = 0;
+ bp += len;
+ len = 0;
break;
case 'i':
case 'l':
case 'L':
/* ip addresses/32-bit words */
- while (size >= sizeof(ul)) {
+ while (len >= sizeof(ul)) {
if (!first)
putchar(',');
ul = EXTRACT_32BITS(bp);
@@ -471,14 +501,14 @@ rfc1048_print(register const u_char *bp)
else
printf("%u", ul);
bp += sizeof(ul);
- size -= sizeof(ul);
+ len -= sizeof(ul);
first = 0;
}
break;
case 'p':
/* IP address pairs */
- while (size >= 2*sizeof(ul)) {
+ while (len >= 2*sizeof(ul)) {
if (!first)
putchar(',');
memcpy((char *)&ul, (const char *)bp, sizeof(ul));
@@ -487,27 +517,27 @@ rfc1048_print(register const u_char *bp)
memcpy((char *)&ul, (const char *)bp, sizeof(ul));
printf("%s)", ipaddr_string(&ul));
bp += sizeof(ul);
- size -= 2*sizeof(ul);
+ len -= 2*sizeof(ul);
first = 0;
}
break;
case 's':
/* shorts */
- while (size >= sizeof(us)) {
+ while (len >= sizeof(us)) {
if (!first)
putchar(',');
us = EXTRACT_16BITS(bp);
printf("%u", us);
bp += sizeof(us);
- size -= sizeof(us);
+ len -= sizeof(us);
first = 0;
}
break;
case 'B':
/* boolean */
- while (size > 0) {
+ while (len > 0) {
if (!first)
putchar(',');
switch (*bp) {
@@ -522,7 +552,7 @@ rfc1048_print(register const u_char *bp)
break;
}
++bp;
- --size;
+ --len;
first = 0;
}
break;
@@ -531,7 +561,7 @@ rfc1048_print(register const u_char *bp)
case 'x':
default:
/* Bytes */
- while (size > 0) {
+ while (len > 0) {
if (!first)
putchar(c == 'x' ? ':' : '.');
if (c == 'x')
@@ -539,7 +569,7 @@ rfc1048_print(register const u_char *bp)
else
printf("%u", *bp);
++bp;
- --size;
+ --len;
first = 0;
}
break;
@@ -549,78 +579,196 @@ rfc1048_print(register const u_char *bp)
switch (tag) {
case TAG_NETBIOS_NODE:
+ /* this option should be at least 1 byte long */
+ if (len < 1) {
+ printf("ERROR: option %u len %u < 1 bytes",
+ TAG_NETBIOS_NODE, len);
+ bp += len;
+ len = 0;
+ break;
+ }
tag = *bp++;
- --size;
+ --len;
fputs(tok2str(nbo2str, NULL, tag), stdout);
break;
case TAG_OPT_OVERLOAD:
+ /* this option should be at least 1 byte long */
+ if (len < 1) {
+ printf("ERROR: option %u len %u < 1 bytes",
+ TAG_OPT_OVERLOAD, len);
+ bp += len;
+ len = 0;
+ break;
+ }
tag = *bp++;
- --size;
+ --len;
fputs(tok2str(oo2str, NULL, tag), stdout);
break;
case TAG_CLIENT_FQDN:
- /* option 81 should be at least 4 bytes long */
- if (len < 4) {
- printf("ERROR: options 81 len %u < 4 bytes", len);
+ /* this option should be at least 3 bytes long */
+ if (len < 3) {
+ printf("ERROR: option %u len %u < 3 bytes",
+ TAG_CLIENT_FQDN, len);
+ bp += len;
+ len = 0;
break;
}
- if (*bp++)
- printf("[svrreg]");
if (*bp)
- printf("%u/%u/", *bp, *(bp+1));
+ printf("[%s] ", client_fqdn_flags(*bp));
+ bp++;
+ if (*bp || *(bp+1))
+ printf("%u/%u ", *bp, *(bp+1));
bp += 2;
putchar('"');
- if (fn_printn(bp, size - 3, snapend)) {
+ if (fn_printn(bp, len - 3, snapend)) {
putchar('"');
goto trunc;
}
putchar('"');
- bp += size - 3;
- size = 0;
+ bp += len - 3;
+ len = 0;
break;
case TAG_CLIENT_ID:
- { int type = *bp++;
- size--;
+ { int type;
+
+ /* this option should be at least 1 byte long */
+ if (len < 1) {
+ printf("ERROR: option %u len %u < 1 bytes",
+ TAG_CLIENT_ID, len);
+ bp += len;
+ len = 0;
+ break;
+ }
+ type = *bp++;
+ len--;
if (type == 0) {
putchar('"');
- if (fn_printn(bp, size, snapend)) {
+ if (fn_printn(bp, len, snapend)) {
putchar('"');
goto trunc;
}
putchar('"');
- bp += size;
- size = 0;
+ bp += len;
+ len = 0;
break;
} else {
- printf("[%s]", tok2str(arp2str, "type-%d", type));
+ printf("%s ", tok2str(arp2str, "hardware-type %u,", type));
+ while (len > 0) {
+ if (!first)
+ putchar(':');
+ printf("%02x", *bp);
+ ++bp;
+ --len;
+ first = 0;
+ }
+ }
+ break;
+ }
+
+ case TAG_AGENT_CIRCUIT:
+ while (len >= 2) {
+ subopt = *bp++;
+ suboptlen = *bp++;
+ len -= 2;
+ if (suboptlen > len) {
+ printf("\n\t %s SubOption %u, length %u: length goes past end of option",
+ tok2str(agent_suboption_values, "Unknown", subopt),
+ subopt,
+ suboptlen);
+ bp += len;
+ len = 0;
+ break;
+ }
+ printf("\n\t %s SubOption %u, length %u: ",
+ tok2str(agent_suboption_values, "Unknown", subopt),
+ subopt,
+ suboptlen);
+ switch (subopt) {
+
+ case AGENT_SUBOPTION_CIRCUIT_ID:
+ fn_printn(bp, suboptlen, NULL);
+ break;
+
+ default:
+ print_unknown_data(bp, "\n\t\t", suboptlen);
+ }
+
+ len -= suboptlen;
+ bp += suboptlen;
+ }
+ break;
+
+ case TAG_CLASSLESS_STATIC_RT:
+ case TAG_CLASSLESS_STA_RT_MS:
+ {
+ u_int mask_width, significant_octets, i;
+
+ /* this option should be at least 5 bytes long */
+ if (len < 5) {
+ printf("ERROR: option %u len %u < 5 bytes",
+ TAG_CLASSLESS_STATIC_RT, len);
+ bp += len;
+ len = 0;
+ break;
}
- while (size > 0) {
+ while (len > 0) {
if (!first)
- putchar(':');
- printf("%02x", *bp);
- ++bp;
- --size;
+ putchar(',');
+ mask_width = *bp++;
+ len--;
+ /* mask_width <= 32 */
+ if (mask_width > 32) {
+ printf("[ERROR: Mask width (%d) > 32]", mask_width);
+ bp += len;
+ len = 0;
+ break;
+ }
+ significant_octets = (mask_width + 7) / 8;
+ /* significant octets + router(4) */
+ if (len < significant_octets + 4) {
+ printf("[ERROR: Remaining length (%u) < %u bytes]", len, significant_octets + 4);
+ bp += len;
+ len = 0;
+ break;
+ }
+ putchar('(');
+ if (mask_width == 0)
+ printf("default");
+ else {
+ for (i = 0; i < significant_octets ; i++) {
+ if (i > 0)
+ putchar('.');
+ printf("%d", *bp++);
+ }
+ for (i = significant_octets ; i < 4 ; i++)
+ printf(".0");
+ printf("/%d", mask_width);
+ }
+ memcpy((char *)&ul, (const char *)bp, sizeof(ul));
+ printf(":%s)", ipaddr_string(&ul));
+ bp += sizeof(ul);
+ len -= (significant_octets + 4);
first = 0;
}
- break;
- }
+ }
+ break;
default:
printf("[unknown special tag %u, size %u]",
- tag, size);
- bp += size;
- size = 0;
+ tag, len);
+ bp += len;
+ len = 0;
break;
}
break;
}
/* Data left over? */
- if (size) {
- printf("[len %u]", len);
- bp += size;
+ if (len) {
+ printf("\n\t trailing data length %u", len);
+ bp += len;
}
}
return;
@@ -658,3 +806,22 @@ trunc:
fputs(tstr, stdout);
#undef PRINTCMUADDR
}
+
+static char *
+client_fqdn_flags(u_int flags)
+{
+ static char buf[8+1];
+ int i = 0;
+
+ if (flags & CLIENT_FQDN_FLAGS_S)
+ buf[i++] = 'S';
+ if (flags & CLIENT_FQDN_FLAGS_O)
+ buf[i++] = 'O';
+ if (flags & CLIENT_FQDN_FLAGS_E)
+ buf[i++] = 'E';
+ if (flags & CLIENT_FQDN_FLAGS_N)
+ buf[i++] = 'N';
+ buf[i] = '\0';
+
+ return buf;
+}
diff --git a/contrib/tcpdump/print-domain.c b/contrib/tcpdump/print-domain.c
index 08b5cea..827d1be 100644
--- a/contrib/tcpdump/print-domain.c
+++ b/contrib/tcpdump/print-domain.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.1 2005/04/20 20:59:00 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.8 2007/02/13 19:19:27 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -280,9 +280,20 @@ struct tok ns_type2str[] = {
{ T_SRV, "SRV" }, /* RFC 2782 */
{ T_ATMA, "ATMA" }, /* ATM Forum */
{ T_NAPTR, "NAPTR" }, /* RFC 2168, RFC 2915 */
+ { T_KX, "KX" }, /* RFC 2230 */
+ { T_CERT, "CERT" }, /* RFC 2538 */
{ T_A6, "A6" }, /* RFC 2874 */
{ T_DNAME, "DNAME" }, /* RFC 2672 */
+ { T_SINK, "SINK" },
{ T_OPT, "OPT" }, /* RFC 2671 */
+ { T_APL, "APL" }, /* RFC 3123 */
+ { T_DS, "DS" }, /* RFC 4034 */
+ { T_SSHFP, "SSHFP" }, /* RFC 4255 */
+ { T_IPSECKEY, "IPSECKEY" }, /* RFC 4025 */
+ { T_RRSIG, "RRSIG" }, /* RFC 4034 */
+ { T_NSEC, "NSEC" }, /* RFC 4034 */
+ { T_DNSKEY, "DNSKEY" }, /* RFC 4034 */
+ { T_SPF, "SPF" }, /* RFC-schlitt-spf-classic-02.txt */
{ T_UINFO, "UINFO" },
{ T_UID, "UID" },
{ T_GID, "GID" },
@@ -311,23 +322,32 @@ static const u_char *
ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns)
{
register const u_char *np = cp;
- register u_int i;
+ register u_int i, class;
cp = ns_nskip(cp);
if (cp == NULL || !TTEST2(*cp, 4))
return(NULL);
- /* print the qtype and qclass (if it's not IN) */
+ /* print the qtype */
i = EXTRACT_16BITS(cp);
cp += 2;
printf(" %s", tok2str(ns_type2str, "Type%d", i));
+ /* print the qclass (if it's not IN) */
i = EXTRACT_16BITS(cp);
cp += 2;
- if (is_mdns && i == (C_IN|C_CACHE_FLUSH))
- printf(" (Cache flush)");
- else if (i != C_IN)
- printf(" %s", tok2str(ns_class2str, "(Class %d)", i));
+ if (is_mdns)
+ class = (i & ~C_QU);
+ else
+ class = i;
+ if (class != C_IN)
+ printf(" %s", tok2str(ns_class2str, "(Class %d)", class));
+ if (is_mdns) {
+ if (i & C_QU)
+ printf(" (QU)");
+ else
+ printf(" (QM)");
+ }
fputs("? ", stdout);
cp = ns_nprint(np, bp);
@@ -338,7 +358,7 @@ ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns)
static const u_char *
ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
{
- register u_int class;
+ register u_int i, class, opt_flags = 0;
register u_short typ, len;
register const u_char *rp;
@@ -352,18 +372,30 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
if (cp == NULL || !TTEST2(*cp, 10))
return (snapend);
- /* print the type/qtype and class (if it's not IN) */
+ /* print the type/qtype */
typ = EXTRACT_16BITS(cp);
cp += 2;
- class = EXTRACT_16BITS(cp);
+ /* print the class (if it's not IN and the type isn't OPT) */
+ i = EXTRACT_16BITS(cp);
cp += 2;
- if (is_mdns && class == (C_IN|C_CACHE_FLUSH))
- printf(" (Cache flush)");
- else if (class != C_IN && typ != T_OPT)
+ if (is_mdns)
+ class = (i & ~C_CACHE_FLUSH);
+ else
+ class = i;
+ if (class != C_IN && typ != T_OPT)
printf(" %s", tok2str(ns_class2str, "(Class %d)", class));
+ if (is_mdns) {
+ if (i & C_CACHE_FLUSH)
+ printf(" (Cache flush)");
+ }
/* ignore ttl */
- cp += 4;
+ cp += 2;
+ /* if T_OPT, save opt_flags */
+ if (typ == T_OPT)
+ opt_flags = EXTRACT_16BITS(cp);
+ /* ignore rest of ttl */
+ cp += 2;
len = EXTRACT_16BITS(cp);
cp += 2;
@@ -480,6 +512,8 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns)
case T_OPT:
printf(" UDPsize=%u", class);
+ if (opt_flags & 0x8000)
+ printf(" OK");
break;
case T_UNSPECA: /* One long string */
@@ -542,7 +576,7 @@ ns_print(register const u_char *bp, u_int length, int is_mdns)
if (DNS_QR(np)) {
/* this is a response */
- printf(" %d%s%s%s%s%s%s",
+ printf("%d%s%s%s%s%s%s",
EXTRACT_16BITS(&np->id),
ns_ops[DNS_OPCODE(np)],
ns_resp[DNS_RCODE(np)],
@@ -610,7 +644,7 @@ ns_print(register const u_char *bp, u_int length, int is_mdns)
}
else {
/* this is a request */
- printf(" %d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)],
+ printf("%d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)],
DNS_RD(np) ? "+" : "",
DNS_CD(np) ? "%" : "");
diff --git a/contrib/tcpdump/print-ether.c b/contrib/tcpdump/print-ether.c
index 57a3d8e..d8911d3 100644
--- a/contrib/tcpdump/print-ether.c
+++ b/contrib/tcpdump/print-ether.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95.2.4 2005/07/10 14:47:57 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ether.c,v 1.95.2.6 2006/02/20 18:15:03 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -49,7 +49,7 @@ const struct tok ethertype_values[] = {
{ ETHERTYPE_VMAN, "VMAN" },
{ ETHERTYPE_PUP, "PUP" },
{ ETHERTYPE_ARP, "ARP"},
- { ETHERTYPE_REVARP , "Reverse ARP"},
+ { ETHERTYPE_REVARP, "Reverse ARP"},
{ ETHERTYPE_NS, "NS" },
{ ETHERTYPE_SPRITE, "Sprite" },
{ ETHERTYPE_TRAIL, "Trail" },
@@ -130,7 +130,6 @@ ether_print(const u_char *p, u_int length, u_int caplen)
/*
* Is it (gag) an 802.3 encapsulation?
*/
- extracted_ether_type = 0;
if (ether_type <= ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
if (llc_print(p, length, caplen, ESRC(ep), EDST(ep),
@@ -245,11 +244,13 @@ ether_encap_print(u_short ether_type, const u_char *p,
if (llc_print(p, length, caplen, p - 18, p - 12,
extracted_ether_type) == 0) {
- ether_hdr_print(p - 18, length + 4);
+ ether_hdr_print(p - 18, length + 4);
+
+ if (!suppress_default_print) {
+ default_print(p - 18, caplen + 4);
+ }
}
- if (!suppress_default_print)
- default_print(p - 18, caplen + 4);
return (1);
@@ -271,10 +272,11 @@ ether_encap_print(u_short ether_type, const u_char *p,
if (llc_print(p, length, caplen, p - 16, p - 10,
extracted_ether_type) == 0) {
ether_hdr_print(p - 16, length + 2);
- }
- if (!suppress_default_print)
- default_print(p - 16, caplen + 2);
+ if (!suppress_default_print) {
+ default_print(p - 16, caplen + 2);
+ }
+ }
return (1);
diff --git a/contrib/tcpdump/print-fddi.c b/contrib/tcpdump/print-fddi.c
index 9166735..49e2b00 100644
--- a/contrib/tcpdump/print-fddi.c
+++ b/contrib/tcpdump/print-fddi.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64.2.1 2005/07/07 01:24:35 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-fddi.c,v 1.64.2.2 2005/11/13 12:12:59 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -266,7 +266,6 @@ fddi_print(const u_char *p, u_int length, u_int caplen)
caplen -= FDDI_HDRLEN;
/* Frame Control field determines interpretation of packet */
- extracted_ethertype = 0;
if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) {
/* Try to print the LLC-layer header & higher layers */
if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
diff --git a/contrib/tcpdump/print-fr.c b/contrib/tcpdump/print-fr.c
index e1f9686..abc3cd7 100644
--- a/contrib/tcpdump/print-fr.c
+++ b/contrib/tcpdump/print-fr.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32.2.12 2005/08/23 03:15:51 guy Exp $ (LBL)";
+ "@(#)$Header: /tcpdump/master/tcpdump/print-fr.c,v 1.32.2.15 2006/02/01 14:39:56 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -113,6 +113,8 @@ static int parse_q922_addr(const u_char *p, u_int *dlci, u_int *sdlcore,
flags[0] = p[0] & 0x02; /* populate the first flag fields */
flags[1] = p[1] & 0x0c;
+ flags[2] = 0; /* clear the rest of the flags */
+ flags[3] = 0;
if (p[1] & FR_EA_BIT)
return 0; /* 2-byte Q.922 address */
@@ -304,6 +306,10 @@ fr_print(register const u_char *p, u_int length)
frf15_print(p, length);
break;
+ case NLPID_PPP:
+ ppp_print(p, length);
+ break;
+
default:
if (!eflag)
fr_hdr_print(length + hdr_len, addr_len,
@@ -320,6 +326,24 @@ fr_print(register const u_char *p, u_int length)
}
+u_int
+mfr_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, 2); /* minimum frame header length */
+
+ if ((length = mfr_print(p, length)) == 0)
+ return (0);
+ else
+ return length;
+ trunc:
+ printf("[|mfr]");
+ return caplen;
+}
+
+
#define MFR_CTRL_MSG_ADD_LINK 1
#define MFR_CTRL_MSG_ADD_LINK_ACK 2
#define MFR_CTRL_MSG_ADD_LINK_REJ 3
diff --git a/contrib/tcpdump/print-icmp.c b/contrib/tcpdump/print-icmp.c
index 1ef5a68..09a7a89 100644
--- a/contrib/tcpdump/print-icmp.c
+++ b/contrib/tcpdump/print-icmp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81.2.2 2005/07/01 16:13:37 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.81.2.6 2007/09/13 17:40:18 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -64,20 +64,12 @@ struct icmp {
u_int16_t icd_seq;
} ih_idseq;
u_int32_t ih_void;
-
- /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
- struct ih_pmtu {
- u_int16_t ipm_void;
- u_int16_t ipm_nextmtu;
- } ih_pmtu;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
#define icmp_seq icmp_hun.ih_idseq.icd_seq
#define icmp_void icmp_hun.ih_void
-#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
-#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
union {
struct id_ts {
u_int32_t its_otime;
@@ -88,12 +80,6 @@ struct icmp {
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
- struct mpls_ext {
- u_int8_t legacy_header[128]; /* extension header starts 128 bytes after ICMP header */
- u_int8_t version_res[2];
- u_int8_t checksum[2];
- u_int8_t data[1];
- } mpls_ext;
u_int32_t id_mask;
u_int8_t id_data[1];
} icmp_dun;
@@ -103,9 +89,6 @@ struct icmp {
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
-#define icmp_mpls_ext_version icmp_dun.mpls_ext.version_res
-#define icmp_mpls_ext_checksum icmp_dun.mpls_ext.checksum
-#define icmp_mpls_ext_data icmp_dun.mpls_ext.data
};
#define ICMP_MPLS_EXT_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
@@ -120,7 +103,7 @@ struct icmp {
* ip header length.
*/
#define ICMP_MINLEN 8 /* abs minimum */
-#define ICMP_EXTD_MINLEN (156 - sizeof (struct ip)) /* draft-bonica-icmp-mpls-02 */
+#define ICMP_EXTD_MINLEN (156 - sizeof (struct ip)) /* draft-bonica-internet-icmp-08 */
#define ICMP_TSLEN (8 + 3 * sizeof (u_int32_t)) /* timestamp */
#define ICMP_MASKLEN 12 /* address mask */
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
@@ -175,7 +158,9 @@ struct icmp {
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#define ICMP_MPLS_EXT_TYPE(type) \
- ((type) == ICMP_UNREACH || (type) == ICMP_TIMXCEED)
+ ((type) == ICMP_UNREACH || \
+ (type) == ICMP_TIMXCEED || \
+ (type) == ICMP_PARAMPROB)
/* rfc1700 */
#ifndef ICMP_UNREACH_NET_UNKNOWN
#define ICMP_UNREACH_NET_UNKNOWN 6 /* destination net unknown */
@@ -278,7 +263,45 @@ struct id_rdiscovery {
u_int32_t ird_pref;
};
-/* draft-bonica-icmp-mpls-02 */
+/*
+ * draft-bonica-internet-icmp-08
+ *
+ * The Destination Unreachable, Time Exceeded
+ * and Parameter Problem messages are slighly changed as per
+ * the above draft. A new Length field gets added to give
+ * the caller an idea about the length of the piggypacked
+ * IP packet before the MPLS extension header starts.
+ *
+ * The Length field represents length of the padded "original datagram"
+ * field measured in 32-bit words.
+ *
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Type | Code | Checksum |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | unused | Length | unused |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Internet Header + leading octets of original datagram |
+ * | |
+ * | // |
+ * | |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+struct icmp_ext_t {
+ u_int8_t icmp_type;
+ u_int8_t icmp_code;
+ u_int8_t icmp_checksum[2];
+ u_int8_t icmp_reserved;
+ u_int8_t icmp_length;
+ u_int8_t icmp_reserved2[2];
+ u_int8_t icmp_ext_legacy_header[128]; /* extension header starts 128 bytes after ICMP header */
+ u_int8_t icmp_ext_version_res[2];
+ u_int8_t icmp_ext_checksum[2];
+ u_int8_t icmp_ext_data[1];
+};
+
struct icmp_mpls_ext_object_header_t {
u_int8_t length[2];
u_int8_t class_num;
@@ -314,17 +337,20 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
{
char *cp;
const struct icmp *dp;
+ const struct icmp_ext_t *ext_dp;
const struct ip *ip;
const char *str, *fmt;
const struct ip *oip;
const struct udphdr *ouh;
const u_int8_t *obj_tptr;
u_int32_t raw_label;
+ const u_char *snapend_save;
const struct icmp_mpls_ext_object_header_t *icmp_mpls_ext_object_header;
u_int hlen, dport, mtu, obj_tlen, obj_class_num, obj_ctype;
char buf[MAXHOSTNAMELEN + 100];
dp = (struct icmp *)bp;
+ ext_dp = (struct icmp_ext_t *)bp;
ip = (struct ip *)bp2;
str = buf;
@@ -546,35 +572,61 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
}
}
}
+
+ /*
+ * print the remnants of the IP packet.
+ * save the snaplength as this may get overidden in the IP printer.
+ */
if (vflag >= 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
bp += 8;
(void)printf("\n\t");
ip = (struct ip *)bp;
snaplen = snapend - bp;
+ snapend_save = snapend;
ip_print(gndo, bp, EXTRACT_16BITS(&ip->ip_len));
+ snapend = snapend_save;
}
+ /*
+ * Attempt to decode the MPLS extensions only for some ICMP types.
+ */
if (vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(dp->icmp_type)) {
- TCHECK(*(dp->icmp_mpls_ext_version));
- printf("\n\tMPLS extension v%u",ICMP_MPLS_EXT_EXTRACT_VERSION(*(dp->icmp_mpls_ext_version)));
+ TCHECK(*ext_dp);
+
+ /*
+ * Check first if the mpls extension header shows a non-zero length.
+ * If the length field is not set then silently verify the checksum
+ * to check if an extension header is present. This is expedient,
+ * however not all implementations set the length field proper.
+ */
+ if (!ext_dp->icmp_length &&
+ in_cksum((const u_short *)&ext_dp->icmp_ext_version_res,
+ plen - ICMP_EXTD_MINLEN, 0)) {
+ return;
+ }
+
+ printf("\n\tMPLS extension v%u",
+ ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)));
/*
* Sanity checking of the header.
*/
- if (ICMP_MPLS_EXT_EXTRACT_VERSION(*(dp->icmp_mpls_ext_version)) != ICMP_MPLS_EXT_VERSION) {
+ if (ICMP_MPLS_EXT_EXTRACT_VERSION(*(ext_dp->icmp_ext_version_res)) !=
+ ICMP_MPLS_EXT_VERSION) {
printf(" packet not supported");
return;
}
hlen = plen - ICMP_EXTD_MINLEN;
- TCHECK2(*(dp->icmp_mpls_ext_checksum), 2);
- printf(", checksum 0x%04x (unverified), length %u", /* FIXME */
- EXTRACT_16BITS(dp->icmp_mpls_ext_checksum),
+ printf(", checksum 0x%04x (%scorrect), length %u",
+ EXTRACT_16BITS(ext_dp->icmp_ext_checksum),
+ in_cksum((const u_short *)&ext_dp->icmp_ext_version_res,
+ plen - ICMP_EXTD_MINLEN, 0) ? "in" : "",
hlen);
hlen -= 4; /* subtract common header size */
- obj_tptr = (u_int8_t *)dp->icmp_mpls_ext_data;
+ obj_tptr = (u_int8_t *)ext_dp->icmp_ext_data;
while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
@@ -592,8 +644,12 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
obj_tlen);
hlen-=sizeof(struct icmp_mpls_ext_object_header_t); /* length field includes tlv header */
- if (obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))
- break;
+
+ /* infinite loop protection */
+ if ((obj_class_num == 0) ||
+ (obj_tlen < sizeof(struct icmp_mpls_ext_object_header_t))) {
+ return;
+ }
obj_tlen-=sizeof(struct icmp_mpls_ext_object_header_t);
switch (obj_class_num) {
diff --git a/contrib/tcpdump/print-ip.c b/contrib/tcpdump/print-ip.c
index 9ea7141..48d54dd 100644
--- a/contrib/tcpdump/print-ip.c
+++ b/contrib/tcpdump/print-ip.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.2 2005/09/20 06:05:38 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.149.2.9 2007/09/14 01:30:02 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -52,6 +52,7 @@ struct tok ip_option_values[] = {
{ IPOPT_SSRR, "SSRR" },
{ IPOPT_LSRR, "LSRR" },
{ IPOPT_RA, "RA" },
+ { IPOPT_RFC1393, "traceroute" },
{ 0, NULL }
};
@@ -75,9 +76,9 @@ ip_printroute(register const u_char *cp, u_int length)
printf(" [bad ptr %u]", cp[2]);
for (len = 3; len < length; len += 4) {
- printf("%s", ipaddr_string(&cp[len]));
+ printf(" %s", ipaddr_string(&cp[len]));
if (ptr > len)
- printf (", ");
+ printf(",");
}
}
@@ -139,17 +140,17 @@ ip_printts(register const u_char *cp, u_int length)
const char *type;
if (length < 4) {
- printf("[bad length %d]", length);
+ printf("[bad length %u]", length);
return;
}
printf(" TS{");
hoplen = ((cp[3]&0xF) != IPOPT_TS_TSONLY) ? 8 : 4;
if ((length - 4) & (hoplen-1))
- printf("[bad length %d]", length);
+ printf("[bad length %u]", length);
ptr = cp[2] - 1;
len = 0;
if (ptr < 4 || ((ptr - 4) & (hoplen-1)) || ptr > length + 1)
- printf("[bad ptr %d]", cp[2]);
+ printf("[bad ptr %u]", cp[2]);
switch (cp[3]&0xF) {
case IPOPT_TS_TSONLY:
printf("TSONLY");
@@ -199,29 +200,37 @@ static void
ip_optprint(register const u_char *cp, u_int length)
{
register u_int option_len;
+ const char *sep = "";
for (; length > 0; cp += option_len, length -= option_len) {
u_int option_code;
+ printf("%s", sep);
+ sep = ",";
+
TCHECK(*cp);
option_code = *cp;
+ printf("%s",
+ tok2str(ip_option_values,"unknown %u",option_code));
+
if (option_code == IPOPT_NOP ||
option_code == IPOPT_EOL)
option_len = 1;
else {
TCHECK(cp[1]);
- option_len = cp[1];
+ option_len = cp[1];
+ if (option_len < 2) {
+ printf(" [bad length %u]", option_len);
+ return;
+ }
}
- printf("%s (%u) len %u",
- tok2str(ip_option_values,"unknown",option_code),
- option_code,
- option_len);
-
- if (option_len < 2)
- return;
+ if (option_len > length) {
+ printf(" [bad length %u]", option_len);
+ return;
+ }
TCHECK2(*cp, option_len);
@@ -236,13 +245,17 @@ ip_optprint(register const u_char *cp, u_int length)
case IPOPT_RR: /* fall through */
case IPOPT_SSRR:
case IPOPT_LSRR:
- ip_printroute( cp, option_len);
+ ip_printroute(cp, option_len);
break;
case IPOPT_RA:
+ if (option_len < 4) {
+ printf(" [bad length %u]", option_len);
+ break;
+ }
TCHECK(cp[3]);
if (EXTRACT_16BITS(&cp[2]) != 0)
- printf("value %u", EXTRACT_16BITS(&cp[2]));
+ printf(" value %u", EXTRACT_16BITS(&cp[2]));
break;
case IPOPT_NOP: /* nothing to print - fall through */
@@ -343,12 +356,6 @@ in_cksum_shouldbe(u_int16_t sum, u_int16_t computed_sum)
return shouldbe;
}
-#ifndef IP_MF
-#define IP_MF 0x2000
-#endif /* IP_MF */
-#ifndef IP_DF
-#define IP_DF 0x4000
-#endif /* IP_DF */
#define IP_RES 0x8000
static struct tok ip_frag_values[] = {
@@ -419,19 +426,21 @@ again:
break;
case IPPROTO_TCP:
+ /* pass on the MF bit plus the offset to detect fragments */
tcp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
- (ipds->off &~ 0x6000));
+ ipds->off & (IP_MF|IP_OFFMASK));
break;
case IPPROTO_UDP:
+ /* pass on the MF bit plus the offset to detect fragments */
udp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
- (ipds->off &~ 0x6000));
+ ipds->off & (IP_MF|IP_OFFMASK));
break;
case IPPROTO_ICMP:
/* pass on the MF bit plus the offset to detect fragments */
icmp_print(ipds->cp, ipds->len, (const u_char *)ipds->ip,
- (ipds->off & 0x3fff));
+ ipds->off & (IP_MF|IP_OFFMASK));
break;
case IPPROTO_PIGP:
@@ -627,7 +636,7 @@ ip_print(netdissect_options *ndo,
}
if (ipds->ip->ip_ttl >= 1)
- (void)printf(", ttl %3u", ipds->ip->ip_ttl);
+ (void)printf(", ttl %u", ipds->ip->ip_ttl);
/*
* for the firewall guys, print id, offset.
@@ -635,19 +644,19 @@ ip_print(netdissect_options *ndo,
* For unfragmented datagrams, note the don't fragment flag.
*/
- (void)printf(", id %u, offset %u, flags [%s], proto: %s (%u)",
+ (void)printf(", id %u, offset %u, flags [%s], proto %s (%u)",
EXTRACT_16BITS(&ipds->ip->ip_id),
(ipds->off & 0x1fff) * 8,
- bittok2str(ip_frag_values, "none", ipds->off&0xe000 ),
+ bittok2str(ip_frag_values, "none", ipds->off&0xe000),
tok2str(ipproto_values,"unknown",ipds->ip->ip_p),
ipds->ip->ip_p);
- (void)printf(", length: %u", EXTRACT_16BITS(&ipds->ip->ip_len));
+ (void)printf(", length %u", EXTRACT_16BITS(&ipds->ip->ip_len));
if ((hlen - sizeof(struct ip)) > 0) {
- printf(", options ( ");
+ printf(", options (");
ip_optprint((u_char *)(ipds->ip + 1), hlen - sizeof(struct ip));
- printf(" )");
+ printf(")");
}
if ((u_char *)ipds->ip + hlen <= snapend) {
diff --git a/contrib/tcpdump/print-ip6.c b/contrib/tcpdump/print-ip6.c
index 5e6902d..4928734 100644
--- a/contrib/tcpdump/print-ip6.c
+++ b/contrib/tcpdump/print-ip6.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.3 2005/09/20 06:05:38 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.47.2.5 2007/09/21 07:07:52 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -95,7 +95,7 @@ ip6_print(register const u_char *bp, register u_int length)
(void)printf("flowlabel 0x%05x, ", flow & 0x000fffff);
#endif
- (void)printf("hlim %u, next-header: %s (%u), length: %u) ",
+ (void)printf("hlim %u, next-header %s (%u) payload length: %u) ",
ip6->ip6_hlim,
tok2str(ipproto_values,"unknown",ip6->ip6_nxt),
ip6->ip6_nxt,
@@ -227,7 +227,7 @@ ip6_print(register const u_char *bp, register u_int length)
return;
default:
- (void)printf("ip-proto-%d %d", ip6->ip6_nxt, len);
+ (void)printf("ip-proto-%d %d", nh, len);
return;
}
}
diff --git a/contrib/tcpdump/print-isoclns.c b/contrib/tcpdump/print-isoclns.c
index 7092ef2..2ea3a3d 100644
--- a/contrib/tcpdump/print-isoclns.c
+++ b/contrib/tcpdump/print-isoclns.c
@@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133.2.19 2005/09/20 10:15:22 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.133.2.25 2007/03/02 09:20:27 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -477,7 +477,7 @@ static struct tok isis_lsp_istype_values[] = {
{ ISIS_LSP_TYPE_UNUSED0, "Unused 0x0 (invalid)"},
{ ISIS_LSP_TYPE_LEVEL_1, "L1 IS"},
{ ISIS_LSP_TYPE_UNUSED2, "Unused 0x2 (invalid)"},
- { ISIS_LSP_TYPE_LEVEL_2, "L1L2 IS"},
+ { ISIS_LSP_TYPE_LEVEL_2, "L2 IS"},
{ 0, NULL }
};
@@ -1618,7 +1618,11 @@ static int
isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi) {
char ident_buffer[20];
+#ifdef INET6
u_int8_t prefix[sizeof(struct in6_addr)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
+#else
+ u_int8_t prefix[sizeof(struct in_addr)]; /* shared copy buffer for IPv4 prefixes */
+#endif
u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen;
if (!TTEST2(*tptr, 4))
@@ -1632,6 +1636,12 @@ isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi
return (0);
status_byte=*(tptr++);
bit_length = status_byte&0x3f;
+ if (bit_length > 32) {
+ printf("%sIPv4 prefix: bad bit length %u",
+ ident,
+ bit_length);
+ return (0);
+ }
processed++;
#ifdef INET6
} else if (afi == IPV6) {
@@ -1639,6 +1649,12 @@ isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi
return (0);
status_byte=*(tptr++);
bit_length=*(tptr++);
+ if (bit_length > 128) {
+ printf("%sIPv6 prefix: bad bit length %u",
+ ident,
+ bit_length);
+ return (0);
+ }
processed+=2;
#endif
} else
@@ -1648,7 +1664,7 @@ isis_print_extd_ip_reach (const u_int8_t *tptr, const char *ident, u_int16_t afi
if (!TTEST2(*tptr, byte_length))
return (0);
- memset(prefix, 0, sizeof(struct in6_addr)); /* clear the copy buffer */
+ memset(prefix, 0, sizeof prefix); /* clear the copy buffer */
memcpy(prefix,tptr,byte_length); /* copy as much as is stored in the TLV */
tptr+=byte_length;
processed+=byte_length;
@@ -2094,7 +2110,7 @@ static int isis_print (const u_int8_t *p, u_int length)
tlv_len);
if (tlv_len == 0) /* something is malformed */
- break;
+ continue;
/* now check if we have a decoder otherwise do a hexdump at the end*/
switch (tlv_type) {
@@ -2233,13 +2249,14 @@ static int isis_print (const u_int8_t *p, u_int length)
break;
case ISIS_TLV_MT_IP_REACH:
- while (tmp>0) {
- mt_len = isis_print_mtid(tptr, "\n\t ");
- if (mt_len == 0) /* did something go wrong ? */
- goto trunctlv;
- tptr+=mt_len;
- tmp-=mt_len;
+ mt_len = isis_print_mtid(tptr, "\n\t ");
+ if (mt_len == 0) { /* did something go wrong ? */
+ goto trunctlv;
+ }
+ tptr+=mt_len;
+ tmp-=mt_len;
+ while (tmp>0) {
ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV4);
if (ext_ip_len == 0) /* did something go wrong ? */
goto trunctlv;
@@ -2260,13 +2277,14 @@ static int isis_print (const u_int8_t *p, u_int length)
break;
case ISIS_TLV_MT_IP6_REACH:
- while (tmp>0) {
- mt_len = isis_print_mtid(tptr, "\n\t ");
- if (mt_len == 0) /* did something go wrong ? */
- goto trunctlv;
- tptr+=mt_len;
- tmp-=mt_len;
+ mt_len = isis_print_mtid(tptr, "\n\t ");
+ if (mt_len == 0) { /* did something go wrong ? */
+ goto trunctlv;
+ }
+ tptr+=mt_len;
+ tmp-=mt_len;
+ while (tmp>0) {
ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV6);
if (ext_ip_len == 0) /* did something go wrong ? */
goto trunctlv;
@@ -2516,7 +2534,7 @@ static int isis_print (const u_int8_t *p, u_int length)
if (!TTEST2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN))
goto trunctlv;
- printf(", Remaining holding time %us", EXTRACT_16BITS(tptr+1));
+ printf(", Remaining holding time %us", EXTRACT_16BITS(tptr));
tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
tmp-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
diff --git a/contrib/tcpdump/print-llc.c b/contrib/tcpdump/print-llc.c
index 3820f32..8ffd289 100644
--- a/contrib/tcpdump/print-llc.c
+++ b/contrib/tcpdump/print-llc.c
@@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.5 2005/09/29 07:40:13 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-llc.c,v 1.61.2.10 2007/02/08 07:07:51 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -82,20 +82,31 @@ static const struct tok llc_flag_values[] = {
{ LLC_GSAP, "Response" },
{ LLC_U_POLL, "Poll" },
{ LLC_GSAP|LLC_U_POLL, "Final" },
+ { LLC_IS_POLL, "Poll" },
{ LLC_GSAP|LLC_IS_POLL, "Final" },
{ 0, NULL }
};
+
+static const struct tok llc_ig_flag_values[] = {
+ { 0, "Individual" },
+ { LLC_IG, "Group" },
+ { 0, NULL }
+};
+
+
static const struct tok llc_supervisory_values[] = {
{ 0, "Receiver Ready" },
- { 1, "Reject" },
- { 2, "Receiver not Ready" },
+ { 1, "Receiver not Ready" },
+ { 2, "Reject" },
{ 0, NULL }
};
static const struct tok cisco_values[] = {
{ PID_CISCO_CDP, "CDP" },
+ { PID_CISCO_VTP, "VTP" },
+ { PID_CISCO_DTP, "DTP" },
{ 0, NULL }
};
@@ -114,6 +125,10 @@ static const struct tok bridged_values[] = {
{ 0, NULL },
};
+static const struct tok null_values[] = {
+ { 0, NULL }
+};
+
struct oui_tok {
u_int32_t oui;
const struct tok *tok;
@@ -140,6 +155,8 @@ llc_print(const u_char *p, u_int length, u_int caplen,
int is_u;
register int ret;
+ *extracted_ethertype = 0;
+
if (caplen < 3) {
(void)printf("[|llc]");
default_print((u_char *)p, caplen);
@@ -147,9 +164,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
}
dsap_field = *p;
- dsap = dsap_field & ~LLC_IG;
ssap_field = *(p + 1);
- ssap = ssap_field & ~LLC_GSAP;
/*
* OK, what type of LLC frame is this? The length
@@ -181,7 +196,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
is_u = 0;
}
- if (ssap == LLCSAP_GLOBAL && dsap == LLCSAP_GLOBAL) {
+ if (ssap_field == LLCSAP_GLOBAL && dsap_field == LLCSAP_GLOBAL) {
/*
* This is an Ethernet_802.3 IPX frame; it has an
* 802.3 header (i.e., an Ethernet header where the
@@ -204,17 +219,22 @@ llc_print(const u_char *p, u_int length, u_int caplen,
return (1);
}
+ dsap = dsap_field & ~LLC_IG;
+ ssap = ssap_field & ~LLC_GSAP;
+
if (eflag) {
- printf("LLC, dsap %s (0x%02x), ssap %s (0x%02x)",
+ printf("LLC, dsap %s (0x%02x) %s, ssap %s (0x%02x) %s",
tok2str(llc_values, "Unknown", dsap),
dsap,
+ tok2str(llc_ig_flag_values, "Unknown", dsap_field & LLC_IG),
tok2str(llc_values, "Unknown", ssap),
- ssap);
+ ssap,
+ tok2str(llc_flag_values, "Unknown", ssap_field & LLC_GSAP));
if (is_u) {
- printf(", cmd 0x%02x: ", control);
+ printf(", ctrl 0x%02x: ", control);
} else {
- printf(", cmd 0x%04x: ", control);
+ printf(", ctrl 0x%04x: ", control);
}
}
@@ -321,7 +341,7 @@ llc_print(const u_char *p, u_int length, u_int caplen,
if (is_u) {
printf("Unnumbered, %s, Flags [%s], length %u",
tok2str(llc_cmd_values, "%02x", LLC_U_CMD(control)),
- bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_U_POLL)),
+ tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_U_POLL)),
length);
p += 3;
@@ -337,18 +357,17 @@ llc_print(const u_char *p, u_int length, u_int caplen,
}
}
} else {
-
if ((control & LLC_S_FMT) == LLC_S_FMT) {
(void)printf("Supervisory, %s, rcv seq %u, Flags [%s], length %u",
tok2str(llc_supervisory_values,"?",LLC_S_CMD(control)),
LLC_IS_NR(control),
- bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_IS_POLL)),
+ tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_IS_POLL)),
length);
} else {
(void)printf("Information, send seq %u, rcv seq %u, Flags [%s], length %u",
LLC_I_NS(control),
LLC_IS_NR(control),
- bittok2str(llc_flag_values,"?",(ssap) | (control & LLC_IS_POLL)),
+ tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_IS_POLL)),
length);
}
p += 4;
@@ -371,7 +390,7 @@ snap_print(const u_char *p, u_int length, u_int caplen,
et = EXTRACT_16BITS(p + 3);
if (eflag) {
- const struct tok *tok = NULL;
+ const struct tok *tok = null_values;
const struct oui_tok *otp;
for (otp = &oui_to_tok[0]; otp->tok != NULL; otp++) {
diff --git a/contrib/tcpdump/print-nfs.c b/contrib/tcpdump/print-nfs.c
index 8929d73..e47f0f6 100644
--- a/contrib/tcpdump/print-nfs.c
+++ b/contrib/tcpdump/print-nfs.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.106.2.2 2005/05/06 07:57:18 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.106.2.4 2007/06/15 23:17:40 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -289,8 +289,12 @@ nfsreply_print(register const u_char *bp, u_int length,
register const u_char *bp2)
{
register const struct sunrpc_msg *rp;
- u_int32_t proc, vers;
+ u_int32_t proc, vers, reply_stat;
char srcid[20], dstid[20]; /*fits 32bit*/
+ enum sunrpc_reject_stat rstat;
+ u_int32_t rlow;
+ u_int32_t rhigh;
+ enum sunrpc_auth_stat rwhy;
nfserr = 0; /* assume no error */
rp = (const struct sunrpc_msg *)bp;
@@ -305,13 +309,83 @@ nfsreply_print(register const u_char *bp, u_int length,
EXTRACT_32BITS(&rp->rm_xid));
}
print_nfsaddr(bp2, srcid, dstid);
- (void)printf("reply %s %d",
- EXTRACT_32BITS(&rp->rm_reply.rp_stat) == SUNRPC_MSG_ACCEPTED?
- "ok":"ERR",
- length);
+ reply_stat = EXTRACT_32BITS(&rp->rm_reply.rp_stat);
+ switch (reply_stat) {
- if (xid_map_find(rp, bp2, &proc, &vers) >= 0)
- interp_reply(rp, proc, vers, length);
+ case SUNRPC_MSG_ACCEPTED:
+ (void)printf("reply ok %u", length);
+ if (xid_map_find(rp, bp2, &proc, &vers) >= 0)
+ interp_reply(rp, proc, vers, length);
+ break;
+
+ case SUNRPC_MSG_DENIED:
+ (void)printf("reply ERR %u: ", length);
+ rstat = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_stat);
+ switch (rstat) {
+
+ case SUNRPC_RPC_MISMATCH:
+ rlow = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.low);
+ rhigh = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.high);
+ (void)printf("RPC Version mismatch (%u-%u)",
+ rlow, rhigh);
+ break;
+
+ case SUNRPC_AUTH_ERROR:
+ rwhy = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_why);
+ (void)printf("Auth ");
+ switch (rwhy) {
+
+ case SUNRPC_AUTH_OK:
+ (void)printf("OK");
+ break;
+
+ case SUNRPC_AUTH_BADCRED:
+ (void)printf("Bogus Credentials (seal broken)");
+ break;
+
+ case SUNRPC_AUTH_REJECTEDCRED:
+ (void)printf("Rejected Credentials (client should begin new session)");
+ break;
+
+ case SUNRPC_AUTH_BADVERF:
+ (void)printf("Bogus Verifier (seal broken)");
+ break;
+
+ case SUNRPC_AUTH_REJECTEDVERF:
+ (void)printf("Verifier expired or was replayed");
+ break;
+
+ case SUNRPC_AUTH_TOOWEAK:
+ (void)printf("Credentials are too weak");
+ break;
+
+ case SUNRPC_AUTH_INVALIDRESP:
+ (void)printf("Bogus response verifier");
+ break;
+
+ case SUNRPC_AUTH_FAILED:
+ (void)printf("Unknown failure");
+ break;
+
+ default:
+ (void)printf("Invalid failure code %u",
+ (unsigned int)rwhy);
+ break;
+ }
+ break;
+
+ default:
+ (void)printf("Unknown reason for rejecting rpc message %u",
+ (unsigned int)rstat);
+ break;
+ }
+ break;
+
+ default:
+ (void)printf("reply Unknown rpc response code=%u %u",
+ reply_stat, length);
+ break;
+ }
}
/*
diff --git a/contrib/tcpdump/print-null.c b/contrib/tcpdump/print-null.c
index bb6ab3c..b525600 100644
--- a/contrib/tcpdump/print-null.c
+++ b/contrib/tcpdump/print-null.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53.2.3 2005/07/07 01:24:38 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.53.2.4 2007/02/26 13:31:33 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -38,6 +38,7 @@ static const char rcsid[] _U_ =
#include "interface.h"
#include "addrtoname.h"
+#include "af.h"
#include "ip.h"
#ifdef INET6
@@ -56,34 +57,6 @@ static const char rcsid[] _U_ =
*/
#define NULL_HDRLEN 4
-/*
- * BSD AF_ values.
- *
- * Unfortunately, the BSDs don't all use the same value for AF_INET6,
- * so, because we want to be able to read captures from all of the BSDs,
- * we check for all of them.
- */
-#define BSD_AF_INET 2
-#define BSD_AF_NS 6 /* XEROX NS protocols */
-#define BSD_AF_ISO 7
-#define BSD_AF_APPLETALK 16
-#define BSD_AF_IPX 23
-#define BSD_AF_INET6_BSD 24 /* OpenBSD (and probably NetBSD), BSD/OS */
-#define BSD_AF_INET6_FREEBSD 28
-#define BSD_AF_INET6_DARWIN 30
-
-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}
-};
-
/*
* Byte-swap a 32-bit number.
@@ -147,27 +120,27 @@ null_if_print(const struct pcap_pkthdr *h, const u_char *p)
switch (family) {
- case BSD_AF_INET:
+ case BSD_AFNUM_INET:
ip_print(gndo, p, length);
break;
#ifdef INET6
- case BSD_AF_INET6_BSD:
- case BSD_AF_INET6_FREEBSD:
- case BSD_AF_INET6_DARWIN:
+ case BSD_AFNUM_INET6_BSD:
+ case BSD_AFNUM_INET6_FREEBSD:
+ case BSD_AFNUM_INET6_DARWIN:
ip6_print(p, length);
break;
#endif
- case BSD_AF_ISO:
+ case BSD_AFNUM_ISO:
isoclns_print(p, length, caplen);
break;
- case BSD_AF_APPLETALK:
+ case BSD_AFNUM_APPLETALK:
atalk_print(p, length);
break;
- case BSD_AF_IPX:
+ case BSD_AFNUM_IPX:
ipx_print(p, length);
break;
diff --git a/contrib/tcpdump/print-pim.c b/contrib/tcpdump/print-pim.c
index a99d060..d539809 100644
--- a/contrib/tcpdump/print-pim.c
+++ b/contrib/tcpdump/print-pim.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45.2.3 2005/07/11 20:24:34 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.45.2.4 2006/02/13 01:32:34 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -81,6 +81,15 @@ static struct tok pimv2_hello_option_values[] = {
{ 0, NULL}
};
+#define PIMV2_REGISTER_FLAG_LEN 4
+#define PIMV2_REGISTER_FLAG_BORDER 0x80000000
+#define PIMV2_REGISTER_FLAG_NULL 0x40000000
+
+static struct tok pimv2_register_flag_values[] = {
+ { PIMV2_REGISTER_FLAG_BORDER, "Border" },
+ { PIMV2_REGISTER_FLAG_NULL, "Null" },
+ { 0, NULL}
+};
/*
* XXX: We consider a case where IPv6 is not ready yet for portability,
@@ -421,13 +430,13 @@ pim_print(register const u_char *bp, register u_int len)
switch (PIM_VER(pim->pim_typever)) {
case 2:
if (!vflag) {
- printf("PIMv%u, %s, length: %u",
+ printf("PIMv%u, %s, length %u",
PIM_VER(pim->pim_typever),
tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
len);
return;
} else {
- printf("PIMv%u, length: %u\n\t%s",
+ printf("PIMv%u, length %u\n\t%s",
PIM_VER(pim->pim_typever),
len,
tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)));
@@ -435,7 +444,7 @@ pim_print(register const u_char *bp, register u_int len)
}
break;
default:
- printf("PIMv%u, length: %u",
+ printf("PIMv%u, length %u",
PIM_VER(pim->pim_typever),
len);
break;
@@ -627,6 +636,15 @@ pimv2_print(register const u_char *bp, register u_int len)
if (pimv2_addr_len != 0)
(void)printf(", RFC2117-encoding");
+ printf(", cksum 0x%04x ", EXTRACT_16BITS(&pim->pim_cksum));
+ if (EXTRACT_16BITS(&pim->pim_cksum) == 0) {
+ printf("(unverified)");
+ } else {
+ printf("(%scorrect)",
+ TTEST2(bp[0], len) &&
+ in_cksum((const u_short*)bp, len, 0) ? "in" : "" );
+ }
+
switch (PIM_TYPE(pim->pim_typever)) {
case PIMV2_TYPE_HELLO:
{
@@ -638,7 +656,7 @@ pimv2_print(register const u_char *bp, register u_int len)
olen = EXTRACT_16BITS(&bp[2]);
TCHECK2(bp[0], 4 + olen);
- printf("\n\t %s Option (%u), length: %u, Value: ",
+ printf("\n\t %s Option (%u), length %u, Value: ",
tok2str( pimv2_hello_option_values,"Unknown",otype),
otype,
olen);
@@ -731,30 +749,35 @@ pimv2_print(register const u_char *bp, register u_int len)
{
struct ip *ip;
- if (vflag && bp + 8 <= ep) {
- (void)printf(" %s%s", bp[4] & 0x80 ? "B" : "",
- bp[4] & 0x40 ? "N" : "");
- }
- bp += 8; len -= 8;
+ if (!TTEST2(*(bp+4), PIMV2_REGISTER_FLAG_LEN))
+ goto trunc;
+
+ printf(", Flags [ %s ]\n\t",
+ tok2str(pimv2_register_flag_values,
+ "none",
+ EXTRACT_32BITS(bp+4)));
+ bp += 8; len -= 8;
/* encapsulated multicast packet */
- if (bp >= ep)
- break;
ip = (struct ip *)bp;
switch (IP_V(ip)) {
+ case 0: /* Null header */
+ (void)printf("IP-Null-header %s > %s",
+ ipaddr_string(&ip->ip_src),
+ ipaddr_string(&ip->ip_dst));
+ break;
+
case 4: /* IPv4 */
- printf(" ");
ip_print(gndo, bp, len);
break;
#ifdef INET6
case 6: /* IPv6 */
- printf(" ");
ip6_print(bp, len);
break;
#endif
- default:
- (void)printf(" IP ver %d", IP_V(ip));
- break;
+ default:
+ (void)printf("IP ver %d", IP_V(ip));
+ break;
}
break;
}
diff --git a/contrib/tcpdump/print-ppp.c b/contrib/tcpdump/print-ppp.c
index 3c48c78..e25930b 100644
--- a/contrib/tcpdump/print-ppp.c
+++ b/contrib/tcpdump/print-ppp.c
@@ -33,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108.2.4 2005/06/18 23:56:40 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.108.2.6 2005/12/05 11:40:36 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -298,6 +298,20 @@ struct tok ipcpopt_values[] = {
{ 0, NULL }
};
+#define IPCPOPT_IPCOMP_HDRCOMP 0x61 /* rfc3544 */
+#define IPCPOPT_IPCOMP_MINLEN 14
+
+struct tok ipcpopt_compproto_values[] = {
+ { PPP_VJC, "VJ-Comp" },
+ { IPCPOPT_IPCOMP_HDRCOMP, "IP Header Compression" },
+ { 0, NULL }
+};
+
+struct tok ipcpopt_compproto_subopt_values[] = {
+ { 1, "RTP-Compression" },
+ { 2, "Enhanced RTP-Compression" },
+ { 0, NULL }
+};
/* IP6CP Config Options */
#define IP6CP_IFID 1
@@ -533,8 +547,9 @@ handle_ctrl_proto(u_int proto, const u_char *pptr, int length)
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);
+ printf("\n\t -----trailing data-----");
+ TCHECK2(tptr[4], len-8);
+ print_unknown_data(tptr+4,"\n\t ",len-8);
}
break;
case CPCODES_ID:
@@ -966,6 +981,7 @@ static int
print_ipcp_config_options(const u_char *p, int length)
{
int len, opt;
+ u_int compproto, ipcomp_subopttotallen, ipcomp_subopt, ipcomp_suboptlen;
if (length < 2)
return 0;
@@ -1000,11 +1016,62 @@ print_ipcp_config_options(const u_char *p, int length)
if (len < 4)
goto invlen;
TCHECK2(*(p + 2), 2);
- if (EXTRACT_16BITS(p + 2) == PPP_VJC) {
- printf("VJ-Comp");
+ compproto = EXTRACT_16BITS(p+2);
+
+ printf("%s (0x%02x):",
+ tok2str(ipcpopt_compproto_values,"Unknown",compproto),
+ compproto);
+
+ switch (compproto) {
+ case PPP_VJC:
/* XXX: VJ-Comp parameters should be decoded */
- } else
- printf("unknown-comp-proto %04x", EXTRACT_16BITS(p + 2));
+ break;
+ case IPCPOPT_IPCOMP_HDRCOMP:
+ if (len < IPCPOPT_IPCOMP_MINLEN)
+ goto invlen;
+
+ TCHECK2(*(p + 2), IPCPOPT_IPCOMP_MINLEN);
+ printf("\n\t TCP Space %u, non-TCP Space %u" \
+ ", maxPeriod %u, maxTime %u, maxHdr %u",
+ EXTRACT_16BITS(p+4),
+ EXTRACT_16BITS(p+6),
+ EXTRACT_16BITS(p+8),
+ EXTRACT_16BITS(p+10),
+ EXTRACT_16BITS(p+12));
+
+ /* suboptions present ? */
+ if (len > IPCPOPT_IPCOMP_MINLEN) {
+ ipcomp_subopttotallen = len - IPCPOPT_IPCOMP_MINLEN;
+ p += IPCPOPT_IPCOMP_MINLEN;
+
+ printf("\n\t Suboptions, length %u", ipcomp_subopttotallen);
+
+ while (ipcomp_subopttotallen >= 2) {
+ TCHECK2(*p, 2);
+ ipcomp_subopt = *p;
+ ipcomp_suboptlen = *(p+1);
+
+ /* sanity check */
+ if (ipcomp_subopt == 0 ||
+ ipcomp_suboptlen == 0 )
+ break;
+
+ /* XXX: just display the suboptions for now */
+ printf("\n\t\t%s Suboption #%u, length %u",
+ tok2str(ipcpopt_compproto_subopt_values,
+ "Unknown",
+ ipcomp_subopt),
+ ipcomp_subopt,
+ ipcomp_suboptlen);
+
+ ipcomp_subopttotallen -= ipcomp_suboptlen;
+ p += ipcomp_suboptlen;
+ }
+ }
+ break;
+ default:
+ break;
+ }
break;
case IPCPOPT_ADDR: /* those options share the same format - fall through */
diff --git a/contrib/tcpdump/print-token.c b/contrib/tcpdump/print-token.c
index 0a80fb6..8a5f4f5 100644
--- a/contrib/tcpdump/print-token.c
+++ b/contrib/tcpdump/print-token.c
@@ -27,7 +27,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.25.2.1 2005/07/07 01:24:40 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-token.c,v 1.25.2.2 2005/11/13 12:13:01 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
@@ -155,7 +155,6 @@ token_print(const u_char *p, u_int length, u_int caplen)
caplen -= hdr_len;
/* Frame Control field determines interpretation of packet */
- extracted_ethertype = 0;
if (FRAME_TYPE(trp) == TOKEN_FC_LLC) {
/* Try to print the LLC-layer header & higher layers */
if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
diff --git a/contrib/tcpdump/print-udp.c b/contrib/tcpdump/print-udp.c
index 089da1a..d530d6a 100644
--- a/contrib/tcpdump/print-udp.c
+++ b/contrib/tcpdump/print-udp.c
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.138 2005/04/07 00:28:17 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.138.2.1 2007/03/28 07:45:46 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -676,6 +676,8 @@ udp_print(register const u_char *bp, u_int length,
lwres_print((const u_char *)(up + 1), length);
else if (ISPORT(LDP_PORT))
ldp_print((const u_char *)(up + 1), length);
+ else if (ISPORT(OLSR_PORT))
+ olsr_print((const u_char *)(up + 1), length);
else if (ISPORT(MPLS_LSP_PING_PORT))
lspping_print((const u_char *)(up + 1), length);
else if (dport == BFD_CONTROL_PORT ||
diff --git a/contrib/tcpdump/tcpdump-stdinc.h b/contrib/tcpdump/tcpdump-stdinc.h
index 337d45e..4e599c3 100644
--- a/contrib/tcpdump/tcpdump-stdinc.h
+++ b/contrib/tcpdump/tcpdump-stdinc.h
@@ -29,9 +29,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
- * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12.2.4 2005/07/09 21:19:45 risso Exp $ (LBL)
- *
* $FreeBSD$
+ * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.12.2.5 2006/06/23 02:07:27 hannes Exp $ (LBL)
*/
/*
@@ -149,4 +148,12 @@ typedef char* caddr_t;
#define INET_ADDRSTRLEN 16
#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
#endif /* tcpdump_stdinc_h */
diff --git a/contrib/tcpdump/tcpdump.1 b/contrib/tcpdump/tcpdump.1
index 1dc0340f..8b70af2 100644
--- a/contrib/tcpdump/tcpdump.1
+++ b/contrib/tcpdump/tcpdump.1
@@ -1,4 +1,4 @@
-.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167.2.6 2005/09/05 09:14:37 guy Exp $ (LBL)
+.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.167.2.11 2007/06/15 20:13:49 guy Exp $ (LBL)
.\"
.\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $
.\"
@@ -112,8 +112,9 @@ tcpdump \- dump traffic on a network
.ad
.SH DESCRIPTION
.LP
-\fITcpdump\fP prints out the headers of packets on a network interface
-that match the boolean \fIexpression\fP. It can also be run with the
+\fITcpdump\fP prints out a description of the contents of packets on a
+network interface that match the boolean \fIexpression\fP. It can also
+be run with the
.B \-w
flag, which causes it to save the packet data to a file for later
analysis, and/or with the
@@ -240,7 +241,10 @@ operation, be enabled on that interface.
.TP
.B Under BSD (this includes Mac OS X):
You must have read access to
-.IR /dev/bpf* .
+.I /dev/bpf*
+on systems that don't have a cloning BPF device, or to
+.I /dev/bpf
+on systems that do.
On BSDs with a devfs (this includes Mac OS X), this might involve more
than just having somebody with super-user access setting the ownership
or permissions on the BPF devices - it might involve configuring devfs
@@ -543,7 +547,7 @@ Standard output is used if \fIfile\fR is ``-''.
.TP
.B \-W
Used in conjunction with the
-.I \-C
+.B \-C
option, this will limit the number
of files created to the specified number, and begin overwriting files
from the beginning, thus creating a 'rotating' buffer.
@@ -552,7 +556,9 @@ the files with enough leading 0s to support the maximum number of
files, allowing them to sort correctly.
.TP
.B \-x
-Print each packet (minus its link level header) in hex.
+When parsing and printing,
+in addition to printing the headers of each packet, print the data of
+each packet (minus its link level header) in hex.
The smaller of the entire packet or
.I snaplen
bytes will be printed. Note that this is the entire link-layer
@@ -561,16 +567,22 @@ will also be printed when the higher layer packet is shorter than the
required padding.
.TP
.B \-xx
-Print each packet,
+When parsing and printing,
+in addition to printing the headers of each packet, print the data of
+each packet,
.I including
its link level header, in hex.
.TP
.B \-X
-Print each packet (minus its link level header) in hex and ASCII.
+When parsing and printing,
+in addition to printing the headers of each packet, print the data of
+each packet (minus its link level header) in hex and ASCII.
This is very handy for analysing new protocols.
.TP
.B \-XX
-Print each packet,
+When parsing and printing,
+in addition to printing the headers of each packet, print the data of
+each packet,
.I including
its link level header, in hex and ASCII.
.TP
@@ -757,8 +769,16 @@ This syntax does not work in IPv6-enabled configuration at this moment.
.IP "\fBdst net \fInet\fR"
True if the IPv4/v6 destination address of the packet has a network
number of \fInet\fP.
-\fINet\fP may be either a name from /etc/networks
-or a network number (see \fInetworks(4)\fP for details).
+\fINet\fP may be either a name from the networks database
+(/etc/networks, etc.) or a network number.
+An IPv4 network number can be written as a dotted quad (e.g., 192.168.1.0),
+dotted triple (e.g., 192.168.1), dotted pair (e.g, 172.16), or single
+number (e.g., 10); the netmask is 255.255.255.255 for a dotted quad
+(which means that it's really a host match), 255.255.255.0 for a dotted
+triple, 255.255.0.0 for a dotted pair, or 255.0.0.0 for a single number.
+An IPv6 network number must be written out fully; the netmask is
+ff:ff:ff:ff:ff:ff:ff:ff, so IPv6 "network" matches are really always
+host matches, and a network match requires a netmask length.
.IP "\fBsrc net \fInet\fR"
True if the IPv4/v6 source address of the packet has a network
number of \fInet\fP.
diff --git a/contrib/tcpdump/tcpdump.c b/contrib/tcpdump/tcpdump.c
index 1730463..69fa694 100644
--- a/contrib/tcpdump/tcpdump.c
+++ b/contrib/tcpdump/tcpdump.c
@@ -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.2.11 2005/08/23 10:29:41 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.253.2.13 2007/09/12 19:48:51 guy Exp $ (LBL)";
#endif
/* $FreeBSD$ */
@@ -192,7 +192,7 @@ static struct printer printers[] = {
#ifdef DLT_LTALK
{ ltalk_if_print, DLT_LTALK },
#endif
-#ifdef DLT_PFLOG
+#if defined(DLT_PFLOG) && defined(HAVE_NET_PFVAR_H)
{ pflog_if_print, DLT_PFLOG },
#endif
#ifdef DLT_FR
@@ -267,6 +267,9 @@ static struct printer printers[] = {
#ifdef DLT_JUNIPER_CHDLC
{ juniper_chdlc_print, DLT_JUNIPER_CHDLC },
#endif
+#ifdef DLT_MFR
+ { mfr_if_print, DLT_MFR },
+#endif
{ NULL, 0 },
};
OpenPOWER on IntegriCloud