diff --git a/docs/backends/bind.rst b/docs/backends/bind.rst index 7b3da21e39ab..19d7021606f2 100644 --- a/docs/backends/bind.rst +++ b/docs/backends/bind.rst @@ -53,8 +53,11 @@ It supports the following blocks and directives: * ``file`` * ``type`` * ``masters`` + * ``primaries`` (added in version 4.9.0) * ``also-notify`` +Unknown directives will be ignored. + .. _setting-bind-check-interval: ``bind-check-interval`` diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index 1a0b01a57886..c90ae0124509 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -935,7 +935,7 @@ void Bind2Backend::loadConfig(string* status) if (domain.type.empty()) { g_log << Logger::Notice << d_logprefix << " Zone '" << domain.name << "' has no type specified, assuming 'native'" << endl; } - if (domain.type != "master" && domain.type != "slave" && domain.type != "native" && !domain.type.empty()) { + if (domain.type != "primary" && domain.type != "secondary" && domain.type != "native" && !domain.type.empty() && domain.type != "master" && domain.type != "slave") { g_log << Logger::Warning << d_logprefix << " Warning! Skipping zone '" << domain.name << "' because type '" << domain.type << "' is invalid" << endl; rejected++; continue; @@ -961,9 +961,9 @@ void Bind2Backend::loadConfig(string* status) bbd.d_also_notify = domain.alsoNotify; DomainInfo::DomainKind kind = DomainInfo::Native; - if (domain.type == "master") + if (domain.type == "primary" || domain.type == "master") kind = DomainInfo::Master; - if (domain.type == "slave") + if (domain.type == "secondary" || domain.type == "slave") kind = DomainInfo::Slave; bool kindChanged = (bbd.d_kind != kind); @@ -1431,9 +1431,9 @@ bool Bind2Backend::createSlaveDomain(const string& ip, const DNSName& domain, co c_of << endl; c_of << "# Superslave zone '" << domain.toString() << "' (added: " << nowTime() << ") (account: " << account << ')' << endl; c_of << "zone \"" << domain.toStringNoDot() << "\" {" << endl; - c_of << "\ttype slave;" << endl; + c_of << "\ttype secondary;" << endl; c_of << "\tfile \"" << filename << "\";" << endl; - c_of << "\tmasters { " << ip << "; };" << endl; + c_of << "\tprimaries { " << ip << "; };" << endl; c_of << "};" << endl; c_of.close(); } diff --git a/pdns/bindlexer.l b/pdns/bindlexer.l index 65dfc4da02ca..481e3b9f9345 100644 --- a/pdns/bindlexer.l +++ b/pdns/bindlexer.l @@ -114,7 +114,8 @@ also-notify return ALSONOTIFYTOK; acl return ACLTOK; logging return LOGGINGTOK; directory return DIRECTORYTOK; -masters return MASTERTOK; +masters return PRIMARYTOK; +primaries return PRIMARYTOK; type return TYPETOK; \" yy_push_state(quoted); [^\"]* yylval=strdup(yytext); return QUOTEDWORD; diff --git a/pdns/bindparser.yy b/pdns/bindparser.yy index 0b1056f2db6e..9f6ba81fe61b 100644 --- a/pdns/bindparser.yy +++ b/pdns/bindparser.yy @@ -108,7 +108,7 @@ void BindParser::commit(BindDomainInfo DI) %} %token AWORD QUOTEDWORD OBRACE EBRACE SEMICOLON ZONETOK FILETOK OPTIONSTOK -%token DIRECTORYTOK ACLTOK LOGGINGTOK CLASSTOK TYPETOK MASTERTOK ALSONOTIFYTOK +%token DIRECTORYTOK ACLTOK LOGGINGTOK CLASSTOK TYPETOK PRIMARYTOK ALSONOTIFYTOK %% @@ -230,10 +230,10 @@ zone_command: command | global_zone_command | zone_also_notify_command ; /* zone commands that also are available at global scope */ -global_zone_command: zone_file_command | zone_type_command | zone_masters_command +global_zone_command: zone_file_command | zone_type_command | zone_primaries_command ; -zone_masters_command: MASTERTOK OBRACE masters EBRACE +zone_primaries_command: PRIMARYTOK OBRACE primaries EBRACE ; zone_also_notify_command: ALSONOTIFYTOK OBRACE zone_also_notify_list EBRACE @@ -251,12 +251,12 @@ zone_also_notify: AWORD } ; -masters: /* empty */ +primaries: /* empty */ | - masters master SEMICOLON + primaries primary SEMICOLON ; -master: AWORD +primary: AWORD { s_di.masters.push_back(ComboAddress($1, 53)); free($1); diff --git a/pdns/named.conf.parsertest b/pdns/named.conf.parsertest index 4d38d223f7ec..b8b0e3599358 100644 --- a/pdns/named.conf.parsertest +++ b/pdns/named.conf.parsertest @@ -30,41 +30,42 @@ zone "test.dyndns" { }; zone "wtest.com"{ - type master; + type primary; file "wtest.com"; }; zone "nztest.com"{ - type master; + type secondary; file "nztest.com"; + primaries { 1.2.3.4:5678; }; }; zone "dnssec-parent.com"{ - type master; + type primary; file "dnssec-parent.com"; }; zone "delegated.dnssec-parent.com"{ - type master; + type primary; file "delegated.dnssec-parent.com"; }; zone "secure-delegated.dnssec-parent.com"{ - type master; + type primary; file "secure-delegated.dnssec-parent.com"; }; zone "minimal.com"{ - type master; + type primary; file "minimal.com"; }; zone "tsig.com"{ - type master; + type primary; file "tsig.com"; }; zone "stest.com"{ - type master; + type primary; file "stest.com"; }; diff --git a/pdns/test-bindparser_cc.cc b/pdns/test-bindparser_cc.cc index cd8fda27183c..bff31f21fc51 100644 --- a/pdns/test-bindparser_cc.cc +++ b/pdns/test-bindparser_cc.cc @@ -48,14 +48,15 @@ BOOST_AUTO_TEST_CASE(test_parser) checkzone(1, "test.com", "./zones/test.com", slave, 1U); BOOST_CHECK_EQUAL(domains[1].masters[0].toString(), ComboAddress("1.2.3.4", 5678).toString()); checkzone(2, "test.dyndns", "./zones/test.dyndns", garblewarble, 0U); - checkzone(3, "wtest.com", "./zones/wtest.com", master, 0U); - checkzone(4, "nztest.com", "./zones/nztest.com", master, 0U); - checkzone(5, "dnssec-parent.com", "./zones/dnssec-parent.com", master, 0U); - checkzone(6, "delegated.dnssec-parent.com", "./zones/delegated.dnssec-parent.com", master, 0U); - checkzone(7, "secure-delegated.dnssec-parent.com", "./zones/secure-delegated.dnssec-parent.com", master, 0U); - checkzone(8, "minimal.com", "./zones/minimal.com", master, 0U); - checkzone(9, "tsig.com", "./zones/tsig.com", master, 0U); - checkzone(10, "stest.com", "./zones/stest.com", master, 0U); + checkzone(3, "wtest.com", "./zones/wtest.com", primary, 0U); + checkzone(4, "nztest.com", "./zones/nztest.com", secondary, 1U); + BOOST_CHECK_EQUAL(domains[1].masters[0].toString(), ComboAddress("1.2.3.4", 5678).toString()); + checkzone(5, "dnssec-parent.com", "./zones/dnssec-parent.com", primary, 0U); + checkzone(6, "delegated.dnssec-parent.com", "./zones/delegated.dnssec-parent.com", primary, 0U); + checkzone(7, "secure-delegated.dnssec-parent.com", "./zones/secure-delegated.dnssec-parent.com", primary, 0U); + checkzone(8, "minimal.com", "./zones/minimal.com", primary, 0U); + checkzone(9, "tsig.com", "./zones/tsig.com", primary, 0U); + checkzone(10, "stest.com", "./zones/stest.com", primary, 0U); } BOOST_AUTO_TEST_SUITE_END() diff --git a/pdns/zone2json.cc b/pdns/zone2json.cc index 9ef9fadb1896..51e76fa03b42 100644 --- a/pdns/zone2json.cc +++ b/pdns/zone2json.cc @@ -162,10 +162,10 @@ try i!=domains.end(); ++i) { - if(i->type!="master" && i->type!="slave") { - cerr<<" Warning! Skipping '"<type<<"' zone '"<name<<"'"<type != "primary" && i->type != "secondary" && !i->type.empty() && i->type != "master" && i->type != "slave") { + cerr << " Warning! Skipping '" << i->type << "' zone '" << i->name << "'" << endl; + continue; + } lines.clear(); try { Json::object obj; diff --git a/pdns/zone2ldap.cc b/pdns/zone2ldap.cc index f0c905977824..5752350e0df4 100644 --- a/pdns/zone2ldap.cc +++ b/pdns/zone2ldap.cc @@ -306,10 +306,10 @@ int main( int argc, char* argv[] ) for(const auto& i: domains) { - if(i.type!="master" && i.type!="slave") { - cerr<<" Warning! Skipping '"<> ./named.conf << __EOF__ zone "."{ - type master; + type primary; file "../../regression-tests.rootzone/zones/ROOT"; }; __EOF__ diff --git a/regression-tests.nobackend/soa-edit/named.conf b/regression-tests.nobackend/soa-edit/named.conf index e94fe49cf821..15e634623d7c 100644 --- a/regression-tests.nobackend/soa-edit/named.conf +++ b/regression-tests.nobackend/soa-edit/named.conf @@ -9,6 +9,6 @@ options { }; zone "minimal.com"{ - type master; + type primary; file "./minimal.com"; }; diff --git a/regression-tests.nobackend/supermaster-signed/command b/regression-tests.nobackend/supermaster-signed/command index 30be471ef1f3..9829dbc8cf99 100755 --- a/regression-tests.nobackend/supermaster-signed/command +++ b/regression-tests.nobackend/supermaster-signed/command @@ -35,12 +35,12 @@ options { minimal-responses yes; }; zone "example.com"{ - type master; + type primary; file "example.com"; }; zone "test.com"{ - type master; + type primary; file "test.com"; }; EOF diff --git a/regression-tests.nobackend/supermaster-unsigned/command b/regression-tests.nobackend/supermaster-unsigned/command index 22935a93f6f0..53b6881c07b0 100755 --- a/regression-tests.nobackend/supermaster-unsigned/command +++ b/regression-tests.nobackend/supermaster-unsigned/command @@ -30,12 +30,12 @@ options { minimal-responses yes; }; zone "example.com"{ - type master; + type primary; file "example.com"; }; zone "test.com"{ - type master; + type primary; file "test.com"; }; EOF diff --git a/regression-tests.recursor-dnssec/recursortests.py b/regression-tests.recursor-dnssec/recursortests.py index c19426965e0b..93e68cc210dd 100644 --- a/regression-tests.recursor-dnssec/recursortests.py +++ b/regression-tests.recursor-dnssec/recursortests.py @@ -474,7 +474,7 @@ def generateAuthNamedConf(cls, confdir, zones): namedconf.write(""" zone "%s" { - type master; + type primary; file "%s.zone"; };""" % (zone, zonename)) diff --git a/regression-tests.recursor/config.sh b/regression-tests.recursor/config.sh index 480f1dd9ffa8..0e40c321542e 100755 --- a/regression-tests.recursor/config.sh +++ b/regression-tests.recursor/config.sh @@ -541,7 +541,7 @@ EOF fi cat >> $dir/named.conf < named-slave.conf + perl -pe 's/type primary;/type secondary;\n\tprimaries { 127.0.0.1:'$port'; };/ ;s/file "([^"]+)/file "$1-slave/' < named.conf > named-slave.conf for zone in $(grep 'zone ' named.conf | cut -f2 -d\") do diff --git a/regression-tests/ext/bind-master b/regression-tests/ext/bind-master index bd2fa1068f29..01b677c418f9 100644 --- a/regression-tests/ext/bind-master +++ b/regression-tests/ext/bind-master @@ -75,7 +75,7 @@ __EOF__ echo "" >> bind.conf echo "zone \"${zone}\" {" >> bind.conf - echo " type master;" >> bind.conf + echo " type primary;" >> bind.conf if [ "${zone}" = "tsig.com" ] then echo " allow-transfer { key test; none; };" >> bind.conf diff --git a/regression-tests/ext/bind-slave b/regression-tests/ext/bind-slave index f0afa2198100..20e7693d8bbc 100644 --- a/regression-tests/ext/bind-slave +++ b/regression-tests/ext/bind-slave @@ -21,7 +21,7 @@ __EOF__ echo "" >> bind-slave.conf echo "zone \"${zone}\" {" >> bind-slave.conf - echo " type slave;" >> bind-slave.conf + echo " type secondary;" >> bind-slave.conf echo " file \"${zone}-slave\";" >> bind-slave.conf if [ "${zone}" = "tsig.com" ] then diff --git a/regression-tests/named.conf b/regression-tests/named.conf index c1105a0891c1..f1ba7d0b5af0 100644 --- a/regression-tests/named.conf +++ b/regression-tests/named.conf @@ -8,17 +8,17 @@ options { minimal-responses yes; }; zone "example.com"{ - type master; + type primary; file "example.com"; }; zone "test.com"{ - type master; + type primary; file "test.com"; }; zone "test.dyndns" { - type master; + type primary; file "test.dyndns"; allow-update { 127.0.0.0/8; @@ -26,7 +26,7 @@ zone "test.dyndns" { }; zone "sub.test.dyndns" { - type master; + type primary; file "sub.test.dyndns"; allow-update { 127.0.0.0/8; @@ -34,67 +34,67 @@ zone "sub.test.dyndns" { }; zone "wtest.com"{ - type master; + type primary; file "wtest.com"; }; zone "nztest.com"{ - type master; + type primary; file "nztest.com"; }; zone "dnssec-parent.com"{ - type master; + type primary; file "dnssec-parent.com"; }; zone "insecure.dnssec-parent.com"{ - type master; + type primary; file "insecure.dnssec-parent.com"; }; zone "delegated.dnssec-parent.com"{ - type master; + type primary; file "delegated.dnssec-parent.com"; }; zone "secure-delegated.dnssec-parent.com"{ - type master; + type primary; file "secure-delegated.dnssec-parent.com"; }; zone "minimal.com"{ - type master; + type primary; file "minimal.com"; }; zone "tsig.com"{ - type master; + type primary; file "tsig.com"; }; zone "stest.com"{ - type master; + type primary; file "stest.com"; }; zone "cdnskey-cds-test.com"{ - type master; + type primary; file "cdnskey-cds-test.com"; }; zone "2.0.192.in-addr.arpa"{ - type master; + type primary; file "2.0.192.in-addr.arpa"; }; zone "cryptokeys.org"{ - type master; + type primary; file "cryptokeys.org"; }; zone "hiddencryptokeys.org"{ - type master; + type primary; file "hiddencryptokeys.org"; };