test/ethernet_interface: Improve syscall test coverage
Change-Id: Ia71a030f2e2e19f2cc191992929ef08d0fa917c2
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 498cab8..529bb2a 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -141,7 +141,17 @@
// would be same as parent interface.
if (intfName.find(".") == std::string::npos)
{
- MacAddressIntf::macAddress(getMACAddress(intfName));
+ try
+ {
+ MacAddressIntf::macAddress(getMACAddress(intfName));
+ }
+ catch (const std::exception& e)
+ {
+ auto msg =
+ fmt::format("Failed to get MAC for {}: {}", intfName, e.what());
+ log<level::ERR>(msg.c_str(),
+ entry("INTERFACE=%s", intfName.c_str()));
+ }
}
EthernetInterfaceIntf::ntpServers(
config.map.getValueStrings("Network", "NTP"));