From 1a8f202c15981444ea46b3e7bfe4e9a37094cddc Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 7 Dec 2023 12:39:45 +0100 Subject: [PATCH] - Fix #308: Deprecate "multi-master-check" in favour of --- configlexer.lex | 3 ++- configparser.y | 6 +++--- doc/ChangeLog | 2 ++ doc/RELNOTES | 2 ++ nsd-checkconf.c | 8 ++++---- nsd.conf.5.in | 5 ++++- nsd.conf.sample.in | 6 +++--- options.c | 14 +++++++------- options.h | 2 +- xfrd-tcp.c | 2 +- xfrd.c | 8 ++++---- 11 files changed, 33 insertions(+), 25 deletions(-) diff --git a/configlexer.lex b/configlexer.lex index 9aed0228f..1525e7971 100644 --- a/configlexer.lex +++ b/configlexer.lex @@ -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;} diff --git a/configparser.y b/configparser.y index 5cf8dd546..fe63a5e36 100644 --- a/configparser.y +++ b/configparser.y @@ -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 @@ -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 diff --git a/doc/ChangeLog b/doc/ChangeLog index 7f27c5a73..8e62a6a84 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -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. diff --git a/doc/RELNOTES b/doc/RELNOTES index d0c6d0c25..b494a305d 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -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 ================ diff --git a/nsd-checkconf.c b/nsd-checkconf.c index 15c96cbf0..02a2c99ed 100644 --- a/nsd-checkconf.c +++ b/nsd-checkconf.c @@ -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); @@ -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); @@ -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); diff --git a/nsd.conf.5.in b/nsd.conf.5.in index 864c564c2..54d0a80ea 100644 --- a/nsd.conf.5.in +++ b/nsd.conf.5.in @@ -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 +.B multi\-primary\-check:\fR 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 +It is the same as multi\-primary\-check. +.TP .B verify\-zone:\fR Enable or disable verification for this zone. Default is value\-zones configured in diff --git a/nsd.conf.sample.in b/nsd.conf.sample.in index 1ffeacd7b..b3d4c9005 100644 --- a/nsd.conf.sample.in +++ b/nsd.conf.sample.in @@ -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. diff --git a/options.c b/options.c index e662ad147..5d1194132 100644 --- a/options.c +++ b/options.c @@ -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; @@ -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; @@ -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; @@ -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); @@ -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); @@ -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; diff --git a/options.h b/options.h index baf2579f5..8c93a69c6 100644 --- a/options.h +++ b/options.h @@ -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; diff --git a/xfrd-tcp.c b/xfrd-tcp.c index 5b1d80bb5..776828ee1 100644 --- a/xfrd-tcp.c +++ b/xfrd-tcp.c @@ -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; diff --git a/xfrd.c b/xfrd.c index 9882e3d5b..f16688477 100644 --- a/xfrd.c +++ b/xfrd.c @@ -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) { @@ -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; @@ -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; } @@ -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;