BIND 10 trac2892, updated. 3a21271bd5b69fd828de3dd3691cc3628c54ae45 [2892] copyright date changed

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 16 11:58:41 UTC 2014


The branch, trac2892 has been updated
       via  3a21271bd5b69fd828de3dd3691cc3628c54ae45 (commit)
       via  e0f5b885fc17cd10f6c5bc83f3bd81e500b5e039 (commit)
       via  ffdb4e63350c3e15a8a2193c178df11825912c77 (commit)
       via  ca04edb6565ec41f7549bef921c8fc2b4b78119f (commit)
       via  ffbbf037b83bef4ed8da16396f65caedd6df6379 (commit)
      from  dbf249256db006eef0111cff5dec4e644706ce54 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3a21271bd5b69fd828de3dd3691cc3628c54ae45
Author: Wlodek Wencel <wlodek at isc.org>
Date:   Thu Jan 16 12:56:37 2014 +0100

    [2892] copyright date changed

commit e0f5b885fc17cd10f6c5bc83f3bd81e500b5e039
Author: Wlodek Wencel <wlodek at isc.org>
Date:   Thu Jan 16 12:55:21 2014 +0100

    [2892] changed message name and content

commit ffdb4e63350c3e15a8a2193c178df11825912c77
Author: Wlodek Wencel <wlodek at isc.org>
Date:   Thu Jan 16 12:53:48 2014 +0100

    [2892] removed Pkt6::getOptions from testServerID function, changed comments and @todo section

commit ca04edb6565ec41f7549bef921c8fc2b4b78119f
Author: Wlodek Wencel <wlodek at isc.org>
Date:   Thu Jan 16 12:49:44 2014 +0100

    [2892] changed return param in testServerID function description

commit ffbbf037b83bef4ed8da16396f65caedd6df6379
Author: Wlodek Wencel <wlodek at isc.org>
Date:   Thu Jan 16 12:48:10 2014 +0100

    [2892] added comments to testServerID unitest

-----------------------------------------------------------------------

Summary of changes:
 src/bin/dhcp6/dhcp6_messages.mes          |    6 +++---
 src/bin/dhcp6/dhcp6_srv.cc                |   30 ++++++++++++++++-------------
 src/bin/dhcp6/dhcp6_srv.h                 |    3 ++-
 src/bin/dhcp6/tests/dhcp6_srv_unittest.cc |   26 ++++++++++++++-----------
 src/lib/dhcpsrv/utils.h                   |    2 +-
 5 files changed, 38 insertions(+), 29 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes
index ca50210..8e97faa 100644
--- a/src/bin/dhcp6/dhcp6_messages.mes
+++ b/src/bin/dhcp6/dhcp6_messages.mes
@@ -264,9 +264,9 @@ of packet.  Note that a packet marked as UNKNOWN may well be a valid
 DHCP packet, just a type not expected by the server (e.g. it will report
 a received OFFER packet as UNKNOWN).
 
-% DHCP6_PACKET_RECEIVED_MISMATCH_SERVERID %1 packet received, with transaction id %2 on interface %3 containing mismatch ServerID
-A debug message noting that server has received message with ServerID
-option that not matching ServerID that server is using.
+% DHCP6_PACKET_MISMATCH_SERVERID_DROP dropping packet %1 (transid=%2, interface=%3) having mismatched server identifier
+A debug message noting that server has received message with server identifier
+option that not matching server identifier that server is using.
 
 % DHCP6_PACKET_RECEIVE_FAIL error on attempt to receive packet: %1
 The IPv6 DHCP server tried to receive a packet but an error
diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc
index 6d82d2e..0d0daf9 100644
--- a/src/bin/dhcp6/dhcp6_srv.cc
+++ b/src/bin/dhcp6/dhcp6_srv.cc
@@ -207,25 +207,29 @@ void Dhcpv6Srv::sendPacket(const Pkt6Ptr& packet) {
 
 bool
 Dhcpv6Srv::testServerID(const Pkt6Ptr& pkt){
-	OptionCollection server_ids = pkt->getOptions(D6O_SERVERID);
-	// if we find serverid option, lets test it.
-	/// @todo: In case we get message that has ServerID option forbidden
-	/// by the RFC, we will drop this loging DHCP6_PACKET_RECEIVED_MISMATCH_SERVERID
-	/// not RFCViolation. Some things should be double checked here and in sanityCheck
-	if (server_ids.size() == 1){
+	/// @todo Currently we always check server identifier regardless if
+	/// it is allowed in the received message or not (per RFC3315).
+	/// If the server identifier is not allowed in the message, the
+	/// sanityCheck function should deal with it. We may rethink this
+	/// design if we decide that it is appropriate to check at this stage
+	/// of message processing that the server identifier must or must not
+	/// be present. In such case however, the logic checking server id
+	/// will have to be removed from sanityCheck and placed here instead,
+	/// to avoid duplicate checks.
+	OptionPtr server_id = pkt->getOption(D6O_SERVERID);
+	if (server_id){
 		// Let us test received ServerID if it is same as ServerID
 		// which is beeing used by server
-		OptionPtr server_id = pkt->getOption(D6O_SERVERID);
 		if (getServerID()->getData() != server_id->getData()){
-			LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL_DATA, DHCP6_PACKET_RECEIVED_MISMATCH_SERVERID)
+			LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL_DATA, DHCP6_PACKET_MISMATCH_SERVERID_DROP)
 				.arg(pkt->getName())
 				.arg(pkt->getTransid())
 				.arg(pkt->getIface());
-			return false;
+			return (false);
 		}
 	}
-	// retunr True if: no serverid received or ServerIDs matching
-	return true;
+	// retun True if: no serverid received or ServerIDs matching
+	return (true);
 }
 
 bool Dhcpv6Srv::run() {
@@ -300,8 +304,8 @@ bool Dhcpv6Srv::run() {
                 continue;
             }
         }
-        // Check received query if it carry ServerID that matches ServerID
-        // that beeing used by the server.
+        // Check if received query carries server identifier matching
+        // server identifier being used by the server.
         if (!testServerID(query)){
         	continue;
         }
diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h
index 1ef6d0d..a943dae 100644
--- a/src/bin/dhcp6/dhcp6_srv.h
+++ b/src/bin/dhcp6/dhcp6_srv.h
@@ -125,7 +125,8 @@ protected:
     /// server identifier being used by the server.
     ///
     /// @param pkt DHCPv6 packet carrying server identifier to be checked.
-    /// @return True or False
+    /// @return true if server id carried in the query matches server id
+    /// used by the server; false otherwise.
     bool testServerID(const Pkt6Ptr& pkt);
 
     /// @brief verifies if specified packet meets RFC requirements
diff --git a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
index 6ef78ab..d037b24 100644
--- a/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
+++ b/src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
@@ -1073,34 +1073,38 @@ TEST_F(Dhcpv6SrvTest, sanityCheck) {
     EXPECT_THROW(srv.sanityCheck(pkt, Dhcpv6Srv::MANDATORY, Dhcpv6Srv::MANDATORY),
                  RFCViolation);
 }
-// Check that server is testing if received ServerID is equal to one beenig used by server
-TEST_F(Dhcpv6SrvTest, testServerID){
+// Check that the server is testing if server identifier received in the
+// query, matches server identifier used by the server.
+TEST_F(Dhcpv6SrvTest, testServerID) {
 	NakedDhcpv6Srv srv(0);
 
 	Pkt6Ptr req = Pkt6Ptr(new Pkt6(DHCPV6_REQUEST, 1234));
-
-    // server-id is MANDATORY in REQUEST
-    // but add there something else
     std::vector<uint8_t> bin;
 
-    //diud_llt with time = 0, macaddress = 00:00:00:00:00:00
+    // diud_llt constructed with: time = 0, macaddress = 00:00:00:00:00:00
+    // it's necessary to generate server identifier option
     isc::util::encode::decodeHex("0001000100000000000000000000", bin);
-    // Now create server-id option
+    // Now create server identifier option
     OptionPtr serverid = OptionPtr(new Option(Option::V6, D6O_SERVERID, bin));
 
+    // Server identifier option is MANDATORY in Request message.
+    // Add server identifier option with different value from one that
+    // server is using.
     req->addOption(serverid);
 
-    //Shoud be dropped
+    // Message shoud be dropped
     EXPECT_FALSE(srv.testServerID(req));
 
+    // Delete server identifier option and add new one, with same value as
+    // server's server identifier.
     req->delOption(D6O_SERVERID);
     req->addOption(srv.getServerID());
 
-    //with proper ServerID we expect true
+    // With proper server identifier we expect true
     EXPECT_TRUE(srv.testServerID(req));
 
-    // server-id is FORBIDDEN in SOLICIT, so check if server is not
-    // dropping corect message
+    // server-id MUST NOT appear in Solicit, so check if server is
+    // not dropping a message without server id.
     Pkt6Ptr pkt = Pkt6Ptr(new Pkt6(DHCPV6_SOLICIT, 1234));
 
     EXPECT_TRUE(srv.testServerID(req));
diff --git a/src/lib/dhcpsrv/utils.h b/src/lib/dhcpsrv/utils.h
index c01aa87..26d98ce 100644
--- a/src/lib/dhcpsrv/utils.h
+++ b/src/lib/dhcpsrv/utils.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above



More information about the bind10-changes mailing list