oemcommands: Validate reserved field content
In "Set Processor Error Configuration" command, byte-1’s [7-2],
byte-2, byte-3's [7-1], bits are reserved and in "Disable BMC System
Reset Action" command, byte-1’s [7-1] bits are reserved. So return
"InvalidFieldRequest" when reserved content is non-zero.
Tested:
IPMI Command: Set Processor Error Configuration
Case 1: Byte 1 - reserved1 bits zero
Command: ipmitool raw 0x30 0x9b 0x03 0x0 0x01
Response: //Success
Case 2: Byte 1 - reserved1 bits non-zero
Command: ipmitool raw 0x30 0x9b 0xf3 0x0 0x01
Response: Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0
cmd=0x9b rsp=0xcc): Invalid data field in request
Case 3: Byte 2 - reserved2 bits zero
Command: ipmitool raw 0x30 0x9b 0x03 0x0 0x01
Response: //Success
Case 4: Byte 2 - reserved2 bits non-zero
Command: ipmitool raw 0x30 0x9b 0x03 0x1 0x01
Response: Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0
cmd=0x9b rsp=0xcc): Invalid data field in request
Case 5: If byte - 3 is not present
Command: ipmitool raw 0x30 0x9b 0x03 0x0
Response: //Success
Case 6: byte-3 with reserved portion(reserved3) zero
Command: ipmitool raw 0x30 0x9b 0x03 0x0 0x01
Response: //Success
Case 7: byte-3 with reserved portion (reserved3) non-zero.
Command: ipmitool raw 0x30 0x9b 0x03 0x0 0xf1
Response: Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0
cmd=0x9b rsp=0xcc): Invalid data field in request
IPMI Command: Disable BMC System Reset Action
Case 1: Byte-1 reserved portion (reserved1) non-zero.
Command : ipmitool raw 0x30 0x42 0x03
Response: Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0
cmd=0x42 rsp=0xcc): Invalid data field in request
Case 2: Byte-1 reserved portion (reserved1) is zero.
Command : ipmitool raw 0x30 0x42 0x01
Response: //Success
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I84a6e3be21d6101824867ff9f92b83be2e6aa406
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index fe589de..492d2b9 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -229,6 +229,11 @@
ipmi::RspType<> ipmiOEMDisableBMCSystemReset(bool disableResetOnSMI,
uint7_t reserved1)
{
+ if (reserved1)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+
std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
try
@@ -789,10 +794,19 @@
std::optional<bool> clearCPUErrorCount,
std::optional<bool> clearCrashdumpCount, std::optional<uint6_t> reserved3)
{
+ if (reserved1 || reserved2)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+
std::shared_ptr<sdbusplus::asio::connection> busp = getSdBus();
try
{
+ if (reserved3.value_or(0))
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
auto service = ipmi::getService(*busp, processorErrConfigIntf,
processorErrConfigObjPath);
ipmi::setDbusProperty(*busp, service, processorErrConfigObjPath,