Fix isotp_send_with_id ignoring the identifier for Single Frames - #79
Merged
SimonCahill merged 2 commits intoSep 12, 2026
Merged
SimonCahill merged 2 commits into
SimonCahill merged 2 commits into
Conversation
isotp_send_single_frame() discarded its id argument and transmitted with link->send_arbitration_id, so isotp_send_with_id() only overrode the identifier of a First Frame. ISO 15765-2 restricts functional addressing to Single Frames, which made the documented use case send on the physical identifier instead. Pass id through to isotp_user_send_can(), add a regression test covering the Single Frame, First Frame and CAN FD escaped Single Frame paths, and bump the version to 1.9.3 for the version gate. Fixes SimonCahill#78 Co-authored by Fable 5.1 High
Co-authored by Fable 5.1 High
Owner
|
Nice catch! |
SimonCahill
approved these changes
Sep 12, 2026
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.
Problem
isotp_send_with_id()is documented as overriding the link's transmit identifier for one send, and the README recommends it for functional addressing. Since 276549c (#36) the override only reached the First Frame:isotp_send_single_frame()discarded itsidargument and transmitted withlink->send_arbitration_id. ISO 15765-2 restricts functional addressing to Single Frames, so a functional request such asisotp_send_with_id(&link, 0x7DF, ...)on a link initialised with0x7E0went out on0x7E0.Full details and a standalone reproduction are in #78.
Fix
isotp_send_single_frame()now passesidtoisotp_user_send_can()and the(void)idthat hid the unused parameter is gone. The change covers both the Classical CAN Single Frame and the CAN FDSF_DLescape format, which share the same send call.isotp_send_first_frame()already usedidand is unchanged.Test
SendsWithOverriddenIdentifierintests/test_framing.cppsends throughisotp_send_with_id()and asserts on the identifier captured by the mock:isotp_send()uses it,ISO_TP_MAX_CAN_FRAME_SIZE > 8, an escaped Single Frame goes out on the override.The test is compiled into all twelve framing configurations. Against
masterit fails in every one of them with the link identifier (0x123) where the override (0x7DF) is expected. With the fix, all pass.Verification
Run locally on macOS with Apple clang 21, using
isotpc_STATIC_LIBRARY=ONbecause the shared-library target does not link on macOS without the user hooks (pre-existing, not touched here):isotpc_ENABLE_CAN_SEND_ARG=ONisotpc_ENABLE_CAN_SEND_ARG=ON isotpc_ENABLE_TRANSCEIVE_EVENTS=ONisotpc_MAX_CAN_FRAME_SIZE=64isotpc_NO_FORMATTED_ERRORS=ONisotpc_BUILD_EXAMPLES=ONcompiles the examples without warnings, andmake version-gatepasses. I could not run the cppcheck/Infer gate or the libFuzzer target locally; CI will cover those.Version
Bumped to 1.9.3 in
vars.mk,CMakeLists.txtandlibrary.jsonso the version gate passes. Happy to change it if you would rather pick the number.Fixes #78
Co-authored by Fable 5.1 High