From Francisco Vidal Meca via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id...
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Thu, 19 Apr 2012 12:41:12 +0000 (12:41 -0000)
committerAlexis La Goutte <alexis.lagoutte@gmail.com>
Thu, 19 Apr 2012 12:41:12 +0000 (12:41 -0000)
HIP dissector: PUZZLE and SOLUTION parameters variable size

According to specifications, puzzle and solution parameters carry Random #I and
#J fields that has variable length depending of the Hash function. The fields
are recognized with a fixed value of 8 bytes.

The #I and #J fields should be determined depending of the TLV size.

See http://tools.ietf.org/html/draft-ietf-hip-rfc5201-bis-08#section-5.2.5 .

svn path=/trunk/; revision=42140

epan/dissectors/packet-hip.c

index 7a64ebdf3e926c56326ad9fc78b553b2ae48fe6a..fc9ed8e4bdb2f3d896744949653b73c148e011f5 100644 (file)
@@ -748,7 +748,7 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
                 proto_tree_add_item(t, hf_hip_tlv_puzzle_o, tvb, newoffset, 2, ENC_BIG_ENDIAN);
                 /* Puzzle I */
                 newoffset += 2;
-                proto_tree_add_item(t, hf_hip_tlv_puzzle_i, tvb,newoffset, 8, ENC_NA);
+                proto_tree_add_item(t, hf_hip_tlv_puzzle_i, tvb,newoffset, tlv_len - 4, ENC_NA);
                 break;
         case PARAM_SOLUTION:
                 t = proto_item_add_subtree(ti, ett_hip_tlv_data);
@@ -762,10 +762,10 @@ dissect_hip_tlv(tvbuff_t *tvb, int offset, proto_item *ti, int type, int tlv_len
                 proto_tree_add_item(t, hf_hip_tlv_solution_o, tvb,newoffset, 2, ENC_BIG_ENDIAN);
                 /* Solution I */
                 newoffset += 2;
-                proto_tree_add_item(t, hf_hip_tlv_solution_i, tvb, newoffset, 8, ENC_NA);
+                proto_tree_add_item(t, hf_hip_tlv_solution_i, tvb, newoffset, (tlv_len - 4)/2, ENC_NA);
                 /* Solution J */
-                newoffset += 8;
-                proto_tree_add_item(t, hf_hip_tlv_solution_j, tvb, newoffset, 8, ENC_NA);
+                newoffset += (tlv_len - 4) /2;
+                proto_tree_add_item(t, hf_hip_tlv_solution_j, tvb, newoffset, (tlv_len -4)/2, ENC_NA);
                 break;
         case PARAM_SEQ:
                 t = proto_item_add_subtree(ti, ett_hip_tlv_data);