Make reservationID of 0 invalid
You must first get a reservationID before doing a non
zero offset sdr read, to do this, let it be initialized
to zero, but make zero not allowed later on.
Tested-by:
Commands acted correctly with ID 0
~# ipmitool raw 0xa 0x23 0x0 0x0 0xa 0x0 0x1 0x8
Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0 cmd=0x23 rsp=0xc5): Reservation cancelled or invalid
~# ipmitool raw 0xa 0x23 0x0 0x0 0xa 0x0 0x0 0x8
0b 00 0a 00 51 01 3b 20 00 0a
Change-Id: I6efed09eb71bd69433f53c8ec530061775d1b087
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 16f3438..084b69d 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -869,6 +869,10 @@
}
*dataLen = 0; // default to 0 in case of an error
sdrReservationID++;
+ if (sdrReservationID == 0)
+ {
+ sdrReservationID++;
+ }
*dataLen = 2;
auto resp = static_cast<uint8_t *>(response);
resp[0] = sdrReservationID & 0xFF;
@@ -896,7 +900,8 @@
// reservation required for partial reads with non zero offset into
// record
- if (req->reservationID != sdrReservationID && req->offset)
+ if ((sdrReservationID == 0 || req->reservationID != sdrReservationID) &&
+ req->offset)
{
return IPMI_CC_INVALID_RESERVATION_ID;
}