diff --git a/aclocal.m4 b/aclocal.m4 index bee01f409b..2a8549bdf6 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -291,6 +291,8 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl m4_include([m4/ax_check_openssl.m4]) m4_include([m4/ax_posix_shell.m4]) m4_include([m4/ax_pthread.m4]) +m4_include([m4/ax_restore_flags.m4]) +m4_include([m4/ax_save_flags.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) diff --git a/bin/check/Makefile.in b/bin/check/Makefile.in index 8f009a4b81..7631032105 100644 --- a/bin/check/Makefile.in +++ b/bin/check/Makefile.in @@ -21,7 +21,7 @@ CINCLUDES = ${NS_INCLUDES} ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES} CDEFINES = -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\" CWARNINGS = -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in index 0588f8b7da..5ff8fe6df2 100644 --- a/bin/confgen/Makefile.in +++ b/bin/confgen/Makefile.in @@ -29,7 +29,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/bin/delv/Makefile.in b/bin/delv/Makefile.in index ea106f8063..b9d1addcaf 100644 --- a/bin/delv/Makefile.in +++ b/bin/delv/Makefile.in @@ -23,7 +23,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" \ CWARNINGS = ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ IRSLIBS = ../../lib/irs/libirs.@A@ diff --git a/bin/dig/Makefile.in b/bin/dig/Makefile.in index 8ea146fa0d..8681abcdfb 100644 --- a/bin/dig/Makefile.in +++ b/bin/dig/Makefile.in @@ -25,7 +25,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" CWARNINGS = ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in index dfaad27ff4..097015ffb6 100644 --- a/bin/dnssec/Makefile.in +++ b/bin/dnssec/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_INCLUDES@ CDEFINES = -DVERSION=\"${VERSION}\" CWARNINGS = -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in index 3b20df7346..40f506cfa1 100644 --- a/bin/named/Makefile.in +++ b/bin/named/Makefile.in @@ -46,13 +46,14 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ ${NS_INCLUDES} ${DNS_INCLUDES} \ ${BIND9_INCLUDES} ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \ ${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \ - ${DBDRIVER_INCLUDES} @OPENSSL_INCLUDES@ + ${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \ + @OPENSSL_INCLUDES@ CDEFINES = @CONTRIB_DLZ@ CWARNINGS = -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ @@ -85,9 +86,11 @@ SUBDIRS = unix TARGETS = named@EXEEXT@ GEOIPLINKOBJS = geoip.@O@ +GEOIP2LINKOBJS = geoip.@O@ OBJS = builtin.@O@ config.@O@ control.@O@ \ - controlconf.@O@ fuzz.@O@ @GEOIPLINKOBJS@ \ + controlconf.@O@ fuzz.@O@ \ + @GEOIPLINKOBJS@ @GEOIP2LINKOBJS@ \ log.@O@ logconf.@O@ main.@O@ \ server.@O@ statschannel.@O@ \ tkeyconf.@O@ tsigconf.@O@ zoneconf.@O@ \ @@ -98,9 +101,11 @@ UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@ SYMOBJS = symtbl.@O@ GEOIPLINKSRCS = geoip.c +GEOIP2LINKSRCS = geoip.c SRCS = builtin.c config.c control.c \ - controlconf.c fuzz.c @GEOIPLINKSRCS@ \ + controlconf.c fuzz.c \ + @GEOIPLINKSRCS@ @GEOIP2LINKSRCS@ \ log.c logconf.c main.c \ server.c statschannel.c \ tkeyconf.c tsigconf.c zoneconf.c \ @@ -132,6 +137,7 @@ config.@O@: config.c -DDYNDB_LIBDIR=\"@libdir@/bind\" \ -DNAMED_LOCALSTATEDIR=\"${localstatedir}\" \ -DNAMED_SYSCONFDIR=\"${sysconfdir}\" \ + -DMAXMINDDB_PREFIX=\"@MAXMINDDB_PREFIX@\" \ -c ${srcdir}/config.c server.@O@: server.c diff --git a/bin/named/config.c b/bin/named/config.c index e51d4dc472..f077156afa 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -66,6 +66,9 @@ options {\n\ #ifndef WIN32 " files unlimited;\n" #endif +#ifdef HAVE_GEOIP2 +" geoip-directory \"" MAXMINDDB_PREFIX "/share/GeoIP2\";\n" +#endif "\ # has-old-clients ;\n\ heartbeat-interval 60;\n\ diff --git a/bin/nsupdate/Makefile.in b/bin/nsupdate/Makefile.in index 1d26ea0d0d..2d9d473fa5 100644 --- a/bin/nsupdate/Makefile.in +++ b/bin/nsupdate/Makefile.in @@ -26,7 +26,7 @@ CINCLUDES = ${DNS_INCLUDES} ${BIND9_INCLUDES} ${ISC_INCLUDES} \ CDEFINES = -DVERSION=\"${VERSION}\" @USE_GSSAPI@ CWARNINGS = -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ diff --git a/bin/plugins/Makefile.in b/bin/plugins/Makefile.in index 1497ae7ca1..1ba22f1d78 100644 --- a/bin/plugins/Makefile.in +++ b/bin/plugins/Makefile.in @@ -17,7 +17,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ ${NS_INCLUDES} ${DNS_INCLUDES} \ ${ISCCFG_INCLUDES} ${ISC_INCLUDES} -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ NSLIBS = ../../lib/ns/libns.@A@ diff --git a/bin/rndc/Makefile.in b/bin/rndc/Makefile.in index ef5c65ea50..5b9b32019a 100644 --- a/bin/rndc/Makefile.in +++ b/bin/rndc/Makefile.in @@ -25,7 +25,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index 76f010b450..a8fbe545ba 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -20,7 +20,7 @@ CDEFINES = CWARNINGS = BACKTRACECFLAGS = @BACKTRACECFLAGS@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/bin/tests/optional/Makefile.in b/bin/tests/optional/Makefile.in index 0aab65749c..5122325434 100644 --- a/bin/tests/optional/Makefile.in +++ b/bin/tests/optional/Makefile.in @@ -22,7 +22,7 @@ CWARNINGS = BACKTRACECFLAGS = @BACKTRACECFLAGS@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@ diff --git a/bin/tests/system/pipelined/Makefile.in b/bin/tests/system/pipelined/Makefile.in index 66817d5c0a..d305546c2a 100644 --- a/bin/tests/system/pipelined/Makefile.in +++ b/bin/tests/system/pipelined/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_INCLUDES@ CDEFINES = CWARNINGS = -DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ diff --git a/bin/tests/system/rsabigexponent/Makefile.in b/bin/tests/system/rsabigexponent/Makefile.in index a15d26400b..4dcb678f8c 100644 --- a/bin/tests/system/rsabigexponent/Makefile.in +++ b/bin/tests/system/rsabigexponent/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_INCLUDES@ CDEFINES = CWARNINGS = -DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ diff --git a/bin/tests/system/tkey/Makefile.in b/bin/tests/system/tkey/Makefile.in index be0cf03256..a385212e64 100644 --- a/bin/tests/system/tkey/Makefile.in +++ b/bin/tests/system/tkey/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_INCLUDES@ CDEFINES = CWARNINGS = -DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ diff --git a/bin/tools/Makefile.in b/bin/tools/Makefile.in index 0fd28471d9..d15309761f 100644 --- a/bin/tools/Makefile.in +++ b/bin/tools/Makefile.in @@ -16,12 +16,13 @@ VERSION=@BIND9_VERSION@ @BIND9_MAKE_INCLUDES@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \ - ${BIND9_INCLUDES} @OPENSSL_INCLUDES@ + ${BIND9_INCLUDES} ${MAXMINDDB_CFLAGS} \ + @OPENSSL_INCLUDES@ CDEFINES = -DVERSION=\"${VERSION}\" CWARNINGS = -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ BIND9LIBS = ../../lib/bind9/libbind9.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ diff --git a/config.h.in b/config.h.in index 3c694930e4..ae89d7f9c9 100644 --- a/config.h.in +++ b/config.h.in @@ -168,6 +168,9 @@ /* Build with GeoIP support */ #undef HAVE_GEOIP +/* Build with GeoIP2 support */ +#undef HAVE_GEOIP2 + /* Build with GeoIP City IPv6 support */ #undef HAVE_GEOIP_CITY_V6 diff --git a/configure b/configure index 7f7bc2026c..683955f22b 100755 --- a/configure +++ b/configure @@ -754,6 +754,11 @@ PTHREAD_CC ax_pthread_config GEOIPLINKOBJS GEOIPLINKSRCS +GEOIP2LINKOBJS +GEOIP2LINKSRCS +MAXMINDDB_PREFIX +MAXMINDDB_LIBS +MAXMINDDB_CFLAGS ISC_PLATFORM_NORETURN_POST ISC_PLATFORM_NORETURN_PRE expanded_sysconfdir @@ -844,6 +849,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -896,6 +902,7 @@ enable_kqueue enable_epoll enable_devpoll with_geoip +with_geoip2 with_locktype with_libtool with_openssl @@ -956,6 +963,9 @@ LT_SYS_LIBRARY_PATH PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR +MAXMINDDB_CFLAGS +MAXMINDDB_LIBS +MAXMINDDB_PREFIX OPENSSL_CFLAGS OPENSSL_LIBS LIBIDN2_CFLAGS @@ -1001,6 +1011,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1253,6 +1264,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1390,7 +1410,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1543,6 +1563,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1629,7 +1650,9 @@ Optional Packages: --with-python=PATH specify path to Python interpreter --with-python-install-dir=PATH installation directory for Python modules - --with-geoip=PATH Build with GeoIP support (yes|no|path) + --with-geoip=PATH Build with legacy GeoIP support (yes|no|path) + --with-geoip2=PATH Build with MaxMind GeoIP2 support (auto|yes|no|path) + [default=no] --with-locktype=ARG Specify mutex lock type (adaptive or standard) --with-libtool use GNU libtool --with-openssl=DIR root of the OpenSSL directory @@ -1692,6 +1715,12 @@ Some influential environment variables: directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path + MAXMINDDB_CFLAGS + C compiler flags for MAXMINDDB, overriding pkg-config + MAXMINDDB_LIBS + linker flags for MAXMINDDB, overriding pkg-config + MAXMINDDB_PREFIX + value of prefix for libmaxminddb, overriding pkg-config OPENSSL_CFLAGS C compiler flags for OPENSSL, overriding pkg-config OPENSSL_LIBS @@ -14140,17 +14169,410 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h # # GeoIP support? # -GEOIPLINKSRCS= -GEOIPLINKOBJS= +geoip2_default="no" # Check whether --with-geoip was given. if test "${with_geoip+set}" = set; then : - withval=$with_geoip; use_geoip="$withval" + withval=$with_geoip; + use_geoip="$withval" + geoip2_default="no" + else use_geoip="no" fi +# Check whether --with-geoip2 was given. +if test "${with_geoip2+set}" = set; then : + withval=$with_geoip2; +else + with_geoip2="$geoip2_default" +fi + + +# specifying both --with-geoip and --with-geoip2 is an error. +if test "no" != "$with_geoip2" && test "no" != "$use_geoip"; then : + as_fn_error $? "--with-geoip and --with-geoip2 are incompatible" "$LINENO" 5 +fi + +GEOIP2LINKSRCS= +GEOIP2LINKOBJS= +case $with_geoip2 in #( + no) : + ;; #( + auto) : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmaxminddb" >&5 +$as_echo_n "checking for libmaxminddb... " >&6; } + +if test -n "$MAXMINDDB_CFLAGS"; then + pkg_cv_MAXMINDDB_CFLAGS="$MAXMINDDB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MAXMINDDB_CFLAGS=`$PKG_CONFIG --cflags "libmaxminddb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$MAXMINDDB_LIBS"; then + pkg_cv_MAXMINDDB_LIBS="$MAXMINDDB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MAXMINDDB_LIBS=`$PKG_CONFIG --libs "libmaxminddb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libmaxminddb" 2>&1` + else + MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libmaxminddb" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$MAXMINDDB_PKG_ERRORS" >&5 + + : +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + : +else + MAXMINDDB_CFLAGS=$pkg_cv_MAXMINDDB_CFLAGS + MAXMINDDB_LIBS=$pkg_cv_MAXMINDDB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_GEOIP2 1" >>confdefs.h + + +if test -n "$MAXMINDDB_PREFIX"; then + pkg_cv_MAXMINDDB_PREFIX="$MAXMINDDB_PREFIX" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MAXMINDDB_PREFIX=`$PKG_CONFIG --variable="prefix" "libmaxminddb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +MAXMINDDB_PREFIX=$pkg_cv_MAXMINDDB_PREFIX + +if test "x$MAXMINDDB_PREFIX" = x""; then : + as_fn_error $? "libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment" "$LINENO" 5 +fi + GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' + GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' + +fi ;; #( + yes) : + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmaxminddb" >&5 +$as_echo_n "checking for libmaxminddb... " >&6; } + +if test -n "$MAXMINDDB_CFLAGS"; then + pkg_cv_MAXMINDDB_CFLAGS="$MAXMINDDB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MAXMINDDB_CFLAGS=`$PKG_CONFIG --cflags "libmaxminddb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$MAXMINDDB_LIBS"; then + pkg_cv_MAXMINDDB_LIBS="$MAXMINDDB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MAXMINDDB_LIBS=`$PKG_CONFIG --libs "libmaxminddb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libmaxminddb" 2>&1` + else + MAXMINDDB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libmaxminddb" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$MAXMINDDB_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libmaxminddb) were not met: + +$MAXMINDDB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables MAXMINDDB_CFLAGS +and MAXMINDDB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables MAXMINDDB_CFLAGS +and MAXMINDDB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + MAXMINDDB_CFLAGS=$pkg_cv_MAXMINDDB_CFLAGS + MAXMINDDB_LIBS=$pkg_cv_MAXMINDDB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_GEOIP2 1" >>confdefs.h + + +if test -n "$MAXMINDDB_PREFIX"; then + pkg_cv_MAXMINDDB_PREFIX="$MAXMINDDB_PREFIX" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libmaxminddb") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MAXMINDDB_PREFIX=`$PKG_CONFIG --variable="prefix" "libmaxminddb" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +MAXMINDDB_PREFIX=$pkg_cv_MAXMINDDB_PREFIX + +if test "x$MAXMINDDB_PREFIX" = x""; then : + as_fn_error $? "libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment" "$LINENO" 5 +fi + GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' + GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' + +fi ;; #( + *) : + # default + + + CCASFLAGS_geoip2_ax_save_flags=$CCASFLAGS + + + + CFLAGS_geoip2_ax_save_flags=$CFLAGS + + + + CPPFLAGS_geoip2_ax_save_flags=$CPPFLAGS + + + + CXXFLAGS_geoip2_ax_save_flags=$CXXFLAGS + + + + ERLCFLAGS_geoip2_ax_save_flags=$ERLCFLAGS + + + + FCFLAGS_geoip2_ax_save_flags=$FCFLAGS + + + + FCLIBS_geoip2_ax_save_flags=$FCLIBS + + + + FFLAGS_geoip2_ax_save_flags=$FFLAGS + + + + FLIBS_geoip2_ax_save_flags=$FLIBS + + + + GCJFLAGS_geoip2_ax_save_flags=$GCJFLAGS + + + + JAVACFLAGS_geoip2_ax_save_flags=$JAVACFLAGS + + + + LDFLAGS_geoip2_ax_save_flags=$LDFLAGS + + + + LIBS_geoip2_ax_save_flags=$LIBS + + + + OBJCFLAGS_geoip2_ax_save_flags=$OBJCFLAGS + + + + OBJCXXFLAGS_geoip2_ax_save_flags=$OBJCXXFLAGS + + + + UPCFLAGS_geoip2_ax_save_flags=$UPCFLAGS + + + + VALAFLAGS_geoip2_ax_save_flags=$VALAFLAGS + + + + MAXMINDDB_CFLAGS="-I$with_geoip2/include" + MAXMINDDB_LIBS="-L$with_geoip2/libs" + CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS" + LDFLAGS="$LDFLAGS $MAXMINDDB_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing MMDB_open" >&5 +$as_echo_n "checking for library containing MMDB_open... " >&6; } +if ${ac_cv_search_MMDB_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char MMDB_open (); +int +main () +{ +return MMDB_open (); + ; + return 0; +} +_ACEOF +for ac_lib in '' maxminddb; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_MMDB_open=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_MMDB_open+:} false; then : + break +fi +done +if ${ac_cv_search_MMDB_open+:} false; then : + +else + ac_cv_search_MMDB_open=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_MMDB_open" >&5 +$as_echo "$ac_cv_search_MMDB_open" >&6; } +ac_res=$ac_cv_search_MMDB_open +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +$as_echo "#define HAVE_GEOIP2 1" >>confdefs.h + + GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' + GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' + MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_mmdb_open" + { $as_echo "$as_me:${as_lineno-$LINENO}: GeoIP2 default database path set to $with_geoip2/share/GeoIP" >&5 +$as_echo "$as_me: GeoIP2 default database path set to $with_geoip2/share/GeoIP" >&6;} + eval MAXMINDDB_PREFIX=\$$with_geoip2 + +else + as_fn_error $? "GeoIP2 requested, but libmaxminddb not found" "$LINENO" 5 +fi + + ;; +esac + + + + + + +GEOIPLINKSRCS= +GEOIPLINKOBJS= if test "yes" = "$use_geoip" then for d in /usr /usr/local /opt/local @@ -14165,10 +14587,6 @@ fi case "$use_geoip" in no|'') - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GeoIP support" >&5 -$as_echo_n "checking for GeoIP support... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 -$as_echo "disabled" >&6; } ;; *) if test -d "$use_geoip" -o -L "$use_geoip" @@ -23933,7 +24351,8 @@ report() { test "large" = "$use_tuning" && echo " Large-system tuning (--with-tuning)" test "no" = "$use_dnstap" || \ echo " Allow 'dnstap' packet logging (--enable-dnstap)" - test "no" = "$use_geoip" || echo " GeoIP access control (--with-geoip)" + test -z "$MAXMINDDB_LIBS" || echo " GeoIP2 access control (--with-geoip2)" + test "no" = "$use_geoip" || echo " Legacy GeoIP access control (--with-geoip)" test "no" = "$use_gssapi" || echo " GSS-API (--with-gssapi)" if test "yes" = "$enable_full_report" -o "aes" != "$with_cc_alg"; then echo " Algorithm: $with_cc_alg" @@ -23997,7 +24416,7 @@ report() { test "no" = "$use_dnstap" && \ echo " Allow 'dnstap' packet logging (--enable-dnstap)" - test "no" = "$use_geoip" && echo " GeoIP access control (--with-geoip)" + test -z "$MAXMINDDB_LIBS" && echo " GeoIP2 access control (--with-geoip2)" test "no" = "$use_gssapi" && echo " GSS-API (--with-gssapi)" test "no" = "$enable_dnsrps" && \ diff --git a/configure.ac b/configure.ac index e20cca72cf..5e019fcb87 100644 --- a/configure.ac +++ b/configure.ac @@ -539,13 +539,64 @@ AC_C_BIGENDIAN # # GeoIP support? # -GEOIPLINKSRCS= -GEOIPLINKOBJS= +geoip2_default="no" AC_ARG_WITH(geoip, AS_HELP_STRING([--with-geoip=PATH], - [Build with GeoIP support (yes|no|path)]), - use_geoip="$withval", use_geoip="no") + [Build with legacy GeoIP support (yes|no|path)]), + [ + use_geoip="$withval" + geoip2_default="no" + ], + [use_geoip="no"]) +AC_ARG_WITH([geoip2], + [AS_HELP_STRING([--with-geoip2=PATH], + [Build with MaxMind GeoIP2 support (auto|yes|no|path) [default=no]])], + [], with_geoip2="$geoip2_default") +# specifying both --with-geoip and --with-geoip2 is an error. +AS_IF([test "no" != "$with_geoip2" && test "no" != "$use_geoip"], + [AC_MSG_ERROR([--with-geoip and --with-geoip2 are incompatible])]) + +GEOIP2LINKSRCS= +GEOIP2LINKOBJS= +AS_CASE([$with_geoip2], + [no],[], + [auto],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb], + [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support]) + PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])]) + GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' + GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' + ],[:])], + [yes],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb], + [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support]) + PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])]) + GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' + GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' + ])], + [ # default + AX_SAVE_FLAGS([geoip2]) + MAXMINDDB_CFLAGS="-I$with_geoip2/include" + MAXMINDDB_LIBS="-L$with_geoip2/libs" + CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS" + LDFLAGS="$LDFLAGS $MAXMINDDB_LIBS" + AC_SEARCH_LIBS([MMDB_open], [maxminddb], + [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support]) + GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' + GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' + MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_mmdb_open" + AC_MSG_NOTICE([GeoIP2 default database path set to $with_geoip2/share/GeoIP]) + AS_VAR_COPY([MAXMINDDB_PREFIX], [$with_geoip2]) + ], + [AC_MSG_ERROR([GeoIP2 requested, but libmaxminddb not found])]) + ]) +AC_ARG_VAR([MAXMINDDB_PREFIX], [value of prefix for MAXMINDDB, overriding pkg-config]) +AC_SUBST([MAXMINDDB_CFLAGS]) +AC_SUBST([MAXMINDDB_LIBS]) +AC_SUBST([GEOIP2LINKSRCS]) +AC_SUBST([GEOIP2LINKOBJS]) + +GEOIPLINKSRCS= +GEOIPLINKOBJS= if test "yes" = "$use_geoip" then for d in /usr /usr/local /opt/local @@ -560,8 +611,6 @@ fi case "$use_geoip" in no|'') - AC_MSG_CHECKING([for GeoIP support]) - AC_MSG_RESULT([disabled]) ;; *) if test -d "$use_geoip" -o -L "$use_geoip" @@ -3123,7 +3172,8 @@ report() { test "large" = "$use_tuning" && echo " Large-system tuning (--with-tuning)" test "no" = "$use_dnstap" || \ echo " Allow 'dnstap' packet logging (--enable-dnstap)" - test "no" = "$use_geoip" || echo " GeoIP access control (--with-geoip)" + test -z "$MAXMINDDB_LIBS" || echo " GeoIP2 access control (--with-geoip2)" + test "no" = "$use_geoip" || echo " Legacy GeoIP access control (--with-geoip)" test "no" = "$use_gssapi" || echo " GSS-API (--with-gssapi)" if test "yes" = "$enable_full_report" -o "aes" != "$with_cc_alg"; then echo " Algorithm: $with_cc_alg" @@ -3187,7 +3237,7 @@ report() { test "no" = "$use_dnstap" && \ echo " Allow 'dnstap' packet logging (--enable-dnstap)" - test "no" = "$use_geoip" && echo " GeoIP access control (--with-geoip)" + test -z "$MAXMINDDB_LIBS" && echo " GeoIP2 access control (--with-geoip2)" test "no" = "$use_gssapi" && echo " GSS-API (--with-gssapi)" test "no" = "$enable_dnsrps" && \ diff --git a/fuzz/Makefile.in b/fuzz/Makefile.in index 84ad6c1ebf..538f6faefa 100644 --- a/fuzz/Makefile.in +++ b/fuzz/Makefile.in @@ -11,7 +11,7 @@ CDEFINES = -DFUZZDIR=\"$(abs_srcdir)\" ISCLIBS = ../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../lib/isc/libisc.@A@ -DNSLIBS = ../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../lib/dns/libdns.@A@ LIBS = @LIBS@ diff --git a/lib/bind9/Makefile.in b/lib/bind9/Makefile.in index b2441fb925..569dfd086b 100644 --- a/lib/bind9/Makefile.in +++ b/lib/bind9/Makefile.in @@ -25,7 +25,7 @@ CWARNINGS = ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ NSLIBS = ../../lib/ns/libns.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index 4cc8a47276..60c87a8c1e 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -27,7 +27,8 @@ VERSION=@BIND9_VERSION@ USE_ISC_SPNEGO = @USE_ISC_SPNEGO@ CINCLUDES = -I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \ - ${ISC_INCLUDES} @OPENSSL_INCLUDES@ @DST_GSSAPI_INC@ + ${ISC_INCLUDES} ${MAXMINDDB_CFLAGS} \ + @OPENSSL_INCLUDES@ @DST_GSSAPI_INC@ CDEFINES = @USE_GSSAPI@ ${USE_ISC_SPNEGO} @@ -37,7 +38,7 @@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ -LIBS = @LIBS@ +LIBS = ${MAXMINDDB_LIBS} @LIBS@ # Alphabetically @@ -51,6 +52,7 @@ DSTOBJS = @DST_EXTRA_OBJS@ \ key.@O@ GEOIPLINKOBJS = geoip.@O@ +GEOIP2LINKOBJS = geoip2.@O@ DNSTAPOBJS = dnstap.@O@ dnstap.pb-c.@O@ @@ -77,7 +79,7 @@ DNSOBJS = acl.@O@ adb.@O@ badcache.@O@ byaddr.@O@ \ PORTDNSOBJS = client.@O@ ecdb.@O@ OBJS= @DNSTAPOBJS@ ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} \ - ${PORTDNSOBJS} @GEOIPLINKOBJS@ + ${PORTDNSOBJS} @GEOIPLINKOBJS@ @GEOIP2LINKOBJS@ DSTSRCS = @DST_EXTRA_SRCS@ @PKCS11LINKSRCS@ \ dst_api.c dst_parse.c \ @@ -89,6 +91,7 @@ DSTSRCS = @DST_EXTRA_SRCS@ @PKCS11LINKSRCS@ \ key.c GEOIPLINKSRCS = geoip.c +GEOIPL2INKSRCS = geoip2.c DNSTAPSRCS = dnstap.c dnstap.pb-c.c @@ -111,7 +114,8 @@ DNSSRCS = acl.c adb.c badcache. byaddr.c \ zonekey.c zt.c ${OTHERSRCS} PORTDNSSRCS = client.c ecdb.c -SRCS = ${DSTSRCS} ${DNSSRCS} ${PORTDNSSRCS} @DNSTAPSRCS@ @GEOIPLINKSRCS@ +SRCS = ${DSTSRCS} ${DNSSRCS} \ + ${PORTDNSSRCS} @DNSTAPSRCS@ @GEOIPLINKSRCS@ @GEOIP2LINKSRCS@ SUBDIRS = include TARGETS = timestamp diff --git a/lib/dns/geoip2.c b/lib/dns/geoip2.c new file mode 100644 index 0000000000..029d85563e --- /dev/null +++ b/lib/dns/geoip2.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include + +#include + +bool +dns_geoip_match(const isc_netaddr_t *reqaddr, + const dns_geoip_databases_t *geoip, + const dns_geoip_elem_t *elt) +{ + UNUSED(reqaddr); + UNUSED(geoip); + UNUSED(elt); + + return (false); +} + +void +dns_geoip_shutdown(void) { + return; +} diff --git a/lib/dns/tests/Makefile.in b/lib/dns/tests/Makefile.in index 7b35b93522..eb297c96f8 100644 --- a/lib/dns/tests/Makefile.in +++ b/lib/dns/tests/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = -DTESTS="\"${top_builddir}/lib/dns/tests/\"" ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../../isc/libisc.@A@ -DNSLIBS = ../libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../libdns.@A@ LIBS = @LIBS@ @CMOCKA_LIBS@ diff --git a/lib/irs/tests/Makefile.in b/lib/irs/tests/Makefile.in index 23fae15085..8ffe2b6edc 100644 --- a/lib/irs/tests/Makefile.in +++ b/lib/irs/tests/Makefile.in @@ -20,7 +20,7 @@ CDEFINES = -DTESTS="\"${top_builddir}/lib/irs/tests/\"" CFGLIBS = ../../isccfg/libisccfg.@A@ CFGDEPLIBS = ../../isccfg/libisccfg.@A@ -DNSLIBS = ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../dns/libdns.@A@ ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../../isc/libisc.@A@ diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index fbc237f475..cf3477b7da 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -23,7 +23,7 @@ CDEFINES = CWARNINGS = ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../../lib/cfg/libisccfg.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ diff --git a/lib/isccfg/tests/Makefile.in b/lib/isccfg/tests/Makefile.in index c5036e293d..490adb1f16 100644 --- a/lib/isccfg/tests/Makefile.in +++ b/lib/isccfg/tests/Makefile.in @@ -22,7 +22,7 @@ CDEFINES = -DTESTS="\"${top_builddir}/lib/dns/tests/\"" ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../../isc/libisc.@A@ -DNSLIBS = ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../dns/libdns.@A@ ISCCFGLIBS = ../libisccfg.@A@ ISCCFGDEPLIBS = ../libisccfg.@A@ diff --git a/lib/ns/Makefile.in b/lib/ns/Makefile.in index 96228b3500..ec152497e9 100644 --- a/lib/ns/Makefile.in +++ b/lib/ns/Makefile.in @@ -36,7 +36,7 @@ ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../lib/dns/libdns.@A@ diff --git a/lib/ns/tests/Makefile.in b/lib/ns/tests/Makefile.in index e6d3049ede..ffd8f41deb 100644 --- a/lib/ns/tests/Makefile.in +++ b/lib/ns/tests/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = -DTESTS="\"${top_builddir}/lib/ns/tests/\"" -DNAMED_PLUGINDIR=\"${plu ISCLIBS = ../../isc/libisc.@A@ @OPENSSL_LIBS@ ISCDEPLIBS = ../../isc/libisc.@A@ -DNSLIBS = ../../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ DNSDEPLIBS = ../../dns/libdns.@A@ NSLIBS = ../libns.@A@ NSDEPLIBS = ../libns.@A@ diff --git a/lib/samples/Makefile.in b/lib/samples/Makefile.in index 339e4f7f06..6125cb5a54 100644 --- a/lib/samples/Makefile.in +++ b/lib/samples/Makefile.in @@ -25,7 +25,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" \ CWARNINGS = ISCLIBS = ../isc/libisc.@A@ @OPENSSL_LIBS@ -DNSLIBS = ../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCCFGLIBS = ../isccfg/libisccfg.@A@ IRSLIBS = ../irs/libirs.@A@ diff --git a/m4/ax_restore_flags.m4 b/m4/ax_restore_flags.m4 new file mode 100644 index 0000000000..8f2adf27c2 --- /dev/null +++ b/m4/ax_restore_flags.m4 @@ -0,0 +1,52 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_restore_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_RESTORE_FLAGS([namespace]) +# +# DESCRIPTION +# +# Restore common compilation flags from temporary variables. +# +# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS, +# OBJCFLAGS. +# +# By default these flags are restored to a global (empty) namespace, but +# user could restore from specific NAMESPACE by using +# AX_RESTORE_FLAGS(NAMESPACE) macro. +# +# Typical usage is like: +# +# AX_SAVE_FLAGS(mypackage) +# CPPFLAGS="-Imypackagespath ${CPPFLAGS}" +# dnl ... do some detection ... +# AX_RESTORE_FLAGS(mypackage) +# +# LICENSE +# +# Copyright (c) 2009 Filippo Giunchedi +# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2011 Russ Allbery +# Copyright (c) 2013 Bastien ROUCARIES +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +# save one flag in name space +AC_DEFUN([_AX_RESTORE_ONE_FLAG],[dnl + AS_VAR_PUSHDEF([_ax_restore_flag_var], [$2[]_$1[]_ax_save_flags]) + AS_VAR_COPY($2[],_ax_restore_flag_var) + AS_VAR_POPDEF([_ax_restore_flag_var]) +]) + +AC_DEFUN([AX_RESTORE_FLAGS], [dnl + m4_foreach([FLAG], dnl + [_AX_SAVE_FLAGS_LIST()], dnl + [_AX_RESTORE_ONE_FLAG([$1],FLAG)]) +]) diff --git a/m4/ax_save_flags.m4 b/m4/ax_save_flags.m4 new file mode 100644 index 0000000000..5bc7c6c7a8 --- /dev/null +++ b/m4/ax_save_flags.m4 @@ -0,0 +1,71 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_save_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_SAVE_FLAGS([NAMESPACE]) +# +# DESCRIPTION +# +# Save common compilation flags into temporary variables. +# +# Compilation flags includes: CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS, LIBS, +# OBJCFLAGS. +# +# By default these flags are saved to a global (empty) namespace, but user +# could specify a specific NAMESPACE to AX_SAVE_FLAGS macro and latter +# restore it by using AX_RESTORE_FLAGS(NAMESPACE). +# +# AX_SAVE_FLAGS(mypackage) +# CPPFLAGS="-Imypackagespath ${CPPFLAGS}" +# dnl .. do some detection ... +# AX_RESTORE_FLAGS(mypackage) +# +# LICENSE +# +# Copyright (c) 2009 Filippo Giunchedi +# Copyright (c) 2011 The Board of Trustees of the Leland Stanford Junior University +# Copyright (c) 2011 Russ Allbery +# Copyright (c) 2013 Bastien ROUCARIES +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +# list of flag to save +AC_DEFUN([_AX_SAVE_FLAGS_LIST],[dnl +[CCASFLAGS],dnl +[CFLAGS],dnl +[CPPFLAGS],dnl +[CXXFLAGS],dnl +[ERLCFLAGS],dnl +[FCFLAGS],dnl +[FCLIBS],dnl +[FFLAGS],dnl +[FLIBS],dnl +[GCJFLAGS],dnl +[JAVACFLAGS],dnl +[LDFLAGS],dnl +[LIBS],dnl +[OBJCFLAGS],dnl +[OBJCXXFLAGS],dnl +[UPCFLAGS],dnl +[VALAFLAGS]dnl +]) + +# save one flag in name space +AC_DEFUN([_AX_SAVE_ONE_FLAG],[ + AS_VAR_PUSHDEF([_ax_save_flag_var], [$2[]_$1[]_ax_save_flags]) + AS_VAR_COPY(_ax_save_flag_var, $2[]) + AS_VAR_POPDEF([_ax_save_flag_var]) +]) + +AC_DEFUN([AX_SAVE_FLAGS],[dnl + m4_foreach([FLAG], dnl + [_AX_SAVE_FLAGS_LIST()], dnl + [_AX_SAVE_ONE_FLAG([$1],FLAG)]) +]) diff --git a/make/rules.in b/make/rules.in index 4ca7c63ec5..dfac0627ac 100644 --- a/make/rules.in +++ b/make/rules.in @@ -120,6 +120,9 @@ LFS_CFLAGS = @LFS_CFLAGS@ LFS_LDFLAGS = @LFS_LDFLAGS@ LFS_LIBS = @LFS_LIBS@ +MAXMINDDB_CFLAGS = @MAXMINDDB_CFLAGS@ +MAXMINDDB_LIBS = @MAXMINDDB_LIBS@ + .SUFFIXES: .SUFFIXES: .c .@O@ diff --git a/util/copyrights b/util/copyrights index 5628d5fba0..465cef0835 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1670,6 +1670,7 @@ ./lib/dns/gen-win32.h C 1999,2000,2001,2004,2005,2006,2007,2009,2014,2016,2018,2019 ./lib/dns/gen.c C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019 ./lib/dns/geoip.c C 2013,2014,2015,2016,2018,2019 +./lib/dns/geoip2.c C 2019 ./lib/dns/gssapi_link.c C 2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2018,2019 ./lib/dns/gssapictx.c C 2000,2001,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019 ./lib/dns/hmac_link.c C.NAI 1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019