Permalink
Browse files

GeoIP backend implementation

  • Loading branch information...
1 parent 08e55b8 commit 709ca59fa0a4d29970435169afa5d6dbd789c185 @cmouse cmouse committed Sep 4, 2014
Showing with 1,024 additions and 5 deletions.
  1. +7 −3 .travis.yml
  2. +14 −0 configure.ac
  3. +4 −0 m4/pdns_with_geo.m4
  4. +1 −1 modules/Makefile.am
  5. +5 −0 modules/geoipbackend/Makefile.am
  6. +1 −0 modules/geoipbackend/OBJECTFILES
  7. +1 −0 modules/geoipbackend/OBJECTLIBS
  8. +650 −0 modules/geoipbackend/geoipbackend.cc
  9. +66 −0 modules/geoipbackend/geoipbackend.hh
  10. +4 −0 modules/geoipbackend/regression-tests/.gitignore
  11. +16 −0 modules/geoipbackend/regression-tests/00dnssec-grabkeys/command
  12. +1 −0 modules/geoipbackend/regression-tests/00dnssec-grabkeys/description
  13. 0 modules/geoipbackend/regression-tests/00dnssec-grabkeys/expected_result
  14. +3 −0 modules/geoipbackend/regression-tests/basic-a-dnssec/command
  15. +1 −0 modules/geoipbackend/regression-tests/basic-a-dnssec/description
  16. +7 −0 modules/geoipbackend/regression-tests/basic-a-dnssec/expected_result
  17. 0 modules/geoipbackend/regression-tests/basic-a-dnssec/skip.nodnssec
  18. +3 −0 modules/geoipbackend/regression-tests/basic-a-resolution/command
  19. +2 −0 modules/geoipbackend/regression-tests/basic-a-resolution/description
  20. +4 −0 modules/geoipbackend/regression-tests/basic-a-resolution/expected_result
  21. +2 −0 modules/geoipbackend/regression-tests/region-a-resolution/command
  22. +2 −0 modules/geoipbackend/regression-tests/region-a-resolution/description
  23. +4 −0 modules/geoipbackend/regression-tests/region-a-resolution/expected_result
  24. +3 −0 modules/geoipbackend/regression-tests/static-any-resolution/command
  25. +2 −0 modules/geoipbackend/regression-tests/static-any-resolution/description
  26. +6 −0 modules/geoipbackend/regression-tests/static-any-resolution/expected_result
  27. +126 −0 pdns/docs/pdns.xml
  28. +8 −0 pdns/iputils.hh
  29. +3 −1 regression-tests/backends/common
  30. +77 −0 regression-tests/backends/geoip-master
  31. +1 −0 regression-tests/start-test-stop
View
@@ -5,12 +5,13 @@ compiler:
before_script:
- git describe --always --dirty=+
- sudo /sbin/ip addr add 10.0.3.0/24 dev lo
+ - sudo /sbin/ip addr add 1.2.3.4/32 dev lo
- sudo rm /etc/apt/sources.list.d/travis_ci_zeromq3-source.list
- sudo apt-get update
- - sudo apt-get install --no-install-recommends libboost-all-dev libtolua-dev bc libcdb-dev libnet-dns-perl unbound-host ldnsutils dnsutils bind9utils libtool libcdb-dev xmlto links asciidoc ruby-json ruby-sqlite3 rubygems libcurl4-openssl-dev ruby1.9.1 socat time libzmq1 libzmq-dev pkg-config daemontools authbind liblua5.1-posix1 libopendbx1-dev libopendbx1-sqlite3 python-virtualenv libldap2-dev softhsm libp11-kit-dev p11-kit moreutils
+ - sudo apt-get install --no-install-recommends libboost-all-dev libtolua-dev bc libcdb-dev libnet-dns-perl unbound-host ldnsutils dnsutils bind9utils libtool libcdb-dev xmlto links asciidoc ruby-json ruby-sqlite3 rubygems libcurl4-openssl-dev ruby1.9.1 socat time libzmq1 libzmq-dev pkg-config daemontools authbind liblua5.1-posix1 libopendbx1-dev libopendbx1-sqlite3 python-virtualenv libldap2-dev softhsm libp11-kit-dev p11-kit moreutils libgeoip-dev geoip-database
- sudo sh -c 'sed s/precise/trusty/g /etc/apt/sources.list > /etc/apt/sources.list.d/trusty.list'
- sudo apt-get update
- - sudo apt-get install liblmdb0 liblmdb-dev lmdb-utils
+ - sudo apt-get install liblmdb0 liblmdb-dev lmdb-utils libyaml-cpp-dev
- sudo update-alternatives --set ruby /usr/bin/ruby1.9.1
- sudo touch /etc/authbind/byport/53
- sudo chmod 755 /etc/authbind/byport/53
@@ -31,7 +32,7 @@ before_script:
- p11-kit -l # ensure it's ok
script:
- ./bootstrap
- - ./configure --with-modules='bind gmysql gpgsql gsqlite3 mydns tinydns remote random opendbx ldap lmdb' --enable-unit-tests --enable-tools --enable-remotebackend-zeromq --enable-experimental-pkcs11
+ - ./configure --with-modules='bind geoip gmysql gpgsql gsqlite3 mydns tinydns remote random opendbx ldap lmdb' --enable-unit-tests --enable-tools --enable-remotebackend-zeromq --enable-experimental-pkcs11
- make -k dist
- make -k -j 4
- make -k install DESTDIR=/tmp/pdns-install-dir
@@ -60,13 +61,16 @@ script:
- touch tests/verify-dnssec-zone/allow-missing
- touch tests/verify-dnssec-zone/skip.nsec3 # some (travis) tools in this test are unable to handle nsec3 zones
- touch tests/verify-dnssec-zone/skip.optout
+ - export geoipregion=oc geoipregionip=1.2.3.4
- ./timestamp ./start-test-stop 5300 bind-both
- ./timestamp ./start-test-stop 5300 bind-dnssec-both
- ./timestamp ./start-test-stop 5300 bind-dnssec-pkcs11
- ./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-both
- ./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-optout-both
- ./timestamp ./start-test-stop 5300 bind-dnssec-nsec3-narrow
- ./timestamp ./start-test-stop 5300 bind-hybrid-nsec3
+ - ./timestamp ./start-test-stop 5300 geoipbackend
+ - ./timestamp ./start-test-stop 5300 geoipbackend-nsec3-narrow
- ./timestamp ./start-test-stop 5300 gmysql-nodnssec-both
- ./timestamp ./start-test-stop 5300 gmysql-both
- ./timestamp ./start-test-stop 5300 gmysql-nsec3-both
View
@@ -63,6 +63,16 @@ eval full_libdir="\"$libdir\""
# detect pkg-config explicitly
PKG_PROG_PKG_CONFIG
+AC_CHECK_HEADERS(
+ [sys/mman.h],
+ [AC_CHECK_FUNC(
+ [mmap],
+ [AC_DEFINE(HAVE_MMAP, [1], [Define to 1 if you have mmap])],
+ [have_mmap=no]
+ )],
+ [have_mmap=no]
+)
+
PDNS_CHECK_RAGEL
AC_CHECK_PROG([ASCIIDOC], [asciidoc], [asciidoc])
@@ -284,6 +294,9 @@ for a in $modules $dynmodules; do
tinydns)
PDNS_CHECK_CDB
;;
+ geoip)
+ PDNS_CHECK_GEOIP
+ ;;
esac
done
@@ -358,6 +371,7 @@ AC_CONFIG_FILES([
modules/bindbackend/Makefile
modules/db2backend/Makefile
modules/geobackend/Makefile
+ modules/geoipbackend/Makefile
modules/gmysqlbackend/Makefile
modules/goraclebackend/Makefile
modules/gpgsqlbackend/Makefile
View
@@ -0,0 +1,4 @@
+AC_DEFUN([PDNS_CHECK_GEOIP], [
+ PKG_CHECK_MODULES([GEOIP], [geoip])
+ PKG_CHECK_MODULES([YAML], [yaml-cpp >= 0.5])
+])
View
@@ -1,2 +1,2 @@
SUBDIRS=@moduledirs@
-DIST_SUBDIRS=bindbackend db2backend geobackend gmysqlbackend goraclebackend gpgsqlbackend gsqlite3backend ldapbackend luabackend mydnsbackend opendbxbackend oraclebackend pipebackend tinydnsbackend remotebackend randombackend lmdbbackend
+DIST_SUBDIRS=bindbackend db2backend geobackend gmysqlbackend goraclebackend gpgsqlbackend gsqlite3backend ldapbackend luabackend mydnsbackend opendbxbackend oraclebackend pipebackend tinydnsbackend remotebackend randombackend lmdbbackend geoipbackend
@@ -0,0 +1,5 @@
+AM_CPPFLAGS=$(THREADFLAGS) $(BOOST_CPPFLAGS) $(YAML_CFLAGS) $(GEOIP_CFLAGS)
+EXTRA_DIST=OBJECTFILES OBJECTLIBS
+pkglib_LTLIBRARIES = libgeoipbackend.la
+libgeoipbackend_la_SOURCES=geoipbackend.cc geoipbackend.hh
+libgeoipbackend_la_LDFLAGS=-module -avoid-version
@@ -0,0 +1 @@
+geoipbackend.lo
@@ -0,0 +1 @@
+$(YAML_LIBS) $(GEOIP_LIBS)
Oops, something went wrong.

0 comments on commit 709ca59

Please sign in to comment.