summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-11-12 10:46:30 -0800
committerPatrick Venture <venture@google.com>2018-11-13 11:07:44 -0800
commit4125880028cc4a825f710b9e1b09986aacd4e1bb (patch)
treeb6d8defec27f0aefd5ac9b82356a9dd931a95ec4 /main.cpp
parent45e428a2b22f5ba134fa07ede6be1f99d12a6c2c (diff)
downloadphosphor-ipmi-blobs-4125880028cc4a825f710b9e1b09986aacd4e1bb.tar.gz
phosphor-ipmi-blobs-4125880028cc4a825f710b9e1b09986aacd4e1bb.zip
process: add IPMI error return mechanism and update errors
The IPMI packet validation code must return specific IPMI errors corresponding to what error has occurred instead of the invalid command error. Update all IPMI handler pieces to return more specific errors. Change-Id: I8d21e92015d84cc0880e3b83991aed7288e19eab Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index dda9dec..4328567 100644
--- a/main.cpp
+++ b/main.cpp
@@ -47,15 +47,17 @@ static ipmi_ret_t handleBlobCommand(ipmi_cmd_t cmd, const uint8_t* reqBuf,
*/
if ((*dataLen) < 1)
{
- return IPMI_CC_INVALID;
+ return IPMI_CC_REQ_DATA_LEN_INVALID;
}
+ /* on failure rc is set to the corresponding IPMI error. */
+ ipmi_ret_t rc = IPMI_CC_OK;
Crc16 crc;
IpmiBlobHandler command =
- validateBlobCommand(&crc, reqBuf, replyCmdBuf, dataLen);
+ validateBlobCommand(&crc, reqBuf, replyCmdBuf, dataLen, &rc);
if (command == nullptr)
{
- return IPMI_CC_INVALID;
+ return rc;
}
return processBlobCommand(command, getBlobManager(), &crc, reqBuf,
OpenPOWER on IntegriCloud