Right now channel number is being unconditionally included in the
Generator ID field. However, as per the SEL Event Records it should
remain 0h depending on what medium/interface the event msg is
received over.

So have this:

# ipmitool sel list
 SEL has no entries
 # ipmitool event 1
 Sending SAMPLE event: Temperature - Upper Critical - Going High
 # ipmitool sel get 0x1 | grep "Generator ID"
  Generator ID          : 0041

Instead of:

 # ipmitool event 1
 Sending SAMPLE event: Temperature - Upper Critical - Going High
 # ipmitool sel get 0x2 | grep "Generator ID"
  Generator ID          : f041

As we are at it adjust the msg length of the platform event - as per the
Table 29-4, Platform Event (Event Message) Command, the 8 bytes is
a msg length dedicated for the System Interface which must include
the Generator ID. Case in point, when the event is sent over the
LAN channel, ipmi_sim rejects it due to invalid length of the
request (e.g. ipmitool does not include the extra software ID in the
event data hence sending only 7 bytes):

 $ ipmitool -Ilanplus -Hlocalhost -p4242 -UXXXXX -PXXXXX event 1
 Sending SAMPLE event: Temperature - Upper Critical - Going High
 Platform Event Message command failed: Request data length invalid

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

diff --git a/lanserv/bmc_sensor.c b/lanserv/bmc_sensor.c
index be6c537f..cc21bf9c 100644
--- a/lanserv/bmc_sensor.c
+++ b/lanserv/bmc_sensor.c
@@ -58,6 +58,7 @@
#include <sys/stat.h>
#include <fcntl.h>

+#include <OpenIPMI/ipmi_mc.h>
#include <OpenIPMI/ipmi_err.h>
#include <OpenIPMI/ipmi_msgbits.h>
#include <OpenIPMI/ipmi_bits.h>
@@ -113,16 +114,35 @@ handle_platform_event(lmc_data_t    *mc,
                     void          *cb_data)
{
    unsigned char sel_data[13];
+    uint8_t msg_length = 7; // IPMB MESSAGING

-    if (check_msg_length(msg, 8, rdata, rdata_len))
+    if (msg->orig_channel->channel_num == 15 ||
+               msg->orig_channel->medium_type == IPMI_CHANNEL_MEDIUM_SYS_INTF)
+       msg_length = 8; // SYSTEM INTERFACE MESSAGING
+
+    if (check_msg_length(msg, msg_length, rdata, rdata_len))
       return;

    sel_data[0] = 0;
    sel_data[1] = 0;
    sel_data[2] = 0;
    sel_data[3] = 0;
+    /*
+       From Table 32-1, SEL Event Records:
+         Byte 1
+           [7:1] - 7-bit I2C . Slave Address, or 7-bit system software ID
+           [0] 0b = ID is IPMB Slave Address
+               1b = system software ID
+         Byte 2
+          [7:4] - Channel number. Channel that event message was
received over. 0h if the
+                  event message was received via the system
interface, primary IPMB, or
+                  internally generated by the BMC.
+    */
    sel_data[4] = msg->data[0];
    sel_data[5] = msg->orig_channel->channel_num << 4;
+    if (msg->orig_channel->channel_num == 15 ||
+               msg->orig_channel->medium_type == IPMI_CHANNEL_MEDIUM_SYS_INTF)
+       sel_data[5] = 0;
    sel_data[6] = msg->data[1];
    sel_data[7] = msg->data[2];
    sel_data[8] = msg->data[3];
--
2.43.0


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

Reply via email to