Skip to content

examples/generators/options.py: TCP_BASE's seq and ack_flag are silently dropped, so every option fixture has seq=0 #602

Description

@JarryShaw

examples/generators/options.py's TCP_BASE passes keyword arguments that TCP.make does not declare. They are silently dropped, with no warning, so every option fixture this generator produces is built with different field values than the dictionary states.

Measured

On origin/main (13a75dfcd), CPython 3.14.7:

TCP_BASE keys: ['ack', 'ack_flag', 'checksum', 'cwr', 'dstport', 'ece', 'fin',
                'ns', 'payload', 'psh', 'rst', 'seq', 'srcport', 'syn', 'urg',
                'urgent_pointer', 'window']

TCP(**TCP_BASE).info.seq = 0      while TCP_BASE says seq = 1
warnings captured: []

Nothing warns. warnings.simplefilter('always') around the construction captures nothing — no UnknownFieldWarning, no DeprecationWarning. The value is simply not applied.

Two distinct problems in one dictionary

  1. seq is not a make parameter and is dropped. TCP_BASE declares seq = 1; the constructed object reports info.seq == 0.
  2. ack and ack_flag are both present, and ack is not the acknowledgement number. ack binds to the ACK flag, so 'ack': 0 sets a flag rather than a sequence value, while ack_flag is not a declared parameter at all and is dropped.

So the dictionary reads as though it sets a sequence number of 1 and an explicit ACK flag, and does neither.

Why it matters beyond this file

options.py:403 and :417 both construct via TCP(options=…, **TCP_BASE), so this is the base for the generated option fixtures. Every fixture built through it carries seq = 0 regardless of what the generator says, and an ack that means something other than it appears to.

That makes the fixtures weaker evidence than they look: a test asserting round-trip fidelity over them is asserting it over a packet whose header fields were not what the generator specified.

Notes

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions