Skip to content

cmd: refuse extra characters after a port in "mirror" - #1017

Open
DrDoof wants to merge 1 commit into
RTLPlayground:mainfrom
DrDoof:fix/mirror-port-suffix
Open

DrDoof wants to merge 1 commit into
RTLPlayground:mainfrom
DrDoof:fix/mirror-port-suffix

Conversation

@DrDoof

@DrDoof DrDoof commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

mirror 12 makes port 1 the mirroring port and mirror 3 45 mirrors port 4. Only the first digit of a port is read; what follows a source port is taken as "both directions" unless it is t or r.

The mirroring port now has to end at a space or the end of the line, and a source port may only be followed by t or r.

In rtlsim on an RTL8373 board mirror 12, mirror 3 45, mirror 3 4x and mirror 3 4rt get 200 on main and switch mirroring on; with this change they get 400 and /mirror.json stays as it was. mirror 3 4 and mirror 3 4r 5t 6 give the same result as before.

Only the first digit of each port is read and whatever follows it is
ignored, so "mirror 12" sets port 1 as the mirroring port and
"mirror 3 45" mirrors port 4.
@feelfree69

Copy link
Copy Markdown
Collaborator

Don't know if all these cmd_parser fixes are needed, @mintsoft refactors this anyway?

@DrDoof DrDoof added the bugfix label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants