From: Tomek Mrugalski Date: Wed, 18 Nov 2020 12:42:06 +0000 (+0100) Subject: [#1332] The v6 elapsed option is now being increased X-Git-Tag: Kea-1.9.2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5037b0c53ada5db9678cd755ff8221a441d84e95;p=thirdparty%2Fkea.git [#1332] The v6 elapsed option is now being increased --- diff --git a/src/bin/perfdhcp/test_control.cc b/src/bin/perfdhcp/test_control.cc index 204e8b68a5..68026c4bd1 100644 --- a/src/bin/perfdhcp/test_control.cc +++ b/src/bin/perfdhcp/test_control.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -1644,14 +1645,21 @@ TestControl::sendSolicit6(const bool preload /*= false*/) { if (!pkt6) { isc_throw(Unexpected, "failed to create SOLICIT packet"); } + + // Check if we need to simulate HA failures by pretending no responses were received. + // The DHCPv6 protocol signals that by increasing the elapsed option field. Note it is in 1/100 of a second. if (options_.getWaitForElapsedTime() && stats_mgr_.getTestPeriod().length().total_seconds() >= options_.getWaitForElapsedTime() && - stats_mgr_.getTestPeriod().length().total_seconds() <= options_.getWaitForElapsedTime() + + stats_mgr_.getTestPeriod().length().total_seconds() < options_.getWaitForElapsedTime() + options_.getIncreaseElapsedTime()) { - boost::shared_ptr - opt_elapsed_time(new LocalizedOption(Option::V6, D6O_ELAPSED_TIME, - OptionBuffer(2, 10))); - pkt6->addOption(opt_elapsed_time); + + // Keep increasing elapsed time. The value should start increasing steadily. + uint32_t val = (stats_mgr_.getTestPeriod().length().total_seconds() - options_.getWaitForElapsedTime() + 1)*100; + if (val > 65535) { + val = 65535; + } + OptionPtr elapsed(new OptionInt(Option::V6, D6O_ELAPSED_TIME, val)); + pkt6->addOption(elapsed); } else { pkt6->addOption(Option::factory(Option::V6, D6O_ELAPSED_TIME)); }