diff options
author | Bill Meier <wmeier@newsguy.com> | 2011-04-28 18:01:38 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2011-04-28 18:01:38 +0000 |
commit | c22cde8de5781c800f7d1c0c54302097c72fb5b3 (patch) | |
tree | 924631dc09c1805fc3c798ea8cd46cda04d95612 /epan/dissectors/packet-lisp.c | |
parent | 60c04b1d8421a7b62db3a9eb013e77b09ef9197c (diff) |
External subdissectors should be called regardless of 'if(tree)'.
svn path=/trunk/; revision=36940
Diffstat (limited to 'epan/dissectors/packet-lisp.c')
-rw-r--r-- | epan/dissectors/packet-lisp.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/epan/dissectors/packet-lisp.c b/epan/dissectors/packet-lisp.c index 804ac70ff0..34a3244565 100644 --- a/epan/dissectors/packet-lisp.c +++ b/epan/dissectors/packet-lisp.c @@ -825,8 +825,7 @@ dissect_lisp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 type; - proto_item *ti; - proto_tree *lisp_tree; + proto_tree *lisp_tree = NULL; /* Clear Info column before fetching data in case an exception is thrown */ col_clear(pinfo->cinfo, COL_INFO); @@ -845,6 +844,7 @@ dissect_lisp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (tree) { + proto_item *ti; /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_lisp, tvb, 0, @@ -854,28 +854,33 @@ dissect_lisp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_item(lisp_tree, hf_lisp_type, tvb, 0, 3, FALSE); + } - switch (type) { - case LISP_MAP_REQUEST: - dissect_lisp_map_request(tvb, pinfo, lisp_tree); - break; - case LISP_MAP_REPLY: - dissect_lisp_map_reply(tvb, pinfo, lisp_tree); - break; - case LISP_MAP_REGISTER: - dissect_lisp_map_register(tvb, pinfo, lisp_tree); - break; - case LISP_MAP_NOTIFY: - dissect_lisp_map_notify(tvb, pinfo, lisp_tree); - break; - case LISP_ECM: - encapsulated = TRUE; - dissect_lisp_ecm(tvb, pinfo, tree, lisp_tree); - break; - default: - call_dissector(data_handle, tvb, pinfo, tree); - break; - } + /* Sub-dissectors are indirectly called by the following and thus + this code should be executed whether or not tree==NULL. + XXX: Is it acceptable to use 'if (tree)' in the cases where + only the data dissector is indirectly called ? + */ + switch (type) { + case LISP_MAP_REQUEST: + dissect_lisp_map_request(tvb, pinfo, lisp_tree); + break; + case LISP_MAP_REPLY: + dissect_lisp_map_reply(tvb, pinfo, lisp_tree); + break; + case LISP_MAP_REGISTER: + dissect_lisp_map_register(tvb, pinfo, lisp_tree); + break; + case LISP_MAP_NOTIFY: + dissect_lisp_map_notify(tvb, pinfo, lisp_tree); + break; + case LISP_ECM: + encapsulated = TRUE; + dissect_lisp_ecm(tvb, pinfo, tree, lisp_tree); + break; + default: + call_dissector(data_handle, tvb, pinfo, tree); + break; } /* Return the amount of data this dissector was able to dissect */ |