From 8b5675913decf25ef6278a9111a1b1a7311d8863 Mon Sep 17 00:00:00 2001 From: Dominik Pataky Date: Mon, 25 Apr 2022 20:26:04 +0200 Subject: [PATCH] Small changes to PR #37 preventing infinite loops; bump version Closes #37 --- netflow/v9.py | 2 -- setup.py | 2 +- tests/lib.py | 2 +- tests/test_netflow.py | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/netflow/v9.py b/netflow/v9.py index 6be32a1..d197dd0 100644 --- a/netflow/v9.py +++ b/netflow/v9.py @@ -538,8 +538,6 @@ class V9ExportPacket: elif isinstance(matched_template, V9OptionsTemplateRecord): odfs = V9OptionsDataFlowset(data[offset:], matched_template) self._options += odfs.option_data_records - if odfs.length == 0: - break if odfs.length == 0: break offset += odfs.length diff --git a/setup.py b/setup.py index b76f436..814a137 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as fh: setup( name='netflow', - version='0.11.0', + version='0.11.1', description='NetFlow v1, v5, v9 and IPFIX tool suite implemented in Python 3', long_description=long_description, long_description_content_type='text/markdown', diff --git a/tests/lib.py b/tests/lib.py index 0fdbb61..7db164a 100644 --- a/tests/lib.py +++ b/tests/lib.py @@ -188,7 +188,7 @@ PACKETS_V9 = [ "0000059c000000140000000000000000e8200050061b0400", ] -PACKET_V9_WITH_PL = ( +PACKET_V9_WITH_ZEROS = ( "000900057b72e830620b717d78cf34e30102000001040048000000000000006e0000000101000000" "000a20076a06065c0800000d6b15c80000000b7b72e4487b72e448080000000000000438bf6401c7" "65ad1e0d6b15c8000000000001040048000000000000006700000001110000c951ac180b0306065c" diff --git a/tests/test_netflow.py b/tests/test_netflow.py index a89bef2..3949687 100755 --- a/tests/test_netflow.py +++ b/tests/test_netflow.py @@ -13,7 +13,7 @@ import random import unittest from tests.lib import send_recv_packets, NUM_PACKETS, \ - PACKET_INVALID, PACKET_V1, PACKET_V5, PACKET_V9_WITH_PL, \ + PACKET_INVALID, PACKET_V1, PACKET_V5, PACKET_V9_WITH_ZEROS, \ PACKET_V9_TEMPLATE, PACKET_V9_TEMPLATE_MIXED, PACKETS_V9 @@ -120,7 +120,7 @@ class TestFlowExportNetflow(unittest.TestCase): self.assertEqual(len(pkts), 0) # no export is parsed due to missing template # send an invalid packet with zero bytes, must fail to parse - pkts, _, _ = send_recv_packets([PACKET_V9_WITH_PL]) + pkts, _, _ = send_recv_packets([PACKET_V9_WITH_ZEROS]) self.assertEqual(len(pkts), 0) # no export is parsed due to missing template # send packet with two templates and eight flows, should parse correctly since the templates are known