aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ip.c
diff options
context:
space:
mode:
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2010-01-08 23:53:46 +0000
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>2010-01-08 23:53:46 +0000
commit65bbe0573fc349306711aee2fd3b5a7531e94e91 (patch)
tree82ad10bc96f487be9bd2a17d89c8fa61a070e776 /epan/dissectors/packet-ip.c
parent0e12cfa1fabe3ac786d80476e8030e47db9efb05 (diff)
Fix Bug #4177: Analyze ! Expert... doesn't show IP "Bad Checksum" errors.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31471 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-ip.c')
-rw-r--r--epan/dissectors/packet-ip.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 540b4896cc..a6d060c8ab 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -1323,7 +1323,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
const guchar *src_addr, *dst_addr;
guint32 src32, dst32;
proto_tree *tree;
- proto_item *item, *ttl_item;
+ proto_item *item=NULL, *ttl_item;
proto_tree *checksum_tree;
guint16 ttl;
@@ -1353,6 +1353,9 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
/* if IP is not referenced from any filters we dont need to worry about
generating any tree items. We must do this after we created the actual
protocol above so that proto hier stat still works though.
+ XXX: Note that because of the following optimization expert items must
+ not be generated inside of an 'if (tree) ...'
+ so that Analyze ! Expert ... will work.
*/
if(!proto_field_is_referenced(parent_tree, proto_ip)){
tree=NULL;
@@ -1502,10 +1505,13 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
PROTO_ITEM_SET_GENERATED(item);
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_bad, tvb, offset + 10, 2, TRUE);
PROTO_ITEM_SET_GENERATED(item);
- expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");
}
}
- } else {
+ if (ipsum != 0) /* Add expert item always (so tap gets called if present);
+ if (tree==NULL) then item will be NULL
+ else item should be from the add_boolean(..., hf_ip_checksum_bad, ...) above */
+ expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum");
+ } else {
ipsum = 0;
if (tree) {
item = proto_tree_add_uint_format(ip_tree, hf_ip_checksum, tvb, offset + 10, 2, iph->ip_sum,