implement 'notify [ yes | no | explicit ]'

This commit is contained in:
Michael Graff 2000-07-24 22:59:44 +00:00
parent 998befa9f3
commit ef653fbdb1
12 changed files with 150 additions and 58 deletions

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.45 2000/07/21 23:13:59 mws Exp $ */
/* $Id: zoneconf.c,v 1.46 2000/07/24 22:59:32 explorer Exp $ */
#include <config.h>
@ -113,6 +113,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
isc_result_t result;
isc_boolean_t boolean;
const char *filename = NULL;
dns_notifytype_t notifytype;
#ifdef notyet
dns_c_severity_t severity;
#endif
@ -174,14 +175,14 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
* acting as masters (type "slave"), but not to stubs.
*/
if (czone->ztype != dns_c_zone_stub) {
result = dns_c_zone_getnotify(czone, &boolean);
result = dns_c_zone_getnotify(czone, &notifytype);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_getnotify(cview, &boolean);
result = dns_c_view_getnotify(cview, &notifytype);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getnotify(cctx, &boolean);
result = dns_c_ctx_getnotify(cctx, &notifytype);
if (result != ISC_R_SUCCESS)
boolean = ISC_TRUE;
dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFY, boolean);
notifytype = dns_notifytype_yes;
dns_zone_setnotifytype(zone, notifytype);
iplist = NULL;
result = dns_c_zone_getalsonotify(czone, &iplist);

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confctx.c,v 1.73 2000/07/11 19:09:04 brister Exp $ */
/* $Id: confctx.c,v 1.74 2000/07/24 22:59:34 explorer Exp $ */
#include <config.h>
@ -33,6 +33,10 @@
#define GETBOOL(FUNC, FIELD) GETBYTYPE(isc_boolean_t, FUNC, FIELD)
#define UNSETBOOL(FUNC, FIELD) UNSETBYTYPE(isc_boolean_t, FUNC, FIELD)
#define SETNOTIFYTYPE(FUNC, FIELD) SETBYTYPE(dns_notifytype_t, FUNC, FIELD)
#define GETNOTIFYTYPE(FUNC, FIELD) GETBYTYPE(dns_notifytype_t, FUNC, FIELD)
#define UNSETNOTIFYTYPE(FUNC, FIELD) UNSETBYTYPE(dns_notifytype_t, FUNC, FIELD)
#define SETINT32(FUNC, FIELD) SETBYTYPE(isc_int32_t, FUNC, FIELD)
#define GETINT32(FUNC, FIELD) GETBYTYPE(isc_int32_t, FUNC, FIELD)
#define UNSETINT32(FUNC, FIELD) UNSETBYTYPE(isc_int32_t, FUNC, FIELD)
@ -835,6 +839,12 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
(unsigned long)(*options->FIELD / 60)); \
}
#define PRINT_IF_EQUAL(VAL, STRVAL, FIELD, NAME) \
if (options->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
fprintf(fp, "%s %s;\n", NAME, STRVAL); \
}
#define PRINT_AS_BOOLEAN(FIELD, NAME) \
if (options->FIELD != NULL) { \
dns_c_printtabs(fp, indent + 1); \
@ -955,7 +965,9 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
PRINT_AS_BOOLEAN(fake_iquery, "fake-iquery");
PRINT_AS_BOOLEAN(recursion, "recursion");
PRINT_AS_BOOLEAN(fetch_glue, "fetch-glue");
PRINT_AS_BOOLEAN(notify, "notify");
PRINT_IF_EQUAL(dns_notifytype_no, "no", notify, "notify");
PRINT_IF_EQUAL(dns_notifytype_yes, "yes", notify, "notify");
PRINT_IF_EQUAL(dns_notifytype_explicit, "explicit", notify, "notify");
PRINT_AS_BOOLEAN(host_statistics, "host-statistics");
PRINT_AS_BOOLEAN(dealloc_on_exit, "deallocate-on-exit");
PRINT_AS_BOOLEAN(use_ixfr, "use-ixfr");
@ -1887,9 +1899,9 @@ SETBOOL(fetchglue, fetch_glue)
UNSETBOOL(fetchglue, fetch_glue)
GETBOOL(notify, notify)
SETBOOL(notify, notify)
UNSETBOOL(notify, notify)
GETNOTIFYTYPE(notify, notify)
SETNOTIFYTYPE(notify, notify)
UNSETNOTIFYTYPE(notify, notify)
GETBOOL(hoststatistics, host_statistics)

View file

@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.103 2000/07/21 21:24:57 brister Exp $ */
/* $Id: confparser.y,v 1.104 2000/07/24 22:59:35 explorer Exp $ */
#include <config.h>
@ -214,6 +214,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
dns_severity_t severity;
dns_c_trans_t transport;
dns_transfer_format_t tformat;
dns_notifytype_t notifytype;
dns_c_ipmatchelement_t *ime;
dns_c_ipmatchlist_t *iml;
@ -394,11 +395,13 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_WILDCARD
%token L_YES
%token L_ZONE
%token L_EXPLICIT
%type <addata> additional_data
%type <boolean> grantp
%type <boolean> yea_or_nay
%type <notifytype> notify_setting
%type <forward> forward_opt
%type <forward> zone_forward_opt
%type <ime> address_match_element
@ -755,7 +758,7 @@ option: /* Empty */
YYABORT;
}
}
| L_NOTIFY yea_or_nay
| L_NOTIFY notify_setting
{
tmpres = dns_c_ctx_setnotify(currcfg, $2);
if (tmpres == ISC_R_EXISTS) {
@ -1912,6 +1915,39 @@ yea_or_nay: L_YES
$$ = isc_boolean_true;
}
}
notify_setting: L_YES
{
$$ = dns_notifytype_yes;
}
| L_TRUE
{
$$ = dns_notifytype_yes;
}
| L_NO
{
$$ = dns_notifytype_no;
}
| L_FALSE
{
$$ = dns_notifytype_no;
}
| L_EXPLICIT
{
$$ = dns_notifytype_explicit;
}
| L_INTEGER
{
if ($1 == 1) {
$$ = dns_notifytype_yes;
} else if ($1 == 0) {
$$ = dns_notifytype_no;
} else {
parser_warning(ISC_TRUE,
"number should be 0 or 1, assuming 1");
$$ = dns_notifytype_yes;
}
}
;
check_names_type: L_MASTER
@ -3613,7 +3649,7 @@ view_option: L_FORWARD zone_forward_opt
YYABORT;
}
}
| L_NOTIFY yea_or_nay
| L_NOTIFY notify_setting
{
dns_c_view_t *view = dns_c_ctx_getcurrview(currcfg);
@ -4783,7 +4819,7 @@ zone_option: L_FILE L_QSTRING
YYABORT;
}
}
| L_NOTIFY yea_or_nay
| L_NOTIFY notify_setting
{
dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg);
@ -5312,6 +5348,7 @@ static struct token keyword_tokens [] = {
{ "warn", L_WARN },
{ "yes", L_YES },
{ "zone", L_ZONE },
{ "explicit", L_EXPLICIT },
{ NULL, 0 }
};

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confview.c,v 1.36 2000/06/09 22:13:23 brister Exp $ */
/* $Id: confview.c,v 1.37 2000/07/24 22:59:37 explorer Exp $ */
#include <config.h>
@ -43,6 +43,10 @@
#define GETBOOL(FUNC, FIELD) GETBYTYPE(isc_boolean_t, FUNC, FIELD)
#define UNSETBOOL(FUNC, FIELD) UNSETBYTYPE(isc_boolean_t, FUNC, FIELD)
#define SETNOTIFYTYPE(FUNC, FIELD) SETBYTYPE(dns_notifytype_t, FUNC, FIELD)
#define GETNOTIFYTYPE(FUNC, FIELD) GETBYTYPE(dns_notifytype_t, FUNC, FIELD)
#define UNSETNOTIFYTYPE(FUNC, FIELD) UNSETBYTYPE(dns_notifytype_t, FUNC, FIELD)
#define SETUINT32(FUNC, FIELD) SETBYTYPE(isc_uint32_t, FUNC, FIELD)
#define GETUINT32(FUNC, FIELD) GETBYTYPE(isc_uint32_t, FUNC, FIELD)
#define UNSETUINT32(FUNC, FIELD) UNSETBYTYPE(isc_uint32_t, FUNC, FIELD)
@ -336,6 +340,7 @@ isc_result_t
dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable) {
dns_c_view_t *elem;
isc_boolean_t bbval;
dns_notifytype_t notifytype;
isc_uint32_t buival;
isc_result_t result = ISC_R_SUCCESS;
dns_c_rrsolist_t *boval;
@ -351,7 +356,7 @@ dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable) {
"implemented");
if (dns_c_view_getnotify(elem, &bbval) != ISC_R_NOTFOUND)
if (dns_c_view_getnotify(elem, &notifytype) != ISC_R_NOTFOUND)
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"view 'notify' is not yet "
@ -1456,9 +1461,9 @@ SETBOOL(fetchglue, fetch_glue)
GETBOOL(fetchglue, fetch_glue)
UNSETBOOL(fetchglue, fetch_glue)
SETBOOL(notify, notify)
GETBOOL(notify, notify)
UNSETBOOL(notify, notify)
GETNOTIFYTYPE(notify, notify)
SETNOTIFYTYPE(notify, notify)
UNSETNOTIFYTYPE(notify, notify)
SETBOOL(rfc2308type1, rfc2308_type1)
GETBOOL(rfc2308type1, rfc2308_type1)

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confzone.c,v 1.48 2000/07/21 21:24:59 brister Exp $ */
/* $Id: confzone.c,v 1.49 2000/07/24 22:59:38 explorer Exp $ */
#include <config.h>
@ -433,7 +433,7 @@ dns_c_zone_new(isc_mem_t *mem,
case dns_c_zone_master:
master_zone_init(&newzone->u.mzone);
break;
case dns_c_zone_slave:
slave_zone_init(&newzone->u.szone);
break;
@ -441,11 +441,11 @@ dns_c_zone_new(isc_mem_t *mem,
case dns_c_zone_stub:
stub_zone_init(&newzone->u.tzone);
break;
case dns_c_zone_hint:
hint_zone_init(&newzone->u.hzone);
break;
case dns_c_zone_forward:
forward_zone_init(&newzone->u.fzone);
break;
@ -1475,7 +1475,7 @@ dns_c_zone_getdialup(dns_c_zone_t *zone, isc_boolean_t *retval) {
*/
isc_result_t
dns_c_zone_setnotify(dns_c_zone_t *zone, isc_boolean_t newval) {
dns_c_zone_setnotify(dns_c_zone_t *zone, dns_notifytype_t newval) {
isc_boolean_t existed = ISC_FALSE;
REQUIRE(DNS_C_ZONE_VALID(zone));
@ -1523,12 +1523,12 @@ dns_c_zone_setnotify(dns_c_zone_t *zone, isc_boolean_t newval) {
*/
isc_result_t
dns_c_zone_getnotify(dns_c_zone_t *zone, isc_boolean_t *retval) {
dns_c_zone_getnotify(dns_c_zone_t *zone, dns_notifytype_t *retval) {
isc_result_t res;
dns_c_setbits_t *bits = NULL;
isc_boolean_t val = ISC_FALSE;
dns_notifytype_t val = dns_notifytype_no;
int bit = 0;
REQUIRE(DNS_C_ZONE_VALID(zone));
REQUIRE(retval != NULL);
@ -1538,25 +1538,25 @@ dns_c_zone_getnotify(dns_c_zone_t *zone, isc_boolean_t *retval) {
bit = MZ_NOTIFY_BIT;
bits = &zone->u.mzone.setflags;
break;
case dns_c_zone_slave:
val = zone->u.szone.notify;
bit = SZ_NOTIFY_BIT;
bits = &zone->u.szone.setflags;
break;
case dns_c_zone_stub:
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
"Stub zones do not have a notify field");
return (ISC_R_FAILURE);
case dns_c_zone_hint:
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
"Hint zones do not have a notify field");
return (ISC_R_FAILURE);
case dns_c_zone_forward:
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_CRITICAL,
@ -1570,7 +1570,7 @@ dns_c_zone_getnotify(dns_c_zone_t *zone, isc_boolean_t *retval) {
} else {
res = ISC_R_NOTFOUND;
}
return (res);
}
@ -3758,8 +3758,12 @@ master_zone_print(FILE *fp, int indent, dns_c_masterzone_t *mzone) {
if (DNS_C_CHECKBIT(MZ_NOTIFY_BIT, &mzone->setflags)) {
dns_c_printtabs(fp, indent);
fprintf(fp, "notify %s;\n",
(mzone->notify ? "true" : "false"));
if (mzone->notify == dns_notifytype_no)
fprintf(fp, "notify no;\n");
if (mzone->notify == dns_notifytype_yes)
fprintf(fp, "notify yes;\n");
if (mzone->notify == dns_notifytype_explicit)
fprintf(fp, "notify explicit;\n");
}
if (mzone->also_notify != NULL) {
@ -3971,8 +3975,12 @@ slave_zone_print(FILE *fp, int indent, dns_c_slavezone_t *szone) {
if (DNS_C_CHECKBIT(SZ_NOTIFY_BIT, &szone->setflags)) {
dns_c_printtabs(fp, indent);
fprintf(fp, "notify %s;\n",
(szone->notify ? "true" : "false"));
if (szone->notify == dns_notifytype_no)
fprintf(fp, "notify no;\n");
if (szone->notify == dns_notifytype_yes)
fprintf(fp, "notify yes;\n");
if (szone->notify == dns_notifytype_explicit)
fprintf(fp, "notify explicit;\n");
}
if (szone->also_notify != NULL) {

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confctx.h,v 1.43 2000/06/22 21:55:20 tale Exp $ */
/* $Id: confctx.h,v 1.44 2000/07/24 22:59:39 explorer Exp $ */
#ifndef DNS_CONFCTX_H
#define DNS_CONFCTX_H 1
@ -154,7 +154,6 @@ struct dns_c_options {
isc_boolean_t *fake_iquery;
isc_boolean_t *recursion;
isc_boolean_t *fetch_glue;
isc_boolean_t *notify;
isc_boolean_t *host_statistics;
isc_boolean_t *dealloc_on_exit;
isc_boolean_t *use_ixfr;
@ -182,6 +181,7 @@ struct dns_c_options {
isc_uint32_t tkeydhkeyi;
char *tkeydomain;
dns_notifytype_t *notify;
dns_c_iplist_t *also_notify;
dns_severity_t *check_names[DNS_C_TRANSCOUNT];
@ -500,8 +500,8 @@ isc_result_t dns_c_ctx_getfetchglue(dns_c_ctx_t *cfg, isc_boolean_t *retval);
isc_result_t dns_c_ctx_unsetfetchglue(dns_c_ctx_t *cfg);
isc_result_t dns_c_ctx_setnotify(dns_c_ctx_t *cfg, isc_boolean_t newval);
isc_result_t dns_c_ctx_getnotify(dns_c_ctx_t *cfg, isc_boolean_t *retval);
isc_result_t dns_c_ctx_setnotify(dns_c_ctx_t *cfg, dns_notifytype_t newval);
isc_result_t dns_c_ctx_getnotify(dns_c_ctx_t *cfg, dns_notifytype_t *retval);
isc_result_t dns_c_ctx_unsetnotify(dns_c_ctx_t *cfg);

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confview.h,v 1.30 2000/06/22 21:55:30 tale Exp $ */
/* $Id: confview.h,v 1.31 2000/07/24 22:59:41 explorer Exp $ */
#ifndef DNS_CONFVIEW_H
#define DNS_CONFVIEW_H 1
@ -336,8 +336,8 @@ isc_result_t dns_c_view_unsetfetchglue(dns_c_view_t *view);
isc_result_t dns_c_view_getnotify(dns_c_view_t *view, isc_boolean_t *retval);
isc_result_t dns_c_view_setnotify(dns_c_view_t *view, isc_boolean_t newval);
isc_result_t dns_c_view_getnotify(dns_c_view_t *view, dns_notifytype_t *retval);
isc_result_t dns_c_view_setnotify(dns_c_view_t *view, dns_notifytype_t newval);
isc_result_t dns_c_view_unsetnotify(dns_c_view_t *view);

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confzone.h,v 1.36 2000/07/21 21:25:01 brister Exp $ */
/* $Id: confzone.h,v 1.37 2000/07/24 22:59:42 explorer Exp $ */
#ifndef DNS_CONFZONE_H
#define DNS_CONFZONE_H 1
@ -309,8 +309,9 @@ isc_result_t dns_c_zone_getdialup(dns_c_zone_t *zone, isc_boolean_t *retval);
isc_result_t dns_c_zone_setnotify(dns_c_zone_t *zone,
isc_boolean_t newval);
isc_result_t dns_c_zone_getnotify(dns_c_zone_t *zone, isc_boolean_t *retval);
dns_notifytype_t newval);
isc_result_t dns_c_zone_getnotify(dns_c_zone_t *zone,
dns_notifytype_t *retval);
isc_result_t dns_c_zone_setalsonotify(dns_c_zone_t *zone,

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: types.h,v 1.88 2000/06/23 02:59:05 tale Exp $ */
/* $Id: types.h,v 1.89 2000/07/24 22:59:43 explorer Exp $ */
#ifndef DNS_TYPES_H
#define DNS_TYPES_H 1
@ -135,6 +135,12 @@ typedef enum {
dns_dbtype_zone = 0, dns_dbtype_cache = 1, dns_dbtype_stub = 3
} dns_dbtype_t;
typedef enum {
dns_notifytype_no = 0,
dns_notifytype_yes = 1,
dns_notifytype_explicit = 2
} dns_notifytype_t;
/*
* These are generated by gen.c.
*/

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zone.h,v 1.60 2000/07/21 18:47:23 mws Exp $ */
/* $Id: zone.h,v 1.61 2000/07/24 22:59:44 explorer Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
@ -897,6 +897,12 @@ dns_zone_getsigvalidityinterval(dns_zone_t *zone);
* 'zone' to be a valid zone.
*/
void
dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype);
/*
* Sets zone notify method to "notifytype"
*/
isc_result_t
dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
isc_timermgr_t *timermgr, isc_socketmgr_t *socketmgr,

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zone.c,v 1.165 2000/07/22 00:40:39 mws Exp $ */
/* $Id: zone.c,v 1.166 2000/07/24 22:59:31 explorer Exp $ */
#include <config.h>
@ -126,6 +126,7 @@ struct dns_zone {
unsigned int masterscnt;
unsigned int curmaster;
isc_sockaddr_t masteraddr;
dns_notifytype_t notifytype;
isc_sockaddr_t *notify;
unsigned int notifycnt;
isc_sockaddr_t notifyfrom;
@ -355,6 +356,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
zone->masterscnt = 0;
zone->curmaster = 0;
zone->notify = NULL;
zone->notifytype = dns_notifytype_yes;
zone->notifycnt = 0;
zone->task = NULL;
zone->update_acl = NULL;
@ -475,6 +477,15 @@ dns_zone_getclass(dns_zone_t *zone){
return (zone->rdclass);
}
void
dns_zone_setnotifytype(dns_zone_t *zone, dns_notifytype_t notifytype) {
REQUIRE(DNS_ZONE_VALID(zone));
LOCK(&zone->lock);
zone->notifytype = notifytype;
UNLOCK(&zone->lock);
}
/*
* Single shot.
*/
@ -1944,16 +1955,17 @@ dns_zone_notify(dns_zone_t *zone) {
unsigned int i;
isc_sockaddr_t dst;
isc_boolean_t isqueued;
dns_notifytype_t notifytype;
REQUIRE(DNS_ZONE_VALID(zone));
LOCK(&zone->lock);
zone->flags &= ~DNS_ZONEFLG_NEEDNOTIFY;
notifytype = zone->notifytype;
UNLOCK(&zone->lock);
if (!DNS_ZONE_OPTION(zone, DNS_ZONEOPT_NOTIFY)) {
if (notifytype == dns_notifytype_no)
return;
}
origin = &zone->origin;
@ -1983,6 +1995,9 @@ dns_zone_notify(dns_zone_t *zone) {
}
UNLOCK(&zone->lock);
if (notifytype == dns_notifytype_explicit)
return;
/*
* Process NS RRset to generate notifies.
*/

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.45 2000/07/21 23:13:59 mws Exp $ */
/* $Id: zoneconf.c,v 1.46 2000/07/24 22:59:32 explorer Exp $ */
#include <config.h>
@ -113,6 +113,7 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
isc_result_t result;
isc_boolean_t boolean;
const char *filename = NULL;
dns_notifytype_t notifytype;
#ifdef notyet
dns_c_severity_t severity;
#endif
@ -174,14 +175,14 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
* acting as masters (type "slave"), but not to stubs.
*/
if (czone->ztype != dns_c_zone_stub) {
result = dns_c_zone_getnotify(czone, &boolean);
result = dns_c_zone_getnotify(czone, &notifytype);
if (result != ISC_R_SUCCESS && cview != NULL)
result = dns_c_view_getnotify(cview, &boolean);
result = dns_c_view_getnotify(cview, &notifytype);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getnotify(cctx, &boolean);
result = dns_c_ctx_getnotify(cctx, &notifytype);
if (result != ISC_R_SUCCESS)
boolean = ISC_TRUE;
dns_zone_setoption(zone, DNS_ZONEOPT_NOTIFY, boolean);
notifytype = dns_notifytype_yes;
dns_zone_setnotifytype(zone, notifytype);
iplist = NULL;
result = dns_c_zone_getalsonotify(czone, &iplist);