diff options
author | Bill Meier <wmeier@newsguy.com> | 2012-07-29 20:11:33 +0000 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2012-07-29 20:11:33 +0000 |
commit | 72f8a17e9246cdb1250e869bdcfea1b29f2916ad (patch) | |
tree | 9b69db4a4c7bd7d30e319e75549de227435debbf | |
parent | b94cd13e93548784fb064322ea3b418d6cbe05ba (diff) |
Minor cleanup....
svn path=/trunk/; revision=44116
-rw-r--r-- | epan/dissectors/packet-mpls-y1711.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/epan/dissectors/packet-mpls-y1711.c b/epan/dissectors/packet-mpls-y1711.c index b0eec24be0..764fc535a1 100644 --- a/epan/dissectors/packet-mpls-y1711.c +++ b/epan/dissectors/packet-mpls-y1711.c @@ -102,20 +102,19 @@ static const value_string y1711_defect_type_vals[] = { static int dissect_mpls_y1711(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - proto_tree *mpls_y1711_tree = NULL; struct mplsinfo *mplsinfo = pinfo->private_data; - proto_item *ti = NULL; - int functype = -1; int offset = 0; - tvbuff_t *data_tvb = NULL; + proto_item *ti; + proto_tree *mpls_y1711_tree; + int functype; + tvbuff_t *data_tvb; + static const guint8 allone[] = { 0xff, 0xff }; + static const guint8 allzero[] = { 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00 }; - const guint8 allone[] = { 0xff, 0xff }; - const guint8 allzero[] = { 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00 }; - functype = tvb_get_guint8(tvb, offset); col_append_fstr(pinfo->cinfo, COL_INFO, " (Y.1711: %s)", (functype == 0x01) ? "CV" : @@ -139,12 +138,12 @@ dissect_mpls_y1711(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return tvb_reported_length(tvb); } + if (!tree) + return tvb_reported_length(tvb); + ti = proto_tree_add_text(tree, tvb, offset, 44, "Y.1711 OAM"); mpls_y1711_tree = proto_item_add_subtree(ti, ett_mpls_y1711); - if (!mpls_y1711_tree) - return tvb_reported_length(tvb); - /* checks for exp, bos and ttl encoding */ if (mplsinfo->label != LABEL_OAM_ALERT) proto_tree_add_text(mpls_y1711_tree, tvb, offset - 4, 3, |