Parcourir la source

[4254] perfdhcp -f parameter can be specified for DHCPv4 case.

Marcin Siodelski il y a 9 ans
Parent
commit
9328124027

+ 4 - 6
src/bin/perfdhcp/command_options.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -691,8 +691,6 @@ CommandOptions::validate() const {
           "-B is not compatible with IPv6 (-6)");
     check((getIpVersion() != 6) && (isRapidCommit() != 0),
           "-6 (IPv6) must be set to use -c");
-    check((getIpVersion() != 6) && (getRenewRate() !=0),
-          "-f<renew-rate> may be used with -6 (IPv6) only");
     check((getIpVersion() != 6) && (getReleaseRate() != 0),
           "-F<release-rate> may be used with -6 (IPv6) only");
     check((getExchangeMode() == DO_SA) && (getNumRequests().size() > 1),
@@ -1010,9 +1008,9 @@ CommandOptions::usage() const {
         "\n"
         "DHCPv6 only options:\n"
         "-c: Add a rapid commit option (exchanges will be SA).\n"
-        "-f<renew-rate>: Rate at which IPv6 Renew requests are sent to\n"
-        "    a server. This value is only valid when used in conjunction with\n"
-        "    the exchange rate (given by -r<rate>).  Furthermore the sum of\n"
+        "-f<renew-rate>: Rate at which DHCPv4 or DHCPv6 renew requests are sent\n"
+        "    to a server. This value is only valid when used in conjunction\n"
+        "    with the exchange rate (given by -r<rate>).  Furthermore the sum of\n"
         "    this value and the release-rate (given by -F<rate) must be equal\n"
         "    to or less than the exchange rate.\n"
         "-F<release-rate>: Rate at which IPv6 Release requests are sent to\n"

+ 4 - 5
src/bin/perfdhcp/tests/command_options_unittest.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -341,6 +341,9 @@ TEST_F(CommandOptionsTest, RenewRate) {
     // that order doesn't matter.
     EXPECT_NO_THROW(process("perfdhcp -6 -f 5 -r 10 -l ethx all"));
     EXPECT_EQ(5, opt.getRenewRate());
+    // Renew rate should also be accepted for DHCPv4 case.
+    EXPECT_NO_THROW(process("perfdhcp -4 -f 5 -r 10 -l ethx all"));
+    EXPECT_EQ(5, opt.getRenewRate());
     // The renew rate should not be greater than the rate.
     EXPECT_THROW(process("perfdhcp -6 -r 10 -f 11 -l ethx all"),
                  isc::InvalidParameter);
@@ -354,10 +357,6 @@ TEST_F(CommandOptionsTest, RenewRate) {
     // be accepted.
     EXPECT_THROW(process("perfdhcp -6 -f 10 -l ethx all"),
                  isc::InvalidParameter);
-    // Currently the -f<renew-rate> can be specified for IPv6 mode
-    // only.
-    EXPECT_THROW(process("perfdhcp -4 -r 10 -f 10 -l ethx all"),
-                 isc::InvalidParameter);
     // Renew rate should be specified.
     EXPECT_THROW(process("perfdhcp -6 -r 10 -f -l ethx all"),
                  isc::InvalidParameter);