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
+4 -4
View File
@@ -23,7 +23,7 @@ struct isobusfs_dh_get_cd_req {
uint8_t fs_function;
uint8_t tan;
uint8_t reserved[6];
};
} __attribute__((__packed__));
/**
* C.2.2.3 Get Current Directory Response
@@ -50,7 +50,7 @@ struct isobusfs_dh_get_cd_res {
__le32 free_space;
__le16 name_len;
uint8_t name[];
};
} __attribute__((__packed__));
/**
* C.2.3.2 Change Current Directory Request
@@ -71,7 +71,7 @@ struct isobusfs_dh_ccd_req {
uint8_t tan;
__le16 name_len;
uint8_t name[];
};
} __attribute__((__packed__));
/**
* C.2.3.3 Change Current Directory Response
@@ -101,7 +101,7 @@ struct isobusfs_dh_ccd_res {
uint8_t tan;
uint8_t error_code;
uint8_t reserved[5];
};
} __attribute__((__packed__));
#endif /* _ISOBUSFS_CMN_DH_H */