If reassembly is enabled, don't try to do any reassembly work at all on

a fragment unless we've captured all the data in the fragment and (in
IPv4 and CLNP) it has a valid checksum, so that if the first fragment is
a short frame or a frame with an invalid checksum, we'll treat it as if
reassembly weren't enabled, and will dissect what data we have in it,
rather than not dissecting *any* of the fragments above the IP/CLNP
layer.

svn path=/trunk/; revision=4575
This commit is contained in:
Guy Harris 2002-01-20 01:04:18 +00:00
parent b6c6ff4106
commit ce6db7ff97
3 changed files with 30 additions and 52 deletions

View File

@ -1,7 +1,7 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
* $Id: packet-clnp.c,v 1.45 2002/01/17 06:29:16 guy Exp $
* $Id: packet-clnp.c,v 1.46 2002/01/20 01:04:18 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
@ -1814,29 +1814,18 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = cnf_hdr_len;
/* For now, dissect the payload of segments other than the initial
segment as data, rather than handing them off to the transport
protocol, just as we do with fragments other than the first
fragment in a fragmented IP datagram; in the future, we will
probably reassemble fragments for IP, and may reassemble segments
for CLNP. */
/* If clnp_reassemble is on and this is a segment, then just add the segment
* to the hashtable.
/* If clnp_reassemble is on, and this is a segment, we have all the
* data in the segment, and the checksum is valid, then just add the
* segment to the hashtable.
*/
save_fragmented = pinfo->fragmented;
if (clnp_reassemble && (cnf_type & CNF_SEG_OK) &&
((cnf_type & CNF_MORE_SEGS) || segment_offset != 0)) {
/* We're reassembling, and this is part of a segmented datagram.
Add the segment to the hash table if the checksum is ok
and the frame isn't truncated. */
if (cksum_status != CKSUM_NOT_OK &&
(tvb_reported_length(tvb) <= tvb_length(tvb))) {
fd_head = fragment_add(tvb, offset, pinfo, du_id, clnp_segment_table,
segment_offset, segment_length - cnf_hdr_len,
cnf_type & CNF_MORE_SEGS);
} else {
fd_head=NULL;
}
((cnf_type & CNF_MORE_SEGS) || segment_offset != 0) &&
(tvb_reported_length(tvb) <= tvb_length(tvb)) &&
cksum_status != CKSUM_NOT_OK) {
fd_head = fragment_add(tvb, offset, pinfo, du_id, clnp_segment_table,
segment_offset, segment_length - cnf_hdr_len,
cnf_type & CNF_MORE_SEGS);
if (fd_head != NULL) {
fragment_data *fd;

View File

@ -1,7 +1,7 @@
/* packet-ip.c
* Routines for IP and miscellaneous IP protocol packet disassembly
*
* $Id: packet-ip.c,v 1.156 2002/01/17 06:29:16 guy Exp $
* $Id: packet-ip.c,v 1.157 2002/01/20 01:04:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -966,23 +966,18 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += hlen;
nxt = iph.ip_p; /* XXX - what if this isn't the same for all fragments? */
/* If ip_defragment is on and this is a fragment, then just add the fragment
* to the hashtable.
/* If ip_defragment is on, this is a fragment, we have all the data
* in the fragment, and the header checksum is valid, then just add
* the fragment to the hashtable.
*/
save_fragmented = pinfo->fragmented;
if (ip_defragment && (iph.ip_off & (IP_MF|IP_OFFSET))) {
/* We're reassembling, and this is part of a fragmented datagram.
Add the fragment to the hash table if the checksum is ok
and the frame isn't truncated. */
if ((ipsum==0) && (tvb_reported_length(tvb) <= tvb_length(tvb))) {
ipfd_head = fragment_add(tvb, offset, pinfo, iph.ip_id,
ip_fragment_table,
(iph.ip_off & IP_OFFSET)*8,
pinfo->iplen - (pinfo->iphdrlen*4),
iph.ip_off & IP_MF);
} else {
ipfd_head=NULL;
}
if (ip_defragment && (iph.ip_off & (IP_MF|IP_OFFSET)) &&
tvb_reported_length(tvb) <= tvb_length(tvb) && ipsum == 0) {
ipfd_head = fragment_add(tvb, offset, pinfo, iph.ip_id,
ip_fragment_table,
(iph.ip_off & IP_OFFSET)*8,
pinfo->iplen - (pinfo->iphdrlen*4),
iph.ip_off & IP_MF);
if (ipfd_head != NULL) {
fragment_data *ipfd;

View File

@ -1,7 +1,7 @@
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
* $Id: packet-ipv6.c,v 1.73 2002/01/17 06:29:16 guy Exp $
* $Id: packet-ipv6.c,v 1.74 2002/01/20 01:04:18 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -807,22 +807,16 @@ again:
proto_tree_add_uint_hidden(ipv6_tree, hf_ipv6_final, tvb, poffset, 1, nxt);
#endif
/* If ipv6_reassemble is on and this is a fragment, then just add the fragment
* to the hashtable.
/* If ipv6_reassemble is on, this is a fragment, and we have all the data
* in the fragment, then just add the fragment to the hashtable.
*/
save_fragmented = pinfo->fragmented;
if (ipv6_reassemble && frag) {
/* We're reassembling, and this is part of a fragmented datagram.
Add the fragment to the hash table if the frame isn't truncated. */
if (tvb_reported_length(tvb) <= tvb_length(tvb)) {
ipfd_head = fragment_add(tvb, offset, pinfo, ident,
ipv6_fragment_table,
offlg & IP6F_OFF_MASK,
plen,
offlg & IP6F_MORE_FRAG);
} else {
ipfd_head = NULL;
}
if (ipv6_reassemble && frag && tvb_reported_length(tvb) <= tvb_length(tvb)) {
ipfd_head = fragment_add(tvb, offset, pinfo, ident,
ipv6_fragment_table,
offlg & IP6F_OFF_MASK,
plen,
offlg & IP6F_MORE_FRAG);
if (ipfd_head != NULL) {
fragment_data *ipfd;