forked from osmocom/wireshark
From Didier via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3055 :
Apply rev 25869 to most of the rest of the TCP-desegmenting dissectors. (The SSL dissector was already updated in one of two spots with bug 4535/rev 32456.) A couple of the patches had to be manually applied. From me: Fix the comments to match the change (including in the TCP and SSL dissectors.) svn path=/trunk/; revision=36332
This commit is contained in:
parent
28ef67fb39
commit
cc6fc23812
|
@ -1561,8 +1561,16 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
* BER).
|
||||
*/
|
||||
if (length_remaining < 6) {
|
||||
/*
|
||||
* Yes. Tell the TCP dissector where the data
|
||||
* for this message starts in the data it handed
|
||||
* us and that we need "some more data." Don't tell
|
||||
* it exactly how many bytes we need because if/when
|
||||
* we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 6 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
|
||||
/*
|
||||
* Return 0, which means "I didn't dissect anything
|
||||
|
|
|
@ -2912,12 +2912,14 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
*/
|
||||
if (length_remaining < BGP_HEADER_SIZE) {
|
||||
/*
|
||||
* 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.
|
||||
* Yes. Tell the TCP dissector where the data for this message
|
||||
* starts in the data it handed us and that we need "some more
|
||||
* data." Don't tell it exactly how many bytes we need because
|
||||
* if/when we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = BGP_HEADER_SIZE - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,12 +156,15 @@ dissect_rtspinterleaved(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
*/
|
||||
if (length_remaining < 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.
|
||||
* Yes. Tell the TCP dissector where the data for
|
||||
* this message starts in the data it handed us and
|
||||
* that we need "some more data." Don't tell it
|
||||
* exactly how many bytes we need because if/when we
|
||||
* ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 4 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Do not modify this file. */
|
||||
/* It is created automatically by the ASN.1 to Wireshark dissector compiler */
|
||||
/* packet-snmp.c */
|
||||
/* ../../tools/asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . snmp.asn */
|
||||
/* ../../../tools/asn2wrs.py -b -p snmp -c ../../../asn1/snmp/snmp.cnf -s ../../../asn1/snmp/packet-snmp-template -D ../../../asn1/snmp snmp.asn */
|
||||
|
||||
/* Input file: packet-snmp-template.c */
|
||||
|
||||
|
@ -2785,8 +2785,16 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo,
|
|||
* BER).
|
||||
*/
|
||||
if (length_remaining < 6) {
|
||||
/*
|
||||
* Yes. Tell the TCP dissector where the data
|
||||
* for this message starts in the data it handed
|
||||
* us and that we need "some more data." Don't tell
|
||||
* it exactly how many bytes we need because if/when
|
||||
* we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 6 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
|
||||
/*
|
||||
* Return 0, which means "I didn't dissect anything
|
||||
|
@ -3625,7 +3633,7 @@ void proto_register_snmp(void) {
|
|||
NULL, HFILL }},
|
||||
|
||||
/*--- End of included file: packet-snmp-hfarr.c ---*/
|
||||
#line 2140 "packet-snmp-template.c"
|
||||
#line 2148 "packet-snmp-template.c"
|
||||
};
|
||||
|
||||
/* List of subtrees */
|
||||
|
@ -3665,7 +3673,7 @@ void proto_register_snmp(void) {
|
|||
&ett_snmp_RReqPDU_U,
|
||||
|
||||
/*--- End of included file: packet-snmp-ettarr.c ---*/
|
||||
#line 2156 "packet-snmp-template.c"
|
||||
#line 2164 "packet-snmp-template.c"
|
||||
};
|
||||
module_t *snmp_module;
|
||||
|
||||
|
|
|
@ -497,10 +497,25 @@ ssh_dissect_ssh1(tvbuff_t *tvb, packet_info *pinfo,
|
|||
* This means we're guaranteed that "remain_length" is positive.
|
||||
*/
|
||||
remain_length = tvb_ensure_length_remaining(tvb,offset);
|
||||
/*
|
||||
* Can we do reassembly?
|
||||
*/
|
||||
if (ssh_desegment && pinfo->can_desegment) {
|
||||
/*
|
||||
* Yes - would an SSH header starting at this offset be split
|
||||
* across segment boundaries?
|
||||
*/
|
||||
if(remain_length < 4) {
|
||||
/*
|
||||
* Yes. Tell the TCP dissector where the data for
|
||||
* this message starts in the data it handed us and
|
||||
* that we need "some more data." Don't tell it
|
||||
* exactly how many bytes we need because if/when we
|
||||
* ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 4-remain_length;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
*need_desegmentation = TRUE;
|
||||
return offset;
|
||||
}
|
||||
|
@ -636,10 +651,25 @@ ssh_dissect_key_exchange(tvbuff_t *tvb, packet_info *pinfo,
|
|||
* This means we're guaranteed that "remain_length" is positive.
|
||||
*/
|
||||
remain_length = tvb_ensure_length_remaining(tvb,offset);
|
||||
/*
|
||||
* Can we do reassembly?
|
||||
*/
|
||||
if (ssh_desegment && pinfo->can_desegment) {
|
||||
/*
|
||||
* Yes - would an SSH header starting at this offset
|
||||
* be split across segment boundaries?
|
||||
*/
|
||||
if(remain_length < 4) {
|
||||
/*
|
||||
* Yes. Tell the TCP dissector where the data for
|
||||
* this message starts in the data it handed us and
|
||||
* that we need "some more data." Don't tell it
|
||||
* exactly how many bytes we need because if/when we
|
||||
* ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 4-remain_length;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
*need_desegmentation = TRUE;
|
||||
return offset;
|
||||
}
|
||||
|
|
|
@ -1322,12 +1322,10 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|||
if (available_bytes < 5) {
|
||||
/*
|
||||
* 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.
|
||||
* Fix for bug 4535: Don't get just the data we need, get
|
||||
* one more segment. Otherwise when the next segment does
|
||||
* not contain all the rest of the SSL PDU, reassembly will
|
||||
* break.
|
||||
* message starts in the data it handed us, and that we need
|
||||
* "some more data." Don't tell it exactly how many bytes we
|
||||
* need because if/when we ask for even more (after the header)
|
||||
* that will break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
|
@ -1366,7 +1364,8 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
|
|||
* the continuation of a previous PDU together with a full new
|
||||
* PDU (and the info column would not show the message type
|
||||
* of the second PDU)
|
||||
*/
|
||||
*/
|
||||
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
*need_desegmentation = TRUE;
|
||||
return offset;
|
||||
|
@ -2811,11 +2810,11 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
byte = tvb_get_guint8(tvb, offset);
|
||||
record_length_length = (byte & 0x80) ? 2 : 3;
|
||||
|
||||
available_bytes = tvb_length_remaining(tvb, offset);
|
||||
|
||||
/*
|
||||
* Can we do reassembly?
|
||||
*/
|
||||
available_bytes = tvb_length_remaining(tvb, offset);
|
||||
|
||||
if (ssl_desegment && pinfo->can_desegment) {
|
||||
/*
|
||||
* Yes - is the record header split across segment boundaries?
|
||||
|
@ -2823,11 +2822,13 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
if (available_bytes < record_length_length) {
|
||||
/*
|
||||
* 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.
|
||||
* message starts in the data it handed us, and that we need
|
||||
* "some more data." Don't tell it exactly how many bytes we
|
||||
* need because if/when we ask for even more (after the header)
|
||||
* that will break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = record_length_length - available_bytes;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
*need_desegmentation = TRUE;
|
||||
return offset;
|
||||
}
|
||||
|
|
|
@ -2070,8 +2070,10 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
if (length_remaining < fixed_len) {
|
||||
/*
|
||||
* 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.
|
||||
* starts in the data it handed us and that we need "some more
|
||||
* data." Don't tell it exactly how many bytes we need because
|
||||
* if/when we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
|
|
|
@ -2402,14 +2402,15 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
* split across segment boundaries?
|
||||
*/
|
||||
if (length_remaining < 8) {
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Yes. Tell the TCP dissector where the data for this message
|
||||
* starts in the data it handed us and that we need "some more
|
||||
* data." Don't tell it exactly how many bytes we need because
|
||||
* if/when we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 8 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -432,13 +432,15 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
*/
|
||||
if (length_remaining < 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.
|
||||
* Yes. Tell the TCP dissector where the data
|
||||
* for this message starts in the data it
|
||||
* handed us and that we need "some more data."
|
||||
* Don't tell it exactly how many bytes we need
|
||||
* because if/when we ask for even more (after
|
||||
* the header) that will break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 4 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4338,10 +4338,13 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo,
|
|||
/*
|
||||
* 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.
|
||||
* us and that we need "some more data." Don't tell
|
||||
* it exactly how many bytes we need because if/when
|
||||
* we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 4 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4450,11 +4453,13 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo,
|
|||
/*
|
||||
* 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.
|
||||
* it handed us and that we need "some more
|
||||
* data." Don't tell it exactly how many bytes
|
||||
* we need because if/when we ask for even more
|
||||
* (after the header) that will break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 10 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4699,11 +4704,13 @@ dissect_x11_replies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
/*
|
||||
* 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.
|
||||
* us and that we need "some more data." Don't tell
|
||||
* it exactly how many bytes we need because if/when
|
||||
* we ask for even more (after the header) that will
|
||||
* break reassembly.
|
||||
*/
|
||||
pinfo->desegment_offset = offset;
|
||||
pinfo->desegment_len = 8 - length_remaining;
|
||||
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue