Ethereal-dev: [Ethereal-dev] Tvbuffifcation, and trailer padding in Ethernet packets
I've just checked in some changes that tvbuffify the IP, ICMP, TCP, UDP,
OSI CLNP, OSI COTP, OSI CLTP, and OSI ESIS dissectors.
In some of the capture files I have, this causes the dissectors to quit
sooner than they did before - which means they don't run past the end of
the packet (although they also give up on TCP segments, for example, if
the entire TCP header isn't available; they use a lot of that header to
generate the summary, so to do that "right" means generating the summary
incrementally).
In some other capture files, as a result of the way I did the
tvbuffification, they quit *later* than they did before - some of the
dissectors now fetch individual fields one at a time from the tvbuff
rather than manually checking to make sure we have the entire header
(and returning if we don't) and then grabbing the entire header, so you
get to see at least part of the header before you get a "Short Frame" or
"Malformed Frame" error.
In addition, I added 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). IP uses it.
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()"); it
returns the actual length, and "dissect_eth()" and "dissect_vlan()" use
that to mark trailer data in Ethernet II frames as well as in 802.3
frames.