Skip to content

fix(server): encode V2 response IntegrityIds - #818

Open
gijzelaerr wants to merge 3 commits into
masterfrom
fix/802-v2-response-integrity-id
Open

fix(server): encode V2 response IntegrityIds#818
gijzelaerr wants to merge 3 commits into
masterfrom
fix/802-v2-response-integrity-id

Conversation

@gijzelaerr

@gijzelaerr gijzelaerr commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • append the current per-client read or write IntegrityId to every established-session V2 response
  • preserve the legacy V1 response layout
  • preserve the current server's optional TCP-reset behavior after symbolic reads
  • cover read/write counter selection and sequential V2 TLS operations

The branch now includes current master through a merge commit; its previous conflicts are resolved without rewriting history.

Verification

  • uv run --frozen --extra test --extra s7commplus pytest -q (1779 passed, 82 skipped)
  • focused V2/TLS/server tests (124 passed)
  • uv run --frozen pre-commit run --all-files
  • uv build --no-sources

Fixes #802

@gijzelaerr
gijzelaerr requested a review from spreeker September 1, 2026 17:07
@gijzelaerr

Copy link
Copy Markdown
Owner Author

@bvanelli Could you review the V2 emulator response behavior here, particularly selecting the read/write counter and appending the IntegrityId without changing the V1 payload layout? The conflict repair also preserves the newer symbolic-read TCP-reset emulation.

The refreshed head passes 1,779 tests, the complete pre-commit suite, and the package build.

@gijzelaerr gijzelaerr modified the milestones: 4.1, 4.0 Sep 8, 2026
@gijzelaerr
gijzelaerr removed the request for review from spreeker September 8, 2026 10:04
@gijzelaerr

Copy link
Copy Markdown
Owner Author

@ale-rinaldi you have detailed V2/TLS observations from the 1507S and 1211C. Could you review the server response layout here against your real-PLC captures or traces, particularly whether the read/write IntegrityId selection and appended counter match V2 responses without changing the V1 payload shape?\n\nThis is primarily a capture/protocol review; it does not require exposing project data or pointing a real PLC at the emulator.

Comment thread s7commplus/server.py
response = self._build_error_response(seq_num, req_session_id, function_code)
rst = False

if self._protocol_version >= ProtocolVersion.V2 and req_session_id != 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, it appends the integrity_id to every function. In theory, this could also apply to _build_error_response and _handle_init_ssl. I'm not sure those use need the integrity id.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S7CommPlus server: encode IntegrityId in V2 response payloads

2 participants