From: Marcin Siodelski Date: Fri, 15 Jan 2016 15:37:24 +0000 (+0100) Subject: [4254] Fixed exchange name for the DHCPv4 renewals in StatsMgr. X-Git-Tag: trac4267_base0~10^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=585bfc578f5192493ecffffea60343d377fd9c2a;p=thirdparty%2Fkea.git [4254] Fixed exchange name for the DHCPv4 renewals in StatsMgr. --- diff --git a/src/bin/perfdhcp/stats_mgr.h b/src/bin/perfdhcp/stats_mgr.h index 9ab95a1451..f9ed4c4768 100644 --- a/src/bin/perfdhcp/stats_mgr.h +++ b/src/bin/perfdhcp/stats_mgr.h @@ -114,6 +114,7 @@ public: enum ExchangeType { XCHG_DO, ///< DHCPv4 DISCOVER-OFFER XCHG_RA, ///< DHCPv4 REQUEST-ACK + XCHG_RNA, ///< DHCPv4 REQUEST-ACK (renewal) XCHG_SA, ///< DHCPv6 SOLICIT-ADVERTISE XCHG_RR, ///< DHCPv6 REQUEST-REPLY XCHG_RN, ///< DHCPv6 RENEW-REPLY @@ -1179,6 +1180,8 @@ public: return("DISCOVER-OFFER"); case XCHG_RA: return("REQUEST-ACK"); + case XCHG_RNA: + return("REQUEST-ACK (renewal)"); case XCHG_SA: return("SOLICIT-ADVERTISE"); case XCHG_RR: diff --git a/src/bin/perfdhcp/test_control.cc b/src/bin/perfdhcp/test_control.cc index 5697e51c50..aae57d5cf7 100644 --- a/src/bin/perfdhcp/test_control.cc +++ b/src/bin/perfdhcp/test_control.cc @@ -689,7 +689,7 @@ TestControl::initializeStatsMgr() { options.getDropTime()[1]); } if (options.getRenewRate() != 0) { - stats_mgr4_->addExchangeStats(StatsMgr4::XCHG_RN); + stats_mgr4_->addExchangeStats(StatsMgr4::XCHG_RNA); } } else if (options.getIpVersion() == 6) { @@ -1119,7 +1119,7 @@ TestControl::processReceivedPacket4(const TestControlSocket& socket, // may need to keep this DHCPACK in the storage if renews. Note that, // DHCPACK messages hold the information about leases assigned. // We use this information to renew. - if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RN)) { + if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RNA)) { // Renew messages are sent, because StatsMgr has the // specific exchange type specified. Let's append the DHCPACK. // message to a storage @@ -1130,8 +1130,8 @@ TestControl::processReceivedPacket4(const TestControlSocket& socket, // renewal. In this case we first check if StatsMgr has exchange type // for renew specified, and if it has, if there is a corresponding // renew message for the received DHCPACK. - } else if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RN)) { - stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RN, pkt4); + } else if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RNA)) { + stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RNA, pkt4); } } } @@ -1657,7 +1657,7 @@ TestControl::sendRequestFromAck(const TestControlSocket& socket) { isc_throw(Unexpected, "Statistics Manager for DHCPv4 " "hasn't been initialized"); } - stats_mgr4_->passSentPacket(StatsMgr4::XCHG_RN, msg); + stats_mgr4_->passSentPacket(StatsMgr4::XCHG_RNA, msg); return (true); } diff --git a/src/bin/perfdhcp/tests/stats_mgr_unittest.cc b/src/bin/perfdhcp/tests/stats_mgr_unittest.cc index 25bc29035a..dcf1e22f7d 100644 --- a/src/bin/perfdhcp/tests/stats_mgr_unittest.cc +++ b/src/bin/perfdhcp/tests/stats_mgr_unittest.cc @@ -265,6 +265,9 @@ TEST_F(StatsMgrTest, ExchangeToString) { EXPECT_EQ("DISCOVER-OFFER", StatsMgr4::exchangeToString(StatsMgr4::XCHG_DO)); EXPECT_EQ("REQUEST-ACK", StatsMgr4::exchangeToString(StatsMgr4::XCHG_RA)); + EXPECT_EQ("REQUEST-ACK (renewal)", + StatsMgr4::exchangeToString(StatsMgr4::XCHG_RNA)); + // Test DHCPv6 specific exchange names. EXPECT_EQ("SOLICIT-ADVERTISE",