From b4925fbd16fb925ede34175b4e173af6f3dad763 Mon Sep 17 00:00:00 2001 From: Arne Welzel Date: Tue, 5 Aug 2025 19:56:07 +0200 Subject: [PATCH] TapAnalyzer: More verdict to action rename Relates to #4725 #4337 --- .../protocol/ip/SessionAdapter.h | 10 +-- .../Baseline/plugins.tap-analyzer/output | 72 +++++++++---------- .../plugins/tap-analyzer-plugin/src/Plugin.cc | 6 +- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/packet_analysis/protocol/ip/SessionAdapter.h b/src/packet_analysis/protocol/ip/SessionAdapter.h index 92d4a59059..f42b8974f0 100644 --- a/src/packet_analysis/protocol/ip/SessionAdapter.h +++ b/src/packet_analysis/protocol/ip/SessionAdapter.h @@ -25,7 +25,7 @@ enum class PacketAction : uint8_t { * Reason why delivery of a packet would be skipped. */ enum class SkipReason : uint8_t { - None, ///< None is used when the verdict is Deliver. + None, ///< None is used when the action is Deliver. Unknown, ///< Placeholder if no other value fits. BadChecksum, ///< The packet's checksum is invalid and ignore_checksums is false. BadProtoHeader, ///< Something was off with the lengths or offsets in the protocol header. @@ -53,7 +53,7 @@ public: * * @param pkt The packet being processed. * @param action Either Deliver or Skip as determined by session analyzers. - * @param skip_reason If verdict is Skip, an indication why this packet is skipped, otherwise None. + * @param skip_reason If action is Skip, an indication why this packet is skipped, otherwise None. */ virtual void TapPacket(const Packet& pkt, PacketAction action, SkipReason skip_reason) = 0; @@ -195,10 +195,10 @@ public: * Helper to forward a packet to all attached TapAnalyzer instances. * * @param pkt The packet. - * @param verdict Whether the packet will be delivered or skipped. - * @param skip_reason If verdict is Skip, should be an indication why this packet is skipped. + * @param action Whether the packet will be delivered or skipped. + * @param skip_reason If action is Skip, should be an indication why this packet is skipped. */ - void TapPacket(const Packet* pkt, PacketAction verdict = PacketAction::Deliver, + void TapPacket(const Packet* pkt, PacketAction action = PacketAction::Deliver, SkipReason skip_reason = SkipReason::None) const; /** diff --git a/testing/btest/Baseline/plugins.tap-analyzer/output b/testing/btest/Baseline/plugins.tap-analyzer/output index d56ace3e3b..c6516b9e1c 100644 --- a/testing/btest/Baseline/plugins.tap-analyzer/output +++ b/testing/btest/Baseline/plugins.tap-analyzer/output @@ -2,86 +2,86 @@ <...>/ip4-tcp-bad-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=54 orig=1, verdict=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 +Packet(len=54 orig=1, action=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip4-tcp-good-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=54 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=54 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip4-udp-bad-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=46 orig=1, verdict=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 +Packet(len=46 orig=1, action=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip4-udp-good-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=46 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=46 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip4-icmp-bad-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=42 orig=1, verdict=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 +Packet(len=42 orig=1, action=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip4-icmp-good-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=42 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=42 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip6-icmp6-bad-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=69 orig=1, verdict=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 +Packet(len=69 orig=1, action=1 skip_reason=1) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/ip6-icmp6-good-chksum.pcap Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=69 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=69 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/get.trace Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=78 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=74 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=202 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=1514 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=1514 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=1514 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=729 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=78 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=74 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=202 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=1514 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=1514 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=1514 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=729 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === <...>/get.trace Init() uid=HhAvVGS1DHFjwGM9 Analyzer added to HhAvVGS1DHFjwGM9 -Packet(len=78 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=74 orig=0, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=202 orig=1, verdict=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=0, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=1514 orig=0, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=1514 orig=0, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=1514 orig=0, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=729 orig=0, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=0, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 -Packet(len=66 orig=1, verdict=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=78 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=74 orig=0, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=202 orig=1, action=0 skip_reason=0) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=0, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=1514 orig=0, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=1514 orig=0, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=1514 orig=0, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=729 orig=0, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=0, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 +Packet(len=66 orig=1, action=1 skip_reason=3) uid=HhAvVGS1DHFjwGM9 Done() uid=HhAvVGS1DHFjwGM9 === diff --git a/testing/btest/plugins/tap-analyzer-plugin/src/Plugin.cc b/testing/btest/plugins/tap-analyzer-plugin/src/Plugin.cc index 29fd49336c..89d3537945 100644 --- a/testing/btest/plugins/tap-analyzer-plugin/src/Plugin.cc +++ b/testing/btest/plugins/tap-analyzer-plugin/src/Plugin.cc @@ -14,10 +14,10 @@ class MyTapAnalyzer : public zeek::packet_analysis::TapAnalyzer { public: MyTapAnalyzer(zeek::Connection* conn) : conn(conn) {} - void TapPacket(const zeek::Packet& pkt, zeek::packet_analysis::PacketAction verdict, + void TapPacket(const zeek::Packet& pkt, zeek::packet_analysis::PacketAction action, const zeek::packet_analysis::SkipReason skip_reason) override { - std::printf("Packet(len=%d orig=%d, verdict=%d skip_reason=%d) uid=%s\n", pkt.len, pkt.is_orig, - static_cast(verdict), static_cast(skip_reason), conn->GetUID().Base62().c_str()); + std::printf("Packet(len=%d orig=%d, action=%d skip_reason=%d) uid=%s\n", pkt.len, pkt.is_orig, + static_cast(action), static_cast(skip_reason), conn->GetUID().Base62().c_str()); } void Init() override { std::printf("Init() uid=%s\n", conn->GetUID().Base62().c_str()); }