Skip to content

uds: don't send consecutive frames past the end of the payload - #3726

Open
singhharsh1708 wants to merge 1 commit into
commaai:masterfrom
singhharsh1708:uds-cf-clamp
Open

uds: don't send consecutive frames past the end of the payload#3726
singhharsh1708 wants to merge 1 commit into
commaai:masterfrom
singhharsh1708:uds-cf-clamp

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 8, 2026

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the car related to opendbc/car/ label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Car behavior report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

✅ No changes detected

@github-actions github-actions Bot left a comment

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.

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

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

Labels

car related to opendbc/car/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ISO-TP] Number of consecutive frames is wrong when FC contains Block Size

1 participant