aboutsummaryrefslogtreecommitdiffstats
path: root/packet-isl.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-12-29 00:51:52 +0000
committerGuy Harris <guy@alum.mit.edu>2000-12-29 00:51:52 +0000
commitbc40aeeadec325c9b9d5b6e6a1fb33acc174df83 (patch)
treedb7bf0d703cf7d2e0854203ca988c945796e9979 /packet-isl.c
parent3e876653f39059ef68194c4ecf5b18df16428622 (diff)
When creating a subset tvbuff with lengths that don't run to the end of
the parent tvbuff, we have to set "pinfo->len" and "pinfo->captured_len" unless we know for certain that *no* old-style dissectors will be called later, because old-style dissectors get their length information from "pi.len" and "pi.captured_len". svn path=/trunk/; revision=2795
Diffstat (limited to 'packet-isl.c')
-rw-r--r--packet-isl.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/packet-isl.c b/packet-isl.c
index 468174dc45..9c8f485f1f 100644
--- a/packet-isl.c
+++ b/packet-isl.c
@@ -1,7 +1,7 @@
/* packet-isl.c
* Routines for Cisco ISL Ethernet header disassembly
*
- * $Id: packet-isl.c,v 1.18 2000/12/28 09:49:09 guy Exp $
+ * $Id: packet-isl.c,v 1.19 2000/12/29 00:51:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -148,6 +148,8 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint crc_offset;
gint captured_length;
tvbuff_t *next_tvb;
+ const guint8 *compat_pd;
+ int compat_offset;
CHECK_DISPLAY_AS_DATA(proto_isl, tvb, pinfo, tree);
@@ -233,12 +235,23 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
captured_length = tvb_length_remaining(tvb, ISL_HEADER_SIZE);
if (captured_length > 4) {
/* Subtract the encapsulated frame CRC. */
- captured_length -= 4;
+ captured_length -= 4;
/* Make sure it's not bigger than the actual length. */
- if (captured_length > length)
- captured_length = length;
+ if (captured_length > length)
+ captured_length = length;
+
next_tvb = tvb_new_subset(tvb, ISL_HEADER_SIZE, captured_length, length);
+
+ /* Set "pinfo"'s payload and captured-payload lengths to the values
+ we calculated.
+
+ XXX - when all dissectors are tvbuffified we shouldn't have to
+ do this any more. */
+ tvb_compat(next_tvb, &compat_pd, &compat_offset);
+ pinfo->len = compat_offset + length;
+ pinfo->captured_len = compat_offset + captured_length;
+
dissect_eth(next_tvb, pinfo, tree);
}
}