--- /dev/null
+// NS2
+
+options {
+ query-source address 10.53.0.2;
+ notify-source 10.53.0.2;
+ transfer-source 10.53.0.2;
+ pid-file "named.pid";
+ listen-on { 10.53.0.2; };
+};
+
+view one {
+ match-clients { geoip asnum "AS1234JUNK"; };
+ zone "example" {
+ type primary;
+ file "example1.db";
+ };
+};
* information regarding copyright ownership.
*/
+#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <isc/log.h>
#include <isc/mem.h>
+#include <isc/parseint.h>
#include <isc/string.h>
#include <isc/util.h>
strlcpy(de.geoip_elem.as_string, search,
sizeof(de.geoip_elem.as_string));
} else if (strcasecmp(stype, "asnum") == 0) {
+ const char *s = search;
+ uint32_t val;
+
+ /* check asnum validity */
subtype = dns_geoip_as_asnum;
+ if (strncasecmp(s, "AS", 2) == 0) {
+ s += 2;
+ }
+ if (isc_parse_uint32(&val, s, 10) != ISC_R_SUCCESS) {
+ cfg_obj_log(obj, ISC_LOG_ERROR, "invalid asnum '%s'",
+ search);
+ return ISC_R_UNEXPECTEDTOKEN;
+ }
+
strlcpy(de.geoip_elem.as_string, search,
sizeof(de.geoip_elem.as_string));
} else if (strcasecmp(stype, "org") == 0) {