Browse Source

[master] Merge branch 'master' of ssh://git.bind10.isc.org/var/bind10/git/bind10
commit.

JINMEI Tatuya 12 years ago
parent
commit
b4b8c1e539
3 changed files with 58 additions and 36 deletions
  1. 21 2
      ChangeLog
  2. 10 12
      src/bin/dhcp6/dhcp6_messages.mes
  3. 27 22
      src/bin/dhcp6/dhcp6_srv.cc

+ 21 - 2
ChangeLog

@@ -1,11 +1,30 @@
-574.    [func]		tmark
+577.	[func]		muks
+	Added an SQLite3 index on records(rname, rdtype). This decreases
+	insert performance by ~28% and adds about ~20% to the file size,
+	but increases zone iteration performance. As it introduces a new
+	index, a database upgrade would be required.
+	(Trac #1756, git 9b3c959af13111af1fa248c5010aa33ee7e307ee)
+
+576.	[bug]		tmark, tomek
+	b10-dhcp6: Fixed bug when the server aborts operation when
+	receiving renew and there are no IPv6 subnets configured.
+	(Trac 2719, git 3132b8b19495470bbfd0f2ba0fe7da443926034b)
+
+575.	[bug]		marcin
+	b10-dhcp6: Fixed the bug whereby the subnet for the incoming
+	packet was selected using only its source address. The subnet
+	is now selected using either source address or the name of the
+	server's interface on which the packet has been received.
+	(Trac #2704, git 1cbacf19a28bdae50bb9bd3767bca0147fde37ed)
+
+574.	[func]		tmark
 	b10-dhcp4, b10-dhcp6: Composite key indexes were added to the lease
 	b10-dhcp4, b10-dhcp6: Composite key indexes were added to the lease
 	tables to reduce lease search time. The lease4 table now has two
 	tables to reduce lease search time. The lease4 table now has two
 	additional indexes: a) hwaddr/subnet_id and b) client_id/subnet_id.
 	additional indexes: a) hwaddr/subnet_id and b) client_id/subnet_id.
 	The lease6 now has the one additional index: iaid/subnet_id/duid.
 	The lease6 now has the one additional index: iaid/subnet_id/duid.
 	Adding these indexes significantly improves lease acquisition
 	Adding these indexes significantly improves lease acquisition
 	performance.
 	performance.
-	(Trac #2699,#2703, git 54bbed5fcbe237c5a49b515ae4c55148723406ce)}}}
+	(Trac #2699,#2703, git 54bbed5fcbe237c5a49b515ae4c55148723406ce)
 
 
 573.	[bug]		stephen
 573.	[bug]		stephen
 	Fixed problem whereby the DHCP server crashed if it ran out of
 	Fixed problem whereby the DHCP server crashed if it ran out of

+ 10 - 12
src/bin/dhcp6/dhcp6_messages.mes

@@ -137,18 +137,6 @@ IPv6 DHCP server but it is not running.
 During startup the IPv6 DHCP server failed to detect any network
 During startup the IPv6 DHCP server failed to detect any network
 interfaces and is therefore shutting down.
 interfaces and is therefore shutting down.
 
 
-% DHCP6_NO_SUBNET_DEF_OPT failed to find subnet for address %1 when adding default options
-This warning message indicates that when attempting to add default options
-to a response, the server found that it was not configured to support
-the subnet from which the DHCPv6 request was received.  The packet has
-been ignored.
-
-% DHCP6_NO_SUBNET_REQ_OPT failed to find subnet for address %1 when adding requested options
-This warning message indicates that when attempting to add requested
-options to a response, the server found that it was not configured
-to support the subnet from which the DHCPv6 request was received.
-The packet has been ignored.
-
 % DHCP6_OPEN_SOCKET opening sockets on port %1
 % DHCP6_OPEN_SOCKET opening sockets on port %1
 A debug message issued during startup, this indicates that the IPv6 DHCP
 A debug message issued during startup, this indicates that the IPv6 DHCP
 server is about to open sockets on the specified port.
 server is about to open sockets on the specified port.
@@ -222,6 +210,16 @@ as a hint for possible requested address.
 % DHCP6_QUERY_DATA received packet length %1, data length %2, data is %3
 % DHCP6_QUERY_DATA received packet length %1, data length %2, data is %3
 A debug message listing the data received from the client or relay.
 A debug message listing the data received from the client or relay.
 
 
+% DHCP6_RENEW_UNKNOWN_SUBNET RENEW message received from client on unknown subnet (duid=%1, iaid=%2)
+A warning message indicating that a client is attempting to renew his lease,
+but the server does not have any information about the subnet this client belongs
+to. This may mean that faulty the mobile client changed its location and is trying to
+renew its old address (client is supposed to send confirm, not rewew in such cases,
+according to RFC3315) or the server configuration has changed and information about
+existing subnet was removed. Note that in a sense this is worse case of DHCP6_UNKNOWN_RENEW,
+as not only the lease is unknown, but also the subnet is. Depending on the reasons
+of this condition, it may or may not correct on its own.
+
 % DHCP6_REQUIRED_OPTIONS_CHECK_FAIL %1 message received from %2 failed the following check: %3
 % DHCP6_REQUIRED_OPTIONS_CHECK_FAIL %1 message received from %2 failed the following check: %3
 This message indicates that received DHCPv6 packet is invalid.  This may be due
 This message indicates that received DHCPv6 packet is invalid.  This may be due
 to a number of reasons, e.g. the mandatory client-id option is missing,
 to a number of reasons, e.g. the mandatory client-id option is missing,

+ 27 - 22
src/bin/dhcp6/dhcp6_srv.cc

@@ -408,29 +408,21 @@ Dhcpv6Srv::copyDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
 }
 }
 
 
 void
 void
-Dhcpv6Srv::appendDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
+Dhcpv6Srv::appendDefaultOptions(const Pkt6Ptr&, Pkt6Ptr& answer) {
     // add server-id
     // add server-id
     answer->addOption(getServerID());
     answer->addOption(getServerID());
-
-    // Get the subnet object. It holds options to be sent to the client
-    // that belongs to the particular subnet.
-    Subnet6Ptr subnet = CfgMgr::instance().getSubnet6(question->getRemoteAddr());
-    // Warn if subnet is not supported and quit.
-    if (!subnet) {
-        LOG_WARN(dhcp6_logger, DHCP6_NO_SUBNET_DEF_OPT)
-            .arg(question->getRemoteAddr().toText());
-        return;
-    }
-
 }
 }
 
 
 void
 void
 Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
 Dhcpv6Srv::appendRequestedOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
-    // Get the subnet for a particular address.
+    // Get the configured subnet suitable for the incoming packet.
-    Subnet6Ptr subnet = CfgMgr::instance().getSubnet6(question->getRemoteAddr());
+    Subnet6Ptr subnet = selectSubnet(question);
+    // Leave if there is no subnet matching the incoming packet.
+    // There is no need to log the error message here because
+    // it will be logged in the assignLease() when it fails to
+    // pick the suitable subnet. We don't want to duplicate
+    // error messages in such case.
     if (!subnet) {
     if (!subnet) {
-        LOG_WARN(dhcp6_logger, DHCP6_NO_SUBNET_REQ_OPT)
-            .arg(question->getRemoteAddr().toText());
         return;
         return;
     }
     }
 
 
@@ -564,9 +556,7 @@ Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer) {
         // thing this client can get is some global information (like DNS
         // thing this client can get is some global information (like DNS
         // servers).
         // servers).
 
 
-        // perhaps this should be logged on some higher level? This is most likely
+        LOG_WARN(dhcp6_logger, DHCP6_SUBNET_SELECTION_FAILED)
-        // configuration bug.
-        LOG_ERROR(dhcp6_logger, DHCP6_SUBNET_SELECTION_FAILED)
             .arg(question->getRemoteAddr().toText())
             .arg(question->getRemoteAddr().toText())
             .arg(question->getName());
             .arg(question->getName());
 
 
@@ -714,6 +704,21 @@ Dhcpv6Srv::assignIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
 OptionPtr
 OptionPtr
 Dhcpv6Srv::renewIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
 Dhcpv6Srv::renewIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
                       Pkt6Ptr /* question */, boost::shared_ptr<Option6IA> ia) {
                       Pkt6Ptr /* question */, boost::shared_ptr<Option6IA> ia) {
+    if (!subnet) {
+        // There's no subnet select for this client. There's nothing to renew.
+        boost::shared_ptr<Option6IA> ia_rsp(new Option6IA(D6O_IA_NA, ia->getIAID()));
+
+        // Insert status code NoAddrsAvail.
+        ia_rsp->addOption(createStatusCode(STATUS_NoBinding,
+                          "Sorry, no known leases for this duid/iaid."));
+
+        LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL, DHCP6_RENEW_UNKNOWN_SUBNET)
+            .arg(duid->toText())
+            .arg(ia->getIAID());
+
+        return (ia_rsp);
+    }
+
     Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(*duid, ia->getIAID(),
     Lease6Ptr lease = LeaseMgrFactory::instance().getLease6(*duid, ia->getIAID(),
                                                             subnet->getID());
                                                             subnet->getID());
 
 
@@ -775,9 +780,9 @@ Dhcpv6Srv::renewLeases(const Pkt6Ptr& renew, Pkt6Ptr& reply) {
         // thing this client can get is some global information (like DNS
         // thing this client can get is some global information (like DNS
         // servers).
         // servers).
 
 
-        // perhaps this should be logged on some higher level? This is most likely
+        LOG_WARN(dhcp6_logger, DHCP6_SUBNET_SELECTION_FAILED)
-        // configuration bug.
+            .arg(renew->getRemoteAddr().toText())
-        LOG_ERROR(dhcp6_logger, DHCP6_SUBNET_SELECTION_FAILED);
+            .arg(renew->getName());
     } else {
     } else {
         LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL_DATA, DHCP6_SUBNET_SELECTED)
         LOG_DEBUG(dhcp6_logger, DBG_DHCP6_DETAIL_DATA, DHCP6_SUBNET_SELECTED)
             .arg(subnet->toText());
             .arg(subnet->toText());