aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ip.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-06-29 09:46:54 +0000
committerGuy Harris <guy@alum.mit.edu>2001-06-29 09:46:54 +0000
commit556a11ad45f9f97d52273386290aa7cdae579c5e (patch)
tree146bc0d7a44d8f5d8b5e672a520865b17cf6466d /packet-ip.c
parentc94f0e130b3e4fdb4f4f6fdf82130166fa011392 (diff)
Create a routine to do the tvbuff-length-adjusting and
"pinfo->{len,captured_len}"-adjusting currently done by the IP dissector, make the IP dissector call that rather than doing the work itself, make the IPv6 dissector call that rather than just adjusting the tvbuff length itself, and make the IPX dissector call that rather than just adjusting "pi.{len,captured_len}" itself. This cleans things up a bit, and causes trailers to be properly reported in IPX-over-Ethernet frames. svn path=/trunk/; revision=3621
Diffstat (limited to 'packet-ip.c')
-rw-r--r--packet-ip.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/packet-ip.c b/packet-ip.c
index 38a453df1e..91a01d5be7 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.138 2001/06/19 23:08:55 guy Exp $
+ * $Id: packet-ip.c,v 1.139 2001/06/29 09:46:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -792,7 +792,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *ip_tree = NULL, *field_tree;
proto_item *ti, *tf;
int offset = 0;
- guint hlen, optlen, len, payload_len, reported_payload_len;
+ guint hlen, optlen, len;
int padding;
guint16 flags;
guint8 nxt;
@@ -815,33 +815,11 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
iph.ip_off = ntohs(iph.ip_off);
iph.ip_sum = ntohs(iph.ip_sum);
- /* Length of payload handed to us. */
- reported_payload_len = tvb_reported_length(tvb);
- payload_len = tvb_length(tvb);
-
/* Length of IP datagram. */
len = iph.ip_len;
- if (len < reported_payload_len) {
- /* Adjust the length of this tvbuff to include only the IP datagram.
- Our caller may use that to determine how much of its packet
- was padding. */
- tvb_set_reported_length(tvb, len);
-
- /* Shrink the total payload by the amount of padding. */
- padding = reported_payload_len - len;
- if (pinfo->len >= padding)
- pinfo->len -= padding;
-
- /* Shrink the captured payload by the amount of padding in the
- captured payload (which may be less than the amount of padding,
- as the padding may not have been captured). */
- if (len < payload_len) {
- padding = payload_len - len;
- if (pinfo->captured_len >= padding)
- pinfo->captured_len -= padding;
- }
- }
+ /* Adjust the length of this tvbuff to include only the IP datagram. */
+ set_actual_length(tvb, pinfo, len);
hlen = lo_nibble(iph.ip_v_hl) * 4; /* IP header length, in bytes */