Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
2136-Use-nsd-instead-of-bind8-9-to-test-against...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2136-Use-nsd-instead-of-bind8-9-to-test-against.patch of Package erlang
From 47b2be55500578ca04e6799e2d689ce6cf8c69bc Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Fri, 13 Nov 2020 16:48:02 +0100 Subject: [PATCH 6/6] Use nsd instead of bind8/9 to test against --- lib/kernel/test/inet_res_SUITE.erl | 153 +++++++++++------- .../otptest/named_inc.conf | 12 -- .../inet_res_SUITE_data/otptest/nsd_inc.conf | 11 ++ .../inet_res_SUITE_data/otptest/otptest.zone | 53 ++++++ .../inet_res_SUITE_data/otptest/root.zone | 52 ------ .../inet_res_SUITE_data/{run-named => run-ns} | 143 +++++++--------- 6 files changed, 215 insertions(+), 209 deletions(-) delete mode 100644 lib/kernel/test/inet_res_SUITE_data/otptest/named_inc.conf create mode 100644 lib/kernel/test/inet_res_SUITE_data/otptest/nsd_inc.conf create mode 100644 lib/kernel/test/inet_res_SUITE_data/otptest/otptest.zone delete mode 100644 lib/kernel/test/inet_res_SUITE_data/otptest/root.zone rename lib/kernel/test/inet_res_SUITE_data/{run-named => run-ns} (52%) diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl index 726c25b2fa..3279b2e5f9 100644 --- a/lib/kernel/test/inet_res_SUITE.erl +++ b/lib/kernel/test/inet_res_SUITE.erl @@ -40,9 +40,10 @@ host_and_addr/0, host_and_addr/1 ]). --define(RUN_NAMED, "run-named"). +-define(RUN_NS, "run-ns"). +-define(LOG_FILE, "ns.log"). -%% This test suite use a script ?RUN_NAMED that tries to start +%% This test suite use a script ?RUN_NS that tries to start %% a temporary local nameserver BIND 8 or 9 that must be installed %% on your machine. %% @@ -152,7 +153,7 @@ ns_init(ZoneDir, PrivDir, DataDir) -> PNum end, ?P("ns_init -> use port number ~p", [PortNum]), - RunNamed = filename:join(DataDir, ?RUN_NAMED), + RunNamed = filename:join(DataDir, ?RUN_NS), ?P("ns_init -> use named ~p", [RunNamed]), NS = {{127,0,0,1},PortNum}, ?P("ns_init -> try open port (exec)"), @@ -174,7 +175,7 @@ ns_start(ZoneDir, PrivDir, NS, P) -> "Error: "++Error -> ?P("ns_start -> error: " "~n ~p", [Error]), - ns_printlog(filename:join([PrivDir,ZoneDir,"named.log"])), + ns_printlog(filename:join([PrivDir,ZoneDir,?LOG_FILE])), throw(Error); _X -> ?P("ns_start -> retry"), @@ -207,7 +208,7 @@ ns_end(undefined, _PrivDir) -> undefined; ns_end({ZoneDir,_NS,P}, PrivDir) when is_port(P) -> port_command(P, ["quit",io_lib:nl()]), ns_stop(P), - ns_printlog(filename:join([PrivDir,ZoneDir,"named.log"])), + ns_printlog(filename:join([PrivDir,ZoneDir,"ns.log"])), ok; ns_end({Tag,_NS,P}, _PrivDir) when is_pid(P) -> Mref = erlang:monitor(process, P), @@ -447,7 +448,9 @@ resolve(Config) when is_list(Config) -> {cname,"cname."++Name,[{cname,Name}],undefined}, {a,"cname."++Name,[{cname,Name},{a,{127,0,0,28}}],undefined}, {ns,"ns."++Name,[],[{ns,Name}]}, - {soa,Domain,[],[{soa,{"ns.otptest","lsa.otptest",1,60,10,300,30}}]}, + {soa,Domain, + undefined, + [{soa,{"ns.otptest","lsa\\.soa.otptest",1,60,10,300,30}}]}, %% WKS: protocol TCP (6), services (bits) TELNET (23) and SMTP (25) {wks,"wks."++Name,[{wks,{{127,0,0,28},6,<<0,0,1,64>>}}],undefined}, {ptr,"28."++RDomain4,[{ptr,Name}],undefined}, @@ -462,10 +465,10 @@ resolve(Config) when is_list(Config) -> [{txt,["Hej ","du ","glade "]},{txt,["ta ","en ","spade!"]}], undefined}, {mb,"mb."++Name,[{mb,"mx."++Name}],undefined}, - {mg,"mg."++Name,[{mg,"Lsa."++Domain}],undefined}, - {mr,"mr."++Name,[{mr,"LSA."++Domain}],undefined}, + {mg,"mg."++Name,[{mg,"lsa\\.mg."++Domain}],undefined}, + {mr,"mr."++Name,[{mr,"lsa\\.mr."++Domain}],undefined}, {minfo,"minfo."++Name, - [{minfo,{"minfo-OWNER."++Name,"MinfoBounce."++Name}}], + [{minfo,{"minfo-owner."++Name,"minfo-bounce."++Name}}], undefined}, {uri,"uri."++Name,[{uri,{10,3,"http://erlang.org"}}],undefined}, {caa,"caa."++Name, @@ -473,9 +476,9 @@ resolve(Config) when is_list(Config) -> undefined}, {any,"cname."++Name,[{cname,Name}],undefined}, {any,Name, - [{a,{127,0,0,28}}, - {aaaa,{0,0,0,0,0,0,32512,28}}, - {hinfo,{"BEAM","Erlang/OTP"}}], + #{ {a,{127,0,0,28}} => [], + {aaaa,{0,0,0,0,0,0,32512,28}} => [], + {hinfo,{"BEAM","Erlang/OTP"}} => [] }, undefined} ], ?P("resolve -> with edns 0"), @@ -495,82 +498,107 @@ resolve(Class, Opts, [{Type,Nm,Answers,Authority}=Q|Qs]) -> _ -> {caseflip(Nm),Nm} end, - AnList = - if - Answers =/= undefined -> - normalize_answers(Answers); - true -> - undefined - end, - NsList = - if - Authority =/= undefined -> - normalize_answers(Authority); - true -> - undefined - end, + NormAnswers = normalize_rrs(Answers), + NormNSs = normalize_rrs(Authority), ?P("resolve -> resolve with ~p", [Name]), {ok,Msg} = inet_res:resolve(Name, Class, Type, Opts), - check_msg(Class, Type, Msg, AnList, NsList), + check_msg(Class, Type, Msg, NormAnswers, NormNSs), ?P("resolve -> resolve with ~p", [NameC]), {ok,MsgC} = inet_res:resolve(NameC, Class, Type, Opts), - check_msg(Class, Type, MsgC, AnList, NsList), + check_msg(Class, Type, MsgC, NormAnswers, NormNSs), ?P("resolve -> next"), resolve(Class, Opts, Qs). -normalize_answers(AnList) -> - lists:sort([normalize_answer(Answer) || Answer <- AnList]). +normalize_rrs(undefined = RRs) -> RRs; +normalize_rrs(RRList) when is_list(RRList) -> + lists:sort([normalize_rr(RR) || RR <- RRList]); +normalize_rrs(RRs) when is_map(RRs) -> + maps:fold( + fun (RR, V, NormRRs) -> + NormRRs#{(normalize_rr(RR)) => V} + end, #{}, RRs). -normalize_answer({soa,{NS,HM,Ser,Ref,Ret,Exp,Min}}) -> +normalize_rr({soa,{NS,HM,Ser,Ref,Ret,Exp,Min}}) -> {tolower(NS),tolower_email(HM),Ser,Ref,Ret,Exp,Min}; -normalize_answer({mx,{Prio,DN}}) -> +normalize_rr({mx,{Prio,DN}}) -> {Prio,tolower(DN)}; -normalize_answer({srv,{Prio,Weight,Port,DN}}) -> +normalize_rr({srv,{Prio,Weight,Port,DN}}) -> {Prio,Weight,Port,tolower(DN)}; -normalize_answer({naptr,{Order,Pref,Flags,Service,RE,Repl}}) -> +normalize_rr({naptr,{Order,Pref,Flags,Service,RE,Repl}}) -> {Order,Pref,Flags,Service,RE,tolower(Repl)}; -normalize_answer({minfo,{RespM,ErrM}}) -> +normalize_rr({minfo,{RespM,ErrM}}) -> {tolower_email(RespM),tolower_email(ErrM)}; -normalize_answer({T,MN}) when T =:= mg; T =:= mr -> +normalize_rr({T,MN}) when T =:= mg; T =:= mr -> tolower_email(MN); -normalize_answer({T,DN}) when T =:= cname; T =:= ns; T =:= ptr; T =:= mb -> +normalize_rr({T,DN}) when T =:= cname; T =:= ns; T =:= ptr; T =:= mb -> tolower(DN); -normalize_answer(Answer) -> - Answer. +normalize_rr(RR) -> + RR. -check_msg(Class, Type, Msg, AnList, NsList) -> +check_msg(Class, Type, Msg, ExpectedAnswers, ExpectedNSs) -> ?P("check_msg ->" "~n Type: ~p" "~n Msg: ~p", [Type,Msg]), - case {normalize_answers( - [begin - Class = inet_dns:rr(RR, class), - {inet_dns:rr(RR, type),inet_dns:rr(RR, data)} - end || RR <- inet_dns:msg(Msg, anlist)]), - normalize_answers( - [begin - Class = inet_dns:rr(RR, class), - {inet_dns:rr(RR, type),inet_dns:rr(RR, data)} - end || RR <- inet_dns:msg(Msg, nslist)])} of - {AnList,NsList} -> - ok; - {NsList,AnList} when Type =:= ns -> - %% This whole case statement is kind of inside out just - %% to accept this case when some legacy DNS resolvers - %% return the answer to a NS query in the answer section - %% instead of in the authority section. - ok; - {AnList,_} when NsList =:= undefined -> - ok; - {_,NsList} when AnList =:= undefined -> - ok + NormAnList = + normalize_rrs( + [begin + Class = inet_dns:rr(RR, class), + {inet_dns:rr(RR, type),inet_dns:rr(RR, data)} + end || RR <- inet_dns:msg(Msg, anlist)]), + NormNsList = + normalize_rrs( + [begin + Class = inet_dns:rr(RR, class), + {inet_dns:rr(RR, type),inet_dns:rr(RR, data)} + end || RR <- inet_dns:msg(Msg, nslist)]), + case + check_msg(ExpectedAnswers, NormAnList) andalso + check_msg(ExpectedNSs, NormNsList) + of + true -> + ok; + false + when Type =:= ns; + Type =:= soa -> + %% Some resolvers return the answer to a NS query + %% in the answer section instead of in the authority section, + %% and some do the same for a SOA query + case + check_msg(ExpectedAnswers, NormNsList) andalso + check_msg(ExpectedNSs, NormAnList) + of + true -> + ok; + false -> + error({Type, + {expected,ExpectedAnswers,ExpectedNSs}, + {got,NormAnList,NormNsList}}) + end; + false -> + error({Type, + {expected,ExpectedAnswers,ExpectedNSs}, + {got,NormAnList,NormNsList}}) end, + %% Test the encoder against the decoder; the least we can do Buf = inet_dns:encode(Msg), {ok,Msg} = inet_dns:decode(Buf), ok. +check_msg(undefined, RRs) when is_list(RRs)-> true; +check_msg(RRs1, RRs2) when is_list(RRs1), is_list(RRs2) -> + RRs1 =:= RRs2; +check_msg(Expected, [RR|RRs]) when is_map(Expected) -> + case Expected of + #{RR := _} -> + case RRs of + [] -> true; + [_|_] -> check_msg(Expected, RRs) + end; + #{} -> false + end; +check_msg(#{}, []) -> false. % At least one has to be ok %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/kernel/test/inet_res_SUITE_data/otptest/named_inc.conf b/lib/kernel/test/inet_res_SUITE_data/otptest/named_inc.conf deleted file mode 100644 index 2d68f6e59c..0000000000 --- a/lib/kernel/test/inet_res_SUITE_data/otptest/named_inc.conf +++ /dev/null @@ -1,12 +0,0 @@ -zone "." in { - type master; - file "root.zone"; -}; -zone "0.0.127.in-addr.arpa." in { - type master; - file "0.0.127.in-addr.arpa.zone"; -}; -zone "0.0.0.0.f.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa." in { - type master; - file "0.0.0.0.f.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.zone"; -}; diff --git a/lib/kernel/test/inet_res_SUITE_data/otptest/nsd_inc.conf b/lib/kernel/test/inet_res_SUITE_data/otptest/nsd_inc.conf new file mode 100644 index 0000000000..d4a434ff77 --- /dev/null +++ b/lib/kernel/test/inet_res_SUITE_data/otptest/nsd_inc.conf @@ -0,0 +1,11 @@ +zone: + name: otptest. + zonefile: otptest.zone + +zone: + name: 0.0.127.in-addr.arpa. + zonefile: 0.0.127.in-addr.arpa.zone + +zone: + name: 0.0.0.0.f.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa. + zonefile: 0.0.0.0.f.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.zone diff --git a/lib/kernel/test/inet_res_SUITE_data/otptest/otptest.zone b/lib/kernel/test/inet_res_SUITE_data/otptest/otptest.zone new file mode 100644 index 0000000000..51268f49ae --- /dev/null +++ b/lib/kernel/test/inet_res_SUITE_data/otptest/otptest.zone @@ -0,0 +1,53 @@ +$TTL 3600 +@ IN SOA ns lsa\.soa ( + 1 ; serial + 60 ; refresh + 10 ; retry + 300 ; expiry + 30 ) ; minimum + + IN NS ns + IN NS ns1-5678901234567890123456789012345678 + IN NS ns2-5678901234567890123456789012345678 + IN MX 10 mx + IN MX 20 mx1-5678901234567890123456789012345678 + IN MX 20 mx2-5678901234567890123456789012345678 + IN MX 20 mx3-5678901234567890123456789012345678 + IN MX 20 mx4-5678901234567890123456789012345678 + IN MX 20 mx5-5678901234567890123456789012345678 + IN MX 20 mx6-5678901234567890123456789012345678 + IN MX 20 mx7-5678901234567890123456789012345678 + +test1-78901234567890123456789012345678 IN A 127.0.0.1 +test2-78901234567890123456789012345678 IN A 127.0.0.2 +ns1-5678901234567890123456789012345678 IN A 127.0.0.11 +ns2-5678901234567890123456789012345678 IN A 127.0.0.12 +mx IN A 127.0.0.10 +mx1-5678901234567890123456789012345678 IN A 127.0.0.21 +mx2-5678901234567890123456789012345678 IN A 127.0.0.22 +mx3-5678901234567890123456789012345678 IN A 127.0.0.23 +mx4-5678901234567890123456789012345678 IN A 127.0.0.24 +mx5-5678901234567890123456789012345678 IN A 127.0.0.25 +mx6-5678901234567890123456789012345678 IN A 127.0.0.26 +mx7-5678901234567890123456789012345678 IN A 127.0.0.27 + +ns IN A 127.0.0.254 +resolve IN A 127.0.0.28 +resolve IN AAAA ::127.0.0.28 +cname.resolve IN CNAME resolve +wks.resolve IN WKS 127.0.0.28 TCP ( telnet smtp ) +resolve IN HINFO "BEAM" "Erlang/OTP" +ns.resolve IN NS resolve +mx.resolve IN MX 10 resolve +_srv._tcp.resolve IN SRV 10 3 4711 resolve +naptr.resolve IN NAPTR 10 5 "S" "HTTP" "" _srv._tcp.resolve +txt.resolve IN TXT "Hej " "du " "glade " +txt.resolve IN TXT "ta " "en " "spade!" +mb.resolve IN MB mx.resolve +mg.resolve IN MG lsa\.mg +mr.resolve IN MR lsa\.mr +minfo.resolve IN MINFO minfo-owner.resolve minfo-bounce.resolve +;uri.resolve IN URI 10 3 "http://erlang.org" +uri.resolve IN TYPE256 \# 21 000a 0003 (68747470 3a2f2f 65726c616e67 2e 6f7267) +;caa.resolve IN CAA 1 iodef "http://iodef.erlang.org" +caa.resolve IN TYPE257 \# 30 01 (05 696f646566) (68747470 3a2f2f 696f646566 2e 65726c616e67 2e 6f7267) diff --git a/lib/kernel/test/inet_res_SUITE_data/otptest/root.zone b/lib/kernel/test/inet_res_SUITE_data/otptest/root.zone deleted file mode 100644 index 804b062ead..0000000000 --- a/lib/kernel/test/inet_res_SUITE_data/otptest/root.zone +++ /dev/null @@ -1,52 +0,0 @@ -$TTL 3600 -@ IN SOA ns.otptest lsa.otptest ( - 1 ; serial - 60 ; refresh - 10 ; retry - 300 ; expiry - 30 ) ; minimum - - IN NS ns.otptest - IN NS ns1-5678901234567890123456789012345678.otptest - IN NS ns2-5678901234567890123456789012345678.otptest -otptest IN MX 10 mx.otptest -otptest IN MX 20 mx1-5678901234567890123456789012345678.otptest -otptest IN MX 20 mx2-5678901234567890123456789012345678.otptest -otptest IN MX 20 mx3-5678901234567890123456789012345678.otptest -otptest IN MX 20 mx4-5678901234567890123456789012345678.otptest -otptest IN MX 20 mx5-5678901234567890123456789012345678.otptest -otptest IN MX 20 mx6-5678901234567890123456789012345678.otptest -otptest IN MX 20 mx7-5678901234567890123456789012345678.otptest - -test1-78901234567890123456789012345678.otptest IN A 127.0.0.1 -test2-78901234567890123456789012345678.otptest IN A 127.0.0.2 -ns1-5678901234567890123456789012345678.otptest IN A 127.0.0.11 -ns2-5678901234567890123456789012345678.otptest IN A 127.0.0.12 -mx.otptest IN A 127.0.0.10 -mx1-5678901234567890123456789012345678.otptest IN A 127.0.0.21 -mx2-5678901234567890123456789012345678.otptest IN A 127.0.0.22 -mx3-5678901234567890123456789012345678.otptest IN A 127.0.0.23 -mx4-5678901234567890123456789012345678.otptest IN A 127.0.0.24 -mx5-5678901234567890123456789012345678.otptest IN A 127.0.0.25 -mx6-5678901234567890123456789012345678.otptest IN A 127.0.0.26 -mx7-5678901234567890123456789012345678.otptest IN A 127.0.0.27 - -resolve.otptest IN A 127.0.0.28 -resolve.otptest IN AAAA ::127.0.0.28 -cname.resolve.otptest IN CNAME resolve.otptest -wks.resolve.otptest IN WKS 127.0.0.28 TCP ( telnet smtp ) -resolve.otptest IN HINFO "BEAM" "Erlang/OTP" -ns.resolve.otptest IN NS resolve.otptest -mx.resolve.otptest IN MX 10 resolve.otptest -_srv._tcp.resolve.otptest IN SRV 10 3 4711 resolve.otptest -naptr.resolve.otptest IN NAPTR 10 5 "S" "HTTP" "" _srv._tcp.resolve.otptest -txt.resolve.otptest IN TXT "Hej " "du " "glade " -txt.resolve.otptest IN TXT "ta " "en " "spade!" -mb.resolve.otptest IN MB mx.resolve.otptest -mg.resolve.otptest IN MG Lsa.otptest -mr.resolve.otptest IN MR LSA.otptest -minfo.resolve.otptest IN MINFO minfo-OWNER.resolve.otptest MinfoBounce.resolve.otptest -uri.resolve.otptest IN URI 10 3 "http://erlang.org" -caa.resolve.otptest IN CAA 1 iodef "http://iodef.erlang.org" - -ns.otptest IN A 127.0.0.254 diff --git a/lib/kernel/test/inet_res_SUITE_data/run-named b/lib/kernel/test/inet_res_SUITE_data/run-ns similarity index 52% rename from lib/kernel/test/inet_res_SUITE_data/run-named rename to lib/kernel/test/inet_res_SUITE_data/run-ns index d67295773a..36855216f8 100755 --- a/lib/kernel/test/inet_res_SUITE_data/run-named +++ b/lib/kernel/test/inet_res_SUITE_data/run-ns @@ -1,9 +1,9 @@ #! /bin/sh ## ## %CopyrightBegin% -## -## Copyright Ericsson AB 2009-2016. All Rights Reserved. -## +## +## Copyright Ericsson AB 2009-2020. All Rights Reserved. +## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at @@ -15,20 +15,25 @@ ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. -## +## ## %CopyrightEnd% ## # # -## run-named -## +## run-ns +## ## $0 IPAddress PortNum SubDir ## -## * Create a work directory ./SubDir, create a named.conf there. -## * Locate named and check its version. -## * Zopy zone files from `dirname $0`/SubDir to ./SubDir. -## * Start named in ./SubDir with logging to named.log there. +## Helper script to run a very local name server for this test suite, +## on a given port number, with a configuration +## customized for the test suite. +## +## * Create a work directory ./SubDir, create a $CONF_FILE there +## that includes $INC_FILE that refers to the zone files. +## * Locate name server and check its version. +## * Zopy zone files and $INC_FILE from `dirname $0`/SubDir to ./SubDir. +## * Start name server in ./SubDir with logging to $LOG_FILE there. ## * Wait for "quit" on stdin. ## * Terminate named and wait for it. ## @@ -44,10 +49,10 @@ PATH=/usr/sbin:/sbin:/usr/bin:/bin SHELL=/bin/sh export PATH SHELL -CONF_FILE=named.conf -INC_FILE=named_inc.conf -PID_FILE=named.pid -LOG_FILE=named.log +LOG_FILE=ns.log + +CONF_FILE=nsd.conf +INC_FILE=nsd_inc.conf error () { r=$? @@ -75,76 +80,48 @@ test -f "$SRCDIR/$INC_FILE" || \ # Locate named and check version. # The bind-named name is used for tricking Apparmor and such # by copying/hardlinking the real named to that name. -NAMED=named -for n in /usr/local/bin/bind-named /usr/local/bin/named \ - /usr/sbin/bind-named /usr/sbin/named /usr/sbin/in.named +NS=named +for n in /usr/sbin/nsd /usr/bin/nsd /usr/local/sbin/nsd /usr/local/bin/nsd do - test -x "$n" && NAMED="$n" && break + test -x "$n" && NS="$n" && break done -NAMED_VER="`"$NAMED" -v 2>&1`" || \ +NS_VER="`"$NS" -v 2>&1`" || \ error "Name server not found!" -NAMED_VER=`echo "$NAMED_VER" | ( read V1 V2 V3 IGNORED && \ - if test :"$V1" = :'in.named'; then - echo "$V2 $V3" - else - echo "$V1 $V2" - fi -)` -case :"$NAMED_VER" in - :'BIND '8.*) NAMED_FG='-f';; - :'BIND '9.*) NAMED_FG='-g';; - :*) error "Name server version is unknown: $NAMED_VER";; -esac +NS_VER=$(echo "$NS_VER" | + ( read V1 V2 V3 IGNORED && + echo "$V1 $V3" ) ) +NS_FG="-d" # Create working directory and cd to it mkdir "$3" >/dev/null 2>&1 cd "$3" >/dev/null 2>&1 || \ error "Can not cd: $3 !" +DIR="$(pwd)" # Create $CONF_FILE -cat >"$CONF_FILE" <<-CONF_FILE - # - # $CONF_FILE for $NAMED_VER - # Generated by $0. - # - # Copyright: see $0. - # - logging { - category default { - default_stderr; - }; - }; - CONF_FILE -case :"$NAMED_VER" in - :'BIND '8.*|:'BIND '9.[012]|:'BIND '9.[012].*) - cat >>"$CONF_FILE" <<-CONF_FILE - controls { - inet 127.0.0.1 port 0 allow { !0/32; }; - }; - options { - pid-file "$PID_FILE"; - listen-on port $2 { $1; }; - recursion no; - allow-query { $1; }; - }; - CONF_FILE - ;; - :*) - cat >>"$CONF_FILE" <<-CONF_FILE - controls { - }; - options { - pid-file none; - listen-on port $2 { $1; }; - recursion no; - allow-query { $1; }; - }; - CONF_FILE - ;; -esac -cat >>"$CONF_FILE" <<-CONF_FILE - include "$INC_FILE"; - CONF_FILE +cat >"$CONF_FILE" <<CONF_FILE +# +# $CONF_FILE for $NS_VER +# Generated by $0. +# +# Copyright: see $0. +# +server: + zonesdir: "$DIR" + port: $2 + database: "" + zonelistfile: "zone.list" + pidfile: "nsd.pid" + xfrdfile: "" + xfrdir: "$DIR" + username: "$LOGNAME" + verbosity: 2 + +remote-control: + control-enable: no + +include: "$DIR/$INC_FILE" +CONF_FILE # Copy all subdir files ( cd "$SRCDIR" && ls -1 ) | while read f; do @@ -153,24 +130,24 @@ done # Start nameserver echo "Cwd: `pwd`" -echo "Nameserver: $NAMED_VER" +echo "Nameserver: $NS_VER" echo "Port: $2" echo "ZoneDir: $3" -echo "Command: $NAMED $NAMED_FG -c $CONF_FILE" -$NAMED $NAMED_FG -c "$CONF_FILE" >"$LOG_FILE" 2>&1 </dev/null & -NAMED_PID=$! -echo "Pid: $NAMED_PID" -trap "kill $NAMED_PID >/dev/null 2>&1; wait $NAMED_PID >/dev/null 2>&1" \ +echo "Command: $NS $NS_FG -c $CONF_FILE" -t "$3" +$NS $NS_FG -c "$CONF_FILE" >"$LOG_FILE" 2>&1 </dev/null & +NS_PID=$! +echo "Pid: $NS_PID" +trap "kill $NS_PID >/dev/null 2>&1; wait $NS_PID >/dev/null 2>&1" \ 0 1 2 3 15 sleep 5 # Give name server time to load its zone files -if ps -p $NAMED_PID >/dev/null 2>&1 || ps p $NAMED_PID >/dev/null 2>&1; then - echo "Running: Enter \`\`quit'' to terminate nameserver[$NAMED_PID]..." +if ps -p $NS_PID >/dev/null 2>&1 || ps p $NS_PID >/dev/null 2>&1; then + echo "Running: Enter \`\`quit'' to terminate nameserver[$NS_PID]..." while read LINE; do test :"$LINE" = :'quit' && break done echo "Closing: Terminating nameserver..." else - error "$NAMED failed to start" + error "$NS failed to start" fi -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor