diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-02-21 00:22:16 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-02-21 00:22:16 +0000 |
commit | ea26e0b4cf09a9f6bb2c1c7793cd55f1d61fa911 (patch) | |
tree | d644b7a3fb4cd2b10b71faf89eade26cef689254 /packet-ieee8023.c | |
parent | 83dd0267a36c377ad5cd3631c2b026fa07eb72d7 (diff) |
Handle exceptions the same way we handle them in the DCE RPC dissector -
rethrow BoundsError, call "show_exception()" for all other errors, and
then fall through to dissect the trailer outside the TRY/CATCH/ENDRY
construct.
svn path=/trunk/; revision=10149
Diffstat (limited to 'packet-ieee8023.c')
-rw-r--r-- | packet-ieee8023.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/packet-ieee8023.c b/packet-ieee8023.c index f1a43dbf76..635856a673 100644 --- a/packet-ieee8023.c +++ b/packet-ieee8023.c @@ -1,7 +1,7 @@ /* packet-ieee8023.c * Routine for dissecting 802.3 (as opposed to D/I/X Ethernet) packets. * - * $Id: packet-ieee8023.c,v 1.7 2004/02/20 10:21:46 guy Exp $ + * $Id: packet-ieee8023.c,v 1.8 2004/02/21 00:22:16 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -30,6 +30,7 @@ #include <epan/packet.h> #include "packet-ieee8023.h" #include "packet-eth.h" +#include "packet-frame.h" static dissector_handle_t ipx_handle; static dissector_handle_t llc_handle; @@ -42,7 +43,6 @@ dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb, { tvbuff_t *volatile next_tvb; tvbuff_t *volatile trailer_tvb; - volatile unsigned long exception = 0; if (fh_tree) proto_tree_add_uint(fh_tree, length_id, tvb, offset_after_length - 2, 2, @@ -87,40 +87,22 @@ dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb, else call_dissector(ipx_handle, next_tvb, pinfo, tree); } - CATCH(ReportedBoundsError) { + CATCH(BoundsError) { + /* Somebody threw BoundsError, which means that dissecting the payload + found that the packet was cut off by a snapshot length before the + end of the payload. The trailer comes after the payload, so *all* + of the trailer is cut off - don't bother adding the trailer, just + rethrow the exception so it gets reported. */ + RETHROW; + } + CATCH_ALL { /* Well, somebody threw an exception other than BoundsError. - Remember the exception, so we can rethrow it after adding - the trailer. - - We do so just in case adding the trailer *also* throws an - exception. - - We don't do so for BoundsError, as that exception means - that dissecting the payload found that the packet was - cut off by a snapshot length before the end of the payload; - the trailer comes after the payload, so that was *definitely* - cut off. */ - exception = EXCEPT_CODE; + Show the exception, and then drive on to show the trailer. */ + show_exception(next_tvb, pinfo, tree, EXCEPT_CODE); } ENDTRY; - if (exception != 0) { - /* Perhaps we'll get another exception from attempting to - dissect the trailer; we already have an exception to - show, so we don't want to show that other exception. */ - TRY { - add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); - } - CATCH_ALL { - ; /* do nothing */ - } - ENDTRY; - - /* Rethrow the original exception, so the appropriate indication - can be put into the tree. */ - THROW(exception); - } else - add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); + add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); } void |