Skip to content

Commit

Permalink
- Fix #308: Deprecate "multi-master-check" in favour of
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Dec 7, 2023
1 parent 9c24338 commit 1a8f202
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 25 deletions.
3 changes: 2 additions & 1 deletion configlexer.lex
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ store-ixfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_STORE_IXFR;}
ixfr-size{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_IXFR_SIZE;}
ixfr-number{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_IXFR_NUMBER;}
create-ixfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CREATE_IXFR;}
multi-master-check{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_MULTI_MASTER_CHECK;}
multi-master-check{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_MULTI_PRIMARY_CHECK;}
multi-primary-check{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_MULTI_PRIMARY_CHECK;}
tls-service-key{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_TLS_SERVICE_KEY;}
tls-service-ocsp{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_TLS_SERVICE_OCSP;}
tls-service-pem{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_TLS_SERVICE_PEM;}
Expand Down
6 changes: 3 additions & 3 deletions configparser.y
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ struct component {
%token VAR_MAX_RETRY_TIME
%token VAR_MIN_RETRY_TIME
%token VAR_MIN_EXPIRE_TIME
%token VAR_MULTI_MASTER_CHECK
%token VAR_MULTI_PRIMARY_CHECK
%token VAR_SIZE_LIMIT_XFR
%token VAR_ZONESTATS
%token VAR_INCLUDE_PATTERN
Expand Down Expand Up @@ -900,8 +900,8 @@ pattern_or_zone_option:
yyerror("expected a number greater than zero");
}
}
| VAR_MULTI_MASTER_CHECK boolean
{ cfg_parser->pattern->multi_master_check = (int)$2; }
| VAR_MULTI_PRIMARY_CHECK boolean
{ cfg_parser->pattern->multi_primary_check = (int)$2; }
| VAR_INCLUDE_PATTERN STRING
{ config_apply_pattern(cfg_parser->pattern, $2); }
| VAR_REQUEST_XFR STRING STRING
Expand Down
2 changes: 2 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
7 December 2023: Wouter
- Merge #307 from anandb-ripencc: Many improvements to the nsd.conf
man page.
- Fix #308: Deprecate "multi-master-check" in favour of
"multi-primary-check".

6 December 2023: Wouter
- Fix to sync the tests script file common.sh.
Expand Down
2 changes: 2 additions & 0 deletions doc/RELNOTES
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ BUG FIXES:
in make install.
- Merge #307 from anandb-ripencc: Many improvements to the nsd.conf
man page.
- Fix #308: Deprecate "multi-master-check" in favour of
"multi-primary-check".

4.8.0
================
Expand Down
8 changes: 4 additions & 4 deletions nsd-checkconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ config_print_zone(nsd_options_type* opt, const char* k, int s, const char *o,
#ifdef RATELIMIT
ZONE_GET_RRL(rrl_whitelist, o, zone->pattern);
#endif
ZONE_GET_BIN(multi_master_check, o, zone->pattern);
ZONE_GET_BIN(multi_primary_check, o, zone->pattern);
ZONE_GET_BIN(store_ixfr, o, zone->pattern);
ZONE_GET_INT(ixfr_size, o, zone->pattern);
ZONE_GET_INT(ixfr_number, o, zone->pattern);
Expand Down Expand Up @@ -391,7 +391,7 @@ config_print_zone(nsd_options_type* opt, const char* k, int s, const char *o,
#ifdef RATELIMIT
ZONE_GET_RRL(rrl_whitelist, o, p);
#endif
ZONE_GET_BIN(multi_master_check, o, p);
ZONE_GET_BIN(multi_primary_check, o, p);
ZONE_GET_BIN(store_ixfr, o, p);
ZONE_GET_INT(ixfr_size, o, p);
ZONE_GET_INT(ixfr_number, o, p);
Expand Down Expand Up @@ -524,8 +524,8 @@ static void print_zone_content_elems(pattern_options_type* pat)
print_acl("allow_query:", pat->allow_query);
print_acl("allow-notify:", pat->allow_notify);
print_acl("request-xfr:", pat->request_xfr);
if(pat->multi_master_check)
printf("\tmulti-master-check: %s\n", pat->multi_master_check?"yes":"no");
if(pat->multi_primary_check)
printf("\tmulti-primary-check: %s\n", pat->multi_primary_check?"yes":"no");
if(!pat->notify_retry_is_default)
printf("\tnotify-retry: %d\n", pat->notify_retry);
print_acl("notify:", pat->notify);
Expand Down
5 changes: 4 additions & 1 deletion nsd.conf.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -965,11 +965,14 @@ The RRL classification types are: nxdomain, error, referral, any, rrsig,
wildcard, nodata, dnskey, positive, all.
.\" rrlend
.TP
.B multi\-master\-check:\fR <yes or no>
.B multi\-primary\-check:\fR <yes or no>
Default no. If enabled, checks all primaries for the last version. It uses
the higher version of all the configured primaries. Useful if you have multiple
primaries that have different version numbers served.
.TP
.B multi\-master\-check:\fR <yes or no>
It is the same as multi\-primary\-check.
.TP
.B verify\-zone:\fR <yes or no>
Enable or disable verification for this zone. Default is value\-zones
configured in
Expand Down
6 changes: 3 additions & 3 deletions nsd.conf.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ remote-control:
# retry values (limited to the bounds given with the above parameters), plus 1.
#min-expire-time: 0

# Slave server tries zone transfer to all masters and picks highest
# zone version available, for when masters have different versions.
#multi-master-check: no
# Secondary server tries zone transfer to all primaries and picks highest
# zone version available, for when primaries have different versions.
#multi-primary-check: no

# limit the zone transfer size (in bytes), stops very large transfers
# 0 is no limits enforced.
Expand Down
14 changes: 7 additions & 7 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ pattern_options_create(region_type* region)
#ifdef RATELIMIT
p->rrl_whitelist = 0;
#endif
p->multi_master_check = 0;
p->multi_primary_check = 0;
p->store_ixfr = 0;
p->store_ixfr_is_default = 1;
p->ixfr_size = IXFR_SIZE_DEFAULT;
Expand Down Expand Up @@ -1099,7 +1099,7 @@ copy_pat_fixed(region_type* region, struct pattern_options* orig,
#ifdef RATELIMIT
orig->rrl_whitelist = p->rrl_whitelist;
#endif
orig->multi_master_check = p->multi_master_check;
orig->multi_primary_check = p->multi_primary_check;
orig->store_ixfr = p->store_ixfr;
orig->store_ixfr_is_default = p->store_ixfr_is_default;
orig->ixfr_size = p->ixfr_size;
Expand Down Expand Up @@ -1227,7 +1227,7 @@ pattern_options_equal(struct pattern_options* p, struct pattern_options* q)
#ifdef RATELIMIT
if(p->rrl_whitelist != q->rrl_whitelist) return 0;
#endif
if(!booleq(p->multi_master_check,q->multi_master_check)) return 0;
if(!booleq(p->multi_primary_check,q->multi_primary_check)) return 0;
if(p->size_limit_xfr != q->size_limit_xfr) return 0;
if(!booleq(p->store_ixfr,q->store_ixfr)) return 0;
if(!booleq(p->store_ixfr_is_default,q->store_ixfr_is_default)) return 0;
Expand Down Expand Up @@ -1456,7 +1456,7 @@ pattern_options_marshal(struct buffer* b, struct pattern_options* p)
marshal_u8(b, p->min_retry_time_is_default);
marshal_u32(b, p->min_expire_time);
marshal_u8(b, p->min_expire_time_expr);
marshal_u8(b, p->multi_master_check);
marshal_u8(b, p->multi_primary_check);
marshal_u8(b, p->store_ixfr);
marshal_u8(b, p->store_ixfr_is_default);
marshal_u64(b, p->ixfr_size);
Expand Down Expand Up @@ -1506,7 +1506,7 @@ pattern_options_unmarshal(region_type* r, struct buffer* b)
p->min_retry_time_is_default = unmarshal_u8(b);
p->min_expire_time = unmarshal_u32(b);
p->min_expire_time_expr = unmarshal_u8(b);
p->multi_master_check = unmarshal_u8(b);
p->multi_primary_check = unmarshal_u8(b);
p->store_ixfr = unmarshal_u8(b);
p->store_ixfr_is_default = unmarshal_u8(b);
p->ixfr_size = unmarshal_u64(b);
Expand Down Expand Up @@ -2397,8 +2397,8 @@ config_apply_pattern(struct pattern_options *dest, const char* name)
copy_and_append_acls(&dest->provide_xfr, pat->provide_xfr);
copy_and_append_acls(&dest->allow_query, pat->allow_query);
copy_and_append_acls(&dest->outgoing_interface, pat->outgoing_interface);
if(pat->multi_master_check)
dest->multi_master_check = pat->multi_master_check;
if(pat->multi_primary_check)
dest->multi_primary_check = pat->multi_primary_check;

if(!pat->verify_zone_is_default) {
dest->verify_zone = pat->verify_zone;
Expand Down
2 changes: 1 addition & 1 deletion options.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ struct pattern_options {
*/
uint8_t min_expire_time_expr;
uint64_t size_limit_xfr;
uint8_t multi_master_check;
uint8_t multi_primary_check;
uint8_t store_ixfr;
uint8_t store_ixfr_is_default;
uint64_t ixfr_size;
Expand Down
2 changes: 1 addition & 1 deletion xfrd-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ xfrd_tcp_read(struct xfrd_tcp_pipeline* tp)
/* fall through to remove zone from tp */
/* fallthrough */
case xfrd_packet_transfer:
if(zone->zone_options->pattern->multi_master_check) {
if(zone->zone_options->pattern->multi_primary_check) {
xfrd_tcp_release(xfrd->tcp_set, zone);
xfrd_make_request(zone);
break;
Expand Down
8 changes: 4 additions & 4 deletions xfrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ xfrd_make_request(xfrd_zone_type* zone)
}

/* multi-master-check */
if(zone->zone_options->pattern->multi_master_check) {
if(zone->zone_options->pattern->multi_primary_check) {
if(zone->multi_master_first_master == zone->master_num &&
zone->round_num > 0 &&
zone->state != xfrd_zone_expired) {
Expand Down Expand Up @@ -1527,7 +1527,7 @@ xfrd_udp_read(xfrd_zone_type* zone)
xfrd_tcp_obtain(xfrd->tcp_set, zone);
break;
case xfrd_packet_transfer:
if(zone->zone_options->pattern->multi_master_check) {
if(zone->zone_options->pattern->multi_primary_check) {
xfrd_udp_release(zone);
xfrd_make_request(zone);
break;
Expand Down Expand Up @@ -2115,7 +2115,7 @@ xfrd_parse_received_xfr_packet(xfrd_zone_type* zone, buffer_type* packet,
xfrd_set_zone_state(zone, xfrd_zone_ok);
DEBUG(DEBUG_XFRD,1, (LOG_INFO, "xfrd: zone %s is ok",
zone->apex_str));
if(zone->zone_options->pattern->multi_master_check) {
if(zone->zone_options->pattern->multi_primary_check) {
region_destroy(tempregion);
return xfrd_packet_drop;
}
Expand Down Expand Up @@ -2384,7 +2384,7 @@ xfrd_handle_received_xfr_packet(xfrd_zone_type* zone, buffer_type* packet)
DEBUG(DEBUG_XFRD,1, (LOG_INFO,
"xfrd: zone %s is waiting for reload",
zone->apex_str));
if(zone->zone_options->pattern->multi_master_check) {
if(zone->zone_options->pattern->multi_primary_check) {
zone->multi_master_update_check = zone->master_num;
xfrd_set_reload_timeout();
return xfrd_packet_transfer;
Expand Down

0 comments on commit 1a8f202

Please sign in to comment.