]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3362] d2::NameRemoveTransaction now checks for NXRRSET
authorThomas Markwalder <tmark@isc.org>
Fri, 7 Mar 2014 16:35:26 +0000 (11:35 -0500)
committerThomas Markwalder <tmark@isc.org>
Fri, 7 Mar 2014 16:35:26 +0000 (11:35 -0500)
Changed NameRemoveTransaction to test for NXRRSET not NXDOMAIN.  Since
the remove prequisites are RRSet tests, if the RRSets do no exist the
DNS server will return NXRRSET. NameRemoveTransaction now correctly
checks for this and treats it as success.

src/bin/d2/nc_remove.cc
src/bin/d2/tests/nc_remove_unittests.cc

index 864b8d7a182588fa9a1a90b716a71137ea8fb1a3..3e0a17d4cf3165bbc46d0ebd05dd7a66a615ba00 100644 (file)
@@ -216,7 +216,7 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
             // We successfully received a response packet from the server.
             const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
             if ((rcode == dns::Rcode::NOERROR()) ||
-                (rcode == dns::Rcode::NXDOMAIN())) {
+                (rcode == dns::Rcode::NXRRSET())) {
                 // We were able to remove it or it wasn't there, now we
                 // need to remove any other RRs for this FQDN.
                 transition(REMOVING_FWD_RRS_ST, UPDATE_OK_EVT);
@@ -319,12 +319,11 @@ NameRemoveTransaction::removingFwdRRsHandler() {
         case DNSClient::SUCCESS: {
             // We successfully received a response packet from the server.
             const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
-            // @todo Not sure if NXDOMAIN is ok here, but I think so.
-            // A Rcode of NXDOMAIN would mean there are no RRs for the FQDN,
+            // A Rcode of NXRRSET means there are no RRs for the FQDN,
             // which is fine.  We were asked to delete them, they are not there
             // so all is well.
             if ((rcode == dns::Rcode::NOERROR()) ||
-                (rcode == dns::Rcode::NXDOMAIN())) {
+                (rcode == dns::Rcode::NXRRSET())) {
                 // We were able to remove the forward mapping. Mark it as done.
                 setForwardChangeCompleted(true);
 
@@ -473,9 +472,9 @@ NameRemoveTransaction::removingRevPtrsHandler() {
             // We successfully received a response packet from the server.
             const dns::Rcode& rcode = getDnsUpdateResponse()->getRcode();
             if ((rcode == dns::Rcode::NOERROR()) ||
-                (rcode == dns::Rcode::NXDOMAIN())) {
+                (rcode == dns::Rcode::NXRRSET())) {
                 // We were able to update the reverse mapping. Mark it as done.
-                // @todo For now we are also treating NXDOMAIN as success.
+                // We are also treating NXRRSET as success.
                 setReverseChangeCompleted(true);
                 transition(PROCESS_TRANS_OK_ST, UPDATE_OK_EVT);
             } else {
index 246fdd2645e83dceb8b671c662bb4cf095e9370d..6ca4ecf87e2a8b59bcbf5996a6d0f6a8830cb87f 100644 (file)
@@ -603,8 +603,8 @@ TEST_F(NameRemoveTransactionTest, removingFwdAddrsHandler_FqdnNotInUse) {
     // Run removingFwdAddrsHandler to construct and send the request.
     EXPECT_NO_THROW(name_remove->removingFwdAddrsHandler());
 
-    // Simulate receiving a FQDN not in use response.
-    name_remove->fakeResponse(DNSClient::SUCCESS, dns::Rcode::NXDOMAIN());
+    // Simulate receiving a RRSET does not exist.
+    name_remove->fakeResponse(DNSClient::SUCCESS, dns::Rcode::NXRRSET());
 
     // Run removingFwdAddrsHandler again to process the response.
     EXPECT_NO_THROW(name_remove->removingFwdAddrsHandler());
@@ -963,8 +963,8 @@ TEST_F(NameRemoveTransactionTest, removingFwdRRsHandler_FqdnNotInUse) {
     // Run removingFwdRRsHandler to construct and send the request.
     EXPECT_NO_THROW(name_remove->removingFwdRRsHandler());
 
-    // Simulate receiving a FQDN not in use response.
-    name_remove->fakeResponse(DNSClient::SUCCESS, dns::Rcode::NXDOMAIN());
+    // Simulate receiving a RRSET does not exist response.
+    name_remove->fakeResponse(DNSClient::SUCCESS, dns::Rcode::NXRRSET());
 
     // Run removingFwdRRsHandler again to process the response.
     EXPECT_NO_THROW(name_remove->removingFwdRRsHandler());
@@ -1340,8 +1340,8 @@ TEST_F(NameRemoveTransactionTest, removingRevPtrsHandler_FqdnNotInUse) {
     EXPECT_EQ(StateModel::NOP_EVT,
               name_remove->getNextEvent());
 
-    // Simulate receiving a FQDN not in use response.
-    name_remove->fakeResponse(DNSClient::SUCCESS, dns::Rcode::NXDOMAIN());
+    // Simulate receiving a RRSET does not exist.
+    name_remove->fakeResponse(DNSClient::SUCCESS, dns::Rcode::NXRRSET());
 
     // Run removingRevPtrsHandler again to process the response.
     EXPECT_NO_THROW(name_remove->removingRevPtrsHandler());