From 9ec80f15143d4e4c8029c6f19b1848501a186bf9 Mon Sep 17 00:00:00 2001 From: Dongjun Na Date: Thu, 3 Oct 2024 13:18:48 +0900 Subject: [PATCH] Refactor Reload WireGuard layer after setters in tests Signed-off-by: Dongjun Na --- Tests/Packet++Test/Tests/WireGuardTests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/Packet++Test/Tests/WireGuardTests.cpp b/Tests/Packet++Test/Tests/WireGuardTests.cpp index cc1471ebe8..480ce74ff0 100644 --- a/Tests/Packet++Test/Tests/WireGuardTests.cpp +++ b/Tests/Packet++Test/Tests/WireGuardTests.cpp @@ -407,6 +407,8 @@ PTF_TEST_CASE(WireGuardEditTest) wgHandShakeInitLayer->setEncryptedTimestamp(expectedTimestampInit); wgHandShakeInitLayer->setMac1(expectedMac1Init); wgHandShakeInitLayer->setMac2(expectedMac2Init); + wgHandShakeInitLayer = wgHandShakeInitPacket.getLayerOfType(); + uint32_t reservedValueInit = 0; memcpy(&reservedValueInit, expectedReservedInit.data(), 3); PTF_ASSERT_EQUAL(wgHandShakeInitLayer->getReserved(), be32toh(reservedValueInit)); @@ -450,6 +452,8 @@ PTF_TEST_CASE(WireGuardEditTest) wgHandShakeResponseLayer->setEncryptedEmpty(encryptedEmptyDataResp); wgHandShakeResponseLayer->setMac1(expectedMac1Resp); wgHandShakeResponseLayer->setMac2(expectedMac2Resp); + wgHandShakeResponseLayer = wgHandShakeResponsePacket.getLayerOfType(); + uint32_t reservedValueResp = 0; memcpy(&reservedValueResp, expectedReservedResp.data(), 3); @@ -481,6 +485,7 @@ PTF_TEST_CASE(WireGuardEditTest) wgCookieReplyaLayer->setNonce(nonceCookie); wgCookieReplyaLayer->setReceiverIndex(1); wgCookieReplyaLayer->setEncryptedCookie(encryptedCookie); + wgCookieReplyaLayer = wgCookieReplyPacket.getLayerOfType(); uint32_t reservedValueCookie = 0; memcpy(&reservedValueCookie, expectedReservedCookie.data(), 3); @@ -514,6 +519,7 @@ PTF_TEST_CASE(WireGuardEditTest) wgTransportDataLayer->setCounter(1); wgTransportDataLayer->setReceiverIndex(1); wgTransportDataLayer->setEncryptedData(expectedEncryptedDataTrans, sizeof(expectedEncryptedDataTrans)); + wgTransportDataLayer = wgTransportDataPacket.getLayerOfType(); uint32_t reservedValue = 0; memcpy(&reservedValue, expectedReservedTrans.data(), 3);