Parcourir la source

[2949] Changes after review:

 - Dhcp6Client::oro_ is now private
 - Dhcp6Srv::copyDefaultOptions renamed to copyClientOptions
 - Comment in processInfRequest clarified
Tomek Mrugalski il y a 10 ans
Parent
commit
3739b530b9
3 fichiers modifiés avec 19 ajouts et 17 suppressions
  1. 12 11
      src/bin/dhcp6/dhcp6_srv.cc
  2. 2 1
      src/bin/dhcp6/dhcp6_srv.h
  3. 5 5
      src/bin/dhcp6/tests/dhcp6_client.h

+ 12 - 11
src/bin/dhcp6/dhcp6_srv.cc

@@ -701,7 +701,7 @@ Dhcpv6Srv::generateServerID() {
 }
 
 void
-Dhcpv6Srv::copyDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
+Dhcpv6Srv::copyClientOptions(const Pkt6Ptr& question, Pkt6Ptr& answer) {
     // Add client-id.
     OptionPtr clientid = question->getOption(D6O_CLIENTID);
     if (clientid) {
@@ -2286,7 +2286,7 @@ Dhcpv6Srv::processSolicit(const Pkt6Ptr& solicit) {
 
     Pkt6Ptr advertise(new Pkt6(DHCPV6_ADVERTISE, solicit->getTransid()));
 
-    copyDefaultOptions(solicit, advertise);
+    copyClientOptions(solicit, advertise);
     appendDefaultOptions(solicit, advertise);
     appendRequestedOptions(solicit, advertise);
     appendRequestedVendorOptions(solicit, advertise);
@@ -2309,7 +2309,7 @@ Dhcpv6Srv::processRequest(const Pkt6Ptr& request) {
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, request->getTransid()));
 
-    copyDefaultOptions(request, reply);
+    copyClientOptions(request, reply);
     appendDefaultOptions(request, reply);
     appendRequestedOptions(request, reply);
     appendRequestedVendorOptions(request, reply);
@@ -2329,7 +2329,7 @@ Dhcpv6Srv::processRenew(const Pkt6Ptr& renew) {
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, renew->getTransid()));
 
-    copyDefaultOptions(renew, reply);
+    copyClientOptions(renew, reply);
     appendDefaultOptions(renew, reply);
     appendRequestedOptions(renew, reply);
 
@@ -2346,7 +2346,7 @@ Dhcpv6Srv::processRebind(const Pkt6Ptr& rebind) {
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, rebind->getTransid()));
 
-    copyDefaultOptions(rebind, reply);
+    copyClientOptions(rebind, reply);
     appendDefaultOptions(rebind, reply);
     appendRequestedOptions(rebind, reply);
 
@@ -2370,7 +2370,7 @@ Dhcpv6Srv::processConfirm(const Pkt6Ptr& confirm) {
     // The server sends Reply message in response to Confirm.
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, confirm->getTransid()));
     // Make sure that the necessary options are included.
-    copyDefaultOptions(confirm, reply);
+    copyClientOptions(confirm, reply);
     appendDefaultOptions(confirm, reply);
     // Indicates if at least one address has been verified. If no addresses
     // are verified it means that the client has sent no IA_NA options
@@ -2444,7 +2444,7 @@ Dhcpv6Srv::processRelease(const Pkt6Ptr& release) {
 
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, release->getTransid()));
 
-    copyDefaultOptions(release, reply);
+    copyClientOptions(release, reply);
     appendDefaultOptions(release, reply);
 
     releaseLeases(release, reply);
@@ -2468,11 +2468,12 @@ Dhcpv6Srv::processInfRequest(const Pkt6Ptr& infRequest) {
     // Create a Reply packet, with the same trans-id as the client's.
     Pkt6Ptr reply(new Pkt6(DHCPV6_REPLY, infRequest->getTransid()));
 
-    // Copy default options (client-id, also relay information if present)
-    copyDefaultOptions(infRequest, reply);
+    // Copy client options (client-id, also relay information if present)
+    copyClientOptions(infRequest, reply);
 
-    // Append default options (server-id for now, but possibly other options
-    // once we start supporting authentication)
+    // Append default options, i.e. options that the server is supposed
+    // to put in all messages it sends (server-id for now, but possibly other
+    // options once we start supporting authentication)
     appendDefaultOptions(infRequest, reply);
 
     // Try to assign options that were requested by the client.

+ 2 - 1
src/bin/dhcp6/dhcp6_srv.h

@@ -394,10 +394,11 @@ protected:
     /// Copies options that must appear in any server response (ADVERTISE, REPLY)
     /// to client's messages (SOLICIT, REQUEST, RENEW, REBIND, DECLINE, RELEASE).
     /// One notable example is client-id. Other options may be copied as required.
+    /// Relay information details are also copied here.
     ///
     /// @param question client's message (options will be copied from here)
     /// @param answer server's message (options will be copied here)
-    void copyDefaultOptions(const Pkt6Ptr& question, Pkt6Ptr& answer);
+    void copyClientOptions(const Pkt6Ptr& question, Pkt6Ptr& answer);
 
     /// @brief Appends default options to server's answer.
     ///

+ 5 - 5
src/bin/dhcp6/tests/dhcp6_client.h

@@ -406,11 +406,6 @@ public:
         oro_.push_back(option_code);
     }
 
-    /// @brief List of options to be requested
-    ///
-    /// Content of this vector will be sent as ORO if use_oro_ is set
-    /// to true. See @ref sendORO for details.
-    std::vector<uint16_t> oro_;
 private:
 
     /// @brief Applies the new leases for the client.
@@ -516,6 +511,11 @@ private:
     /// @brief Pointer to the option holding a prefix hint.
     Option6IAPrefixPtr prefix_hint_;
 
+    /// @brief List of options to be requested
+    ///
+    /// Content of this vector will be sent as ORO if use_oro_ is set
+    /// to true. See @ref sendORO for details.
+    std::vector<uint16_t> oro_;
 };
 
 } // end of namespace isc::dhcp::test