summaryrefslogtreecommitdiffstats
path: root/src/bin/perfdhcp
diff options
context:
space:
mode:
authorPiotrek Zadroga <piotrek@isc.org>2023-05-26 11:03:59 +0200
committerPiotrek Zadroga <piotrek@isc.org>2023-05-26 15:22:24 +0200
commit6123d2a0a122fad941bc3b0f537be02ab734df26 (patch)
tree7583bd85ec0fd64338ed34eba7c543fcfcd503b1 /src/bin/perfdhcp
parent[#2834] Doc and ChangeLog update (diff)
downloadkea-6123d2a0a122fad941bc3b0f537be02ab734df26.tar.xz
kea-6123d2a0a122fad941bc3b0f537be02ab734df26.zip
[#2834] Addressed review comments
Diffstat (limited to 'src/bin/perfdhcp')
-rw-r--r--src/bin/perfdhcp/command_options.cc5
-rw-r--r--src/bin/perfdhcp/tests/command_options_unittest.cc10
2 files changed, 12 insertions, 3 deletions
diff --git a/src/bin/perfdhcp/command_options.cc b/src/bin/perfdhcp/command_options.cc
index 5167421c82..a01f967be3 100644
--- a/src/bin/perfdhcp/command_options.cc
+++ b/src/bin/perfdhcp/command_options.cc
@@ -608,9 +608,8 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
// and must be used together with -A option.
check((ipversion_ != 6),
"-6 must be explicitly specified before --o1r is used.");
- if (v6_relay_encapsulation_level_ != 1) {
- isc_throw(isc::InvalidParameter, "-A must be explicitly specified before --o1r is used.");
- }
+ check(v6_relay_encapsulation_level_ <= 0,
+ "-A must be explicitly specified before --o1r is used.");
// custom option (expected format: code,hexstring)
std::string opt_text = std::string(optarg);
diff --git a/src/bin/perfdhcp/tests/command_options_unittest.cc b/src/bin/perfdhcp/tests/command_options_unittest.cc
index 7f5eb271ea..e2ac820c25 100644
--- a/src/bin/perfdhcp/tests/command_options_unittest.cc
+++ b/src/bin/perfdhcp/tests/command_options_unittest.cc
@@ -899,6 +899,16 @@ TEST_F(CommandOptionsTest, ElapsedTime) {
EXPECT_EQ(10, opt.getWaitForElapsedTime());
}
+TEST_F(CommandOptionsTest, UseRelayV6OptionsWithoutV6) {
+ CommandOptions opt;
+ EXPECT_NO_THROW(process(opt, "perfdhcp -6 -A1 --o1r 32,00000E10 -l ethx all"));
+ EXPECT_TRUE(opt.isUseRelayedV6());
+ EXPECT_EQ(1, opt.getRelayOpts().size());
+
+ // --o1r must be used together with -6
+ EXPECT_THROW(process(opt, "perfdhcp -A1 --o1r 32,00000E10 -l ethx all"), isc::InvalidParameter);
+}
+
TEST_F(CommandOptionsTest, UseRelayV6OptionsWithoutRelayEncapsulation) {
CommandOptions opt;
EXPECT_NO_THROW(process(opt, "perfdhcp -6 -A1 --o1r 32,00000E10 -l ethx all"));