summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-07-31 20:43:37 +0300
committerEd Tanous <ed.tanous@intel.com>2019-08-01 18:19:38 +0300
commitd0f63ef62c76c932a2003eaa42c0b250065ae06f (patch)
tree4c0e3cb32dc80f80460bdbf82ff6d401d4ff194f /meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net
parentb4f66bacb1b8e661d794fa7a189e2f66f5092e2e (diff)
downloadopenbmc-d0f63ef62c76c932a2003eaa42c0b250065ae06f.tar.xz
Update to internal 7-31-19
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0007-Adding-support-for-GetSessionInfo-command.patch418
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0008-Sync-GetSession-Info-cmd-based-on-Upstream-review.patch282
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch48
3 files changed, 28 insertions, 720 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0007-Adding-support-for-GetSessionInfo-command.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0007-Adding-support-for-GetSessionInfo-command.patch
deleted file mode 100644
index bbbe6ae4f..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0007-Adding-support-for-GetSessionInfo-command.patch
+++ /dev/null
@@ -1,418 +0,0 @@
-From b05fb3231810865ef1b6e627bb0452ae7a6c61f8 Mon Sep 17 00:00:00 2001
-From: ssekar <suryakanth.sekar@linux.intel.com>
-Date: Wed, 12 Dec 2018 16:04:15 +0530
-Subject: [PATCH 1/2] Adding support for GetSessionInfo command
-
-Description: user can get all session info (remote ip,port,
-session id, priv, etc) using this command.
-
-Verification :we can get all active and non active session
-info by session handle session id.
-Updated the Remote IP addr and Port update for sessioninfo.
-Unit testing are done.
-
-Change-Id: I662ef2b9f0c1d6bda331eb6481d7b9f34534541b
-Signed-off-by: ssekar <suryakanth.sekar@linux.intel.com>
----
- comm_module.cpp | 8 +++
- command/session_cmds.cpp | 147 +++++++++++++++++++++++++++++++++++++++
- command/session_cmds.hpp | 55 +++++++++++++++
- message_handler.cpp | 1 +
- sessions_manager.cpp | 55 +++++++++++++++
- sessions_manager.hpp | 7 ++
- socket_channel.hpp | 17 +++++
- 7 files changed, 290 insertions(+)
-
-diff --git a/comm_module.cpp b/comm_module.cpp
-index acc9089..7a1a17d 100644
---- a/comm_module.cpp
-+++ b/comm_module.cpp
-@@ -53,6 +53,14 @@ void sessionSetupCommands()
- &closeSession,
- session::Privilege::CALLBACK,
- false},
-+ // Session Info Command
-+ {
-+ {
-+ (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
-+ static_cast<uint16_t>(command::NetFns::APP) | 0x3D
-+ },
-+ &getSessionInfo, session::Privilege::USER, false
-+ },
- };
-
- for (auto& iter : commands)
-diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
-index 8606ce5..4beeb6e 100644
---- a/command/session_cmds.cpp
-+++ b/command/session_cmds.cpp
-@@ -8,6 +8,14 @@
- namespace command
- {
-
-+// Defined as per IPMI sepcification
-+static constexpr uint8_t searchCurrentSession = 0x00;
-+static constexpr uint8_t searchSessionByHandle = 0xFE;
-+static constexpr uint8_t searchSessionByID = 0xFF;
-+
-+static constexpr uint8_t ipmi15VerSession = 0x00;
-+static constexpr uint8_t ipmi20VerSession = 0x01;
-+
- std::vector<uint8_t>
- setSessionPrivilegeLevel(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler)
-@@ -92,4 +100,143 @@ std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
- return outPayload;
- }
-
-+std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
-+ const message::Handler& handler)
-+
-+{
-+ std::vector<uint8_t> outPayload(sizeof(GetSessionInfoResponse));
-+ auto request =
-+ reinterpret_cast<const GetSessionInfoRequest*>(inPayload.data());
-+ auto response =
-+ reinterpret_cast<GetSessionInfoResponse*>(outPayload.data());
-+ uint32_t reqSessionID = handler.sessionID;
-+ response->completionCode = IPMI_CC_OK;
-+ if (inPayload.size() == 1 && request->sessionIndex != 0)
-+ {
-+ if (request->sessionIndex <= session::MAX_SESSION_COUNT)
-+ {
-+ reqSessionID = std::get<session::Manager&>(singletonPool)
-+ .getSessionIDbyHandle(request->sessionIndex);
-+ }
-+ else
-+ {
-+ response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ }
-+
-+ // Here we look for session info according to session index parameter
-+ switch (request->sessionIndex)
-+ {
-+ // Look for current active session which this cmd is received over
-+ case searchCurrentSession:
-+ // Request data should only contain session index byte
-+ if (inPayload.size() != 1)
-+ {
-+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ // To look for current active session which the command came over,
-+ // the session ID cannot be 0.
-+ if (0 == reqSessionID)
-+ {
-+ response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ break;
-+ case searchSessionByHandle:
-+ // Request data should only contain session index byte and Session
-+ // handle
-+ if (inPayload.size() != 2)
-+ {
-+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+
-+ // Retrieve session id based on session handle
-+ if (request->sessionHandle <= session::MAX_SESSION_COUNT)
-+ {
-+ reqSessionID =
-+ std::get<session::Manager&>(singletonPool)
-+ .getSessionIDbyHandle(request->sessionHandle);
-+ }
-+ else
-+ {
-+ response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ break;
-+ case searchSessionByID:
-+ // Request data should only contain session index byte and Session
-+ // handle
-+ if (inPayload.size() != sizeof(GetSessionInfoRequest))
-+ {
-+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ reqSessionID = endian::from_ipmi(request->sessionID);
-+
-+ break;
-+ default:
-+ if (inPayload.size() != 1)
-+ {
-+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ }
-+
-+ response->totalSessionCount = session::MAX_SESSION_COUNT;
-+ response->activeSessioncount =
-+ std::get<session::Manager&>(singletonPool).getNoOfActiveSession();
-+ response->sessionHandle = 0;
-+ if (reqSessionID != 0)
-+ {
-+
-+ std::shared_ptr<session::Session> sessionInfo;
-+ try
-+ {
-+ sessionInfo = std::get<session::Manager&>(singletonPool)
-+ .getSession(reqSessionID);
-+ }
-+ catch (std::exception& e)
-+ {
-+ response->completionCode = IPMI_CC_UNSPECIFIED_ERROR;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ response->sessionHandle = std::get<session::Manager&>(singletonPool)
-+ .getSessionHandle(reqSessionID);
-+ uint8_t userId = ipmi::ipmiUserGetUserId(sessionInfo->userName);
-+ if (userId == ipmi::invalidUserId)
-+ {
-+ response->completionCode = IPMI_CC_UNSPECIFIED_ERROR;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return std::move(outPayload);
-+ }
-+ response->userID = userId; // userId;
-+ response->privLevel = static_cast<uint8_t>(sessionInfo->curPrivLevel);
-+ response->chanNum = sessionInfo->chNum; // byte7 3:0
-+ response->ipmiVer = ipmi20VerSession; // byte7 7:4
-+ response->remoteIpAddr =
-+ sessionInfo->channelPtr->getRemoteAddressInbytes();
-+ response->remotePort =
-+ sessionInfo->channelPtr->getPort(); // remoteSessionPort;
-+
-+ std::cerr << "\nSessionInfo:" << (int)reqSessionID;
-+ // TODO: Filling the Remote MACAddress
-+ }
-+ else
-+ {
-+ outPayload.resize(4);
-+ }
-+ return std::move(outPayload);
-+}
-+
- } // namespace command
-diff --git a/command/session_cmds.hpp b/command/session_cmds.hpp
-index 9737fdb..741de23 100644
---- a/command/session_cmds.hpp
-+++ b/command/session_cmds.hpp
-@@ -116,4 +116,59 @@ struct CloseSessionResponse
- std::vector<uint8_t> closeSession(const std::vector<uint8_t>& inPayload,
- const message::Handler& handler);
-
-+/**
-+ * @struct GetSessionInfoRequest
-+ *
-+ * IPMI Request data for getSession info command
-+ */
-+struct GetSessionInfoRequest
-+{
-+ uint8_t sessionIndex;
-+ union
-+ {
-+ uint8_t sessionHandle;
-+ uint32_t sessionID;
-+ };
-+} __attribute__((packed));
-+
-+/**
-+ * @struct getSessionInfoResponse
-+ *
-+ * IPMI Response data for getSession info command
-+ */
-+struct GetSessionInfoResponse
-+{
-+ uint8_t completionCode;
-+ uint8_t sessionHandle;
-+ uint8_t totalSessionCount;
-+ uint8_t activeSessioncount;
-+ uint8_t userID;
-+ uint8_t privLevel;
-+#if BYTE_ORDER == LITTLE_ENDIAN
-+ uint8_t chanNum : 4;
-+ uint8_t ipmiVer : 4;
-+#endif
-+#if BYTE_ORDER == BIG_ENDIAN
-+ uint8_t ipmiVer : 4;
-+ uint8_t chanNum : 4;
-+#endif
-+ uint32_t remoteIpAddr; // for channel private data
-+ uint8_t remoteMACAddr[6];
-+ uint16_t remotePort;
-+} __attribute__((packed));
-+
-+/**
-+ * @brief GetSessionInfo Command
-+ *
-+ * This command is used to get the session information based on
-+ * session handle or session ID. Retreive all session information.
-+
-+ * @param[in] inPayload - Request Data for the command
-+ * @param[in] handler - Reference to the Message Handler
-+ *
-+ * @return Response data for the command
-+ */
-+std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
-+ const message::Handler& handler);
-+
- } // namespace command
-diff --git a/message_handler.cpp b/message_handler.cpp
-index e2aafb3..b335236 100644
---- a/message_handler.cpp
-+++ b/message_handler.cpp
-@@ -43,6 +43,7 @@ bool Handler::receive()
- sessionID = inMessage->bmcSessionID;
- inMessage->rcSessionID = session->getRCSessionID();
- session->updateLastTransactionTime();
-+ session->channelPtr = channel;
-
- return true;
- }
-diff --git a/sessions_manager.cpp b/sessions_manager.cpp
-index 95a8a15..9f3210b 100644
---- a/sessions_manager.cpp
-+++ b/sessions_manager.cpp
-@@ -88,6 +88,9 @@ std::shared_ptr<Session>
- }
- sessionID = session->getBMCSessionID();
- sessionsMap.emplace(sessionID, session);
-+ storeSessionHandle(sessionID);
-+
-+
- return session;
- }
-
-@@ -149,12 +152,15 @@ std::shared_ptr<Session> Manager::getSession(SessionID sessionID,
-
- void Manager::cleanStaleEntries()
- {
-+ uint8_t sessionIndex = 0;
- for (auto iter = sessionsMap.begin(); iter != sessionsMap.end();)
- {
- auto session = iter->second;
- if ((session->getBMCSessionID() != SESSION_ZERO) &&
- !(session->isSessionActive()))
- {
-+ sessionIndex = getSessionHandle(session->getBMCSessionID());
-+ sessionHandleMap[sessionIndex] = 0;
- iter = sessionsMap.erase(iter);
- }
- else
-@@ -164,4 +170,53 @@ void Manager::cleanStaleEntries()
- }
- }
-
-+uint8_t Manager::storeSessionHandle(SessionID bmcSessionID)
-+{
-+ // Zero handler is reserved for invalid session.
-+ //index starts with 1, for direct usage. Index 0 reserved
-+ for (uint8_t i = 1; i <= MAX_SESSION_COUNT; i++)
-+ {
-+ if (sessionHandleMap[i] == 0)
-+ {
-+ sessionHandleMap[i] = bmcSessionID;
-+ break;
-+ }
-+ }
-+ return 0;
-+}
-+
-+uint32_t Manager::getSessionIDbyHandle(uint8_t sessionHandle) const
-+{
-+ if (sessionHandle <= MAX_SESSION_COUNT)
-+ {
-+ return sessionHandleMap[sessionHandle];
-+ }
-+ return 0;
-+}
-+
-+uint8_t Manager::getSessionHandle(SessionID bmcSessionID) const
-+{
-+
-+ for (uint8_t i = 1; i <= MAX_SESSION_COUNT; i++)
-+ {
-+ if (sessionHandleMap[i] == bmcSessionID)
-+ {
-+ return i;
-+ }
-+ }
-+ return 0;
-+}
-+uint8_t Manager::getNoOfActiveSession() const
-+{
-+ uint8_t count = 0;
-+ for (const auto& it : sessionsMap)
-+ {
-+ const auto& session = it.second;
-+ if (session->state == State::ACTIVE)
-+ {
-+ count++;
-+ }
-+ }
-+ return count;
-+}
- } // namespace session
-diff --git a/sessions_manager.hpp b/sessions_manager.hpp
-index 9fd38b1..f6ed1c3 100644
---- a/sessions_manager.hpp
-+++ b/sessions_manager.hpp
-@@ -82,8 +82,15 @@ class Manager
- std::shared_ptr<Session>
- getSession(SessionID sessionID,
- RetrieveOption option = RetrieveOption::BMC_SESSION_ID);
-+ uint8_t getNoOfActiveSession() const;
-+ uint8_t getSessionHandle(SessionID bmcSessionID) const;
-+ uint8_t storeSessionHandle(SessionID bmcSessionID);
-+ uint32_t getSessionIDbyHandle(uint8_t sessionHandle) const;
-
- private:
-+ //+1 for session, as 0 is reserved for sessionless command
-+ std::array<uint32_t, MAX_SESSION_COUNT + 1> sessionHandleMap;
-+
- /**
- * @brief Session Manager keeps the session objects as a sorted
- * associative container with Session ID as the unique key
-diff --git a/socket_channel.hpp b/socket_channel.hpp
-index ebe0c8f..349701e 100644
---- a/socket_channel.hpp
-+++ b/socket_channel.hpp
-@@ -64,6 +64,23 @@ class Channel
- return endpoint.port();
- }
-
-+ /**
-+ * @brief Return the binary representation of the remote IPv4 address
-+ *
-+ * getSessionInfo needs to return the remote IPv4 addresses of each session
-+ *
-+ * @return A uint32_t representation of the remote IPv4 address
-+ */
-+ std::uint32_t getRemoteAddressInbytes()
-+ {
-+ const boost::asio::ip::address& addr = endpoint.address();
-+ if (addr.is_v4())
-+ {
-+ return addr.to_v4().to_uint();
-+ }
-+ return 0;
-+ }
-+
- /**
- * @brief Read the incoming packet
- *
---
-2.17.1
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0008-Sync-GetSession-Info-cmd-based-on-Upstream-review.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0008-Sync-GetSession-Info-cmd-based-on-Upstream-review.patch
deleted file mode 100644
index c6b87bf4f..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0008-Sync-GetSession-Info-cmd-based-on-Upstream-review.patch
+++ /dev/null
@@ -1,282 +0,0 @@
-From a413e390563205476656a9005ca447f5b626872f Mon Sep 17 00:00:00 2001
-From: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
-Date: Wed, 6 Mar 2019 10:35:56 +0530
-Subject: [PATCH 2/2] Sync GetSession Info cmd based on Upstream review
-
-Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com>
----
- comm_module.cpp | 12 +++----
- command/session_cmds.cpp | 71 ++++++++++++++++++----------------------
- sessions_manager.cpp | 10 +++---
- sessions_manager.hpp | 2 +-
- socket_channel.hpp | 33 ++++++++++---------
- 5 files changed, 59 insertions(+), 69 deletions(-)
-
-diff --git a/comm_module.cpp b/comm_module.cpp
-index 7a1a17d..2546583 100644
---- a/comm_module.cpp
-+++ b/comm_module.cpp
-@@ -54,13 +54,11 @@ void sessionSetupCommands()
- session::Privilege::CALLBACK,
- false},
- // Session Info Command
-- {
-- {
-- (static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
-- static_cast<uint16_t>(command::NetFns::APP) | 0x3D
-- },
-- &getSessionInfo, session::Privilege::USER, false
-- },
-+ {{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
-+ static_cast<uint16_t>(command::NetFns::APP) | 0x3D},
-+ &getSessionInfo,
-+ session::Privilege::USER,
-+ false},
- };
-
- for (auto& iter : commands)
-diff --git a/command/session_cmds.cpp b/command/session_cmds.cpp
-index 4beeb6e..0c3a4ed 100644
---- a/command/session_cmds.cpp
-+++ b/command/session_cmds.cpp
-@@ -8,7 +8,7 @@
- namespace command
- {
-
--// Defined as per IPMI sepcification
-+// Defined as per IPMI specification
- static constexpr uint8_t searchCurrentSession = 0x00;
- static constexpr uint8_t searchSessionByHandle = 0xFE;
- static constexpr uint8_t searchSessionByID = 0xFF;
-@@ -111,20 +111,6 @@ std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
- reinterpret_cast<GetSessionInfoResponse*>(outPayload.data());
- uint32_t reqSessionID = handler.sessionID;
- response->completionCode = IPMI_CC_OK;
-- if (inPayload.size() == 1 && request->sessionIndex != 0)
-- {
-- if (request->sessionIndex <= session::MAX_SESSION_COUNT)
-- {
-- reqSessionID = std::get<session::Manager&>(singletonPool)
-- .getSessionIDbyHandle(request->sessionIndex);
-- }
-- else
-- {
-- response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
-- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-- }
-- }
-
- // Here we look for session info according to session index parameter
- switch (request->sessionIndex)
-@@ -132,29 +118,22 @@ std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
- // Look for current active session which this cmd is received over
- case searchCurrentSession:
- // Request data should only contain session index byte
-- if (inPayload.size() != 1)
-+ if (inPayload.size() != sizeof(request->sessionIndex))
- {
- response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-- }
-- // To look for current active session which the command came over,
-- // the session ID cannot be 0.
-- if (0 == reqSessionID)
-- {
-- response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
-- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
- break;
- case searchSessionByHandle:
- // Request data should only contain session index byte and Session
- // handle
-- if (inPayload.size() != 2)
-+ if (inPayload.size() != (sizeof(request->sessionIndex) +
-+ sizeof(request->sessionHandle)))
- {
- response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
-
- // Retrieve session id based on session handle
-@@ -168,7 +147,7 @@ std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
- {
- response->completionCode = IPMI_CC_INVALID_FIELD_REQUEST;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
- break;
- case searchSessionByID:
-@@ -178,23 +157,38 @@ std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
- {
- response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
- reqSessionID = endian::from_ipmi(request->sessionID);
-
- break;
- default:
-- if (inPayload.size() != 1)
-+ if (inPayload.size() == sizeof(request->sessionIndex))
-+ {
-+ if (request->sessionIndex <= session::MAX_SESSION_COUNT)
-+ {
-+ reqSessionID =
-+ std::get<session::Manager&>(singletonPool)
-+ .getSessionIDbyHandle(request->sessionIndex);
-+ }
-+ else
-+ {
-+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
-+ outPayload.resize(sizeof(response->completionCode));
-+ return outPayload;
-+ }
-+ }
-+ else
- {
- response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
- }
-
- response->totalSessionCount = session::MAX_SESSION_COUNT;
- response->activeSessioncount =
-- std::get<session::Manager&>(singletonPool).getNoOfActiveSession();
-+ std::get<session::Manager&>(singletonPool).getActiveSessionCount();
- response->sessionHandle = 0;
- if (reqSessionID != 0)
- {
-@@ -207,9 +201,9 @@ std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
- }
- catch (std::exception& e)
- {
-- response->completionCode = IPMI_CC_UNSPECIFIED_ERROR;
-+ response->completionCode = IPMI_CC_REQ_DATA_LEN_INVALID;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
- response->sessionHandle = std::get<session::Manager&>(singletonPool)
- .getSessionHandle(reqSessionID);
-@@ -218,25 +212,24 @@ std::vector<uint8_t> getSessionInfo(const std::vector<uint8_t>& inPayload,
- {
- response->completionCode = IPMI_CC_UNSPECIFIED_ERROR;
- outPayload.resize(sizeof(response->completionCode));
-- return std::move(outPayload);
-+ return outPayload;
- }
- response->userID = userId; // userId;
- response->privLevel = static_cast<uint8_t>(sessionInfo->curPrivLevel);
- response->chanNum = sessionInfo->chNum; // byte7 3:0
- response->ipmiVer = ipmi20VerSession; // byte7 7:4
-- response->remoteIpAddr =
-- sessionInfo->channelPtr->getRemoteAddressInbytes();
- response->remotePort =
- sessionInfo->channelPtr->getPort(); // remoteSessionPort;
-+ response->remoteIpAddr =
-+ sessionInfo->channelPtr->getRemoteAddressInBytes();
-
-- std::cerr << "\nSessionInfo:" << (int)reqSessionID;
- // TODO: Filling the Remote MACAddress
- }
- else
- {
- outPayload.resize(4);
- }
-- return std::move(outPayload);
-+ return outPayload;
- }
-
- } // namespace command
-diff --git a/sessions_manager.cpp b/sessions_manager.cpp
-index 9f3210b..c6897c6 100644
---- a/sessions_manager.cpp
-+++ b/sessions_manager.cpp
-@@ -152,15 +152,13 @@ std::shared_ptr<Session> Manager::getSession(SessionID sessionID,
-
- void Manager::cleanStaleEntries()
- {
-- uint8_t sessionIndex = 0;
- for (auto iter = sessionsMap.begin(); iter != sessionsMap.end();)
- {
- auto session = iter->second;
- if ((session->getBMCSessionID() != SESSION_ZERO) &&
- !(session->isSessionActive()))
- {
-- sessionIndex = getSessionHandle(session->getBMCSessionID());
-- sessionHandleMap[sessionIndex] = 0;
-+ sessionHandleMap[getSessionHandle(session->getBMCSessionID())] = 0;
- iter = sessionsMap.erase(iter);
- }
- else
-@@ -172,8 +170,8 @@ void Manager::cleanStaleEntries()
-
- uint8_t Manager::storeSessionHandle(SessionID bmcSessionID)
- {
-- // Zero handler is reserved for invalid session.
-- //index starts with 1, for direct usage. Index 0 reserved
-+ // Handler index 0 is reserved for invalid session.
-+ // index starts with 1, for direct usage. Index 0 reserved
- for (uint8_t i = 1; i <= MAX_SESSION_COUNT; i++)
- {
- if (sessionHandleMap[i] == 0)
-@@ -206,7 +204,7 @@ uint8_t Manager::getSessionHandle(SessionID bmcSessionID) const
- }
- return 0;
- }
--uint8_t Manager::getNoOfActiveSession() const
-+uint8_t Manager::getActiveSessionCount() const
- {
- uint8_t count = 0;
- for (const auto& it : sessionsMap)
-diff --git a/sessions_manager.hpp b/sessions_manager.hpp
-index f6ed1c3..3ff213e 100644
---- a/sessions_manager.hpp
-+++ b/sessions_manager.hpp
-@@ -82,7 +82,7 @@ class Manager
- std::shared_ptr<Session>
- getSession(SessionID sessionID,
- RetrieveOption option = RetrieveOption::BMC_SESSION_ID);
-- uint8_t getNoOfActiveSession() const;
-+ uint8_t getActiveSessionCount() const;
- uint8_t getSessionHandle(SessionID bmcSessionID) const;
- uint8_t storeSessionHandle(SessionID bmcSessionID);
- uint32_t getSessionIDbyHandle(uint8_t sessionHandle) const;
-diff --git a/socket_channel.hpp b/socket_channel.hpp
-index 349701e..8b64740 100644
---- a/socket_channel.hpp
-+++ b/socket_channel.hpp
-@@ -107,14 +107,15 @@ class Channel
- *
- * @return A uint32_t representation of the remote IPv4 address
- */
-- std::uint32_t getRemoteAddressInbytes()
-+ uint32_t getRemoteAddressInBytes() const
- {
-- const boost::asio::ip::address& addr = endpoint.address();
-- if (addr.is_v4())
-+ uint32_t v4addr = 0;
-+ if (sockAddrSize == sizeof(sockaddr_in))
- {
-- return addr.to_v4().to_uint();
-+ auto saddr = reinterpret_cast<const sockaddr_in*>(&remoteSockAddr);
-+ v4addr = ntohl(saddr->sin_addr.s_addr);
- }
-- return 0;
-+ return v4addr;
- }
-
- /**
---
-2.17.1
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch
index c90cccf34..dc7f7357c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0009-Add-dbus-interface-for-sol-commands.patch
@@ -1,6 +1,6 @@
-From 6b9aaf0304aed06e4b5ac53e7c163089568d4171 Mon Sep 17 00:00:00 2001
+From 97c21a556702a0d65096b30c07ef23f15cb6a7d9 Mon Sep 17 00:00:00 2001
From: Cheng C Yang <cheng.c.yang@intel.com>
-Date: Sat, 23 Mar 2019 04:03:07 +0800
+Date: Wed, 3 Jul 2019 07:39:47 +0800
Subject: [PATCH] Add dbus interface for sol commands
Add dbus interface for sol config parameters so that after move set/get
@@ -25,22 +25,24 @@ to 0 and other properties will not reset to default value.
Signed-off-by: Cheng C Yang <cheng.c.yang@intel.com>
---
- command/payload_cmds.cpp | 1 +
- command/sol_cmds.cpp | 84 ---------------------------------
- sol/sol_manager.cpp | 119 +++++++++++++++++++++++++++++++++++++++++++++++
+ command/payload_cmds.cpp | 3 ++
+ command/sol_cmds.cpp | 84 -------------------------------
+ sol/sol_manager.cpp | 125 +++++++++++++++++++++++++++++++++++++++++++++++
sol/sol_manager.hpp | 1 +
sol_module.cpp | 6 ---
- 5 files changed, 121 insertions(+), 90 deletions(-)
+ 5 files changed, 129 insertions(+), 90 deletions(-)
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
-index 3b5b4f8..570cdff 100644
+index c32a510..17167a7 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
-@@ -34,6 +34,7 @@ std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
+@@ -34,6 +34,9 @@ std::vector<uint8_t> activatePayload(const std::vector<uint8_t>& inPayload,
return outPayload;
}
-+ std::get<sol::Manager&>(singletonPool).updateSOLParameter();
++ std::get<sol::Manager&>(singletonPool)
++ .updateSOLParameter(ipmi::convertCurrentChannelNum(
++ ipmi::currentChNum, getInterfaceIndex()));
if (!std::get<sol::Manager&>(singletonPool).enable)
{
response->completionCode = IPMI_CC_PAYLOAD_TYPE_DISABLED;
@@ -140,7 +142,7 @@ index a8fa410..804b5ea 100644
const message::Handler& handler)
{
diff --git a/sol/sol_manager.cpp b/sol/sol_manager.cpp
-index 2046fe4..de36723 100644
+index 2046fe4..eedd28a 100644
--- a/sol/sol_manager.cpp
+++ b/sol/sol_manager.cpp
@@ -12,7 +12,13 @@
@@ -152,12 +154,12 @@ index 2046fe4..de36723 100644
+#include <sdbusplus/message/types.hpp>
+
+constexpr const char* solInterface = "xyz.openbmc_project.Ipmi.SOL";
-+constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol";
++constexpr const char* solPath = "/xyz/openbmc_project/ipmi/sol/";
+constexpr const char* PROP_INTF = "org.freedesktop.DBus.Properties";
namespace sol
{
-@@ -93,6 +99,119 @@ void Manager::stopHostConsole()
+@@ -93,6 +99,125 @@ void Manager::stopHostConsole()
}
}
@@ -221,17 +223,19 @@ index 2046fe4..de36723 100644
+ return properties;
+}
+
-+void Manager::updateSOLParameter()
++void Manager::updateSOLParameter(uint8_t channelNum)
+{
+ std::variant<uint8_t, bool> value;
+ sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection());
+ static std::string solService{};
+ ipmi::PropertyMap properties;
++ std::string ethdevice = ipmi::getChannelName(channelNum);
++ std::string solPathWitheEthName = solPath + ethdevice;
+ if (solService.empty())
+ {
+ try
+ {
-+ solService = getService(dbus, solInterface, solPath);
++ solService = getService(dbus, solInterface, solPathWitheEthName);
+ }
+ catch (const std::runtime_error& e)
+ {
@@ -243,8 +247,8 @@ index 2046fe4..de36723 100644
+ }
+ try
+ {
-+ properties =
-+ getAllDbusProperties(dbus, solService, solPath, solInterface);
++ properties = getAllDbusProperties(dbus, solService, solPathWitheEthName,
++ solInterface);
+ }
+ catch (const std::runtime_error&)
+ {
@@ -257,8 +261,12 @@ index 2046fe4..de36723 100644
+
+ enable = std::get<bool>(properties["Enable"]);
+
++ forceEncrypt = std::get<bool>(properties["ForceEncryption"]);
++
++ forceAuth = std::get<bool>(properties["ForceAuthentication"]);
++
+ solMinPrivilege = static_cast<session::Privilege>(
-+ std::get<uint8_t>(properties["Authentication"]));
++ std::get<uint8_t>(properties["Privilege"]));
+
+ accumulateInterval =
+ std::get<uint8_t>((properties["AccumulateIntervalMS"])) *
@@ -278,14 +286,14 @@ index 2046fe4..de36723 100644
session::SessionID sessionID)
{
diff --git a/sol/sol_manager.hpp b/sol/sol_manager.hpp
-index 5d96890..b7eb89e 100644
+index 5d96890..00da9fb 100644
--- a/sol/sol_manager.hpp
+++ b/sol/sol_manager.hpp
@@ -248,6 +248,7 @@ class Manager
* @return 0 on success and errno on failure.
*/
int writeConsoleSocket(const std::vector<uint8_t>& input) const;
-+ void updateSOLParameter(void);
++ void updateSOLParameter(uint8_t channelNum);
private:
SOLPayloadMap payloadMap;
@@ -307,5 +315,5 @@ index 8200e74..2b1fb46 100644
{{(static_cast<uint32_t>(message::PayloadType::IPMI) << 16) |
static_cast<uint16_t>(::command::NetFns::TRANSPORT) | 0x22},
--
-2.16.2
+2.7.4