Browse Source

[3295] Propagate Client FQDN within server's response message.

Marcin Siodelski 11 years ago
parent
commit
55196110a2
2 changed files with 19 additions and 18 deletions
  1. 9 9
      src/bin/dhcp6/dhcp6_srv.cc
  2. 10 9
      src/bin/dhcp6/dhcp6_srv.h

+ 9 - 9
src/bin/dhcp6/dhcp6_srv.cc

@@ -887,8 +887,7 @@ Dhcpv6Srv::selectSubnet(const Pkt6Ptr& question) {
 }
 }
 
 
 void
 void
-Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer,
-                        const Option6ClientFqdnPtr& fqdn) {
+Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer) {
 
 
     // We need to allocate addresses for all IA_NA options in the client's
     // We need to allocate addresses for all IA_NA options in the client's
     // question (i.e. SOLICIT or REQUEST) message.
     // question (i.e. SOLICIT or REQUEST) message.
@@ -941,10 +940,9 @@ Dhcpv6Srv::assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer,
          opt != question->options_.end(); ++opt) {
          opt != question->options_.end(); ++opt) {
         switch (opt->second->getType()) {
         switch (opt->second->getType()) {
         case D6O_IA_NA: {
         case D6O_IA_NA: {
-            OptionPtr answer_opt = assignIA_NA(subnet, duid, question,
+            OptionPtr answer_opt = assignIA_NA(subnet, duid, question, answer,
                                                boost::dynamic_pointer_cast<
                                                boost::dynamic_pointer_cast<
-                                               Option6IA>(opt->second),
-                                               fqdn);
+                                               Option6IA>(opt->second));
             if (answer_opt) {
             if (answer_opt) {
                 answer->addOption(answer_opt);
                 answer->addOption(answer_opt);
             }
             }
@@ -1232,8 +1230,8 @@ Dhcpv6Srv::sendNameChangeRequests() {
 
 
 OptionPtr
 OptionPtr
 Dhcpv6Srv::assignIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
 Dhcpv6Srv::assignIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
-                       const Pkt6Ptr& query, boost::shared_ptr<Option6IA> ia,
-                       const Option6ClientFqdnPtr& fqdn) {
+                       const Pkt6Ptr& query, const Pkt6Ptr& answer,
+                       boost::shared_ptr<Option6IA> ia) {
     // If there is no subnet selected for handling this IA_NA, the only thing to do left is
     // If there is no subnet selected for handling this IA_NA, the only thing to do left is
     // to say that we are sorry, but the user won't get an address. As a convenience, we
     // to say that we are sorry, but the user won't get an address. As a convenience, we
     // use a different status text to indicate that (compare to the same status code,
     // use a different status text to indicate that (compare to the same status code,
@@ -1287,6 +1285,8 @@ Dhcpv6Srv::assignIA_NA(const Subnet6Ptr& subnet, const DuidPtr& duid,
     // the update.
     // the update.
     bool do_fwd = false;
     bool do_fwd = false;
     bool do_rev = false;
     bool do_rev = false;
+    Option6ClientFqdnPtr fqdn = boost::dynamic_pointer_cast<
+        Option6ClientFqdn>(answer->getOption(D6O_CLIENT_FQDN));
     if (fqdn) {
     if (fqdn) {
         // Flag S must not coexist with flag N being set to 1, so if S=1
         // Flag S must not coexist with flag N being set to 1, so if S=1
         // server takes responsibility for both reverse and forward updates.
         // server takes responsibility for both reverse and forward updates.
@@ -2178,7 +2178,7 @@ Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) {
     appendRequestedVendorOptions(solicit, advertise);
     appendRequestedVendorOptions(solicit, advertise);
 
 
     Option6ClientFqdnPtr fqdn = processClientFqdn(solicit, advertise);
     Option6ClientFqdnPtr fqdn = processClientFqdn(solicit, advertise);
-    assignLeases(solicit, advertise, fqdn);
+    assignLeases(solicit, advertise);
     appendClientFqdn(solicit, advertise, fqdn);
     appendClientFqdn(solicit, advertise, fqdn);
     // Note, that we don't create NameChangeRequests here because we don't
     // Note, that we don't create NameChangeRequests here because we don't
     // perform DNS Updates for Solicit. Client must send Request to update
     // perform DNS Updates for Solicit. Client must send Request to update
@@ -2200,7 +2200,7 @@ Dhcpv6Srv::processRequest(const Pkt6Ptr& request) {
     appendRequestedVendorOptions(request, reply);
     appendRequestedVendorOptions(request, reply);
 
 
     Option6ClientFqdnPtr fqdn = processClientFqdn(request, reply);
     Option6ClientFqdnPtr fqdn = processClientFqdn(request, reply);
-    assignLeases(request, reply, fqdn);
+    assignLeases(request, reply);
     appendClientFqdn(request, reply, fqdn);
     appendClientFqdn(request, reply, fqdn);
     createNameChangeRequests(reply, fqdn);
     createNameChangeRequests(reply, fqdn);
 
 

+ 10 - 9
src/bin/dhcp6/dhcp6_srv.h

@@ -214,15 +214,17 @@ protected:
     /// @param subnet subnet the client is connected to
     /// @param subnet subnet the client is connected to
     /// @param duid client's duid
     /// @param duid client's duid
     /// @param query client's message (typically SOLICIT or REQUEST)
     /// @param query client's message (typically SOLICIT or REQUEST)
+    /// @param answer server's response to the client's message. This
+    /// message should contain Client FQDN option being sent by the server
+    /// to the client (if the client sent this option to the server).
     /// @param ia pointer to client's IA_NA option (client's request)
     /// @param ia pointer to client's IA_NA option (client's request)
-    /// @param fqdn A DHCPv6 Client FQDN %Option generated in a response to the
-    /// FQDN option sent by a client.
+    ///
     /// @return IA_NA option (server's response)
     /// @return IA_NA option (server's response)
     OptionPtr assignIA_NA(const isc::dhcp::Subnet6Ptr& subnet,
     OptionPtr assignIA_NA(const isc::dhcp::Subnet6Ptr& subnet,
                           const isc::dhcp::DuidPtr& duid,
                           const isc::dhcp::DuidPtr& duid,
                           const isc::dhcp::Pkt6Ptr& query,
                           const isc::dhcp::Pkt6Ptr& query,
-                          Option6IAPtr ia,
-                          const Option6ClientFqdnPtr& fqdn);
+                          const isc::dhcp::Pkt6Ptr& answer,
+                          Option6IAPtr ia);
 
 
     /// @brief Processes IA_PD option (and assigns prefixes if necessary).
     /// @brief Processes IA_PD option (and assigns prefixes if necessary).
     ///
     ///
@@ -352,11 +354,10 @@ protected:
     /// @todo: Extend this method once TA and PD becomes supported
     /// @todo: Extend this method once TA and PD becomes supported
     ///
     ///
     /// @param question client's message (with requested IA_NA)
     /// @param question client's message (with requested IA_NA)
-    /// @param answer server's message (IA_NA options will be added here)
-    /// @param fqdn an FQDN option generated in a response to the client's
-    /// FQDN option.
-    void assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer,
-                      const Option6ClientFqdnPtr& fqdn);
+    /// @param answer server's message (IA_NA options will be added here).
+    /// This message should contain Client FQDN option being sent by the server
+    /// to the client (if the client sent this option to the server).
+    void assignLeases(const Pkt6Ptr& question, Pkt6Ptr& answer);
 
 
     /// @brief Processes Client FQDN Option.
     /// @brief Processes Client FQDN Option.
     ///
     ///