Skip to content

J1939-21 Sequence Number for fragmented frames is not respected on reassembly #69

Description

@ale-polimi

The problem

According to J1939-21 standard, the packets shall be assembled sequentially, in order of sequence number.

5.10.1.4 Reassembly
Data packets are received sequentially. Each data packet of a multipacket message shall be assembled, in order of
sequence number, into a single string of bytes. This string of bytes is passed to the application entity responsible for the
large message.

This project assembles the packets sequentially, but without consideration of the sequence number.

I've captured this behaviour with candump:

(144.088236)  vcan0  18EAFF03   [3]  EC FE 00
(144.088676)  vcan0  18ECFF01   [8]  20 11 00 03 FF EC FE 00
(144.138983)  vcan0  1CEBFF01   [8]  01 32 47 31 57 4C 31 31
(144.140534)  vcan0  1CEBFF01   [8]  03 41 41 41 41 41 41 41      <-- Packet injected on the canbus
(144.189149)  vcan0  1CEBFF01   [8]  02 54 37 4C 39 31 36 31
(144.239272)  vcan0  1CEBFF01   [8]  03 32 34 30 FF FF FF FF

Which results in this at the receiver end:

Image

Proposed solution

Check the sequence number of fragmented packets during reassembly. If an out of sequence packet is received, raise an exception.

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