mirror of
https://github.com/pavel-odintsov/fastnetmon
synced 2024-11-23 13:22:36 +01:00
Better naming for nf5_flow_t: netflow5_flow_t
This commit is contained in:
parent
405ae8e835
commit
e654a640ed
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user