diff options
author | Gerald Combs <gerald@wireshark.org> | 2008-12-19 23:49:03 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2008-12-19 23:49:03 +0000 |
commit | 7d22c0fb7f065d45c744fd97fee785f4b9ed8556 (patch) | |
tree | a7873b88f53d9a7db8509a12e299a82b3ef9001b | |
parent | 6d04f793f019b456f8d8c81f231152fbba24da8b (diff) |
Rename geoip.[ch] to geoip_db.[ch] so we don't collide with GeoIP.h. Rename
some functions to match.
Add GeoIP lookups to the IP dissector. Add a preference for GeoIP lookups,
which is disabled by default.
svn path=/trunk/; revision=27063
-rw-r--r-- | epan/Makefile.common | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ip.c | 180 | ||||
-rw-r--r-- | epan/epan.c | 4 | ||||
-rw-r--r-- | epan/geoip_db.c (renamed from epan/geoip.c) | 83 | ||||
-rw-r--r-- | epan/geoip_db.h (renamed from epan/geoip.h) | 27 | ||||
-rw-r--r-- | gtk/about_dlg.c | 4 | ||||
-rw-r--r-- | gtk/hostlist_table.c | 4 | ||||
-rw-r--r-- | version_info.c | 2 |
8 files changed, 241 insertions, 67 deletions
diff --git a/epan/Makefile.common b/epan/Makefile.common index 6529e792fc..371c2dcca7 100644 --- a/epan/Makefile.common +++ b/epan/Makefile.common @@ -56,7 +56,7 @@ LIBWIRESHARK_SRC = \ frequency-utils.c \ funnel.c \ gcp.c \ - geoip.c \ + geoip_db.c \ golay.c \ guid-utils.c \ h225-persistentdata.c \ @@ -173,7 +173,7 @@ LIBWIRESHARK_INCLUDES = \ funnel.h \ garrayfix.h \ gcp.h \ - geoip.h \ + geoip_db.h \ golay.h \ gnuc_format_check.h \ greproto.h \ diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index b835f4302b..756d310e29 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -63,6 +63,11 @@ #include <epan/expert.h> #include <epan/strutil.h> +#ifdef HAVE_GEOIP +#include "GeoIP.h" +#include <epan/geoip_db.h> +#endif /* HAVE_GEOIP */ + static int ip_tap = -1; static void dissect_icmp(tvbuff_t *, packet_info *, proto_tree *); @@ -86,6 +91,11 @@ static gboolean ip_check_checksum = TRUE; /* Assume TSO and correct zero-length IP packets */ static gboolean ip_tso_supported = FALSE; +#ifdef HAVE_GEOIP +/* Look up addresses in GeoIP */ +static gboolean ip_use_geoip = FALSE; +#endif /* HAVE_GEOIP */ + static int proto_ip = -1; static int hf_ip_version = -1; static int hf_ip_hdr_len = -1; @@ -126,6 +136,24 @@ static int hf_ip_fragment_too_long_fragment = -1; static int hf_ip_fragment_error = -1; static int hf_ip_reassembled_in = -1; +#ifdef HAVE_GEOIP +static int hf_geoip_country = -1; +static int hf_geoip_city = -1; +static int hf_geoip_org = -1; +static int hf_geoip_isp = -1; +static int hf_geoip_asnum = -1; +static int hf_geoip_src_country = -1; +static int hf_geoip_src_city = -1; +static int hf_geoip_src_org = -1; +static int hf_geoip_src_isp = -1; +static int hf_geoip_src_asnum = -1; +static int hf_geoip_dst_country = -1; +static int hf_geoip_dst_city = -1; +static int hf_geoip_dst_org = -1; +static int hf_geoip_dst_isp = -1; +static int hf_geoip_dst_asnum = -1; +#endif /* HAVE_GEOIP */ + static gint ett_ip = -1; static gint ett_ip_dsfield = -1; static gint ett_ip_tos = -1; @@ -380,11 +408,11 @@ static gint ett_icmp_mpls_stack_object = -1; /* Return true if the address is in the 224.0.0.0/24 network block */ #define is_a_local_network_control_block_addr(addr) \ - ((addr & 0xffffff00) == 0xe0000000) + ((addr & 0xffffff00) == 0xe0000000) /* Return true if the address is in the 224.0.0.0/4 network block */ #define is_a_multicast_addr(addr) \ - ((addr & 0xf0000000) == 0xe0000000) + ((addr & 0xf0000000) == 0xe0000000) /* * defragmentation of IPv4 @@ -1186,7 +1214,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { proto_tree *ip_tree = NULL, *field_tree; proto_item *ti = NULL, *tf; - guint32 addr; + guint32 src_naddr, dst_naddr; int offset = 0; guint hlen, optlen; guint16 flags; @@ -1205,6 +1233,11 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree *tree; proto_item *item, *ttl_item; proto_tree *checksum_tree; +#ifdef HAVE_GEOIP + guint dbnum; + int geoip_hf, geoip_src_hf, geoip_dst_hf; + const char *geoip_src_str, *geoip_dst_str; +#endif /* HAVE_GEOIP */ tree=parent_tree; @@ -1259,7 +1292,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_uint_format(ip_tree, hf_ip_hdr_len, tvb, offset, 1, hlen, "Header length: %u bytes", hlen); } - + iph->ip_tos = tvb_get_guint8(tvb, offset + 1); if (check_col(pinfo->cinfo, COL_DSCP_VALUE)) { col_add_fstr(pinfo->cinfo, COL_DSCP_VALUE, "%u", IPDSFIELD_DSCP(iph->ip_tos)); @@ -1302,7 +1335,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) * If ip_len is zero, assume TSO and use the reported length instead. Note * that we need to use the frame/reported length instead of the * actually-available length, just in case a snaplen was used on capture. */ - if (ip_tso_supported && !iph->ip_len) + if (ip_tso_supported && !iph->ip_len) iph->ip_len = tvb_reported_length(tvb); if (iph->ip_len < hlen) { @@ -1407,13 +1440,13 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (tree) { const char *src_host; - memcpy(&addr, iph->ip_src.data, 4); - src_host = get_hostname(addr); + memcpy(&src_naddr, iph->ip_src.data, 4); + src_host = get_hostname(src_naddr); if (ip_summary_in_tree) { proto_item_append_text(ti, ", Src: %s (%s)", src_host, ip_to_str(iph->ip_src.data)); } - proto_tree_add_ipv4(ip_tree, hf_ip_src, tvb, offset + 12, 4, addr); - item = proto_tree_add_ipv4(ip_tree, hf_ip_addr, tvb, offset + 12, 4, addr); + proto_tree_add_ipv4(ip_tree, hf_ip_src, tvb, offset + 12, 4, src_naddr); + item = proto_tree_add_ipv4(ip_tree, hf_ip_addr, tvb, offset + 12, 4, src_naddr); PROTO_ITEM_SET_HIDDEN(item); item = proto_tree_add_string(ip_tree, hf_ip_src_host, tvb, offset + 12, 4, src_host); PROTO_ITEM_SET_GENERATED(item); @@ -1440,7 +1473,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) */ if (is_a_local_network_control_block_addr(dst32)) { if (ttl != 1) { - expert_add_info_format(pinfo, ttl_item, PI_SEQUENCE, PI_NOTE, + expert_add_info_format(pinfo, ttl_item, PI_SEQUENCE, PI_NOTE, "\"Time To Live\" > 1 for a packet sent to the Local Network Control Block (see RFC 3171)"); } } else if (!is_a_multicast_addr(dst32) && ttl < 5) { @@ -1450,13 +1483,13 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (tree) { const char *dst_host; - memcpy(&addr, iph->ip_dst.data, 4); - dst_host = get_hostname(addr); + memcpy(&dst_naddr, iph->ip_dst.data, 4); + dst_host = get_hostname(dst_naddr); if (ip_summary_in_tree) { proto_item_append_text(ti, ", Dst: %s (%s)", dst_host, ip_to_str(iph->ip_dst.data)); } - proto_tree_add_ipv4(ip_tree, hf_ip_dst, tvb, offset + 16, 4, addr); - item = proto_tree_add_ipv4(ip_tree, hf_ip_addr, tvb, offset + 16, 4, addr); + proto_tree_add_ipv4(ip_tree, hf_ip_dst, tvb, offset + 16, 4, dst_naddr); + item = proto_tree_add_ipv4(ip_tree, hf_ip_addr, tvb, offset + 16, 4, dst_naddr); PROTO_ITEM_SET_HIDDEN(item); item = proto_tree_add_string(ip_tree, hf_ip_dst_host, tvb, offset + 16, 4, dst_host); PROTO_ITEM_SET_GENERATED(item); @@ -1466,6 +1499,71 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) PROTO_ITEM_SET_HIDDEN(item); } +#ifdef HAVE_GEOIP + if (tree && ip_use_geoip) { + for (dbnum = 0; dbnum < geoip_num_dbs(); dbnum++) { + geoip_src_str = geoip_db_lookup_ipv4(dbnum, src_naddr, NULL); + geoip_dst_str = geoip_db_lookup_ipv4(dbnum, dst_naddr, NULL); + + switch (geoip_db_type(dbnum)) { + case GEOIP_COUNTRY_EDITION: + geoip_hf = hf_geoip_country; + geoip_src_hf = hf_geoip_src_country; + geoip_dst_hf = hf_geoip_dst_country; + break; + case GEOIP_CITY_EDITION_REV0: + geoip_hf = hf_geoip_city; + geoip_src_hf = hf_geoip_src_city; + geoip_dst_hf = hf_geoip_dst_city; + break; + case GEOIP_CITY_EDITION_REV1: + geoip_hf = hf_geoip_city; + geoip_src_hf = hf_geoip_src_city; + geoip_dst_hf = hf_geoip_dst_city; + break; + case GEOIP_ORG_EDITION: + geoip_hf = hf_geoip_org; + geoip_src_hf = hf_geoip_src_org; + geoip_dst_hf = hf_geoip_dst_org; + break; + case GEOIP_ISP_EDITION: + geoip_hf = hf_geoip_isp; + geoip_src_hf = hf_geoip_src_isp; + geoip_dst_hf = hf_geoip_dst_isp; + break; + case GEOIP_ASNUM_EDITION: + geoip_hf = hf_geoip_asnum; + geoip_src_hf = hf_geoip_src_asnum; + geoip_dst_hf = hf_geoip_dst_asnum; + break; + default: + continue; + break; + } + + if (geoip_src_str) { + item = proto_tree_add_string_format_value(ip_tree, geoip_src_hf, tvb, + offset + IPH_SRC, 4, geoip_src_str, "%s", geoip_src_str); + PROTO_ITEM_SET_GENERATED(item); + item = proto_tree_add_string_format_value(ip_tree, geoip_hf, tvb, + offset + IPH_SRC, 4, geoip_src_str, "%s", geoip_src_str); + PROTO_ITEM_SET_GENERATED(item); + PROTO_ITEM_SET_HIDDEN(item); + } + + if (geoip_dst_str) { + item = proto_tree_add_string_format_value(ip_tree, geoip_dst_hf, tvb, + offset + IPH_DST, 4, geoip_dst_str, "%s", geoip_dst_str); + PROTO_ITEM_SET_GENERATED(item); + item = proto_tree_add_string_format_value(ip_tree, geoip_hf, tvb, + offset + IPH_DST, 4, geoip_dst_str, "%s", geoip_dst_str); + PROTO_ITEM_SET_GENERATED(item); + PROTO_ITEM_SET_HIDDEN(item); + } + } + } +#endif /* HAVE_GEOIP */ + if (tree) { /* Decode IP options, if any. */ if (hlen > IPH_MIN_LEN) { @@ -2425,7 +2523,53 @@ proto_register_ip(void) { &hf_ip_host, { "Source or Destination Host", "ip.host", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, - +#ifdef HAVE_GEOIP + { &hf_geoip_country, + { "Source or Destination GeoIP Country", "ip.geoip.country", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_city, + { "Source or Destination GeoIP City", "ip.geoip.city", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_org, + { "Source or Destination GeoIP Organization", "ip.geoip.org", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_isp, + { "Source or Destination GeoIP ISP", "ip.geoip.isp", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_asnum, + { "Source or Destination GeoIP AS Number", "ip.geoip.asnum", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_src_country, + { "Source GeoIP Country", "ip.geoip.src_country", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_src_city, + { "Source GeoIP City", "ip.geoip.src_city", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_src_org, + { "Source GeoIP Organization", "ip.geoip.src_org", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_src_isp, + { "Source GeoIP ISP", "ip.geoip.src_isp", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_src_asnum, + { "Source GeoIP AS Number", "ip.geoip.src_asnum", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_dst_country, + { "Destination GeoIP Country", "ip.geoip.dst_country", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_dst_city, + { "Destination GeoIP City", "ip.geoip.dst_city", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_dst_org, + { "Destination GeoIP Organization", "ip.geoip.dst_org", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_dst_isp, + { "Destination GeoIP ISP", "ip.geoip.dst_isp", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, + { &hf_geoip_dst_asnum, + { "Destination GeoIP AS Number", "ip.geoip.dst_asnum", FT_STRING, BASE_NONE, NULL, 0x0, + "", HFILL }}, +#endif /* HAVE_GEOIP */ { &hf_ip_flags, { "Flags", "ip.flags", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }}, @@ -2544,6 +2688,12 @@ proto_register_ip(void) "Support packet-capture from IP TSO-enabled hardware", "Whether to correct for TSO-enabled hardware captures, such as spoofing the IP packet length", &ip_tso_supported); +#ifdef HAVE_GEOIP + prefs_register_bool_preference(ip_module, "use_geoip" , + "Enable GeoIP lookups", + "Whether to look up IP addresses in each GeoIP database we have loaded", + &ip_use_geoip); +#endif /* HAVE_GEOIP */ register_dissector("ip", dissect_ip, proto_ip); register_init_routine(ip_defragment_init); diff --git a/epan/epan.c b/epan/epan.c index 22f3940aff..c835defd85 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -60,7 +60,7 @@ #endif #ifdef HAVE_GEOIP -#include "geoip.h" +#include "geoip_db.h" #endif gchar* @@ -107,7 +107,7 @@ epan_init(void (*register_all_protocols_func)(register_cb cb, gpointer client_da wslua_init(NULL); #endif #ifdef HAVE_GEOIP - geoip_init(); + geoip_db_init(); #endif } diff --git a/epan/geoip.c b/epan/geoip_db.c index 179095e0a1..3408bdb4a9 100644 --- a/epan/geoip.c +++ b/epan/geoip_db.c @@ -1,4 +1,4 @@ -/* geoip.c +/* geoip_db.c * GeoIP database support * * Copyright 2008, Gerald Combs <gerald@wireshark.org> @@ -39,7 +39,7 @@ #include "GeoIP.h" #include "GeoIPCity.h" -#include "geoip.h" +#include "geoip_db.h" #include "uat.h" #include "prefs.h" #include "report_err.h" @@ -51,17 +51,17 @@ /* Column names for each database type */ value_string geoip_type_name_vals[] = { - { GEOIP_COUNTRY_EDITION, "Country" }, - { GEOIP_REGION_EDITION_REV0, "Region" }, - { GEOIP_CITY_EDITION_REV0, "City" }, - { GEOIP_ORG_EDITION, "Organization" }, - { GEOIP_ISP_EDITION, "ISP" }, - { GEOIP_CITY_EDITION_REV1, "City" }, - { GEOIP_REGION_EDITION_REV1, "Region" }, - { GEOIP_PROXY_EDITION, "Proxy" }, - { GEOIP_ASNUM_EDITION, "AS Number" }, - { GEOIP_NETSPEED_EDITION, "Speed" }, - { GEOIP_DOMAIN_EDITION, "Domain" }, + { GEOIP_COUNTRY_EDITION, "Country" }, + { GEOIP_REGION_EDITION_REV0, "Region" }, + { GEOIP_CITY_EDITION_REV0, "City"}, + { GEOIP_ORG_EDITION, "Organization" }, + { GEOIP_ISP_EDITION, "ISP" }, + { GEOIP_CITY_EDITION_REV1, "City" }, + { GEOIP_REGION_EDITION_REV1, "Region" }, + { GEOIP_PROXY_EDITION, "Proxy" }, + { GEOIP_ASNUM_EDITION, "AS Number" }, + { GEOIP_NETSPEED_EDITION, "Speed" }, + { GEOIP_DOMAIN_EDITION, "Domain" }, { 0, NULL } }; @@ -105,7 +105,7 @@ geoip_dat_scan_dir(const char *dirname) { } /* UAT callbacks */ -static void* geoip_path_copy_cb(void* dest, const void* orig, unsigned len _U_) { +static void* geoip_db_path_copy_cb(void* dest, const void* orig, unsigned len _U_) { const geoip_db_path_t *m = orig; geoip_db_path_t *d = dest; @@ -114,7 +114,7 @@ static void* geoip_path_copy_cb(void* dest, const void* orig, unsigned len _U_) return d; } -static void geoip_path_free_cb(void* p) { +static void geoip_db_path_free_cb(void* p) { geoip_db_path_t *m = p; if (m->path) g_free(m->path); } @@ -123,7 +123,7 @@ static void geoip_path_free_cb(void* p) { * Initialize GeoIP lookups */ void -geoip_init(void) { +geoip_db_init(void) { guint i; static uat_field_t geoip_db_paths_fields[] = { UAT_FLD_CSTRING(geoip_mod, path, "The database path"), @@ -141,9 +141,9 @@ geoip_init(void) { &num_geoip_db_paths, UAT_CAT_GENERAL, "ChGeoIPDbPaths", - geoip_path_copy_cb, + geoip_db_path_copy_cb, NULL, - geoip_path_free_cb, + geoip_db_path_free_cb, geoip_db_paths_fields); uat_load(geoip_db_paths_uat, &geoip_load_error); @@ -177,15 +177,25 @@ geoip_db_name(guint dbnum) { return "Invalid database"; } +int +geoip_db_type(guint dbnum) { + GeoIP *gi; + + gi = g_array_index(geoip_dat_arr, GeoIP *, dbnum); + if (gi) { + return (gi->databaseType); + } + return -1; +} + #define VAL_STR_LEN 100 const char * -geoip_db_lookup_ipv4(guint dbnum, guint32 addr) { +geoip_db_lookup_ipv4(guint dbnum, guint32 addr, char *not_found) { GeoIP *gi; GeoIPRecord *gir; - const char *ret = NULL; + const char *ret = not_found; static char val[VAL_STR_LEN]; - g_snprintf(val, VAL_STR_LEN, "-"); gi = g_array_index(geoip_dat_arr, GeoIP *, dbnum); if (gi) { switch (gi->databaseType) { @@ -198,8 +208,10 @@ geoip_db_lookup_ipv4(guint dbnum, guint32 addr) { gir = GeoIP_record_by_ipnum(gi, addr); if (gir && gir->city && gir->region) { g_snprintf(val, VAL_STR_LEN, "%s, %s", gir->city, gir->region); + ret = val; } else if (gir && gir->city) { g_snprintf(val, VAL_STR_LEN, "%s", gir->city); + ret = val; } break; @@ -210,18 +222,17 @@ geoip_db_lookup_ipv4(guint dbnum, guint32 addr) { break; default: - ret = "Unsupported db type"; - } - if (ret) { - g_snprintf (val, VAL_STR_LEN, "%s", ret); + break; } - return val; } - return "Invalid database"; + if (ret) { + return ret; + } + return not_found; } gchar * -geoip_get_paths(void) { +geoip_db_get_paths(void) { GString* path_str = NULL; gchar *path_ret; char path_separator; @@ -249,7 +260,7 @@ geoip_get_paths(void) { #else /* HAVE_GEOIP */ void -geoip_init(void) {} +geoip_db_init(void) {} guint geoip_num_dbs(void) { @@ -261,13 +272,18 @@ geoip_db_name(guint dbnum _U_) { return "Unsupported"; } +int +geoip_db_type(guint dbnum _U_) { + return -1; +} + const char * -geoip_db_lookup_ipv4(guint dbnum _U_, guint32 addr _U_) { - return ""; +geoip_db_lookup_ipv4(guint dbnum _U_, guint32 addr _U_, char *not_found) { + return not_found; } gchar * -geoip_get_paths(void) { +geoip_db_get_paths(void) { return ""; } @@ -284,5 +300,4 @@ geoip_get_paths(void) { * * ex: set shiftwidth=4 tabstop=4 noexpandtab * :indentSize=4:tabSize=4:noTabs=false: - */ - + */
\ No newline at end of file diff --git a/epan/geoip.h b/epan/geoip_db.h index 71e24cb542..1885964c48 100644 --- a/epan/geoip.h +++ b/epan/geoip_db.h @@ -1,4 +1,4 @@ -/* geoip.h +/* geoip_db.h * GeoIP database support * * $Id$ @@ -24,13 +24,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __GEOIP_H__ -#define __GEOIP_H__ +#ifndef __GEOIP_DB_H__ +#define __GEOIP_DB_H__ /** * Init function called from epan.h */ -extern void geoip_init(void); +extern void geoip_db_init(void); /** * Number of databases we have loaded @@ -43,24 +43,33 @@ extern guint geoip_num_dbs(void); * Fetch the name of a database * * @param dbnum Database index - * @return The number GeoIP databases successfully loaded + * @return The database name or "Invalid database" */ const gchar *geoip_db_name(guint dbnum); /** + * Fetch the database type. Types are enumerated in GeoIPDBTypes in GeoIP.h. + * + * @param dbnum Database index + * @return The database type or -1 + */ +int geoip_db_type(guint dbnum); + +/** * Look up an IPv4 address in a database * * @param dbnum Database index * @param addr IPv4 address to look up - * @return The number GeoIP databases successfully loaded + * @param not_found The string to return if the lookup fails. May be NULL. + * @return The database entry if found, else not_found */ -const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr); +const char *geoip_db_lookup_ipv4(guint dbnum, guint32 addr, char *not_found); /** * Get all configured paths * * @return String with all paths separated by a path separator */ -extern gchar *geoip_get_paths(void); +extern gchar *geoip_db_get_paths(void); -#endif /* __GEOIP_H__ */ +#endif /* __GEOIP_DB_H__ */ diff --git a/gtk/about_dlg.c b/gtk/about_dlg.c index 25c7651308..65212ee578 100644 --- a/gtk/about_dlg.c +++ b/gtk/about_dlg.c @@ -36,7 +36,7 @@ #include <epan/oids.h> #endif #ifdef HAVE_GEOIP -#include <epan/geoip.h> +#include <epan/geoip_db.h> #endif #include "../globals.h" @@ -430,7 +430,7 @@ about_folders_page_new(void) #ifdef HAVE_GEOIP /* GeoIP */ - path = geoip_get_paths(); + path = geoip_db_get_paths(); #ifdef _WIN32 resultArray = g_strsplit(path, ";", 10); diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c index bfb5046011..96cccad773 100644 --- a/gtk/hostlist_table.c +++ b/gtk/hostlist_table.c @@ -40,7 +40,7 @@ #include <epan/tap.h> #include <epan/strutil.h> #ifdef HAVE_GEOIP -#include <epan/geoip.h> +#include <epan/geoip_db.h> #endif #include "../simple_dialog.h" @@ -1108,7 +1108,7 @@ add_hostlist_table_data(hostlist_table *hl, const address *addr, guint32 port, g /* Filled in from the GeoIP config, if any */ for (i = 0; i < NUM_GEOIP_COLS; i++) { if (i < geoip_num_dbs() && talker->address.type == AT_IPv4) { - const guchar *name = geoip_db_lookup_ipv4(i, *(guint32*)talker->address.data); + const guchar *name = geoip_db_lookup_ipv4(i, *(guint32*)talker->address.data, "-"); g_snprintf(geoip[i], COL_STR_LEN, "%s", format_text (name, strlen(name))); entries[NUM_BUILTIN_COLS + i] = geoip[i]; gtk_clist_set_column_visibility(hl->table, NUM_BUILTIN_COLS + i, TRUE); diff --git a/version_info.c b/version_info.c index 52836f2b8f..e37cfbe75f 100644 --- a/version_info.c +++ b/version_info.c @@ -88,7 +88,7 @@ #endif #ifdef HAVE_GEOIP -#include <epan/geoip.h> +#include <epan/geoip_db.h> #endif #ifdef SVNVERSION |