aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-01-23 08:55:37 +0000
committerGuy Harris <guy@alum.mit.edu>2000-01-23 08:55:37 +0000
commit2461d79698e685644e2f07ee46381a092348461c (patch)
tree8647292ca380ae9108970a167959b9df1c931ec9
parent42d68156a9599948fb0c5c633efc9d61548d5a5b (diff)
In "dissect_eth()", update "pi.len" and "pi.captured_len" regardless of
whether we're building a protocol tree or not. Make "dissect_eth()" use "BYTES_ARE_IN_FRAME()" to see if we have a full Ethernet header - it can be called with a non-zero offset, if Ethernet frames are encapsulated inside other frames (e.g., ATM LANE). Make capture routines take an "offset" argument if the corresponding dissect routine takes one (for symmetry, and for Cisco ISL or any other protocol that encapsulates Ethernet or Token-Ring frames inside other frames). Pass the frame lengths to capture routines via the "pi" structure, rather than as an in-line argument, so that they can macros such as "BYTES_ARE_IN_FRAME()" the way the corresponding dissect routines do. Make capture routines update "pi.len" and "pi.captured_len" the same way the corresponding diseect routines do, if the capture routines then call other capture routines. Make "capture_vlan()" count as "other" frames that are too short, the way other capture routines do. svn path=/trunk/; revision=1525
-rw-r--r--capture.c20
-rw-r--r--ethertype.c12
-rw-r--r--packet-clip.c6
-rw-r--r--packet-eth.c67
-rw-r--r--packet-fddi.c11
-rw-r--r--packet-ip.c8
-rw-r--r--packet-ipx.c4
-rw-r--r--packet-llc.c12
-rw-r--r--packet-netbios.c5
-rw-r--r--packet-null.c10
-rw-r--r--packet-ppp.c10
-rw-r--r--packet-raw.c8
-rw-r--r--packet-tr.c12
-rw-r--r--packet-vines.c4
-rw-r--r--packet-vlan.c11
-rw-r--r--packet.h35
16 files changed, 127 insertions, 108 deletions
diff --git a/capture.c b/capture.c
index d86a82ba23..2f523e6c38 100644
--- a/capture.c
+++ b/capture.c
@@ -1,7 +1,7 @@
/* capture.c
* Routines for packet capture windows
*
- * $Id: capture.c,v 1.90 2000/01/20 21:34:12 guy Exp $
+ * $Id: capture.c,v 1.91 2000/01/23 08:55:30 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -861,26 +861,32 @@ capture_pcap_cb(u_char *user, const struct pcap_pkthdr *phdr,
/* XXX - do something if this fails */
wtap_dump(ld->pdh, &whdr, pd, &err);
}
+
+ /* Set the initial payload to the packet length, and the initial
+ captured payload to the capture length (other protocols may
+ reduce them if their headers say they're less). */
+ pi.len = phdr->len;
+ pi.captured_len = phdr->caplen;
switch (ld->linktype) {
case WTAP_ENCAP_ETHERNET:
- capture_eth(pd, phdr->caplen, &ld->counts);
+ capture_eth(pd, 0, &ld->counts);
break;
case WTAP_ENCAP_FDDI:
case WTAP_ENCAP_FDDI_BITSWAPPED:
- capture_fddi(pd, phdr->caplen, &ld->counts);
+ capture_fddi(pd, &ld->counts);
break;
case WTAP_ENCAP_TR:
- capture_tr(pd, phdr->caplen, &ld->counts);
+ capture_tr(pd, 0, &ld->counts);
break;
case WTAP_ENCAP_NULL:
- capture_null(pd, phdr->caplen, &ld->counts);
+ capture_null(pd, &ld->counts);
break;
case WTAP_ENCAP_PPP:
- capture_ppp(pd, phdr->caplen, &ld->counts);
+ capture_ppp(pd, &ld->counts);
break;
case WTAP_ENCAP_RAW_IP:
- capture_raw(pd, phdr->caplen, &ld->counts);
+ capture_raw(pd, &ld->counts);
break;
/* XXX - FreeBSD may append 4-byte ATM pseudo-header to DLT_ATM_RFC1483,
with LLC header following; we should implement it at some
diff --git a/ethertype.c b/ethertype.c
index e7012db419..43a3d141a0 100644
--- a/ethertype.c
+++ b/ethertype.c
@@ -2,7 +2,7 @@
* Routines for calling the right protocol for the ethertype.
* This is called by both packet-eth.c (Ethernet II) and packet-llc.c (SNAP)
*
- * $Id: ethertype.c,v 1.25 2000/01/22 06:22:12 guy Exp $
+ * $Id: ethertype.c,v 1.26 2000/01/23 08:55:31 guy Exp $
*
* Gilbert Ramirez <gram@xiexie.org>
*
@@ -57,20 +57,20 @@ const value_string etype_vals[] = {
void
capture_ethertype(guint16 etype, int offset,
- const u_char *pd, guint32 cap_len, packet_counts *ld)
+ const u_char *pd, packet_counts *ld)
{
switch (etype) {
case ETHERTYPE_IP:
- capture_ip(pd, offset, cap_len, ld);
+ capture_ip(pd, offset, ld);
break;
case ETHERTYPE_IPX:
- capture_ipx(pd, offset, cap_len, ld);
+ capture_ipx(pd, offset, ld);
break;
case ETHERTYPE_VLAN:
- capture_vlan(pd, offset, cap_len, ld);
+ capture_vlan(pd, offset, ld);
break;
case ETHERTYPE_VINES:
- capture_vines(pd, offset, cap_len, ld);
+ capture_vines(pd, offset, ld);
break;
default:
ld->other++;
diff --git a/packet-clip.c b/packet-clip.c
index cfc4c0fd50..d873d21a01 100644
--- a/packet-clip.c
+++ b/packet-clip.c
@@ -1,7 +1,7 @@
/* packet-clip.c
* Routines for clip packet disassembly
*
- * $Id: packet-clip.c,v 1.3 1999/11/16 11:42:28 guy Exp $
+ * $Id: packet-clip.c,v 1.4 2000/01/23 08:55:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -39,9 +39,9 @@
static gint ett_clip = -1;
void
-capture_clip( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
+capture_clip( const u_char *pd, packet_counts *ld ) {
- capture_ip(pd, 0, cap_len, ld);
+ capture_ip(pd, 0, ld);
}
void
diff --git a/packet-eth.c b/packet-eth.c
index 78a352be9e..41b455cdb9 100644
--- a/packet-eth.c
+++ b/packet-eth.c
@@ -1,7 +1,7 @@
/* packet-eth.c
* Routines for ethernet packet disassembly
*
- * $Id: packet-eth.c,v 1.25 1999/11/30 23:56:35 gram Exp $
+ * $Id: packet-eth.c,v 1.26 2000/01/23 08:55:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -65,46 +65,58 @@ static gint ett_ether2 = -1;
#define ETHERNET_SNAP 3
void
-capture_eth(const u_char *pd, guint32 cap_len, packet_counts *ld) {
- guint16 etype;
- int offset = ETH_HEADER_SIZE;
+capture_eth(const u_char *pd, int offset, packet_counts *ld)
+{
+ guint16 etype, length;
int ethhdr_type; /* the type of ethernet frame */
- if (cap_len < ETH_HEADER_SIZE) {
+ if (!BYTES_ARE_IN_FRAME(offset, ETH_HEADER_SIZE)) {
ld->other++;
return;
}
- etype = (pd[12] << 8) | pd[13];
+ etype = pntohs(&pd[offset+12]);
/* either ethernet802.3 or ethernet802.2 */
if (etype <= IEEE_802_3_MAX_LEN) {
+ length = etype;
- /* Is there an 802.2 layer? I can tell by looking at the first 2
- bytes after the 802.3 header. If they are 0xffff, then what
- follows the 802.3 header is an IPX payload, meaning no 802.2.
- (IPX/SPX is they only thing that can be contained inside a
- straight 802.3 packet). A non-0xffff value means that there's an
- 802.2 layer inside the 802.3 layer */
- if (pd[14] == 0xff && pd[15] == 0xff) {
+ /* Is there an 802.2 layer? I can tell by looking at the first 2
+ bytes after the 802.3 header. If they are 0xffff, then what
+ follows the 802.3 header is an IPX payload, meaning no 802.2.
+ (IPX/SPX is they only thing that can be contained inside a
+ straight 802.3 packet). A non-0xffff value means that there's an
+ 802.2 layer inside the 802.3 layer */
+ if (pd[offset+14] == 0xff && pd[offset+15] == 0xff) {
ethhdr_type = ETHERNET_802_3;
}
else {
ethhdr_type = ETHERNET_802_2;
}
+
+ /* Convert the LLC length from the 802.3 header to a total
+ length, by adding in the Ethernet header size, and set
+ the payload and captured-payload lengths to the minima
+ of the total length and the frame lengths. */
+ length += ETH_HEADER_SIZE;
+ if (pi.len > length)
+ pi.len = length;
+ if (pi.captured_len > length)
+ pi.captured_len = length;
} else {
ethhdr_type = ETHERNET_II;
}
+ offset += ETH_HEADER_SIZE;
switch (ethhdr_type) {
case ETHERNET_802_3:
- capture_ipx(pd, offset, cap_len, ld);
+ capture_ipx(pd, offset, ld);
break;
case ETHERNET_802_2:
- capture_llc(pd, offset, cap_len, ld);
+ capture_llc(pd, offset, ld);
break;
case ETHERNET_II:
- capture_ethertype(etype, offset, pd, cap_len, ld);
+ capture_ethertype(etype, offset, pd, ld);
break;
}
}
@@ -115,8 +127,8 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
proto_tree *fh_tree = NULL;
proto_item *ti;
int ethhdr_type; /* the type of ethernet frame */
-
- if (fd->cap_len < ETH_HEADER_SIZE) {
+
+ if (!BYTES_ARE_IN_FRAME(offset, ETH_HEADER_SIZE)) {
dissect_data(pd, offset, fd, tree);
return;
}
@@ -162,18 +174,17 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
proto_tree_add_item(fh_tree, hf_eth_dst, offset+0, 6, &pd[offset+0]);
proto_tree_add_item(fh_tree, hf_eth_src, offset+6, 6, &pd[offset+6]);
proto_tree_add_item(fh_tree, hf_eth_len, offset+12, 2, length);
-
- /* Convert the LLC length from the 802.3 header to a total
- length, by adding in the Ethernet header size, and set
- the payload and captured-payload lengths to the minima
- of the total length and the frame lengths. */
- length += ETH_HEADER_SIZE;
- if (pi.len > length)
- pi.len = length;
- if (pi.captured_len > length)
- pi.captured_len = length;
}
+ /* Convert the LLC length from the 802.3 header to a total
+ length, by adding in the Ethernet header size, and set
+ the payload and captured-payload lengths to the minima
+ of the total length and the frame lengths. */
+ length += ETH_HEADER_SIZE;
+ if (pi.len > length)
+ pi.len = length;
+ if (pi.captured_len > length)
+ pi.captured_len = length;
} else {
ethhdr_type = ETHERNET_II;
if (check_col(fd, COL_INFO))
diff --git a/packet-fddi.c b/packet-fddi.c
index cdfae657b5..a044ac87be 100644
--- a/packet-fddi.c
+++ b/packet-fddi.c
@@ -3,7 +3,7 @@
*
* Laurent Deniel <deniel@worldnet.fr>
*
- * $Id: packet-fddi.c,v 1.25 1999/11/16 11:42:30 guy Exp $
+ * $Id: packet-fddi.c,v 1.26 2000/01/23 08:55:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -137,10 +137,11 @@ swap_mac_addr(u_char *swapped_addr, const u_char *orig_addr)
void
-capture_fddi(const u_char *pd, guint32 cap_len, packet_counts *ld) {
+capture_fddi(const u_char *pd, packet_counts *ld)
+{
int offset = 0, fc;
- if (cap_len < FDDI_HEADER_SIZE) {
+ if (!BYTES_ARE_IN_FRAME(0, FDDI_HEADER_SIZE)) {
ld->other++;
return;
}
@@ -168,7 +169,7 @@ capture_fddi(const u_char *pd, guint32 cap_len, packet_counts *ld) {
case FDDI_FC_LLC_ASYNC + 13 :
case FDDI_FC_LLC_ASYNC + 14 :
case FDDI_FC_LLC_ASYNC + 15 :
- capture_llc(pd, offset, cap_len, ld);
+ capture_llc(pd, offset, ld);
return;
default :
ld->other++;
@@ -259,7 +260,7 @@ void dissect_fddi(const u_char *pd, frame_data *fd, proto_tree *tree,
static u_char src[6], dst[6];
u_char src_swapped[6], dst_swapped[6];
- if (fd->cap_len < FDDI_HEADER_SIZE) {
+ if (!BYTES_ARE_IN_FRAME(0, FDDI_HEADER_SIZE)) {
dissect_data(pd, offset, fd, tree);
return;
}
diff --git a/packet-ip.c b/packet-ip.c
index b539534497..c1bb7e69a2 100644
--- a/packet-ip.c
+++ b/packet-ip.c
@@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
- * $Id: packet-ip.c,v 1.69 2000/01/20 21:34:12 guy Exp $
+ * $Id: packet-ip.c,v 1.70 2000/01/23 08:55:32 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -311,7 +311,11 @@ typedef struct _e_ip
void
-capture_ip(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld) {
+capture_ip(const u_char *pd, int offset, packet_counts *ld) {
+ if (!BYTES_ARE_IN_FRAME(offset, IPH_MIN_LEN)) {
+ ld->other++;
+ return;
+ }
switch (pd[offset + 9]) {
case IP_PROTO_TCP:
ld->tcp++;
diff --git a/packet-ipx.c b/packet-ipx.c
index 8a58fd392d..8cce00579f 100644
--- a/packet-ipx.c
+++ b/packet-ipx.c
@@ -2,7 +2,7 @@
* Routines for NetWare's IPX
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-ipx.c,v 1.46 2000/01/22 06:22:13 guy Exp $
+ * $Id: packet-ipx.c,v 1.47 2000/01/23 08:55:33 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -336,7 +336,7 @@ ipxnet_to_str_punct(const guint32 ad, char punct) {
}
void
-capture_ipx(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld)
+capture_ipx(const u_char *pd, int offset, packet_counts *ld)
{
ld->ipx++;
}
diff --git a/packet-llc.c b/packet-llc.c
index ccf7b19306..b6bca3f384 100644
--- a/packet-llc.c
+++ b/packet-llc.c
@@ -2,7 +2,7 @@
* Routines for IEEE 802.2 LLC layer
* Gilbert Ramirez <gramirez@tivoli.com>
*
- * $Id: packet-llc.c,v 1.40 2000/01/22 21:49:50 gerald Exp $
+ * $Id: packet-llc.c,v 1.41 2000/01/23 08:55:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -51,7 +51,7 @@ static int hf_llc_pid = -1;
static gint ett_llc = -1;
static gint ett_llc_ctrl = -1;
-typedef void (capture_func_t)(const u_char *, int, guint32, packet_counts *);
+typedef void (capture_func_t)(const u_char *, int, packet_counts *);
typedef void (dissect_func_t)(const u_char *, int, frame_data *, proto_tree *);
/* The SAP info is split into two tables, one value_string table and one table of sap_info. This is
@@ -198,7 +198,7 @@ sap_dissect_func(u_char sap) {
}
void
-capture_llc(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld) {
+capture_llc(const u_char *pd, int offset, packet_counts *ld) {
int is_snap;
guint16 control;
@@ -249,11 +249,11 @@ capture_llc(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld) {
OUI_ENCAP_ETHER and an Ethernet
packet type for AARP packets. */
capture_ethertype(etype, offset+8, pd,
- cap_len, ld);
+ ld);
break;
case OUI_CISCO:
capture_ethertype(etype,
- offset + 8, pd, cap_len, ld);
+ offset + 8, pd, ld);
break;
default:
ld->other++;
@@ -272,7 +272,7 @@ capture_llc(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld) {
offset += llc_header_len;
if (capture) {
- capture(pd, offset, cap_len, ld);
+ capture(pd, offset, ld);
}
else {
ld->other++;
diff --git a/packet-netbios.c b/packet-netbios.c
index 8ceb02c69c..f9386cca66 100644
--- a/packet-netbios.c
+++ b/packet-netbios.c
@@ -5,7 +5,7 @@
*
* derived from the packet-nbns.c
*
- * $Id: packet-netbios.c,v 1.13 2000/01/16 02:54:48 guy Exp $
+ * $Id: packet-netbios.c,v 1.14 2000/01/23 08:55:34 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -178,8 +178,7 @@ static char *CommandName[] = {
"Session Alive", /* 0x1f */
};
-void capture_netbios(const u_char *pd, int offset, guint32 cap_len,
- packet_counts *ld)
+void capture_netbios(const u_char *pd, int offset, packet_counts *ld)
{
ld->netbios++;
}
diff --git a/packet-null.c b/packet-null.c
index 3eaf2682ee..8cc9a31b46 100644
--- a/packet-null.c
+++ b/packet-null.c
@@ -1,7 +1,7 @@
/* packet-null.c
* Routines for null packet disassembly
*
- * $Id: packet-null.c,v 1.17 1999/11/16 11:42:43 guy Exp $
+ * $Id: packet-null.c,v 1.18 2000/01/23 08:55:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -79,7 +79,7 @@ static const value_string family_vals[] = {
};
void
-capture_null( const u_char *pd, guint32 cap_len, packet_counts *ld )
+capture_null( const u_char *pd, packet_counts *ld )
{
guint32 null_header;
@@ -172,7 +172,7 @@ capture_null( const u_char *pd, guint32 cap_len, packet_counts *ld )
/*
* Hand it to PPP.
*/
- capture_ppp(pd, cap_len, ld);
+ capture_ppp(pd, ld);
} else {
/*
* Treat it as a normal DLT_NULL header.
@@ -195,12 +195,12 @@ capture_null( const u_char *pd, guint32 cap_len, packet_counts *ld )
* BSD derivatives have different values?).
*/
if (null_header > IEEE_802_3_MAX_LEN)
- capture_ethertype(null_header, 4, pd, cap_len, ld);
+ capture_ethertype(null_header, 4, pd, ld);
else {
switch (null_header) {
case BSD_AF_INET:
- capture_ip(pd, 4, cap_len, ld);
+ capture_ip(pd, 4, ld);
break;
default:
diff --git a/packet-ppp.c b/packet-ppp.c
index feb31b4a1c..6e3228a4b4 100644
--- a/packet-ppp.c
+++ b/packet-ppp.c
@@ -1,7 +1,7 @@
/* packet-ppp.c
* Routines for ppp packet disassembly
*
- * $Id: packet-ppp.c,v 1.24 2000/01/20 21:34:15 guy Exp $
+ * $Id: packet-ppp.c,v 1.25 2000/01/23 08:55:35 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -520,16 +520,16 @@ static const ip_tcp_opt ipcp_opts[] = {
#define N_IPCP_OPTS (sizeof ipcp_opts / sizeof ipcp_opts[0])
void
-capture_ppp( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
+capture_ppp( const u_char *pd, packet_counts *ld ) {
switch (pntohs(&pd[2])) {
case PPP_IP:
- capture_ip(pd, 4, cap_len, ld);
+ capture_ip(pd, 4, ld);
break;
case PPP_IPX:
- capture_ipx(pd, 4, cap_len, ld);
+ capture_ipx(pd, 4, ld);
break;
case PPP_VINES:
- capture_ipx(pd, 4, cap_len, ld);
+ capture_ipx(pd, 4, ld);
break;
default:
ld->other++;
diff --git a/packet-raw.c b/packet-raw.c
index ae7b829e9e..6465bcb51b 100644
--- a/packet-raw.c
+++ b/packet-raw.c
@@ -1,7 +1,7 @@
/* packet-raw.c
* Routines for raw packet disassembly
*
- * $Id: packet-raw.c,v 1.11 1999/11/16 11:42:50 guy Exp $
+ * $Id: packet-raw.c,v 1.12 2000/01/23 08:55:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -38,7 +38,7 @@
static gint ett_raw = -1;
void
-capture_raw( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
+capture_raw( const u_char *pd, packet_counts *ld ) {
/* So far, the only time we get raw connection types are with Linux and
* Irix PPP connections. We can't tell what type of data is coming down
@@ -49,9 +49,9 @@ capture_raw( const u_char *pd, guint32 cap_len, packet_counts *ld ) {
* sometimes. This check should be removed when 2.2 is out.
*/
if (pd[0] == 0xff && pd[1] == 0x03)
- capture_ip(pd, 4, cap_len, ld);
+ capture_ip(pd, 4, ld);
else
- capture_ip(pd, 0, cap_len, ld);
+ capture_ip(pd, 0, ld);
}
void
diff --git a/packet-tr.c b/packet-tr.c
index 8da5bc4eb8..9bd3aa2cc0 100644
--- a/packet-tr.c
+++ b/packet-tr.c
@@ -2,7 +2,7 @@
* Routines for Token-Ring packet disassembly
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: packet-tr.c,v 1.33 2000/01/22 06:22:17 guy Exp $
+ * $Id: packet-tr.c,v 1.34 2000/01/23 08:55:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -148,9 +148,7 @@ static void
add_ring_bridge_pairs(int rcf_len, const u_char *pd, int offset, proto_tree *tree);
void
-capture_tr(const u_char *pd, guint32 cap_len, packet_counts *ld) {
-
- int offset = 0;
+capture_tr(const u_char *pd, int offset, packet_counts *ld) {
int source_routed = 0;
int frame_type;
@@ -162,7 +160,7 @@ capture_tr(const u_char *pd, guint32 cap_len, packet_counts *ld) {
guint8 trn_fc; /* field control field */
guint8 trn_shost[6]; /* source host */
- if (cap_len < TR_MAX_HEADER_LEN) {
+ if (!BYTES_ARE_IN_FRAME(offset, TR_MIN_HEADER_LEN)) {
ld->other++;
return;
}
@@ -259,7 +257,7 @@ capture_tr(const u_char *pd, guint32 cap_len, packet_counts *ld) {
ld->other++;
break;
case 1:
- capture_llc(pd, offset, cap_len, ld);
+ capture_llc(pd, offset, ld);
break;
default:
/* non-MAC, non-LLC, i.e., "Reserved" */
@@ -295,7 +293,7 @@ dissect_tr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
/* Token-Ring Strings */
char *fc[] = { "MAC", "LLC", "Reserved", "Unknown" };
- if (fd->cap_len < TR_MIN_HEADER_LEN) {
+ if (!BYTES_ARE_IN_FRAME(offset, TR_MIN_HEADER_LEN)) {
dissect_data(pd, offset, fd, tree);
return;
}
diff --git a/packet-vines.c b/packet-vines.c
index 5d293e430f..b1d35e04c5 100644
--- a/packet-vines.c
+++ b/packet-vines.c
@@ -1,7 +1,7 @@
/* packet-vines.c
* Routines for Banyan VINES protocol packet disassembly
*
- * $Id: packet-vines.c,v 1.11 2000/01/21 00:07:53 gram Exp $
+ * $Id: packet-vines.c,v 1.12 2000/01/23 08:55:37 guy Exp $
*
* Don Lafontaine <lafont02@cn.ca>
*
@@ -45,7 +45,7 @@ static gint ett_vines_frp = -1;
static gint ett_vines_spp = -1;
void
-capture_vines(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld)
+capture_vines(const u_char *pd, int offset, packet_counts *ld)
{
ld->vines++;
}
diff --git a/packet-vlan.c b/packet-vlan.c
index e9d7f91cc6..7df004b6ee 100644
--- a/packet-vlan.c
+++ b/packet-vlan.c
@@ -1,7 +1,7 @@
/* packet-vlan.c
* Routines for VLAN 802.1Q ethernet header disassembly
*
- * $Id: packet-vlan.c,v 1.6 1999/12/05 20:05:44 nneul Exp $
+ * $Id: packet-vlan.c,v 1.7 2000/01/23 08:55:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -48,20 +48,21 @@ static int hf_vlan_cfi = -1;
static gint ett_vlan = -1;
void
-capture_vlan(const u_char *pd, int offset, guint32 cap_len, packet_counts *ld ) {
+capture_vlan(const u_char *pd, int offset, packet_counts *ld ) {
guint32 encap_proto;
if ( !BYTES_ARE_IN_FRAME(offset,5) ) {
+ ld->other++;
return;
}
encap_proto = pntohs( &pd[offset+2] );
if ( encap_proto <= IEEE_802_3_MAX_LEN) {
if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) {
- capture_ipx(pd,offset+4,cap_len,ld);
+ capture_ipx(pd,offset+4,ld);
} else {
- capture_llc(pd,offset+4,cap_len,ld);
+ capture_llc(pd,offset+4,ld);
}
} else {
- capture_ethertype(encap_proto, offset+4, pd, cap_len, ld);
+ capture_ethertype(encap_proto, offset+4, pd, ld);
}
}
diff --git a/packet.h b/packet.h
index cd9ca5e0c0..e8ded27085 100644
--- a/packet.h
+++ b/packet.h
@@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
- * $Id: packet.h,v 1.166 2000/01/20 21:34:14 guy Exp $
+ * $Id: packet.h,v 1.167 2000/01/23 08:55:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -270,29 +270,28 @@ void dissect_packet(const u_char *, frame_data *, proto_tree *);
/*
* Routines in packet-*.c
- * Routines should take three args: packet data *, cap_len, packet_counts *
+ * Routines should take two args: packet data *, packet_counts *
* They should never modify the packet data.
*/
-void capture_clip(const u_char *, guint32, packet_counts *);
-void capture_eth(const u_char *, guint32, packet_counts *);
-void capture_fddi(const u_char *, guint32, packet_counts *);
-void capture_null(const u_char *, guint32, packet_counts *);
-void capture_ppp(const u_char *, guint32, packet_counts *);
-void capture_raw(const u_char *, guint32, packet_counts *);
-void capture_tr(const u_char *, guint32, packet_counts *);
+void capture_clip(const u_char *, packet_counts *);
+void capture_fddi(const u_char *, packet_counts *);
+void capture_null(const u_char *, packet_counts *);
+void capture_ppp(const u_char *, packet_counts *);
+void capture_raw(const u_char *, packet_counts *);
/*
* Routines in packet-*.c
- * Routines should take four args: packet data *, offset, cap_len,
- * packet_counts *
+ * Routines should take three args: packet data *, offset, packet_counts *
* They should never modify the packet data.
*/
-void capture_netbios(const u_char *, int, guint32, packet_counts *);
-void capture_llc(const u_char *, int, guint32, packet_counts *);
-void capture_ip(const u_char *, int, guint32, packet_counts *);
-void capture_ipx(const u_char *, int, guint32, packet_counts *);
-void capture_vines(const u_char *, int, guint32, packet_counts *);
-void capture_vlan(const u_char *, int, guint32, packet_counts *);
+void capture_eth(const u_char *, int, packet_counts *);
+void capture_ip(const u_char *, int, packet_counts *);
+void capture_ipx(const u_char *, int, packet_counts *);
+void capture_llc(const u_char *, int, packet_counts *);
+void capture_netbios(const u_char *, int, packet_counts *);
+void capture_tr(const u_char *, int, packet_counts *);
+void capture_vines(const u_char *, int, packet_counts *);
+void capture_vlan(const u_char *, int, packet_counts *);
/*
* Routines in packet-*.c
@@ -440,7 +439,7 @@ void init_dissect_x25(void);
/* These functions are in ethertype.c */
void capture_ethertype(guint16 etype, int offset,
- const u_char *pd, guint32 cap_len, packet_counts *ld);
+ const u_char *pd, packet_counts *ld);
void ethertype(guint16 etype, int offset,
const u_char *pd, frame_data *fd, proto_tree *tree,
proto_tree *fh_tree, int item_id);