aboutsummaryrefslogtreecommitdiffstats
path: root/epan/addr_resolv.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-02-08 17:20:26 -0800
committerGerald Combs <gerald@wireshark.org>2018-03-06 18:02:21 +0000
commita1da75c554881667dd92e11f098630f2d604872b (patch)
treeb1d6a60a663bf93f1eede809a0c383544508d6e2 /epan/addr_resolv.c
parentb2d3680558d19998c55b48e9807a26e145756eba (diff)
Transition from GeoIP Legacy to MaxMindDB.
MaxMind is discontinuing its legacy databases in April in favor of GeoIP2, which use a newer database format (MaxMind DB). The reference C library (libmaxminddb) is available under the Apache 2.0 license which isn't quite compatible with ours. Add mmdbresolve, a utility that reads IPv4 and IPv6 addresses on stdin and prints resolved information on stdout. Place it under a liberal license (MIT) so that we can keep libmaxminddb at arm's length. Add epan/maxmind_db.[ch], which spawns mmdbresolve and communicates with it via stdio. Migrate the preferences and documentation to MaxMindDB. Change the IPv4 and IPv6 asnum fields to FT_UINT32s. Change the geographic coordinate fields to FT_DOUBLEs. Bug: 10658 Change-Id: I24aeed637bea1b41d173270bda413af230f4425f Reviewed-on: https://code.wireshark.org/review/26214 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r--epan/addr_resolv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 1cae8a5733..56da73bf69 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -92,6 +92,7 @@
#include <epan/strutil.h>
#include <epan/to_str-int.h>
+#include <epan/maxmind_db.h>
#include <epan/prefs.h>
#define ENAME_HOSTS "hosts"
@@ -245,12 +246,12 @@ static void add_serv_port_cb(const guint32 port, gpointer ptr);
/* http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx#existing
* One-at-a-Time hash
*/
-static guint32
+guint
ipv6_oat_hash(gconstpointer key)
{
int len = 16;
const unsigned char *p = (const unsigned char *)key;
- guint32 h = 0;
+ guint h = 0;
int i;
for ( i = 0; i < len; i++ ) {
@@ -266,7 +267,7 @@ ipv6_oat_hash(gconstpointer key)
return h;
}
-static gboolean
+gboolean
ipv6_equal(gconstpointer v1, gconstpointer v2)
{
@@ -2519,6 +2520,7 @@ host_name_lookup_process(void) {
wmem_list_frame_t* head;
new_resolved_objects = FALSE;
+ nro |= maxmind_db_lookup_process();
if (!async_dns_initialized)
/* c-ares not initialized. Bail out and cancel timers. */
@@ -2579,6 +2581,8 @@ host_name_lookup_process(void) {
new_resolved_objects = FALSE;
+ nro |= maxmind_db_lookup_process();
+
return nro;
}