aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-08-29 18:59:49 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-08-29 18:59:49 +0000
commit39a61a1680b5a7405d7e81f9c15903fc958cc0cd (patch)
tree4c3b66b00f2c5304399864875476d5a1e73205fe /epan
parentbc654875f03fef8248b06b4bdc8bd26df0a50211 (diff)
downloadwireshark-39a61a1680b5a7405d7e81f9c15903fc958cc0cd.tar.gz
wireshark-39a61a1680b5a7405d7e81f9c15903fc958cc0cd.tar.bz2
wireshark-39a61a1680b5a7405d7e81f9c15903fc958cc0cd.zip
Don't store address in the hastable when name resolution is off.
svn path=/trunk/; revision=51577
Diffstat (limited to 'epan')
-rw-r--r--epan/addr_resolv.c30
-rw-r--r--epan/addr_resolv.h2
2 files changed, 11 insertions, 21 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 8107cab2be..7bad2dcad1 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -899,7 +899,6 @@ new_ipv4(const guint addr)
tp->addr = addr;
tp->resolve = FALSE;
tp->is_dummy_entry = FALSE;
- ip_to_str_buf((const guint8 *)&addr, tp->ip, sizeof(tp->ip));
return tp;
}
@@ -985,7 +984,6 @@ new_ipv6(const struct e_in6_addr *addr)
tp->addr = *addr;
tp->resolve = FALSE;
tp->is_dummy_entry = FALSE;
- ip6_to_str_buf(addr, tp->ip6);
return tp;
}
@@ -1040,7 +1038,6 @@ try_resolv:
* going to risk changing the semantics.
*/
if (!tp->is_dummy_entry) {
- g_strlcpy(tp->name, tp->ip6, MAXNAMELEN);
ip6_to_str_buf(addr, tp->name);
tp->is_dummy_entry = TRUE;
}
@@ -1062,7 +1059,6 @@ try_resolv:
/* unknown host or DNS timeout */
if (!tp->is_dummy_entry) {
tp->is_dummy_entry = TRUE;
- g_strlcpy(tp->name, tp->ip6, MAXNAMELEN);
}
*found = FALSE;
return tp;
@@ -2656,14 +2652,12 @@ const gchar *
get_hostname(const guint addr)
{
gboolean found;
-
- /* XXX why do we call this if we're not resolving? To create hash entries?
- * Why?
- */
- hashipv4_t *tp = host_lookup(addr, &found);
+ hashipv4_t *tp;
if (!gbl_resolv_flags.network_name)
- return tp->ip;
+ return ip_to_str((guint8*)&addr);
+
+ tp = host_lookup(addr, &found);
return tp->name;
}
@@ -2674,16 +2668,14 @@ const gchar *
get_hostname6(const struct e_in6_addr *addr)
{
gboolean found;
-
- /* XXX why do we call this if we're not resolving? To create hash entries?
- * Why?
- */
- hashipv6_t *tp = host_lookup6(addr, &found);
+ hashipv6_t *tp;
if (!gbl_resolv_flags.network_name)
- return tp->ip6;
+ return ip6_to_str(addr);
- return tp->name;
+ tp = host_lookup6(addr, &found);
+
+ return tp->name;
}
/* -------------------------- */
@@ -2698,7 +2690,7 @@ add_ipv4_name(const guint addr, const gchar *name)
* Don't add zero-length names; apparently, some resolvers will return
* them if they get them from DNS.
*/
- if (name[0] == '\0')
+ if ((name[0] == '\0')||(!gbl_resolv_flags.network_name))
return;
@@ -2753,7 +2745,7 @@ add_ipv6_name(const struct e_in6_addr *addrp, const gchar *name)
* Don't add zero-length names; apparently, some resolvers will return
* them if they get them from DNS.
*/
- if (name[0] == '\0')
+ if ((name[0] == '\0')||(!gbl_resolv_flags.network_name))
return;
tp = (hashipv6_t *)g_hash_table_lookup(ipv6_hash_table, addrp);
diff --git a/epan/addr_resolv.h b/epan/addr_resolv.h
index c6743a3a2f..72f03def93 100644
--- a/epan/addr_resolv.h
+++ b/epan/addr_resolv.h
@@ -80,7 +80,6 @@ typedef struct hashipv4 {
guint addr;
gboolean is_dummy_entry; /* name is IPv4 address in dot format */
gboolean resolve; /* already tried to resolve it */
- gchar ip[16];
gchar name[MAXNAMELEN];
} hashipv4_t;
@@ -89,7 +88,6 @@ typedef struct hashipv6 {
struct e_in6_addr addr;
gboolean is_dummy_entry; /* name is IPv6 address in colon format */
gboolean resolve; /* */
- gchar ip6[MAX_IP6_STR_LEN]; /* XX */
gchar name[MAXNAMELEN];
} hashipv6_t;
/*