sharkd: support for MaxMindDB.

Call maxmind_db_lookup_process() [via host_name_lookup_process()] before processing request.
It's still buggy, webshark needs a refresh to show endpoint or conversation ipmap,
but it's better than nothing.

It seems to need refresh, cause maxmind_db_lookup_ipv[46] works only for cached entries.

Also cause mmdbresolve is pipe-based, every sharkd need to have it own mmdbresolve process.

Change-Id: I3d588d1fa9e9ba645cc3d0bff3d276b202159d21
Petri-Dish: Jakub Zawadzki <>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jakub Zawadzki <>
Jakub Zawadzki 2018-05-04 20:38:19 +02:00
parent a834d3794d
commit 5cdff26107
2 changed files with 16 additions and 0 deletions

View File

@ -52,6 +52,7 @@
#include "epan/register.h"
#include <epan/epan_dissect.h>
#include <epan/tap.h>
#include <epan/uat-int.h>
#include <codecs/codecs.h>
@ -195,6 +196,12 @@ main(int argc, char *argv[])
/* Build the column format array */
build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE);
/* mmdbresolve is started from mmdb_resolve_start(), which is called from epan_load_settings via: read_prefs -> (...) uat_load_all -> maxmind_db_post_update_cb.
* Need to stop it, otherwise all sharkd will have same mmdbresolve process, including pipe descriptors to read and write. */
uat_clear(uat_get_table_by_name("MaxMind Database Paths"));
ret = sharkd_loop();

View File

@ -4003,6 +4003,11 @@ sharkd_session_main(void)
filter_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, sharkd_session_filter_free);
/* mmdbresolve was stopped before fork(), force starting it */
uat_get_table_by_name("MaxMind Database Paths")->post_update_cb();
while (fgets(buf, sizeof(buf), stdin))
/* every command is line seperated JSON */
@ -4033,6 +4038,10 @@ sharkd_session_main(void)
return 2;
#if defined(HAVE_C_ARES) || defined(HAVE_MAXMINDDB)
sharkd_session_process(buf, tokens, ret);