aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ethertype.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-11-18 10:38:33 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2000-11-18 10:38:33 +0000
commitf4fc5ac736a773f41e683e59d4431b1fbfa43c9d (patch)
tree5e117f446c6e233d14b642596d67c985e685f328 /packet-ethertype.c
parent92c209a221b63e9fd8b07684cec124efc0e01597 (diff)
Tvbuffify the IP, ICMP, TCP, UDP, OSI CLNP, OSI COTP, OSI CLTP, and OSI
ESIS dissectors. Register the IP dissector and have dissectors that call it directly (rather than through a port table) call it through a handle. Add a routine "tvb_set_reported_length()" which a dissector can use if it was handed a tvbuff that contains more data than is actually in its part of the packet - for example, handing a padded Ethernet frame to IP; the routine sets the reported length of the tvbuff (and also adjusts the actual length, as appropriate). Then use it in IP. Given that, "ethertype()" can determine how much of the Ethernet frame was actually part of an IP datagram (and can do the same for other protocols under Ethernet that use "tvb_set_reported_length()"; have it return the actual length, and have "dissect_eth()" and "dissect_vlan()" use that to mark trailer data in Ethernet II frames as well as in 802.3 frames. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2658 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ethertype.c')
-rw-r--r--packet-ethertype.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/packet-ethertype.c b/packet-ethertype.c
index 3ffcd0e2c3..454c58fbfa 100644
--- a/packet-ethertype.c
+++ b/packet-ethertype.c
@@ -1,7 +1,7 @@
/* ethertype.c
* Routines for calling the right protocol for the ethertype.
*
- * $Id: packet-ethertype.c,v 1.8 2000/11/16 07:35:37 guy Exp $
+ * $Id: packet-ethertype.c,v 1.9 2000/11/18 10:38:24 guy Exp $
*
* Gilbert Ramirez <gram@xiexie.org>
*
@@ -95,7 +95,7 @@ capture_ethertype(guint16 etype, int offset,
}
}
-void
+guint
ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, packet_info *pinfo,
proto_tree *tree, proto_tree *fh_tree, int item_id)
{
@@ -107,6 +107,7 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, packet_info *pin
proto_tree_add_uint(fh_tree, item_id, tvb, offset_after_etype - 2, 2, etype);
}
+ /* Tvbuff for the payload after the Ethernet type. */
next_tvb = tvb_new_subset(tvb, offset_after_etype, -1, -1);
/* Look for sub-dissector */
@@ -137,6 +138,11 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, packet_info *pin
}
}
}
+
+ /* Return the length of that tvbuff; the subdissector may have
+ reduced the length to a value specified by a length field
+ in its header, meaning what remains is padding. */
+ return tvb_reported_length(next_tvb);
}