Skip to content

ef: fix rx ign never matching a named frame - #20

Open
jeso-mchp wants to merge 1 commit into
masterfrom
master.ef-fix-rx-ign-named-frames
Open

ef: fix rx ign never matching a named frame#20
jeso-mchp wants to merge 1 commit into
masterfrom
master.ef-fix-rx-ign-named-frames

Conversation

@jeso-mchp

Copy link
Copy Markdown
Contributor

'rx ign name ' silently absorbed nothing: every frame reaching the interface was counted RX-ERR, including one byte-identical to the named frame. The equivalent with an inline frame spec worked.

The ign matcher compares only the first frame_size_no_padding bytes of the frame and bails out when that length is 0. The length is computed in argc_cmd, but only on the inline-spec path: a 'name ' reference returns early, before the summation, and copy_cmd_by_name cloned frame, frame_buf and frame_mask_buf without it. So an ign command referring to a named frame kept a length of 0 and was skipped for every frame.

Propagate frame_size_no_padding in copy_cmd_by_name alongside the other three clones. The named definition always has it computed, since a 'name ' command cannot take the reference early return and so always parses an inline spec. Recomputing it from the cloned frame stack would duplicate the parser's summation in a second file.

Only the ign path was affected. Regular rx matching uses frame_buf and frame->padding_len, both cloned correctly, so 'rx name ' worked before and is unchanged.

Extract the frame pairing loop from exec_cmds into resolve_named_frames so the tests can drive name resolution without a socket. Behaviour is unchanged.

'rx <if> ign name <ref>' silently absorbed nothing: every frame
reaching the interface was counted RX-ERR, including one byte-identical
to the named frame. The equivalent with an inline frame spec worked.

The ign matcher compares only the first frame_size_no_padding bytes of
the frame and bails out when that length is 0. The length is computed
in argc_cmd, but only on the inline-spec path: a 'name <ref>' reference
returns early, before the summation, and copy_cmd_by_name cloned frame,
frame_buf and frame_mask_buf without it. So an ign command referring to
a named frame kept a length of 0 and was skipped for every frame.

Propagate frame_size_no_padding in copy_cmd_by_name alongside the other
three clones. The named definition always has it computed, since a
'name <n> <spec>' command cannot take the reference early return and so
always parses an inline spec. Recomputing it from the cloned frame
stack would duplicate the parser's summation in a second file.

Only the ign path was affected. Regular rx matching uses frame_buf and
frame->padding_len, both cloned correctly, so 'rx <if> name <ref>'
worked before and is unchanged.

Extract the frame pairing loop from exec_cmds into
resolve_named_frames so the tests can drive name resolution without a
socket. Behaviour is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant