diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-03-04 06:47:10 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-03-04 06:47:10 +0000 |
commit | 9db95664d104089e059e1110bd4936cb8375ff26 (patch) | |
tree | ad09573b7494a677e409713fff80f9bed96d8553 /packet-ip.c | |
parent | 9a57223addead8c42ff2c9b98c88aa68d5f670fe (diff) |
When deciding whether we have enough data in a lower-level packet to
attempt reassembly of a higher-level packet that includes the
lower-level packet, use "tvb_bytes_exist()" to check whether all the
data that's to be included in the reassembly is available, rather than
by checking whether the packet is short.
Add some checks of that sort that were missing.
Use the reported length of the packet when doing reassembly.
Make the "iphdrlen" field of a "packet_info" structure be the length of
the IP header in bytes, not in 4-byte words.
svn path=/trunk/; revision=7274
Diffstat (limited to 'packet-ip.c')
-rw-r--r-- | packet-ip.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packet-ip.c b/packet-ip.c index 843048c6db..a16c417dd9 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.184 2003/03/03 23:20:57 sahlberg Exp $ + * $Id: packet-ip.c,v 1.185 2003/03/04 06:47:10 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1005,7 +1005,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->iplen = iph->ip_len; - pinfo->iphdrlen = lo_nibble(iph->ip_v_hl); + pinfo->iphdrlen = hlen; SET_ADDRESS(&pinfo->net_src, AT_IPv4, 4, tvb_get_ptr(tvb, offset + IPH_SRC, 4)); SET_ADDRESS(&pinfo->src, AT_IPv4, 4, tvb_get_ptr(tvb, offset + IPH_SRC, 4)); @@ -1022,11 +1022,12 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ save_fragmented = pinfo->fragmented; if (ip_defragment && (iph->ip_off & (IP_MF|IP_OFFSET)) && - tvb_reported_length(tvb) <= tvb_length(tvb) && ipsum == 0) { + tvb_bytes_exist(tvb, offset, pinfo->iplen - pinfo->iphdrlen) && + 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), + pinfo->iplen - pinfo->iphdrlen, iph->ip_off & IP_MF); if (ipfd_head != NULL) { |