aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tpkt.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-02-23 21:07:48 +0000
committerGuy Harris <guy@alum.mit.edu>2002-02-23 21:07:48 +0000
commitf4f3208a00a0dd4ce9ff90077243c80767902ff1 (patch)
tree05ce9a3b61b183179a9abf2fb860c656233de500 /packet-tpkt.c
parent7027650b5ce8aeeb4e2e7aa91d670d213cde18b2 (diff)
In the Q.931-over-TPKT-over-TCP dissector, if the TCP segment we're
handed looks as if it contains only a TPKT header (4 bytes long, and those 4 bytes look like a TPKT header according to "is_tpkt()"), call the "dissect TPKT over a TCP stream" routine. If we're doing reassembly, that routine will force a reassembly because the TPKT payload isn't in that segment, and the various heuristic XXX-over-TPKT dissectors will be called again, this time with enough data for them to say whether the TPKT payload is for them or not; if we're not doing reassembly, we'll dissect the TPKT header and then call the "dissect a Q.931 PDU" routine, which will throw an exception because there isn't any payload from which to fetch data (and that's what we want to happen). In the "dissect TPKT over a TCP stream" routine, if reassembly is enabled, do the check to see if we need to do reassembly to get the payload before dissecting the TPKT header, so that we don't dissect the TPKT header and then decide "oops, we need some more data to get the TPKT payload". svn path=/trunk/; revision=4792
Diffstat (limited to 'packet-tpkt.c')
-rw-r--r--packet-tpkt.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/packet-tpkt.c b/packet-tpkt.c
index e397654567..93424d98ff 100644
--- a/packet-tpkt.c
+++ b/packet-tpkt.c
@@ -7,7 +7,7 @@
* Routine to dissect RFC 1006 TPKT packet containing OSI TP PDU
* Copyright 2001, Martin Thomas <Martin_A_Thomas@yahoo.com>
*
- * $Id: packet-tpkt.c,v 1.15 2002/02/23 02:30:15 guy Exp $
+ * $Id: packet-tpkt.c,v 1.16 2002/02/23 21:07:48 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -141,14 +141,39 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/*
+ * Get the length from the TPKT header.
+ */
+ data_len = tvb_get_ntohs(tvb, offset + 2);
+
+ /*
+ * Can we do reassembly?
+ */
+ if (desegment && pinfo->can_desegment) {
+ /*
+ * Yes - is the payload split across segment
+ * boundaries?
+ */
+ if (length_remaining < data_len + 4) {
+ /*
+ * Yes. Tell the TCP dissector where
+ * the data for this message starts in
+ * the data it handed us, and how many
+ * more bytes we need, and return.
+ */
+ pinfo->desegment_offset = offset;
+ pinfo->desegment_len =
+ (data_len + 4) - length_remaining;
+ return;
+ }
+ }
+
+ /*
* Dissect the TPKT header.
* Save and restore "pinfo->current_proto".
*/
saved_proto = pinfo->current_proto;
pinfo->current_proto = "TPKT";
- data_len = tvb_get_ntohs(tvb, offset + 2);
-
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TPKT");
if (check_col(pinfo->cinfo, COL_INFO)) {
@@ -175,28 +200,6 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
pinfo->current_proto = saved_proto;
- /*
- * Can we do reassembly?
- */
- if (desegment && pinfo->can_desegment) {
- /*
- * Yes - is the payload split across segment
- * boundaries?
- */
- if (length_remaining < data_len + 4) {
- /*
- * Yes. Tell the TCP dissector where
- * the data for this message starts in
- * the data it handed us, and how many
- * more bytes we need, and return.
- */
- pinfo->desegment_offset = offset;
- pinfo->desegment_len =
- (data_len + 4) - length_remaining;
- return;
- }
- }
-
/* Skip the TPKT header. */
offset += 4;