|
@@ -114,6 +114,7 @@ CommandOptions::reset() {
|
|
|
lease_type_.set(LeaseType::ADDRESS);
|
|
|
rate_ = 0;
|
|
|
renew_rate_ = 0;
|
|
|
+ release_rate_ = 0;
|
|
|
report_delay_ = 0;
|
|
|
clients_num_ = 0;
|
|
|
mac_template_.assign(mac, mac + 6);
|
|
@@ -211,7 +212,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
|
|
|
// In this section we collect argument values from command line
|
|
|
// they will be tuned and validated elsewhere
|
|
|
while((opt = getopt(argc, argv, "hv46r:t:R:b:n:p:d:D:l:P:a:L:"
|
|
|
- "s:iBc1T:X:O:E:S:I:x:w:e:f:")) != -1) {
|
|
|
+ "s:iBc1T:X:O:E:S:I:x:w:e:f:F:")) != -1) {
|
|
|
stream << " -" << static_cast<char>(opt);
|
|
|
if (optarg) {
|
|
|
stream << " " << optarg;
|
|
@@ -307,6 +308,12 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
|
|
|
" must be a positive integer");
|
|
|
break;
|
|
|
|
|
|
+ case 'F':
|
|
|
+ release_rate_ = positiveInteger("value of the release rate:"
|
|
|
+ " -F<release-rate> must be a"
|
|
|
+ " positive integer");
|
|
|
+ break;
|
|
|
+
|
|
|
case 'h':
|
|
|
usage();
|
|
|
return (true);
|
|
@@ -690,6 +697,8 @@ CommandOptions::validate() const {
|
|
|
"-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),
|
|
|
"second -n<num-request> is not compatible with -i");
|
|
|
check((getIpVersion() == 4) && !getLeaseType().is(LeaseType::ADDRESS),
|
|
@@ -719,6 +728,8 @@ CommandOptions::validate() const {
|
|
|
"-I<ip-offset> is not compatible with -i");
|
|
|
check((getExchangeMode() == DO_SA) && (getRenewRate() != 0),
|
|
|
"-f<renew-rate> is not compatible with -i");
|
|
|
+ check((getExchangeMode() == DO_SA) && (getReleaseRate() != 0),
|
|
|
+ "-F<release-rate> is not compatible with -i");
|
|
|
check((getExchangeMode() != DO_SA) && (isRapidCommit() != 0),
|
|
|
"-i must be set to use -c");
|
|
|
check((getRate() == 0) && (getReportDelay() != 0),
|
|
@@ -730,12 +741,16 @@ CommandOptions::validate() const {
|
|
|
check((getRate() == 0) &&
|
|
|
((getMaxDrop().size() > 0) || getMaxDropPercentage().size() > 0),
|
|
|
"-r<rate> must be set to use -D<max-drop>");
|
|
|
- check((getRate() != 0) && (getRenewRate() > getRate()),
|
|
|
- "Renew rate specified as -f<renew-rate> must not be greater than"
|
|
|
- " the rate specified as -r<rate>");
|
|
|
+ check((getRate() != 0) && (getRenewRate() + getReleaseRate() > getRate()),
|
|
|
+ "The sum of Renew rate (-f<renew-rate>) and Release rate"
|
|
|
+ " (-F<release-rate>) must not be greater than the rate specified"
|
|
|
+ " as -r<rate>");
|
|
|
check((getRate() == 0) && (getRenewRate() != 0),
|
|
|
"Renew rate specified as -f<renew-rate> must not be specified"
|
|
|
" when -r<rate> parameter is not specified");
|
|
|
+ check((getRate() == 0) && (getReleaseRate() != 0),
|
|
|
+ "Release rate specified as -F<release-rate> must not be specified"
|
|
|
+ " when -r<rate> parameter is not specified");
|
|
|
check((getTemplateFiles().size() < getTransactionIdOffset().size()),
|
|
|
"-T<template-file> must be set to use -X<xid-offset>");
|
|
|
check((getTemplateFiles().size() < getRandomOffset().size()),
|
|
@@ -816,6 +831,9 @@ CommandOptions::printCommandLine() const {
|
|
|
if (getRenewRate() != 0) {
|
|
|
std::cout << "renew-rate[1/s]=" << getRenewRate() << std::endl;
|
|
|
}
|
|
|
+ if (getReleaseRate() != 0) {
|
|
|
+ std::cout << "release-rate[1/s]=" << getReleaseRate() << std::endl;
|
|
|
+ }
|
|
|
if (report_delay_ != 0) {
|
|
|
std::cout << "report[s]=" << report_delay_ << std::endl;
|
|
|
}
|
|
@@ -899,13 +917,14 @@ void
|
|
|
CommandOptions::usage() const {
|
|
|
std::cout <<
|
|
|
"perfdhcp [-hv] [-4|-6] [-e<lease-type>] [-r<rate>] [-f<renew-rate>]\n"
|
|
|
- " [-t<report>] [-R<range>] [-b<base>] [-n<num-request>]\n"
|
|
|
- " [-p<test-period>] [-d<drop-time>] [-D<max-drop>]\n"
|
|
|
- " [-l<local-addr|interface>] [-P<preload>] [-a<aggressivity>]\n"
|
|
|
- " [-L<local-port>] [-s<seed>] [-i] [-B] [-c] [-1]\n"
|
|
|
- " [-T<template-file>] [-X<xid-offset>] [-O<random-offset]\n"
|
|
|
- " [-E<time-offset>] [-S<srvid-offset>] [-I<ip-offset>]\n"
|
|
|
- " [-x<diagnostic-selector>] [-w<wrapped>] [server]\n"
|
|
|
+ " [-F<release-rate>] [-t<report>] [-R<range>] [-b<base>]\n"
|
|
|
+ " [-n<num-request>] [-p<test-period>] [-d<drop-time>]\n"
|
|
|
+ " [-D<max-drop>] [-l<local-addr|interface>] [-P<preload>]\n"
|
|
|
+ " [-a<aggressivity>] [-L<local-port>] [-s<seed>] [-i] [-B]\n"
|
|
|
+ " [-c] [-1] [-T<template-file>] [-X<xid-offset>]\n"
|
|
|
+ " [-O<random-offset] [-E<time-offset>] [-S<srvid-offset>]\n"
|
|
|
+ " [-I<ip-offset>] [-x<diagnostic-selector>] [-w<wrapped>]\n"
|
|
|
+ " [server]\n"
|
|
|
"\n"
|
|
|
"The [server] argument is the name/address of the DHCP server to\n"
|
|
|
"contact. For DHCPv4 operation, exchanges are initiated by\n"
|
|
@@ -949,9 +968,13 @@ CommandOptions::usage() const {
|
|
|
" elapsed-time option in the (second/request) template.\n"
|
|
|
" The value 0 disables it.\n"
|
|
|
"-f<renew-rate>: A rate at which IPv6 Renew requests are sent to\n"
|
|
|
- " a server. This value must not be equal or lower than the rate\n"
|
|
|
- " specified as -r<rate>. If -r<rate> is not specified, this\n"
|
|
|
- " parameter must not be specified too.\n"
|
|
|
+ " a server. The sum of this value and release-rate must be equal\n"
|
|
|
+ " or lower than the rate specified as -r<rate>. If -r<rate> is\n"
|
|
|
+ " not specified, this parameter must not be specified too.\n"
|
|
|
+ "-F<release-rate>: A rate at which IPv6 Release requests are sent to\n"
|
|
|
+ " a server. The sum of this value and renew-rate must be equal or\n"
|
|
|
+ " lower than the rate specified as -r<rate>. If -r<rate> is not\n"
|
|
|
+ " specified, this parameter must not be specified too.\n"
|
|
|
"-h: Print this help.\n"
|
|
|
"-i: Do only the initial part of an exchange: DO or SA, depending on\n"
|
|
|
" whether -6 is given.\n"
|