From: Michal Berger <[email protected]>
Date: Sun, 21 Dec 2025 20:27:59 +0100
Subject: [PATCH] lanserv/bmc_sensor: Set proper completion code for the
platform event

Currently, depending on how rdata is set prior to the handler call, BMC
may end up indicating that the "Invalid command" was sent, while still
properly processing it and adding the event to SEL. Since this may be
a bit confusing on the requestor's end, make sure proper completion
code is returned.

Can be reproduced by sending a direct Platform Event Message, e.g.:

 # ipmitool sel list
 SEL has no entries
 # ipmitool raw 0x4 0x2 0x41 0x4 0x3 0xfe 0x80 0x1 0x2 0x3
 Unable to send RAW command (channel=0x0 netfn=0x4 lun=0x0 cmd=0x2
rsp=0xc1): Invalid command
 # echo $?
 1
 # # The event was successfully added to SEL anyway
 # ipmitool sel get 0x1
 SEL Record ID          : 0001
  Record Type           : 02
  Timestamp             : S+ 70/001 S+ 70/001
  Generator ID          : f041
  EvM Revision          : 04
  Sensor Type           : Current
  Sensor Number         : fe
  Event Type            : Unspecified
  Event Direction       : Deassertion Event
  Event Data            : 010203
  Description           :

Signed-off-by: Michal Berger <[email protected]>
---
lanserv/bmc_sensor.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/lanserv/bmc_sensor.c b/lanserv/bmc_sensor.c
index 9de230a0..1f43e178 100644
--- a/lanserv/bmc_sensor.c
+++ b/lanserv/bmc_sensor.c
@@ -130,6 +130,10 @@ handle_platform_event(lmc_data_t    *mc,
    sel_data[10] = msg->data[5];
    sel_data[11] = msg->data[6];
    sel_data[12] = msg->data[7];
+
+    rdata[0] = 0;
+    *rdata_len = 1;
+
    mc_new_event(mc, 2, sel_data);
}

--
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to