From e654a640eda1a7793e4650a85822738b7d98d7b6 Mon Sep 17 00:00:00 2001 From: Pavel Odintsov Date: Mon, 19 Jun 2023 18:29:00 +0100 Subject: [PATCH] Better naming for nf5_flow_t: netflow5_flow_t --- src/netflow_plugin/netflow.hpp | 6 +++--- src/netflow_plugin/netflow_collector.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/netflow_plugin/netflow.hpp b/src/netflow_plugin/netflow.hpp index 66c2d46..d26fccc 100644 --- a/src/netflow_plugin/netflow.hpp +++ b/src/netflow_plugin/netflow.hpp @@ -85,7 +85,7 @@ class __attribute__((__packed__)) nf5_header_t { // We are using this class for decoding messages from the wire // Please do not add new fields here -class __attribute__((__packed__)) nf5_flow_t { +class __attribute__((__packed__)) netflow5_flow_t { public: uint32_t src_ip = 0; uint32_t dest_ip = 0; @@ -119,10 +119,10 @@ class __attribute__((__packed__)) nf5_flow_t { uint16_t pad2 = 0; }; -static_assert(sizeof(nf5_flow_t) == 48, "Bad size for nf5_flow_t"); +static_assert(sizeof(netflow5_flow_t) == 48, "Bad size for netflow5_flow_t"); #define NF5_MAXFLOWS 30 -#define NF5_PACKET_SIZE(nflows) (sizeof(nf5_header_t) + ((nflows) * sizeof(nf5_flow_t))) +#define NF5_PACKET_SIZE(nflows) (sizeof(nf5_header_t) + ((nflows) * sizeof(netflow5_flow_t))) /* Netflow v9 */ diff --git a/src/netflow_plugin/netflow_collector.cpp b/src/netflow_plugin/netflow_collector.cpp index 1caebc3..40fc063 100644 --- a/src/netflow_plugin/netflow_collector.cpp +++ b/src/netflow_plugin/netflow_collector.cpp @@ -2294,10 +2294,10 @@ bool process_netflow_packet_v5(uint8_t* packet, uint32_t len, std::string& clien for (uint32_t i = 0; i < nflows; i++) { size_t offset = NF5_PACKET_SIZE(i); - nf5_flow_t* nf5_flow = (nf5_flow_t*)(packet + offset); + netflow5_flow_t* nf5_flow = (netflow5_flow_t*)(packet + offset); /* Check packet bounds */ - if (offset + sizeof(nf5_flow_t) > len) { + if (offset + sizeof(netflow5_flow_t) > len) { logger << log4cpp::Priority::ERROR << "Error! You will try to read outside the Netflow v5 packet"; return false; }