ethernet_interface: Add error logging for ethtool queries
Change-Id: I385476e24bcef61f05350d89433ac2f9e5ce2225
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index c0f3a36..c2ded8c 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -333,8 +333,20 @@
duplex = edata.duplex;
autoneg = edata.autoneg;
}
- catch (const std::exception& e)
+ catch (const std::system_error& e)
{
+ if (e.code() == std::errc::operation_not_supported)
+ {
+ auto msg = fmt::format("ETHTOOL not supported on {}", ifr.ifr_name);
+ log<level::NOTICE>(msg.c_str(),
+ entry("INTERFACE=%s", ifr.ifr_name));
+ }
+ else
+ {
+ auto msg =
+ fmt::format("ETHTOOL failed on {}: {}", ifr.ifr_name, e.what());
+ log<level::ERR>(msg.c_str(), entry("INTERFACE=%s", ifr.ifr_name));
+ }
}
enabled = nicEnabled();