isobusfs: pack the protocol structures

The isobusfs protocol structures describe the message layout defined in
ISO 11783-13 but were not packed. The compiler added padding bytes in
front of 16/32 bit values which follow an odd number of bytes, e.g. the
Read File Request (8 bytes according to C.3.5.2) had a size of 10 bytes
and the count value at the wrong position. Server and client of the
can-utils used the same structures and understood each other but the
messages were not compatible to other ISOBUS devices. Additionally the
padding bytes sent uninitialized content.

Add __attribute__((__packed__)) to all protocol structures as it is
already done in j1939_vehicle_position.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
Oliver Hartkopp
2026-10-14 10:21:56 +00:00
parent 8222f517b7
commit aa54819b65
5 changed files with 33 additions and 33 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ struct isobusfs_va_init_vol_req {
uint8_t volume_flags;
__le16 name_len;
uint8_t name[];
};
} __attribute__((__packed__));
/**
* C.5.2.3 Initialize Volume Response
@@ -62,6 +62,6 @@ struct isobusfs_va_init_vol_res {
uint8_t tan;
uint8_t error_code;
uint8_t reserved[4];
};
} __attribute__((__packed__));
#endif /* _ISOBUSFS_CMN_VA_H */