aboutsummaryrefslogtreecommitdiffstats
path: root/epan/maxmind_db.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-03-10 09:20:12 -0800
committerGerald Combs <gerald@wireshark.org>2018-03-10 17:50:33 +0000
commit5564c222e27740166ec36f0cc1e858bcb429f68c (patch)
tree7fd077d56fc18100ad46afdb760e16c1ececa599 /epan/maxmind_db.c
parentaae6b8442cca8373d77980144b1421474fee5c3d (diff)
MaxMind DB: Fixup IPv6 address interning.
Intern IPv6 addresses into their own hash table. Change-Id: I1ad60bf56585fcd89964e949e8754af3c7512a75 Reviewed-on: https://code.wireshark.org/review/26414 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/maxmind_db.c')
-rw-r--r--epan/maxmind_db.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/epan/maxmind_db.c b/epan/maxmind_db.c
index 705130508e..9e8b67a41d 100644
--- a/epan/maxmind_db.c
+++ b/epan/maxmind_db.c
@@ -47,6 +47,7 @@ static wmem_map_t *mmdb_ipv6_map;
// Interned strings
static wmem_map_t *mmdb_str_chunk;
+static wmem_map_t *mmdb_ipv6_chunk;
/* Child mmdbresolve process */
static char cur_addr[WS_INET6_ADDRSTRLEN];
@@ -115,11 +116,11 @@ static const char *chunkify_string(char *key) {
}
static const void *chunkify_v6_addr(const ws_in6_addr *addr) {
- void *chunk_v6_bytes = (char *) wmem_map_lookup(mmdb_ipv6_map, addr->bytes);
+ void *chunk_v6_bytes = (char *) wmem_map_lookup(mmdb_ipv6_chunk, addr->bytes);
if (!chunk_v6_bytes) {
chunk_v6_bytes = wmem_memdup(wmem_epan_scope(), addr->bytes, sizeof(ws_in6_addr));
- wmem_map_insert(mmdb_ipv6_map, chunk_v6_bytes, chunk_v6_bytes);
+ wmem_map_insert(mmdb_ipv6_chunk, chunk_v6_bytes, chunk_v6_bytes);
}
return chunk_v6_bytes;
@@ -237,6 +238,10 @@ static void mmdb_resolve_start(void) {
mmdb_str_chunk = wmem_map_new(wmem_epan_scope(), wmem_str_hash, g_str_equal);
}
+ if (!mmdb_ipv6_chunk) {
+ mmdb_ipv6_chunk = wmem_map_new(wmem_epan_scope(), ipv6_oat_hash, ipv6_equal);
+ }
+
if (!mmdb_file_arr) {
MMDB_DEBUG("unexpected mmdb_file_arr == NULL");
return;