diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-01-23 08:55:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-01-23 08:55:37 +0000 |
commit | 2461d79698e685644e2f07ee46381a092348461c (patch) | |
tree | 8647292ca380ae9108970a167959b9df1c931ec9 /packet-tr.c | |
parent | 42d68156a9599948fb0c5c633efc9d61548d5a5b (diff) | |
download | wireshark-2461d79698e685644e2f07ee46381a092348461c.tar.gz wireshark-2461d79698e685644e2f07ee46381a092348461c.tar.bz2 wireshark-2461d79698e685644e2f07ee46381a092348461c.zip |
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
Diffstat (limited to 'packet-tr.c')
-rw-r--r-- | packet-tr.c | 12 |
1 files changed, 5 insertions, 7 deletions
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; } |