]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4011. [bug] master's list port and dscp inheritance was not
authorMark Andrews <marka@isc.org>
Mon, 24 Nov 2014 00:25:06 +0000 (11:25 +1100)
committerMark Andrews <marka@isc.org>
Mon, 24 Nov 2014 00:25:06 +0000 (11:25 +1100)
                        properly implemented. [RT #37792]

CHANGES
bin/named/config.c
bin/tests/system/notify/clean.sh
bin/tests/system/notify/ns2/named.conf
bin/tests/system/notify/ns4/named.conf [new file with mode: 0644]
bin/tests/system/notify/ns4/named.port [new file with mode: 0644]
bin/tests/system/notify/setup.sh
bin/tests/system/notify/tests.sh
bin/tests/system/start.pl

diff --git a/CHANGES b/CHANGES
index 3da1632ea4cf55d95505555feb8e16b78000c993..dadb50602f07bae09249a996fc3a294865418bce 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4011.  [bug]           master's list port and dscp inheritance was not
+                       properly implemented. [RT #37792]
+                       
 4010.  [cleanup]       Clear the prefetchable state when initiating a prefetch.
                        [RT #37399]
 
index f23083013e1b3a80c5c45da1c46469f4a1da5877..6c7fe19fb52e2237f749ebe8f360772702cb4af5 100644 (file)
@@ -588,6 +588,17 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
        REQUIRE(keysp != NULL && *keysp == NULL);
        REQUIRE(countp != NULL);
 
+       /*
+        * Get system defaults.
+        */
+       result = ns_config_getport(config, &port);
+       if (result != ISC_R_SUCCESS)
+               goto cleanup;
+
+       result = ns_config_getdscp(config, &dscp);
+       if (result != ISC_R_SUCCESS)
+               goto cleanup;
+
  newlist:
        addrlist = cfg_tuple_get(list, "addresses");
        portobj = cfg_tuple_get(list, "port");
@@ -602,10 +613,6 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
                        goto cleanup;
                }
                port = (in_port_t) val;
-       } else {
-               result = ns_config_getport(config, &port);
-               if (result != ISC_R_SUCCESS)
-                       goto cleanup;
        }
 
        if (dscpobj != NULL && cfg_obj_isuint32(dscpobj)) {
@@ -616,10 +623,6 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
                        return (ISC_R_RANGE);
                }
                dscp = (isc_dscp_t)cfg_obj_asuint32(dscpobj);
-       } else {
-               result = ns_config_getdscp(config, &dscp);
-               if (result != ISC_R_SUCCESS)
-                       goto cleanup;
        }
 
        result = ISC_R_NOMEMORY;
index 7fadeefe571431762d69f81053dfba32a90da737..2f11059222fea7deb94218ec7635a967aae52e88 100644 (file)
 # Clean up after zone transfer tests.
 #
 
-rm -f ns3/example.bk dig.out.ns2.test* dig.out.ns3.test*
-rm -f ns2/example.db
-rm -f log.out
 rm -f */named.memstats
+rm -f dig.out.ns2.test*
+rm -f dig.out.ns3.test*
+rm -f dig.out.ns4.test*
+rm -f log.out
+rm -f ns2/example.db
+rm -f ns2/x21.db*
+rm -f ns3/example.bk
+rm -f ns4/x21.bk*
index 1fe1086c631fbe6bd91407100d9dcefc12cc7a85..fe00aa5d26ace77cd1dc769a323a7e4312e1ee86 100644 (file)
@@ -42,6 +42,10 @@ zone "example" {
        also-notify { /* empty */ };
 };
 
+masters noport { 10.53.0.4; };
+
+masters x21 port 5301 { noport; };
+
 zone x1 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
 zone x2 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
 zone x3 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
@@ -62,3 +66,4 @@ zone x17 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
 zone x18 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
 zone x19 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
 zone x20 { type master; file "generic.db"; also-notify { 10.53.0.3; }; };
+zone x21 { type master; file "x21.db"; allow-update { any; }; also-notify { x21; }; };
diff --git a/bin/tests/system/notify/ns4/named.conf b/bin/tests/system/notify/ns4/named.conf
new file mode 100644 (file)
index 0000000..e1084f2
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: named.conf,v 1.24 2007/06/18 23:47:29 tbox Exp $ */
+
+controls { /* empty */ };
+
+options {
+       query-source address 10.53.0.4;
+       notify-source 10.53.0.4;
+       transfer-source 10.53.0.4;
+       port 5301;
+       pid-file "named.pid";
+       listen-on { 10.53.0.4; };
+       listen-on-v6 { none; };
+       recursion yes;
+       acache-enable yes;
+       notify yes;
+};
+
+zone "." {
+       type hint;
+       file "../../common/root.hint";
+};
+
+zone "x21" {
+       type slave;
+       masters { 10.53.0.2 port 5300; };
+       file "x21.bk";
+};
diff --git a/bin/tests/system/notify/ns4/named.port b/bin/tests/system/notify/ns4/named.port
new file mode 100644 (file)
index 0000000..3cda32b
--- /dev/null
@@ -0,0 +1 @@
+5301
index e989e4bb05a95f614b85c9000b98b09c78136799..2e0b5e183089f8ee01410d4e78d08357e4404471 100644 (file)
@@ -18,3 +18,4 @@
 # $Id: setup.sh,v 1.10 2007/06/19 23:47:04 tbox Exp $
 
 cp -f ns2/example1.db ns2/example.db
+cp -f ns2/generic.db ns2/x21.db
index 1e2d7b8143e2f70334b3d36161df08f40b8f075c..a6eeafb4ec49ed9e09fcf7e77ee894bcaef11fe3 100644 (file)
@@ -150,5 +150,25 @@ $PERL ../digcomp.pl dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
 [ $ret = 0 ] || echo "I:failed"
 status=`expr $ret + $status`
 
+n=`expr $n + 1`
+echo "I:checking notify to alternate port with master inheritance"
+$NSUPDATE << EOF
+server 10.53.0.2 5300
+zone x21
+update add added.x21 0 in txt "test string"
+send
+EOF
+for i in 1 2 3 4 5 6 7 8 9
+do
+       $DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd added.x21.\
+               @10.53.0.4 txt -p 5301 > dig.out.ns4.test$n || ret=1
+       grep "test string" dig.out.ns4.test$n > /dev/null && break
+       sleep 1
+done
+grep "test string" dig.out.ns4.test$n > /dev/null || ret=1
+
+[ $ret = 0 ] || echo "I:failed"
+status=`expr $ret + $status`
+
 echo "I:exit status: $status"
 exit $status
index f5d2d352c1c81cbc60d5dfe59077c625535f5cfe..c4863c60d9ba44befa838dc87a318978f99b4234 100644 (file)
@@ -104,14 +104,28 @@ if ($server) {
 sub check_ports {
        my $server = shift;
        my $options = "";
+       my $port = 5300;
+       my $file = "";
+
+       $file = $testdir . "/" . $server . "/named.port" if ($server);
 
        if ($server && $server =~ /(\d+)$/) {
                $options = "-i $1";
        }
 
+       if ($file ne "" && -e $file) {
+               open(FH, "<", $file);
+               while(my $line=<FH>) {
+                       chomp $line;
+                       $port = $line;
+                       last;
+               }
+               close FH;
+       }
+
        my $tries = 0;
        while (1) {
-               my $return = system("$PERL $topdir/testsock.pl -p 5300 $options");
+               my $return = system("$PERL $topdir/testsock.pl -p $port $options");
                last if ($return == 0);
                if (++$tries > 4) {
                        print "$0: could not bind to server addresses, still running?\n";
@@ -258,11 +272,23 @@ sub start_server {
 sub verify_server {
        my $server = shift;
        my $n = $server;
+       my $port = 5300;
+
        $n =~ s/^ns//;
 
+       if (-e "$testdir/$server/named.port") {
+               open(FH, "<", "$testdir/$server/named.port");
+               while(my $line=<FH>) {
+                       chomp $line;
+                       $port = $line;
+                       last;
+               }
+               close FH;
+       }
+
        my $tries = 0;
        while (1) {
-               my $return = system("$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noedns -p 5300 version.bind. chaos txt \@10.53.0.$n > dig.out");
+               my $return = system("$DIG +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noedns -p $port version.bind. chaos txt \@10.53.0.$n > dig.out");
                last if ($return == 0);
                if (++$tries >= 30) {
                        print `grep ";" dig.out > /dev/null`;