Updated the close session to close any session
Added support in close session command to close not only the self
sessions but also other netipmid sessions.
With this support, now any netipmid instance will be able to close
any other netipmid instance's session.
Tested close session command for both self and other netipmid sessions:
Unit Tested:
Close the existing valid session by session id
ipmitool raw 0x6 0x3c <valid sesssion id >
Response : 00 // success
Close the existing valid session by session handle
ipmitool raw 0x6 0x3c <zero session id> <valid session handle>
Response : 00 // success
Close the session by zero session id
ipmitool raw 0x6 0x3c <zero session id>
Response : 0x87 // Inavlid Session Id
Close the session by zero session handle
ipmitool raw 0x6 0x3c <zero session id> <zero session handle>
Response : 0x88 // inavlid session handle
Close an inactive session.
ipmitool raw 0x6 0x3c <valid session id>
Response : 0xcc // invalid data field in request
Close an inactive session.
ipmitool raw 0x6 0x3c <zero session id> <valid session handle>
Response : 0xcc // invalid data field in request
Close high privilege session by session id.
ipmitool raw 0x6 0x3c <valid session id>
Response : 0xd4 // insufficient privilege level
Close high privilege session by session handle.
ipmitool raw 0x6 0x3c <zero session id> <valid session handle>
Response : 0xd4 // insufficient privilege level
Signed-off-by: Rajashekar Gade Reddy <raja.sekhar.reddy.gade@linux.intel.com>
Change-Id: Ieade8e342777a940d30248bb23f67dc3c787a001
diff --git a/command/session_cmds.hpp b/command/session_cmds.hpp
index 9737fdb..d5d394b 100644
--- a/command/session_cmds.hpp
+++ b/command/session_cmds.hpp
@@ -9,6 +9,10 @@
constexpr uint8_t IPMI_CC_INVALID_PRIV_LEVEL = 0x80;
constexpr uint8_t IPMI_CC_EXCEEDS_USER_PRIV = 0x81;
+// bits 30 & 31 (MSB) hold the instanceID, hence shifting by 30 bits
+constexpr uint8_t myNetInstanceSessionIdShiftMask = 30;
+// bits 6 & 7 (MSB) hold the instanceID, hence shifting by 6 bits
+constexpr uint8_t myNetInstanceSessionHandleShiftMask = 6;
/**
* @struct SetSessionPrivLevelReq
@@ -74,9 +78,6 @@
std::vector<uint8_t>
setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
const message::Handler& handler);
-
-constexpr uint8_t IPMI_CC_INVALID_SESSIONID = 0x87;
-
/**
* @struct CloseSessionRequest
*