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/handler.cpp b/handler.cpp
index a9f428e..d03632e 100644
--- a/handler.cpp
+++ b/handler.cpp
@@ -66,10 +66,14 @@
using InternalFailure =
sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-std::tuple<std::uint8_t, std::string> Handler::getEthDetails() const
+std::tuple<std::uint8_t, std::string>
+ Handler::getEthDetails(std::string intf) const
{
- return std::make_tuple<std::uint8_t, std::string>(
- ::ipmi::getChannelByName(NCSI_IF_NAME_STR), NCSI_IF_NAME_STR);
+ if (intf.empty())
+ {
+ intf = NCSI_IF_NAME_STR;
+ }
+ return std::make_tuple(::ipmi::getChannelByName(intf), std::move(intf));
}
std::int64_t Handler::getRxPackets(const std::string& name) const