Skip to content

Commit

Permalink
mctpd: check IIDs and opcodes in control protocol responses
Browse files Browse the repository at this point in the history
Currently we ignore the IID and opcode fields in control protocol
response messages. This means we may get a delayed response from an
endpoint, it may be interpreted incorrectly as a response to the next
message.

Instead, allocate new IIDs for each message, then check the IIDs in
responses. We do this through a new common response validation function,
mctp_ctrl_validate_response.

This requires some additional string building for error messages.

Signed-off-by: Jeremy Kerr <[email protected]>
  • Loading branch information
jk-ozlabs committed Oct 21, 2024
1 parent f110926 commit e7d64b0
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 68 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased


### Fixed

1. Fixed build on musl; we were relying on an implicit definition for `AF_MCTP`

### Changed

1. We now enforce IID checks on MCTP control protocol responses; this
prevents odd behaviour from delayed or invalid responses.

## [2.0] - 2024-09-19

### Added
Expand Down
5 changes: 5 additions & 0 deletions src/mctp-control-spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ struct mctp_ctrl_msg_hdr {
uint8_t command_code;
} __attribute__((__packed__));

struct mctp_ctrl_resp {
struct mctp_ctrl_msg_hdr ctrl_hdr;
uint8_t completion_code;
} __attribute__((packed));

typedef enum {
set_eid,
force_eid,
Expand Down
Loading

0 comments on commit e7d64b0

Please sign in to comment.