]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Support Net::DNS::Nameserver 1.42
authorMark Andrews <marka@isc.org>
Tue, 2 Jan 2024 04:39:58 +0000 (15:39 +1100)
committerMark Andrews <marka@isc.org>
Wed, 3 Jan 2024 01:01:14 +0000 (12:01 +1100)
In Net::DNS 1.42 $ns->main_loop no longer loops.  Use current methods
for starting the server, wait for SIGTERM then cleanup child processes
using $ns->stop_server(), then remove the pid file.

(cherry picked from commit c2c59dea60135ac2835c52e8d9ecaf76bffeb634)

bin/tests/system/chain/ans3/ans.pl
bin/tests/system/reclimit/ans7/ans.pl

index 271b2a44b21d428715bb628b16763db3afaeb3c6..e42240be63a99980b9fbb0eab4a9dc0d835f0bff 100644 (file)
@@ -22,9 +22,14 @@ my $pidf = new IO::File "ans.pid", "w" or die "cannot open pid file: $!";
 print $pidf "$$\n" or die "cannot write pid file: $!";
 $pidf->close or die "cannot close pid file: $!";
 sub rmpid { unlink "ans.pid"; exit 1; };
+sub term { };
 
 $SIG{INT} = \&rmpid;
-$SIG{TERM} = \&rmpid;
+if ($Net::DNS::VERSION > 1.41) {
+    $SIG{TERM} = \&term;
+} else {
+    $SIG{TERM} = \&rmpid;
+}
 
 my $localaddr = "10.53.0.3";
 
@@ -128,4 +133,11 @@ my $ns = Net::DNS::Nameserver->new(
     Verbose => $verbose,
 );
 
-$ns->main_loop;
+if ($Net::DNS::VERSION >= 1.42) {
+    $ns->start_server();
+    select(undef, undef, undef, undef);
+    $ns->stop_server();
+    unlink "ans.pid";
+} else {
+    $ns->main_loop;
+}
index 41a44a6b5e3b98f573b6b969fc2b007b864a3631..52110f1802aaa5ef60e66e9d59ce2c1f1f0f7259 100644 (file)
@@ -22,9 +22,14 @@ my $pidf = new IO::File "ans.pid", "w" or die "cannot open pid file: $!";
 print $pidf "$$\n" or die "cannot write pid file: $!";
 $pidf->close or die "cannot close pid file: $!";
 sub rmpid { unlink "ans.pid"; exit 1; };
+sub term { };
 
 $SIG{INT} = \&rmpid;
-$SIG{TERM} = \&rmpid;
+if ($Net::DNS::VERSION >= 1.42) {
+    $SIG{TERM} = \&term;
+} else {
+    $SIG{TERM} = \&rmpid;
+}
 
 my $count = 0;
 
@@ -73,4 +78,11 @@ my $ns = Net::DNS::Nameserver->new(
     Verbose => $verbose,
 );
 
-$ns->main_loop;
+if ($Net::DNS::VERSION >= 1.42) {
+    $ns->start_server();
+    select(undef, undef, undef, undef);
+    $ns->stop_server();
+    unlink "ans.pid";
+} else {
+    $ns->main_loop;
+}