``--o1r code,hexstring``
This option is very similar to ``-o``, only that it forces ``perfdhcp``
to insert the specified extra option (or options if used several times)
- into relayed DHCPv6 message at 1st level of encapsulation. The code
+ into relayed DHCPv6 message at first level of encapsulation. The code
specifies the option code and the hexstring is a hexadecimal string that
defines the content of the option. Care should be taken as ``perfdhcp``
does not offer any kind of logic behind those options; they are simply
// 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);
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"));