diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-02-08 17:20:26 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2018-03-06 18:02:21 +0000 |
commit | a1da75c554881667dd92e11f098630f2d604872b (patch) | |
tree | b1d6a60a663bf93f1eede809a0c383544508d6e2 /cmake | |
parent | b2d3680558d19998c55b48e9807a26e145756eba (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 'cmake')
-rw-r--r-- | cmake/modules/FindGEOIP.cmake | 74 | ||||
-rw-r--r-- | cmake/modules/FindMaxMindDB.cmake | 74 |
2 files changed, 74 insertions, 74 deletions
diff --git a/cmake/modules/FindGEOIP.cmake b/cmake/modules/FindGEOIP.cmake deleted file mode 100644 index 518837be4b..0000000000 --- a/cmake/modules/FindGEOIP.cmake +++ /dev/null @@ -1,74 +0,0 @@ -# -# - Find GeoIP -# Find the native GEOIP includes and library -# -# GEOIP_INCLUDE_DIRS - where to find GeoIP.h, etc. -# GEOIP_LIBRARIES - List of libraries when using GeoIP. -# GEOIP_FOUND - True if GeoIP found. -# GEOIP_DLL_DIR - (Windows) Path to the GeoIP DLL. -# GEOIP_DLL - (Windows) Name of the GeoIP DLL. - - -IF (GEOIP_INCLUDE_DIRS) - # Already in cache, be silent - SET(GEOIP_FIND_QUIETLY TRUE) -ENDIF (GEOIP_INCLUDE_DIRS) - -INCLUDE(FindWSWinLibs) -FindWSWinLibs("GeoIP-.*" "GEOIP_HINTS") - -IF (NOT WIN32) - find_package(PkgConfig) - pkg_search_module(GEOIP geoip) -endif() - -FIND_PATH(GEOIP_INCLUDE_DIR GeoIP.h - HINTS - "${GEOIP_INCLUDEDIR}" - "${GEOIP_HINTS}/include" -) - -SET(GEOIP_NAMES GeoIP libGeoIP-1) -FIND_LIBRARY(GEOIP_LIBRARY NAMES ${GEOIP_NAMES} - HINTS - "${GEOIP_LIBDIR}" - "${GEOIP_HINTS}/lib" - ) - -# handle the QUIETLY and REQUIRED arguments and set GEOIP_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOIP DEFAULT_MSG GEOIP_LIBRARY GEOIP_INCLUDE_DIR) - -IF(GEOIP_FOUND) - INCLUDE(CMakePushCheckState) - CMAKE_PUSH_CHECK_STATE() - SET(GEOIP_LIBRARIES ${GEOIP_LIBRARY} ) - SET(GEOIP_INCLUDE_DIRS ${GEOIP_INCLUDE_DIR} ) - INCLUDE(CheckFunctionExists) - SET(CMAKE_REQUIRED_INCLUDES ${GEOIP_INCLUDE_DIRS}) - SET(CMAKE_REQUIRED_LIBRARIES ${GEOIP_LIBRARIES}) - CHECK_FUNCTION_EXISTS("GeoIP_country_name_by_ipnum_v6" HAVE_GEOIP_V6) - CHECK_FUNCTION_EXISTS("GeoIP_free" HAVE_GEOIP_FREE) - CMAKE_POP_CHECK_STATE() - if (WIN32) - set ( GEOIP_DLL_DIR "${GEOIP_HINTS}/bin" - CACHE PATH "Path to the GeoIP DLL" - ) - file( GLOB _geoip_dll RELATIVE "${GEOIP_DLL_DIR}" - "${GEOIP_DLL_DIR}/libGeoIP-*.dll" - ) - set ( GEOIP_DLL ${_geoip_dll} - # We're storing filenames only. Should we use STRING instead? - CACHE FILEPATH "GeoIP DLL file name" - ) - mark_as_advanced( GEOIP_DLL_DIR GEOIP_DLL ) - endif() -ELSE(GEOIP_FOUND) - SET(GEOIP_LIBRARIES ) - SET(GEOIP_INCLUDE_DIRS ) - SET(GEOIP_DLL_DIR ) - SET(GEOIP_DLL ) -ENDIF(GEOIP_FOUND) - -MARK_AS_ADVANCED( GEOIP_LIBRARIES GEOIP_INCLUDE_DIRS ) diff --git a/cmake/modules/FindMaxMindDB.cmake b/cmake/modules/FindMaxMindDB.cmake new file mode 100644 index 0000000000..cad4499e5b --- /dev/null +++ b/cmake/modules/FindMaxMindDB.cmake @@ -0,0 +1,74 @@ +# +# - Try to find libmaxminddb. +# Once done this will define +# MAXMINDDB_FOUND - System has libmaxminddb +# MAXMINDDB_INCLUDE_DIRS - The libmaxminddb include directories +# MAXMINDDB_LIBRARIES - The libraries needed to use libmaxminddb +# MAXMINDDB_DEFINITIONS - Compiler switches required for using libmaxminddb +# MAXMINDDB_DLL_DIR - (Windows) Path to the MaxMindDB DLL. +# MAXMINDDB_DLL - (Windows) Name of the MaxMindDB DLL. + +IF (MAXMINDDB_INCLUDE_DIRS) + # Already in cache, be silent + SET(MAXMINDDB_FIND_QUIETLY TRUE) +ENDIF (MAXMINDDB_INCLUDE_DIRS) + +INCLUDE(FindWSWinLibs) +FindWSWinLibs("MaxMindDB-.*" "MAXMINDDB_HINTS") + +IF (NOT WIN32) + find_package(PkgConfig) + pkg_check_modules(PC_LIBMAXMINDDB QUIET libmaxminddb) + set(MAXMINDDB_DEFINITIONS ${PC_LIBMAXMINDDB_CFLAGS_OTHER}) +endif() + +FIND_PATH(MAXMINDDB_INCLUDE_DIR maxminddb.h + HINTS + ${PC_LIBMAXMINDDB_INCLUDEDIR} ${PC_LIBMAXMINDDB_INCLUDE_DIRS} + PATH_SUFFIXES maxminddb +) + +find_library(MAXMINDDB_LIBRARY + NAMES + maxminddb libmaxminddb + HINTS + ${PC_LIBMAXMINDDB_LIBDIR} ${PC_LIBMAXMINDDB_LIBRARY_DIRS} + "${MAXMINDDB_HINTS}/lib" +) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set MAXMINDDB_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(MaxMindDB DEFAULT_MSG + MAXMINDDB_LIBRARY MAXMINDDB_INCLUDE_DIR) + +IF(MAXMINDDB_FOUND) + INCLUDE(CMakePushCheckState) + CMAKE_PUSH_CHECK_STATE() + SET(MAXMINDDB_LIBRARIES ${MAXMINDDB_LIBRARY} ) + SET(MAXMINDDB_INCLUDE_DIRS ${MAXMINDDB_INCLUDE_DIR} ) + INCLUDE(CheckFunctionExists) + SET(CMAKE_REQUIRED_INCLUDES ${MAXMINDDB_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${MAXMINDDB_LIBRARIES}) + CMAKE_POP_CHECK_STATE() + if (WIN32) + set ( MAXMINDDB_DLL_DIR "${MAXMINDDB_HINTS}/bin" + CACHE PATH "Path to the MaxMindDB DLL" + ) + file( GLOB _MAXMINDDB_dll RELATIVE "${MAXMINDDB_DLL_DIR}" + "${MAXMINDDB_DLL_DIR}/libmaxminddb*.dll" + ) + set ( MAXMINDDB_DLL ${_MAXMINDDB_dll} + # We're storing filenames only. Should we use STRING instead? + CACHE FILEPATH "MaxMindDB DLL file name" + ) + mark_as_advanced( MAXMINDDB_DLL_DIR MAXMINDDB_DLL ) + endif() +ELSE(MAXMINDDB_FOUND) + SET(MAXMINDDB_LIBRARIES ) + SET(MAXMINDDB_INCLUDE_DIRS ) + SET(MAXMINDDB_DLL_DIR ) + SET(MAXMINDDB_DLL ) +ENDIF(MAXMINDDB_FOUND) + +MARK_AS_ADVANCED( MAXMINDDB_LIBRARIES MAXMINDDB_INCLUDE_DIRS ) |