diff --git a/aclocal.m4 b/aclocal.m4 index b667d3abcb..09c2911218 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -288,6 +288,8 @@ AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR +m4_include([m4/ax_restore_flags.m4]) +m4_include([m4/ax_save_flags.m4]) m4_include([libtool.m4/libtool.m4]) m4_include([libtool.m4/ltoptions.m4]) m4_include([libtool.m4/ltsugar.m4]) diff --git a/bin/check/Makefile.in b/bin/check/Makefile.in index c124e80367..3048ec39c5 100644 --- a/bin/check/Makefile.in +++ b/bin/check/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.36 2009/12/05 23:31:40 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -23,7 +21,7 @@ CINCLUDES = ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES} \ CDEFINES = @CRYPTO@ -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@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in index 87f13dda4b..bc7dc5be5e 100644 --- a/bin/confgen/Makefile.in +++ b/bin/confgen/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.8 2009/12/05 23:31:40 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -31,7 +29,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ -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 e2d2802262..b826223ef0 100644 --- a/bin/delv/Makefile.in +++ b/bin/delv/Makefile.in @@ -23,7 +23,7 @@ CDEFINES = @CRYPTO@ -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@ ISCLIBS = ../../lib/isc/libisc.@A@ IRSLIBS = ../../lib/irs/libirs.@A@ diff --git a/bin/dig/Makefile.in b/bin/dig/Makefile.in index a9830a9119..f039be623e 100644 --- a/bin/dig/Makefile.in +++ b/bin/dig/Makefile.in @@ -25,7 +25,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" @CRYPTO@ 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@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in index 2239ad1457..d9380542da 100644 --- a/bin/dnssec/Makefile.in +++ b/bin/dnssec/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.42.332.1 2011/03/16 06:37:51 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -23,7 +21,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \ @CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\" CWARNINGS = -DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../lib/isc/libisc.@A@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in index 1c413973d0..e7a61c9086 100644 --- a/bin/named/Makefile.in +++ b/bin/named/Makefile.in @@ -45,13 +45,14 @@ DLZDRIVER_LIBS = @DLZ_DRIVER_LIBS@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \ ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \ - ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@ + ${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \ + @DST_OPENSSL_INC@ CDEFINES = @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@ 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@ @@ -82,10 +83,13 @@ SUBDIRS = unix TARGETS = named@EXEEXT@ lwresd@EXEEXT@ GEOIPLINKOBJS = geoip.@O@ +GEOIP2LINKOBJS = geoip.@O@ OBJS = builtin.@O@ client.@O@ config.@O@ control.@O@ \ - controlconf.@O@ fuzz.@O@ @GEOIPLINKOBJS@ interfacemgr.@O@ \ - listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \ + controlconf.@O@ fuzz.@O@ \ + @GEOIPLINKOBJS@ @GEOIP2LINKOBJS@ \ + interfacemgr.@O@ listenlist.@O@ log.@O@ logconf.@O@ \ + main.@O@ notify.@O@ \ query.@O@ server.@O@ sortlist.@O@ statschannel.@O@ \ tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \ zoneconf.@O@ \ @@ -98,10 +102,13 @@ UOBJS = unix/os.@O@ unix/dlz_dlopen_driver.@O@ SYMOBJS = symtbl.@O@ GEOIPLINKSRCS = geoip.c +GEOIP2LINKSRCS = geoip.c SRCS = builtin.c client.c config.c control.c \ - controlconf.c fuzz.c @GEOIPLINKSRCS@ interfacemgr.c \ - listenlist.c log.c logconf.c main.c notify.c \ + controlconf.c fuzz.c \ + @GEOIPLINKSRCS@ @GEOIP2LINKSRCS@ \ + interfacemgr.c \ listenlist.c log.c logconf.c \ + main.c notify.c \ query.c server.c sortlist.c statschannel.c \ tkeyconf.c tsigconf.c update.c xfrout.c \ zoneconf.c \ @@ -135,6 +142,7 @@ config.@O@: config.c -DDYNDB_LIBDIR=\"@libdir@/bind\" \ -DNS_LOCALSTATEDIR=\"${localstatedir}\" \ -DNS_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 7584efba94..323231c1bf 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -70,6 +70,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 0276f691e5..5332516ff7 100644 --- a/bin/nsupdate/Makefile.in +++ b/bin/nsupdate/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.36 2009/12/05 23:31:40 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -29,7 +27,7 @@ CDEFINES = -DVERSION=\"${VERSION}\" @CRYPTO@ @USE_GSSAPI@ CWARNINGS = LWRESLIBS = ../../lib/lwres/liblwres.@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@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ diff --git a/bin/rndc/Makefile.in b/bin/rndc/Makefile.in index 67c7b7d2b5..1e63b553b5 100644 --- a/bin/rndc/Makefile.in +++ b/bin/rndc/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.49 2009/12/05 23:31:40 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -27,7 +25,7 @@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCCLIBS = ../../lib/isccc/libisccc.@A@ ISCLIBS = ../../lib/isc/libisc.@A@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ -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 de6813058d..f34069adbf 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -20,7 +20,7 @@ CDEFINES = @CRYPTO@ 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@ @ISC_OPENSSL_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @ISC_OPENSSL_LIBS@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/bin/tests/optional/Makefile.in b/bin/tests/optional/Makefile.in index 4442a808c4..97d1024244 100644 --- a/bin/tests/optional/Makefile.in +++ b/bin/tests/optional/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = @CRYPTO@ @USE_GSSAPI@ 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@ @ISC_OPENSSL_LIBS@ ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @ISC_OPENSSL_LIBS@ ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@ diff --git a/bin/tests/system/pipelined/Makefile.in b/bin/tests/system/pipelined/Makefile.in index f140d525db..8bb1097e83 100644 --- a/bin/tests/system/pipelined/Makefile.in +++ b/bin/tests/system/pipelined/Makefile.in @@ -20,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ CDEFINES = @CRYPTO@ CWARNINGS = -DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ diff --git a/bin/tests/system/rsabigexponent/Makefile.in b/bin/tests/system/rsabigexponent/Makefile.in index af2b0f1e70..83b41b8b47 100644 --- a/bin/tests/system/rsabigexponent/Makefile.in +++ b/bin/tests/system/rsabigexponent/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id$ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -22,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ CDEFINES = @CRYPTO@ CWARNINGS = -DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ diff --git a/bin/tests/system/tkey/Makefile.in b/bin/tests/system/tkey/Makefile.in index 252b6c061d..df275ca01f 100644 --- a/bin/tests/system/tkey/Makefile.in +++ b/bin/tests/system/tkey/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.14 2009/12/05 23:31:40 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -22,7 +20,7 @@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ CDEFINES = @CRYPTO@ CWARNINGS = -DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +DNSLIBS = ../../../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCLIBS = ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ DNSDEPLIBS = ../../../../lib/dns/libdns.@A@ diff --git a/bin/tools/Makefile.in b/bin/tools/Makefile.in index 7bf2af4cea..9352155dfd 100644 --- a/bin/tools/Makefile.in +++ b/bin/tools/Makefile.in @@ -17,12 +17,13 @@ VERSION=@BIND9_VERSION@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} \ ${ISCCFG_INCLUDES} ${LWRES_INCLUDES} \ - ${BIND9_INCLUDES} @DST_OPENSSL_INC@ + ${BIND9_INCLUDES} ${MAXMINDDB_CFLAGS} \ + @DST_OPENSSL_INC@ CDEFINES = @CRYPTO@ -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@ @DNS_CRYPTO_LIBS@ ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ diff --git a/config.h.in b/config.h.in index 4ecaa8fd44..8ae7692568 100644 --- a/config.h.in +++ b/config.h.in @@ -270,6 +270,9 @@ int sigwait(const unsigned int *set, int *sig); /* 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 a205b7e093..ce0f5d8697 100755 --- a/configure +++ b/configure @@ -876,6 +876,11 @@ ISC_PLATFORM_HAVEGSSAPI KRB5_CONFIG GEOIPLINKOBJS GEOIPLINKSRCS +GEOIP2LINKOBJS +GEOIP2LINKSRCS +MAXMINDDB_PREFIX +MAXMINDDB_LIBS +MAXMINDDB_CFLAGS LWRES_PLATFORM_NEEDSYSSELECTH ISC_PLATFORM_NEEDSYSSELECTH ISC_PLATFORM_HAVEDEVPOLL @@ -974,6 +979,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -1027,6 +1033,7 @@ enable_kqueue enable_epoll enable_devpoll with_geoip +with_geoip2 with_gssapi with_randomdev enable_threads @@ -1100,6 +1107,9 @@ CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR +MAXMINDDB_CFLAGS +MAXMINDDB_LIBS +MAXMINDDB_PREFIX CMOCKA_CFLAGS CMOCKA_LIBS KYUA' @@ -1141,6 +1151,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}' @@ -1393,6 +1404,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=* \ @@ -1530,7 +1550,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. @@ -1683,6 +1703,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] @@ -1771,7 +1792,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-gssapi=PATH|/path/krb5-config Specify path for system-supplied GSSAPI [default=auto] @@ -1843,6 +1866,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 CMOCKA_CFLAGS C compiler flags for CMOCKA, overriding pkg-config CMOCKA_LIBS linker flags for CMOCKA, overriding pkg-config @@ -14616,17 +14645,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 @@ -14641,10 +15063,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" @@ -27300,7 +27718,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" @@ -27379,7 +27798,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 "yes" = "$enable_fixed" || \ diff --git a/configure.ac b/configure.ac index 6cc1089534..94e03a7224 100644 --- a/configure.ac +++ b/configure.ac @@ -722,13 +722,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 @@ -743,8 +794,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" @@ -5538,7 +5587,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" @@ -5617,7 +5667,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 "yes" = "$enable_fixed" || \ diff --git a/lib/bind9/Makefile.in b/lib/bind9/Makefile.in index 3c98330249..73a55989f8 100644 --- a/lib/bind9/Makefile.in +++ b/lib/bind9/Makefile.in @@ -7,8 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -# $Id: Makefile.in,v 1.14 2009/12/05 23:31:40 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -27,7 +25,7 @@ CWARNINGS = ISCLIBS = ../../lib/isc/libisc.@A@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ -DNSLIBS = ../../lib/dns/libdns.@A@ +DNSLIBS = ../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index f6868d1587..7f09bd6873 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} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@ + ${ISC_INCLUDES} ${MAXMINDDB_CFLAGS} \ + @DST_OPENSSL_INC@ @DST_GSSAPI_INC@ CDEFINES = -DUSE_MD5 @CRYPTO@ @USE_GSSAPI@ ${USE_ISC_SPNEGO} @@ -37,7 +38,7 @@ ISCLIBS = ../../lib/isc/libisc.@A@ ISCDEPLIBS = ../../lib/isc/libisc.@A@ -LIBS = @LIBS@ +LIBS = ${MAXMINDDB_LIBS} @LIBS@ # Alphabetically @@ -57,6 +58,7 @@ DSTOBJS = @DST_EXTRA_OBJS@ @OPENSSLLINKOBJS@ @PKCS11LINKOBJS@ \ gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ key.@O@ GEOIPLINKOBJS = geoip.@O@ +GEOIP2LINKOBJS = geoip2.@O@ DNSTAPOBJS = dnstap.@O@ dnstap.pb-c.@O@ @@ -82,7 +84,7 @@ DNSOBJS = acache.@O@ acl.@O@ adb.@O@ badcache.@O@ byaddr.@O@ \ PORTDNSOBJS = client.@O@ ecdb.@O@ OBJS= @DNSTAPOBJS@ ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} \ - ${PORTDNSOBJS} @GEOIPLINKOBJS@ + ${PORTDNSOBJS} @GEOIPLINKOBJS@ @GEOIP2LINKOBJS@ # Alphabetically @@ -103,6 +105,7 @@ DSTSRCS = @DST_EXTRA_SRCS@ @OPENSSLLINKSRCS@ @PKCS11LINKSRCS@ \ hmac_link.c key.c GEOIPLINKSRCS = geoip.c +GEOIPL2INKSRCS = geoip2.c DNSTAPSRCS = dnstap.c dnstap.pb-c.c @@ -123,7 +126,8 @@ DNSSRCS = acache.c acl.c adb.c badcache. byaddr.c \ version.c view.c xfrin.c zone.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 0897579cb4..90dc3a69c5 100644 --- a/lib/dns/tests/Makefile.in +++ b/lib/dns/tests/Makefile.in @@ -21,7 +21,7 @@ CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns/tests/\"" ISCLIBS = ../../isc/libisc.@A@ 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 5089b6cd21..536fa59286 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@ ISCDEPLIBS = ../../isc/libisc.@A@ diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index f459bd54a0..b97657d9b8 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -23,7 +23,7 @@ CDEFINES = CWARNINGS = ISCLIBS = ../../lib/isc/libisc.@A@ -DNSLIBS = ../../lib/dns/libdns.@A@ +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 521e1cc428..3064152b6b 100644 --- a/lib/isccfg/tests/Makefile.in +++ b/lib/isccfg/tests/Makefile.in @@ -22,7 +22,7 @@ CDEFINES = @CRYPTO@ -DTESTS="\"${top_builddir}/lib/dns/tests/\"" ISCLIBS = ../../isc/libisc.@A@ 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/samples/Makefile.in b/lib/samples/Makefile.in index 7abdd8e80f..6abe81c2ac 100644 --- a/lib/samples/Makefile.in +++ b/lib/samples/Makefile.in @@ -25,7 +25,7 @@ CDEFINES = @CRYPTO@ -DVERSION=\"${VERSION}\" \ CWARNINGS = ISCLIBS = ../isc/libisc.@A@ -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 8804a5a4b6..30605a09c8 100644 --- a/make/rules.in +++ b/make/rules.in @@ -118,6 +118,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 7fae33a59c..49659c1c1f 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3323,6 +3323,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 @@ -4456,6 +4457,8 @@ ./libtool.m4/ltversion.m4 X 2012,2018,2019 ./libtool.m4/lt~obsolete.m4 X 2012,2018,2019 ./ltmain.sh X 1999,2000,2001,2003,2004,2006,2009,2012,2018,2019 +./m4/ax_restore_flags.m4 X 2019 +./m4/ax_save_flags.m4 X 2019 ./make/Makefile.in MAKE 1998,1999,2000,2001,2004,2007,2012,2016,2018,2019 ./make/includes.in MAKE 1999,2000,2001,2004,2005,2007,2012,2014,2016,2018,2019 ./make/mkdep.in X 1999,2000,2001,2006,2011,2014,2018,2019