aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ospf.c
diff options
context:
space:
mode:
authorJoerg Mayer <jmayer@loplof.de>2015-08-22 16:11:35 +0400
committerJörg Mayer <jmayer@loplof.de>2015-08-22 12:21:48 +0000
commit5a7f574cbd2af2f271df1a94e682ade7fa607ef9 (patch)
tree91d87e5e16c8c9929edf12df7604542bf79c6016 /epan/dissectors/packet-ospf.c
parentb0a8fa59f891b843a8fa6a6084f3fb73fb09e3ac (diff)
Fix two bugs
1) Introduced by me in commit c4fe7129d802752aa4cc89a66d2d5d5f2698e020 where I didn't honor the "print lsa header only" flag properly for data highlighting 2) Introduced in 2001 with commit dd1b7eafafb5748757a0396f4cc6ad6e65f37483 which moved offset increasing into an "if (tree)" statement with code after the if statement continuing to work with offset. Also make display of v2 and v3 LSAs the same again (forgot one case in previous commit. bug:11461 Change-Id: I1986c19842f1fa9c8a6d0a7c9a79c64939eeb9d0 Reviewed-on: https://code.wireshark.org/review/10192 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Diffstat (limited to 'epan/dissectors/packet-ospf.c')
-rw-r--r--epan/dissectors/packet-ospf.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/epan/dissectors/packet-ospf.c b/epan/dissectors/packet-ospf.c
index 6dc9a499bb..d39c4f90b9 100644
--- a/epan/dissectors/packet-ospf.c
+++ b/epan/dissectors/packet-ospf.c
@@ -1562,8 +1562,6 @@ dissect_ospf_db_desc(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *
dissect_ospf_bitfield(ospf_db_desc_tree, tvb, offset + 3, &bfinfo_dbd);
proto_tree_add_item(ospf_db_desc_tree, hf_ospf_db_dd_sequence, tvb, offset + 4, 4, ENC_BIG_ENDIAN);
-
- offset += 8;
break;
case OSPF_VERSION_3:
@@ -1585,10 +1583,16 @@ dissect_ospf_db_desc(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *
dissect_ospf_bitfield(ospf_db_desc_tree, tvb, offset + 7, &bfinfo_dbd);
proto_tree_add_item(ospf_db_desc_tree, hf_ospf_db_dd_sequence, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
-
- offset += 12;
break;
- }
+ }
+ }
+ switch (version ) {
+ case OSPF_VERSION_2:
+ offset += 8;
+ break;
+ case OSPF_VERSION_3:
+ offset += 12;
+ break;
}
/* LS Headers will be processed here */
@@ -2449,11 +2453,11 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *t
ls_length = tvb_get_ntohs(tvb, offset + 18);
end_offset = offset + ls_length;
- ospf_lsa_tree = proto_tree_add_subtree_format(tree, tvb, offset, ls_length,
- ett_ospf_lsa, &lsa_ti, "LSA-type %d (%s), len %d",
- ls_type, val_to_str(ls_type, ls_type_vals, "Unknown (%d)"),
- ls_length);
-
+ ospf_lsa_tree = proto_tree_add_subtree_format(tree, tvb, offset,
+ disassemble_body?ls_length:OSPF_LSA_HEADER_LENGTH,
+ ett_ospf_lsa, &lsa_ti, "LSA-type %d (%s), len %d",
+ ls_type, val_to_str_const(ls_type, ls_type_vals, "Unknown"),
+ ls_length);
proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_age, tvb,
offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_donotage, tvb,
@@ -2714,14 +2718,11 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *t
ls_length = tvb_get_ntohs(tvb, offset + 18);
end_offset = offset + ls_length;
- if (disassemble_body) {
- ospf_lsa_tree = proto_tree_add_subtree_format(tree, tvb, offset, ls_length,
- ett_ospf_lsa, &type_item, "%s (Type: 0x%04x)", val_to_str_const(ls_type, v3_ls_type_vals,"Unknown"), ls_type);
- } else {
- ospf_lsa_tree = proto_tree_add_subtree(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
- ett_ospf_lsa, &type_item, "LSA Header");
- }
-
+ ospf_lsa_tree = proto_tree_add_subtree_format(tree, tvb, offset,
+ disassemble_body?ls_length:OSPF_LSA_HEADER_LENGTH,
+ ett_ospf_lsa, &type_item, "LSA-type %d (%s), len %d",
+ ls_type, val_to_str_const(ls_type, v3_ls_type_vals, "Unknown"),
+ ls_length);
proto_tree_add_item(ospf_lsa_tree, hf_ospf_ls_age, tvb, offset, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(ospf_lsa_tree, hf_ospf_v3_lsa_do_not_age, tvb, offset, 2, ENC_BIG_ENDIAN);