uds: don't send consecutive frames past the end of the payload - #3726
Open
singhharsh1708 wants to merge 1 commit into
Open
uds: don't send consecutive frames past the end of the payload#3726singhharsh1708 wants to merge 1 commit into
singhharsh1708 wants to merge 1 commit into
Conversation
Contributor
Car behavior reportReplays driving segments through this PR and compares the behavior to master. ✅ No changes detected |
Contributor
There was a problem hiding this comment.
Thanks for contributing to opendbc! In order for us to review your PR as quickly as possible, check the following:
- Convert your PR to a draft unless it's ready to review
- Read the contributing docs
- Before marking as "ready for review", ensure:
- the goal is clearly stated in the description
- all the tests are passing
- include a route or your device' dongle ID if relevant
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.
When an ECU's flow control frame asks for a bigger block size than the payload has left, IsoTpMessage keeps emitting consecutive frames past the end of tx_dat. The slice is empty and ljust pads it, so frames carrying no payload go out on the bus, each one costing another separation time delay.
An 8 byte request answered with flow control 30 08 14 sends eight consecutive frames on master: 2117180000000000, then 2200000000000000 through 2800000000000000. Only the first carries payload. With this change it sends that one frame. ISO 15765-2 section 9.6.5.3 says only the last block of a transfer may have fewer than BS frames, so stopping when the payload runs out is the specified behaviour. Multi-block transfers are unchanged, 25 and 30 bytes at block size 2 still send 2 frames per block.
Scope is small and worth stating: opendbc's own firmware queries never reach this path, since all 127 requests in FW_QUERY_CONFIGS are 7 bytes or shorter and take the single frame path. This affects callers using UdsClient or IsoTpMessage directly with a request of 8 bytes or more.
Clamping end to tx_len is the fix pd0wm proposed in the issue. There is no test file for IsoTpMessage today, happy to add one if you want the behaviour pinned.
Fixes #1682