forked from osmocom/wireshark
DNS: Base32-encode NSEC3 Next Hashed Owner Name
As the owner name of each NSEC3 record is Base32-encoded, the Next Hashed Owner Name field in those records should also be displayed in Base32-encoded form. This enables the user to quickly tell what span of hashed owner names is covered by a given NSEC3 record.
This commit is contained in:
parent
f7a882d3eb
commit
d408ad5ba8
|
@ -3344,9 +3344,14 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
|
|||
{
|
||||
int rr_len, initial_offset = cur_offset;
|
||||
guint8 salt_len, hash_len;
|
||||
proto_item *flags_item;
|
||||
proto_item *flags_item, *hash_item;
|
||||
proto_tree *flags_tree;
|
||||
|
||||
/* Base 32 Encoding with Extended Hex Alphabet (see RFC 4648 section 7) */
|
||||
const char *base32hex = "0123456789abcdefghijklmnopqrstuv";
|
||||
char *hash_value_base32hex;
|
||||
int group, in_offset, out_offset;
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_dns_nsec3_algo, tvb, cur_offset, 1, ENC_BIG_ENDIAN);
|
||||
cur_offset += 1;
|
||||
|
||||
|
@ -3369,7 +3374,20 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
|
|||
hash_len = tvb_get_guint8(tvb, cur_offset);
|
||||
cur_offset += 1;
|
||||
|
||||
proto_tree_add_item(rr_tree, hf_dns_nsec3_hash_value, tvb, cur_offset, hash_len, ENC_NA);
|
||||
/*
|
||||
* The code below is optimized for simplicity as trailing padding
|
||||
* characters ("=") are not used in the NSEC3 specification (see RFC 5155
|
||||
* section 1.3).
|
||||
*/
|
||||
hash_value_base32hex = (char *)wmem_alloc0(wmem_packet_scope(), hash_len * 2);
|
||||
for (in_offset = 0, out_offset = 0;
|
||||
in_offset / 8 < hash_len;
|
||||
in_offset += 5, out_offset += 1) {
|
||||
group = tvb_get_bits8(tvb, cur_offset * 8 + in_offset, 5);
|
||||
hash_value_base32hex[out_offset] = base32hex[group];
|
||||
}
|
||||
hash_item = proto_tree_add_string(rr_tree, hf_dns_nsec3_hash_value, tvb, cur_offset, hash_len, hash_value_base32hex);
|
||||
proto_item_set_generated(hash_item);
|
||||
cur_offset += hash_len;
|
||||
|
||||
rr_len = data_len - (cur_offset - initial_offset);
|
||||
|
@ -5915,7 +5933,7 @@ proto_register_dns(void)
|
|||
|
||||
{ &hf_dns_nsec3_hash_value,
|
||||
{ "Next hashed owner", "dns.nsec3.hash_value",
|
||||
FT_BYTES, BASE_NONE, NULL, 0,
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_dns_tlsa_certificate_usage,
|
||||
|
|
Loading…
Reference in New Issue