diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-08-10 22:15:22 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-08-10 22:15:22 +0000 |
commit | c6893212f128446723d60b927bd32f8ddec8c436 (patch) | |
tree | aecad4235d564232579edc85e88f9e2485d29666 /epan/dissectors | |
parent | a8533d84e5d844688ae8137a3477c3de702e2753 (diff) |
For TLV items that are a single integral value and thus must have a
certain length:
attach the expert item to the length field if we're showing it,
otherwise put in a text item for the malformed TLV and attach
the expert item to that;
don't give up, as we'll just skip the bad item and move on to
the next item.
svn path=/trunk/; revision=29373
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-pppoe.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/epan/dissectors/packet-pppoe.c b/epan/dissectors/packet-pppoe.c index 525dec574c..213bcb1bec 100644 --- a/epan/dissectors/packet-pppoe.c +++ b/epan/dissectors/packet-pppoe.c @@ -209,6 +209,7 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr proto_tree *pppoe_tree; proto_item *ti; proto_item *pppoe_tree_tag_length_item = NULL; + proto_item *item; /* Start Decoding Here. */ if (tree) @@ -353,12 +354,18 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr proto_tree_add_item(pppoe_tree, hf_pppoed_tag_seq_num, tvb, tagstart+4, poe_tag_length, FALSE); } else { - if (global_pppoe_show_tags_and_lengths) + if (global_pppoe_show_tags_and_lengths) { proto_item_append_text(pppoe_tree_tag_length_item, " [Wrong: should be 2]"); - expert_add_info_format(pinfo, pppoe_tree, PI_MALFORMED, PI_WARN, - "Sequence Number tag: Wrong length: %d (expected 2)", + item = pppoe_tree_tag_length_item; + } else { + item = proto_tree_add_text(pppoe_tree, tvb, tagstart+4, poe_tag_length, + "%s: Wrong length: %u (expected 2)", + proto_registrar_get_name(hf_pppoed_tag_seq_num), + poe_tag_length); + } + expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, + "Sequence Number tag: Wrong length: %u (expected 2)", poe_tag_length); - return; /* we can do no more */ } break; case PPPOE_TAG_CRED_SCALE: @@ -366,12 +373,18 @@ dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tr proto_tree_add_item(pppoe_tree, hf_pppoed_tag_cred_scale, tvb, tagstart+4, poe_tag_length, FALSE); } else { - if (global_pppoe_show_tags_and_lengths) + if (global_pppoe_show_tags_and_lengths) { proto_item_append_text(pppoe_tree_tag_length_item, " [Wrong: should be 2]"); - expert_add_info_format(pinfo, pppoe_tree, PI_MALFORMED, PI_WARN, - "Credit Scale Factor tag: Wrong length: %d (expected 2)", + item = pppoe_tree_tag_length_item; + } else { + item = proto_tree_add_text(pppoe_tree, tvb, tagstart+4, poe_tag_length, + "%s: Wrong length: %u (expected 2)", + proto_registrar_get_name(hf_pppoed_tag_cred_scale), + poe_tag_length); + } + expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, + "Credit Scale Factor tag: Wrong length: %u (expected 2)", poe_tag_length); - return; /* we can do no more */ } break; case PPPOE_TAG_RELAY_ID: |