diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-02-09 23:25:17 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-02-11 05:13:37 +0000 |
commit | 5c4458345ca686e2f34d9c0d6df257cd82dd14c5 (patch) | |
tree | 2a0c0957f01cd69e8f3f105f2e75e84364e48313 /epan/maxmind_db.c | |
parent | 426107f2b5708033e428364151b834be1dc66903 (diff) |
Change maxmind_db_lookup_ipv4 to look more like maxmind_db_lookup_ipv6
Both functions accept an address in network byte order, but
maxmind_db_lookup_ipv4 does not accept a pointer. Add an indirection and
remove unnecessary memcpy calls. This removes some confusion for me.
Change-Id: I291c54c8c55bc8048ca011b84918c8a5d3ed1398
Reviewed-on: https://code.wireshark.org/review/31951
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/maxmind_db.c')
-rw-r--r-- | epan/maxmind_db.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/maxmind_db.c b/epan/maxmind_db.c index 99705eef21..9acf8e047e 100644 --- a/epan/maxmind_db.c +++ b/epan/maxmind_db.c @@ -630,16 +630,16 @@ gboolean maxmind_db_lookup_process(void) } const mmdb_lookup_t * -maxmind_db_lookup_ipv4(guint32 addr) { - mmdb_lookup_t *result = (mmdb_lookup_t *) wmem_map_lookup(mmdb_ipv4_map, GUINT_TO_POINTER(addr)); +maxmind_db_lookup_ipv4(const ws_in4_addr *addr) { + mmdb_lookup_t *result = (mmdb_lookup_t *) wmem_map_lookup(mmdb_ipv4_map, GUINT_TO_POINTER(*addr)); if (!result) { result = &mmdb_not_found; - wmem_map_insert(mmdb_ipv4_map, GUINT_TO_POINTER(addr), result); + wmem_map_insert(mmdb_ipv4_map, GUINT_TO_POINTER(*addr), result); if (mmdbr_pipe_valid()) { char addr_str[WS_INET_ADDRSTRLEN]; - ws_inet_ntop4(&addr, addr_str, WS_INET_ADDRSTRLEN); + ws_inet_ntop4(addr, addr_str, WS_INET_ADDRSTRLEN); MMDB_DEBUG("looking up %s", addr_str); g_async_queue_push(mmdbr_request_q, g_strdup_printf("%s\n", addr_str)); } @@ -707,7 +707,7 @@ maxmind_db_lookup_process(void) } const mmdb_lookup_t * -maxmind_db_lookup_ipv4(guint32 addr _U_) { +maxmind_db_lookup_ipv4(const ws_in4_addr *addr _U_) { return &mmdb_not_found; } |