diff options
author | Patrick Venture <venture@google.com> | 2018-11-12 10:46:30 -0800 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2018-11-13 11:07:44 -0800 |
commit | 4125880028cc4a825f710b9e1b09986aacd4e1bb (patch) | |
tree | b6d8defec27f0aefd5ac9b82356a9dd931a95ec4 /ipmi.cpp | |
parent | 45e428a2b22f5ba134fa07ede6be1f99d12a6c2c (diff) | |
download | phosphor-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 'ipmi.cpp')
-rw-r--r-- | ipmi.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -105,7 +105,7 @@ ipmi_ret_t enumerateBlob(ManagerInterface* mgr, const uint8_t* reqBuf, std::string blobId = mgr->getBlobId(request.blobIdx); if (blobId == "") { - return IPMI_CC_INVALID; + return IPMI_CC_INVALID_FIELD_REQUEST; } /* TODO(venture): Need to do a hard-code check against the maximum @@ -130,13 +130,13 @@ ipmi_ret_t openBlob(ManagerInterface* mgr, const uint8_t* reqBuf, request->blobId, (requestLen - sizeof(struct BmcBlobOpenTx))); if (path.empty()) { - return IPMI_CC_INVALID; + return IPMI_CC_REQ_DATA_LEN_INVALID; } /* Attempt to open. */ if (!mgr->open(request->flags, path, &session)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } struct BmcBlobOpenRx reply; @@ -158,7 +158,7 @@ ipmi_ret_t closeBlob(ManagerInterface* mgr, const uint8_t* reqBuf, /* Attempt to close. */ if (!mgr->close(request.sessionId)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } (*dataLen) = 0; @@ -175,13 +175,13 @@ ipmi_ret_t deleteBlob(ManagerInterface* mgr, const uint8_t* reqBuf, request->blobId, (requestLen - sizeof(struct BmcBlobDeleteTx))); if (path.empty()) { - return IPMI_CC_INVALID; + return IPMI_CC_REQ_DATA_LEN_INVALID; } /* Attempt to delete. */ if (!mgr->deleteBlob(path)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } (*dataLen) = 0; @@ -220,14 +220,14 @@ ipmi_ret_t statBlob(ManagerInterface* mgr, const uint8_t* reqBuf, request->blobId, (requestLen - sizeof(struct BmcBlobStatTx))); if (path.empty()) { - return IPMI_CC_INVALID; + return IPMI_CC_REQ_DATA_LEN_INVALID; } /* Attempt to stat. */ struct BlobMeta meta; if (!mgr->stat(path, &meta)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } return returnStatBlob(&meta, replyCmdBuf, dataLen); @@ -244,7 +244,7 @@ ipmi_ret_t sessionStatBlob(ManagerInterface* mgr, const uint8_t* reqBuf, if (!mgr->stat(request.sessionId, &meta)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } return returnStatBlob(&meta, replyCmdBuf, dataLen); @@ -259,7 +259,7 @@ ipmi_ret_t commitBlob(ManagerInterface* mgr, const uint8_t* reqBuf, /* Sanity check the commitDataLen */ if (request->commitDataLen > (requestLen - sizeof(struct BmcBlobCommitTx))) { - return IPMI_CC_INVALID; + return IPMI_CC_REQ_DATA_LEN_INVALID; } std::vector<uint8_t> data(request->commitDataLen); @@ -267,7 +267,7 @@ ipmi_ret_t commitBlob(ManagerInterface* mgr, const uint8_t* reqBuf, if (!mgr->commit(request->sessionId, data)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } (*dataLen) = 0; @@ -317,7 +317,7 @@ ipmi_ret_t writeBlob(ManagerInterface* mgr, const uint8_t* reqBuf, /* Attempt to write the bytes. */ if (!mgr->write(request->sessionId, request->offset, data)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } return IPMI_CC_OK; @@ -342,7 +342,7 @@ ipmi_ret_t writeMeta(ManagerInterface* mgr, const uint8_t* reqBuf, /* Attempt to write the bytes. */ if (!mgr->writeMeta(request.sessionId, request.offset, data)) { - return IPMI_CC_INVALID; + return IPMI_CC_UNSPECIFIED_ERROR; } return IPMI_CC_OK; |