aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-dns.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2013-09-03 06:34:00 +0000
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2013-09-03 06:34:00 +0000
commitb7e78c778a29e064698ac09a1faa80867b1e6a95 (patch)
treef5ece0036fb9391dc926506d9f5427fe8d08870e /epan/dissectors/packet-dns.c
parent8e237acf74c5dbd5f0a721e60f9034ab89298ee5 (diff)
Enhance AFSDB and RT type
Convert proto_tree_add_text calls to proto_tree_add_item svn path=/trunk/; revision=51702
Diffstat (limited to 'epan/dissectors/packet-dns.c')
-rw-r--r--epan/dissectors/packet-dns.c60
1 files changed, 51 insertions, 9 deletions
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 448221b78e..675c3c2a58 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -267,6 +267,10 @@ static int hf_dns_gpos_altitude_length = -1;
static int hf_dns_gpos_altitude = -1;
static int hf_dns_rp_mailbox = -1;
static int hf_dns_rp_txt_rr = -1;
+static int hf_dns_afsdb_subtype = -1;
+static int hf_dns_afsdb_hostname = -1;
+static int hf_dns_rt_preference = -1;
+static int hf_dns_rt_intermediate_host = -1;
static int hf_dns_nsap_rdata = -1;
static int hf_dns_caa_flags = -1;
static int hf_dns_caa_flag_issuer_critical = -1;
@@ -3247,30 +3251,48 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
}
break;
- case T_AFSDB:
- case T_RT:
+ case T_AFSDB: /* AFS data base location (18) */
{
- guint16 subtype = 0;
const guchar *host_name;
int host_name_len;
if (cinfo != NULL) {
col_append_fstr(cinfo, COL_INFO, " %s", name);
}
- subtype = tvb_get_ntohs(tvb, cur_offset);
+
host_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &host_name);
if (data_len < 1) {
goto bad_rr;
}
- proto_tree_add_text(rr_tree, tvb, cur_offset, 2,
- (type == T_AFSDB) ? "Subtype: %u" : "Preference: %u", subtype);
- proto_tree_add_text(rr_tree, tvb, cur_offset + 2, host_name_len,
- (type == T_AFSDB) ? "Hostname: %s" : "Intermediate-Host: %s",
- format_text(host_name, strlen(host_name)));
+ proto_tree_add_item(rr_tree, hf_dns_afsdb_subtype, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+ cur_offset =+ 2;
+
+ proto_tree_add_string(rr_tree, hf_dns_afsdb_hostname, tvb, cur_offset, host_name_len, host_name);
}
+ case T_RT: /* Route-Through (21) */
+ {
+ const guchar *host_name;
+ int host_name_len;
+
+ if (cinfo != NULL) {
+ col_append_fstr(cinfo, COL_INFO, " %s", name);
+ }
+
+ host_name_len = get_dns_name(tvb, cur_offset + 2, 0, dns_data_offset, &host_name);
+
+ if (data_len < 1) {
+ goto bad_rr;
+ }
+
+ proto_tree_add_item(rr_tree, hf_dns_rt_preference, tvb, cur_offset, 2, ENC_BIG_ENDIAN);
+ cur_offset =+ 2;
+
+ proto_tree_add_string(rr_tree, hf_dns_rt_intermediate_host, tvb, cur_offset, host_name_len, host_name);
+
+ }
break;
case T_X25:
@@ -4982,6 +5004,26 @@ proto_register_dns(void)
FT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL }},
+ { &hf_dns_afsdb_subtype,
+ { "Subtype","dns.afsdb.subtype",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }},
+
+ { &hf_dns_afsdb_hostname,
+ { "Hostname","dns.afsdb.hostname",
+ FT_STRING, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
+
+ { &hf_dns_rt_preference,
+ { "Preference","dns.rt.subtype",
+ FT_UINT16, BASE_DEC, NULL, 0,
+ NULL, HFILL }},
+
+ { &hf_dns_rt_intermediate_host,
+ { "Intermediate Hostname","dns.rt.intermediate_host",
+ FT_STRING, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
+
{ &hf_dns_nsap_rdata,
{ "NSAP Data", "dns.nsap.rdata",
FT_BYTES, BASE_NONE, NULL, 0,