Repository navigation
Conversation
The RTU unit test stopped in test_server() at the first crafted write request (unit-test-client.c, "write 0 values") and never reached the end of the suite. Two raw requests can't be framed by an RTU server, which works out the request length from the function code and byte count: - send_crafted_request() zeroes the byte count of write requests on the "0 values" pass but still sends the data bytes. The server takes the first 9 bytes as the request (bad CRC), then waits for the rest of a "request" made of the 6 leftover bytes and times out. - The unknown function code request carries 4 payload bytes. The server can't know a length for an unknown function code, reads slave, function code and CRC only, the CRC fails and nothing is replied. Send the zero-value write requests without data, and the unknown function code request as slave and function code only. TCP keeps working since the MBAP length follows the actual request length. Tested with unit-test-server/unit-test-client: - RTU, QNX 8.0 (Raspberry Pi 4) <-> Linux (Raspberry Pi 3B) over UART at 115200 8N1: all tests pass (before: stopped at the "write 0 values" check after 65 OKs). - RTU, Linux <-> Linux over a pty pair: all tests pass (before: same stop). - TCP and TCP PI (IPv6): all tests pass on Linux and QNX.
|
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... |
Author
|
@cla-bot check |
|
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... |
|
The cla-bot has been summoned, and re-checked this pull request! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #893.
Two raw requests in
test_server()can't be framed by an RTU server, which works out the request length from the function code and byte count:send_crafted_request()zeroes the byte count of write requests on the "0 values" pass but still sends the data bytes, so the server reads 9 bytes (bad CRC) and then times out waiting on the 6 leftover bytes.This sends the zero-value write requests without data, and the unknown function code request as slave and function code only. Only
tests/unit-test-client.cchanges; TCP keeps working since the MBAP length follows the actual request length.Tested (unit-test-server / unit-test-client):
I agree to the terms of the Contributor License Agreement (CLA.txt).