Skip to content

[go-LIN-01] Diagnostic frames (0x3C/0x3D) are transmitted with the wrong checksum type #63

Description

@SoundMatt

Location

master/master.go (Node.Diagnostics, the n.bus.Publish(f.ID, f.Data) call and the two SendHeader calls that follow it); root cause in the Bus interface in lin.go (Publish(id, data []byte) error — no way to specify checksum type); virtual/bus.go (Publish hardcodes the enhanced checksum type on the registered response entry, and SendHeader recomputes the checksum using whatever type was stored).

Finding

MasterRequestFrame.ToFrame() and SlaveResponseFrame.ToFrame() in diagnostic.go correctly build a classic-checksum Frame for the LIN diagnostic frames (IDs 0x3C/0x3D), matching what LIN 2.x diagnostic transport requires. However, master.Node.Diagnostics throws that fully-built Frame away and only reuses its ID/Data, re-registering the response through the generic Bus.Publish(id, data) call. virtual.Bus.Publish always stores the entry with the enhanced checksum type, and SendHeader then computes and transmits the frame's checksum using that stored type — so the request/response actually placed on the bus for every diagnostic exchange carries an enhanced checksum, not the classic checksum diagnostic frames require.

The library's own ValidateFrame rejects a diagnostic-ID frame that isn't classic-checksummed, confirming the library itself considers this combination invalid — yet the normal Diagnostics code path produces exactly that invalid combination. I confirmed at current HEAD (commit 7c03bdd) that Diagnostics still calls n.bus.Publish(f.ID, f.Data) rather than routing through virtual.Bus.PublishClassic (which exists but isn't reachable through the Bus/MasterBus interfaces that master.Node depends on), so this is not fixed by any of the recent merged PRs.

Recommendation

Extend the Bus interface with a checksum-type-aware publish path (e.g. accept a full Frame, or add a checksum-type parameter to Publish), and have Diagnostics register the classic-checksum Frame it already builds via ToFrame() instead of discarding it. Apply the same fix to the 0x3D response registration path.

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