]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2834] Addressed review comments
authorPiotrek Zadroga <piotrek@isc.org>
Mon, 29 May 2023 10:06:35 +0000 (12:06 +0200)
committerPiotrek Zadroga <piotrek@isc.org>
Mon, 29 May 2023 10:06:35 +0000 (12:06 +0200)
src/bin/perfdhcp/command_options.cc
src/bin/perfdhcp/tests/command_options_unittest.cc

index 11ee904673d604ba6c95aafb42450f2b751fdbd9..b681740243adacf734d678e9ede37e4e75d68d12 100644 (file)
@@ -471,16 +471,16 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
 
             // custom option (expected format: code,hexstring)
             std::string opt_text = std::string(optarg);
-            size_t coma_loc = opt_text.find(',');
-            check(coma_loc == std::string::npos,
-                  "-o option must provide option code, a coma and hexstring for"
+            size_t comma_loc = opt_text.find(',');
+            check(comma_loc == std::string::npos,
+                  "-o option must provide option code, a comma and hexstring for"
                   " the option content, e.g. -o60,646f63736973 for sending option"
                   " 60 (class-id) with the value 'docsis'");
             int code = 0;
 
             // Try to parse the option code
             try {
-                code = boost::lexical_cast<int>(opt_text.substr(0,coma_loc));
+                code = boost::lexical_cast<int>(opt_text.substr(0, comma_loc));
                 check(code <= 0, "Option code can't be negative");
             } catch (const boost::bad_lexical_cast&) {
                 isc_throw(InvalidParameter, "Invalid option code specified for "
@@ -488,7 +488,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             }
 
             // Now try to interpret the hexstring
-            opt_text = opt_text.substr(coma_loc + 1);
+            opt_text = opt_text.substr(comma_loc + 1);
             std::vector<uint8_t> bin;
             try {
                 isc::util::encode::decodeHex(opt_text, bin);
@@ -614,7 +614,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             // custom option (expected format: encapsulation-level:code,hexstring)
             std::string opt_text = std::string(optarg);
             size_t colon_loc = opt_text.find(':');
-            size_t coma_loc = opt_text.find(',');
+            size_t comma_loc = opt_text.find(',');
 
             // if encapsulation level is skipped by user, let's assume it is 1
             uint8_t option_encapsulation_level = 1;
@@ -636,8 +636,8 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
                 }
             }
 
-            check(coma_loc == std::string::npos,
-                  "--or option must provide encapsulation level, a colon, option code, a coma and "
+            check(comma_loc == std::string::npos,
+                  "--or option must provide encapsulation level, a colon, option code, a comma and "
                   "hexstring for the option content, e.g. --or 1:60,646f63736973 for sending option"
                   " 60 (class-id) with the value 'docsis' at first level of encapsulation");
             int code = 0;
@@ -645,7 +645,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             // Try to parse the option code
             try {
                 code = boost::lexical_cast<int>(
-                    opt_text.substr(colon_loc + 1, coma_loc - colon_loc - 1));
+                    opt_text.substr(colon_loc + 1, comma_loc - colon_loc - 1));
                 check(code <= 0, "Option code can't be negative or zero");
             } catch (const boost::bad_lexical_cast&) {
                 isc_throw(InvalidParameter,
@@ -654,7 +654,7 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) {
             }
 
             // Now try to interpret the hexstring
-            opt_text = opt_text.substr(coma_loc + 1);
+            opt_text = opt_text.substr(comma_loc + 1);
             std::vector<uint8_t> bin;
             try {
                 isc::util::encode::decodeHex(opt_text, bin);
@@ -1394,7 +1394,7 @@ DHCPv6 only options:
     <encapsulation-level> value is 1, which means that the generated
     traffic is an equivalent of the traffic passing through a single
     relay agent.
---or encapsulation-level:<code,hexstring>: Send custom option included
+--or encapsulation-level:<code,hexstring>: Send given option included
     to simulated DHCPv6 relayed traffic at given level of encapsulation
     with the specified code and the specified buffer in hexstring format.
     Currently the only supported encapsulation-level value is 1.
index db4254a22b902af04f7602cdae94d3cb3533c3b6..57989fc923ab1a5630c95e78f33fecd6c1ed5c1d 100644 (file)
@@ -950,7 +950,7 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsWithMultiSubnets) {
 TEST_F(CommandOptionsTest, UseRelayV6OptionsNoComma) {
     CommandOptions opt;
 
-    // --or must be followed by encapsulation-level, colon, option code, a coma and hexstring
+    // --or must be followed by encapsulation-level, colon, option code, a comma and hexstring
     // in case encapsulation-level and colon are skipped, encapsulation-level is by default 1
     EXPECT_THROW(process(opt, "perfdhcp -6 --or 3200000E10 -l ethx all"), isc::InvalidParameter);
 }
@@ -958,7 +958,7 @@ TEST_F(CommandOptionsTest, UseRelayV6OptionsNoComma) {
 TEST_F(CommandOptionsTest, UseRelayV6OptionsNegativeOptionCode) {
     CommandOptions opt;
 
-    // --or must be followed by encapsulation-level, colon, positive option code, a coma and hexstring
+    // --or must be followed by encapsulation-level, colon, positive option code, a comma and hexstring
     // in case encapsulation-level and colon are skipped, encapsulation-level is by default 1
     EXPECT_THROW(process(opt, "perfdhcp -6 --or -32,00000E10 -l ethx all"), isc::InvalidParameter);
 }