diff options
-rw-r--r-- | packet-clnp.c | 31 | ||||
-rw-r--r-- | packet-ip.c | 27 | ||||
-rw-r--r-- | packet-ipv6.c | 24 |
3 files changed, 30 insertions, 52 deletions
diff --git a/packet-clnp.c b/packet-clnp.c index ac1cc1ca23..7d2a26cd8d 100644 --- a/packet-clnp.c +++ b/packet-clnp.c @@ -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; diff --git a/packet-ip.c b/packet-ip.c index 27ba0f0bb2..e09244aa8a 100644 --- a/packet-ip.c +++ b/packet-ip.c @@ -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; diff --git a/packet-ipv6.c b/packet-ipv6.c index 563f0d60be..b15cea288e 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -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; |