diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-02-23 21:07:48 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-02-23 21:07:48 +0000 |
commit | f4f3208a00a0dd4ce9ff90077243c80767902ff1 (patch) | |
tree | 05ce9a3b61b183179a9abf2fb860c656233de500 | |
parent | 7027650b5ce8aeeb4e2e7aa91d670d213cde18b2 (diff) | |
download | wireshark-f4f3208a00a0dd4ce9ff90077243c80767902ff1.tar.gz wireshark-f4f3208a00a0dd4ce9ff90077243c80767902ff1.tar.bz2 wireshark-f4f3208a00a0dd4ce9ff90077243c80767902ff1.zip |
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
-rw-r--r-- | packet-q931.c | 11 | ||||
-rw-r--r-- | packet-tpkt.c | 53 |
2 files changed, 37 insertions, 27 deletions
diff --git a/packet-q931.c b/packet-q931.c index fe122e9381..9b80ddfce9 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris <guy@alum.mit.edu> * - * $Id: packet-q931.c,v 1.39 2002/02/23 02:30:15 guy Exp $ + * $Id: packet-q931.c,v 1.40 2002/02/23 21:07:47 guy Exp $ * * Modified by Andreas Sikkema for possible use with H.323 * @@ -2518,8 +2518,15 @@ dissect_q931_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * is one, and that the code put a TPKT header in one * segment and the rest of the PDU in another. */ - if (tvb_length(tvb) == 4) + if (tvb_length(tvb) == 4) { + /* + * It is - call the "dissect TPKT over a TCP stream" + * routine. + */ + dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment, + q931_tpkt_pdu_handle); return TRUE; + } /* * Well, we have more data than just the TPKT header; 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; |