Small changes to PR #37 preventing infinite loops; bump version

Closes #37
This commit is contained in:
Dominik Pataky 2022-04-25 20:26:04 +02:00
parent b8e911a40a
commit 8b5675913d
4 changed files with 4 additions and 6 deletions

View file

@ -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

View file

@ -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',

View file

@ -188,7 +188,7 @@ PACKETS_V9 = [
"0000059c000000140000000000000000e8200050061b0400",
]
PACKET_V9_WITH_PL = (
PACKET_V9_WITH_ZEROS = (
"000900057b72e830620b717d78cf34e30102000001040048000000000000006e0000000101000000"
"000a20076a06065c0800000d6b15c80000000b7b72e4487b72e448080000000000000438bf6401c7"
"65ad1e0d6b15c8000000000001040048000000000000006700000001110000c951ac180b0306065c"

View file

@ -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