flowprobe: fix clearing interface state on feature disabling
As a result of recent fixes, all currently stored flows of an interface are deleted when the feature is being disabled for the interface. This includes stopping the timer and freeing the flow entries for further reuse. The problem is that meta information is not cleared in the flow entries being deleted. For example, packet delta count will keep its value. The next flow that gets one of these pool entries will already have a non-zero packet count. So the counting of packets will start from a non-zero value. And incorrect packet delta count will be exported for that flow. With this fix, clear meta information too when clearing interface state. Also, update the corresponding test to cover this case. Type: fix Change-Id: I9a73b3958adfd1676e66b0ed50f1478920671cca Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
This commit is contained in:
Alexander Chernavin
committed by
Matthew Smith
parent
92ab407a59
commit
dab1dfeea9
@ -527,6 +527,9 @@ flowprobe_clear_state_if_index (u32 sw_if_index)
|
|||||||
if (e->key.rx_sw_if_index == sw_if_index ||
|
if (e->key.rx_sw_if_index == sw_if_index ||
|
||||||
e->key.tx_sw_if_index == sw_if_index)
|
e->key.tx_sw_if_index == sw_if_index)
|
||||||
{
|
{
|
||||||
|
e->packetcount = 0;
|
||||||
|
e->octetcount = 0;
|
||||||
|
e->prot.tcp.flags = 0;
|
||||||
if (fm->passive_timer > 0)
|
if (fm->passive_timer > 0)
|
||||||
{
|
{
|
||||||
tw_timer_stop_2t_1w_2048sl (
|
tw_timer_stop_2t_1w_2048sl (
|
||||||
|
@ -1441,8 +1441,27 @@ class DisableFP(MethodHolder):
|
|||||||
self.sleep(12, "wait for leftover ip4 flows during three passive intervals")
|
self.sleep(12, "wait for leftover ip4 flows during three passive intervals")
|
||||||
self.collector.assert_nothing_captured()
|
self.collector.assert_nothing_captured()
|
||||||
|
|
||||||
|
# re-enable feature for the interface
|
||||||
|
ipfix.enable_flowprobe_feature()
|
||||||
|
|
||||||
|
# template packet should arrive immediately
|
||||||
|
ipfix_decoder = IPFIXDecoder()
|
||||||
|
self.vapi.ipfix_flush()
|
||||||
|
templates = ipfix.verify_templates(ipfix_decoder, count=1)
|
||||||
|
|
||||||
|
# send some ip4 packets
|
||||||
|
self.create_stream(src_if=self.pg3, dst_if=self.pg4, packets=5)
|
||||||
|
capture = self.send_packets(src_if=self.pg3, dst_if=self.pg4)
|
||||||
|
|
||||||
|
# verify meta info - packet/octet delta
|
||||||
|
self.vapi.ipfix_flush()
|
||||||
|
cflow = self.wait_for_cflow_packet(self.collector, templates[0], timeout=8)
|
||||||
|
self.verify_cflow_data(ipfix_decoder, capture, cflow)
|
||||||
|
|
||||||
|
self.collector.get_capture(2)
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
ipfix.disable_exporter()
|
ipfix.remove_vpp_config()
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipUnless(config.extended, "part of extended tests")
|
@unittest.skipUnless(config.extended, "part of extended tests")
|
||||||
|
Reference in New Issue
Block a user