Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when parsing some netflow data fields #714

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/inputs/flow/NetflowData.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ static bool process_netflow_v1(NFSample *sample)
return false;
}

sample->uptime_ms = nf1_hdr->uptime_ms;
sample->time_sec = nf1_hdr->time_sec;
sample->time_nanosec = nf1_hdr->time_nanosec;
sample->uptime_ms = be32toh(nf1_hdr->uptime_ms);
sample->time_sec = be32toh(nf1_hdr->time_sec);
sample->time_nanosec = be32toh(nf1_hdr->time_nanosec);

for (uint16_t flow = 0; flow < sample->nflows; flow++) {
offset = NF1_PACKET_SIZE(flow);
Expand Down Expand Up @@ -118,10 +118,10 @@ static bool process_netflow_v5(NFSample *sample)
return false;
}

sample->uptime_ms = nf5_hdr->uptime_ms;
sample->time_sec = nf5_hdr->time_sec;
sample->time_nanosec = nf5_hdr->time_nanosec;
sample->flow_sequence = nf5_hdr->flow_sequence;
sample->uptime_ms = be32toh(nf5_hdr->uptime_ms);
sample->time_sec = be32toh(nf5_hdr->time_sec);
sample->time_nanosec = be32toh(nf5_hdr->time_nanosec);
sample->flow_sequence = be32toh(nf5_hdr->flow_sequence);

for (uint16_t flow = 0; flow < sample->nflows; flow++) {
offset = NF5_PACKET_SIZE(flow);
Expand Down Expand Up @@ -172,10 +172,10 @@ static bool process_netflow_v7(NFSample *sample)
return false;
}

sample->uptime_ms = nf7_hdr->uptime_ms;
sample->time_sec = nf7_hdr->time_sec;
sample->time_nanosec = nf7_hdr->time_nanosec;
sample->flow_sequence = nf7_hdr->flow_sequence;
sample->uptime_ms = be32toh(nf7_hdr->uptime_ms);
sample->time_sec = be32toh(nf7_hdr->time_sec);
sample->time_nanosec = be32toh(nf7_hdr->time_nanosec);
sample->flow_sequence = be32toh(nf7_hdr->flow_sequence);

for (uint16_t flow = 0; flow < sample->nflows; flow++) {
offset = NF7_PACKET_SIZE(flow);
Expand Down Expand Up @@ -395,8 +395,8 @@ static bool process_netflow_v9(NFSample *sample)
uint32_t i, flowset_id, flowset_len, flowset_flows;
uint32_t offset, total_flows;

sample->uptime_ms = nf9_hdr->uptime_ms;
sample->time_sec = nf9_hdr->time_sec;
sample->uptime_ms = be32toh(nf9_hdr->uptime_ms);
sample->time_sec = be32toh(nf9_hdr->time_sec);
sample->flow_sequence = be32toh(nf9_hdr->package_sequence);
sample->source_id = be32toh(nf9_hdr->source_id);

Expand Down Expand Up @@ -618,7 +618,7 @@ static bool process_netflow_v10(NFSample *sample)
uint32_t i, flowset_id, flowset_len, flowset_flows;
uint32_t offset, total_flows;

sample->time_sec = nf10_hdr->time_sec;
sample->time_sec = be32toh(nf10_hdr->time_sec);
sample->flow_sequence = be32toh(nf10_hdr->package_sequence);
sample->source_id = be32toh(nf10_hdr->source_id);

Expand Down
Loading