Skip to content

Missing multi-part (TP DT) messages can cause data corruption #72

@pmoosman

Description

@pmoosman

In j1939_21.py the method _process_tp_dt() accepts out-of-sequence packets.

We had a case where the last X packets of a multi-part message were lost and the first Y packets of the next multi-part message were lost. The j1939_21.py code combined those to multi-part messages creating corrupt output.

Example, consider a multi-part message that is made up of 6 packets.

<packet #1 of 6 received of message A>
<packet #2 of 6 received of message A>

<lost packets 3-6 of message A>

<lost packet 1 of message B>

<packet #2 of 6 of message B received> - _process_tp_dt() appends this packet message A
<packet #3 of 6 of message B received> - _process_tp_dt() appends this packet message A
<packet #4 of 6 of message B received> - _process_tp_dt() appends this packet message A

At this point _process_tp_dt() has received 6 packets and outputs a corrupt result.

I propose we add code to j1939_21.py to check the packet sequence number. If _process_tp_dt() receives any out-of-order packet sequence numbers, it should reject them and reset the _rcv_buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions