apphandler: Fix for get system info command
Issue: Get system info parameters command giving improper default
results for parameters 1,3,4,5,6,7.
Fix: Provided fix to return proper default response
Tested:
Verified using ipmitool raw commands
Command : ipmitool raw 0x06 0x59 0x00 0x01 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
cmd=0x59 rsp=0xcb): Requested sensor, data, or record not
found
Command : ipmitool raw 0x06 0x59 0x00 0x02 0x00 0x00
Response: 11 00 00 0a 69 6e 74 65 6c 2d 6f 62 6d 63 00 00
00 00
Command : ipmitool raw 0x06 0x59 0x00 0x03 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
cmd=0x59 rsp=0xcb): Requested sensor, data, or record not
found
Command : ipmitool raw 0x06 0x59 0x00 0x07 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
cmd=0x59 rsp=0xcb): Requested sensor, data, or record not
found
Command : ipmitool raw 0x06 0x59 0x00 0x08 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
cmd=0x59 rsp=0x80): Unknown (0x80)
Command : ipmitool raw 0x06 0x59 0x00 0x3f 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
cmd=0x59 rsp=0xcc): Invalid data field in request
Signed-off-by: Snehalatha V <SnehalathaX.V@intel.com>
Change-Id: I2a98b91bad199dc4eeac68b68972c3355cb5ec2f
diff --git a/apphandler.cpp b/apphandler.cpp
index 4ba637f..90818a9 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -1289,10 +1289,15 @@
uint8_t paramSelector, uint8_t setSelector,
uint8_t BlockSelector)
{
- if (reserved)
+ if (reserved || (paramSelector >= invalidParamSelectorStart &&
+ paramSelector <= invalidParamSelectorEnd))
{
return ipmi::responseInvalidFieldRequest();
}
+ if ((paramSelector >= oemCmdStart) && (paramSelector <= oemCmdEnd))
+ {
+ return ipmi::responseParmNotSupported();
+ }
if (getRevision)
{
return ipmi::responseSuccess(paramRevision, std::nullopt, std::nullopt);
@@ -1322,7 +1327,7 @@
bool found = std::get<0>(ret);
if (!found)
{
- return ipmi::responseParmNotSupported();
+ return ipmi::responseSensorInvalid();
}
std::string& paramString = std::get<1>(ret);
std::vector<uint8_t> configData;
@@ -1334,7 +1339,14 @@
count = std::min(paramString.length(), smallChunkSize);
configData.resize(count + configDataOverhead);
std::copy_n(paramString.begin(), count,
- configData.begin() + configDataOverhead); // 14 bytes thunk
+ configData.begin() + configDataOverhead); // 14 bytes chunk
+
+ // Append zero's to remaining bytes
+ if (configData.size() < configParameterLength)
+ {
+ std::fill_n(std::back_inserter(configData),
+ configParameterLength - configData.size(), 0x00);
+ }
}
else
{