diff --git a/.gitignore b/.gitignore index 0d91436f7ec6..b96b924d40dc 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ pdns_recursor.pid *.gcda *.gcno *.gcov +modules/geoipbackend/regression-tests/GeoLiteCity.dat diff --git a/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv b/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv new file mode 100644 index 000000000000..3e0866adc82a --- /dev/null +++ b/modules/geoipbackend/regression-tests/GeoLiteCity-Blocks.csv @@ -0,0 +1,4 @@ +startIpNum,endIpNum,locId +"2130706433","2130706433","1" +"2130706434","2130706434","2" +"2130706435","2130706435","3" diff --git a/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv b/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv new file mode 100644 index 000000000000..a0786c2ec164 --- /dev/null +++ b/modules/geoipbackend/regression-tests/GeoLiteCity-Location.csv @@ -0,0 +1,4 @@ +locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode +1,"O1","L1","C1","00001",0,0,1,1 +2,"O1","L2","C2","00002",0,0,2,2 +3,"O1","L3","C3","00003",0,0,3,3 diff --git a/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 b/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 new file mode 100644 index 000000000000..da06c58437f2 --- /dev/null +++ b/modules/geoipbackend/regression-tests/GeoLiteCity.dat.b64 @@ -0,0 +1,5 @@ +AQAAIQAAIQAAAgAAIQAAAwAAIQAABAAAIQAABQAAIQAABgAAIQAABwAAIQAACAAACQAAIQAACgAA +IQAACwAAIQAADAAAIQAADQAAIQAADgAAIQAADwAAIQAAEAAAIQAAEQAAIQAAEgAAIQAAEwAAIQAA +FAAAIQAAFQAAIQAAFgAAIQAAFwAAIQAAGAAAIQAAGQAAIQAAGgAAIQAAGwAAIQAAHAAAIQAAHQAA +IQAAHgAAIQAAHwAAIAAAIQAAIgAAOAAATgAAKvZMMQBDMQAwMDAwMQBAdxtAdxsAAAD2TDIAQzIA +MDAwMDIAQHcbQHcbAAAA9kwzAEMzADAwMDAzAEB3G0B3GwAAAGNzdjJkYXQucHn///8CIQAA diff --git a/modules/geoipbackend/regression-tests/city-resolution/command b/modules/geoipbackend/regression-tests/city-resolution/command new file mode 100755 index 000000000000..d1b4f7813f62 --- /dev/null +++ b/modules/geoipbackend/regression-tests/city-resolution/command @@ -0,0 +1,5 @@ +#!/bin/sh +cleandig city.geo.example.com A ednssubnet 127.0.0.1 +cleandig city.geo.example.com A ednssubnet 127.0.0.2 +cleandig city.geo.example.com A ednssubnet 127.0.0.3 + diff --git a/modules/geoipbackend/regression-tests/city-resolution/description b/modules/geoipbackend/regression-tests/city-resolution/description new file mode 100644 index 000000000000..e08b4cc5bb38 --- /dev/null +++ b/modules/geoipbackend/regression-tests/city-resolution/description @@ -0,0 +1 @@ +This test tests that city database support works diff --git a/modules/geoipbackend/regression-tests/city-resolution/expected_result b/modules/geoipbackend/regression-tests/city-resolution/expected_result new file mode 100644 index 000000000000..a6990b5a0b30 --- /dev/null +++ b/modules/geoipbackend/regression-tests/city-resolution/expected_result @@ -0,0 +1,12 @@ +0 city.geo.example.com. IN A 30 127.0.1.1 +2 . IN OPT 0 AAgACAABICB/AAAB +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='city.geo.example.com.', qtype=A +0 city.geo.example.com. IN A 30 127.0.2.1 +2 . IN OPT 0 AAgACAABICB/AAAC +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='city.geo.example.com.', qtype=A +0 city.geo.example.com. IN A 30 127.0.3.1 +2 . IN OPT 0 AAgACAABICB/AAAD +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='city.geo.example.com.', qtype=A diff --git a/regression-tests/backends/geoip-master b/regression-tests/backends/geoip-master index 8a3039b35333..0397e138cf51 100644 --- a/regression-tests/backends/geoip-master +++ b/regression-tests/backends/geoip-master @@ -32,6 +32,12 @@ domains: - ns: ns1.example.com - ns: ns2.example.com - mx: 10 mx.example.com + c1.l1.o1.city.geo.example.com: + - a: 127.0.1.1 + c2.l2.o1.city.geo.example.com: + - a: 127.0.2.1 + c3.l3.o1.city.geo.example.com: + - a: 127.0.3.1 continent.geo.example.com: - txt: Your continent is %cn $geoipregion.service.geo.example.com: @@ -41,6 +47,7 @@ domains: services: www.geo.example.com: '%cn.service.geo.example.com' indirect.geo.example.com: '%cn.elsewhere.example.com' + city.geo.example.com: '%ci.%re.%cc.city.geo.example.com' EOF cat > $testsdir/region-a-resolution/expected_result < $testsdir/GeoLiteCity.dat + $RUNWRAPPER $PDNS --daemon=no --local-port=$port --socket-dir=./ \ --no-shuffle --launch=geoip \ --cache-ttl=$cachettl --dname-processing --no-config \ --distributor-threads=1 \ - --geoip-zones-file=$testsdir/geo.yaml --geoip-database-files=/usr/share/GeoIP/GeoIP.dat \ + --geoip-zones-file=$testsdir/geo.yaml --geoip-database-files="/usr/share/GeoIP/GeoIP.dat $testsdir/GeoLiteCity.dat" \ --module-dir=./modules --edns-subnet-processing=yes \ $geoipkeydir & ;;