Skip to content

[rust-LIN-01] Diagnostic frames (0x3C/0x3D) cannot be transmitted via the documented slave API #27

Description

@SoundMatt

Location

  • src/virtual_bus/mod.rsBus::publish impl for VirtualBus (hardcodes Enhanced checksum type)
  • src/slave/mod.rsSlaveNode::set_response (only path used by the slave-facing API)
  • src/frame.rsvalidate_frame (rejects diagnostic frames that aren't Classic-checksum)

Problem

The Bus::publish trait method on VirtualBus always registers a slave response with ChecksumType::Enhanced — it calls its internal publish_with_type with that type hardcoded. send_header later synthesizes the frame using whatever checksum type was registered and calls validate_frame on it, and validate_frame correctly (per ISO 17987 / RELAY's frame rules) requires diagnostic frame IDs 0x3C/0x3D to use the classic checksum, not enhanced.

The only way to register a diagnostic response with the correct classic checksum is VirtualBus::publish_classic, but that's an inherent method on VirtualBus directly, not part of the Bus trait — and nothing in the slave-facing API calls it. SlaveNode::set_response, which is the documented way applications register slave responses, calls self.bus.publish(...) (the trait method, always Enhanced). So any application that registers a diagnostic-frame (0x3C/0x3D) response through SlaveNode — the only documented, protocol-generic API — will have that response synthesized with an Enhanced checksum, which then fails validate_frame inside send_header with an InvalidFrame error every time the master tries to drive that header. Diagnostic/transport-layer frames are effectively unreachable through the whole documented master/slave surface, even though the checksum-type rule they run afoul of is itself correctly implemented.

There's also no end-to-end test that drives a diagnostic ID through send_header to catch this.

Suggested fix

Either have publish_with_type (or publish) auto-select ChecksumType::Classic when the ID is 0x3C/0x3D, or add a checksum-type parameter to the Bus::publish trait itself and route SlaveNode::set_response through it so classic-checksum diagnostic responses can be registered via the standard API. Add a round-trip test that registers a diagnostic ID and successfully drives it through send_header.


Filed from the 2026-07-29 ecosystem audit register; independently re-verified against current HEAD before filing.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions