Skip to content

NetFlow v9 PduBuffer and TimeAdapter 0.9 crashes and 1000x timestamp unit bug #52

Open

Description

@britram

Pre-existing 0.9 bugs in ipfix/v9pdu.py and ipfix/template.py (distinct from #42, fixed in #34):

  • TimeAdapter divided SysUpTime by 1000 and passed seconds to types._decode_msec() (which expects milliseconds), shifting timestamps by 1000x into dates near 1970; TimeAdapter.namedict_iterator() also crashed with NameError (ienames).
  • PduBuffer.tuple_iterator() crashed on Python 3 with NameError because reduce was never imported in ipfix/v9pdu.py.
  • PduBuffer.__repr__() crashed with NameError (addinf undefined), and PduBuffer.__init__() initialized self.base_epoch instead of self.basetime_epoch.
  • Template-key arity mismatches: PduBuffer.active_template_ids() checked k[0:1] == (self.sesid, self.odid) (always False because a 1-element slice cannot equal a 2-tuple) and yielded odid instead of tid; accepted_tids and _recache_accepted_tids() used 2-tuples (odid, tid) against 3-tuple (sesid, odid, tid) keys in self.templates, raising KeyError.
  • SinglePduBuffer lacked short-PDU and EOF bounds checks (struct.error instead of EOFError/IpfixDecodeError), StreamPduBuffer.next_set() crashed on EOF or short reads immediately after reading a PDU header, and decode_template_from() did not reject the enterprise bit in NetFlow v9 templates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions