eth: Support looking up alternate interace channels
This makes it possible to use the GetEthDevice command to look up
interfaces other than the default NCSI interface.
Change-Id: I3a5563743a28b39adc753d8957f68f0bc330cf3a
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/eth.cpp b/eth.cpp
index 127309a..0c85d28 100644
--- a/eth.cpp
+++ b/eth.cpp
@@ -40,8 +40,8 @@
#define MAX_IPMI_BUFFER 64
#endif
-ipmi_ret_t getEthDevice(const uint8_t*, uint8_t* replyBuf, size_t* dataLen,
- const HandlerInterface* handler)
+ipmi_ret_t getEthDevice(const uint8_t* reqBuf, uint8_t* replyBuf,
+ size_t* dataLen, const HandlerInterface* handler)
{
if ((*dataLen) < sizeof(struct EthDeviceRequest))
{
@@ -49,8 +49,11 @@
static_cast<uint32_t>(*dataLen));
return IPMI_CC_REQ_DATA_LEN_INVALID;
}
+ reqBuf += sizeof(struct EthDeviceRequest);
+ *dataLen -= sizeof(struct EthDeviceRequest);
- std::tuple<std::uint8_t, std::string> details = handler->getEthDetails();
+ std::tuple<std::uint8_t, std::string> details = handler->getEthDetails(
+ std::string(reinterpret_cast<const char*>(reqBuf), *dataLen));
std::string device = std::get<1>(details);
if (device.length() == 0)