Add a preference for whether to use names found in DNS packets for address

resolution.

svn path=/trunk/; revision=51584
This commit is contained in:
Evan Huus 2013-08-30 01:29:46 +00:00
parent 2e857954a3
commit d9eb37b849
1 changed files with 12 additions and 4 deletions

View File

@ -270,6 +270,9 @@ static range_t *global_dns_udp_port_range;
/* desegmentation of DNS over TCP */
static gboolean dns_desegment = TRUE;
/* whether or not to use DNS data we see in packets to resolve addresses */
static gboolean dns_use_for_addr_resolution = TRUE;
/* Dissector handle for GSSAPI */
static dissector_handle_t gssapi_handle;
static dissector_handle_t ntlmssp_handle;
@ -1589,7 +1592,6 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
case T_A:
{
const char *addr;
guint32 addr_int;
addr = tvb_ip_to_str(tvb, cur_offset);
if (cinfo != NULL) {
@ -1599,7 +1601,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
proto_item_append_text(trr, ", addr %s", addr);
proto_tree_add_item(rr_tree, hf_dns_rr_addr, tvb, cur_offset, 4, ENC_BIG_ENDIAN);
if ((dns_class & 0x7f) == C_IN) {
if (dns_use_for_addr_resolution && (dns_class & 0x7f) == C_IN) {
guint32 addr_int;
tvb_memcpy(tvb, &addr_int, cur_offset, sizeof(addr_int));
add_ipv4_name(addr_int, name);
}
@ -2110,7 +2113,6 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
case T_AAAA: /* IPv6 Address (28) */
{
const char *addr6;
struct e_in6_addr addr_in6;
addr6 = tvb_ip6_to_str(tvb, cur_offset);
if (cinfo != NULL) {
@ -2121,7 +2123,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
proto_tree_add_item(rr_tree, hf_dns_aaaa, tvb, cur_offset, 16, ENC_NA);
if ((dns_class & 0x7f) == C_IN) {
if (dns_use_for_addr_resolution && (dns_class & 0x7f) == C_IN) {
struct e_in6_addr addr_in6;
tvb_memcpy(tvb, &addr_in6, cur_offset, sizeof(addr_in6));
add_ipv6_name(&addr_in6, name);
}
@ -4881,6 +4884,11 @@ proto_register_dns(void)
" To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
&dns_desegment);
prefs_register_bool_preference(dns_module, "use_for_addr_resolution",
"Use DNS packet data for address resolution",
"Whether address/name pairs found in dissected DNS packets should be used by Wireshark for name resolution.",
&dns_use_for_addr_resolution);
dns_tsig_dissector_table = register_dissector_table("dns.tsig.mac", "DNS TSIG MAC Dissectors", FT_STRING, BASE_NONE);
}
/*