Skip to content

Commit

Permalink
Upgrade pcapplusplus from 22.11 to 23.09 (#701)
Browse files Browse the repository at this point in the history
* Upgrade pcapplusplus from 22.11 to 23.09

* Fix macos python version
  • Loading branch information
leoparente authored Nov 7, 2023
1 parent 167a0b1 commit ab14a07
Show file tree
Hide file tree
Showing 33 changed files with 90 additions and 85 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build

- name: Python Setup
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Get Conan
id: conan
uses: turtlebrowser/get-conan@main
Expand Down
2 changes: 1 addition & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ libmaxminddb/1.7.1
nlohmann_json/3.11.2
openssl/1.1.1w
opentelemetry-proto/1.0.0
pcapplusplus/22.11
pcapplusplus/23.09
protobuf/3.21.12
sigslot/1.2.2
spdlog/1.12.0
Expand Down
4 changes: 2 additions & 2 deletions libs/visor_dns/DnsLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include "DnsLayer.h"
#include "EndianPortable.h"
#include <IpAddress.h>
#include <pcapplusplus/IpAddress.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#include <Logger.h>
#include <pcapplusplus/Logger.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
2 changes: 1 addition & 1 deletion libs/visor_dns/DnsLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "DnsLayerEnums.h"
#include "DnsResource.h"
#include "DnsResourceData.h"
#include <UdpLayer.h>
#include <pcapplusplus/UdpLayer.h>
#include <VisorTcpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
Expand Down
2 changes: 1 addition & 1 deletion libs/visor_dns/DnsResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#include <Logger.h>
#include <pcapplusplus/Logger.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
4 changes: 2 additions & 2 deletions libs/visor_dns/DnsResourceData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

#include "DnsResourceData.h"
#include "EndianPortable.h"
#include <GeneralUtils.h>
#include <pcapplusplus/GeneralUtils.h>
#include <sstream>
#include <string.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#include <Logger.h>
#include <pcapplusplus/Logger.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wunused-parameter"
Expand Down
2 changes: 1 addition & 1 deletion libs/visor_dns/DnsResourceData.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PV_PACKETPP_DNS_RESOURCE_DATA

#include "DnsResource.h"
#include <IpAddress.h>
#include <pcapplusplus/IpAddress.h>
#include <memory>
#include <string>
#include <stdint.h>
Expand Down
6 changes: 3 additions & 3 deletions libs/visor_dns/tests/benchmark_dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include "IPv4Layer.h"
#include "PacketUtils.h"
#include "PcapFileDevice.h"
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/PacketUtils.h>
#include <pcapplusplus/PcapFileDevice.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
2 changes: 1 addition & 1 deletion libs/visor_tcp/VisorTcpLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifdef TCPOPT_CCECHO
#undef TCPOPT_CCECHO
#endif // TCPOPT_CCECHO
#include <TcpLayer.h>
#include <pcapplusplus/TcpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
2 changes: 1 addition & 1 deletion libs/visor_utils/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "utils.h"
#include "EndianPortable.h"
#include <IpUtils.h>
#include <pcapplusplus/IpUtils.h>
#include <fmt/format.h>
#include <sstream>

Expand Down
2 changes: 1 addition & 1 deletion libs/visor_utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include <IpAddress.h>
#include <pcapplusplus/IpAddress.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/bgp/BgpStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "BgpStreamHandler.h"
#include <TimespecTimeval.h>
#include <pcapplusplus/TimespecTimeval.h>

namespace visor::handler::bgp {

Expand Down
2 changes: 1 addition & 1 deletion src/handlers/bgp/BgpStreamHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <BgpLayer.h>
#include <pcapplusplus/BgpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/dhcp/DhcpStreamHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include "DhcpLayer.h"
#include "DhcpV6Layer.h"
#include "EthLayer.h"
#include "IPv6Layer.h"
#include <pcapplusplus/DhcpLayer.h>
#include <pcapplusplus/DhcpV6Layer.h>
#include <pcapplusplus/EthLayer.h>
#include <pcapplusplus/IPv6Layer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/dns/v1/DnsStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include <IPv4Layer.h>
#include <IPv6Layer.h>
#include <TimespecTimeval.h>
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/TimespecTimeval.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
10 changes: 5 additions & 5 deletions src/handlers/dns/v1/tests/test_dns_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#pragma clang diagnostic ignored "-Wc99-extensions"
#pragma clang diagnostic ignored "-Wrange-loop-analysis"
#endif
#include "DnsLayer.h"
#include <Packet.h>
#include <PcapFileDevice.h>
#include <ProtocolType.h>
#include <UdpLayer.h>
#include <pcapplusplus/DnsLayer.h>
#include <pcapplusplus/Packet.h>
#include <pcapplusplus/PcapFileDevice.h>
#include <pcapplusplus/ProtocolType.h>
#include <pcapplusplus/UdpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wold-style-cast"
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/dns/v2/DnsStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include <IPv4Layer.h>
#include <IPv6Layer.h>
#include <TimespecTimeval.h>
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/TimespecTimeval.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
10 changes: 5 additions & 5 deletions src/handlers/dns/v2/tests/test_dns_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#pragma clang diagnostic ignored "-Wc99-extensions"
#pragma clang diagnostic ignored "-Wrange-loop-analysis"
#endif
#include "DnsLayer.h"
#include <Packet.h>
#include <PcapFileDevice.h>
#include <ProtocolType.h>
#include <UdpLayer.h>
#include <pcapplusplus/DnsLayer.h>
#include <pcapplusplus/Packet.h>
#include <pcapplusplus/PcapFileDevice.h>
#include <pcapplusplus/ProtocolType.h>
#include <pcapplusplus/UdpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wold-style-cast"
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/net/v1/NetStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include "IPv4Layer.h"
#include "IPv6Layer.h"
#include "PacketUtils.h"
#include "TimespecTimeval.h"
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/PacketUtils.h>
#include <pcapplusplus/TimespecTimeval.h>
#include "VisorTcpLayer.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/net/v2/NetStreamHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include "IPv4Layer.h"
#include "IPv6Layer.h"
#include "PacketUtils.h"
#include "TimespecTimeval.h"
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/PacketUtils.h>
#include <pcapplusplus/TimespecTimeval.h>
#include "VisorTcpLayer.h"
#ifdef __GNUC__
#pragma GCC diagnostic pop
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/netprobe/NetProbeStreamHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <IcmpLayer.h>
#include <pcapplusplus/IcmpLayer.h>
#include <VisorTcpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/dnstap/DnstapInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <DnsLayer.h>
#include <pcapplusplus/DnsLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
10 changes: 5 additions & 5 deletions src/inputs/flow/FlowInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <IPv4Layer.h>
#include <IPv6Layer.h>
#include <Packet.h>
#include <PcapFileDevice.h>
#include <UdpLayer.h>
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/Packet.h>
#include <pcapplusplus/PcapFileDevice.h>
#include <pcapplusplus/UdpLayer.h>
#include <uvw/async.h>
#include <uvw/loop.h>
#include <uvw/timer.h>
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/netprobe/NetProbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <IpAddress.h>
#include <Packet.h>
#include <pcapplusplus/IpAddress.h>
#include <pcapplusplus/Packet.h>
#include <uvw/loop.h>
#include <uvw/dns.h>
#ifdef __GNUC__
Expand Down
10 changes: 5 additions & 5 deletions src/inputs/netprobe/NetProbeInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif
#include <IPv4Layer.h>
#include <IPv6Layer.h>
#include <Packet.h>
#include <PcapFileDevice.h>
#include <UdpLayer.h>
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/Packet.h>
#include <pcapplusplus/PcapFileDevice.h>
#include <pcapplusplus/UdpLayer.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/netprobe/NetProbeInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "InputStream.h"
#include "NetProbe.h"
#include <Packet.h>
#include <pcapplusplus/Packet.h>
#include <spdlog/spdlog.h>

namespace uvw {
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/netprobe/PingProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "NetProbeException.h"
#include "ThreadName.h"
#include <Packet.h>
#include <TimespecTimeval.h>
#include <pcapplusplus/Packet.h>
#include <pcapplusplus/TimespecTimeval.h>
#include <uvw/idle.h>

namespace visor::input::netprobe {
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/netprobe/PingProbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ typedef int SOCKET;
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include <IcmpLayer.h>
#include <IpAddress.h>
#include <pcapplusplus/IcmpLayer.h>
#include <pcapplusplus/IpAddress.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
Expand Down
24 changes: 12 additions & 12 deletions src/inputs/pcap/PcapInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
#include <DnsLayer.h> // used only for mock generator
#include <EthLayer.h>
#include <IPv4Layer.h>
#include <IPv6Layer.h>
#include <Logger.h>
#include <PacketUtils.h>
#include <PcapFileDevice.h>
#include <SystemUtils.h>
#include <pcapplusplus/DnsLayer.h> // used only for mock generator
#include <pcapplusplus/EthLayer.h>
#include <pcapplusplus/IPv4Layer.h>
#include <pcapplusplus/IPv6Layer.h>
#include <pcapplusplus/Logger.h>
#include <pcapplusplus/PacketUtils.h>
#include <pcapplusplus/PcapFileDevice.h>
#include <pcapplusplus/SystemUtils.h>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include <IpUtils.h>
#include <assert.h>
#include <cstdint>
#include <pcapplusplus/IpUtils.h>
#include <sstream>

using namespace std::chrono;
Expand Down Expand Up @@ -76,7 +76,7 @@ PcapInputStream::PcapInputStream(const std::string &name)
this,
_tcp_connection_start_cb,
_tcp_connection_end_cb,
{true, 1, 1000, 50})
pcpp::TcpReassemblyConfiguration(true, 1, 1000, 50))
{
pcpp::Logger::getInstance().suppressLogs();
}
Expand Down Expand Up @@ -111,7 +111,7 @@ void PcapInputStream::start()
}

if (config_exists("debug") && config_get<bool>("debug")) {
pcpp::Logger::getInstance().setAllModlesToLogLevel(pcpp::Logger::LogLevel::Debug);
pcpp::Logger::getInstance().setAllModulesToLogLevel(pcpp::Logger::LogLevel::Debug);
}

_cur_pcap_source = PcapInputStream::DefaultPcapSource;
Expand Down Expand Up @@ -257,7 +257,7 @@ void PcapInputStream::tcp_message_ready(int8_t side, const pcpp::TcpStreamData &
for (auto &proxy : _event_proxies) {
dynamic_cast<PcapInputEventProxy *>(proxy.get())->tcp_message_ready_cb(side, tcpData, _packet_dir_cache);
}
if (_lru_list->put(tcpData.getConnectionData().flowKey, tcpData.getConnectionData().endTime, &_deleted_data)){
if (_lru_list->put(tcpData.getConnectionData().flowKey, tcpData.getConnectionData().endTime, &_deleted_data)) {
_lru_overflow.push_back(_deleted_data.first);
}
}
Expand Down
Loading

0 comments on commit ab14a07

Please sign in to comment.