Skip Menu |

This queue is for tickets about the Net-Flow CPAN distribution.

Report information
The Basics
Id: 81789
Status: rejected
Priority: 0/
Queue: Net-Flow

People
Owner: Nobody in particular
Requestors: kichik [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



Subject: Multiple flowsets are not parsed correctly for NetFlow v9
decode() counts each flow with $FlowCount. It uses that variable to verify it hasn't finished reading the packet in line 919: while( $FlowCount < $NetFlowHeaderRef->{Count} ){ The count in the NetFlow header is of *flowsets* and not the separate flows in them. Each flowsets contain its own length field that implies the number of flows. This can cause entire flowsets to be skipped. For example, decode() will not parse a single flow in the following packet. It will only parse the templates. * header - count = 2 * flowset - id: 0 #templates * template flow - id: 256 * template flow - id: 257 * flowset #ignored - id = 256 * flow * flow * flow Since every flow, including the template flows, is counted against the header's flowset count, $FlowCount will be 2 before it reaches the second flowset. The loop will stop and the flows will be ignored. I've attached a patch that fixes this by only incrementing $FlowCount once per flowset. The name should probably be changed to $FlowSetCount, but I wanted to keep it simple.
Subject: fix_flowset_counter.patch
diff -ru Net-Flow-0.04/lib/Net/Flow.pm Net-Flow-0.04.patched/lib/Net/Flow.pm --- Net-Flow-0.04/lib/Net/Flow.pm 2012-12-08 04:58:22.000000000 +0200 +++ Net-Flow-0.04.patched/lib/Net/Flow.pm 2012-12-08 04:58:49.000000000 +0200 @@ -1000,8 +1000,6 @@ } - $FlowCount += 1 ; - @Template = grep{ $_ if( $_->{TemplateId} ne $TemplateRef->{TemplateId} ) ; @@ -1028,13 +1026,14 @@ last ; } - $FlowCount += 1 ; push(@Flows,$FlowRef) ; } } + $FlowCount += 1 ; + } #
The count in the header is not of the number of flowsets, but the number of "FlowSet records" and "Template FlowSet records". RFC 3954 is pretty clear on this point. Count The total number of records in the Export Packet, which is the sum of Options FlowSet records, Template FlowSet records, and Data FlowSet records. The problem in this bug is not Net::Flow, but the example. In the example the count should be 5 (not 2) 1 - template flow (256) 2 - template flow (256) 3 - flow (1) 4 - flow (2) 5 - flow (3)
Thanks for replying. The RFC does seem to state that. I'll take a deeper look at our code.
On Sun Feb 10 02:28:52 2013, https://www.google.com/accounts/o8/id? id=AItOawmYobypfR9v4TYQAKGgPExEO1dkgd0FCH8 wrote: Show quoted text
> Thanks for replying. The RFC does seem to state that. I'll take a
deeper Show quoted text
> look at our code.
OK. Moving back to rejected as I have many v9 captures that agree with me. :-) Feel free to contact me directly if you need more information.