Skip to content

Fix validation of FC22 echoed confirmation fields - #870

Open
Daniiiil1 wants to merge 1 commit into
stephane:masterfrom
Daniiiil1:agent/validate-fc22-confirmation
Open

Fix validation of FC22 echoed confirmation fields#870
Daniiiil1 wants to merge 1 commit into
stephane:masterfrom
Daniiiil1:agent/validate-fc22-confirmation

Conversation

@Daniiiil1

Copy link
Copy Markdown

What changed

  • add a dedicated FC22 confirmation case in check_confirmation()
  • require the echoed reference address, AND mask, and OR mask to match the request
  • add independent integration regressions for a mismatch in each echoed field

Why

The Modbus specification defines the normal Mask Write Register response as an exact echo of the request fields. FC22 previously fell through to the generic one-value case, so a response with the correct function and length could be accepted even when the echoed address or masks differed.

Fixes #868.

Validation

  • git diff --check
  • ./autogen.sh
  • ./configure --disable-shared
  • make -j4
  • tests/unit-tests.shALL TESTS PASS WITH SUCCESS

One earlier full-suite run hit the pre-existing timing-sensitive 7 ms byte-timeout test on macOS; the FC22 regressions passed in that run, and a clean rerun of the complete integration script passed.

@cla-bot

cla-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Daniil Mordanov.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@Daniiiil1
Daniiiil1 marked this pull request as ready for review August 9, 2026 13:17
@Daniiiil1
Daniiiil1 force-pushed the agent/validate-fc22-confirmation branch from 0b09c28 to cb728a4 Compare August 9, 2026 13:18
@cla-bot

cla-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FC22 confirmation accepts mismatched address and masks

1 participant