diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2012-09-17 15:18:32 +0000 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2012-09-17 15:18:32 +0000 |
commit | 0002fd11b51039467ac3ca8bc66f72a538f3bb1d (patch) | |
tree | 76349c590daf192b77674162907ed3965c316f43 /epan | |
parent | 9e5e7b75df1b1d4d1f6e37877a11f9623bf6fd6c (diff) |
From me via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7709
Enhance DNS Dissector
Enhance DNS : make TXT, SPF type filterable
svn path=/trunk/; revision=44943
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-dns.c | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index d630dc41af..0490965967 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -114,6 +114,10 @@ static int hf_dns_hinfo_os_length = -1; static int hf_dns_hinfo_os = -1; static int hf_dns_mx_preference = -1; static int hf_dns_mx_mail_exchange = -1; +static int hf_dns_txt_length = -1; +static int hf_dns_txt = -1; +static int hf_dns_spf_length = -1; +static int hf_dns_spf = -1; static int hf_dns_rr_ns = -1; static int hf_dns_rr_opt = -1; static int hf_dns_rr_opt_code = -1; @@ -1671,8 +1675,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, } break; - case T_TXT: - case T_SPF: + case T_TXT: /* Text Strings (16) */ { int rr_len = data_len; int txt_offset; @@ -1682,10 +1685,33 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, txt_offset = cur_offset; while (rr_len != 0) { txt_len = tvb_get_guint8(tvb, txt_offset); - proto_tree_add_text(rr_tree, tvb, txt_offset, 1 + txt_len, - "Text: %.*s", txt_len, tvb_get_ephemeral_string(tvb, txt_offset + 1, txt_len)); - txt_offset += 1 + txt_len; - rr_len -= 1 + txt_len; + proto_tree_add_item(rr_tree, hf_dns_txt_length, tvb, txt_offset, 1, ENC_BIG_ENDIAN); + txt_offset += 1; + rr_len -= 1; + proto_tree_add_item(rr_tree, hf_dns_txt, tvb, txt_offset, txt_len, ENC_BIG_ENDIAN); + txt_offset += txt_len; + rr_len -= txt_len; + } + + } + break; + + case T_SPF: /* Sender Policy Framework (99) */ + { + int rr_len = data_len; + int spf_offset; + int spf_len; + + + spf_offset = cur_offset; + while (rr_len != 0) { + spf_len = tvb_get_guint8(tvb, spf_offset); + proto_tree_add_item(rr_tree, hf_dns_spf_length, tvb, spf_offset, 1, ENC_BIG_ENDIAN); + spf_offset += 1; + rr_len -= 1; + proto_tree_add_item(rr_tree, hf_dns_spf, tvb, spf_offset, spf_len, ENC_BIG_ENDIAN); + spf_offset += spf_len; + rr_len -= spf_len; } } @@ -4113,6 +4139,26 @@ proto_register_dns(void) FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, + { &hf_dns_txt_length, + { "TXT Length", "dns.txt.length", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_dns_txt, + { "TXT", "dns.txt", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + + { &hf_dns_spf_length, + { "SPF Length", "dns.spf.length", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + + { &hf_dns_spf, + { "SPF", "dns.spf", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_dns_rr_ns, { "Name Server", "dns.resp.ns", FT_STRING, BASE_NONE, NULL, 0x0, |