--- bind-9.4.1_p1.patched-not-compiled/work/bind-9.4.1-P1/contrib/dlz/drivers/dlz_postgres_driver.c 2008-04-07 19:44:49.000000000 +0400 +++ bind-9.4.1_p1.patched-not-compiled.opt/work/bind-9.4.1-P1/contrib/dlz/drivers/dlz_postgres_driver.c 2008-04-07 19:43:42.000000000 +0400 @@ -52,6 +52,7 @@ #ifdef DLZ_POSTGRES #define CUT_TEMP_MSGS +#define PRIVATE_ZONE_OPTIMIZE #include #include @@ -297,6 +298,36 @@ unsigned int dlz_thread_num = 1+(int) (1000.0*rand()/(RAND_MAX+1.0)); REQUIRE(*rs == NULL); +#ifdef PRIVATE_ZONE_OPTIMIZE + +#define _10_IN_ADDR_ARPA "10.in-addr.arpa" +#define _168_IN_ADDR_ARPA "168.192.in-addr.arpa" +#define _10_LEN 15 +#define _168_LEN 20 + + uint8_t octs[4]; + char conv_host[15]; + bzero(conv_host, sizeof(conv_host)); + if(!memcmp(zone + strlen(zone) - _10_LEN, _10_IN_ADDR_ARPA, _10_LEN)) + { + if(sscanf(zone, "%hhu.%hhu.%hhu.%hhu.", &octs[0], &octs[1], &octs[2], &octs[3]) == 4) + { + sprintf(conv_host, "%hhu.%hhu.%hhu", octs[0], octs[1], octs[2]); + record = conv_host; + zone = _10_IN_ADDR_ARPA; + } + } + else if(!memcmp(zone + strlen(zone) - _168_LEN, _168_IN_ADDR_ARPA, _168_LEN)) + { + if(sscanf(zone, "%hhu.%hhu.%hhu.%hhu.", &octs[0], &octs[1], &octs[2], &octs[3]) == 4) + { + sprintf(conv_host, "%hhu.%hhu", octs[0], octs[1]); + record = conv_host; + zone = _168_IN_ADDR_ARPA; + } + } + +#endif #ifndef CUT_TEMP_MSGS /* temporary logging message */