From 00da2836946acb154b1c91105a4282794bfa3dc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 00:18:54 -0700 Subject: [PATCH 1/4] Bump pyparsing from 3.1.1 to 3.1.2 in /Tests/ExamplesTest (#1350) Bumps [pyparsing](https://github.com/pyparsing/pyparsing) from 3.1.1 to 3.1.2. - [Release notes](https://github.com/pyparsing/pyparsing/releases) - [Changelog](https://github.com/pyparsing/pyparsing/blob/master/CHANGES) - [Commits](https://github.com/pyparsing/pyparsing/compare/3.1.1...pyparsing_3.1.2) --- updated-dependencies: - dependency-name: pyparsing dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Tests/ExamplesTest/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ExamplesTest/requirements.txt b/Tests/ExamplesTest/requirements.txt index 04ba1fcb9e..b93fe77975 100644 --- a/Tests/ExamplesTest/requirements.txt +++ b/Tests/ExamplesTest/requirements.txt @@ -1,7 +1,7 @@ attrs==23.2.0 iniconfig==2.0.0 py==1.11.0 -pyparsing==3.1.1 +pyparsing==3.1.2 pytest==8.0.2 scapy==2.5.0 toml==0.10.2 From e05c2d5f448085f7c3dec67faf1e42f0100ad3c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 00:19:41 -0700 Subject: [PATCH 2/4] Bump marocchino/validate-dependabot from 2 to 3 (#1352) Bumps [marocchino/validate-dependabot](https://github.com/marocchino/validate-dependabot) from 2 to 3. - [Release notes](https://github.com/marocchino/validate-dependabot/releases) - [Commits](https://github.com/marocchino/validate-dependabot/compare/v2...v3) --- updated-dependencies: - dependency-name: marocchino/validate-dependabot dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/check_dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check_dependabot.yml b/.github/workflows/check_dependabot.yml index 2b7b4c77ec..a7bbbfcd8e 100644 --- a/.github/workflows/check_dependabot.yml +++ b/.github/workflows/check_dependabot.yml @@ -11,5 +11,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: marocchino/validate-dependabot@v2 + - uses: marocchino/validate-dependabot@v3 id: validate From c551f4056a88e2bc960b4ae2d152dd17fcfba58c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 01:10:00 -0700 Subject: [PATCH 3/4] Bump pytest from 8.0.2 to 8.1.1 in /Tests/ExamplesTest (#1351) Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.0.2 to 8.1.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.0.2...8.1.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Tests/ExamplesTest/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ExamplesTest/requirements.txt b/Tests/ExamplesTest/requirements.txt index b93fe77975..264a86fa83 100644 --- a/Tests/ExamplesTest/requirements.txt +++ b/Tests/ExamplesTest/requirements.txt @@ -2,6 +2,6 @@ attrs==23.2.0 iniconfig==2.0.0 py==1.11.0 pyparsing==3.1.2 -pytest==8.0.2 +pytest==8.1.1 scapy==2.5.0 toml==0.10.2 From 1e5094f0e5b510117a9cac1402d0d34a6d81670e Mon Sep 17 00:00:00 2001 From: "Liu, An-Chi" Date: Thu, 4 Apr 2024 17:58:53 +0900 Subject: [PATCH 4/4] remove unused `dummy` argument (#1354) --- Examples/IPFragUtil/main.cpp | 2 +- Packet++/header/PayloadLayer.h | 4 +--- Packet++/src/PayloadLayer.cpp | 2 +- Tests/Packet++Test/Tests/EthAndArpTests.cpp | 4 ++-- Tests/Packet++Test/Tests/GreTests.cpp | 2 +- Tests/Packet++Test/Tests/IPv4Tests.cpp | 2 +- Tests/Packet++Test/Tests/IPv6Tests.cpp | 2 +- Tests/Packet++Test/Tests/PacketTests.cpp | 10 +++++----- Tests/Packet++Test/Tests/SipSdpTests.cpp | 2 +- Tests/Packet++Test/Tests/SllNullLoopbackTests.cpp | 2 +- Tests/Packet++Test/Tests/TcpTests.cpp | 2 +- Tests/Pcap++Test/Tests/LiveDeviceTests.cpp | 4 ++-- Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp | 2 +- 13 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Examples/IPFragUtil/main.cpp b/Examples/IPFragUtil/main.cpp index 98ad9ac8af..27ad037f97 100644 --- a/Examples/IPFragUtil/main.cpp +++ b/Examples/IPFragUtil/main.cpp @@ -205,7 +205,7 @@ void splitIPPacketToFragmentsBySize(pcpp::RawPacket* rawPacket, size_t fragmentS newFrag.removeAllLayersAfter(fragIpLayer); // create a new PayloadLayer with the fragmented data and add it to the new fragment packet - pcpp::PayloadLayer newPayload(ipLayer->getLayerPayload() + curOffset, curFragSize, false); + pcpp::PayloadLayer newPayload(ipLayer->getLayerPayload() + curOffset, curFragSize); newFrag.addLayer(&newPayload); // set fragment parameters in IPv4/6 layer diff --git a/Packet++/header/PayloadLayer.h b/Packet++/header/PayloadLayer.h index 1f9f2caa6c..bed6d3f677 100644 --- a/Packet++/header/PayloadLayer.h +++ b/Packet++/header/PayloadLayer.h @@ -30,10 +30,8 @@ namespace pcpp * A constructor that allocates a new payload * @param[in] data A raw buffer that will be used as a payload. This data will be copied to the layer * @param[in] dataLen The raw buffer length - * @param[in] dummy A dummy parameter to separate the constructor signature from the other constructor. Its value isn't used anywhere - * @todo dummy is probably not necessary anymore. Remove it */ - PayloadLayer(const uint8_t* data, size_t dataLen, bool dummy); + PayloadLayer(const uint8_t* data, size_t dataLen); /** * A constructor that allocates a new payload from an hex stream diff --git a/Packet++/src/PayloadLayer.cpp b/Packet++/src/PayloadLayer.cpp index ce79f79228..5e3f7f1e40 100644 --- a/Packet++/src/PayloadLayer.cpp +++ b/Packet++/src/PayloadLayer.cpp @@ -8,7 +8,7 @@ namespace pcpp { -PayloadLayer::PayloadLayer(const uint8_t* data, size_t dataLen, bool) : Layer() +PayloadLayer::PayloadLayer(const uint8_t* data, size_t dataLen) : Layer() { m_Data = new uint8_t[dataLen]; memcpy(m_Data, data, dataLen); diff --git a/Tests/Packet++Test/Tests/EthAndArpTests.cpp b/Tests/Packet++Test/Tests/EthAndArpTests.cpp index 27035fd9ce..906ad73fea 100644 --- a/Tests/Packet++Test/Tests/EthAndArpTests.cpp +++ b/Tests/Packet++Test/Tests/EthAndArpTests.cpp @@ -33,7 +33,7 @@ PTF_TEST_CASE(EthPacketCreation) pcpp::EthLayer ethLayer(srcMac, dstMac, PCPP_ETHERTYPE_IP); uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04 }; - pcpp::PayloadLayer payloadLayer(payload, 4, true); + pcpp::PayloadLayer payloadLayer(payload, 4); pcpp::Packet ethPacket(1); PTF_ASSERT_TRUE(ethPacket.addLayer(ðLayer)); @@ -61,7 +61,7 @@ PTF_TEST_CASE(EthPacketPointerCreation) pcpp::EthLayer* ethLayer = new pcpp::EthLayer(srcMac, dstMac, PCPP_ETHERTYPE_IP); uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04 }; - pcpp::PayloadLayer* payloadLayer = new pcpp::PayloadLayer(payload, 4, true); + pcpp::PayloadLayer* payloadLayer = new pcpp::PayloadLayer(payload, 4); pcpp::Packet* ethPacket = new pcpp::Packet(1); PTF_ASSERT_TRUE(ethPacket->addLayer(ethLayer, true)); diff --git a/Tests/Packet++Test/Tests/GreTests.cpp b/Tests/Packet++Test/Tests/GreTests.cpp index 3b4a86a986..e359fe74ea 100644 --- a/Tests/Packet++Test/Tests/GreTests.cpp +++ b/Tests/Packet++Test/Tests/GreTests.cpp @@ -177,7 +177,7 @@ PTF_TEST_CASE(GreCreationTest) pppLayer.getPPP_PPTPHeader()->protocol = htobe16(PCPP_PPP_CCP); uint8_t data[4] = { 0x06, 0x04, 0x00, 0x04 }; - pcpp::PayloadLayer payloadLayer(data, 4, true); + pcpp::PayloadLayer payloadLayer(data, 4); pcpp::Packet grev1Packet(1); PTF_ASSERT_TRUE(grev1Packet.addLayer(ðLayer)); diff --git a/Tests/Packet++Test/Tests/IPv4Tests.cpp b/Tests/Packet++Test/Tests/IPv4Tests.cpp index 6152e80703..28a119be43 100644 --- a/Tests/Packet++Test/Tests/IPv4Tests.cpp +++ b/Tests/Packet++Test/Tests/IPv4Tests.cpp @@ -25,7 +25,7 @@ PTF_TEST_CASE(IPv4PacketCreation) uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xa }; - pcpp::PayloadLayer payloadLayer(payload, 10, true); + pcpp::PayloadLayer payloadLayer(payload, 10); pcpp::Packet ip4Packet(1); diff --git a/Tests/Packet++Test/Tests/IPv6Tests.cpp b/Tests/Packet++Test/Tests/IPv6Tests.cpp index abf9393a9a..e019c33d65 100644 --- a/Tests/Packet++Test/Tests/IPv6Tests.cpp +++ b/Tests/Packet++Test/Tests/IPv6Tests.cpp @@ -52,7 +52,7 @@ PTF_TEST_CASE(IPv6UdpPacketParseAndCreate) pcpp::Layer* afterIpv6Layer = pUdpLayer->getNextLayer(); uint8_t* payloadData = new uint8_t[afterIpv6Layer->getDataLen()]; afterIpv6Layer->copyData(payloadData); - pcpp::PayloadLayer payloadLayer(payloadData, afterIpv6Layer->getDataLen(), true); + pcpp::PayloadLayer payloadLayer(payloadData, afterIpv6Layer->getDataLen()); pcpp::Packet ip6UdpPacketNew(1); PTF_ASSERT_TRUE(ip6UdpPacketNew.addLayer(ðLayer)); diff --git a/Tests/Packet++Test/Tests/PacketTests.cpp b/Tests/Packet++Test/Tests/PacketTests.cpp index 0d90d3f68d..ec9015b29c 100644 --- a/Tests/Packet++Test/Tests/PacketTests.cpp +++ b/Tests/Packet++Test/Tests/PacketTests.cpp @@ -36,7 +36,7 @@ PTF_TEST_CASE(InsertDataToPacket) ip4Layer.getIPv4Header()->protocol = pcpp::PACKETPP_IPPROTO_TCP; uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xa }; - pcpp::PayloadLayer payloadLayer(payload, 10, true); + pcpp::PayloadLayer payloadLayer(payload, 10); // create the packet pcpp::Packet ip4Packet(1); @@ -119,7 +119,7 @@ PTF_TEST_CASE(CreatePacketFromBuffer) PTF_ASSERT_TRUE(newPacket->addLayer(&ip4Layer)); uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xa }; - pcpp::PayloadLayer payloadLayer(payload, 10, true); + pcpp::PayloadLayer payloadLayer(payload, 10); PTF_ASSERT_TRUE(newPacket->addLayer(&payloadLayer)); pcpp::Logger::getInstance().suppressLogs(); @@ -256,7 +256,7 @@ PTF_TEST_CASE(RemoveLayerTest) PTF_ASSERT_TRUE(testPacket.addLayer(&ip4Layer)); uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xa }; - pcpp::PayloadLayer payloadLayer(payload, 10, true); + pcpp::PayloadLayer payloadLayer(payload, 10); PTF_ASSERT_TRUE(testPacket.addLayer(&payloadLayer)); @@ -819,7 +819,7 @@ PTF_TEST_CASE(PacketTrailerTest) // add layer after trailer (result with an error) uint8_t payload[4] = { 0x1, 0x2, 0x3, 0x4 }; - std::unique_ptr newPayloadLayer(new pcpp::PayloadLayer(payload, 4, false)); + std::unique_ptr newPayloadLayer(new pcpp::PayloadLayer(payload, 4)); pcpp::Logger::getInstance().suppressLogs(); PTF_ASSERT_FALSE(trailerIPv4Packet.addLayer(newPayloadLayer.get(), true)); pcpp::Logger::getInstance().enableLogs(); @@ -923,7 +923,7 @@ PTF_TEST_CASE(PacketTrailerTest) PTF_TEST_CASE(ResizeLayerTest) { uint8_t payload[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xa }; - pcpp::PayloadLayer payloadLayer(payload, 10, true); + pcpp::PayloadLayer payloadLayer(payload, 10); // Creating a packet pcpp::Packet packet(1500); diff --git a/Tests/Packet++Test/Tests/SipSdpTests.cpp b/Tests/Packet++Test/Tests/SipSdpTests.cpp index 10d9821525..27ba32a4b1 100644 --- a/Tests/Packet++Test/Tests/SipSdpTests.cpp +++ b/Tests/Packet++Test/Tests/SipSdpTests.cpp @@ -201,7 +201,7 @@ PTF_TEST_CASE(SipRequestLayerCreationTest) PTF_ASSERT_TRUE(newSipPacket.addLayer(&sipReqLayer)); pcpp::SipRequestLayer* samplePacketSipLayer = sipReqSamplePacket.getLayerOfType(); - auto payloadLayer = new pcpp::PayloadLayer(samplePacketSipLayer->getLayerPayload(), samplePacketSipLayer->getLayerPayloadSize(), true); + auto payloadLayer = new pcpp::PayloadLayer(samplePacketSipLayer->getLayerPayload(), samplePacketSipLayer->getLayerPayloadSize()); PTF_ASSERT_TRUE(newSipPacket.addLayer(payloadLayer, true)); newSipPacket.computeCalculateFields(); diff --git a/Tests/Packet++Test/Tests/SllNullLoopbackTests.cpp b/Tests/Packet++Test/Tests/SllNullLoopbackTests.cpp index b5cbe4d2f5..d06719c591 100644 --- a/Tests/Packet++Test/Tests/SllNullLoopbackTests.cpp +++ b/Tests/Packet++Test/Tests/SllNullLoopbackTests.cpp @@ -133,7 +133,7 @@ PTF_TEST_CASE(NullLoopbackTest) pcpp::UdpLayer newUdpLayer(55369, 8612); uint8_t payload[] = { 0x42, 0x4a, 0x4e, 0x42, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - pcpp::PayloadLayer newPayloadLayer(payload, 16, false); + pcpp::PayloadLayer newPayloadLayer(payload, 16); pcpp::Packet newNullPacket(1); PTF_ASSERT_TRUE(newNullPacket.addLayer(&newNullLoopbackLayer)); diff --git a/Tests/Packet++Test/Tests/TcpTests.cpp b/Tests/Packet++Test/Tests/TcpTests.cpp index 302747406b..3c941a7054 100644 --- a/Tests/Packet++Test/Tests/TcpTests.cpp +++ b/Tests/Packet++Test/Tests/TcpTests.cpp @@ -180,7 +180,7 @@ PTF_TEST_CASE(TcpPacketCreation) PTF_ASSERT_EQUAL(tcpLayer.getTcpOptionCount(), 3); uint8_t payloadData[9] = { 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; - pcpp::PayloadLayer payloadLayer(payloadData, 9, true); + pcpp::PayloadLayer payloadLayer(payloadData, 9); pcpp::Packet tcpPacket(1); tcpPacket.addLayer(ðLayer); diff --git a/Tests/Pcap++Test/Tests/LiveDeviceTests.cpp b/Tests/Pcap++Test/Tests/LiveDeviceTests.cpp index c0309f33f2..9ff4b1dd00 100644 --- a/Tests/Pcap++Test/Tests/LiveDeviceTests.cpp +++ b/Tests/Pcap++Test/Tests/LiveDeviceTests.cpp @@ -780,7 +780,7 @@ PTF_TEST_CASE(TestMtuSize) size_t smallDataLen = liveDev->getMtu() - (smallIPLayer.getDataLen()); uint8_t* smallData = new uint8_t[smallDataLen]; memset(smallData, 0xFF, smallDataLen); - pcpp::PayloadLayer smallPayload(smallData, smallDataLen, false); + pcpp::PayloadLayer smallPayload(smallData, smallDataLen); smallPacket.addLayer(&smallPayload); // Check the size of the small Packet @@ -812,7 +812,7 @@ PTF_TEST_CASE(TestMtuSize) size_t largeDataLen = liveDev->getMtu() - largeIPLayer.getDataLen() + 1; uint8_t* largeData = new uint8_t[largeDataLen]; memset(largeData, 0xFF, largeDataLen); - pcpp::PayloadLayer largePayload(largeData, largeDataLen, false); + pcpp::PayloadLayer largePayload(largeData, largeDataLen); largePacket.addLayer(&largePayload); // Check the size of the large Packet diff --git a/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp b/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp index 33cb1b5466..b807b2003d 100644 --- a/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp +++ b/Tests/Pcap++Test/Tests/TcpReassemblyTests.cpp @@ -254,7 +254,7 @@ static pcpp::RawPacket tcpReassemblyAddRetransmissions(pcpp::RawPacket rawPacket tcpLayer->getTcpHeader()->sequenceNumber = htobe32(be32toh(tcpLayer->getTcpHeader()->sequenceNumber) + beginning); - pcpp::PayloadLayer newPayloadLayer(newPayload, numOfBytes, false); + pcpp::PayloadLayer newPayloadLayer(newPayload, numOfBytes); packet.addLayer(&newPayloadLayer); packet.computeCalculateFields();