Create error log if unable to fetch the interface info
Change-Id: I3e075fa04d7d0bb6f10b80d00a0aafd676be68e6
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 29517f9..6c5aec9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,14 +32,12 @@
xyz/openbmc_project/Network/IP/Create/server.cpp \
xyz/openbmc_project/Network/IP/Create/server.hpp
-
BUILT_SOURCES = \
xyz/openbmc_project/Network/VLAN/Create/server.cpp \
xyz/openbmc_project/Network/VLAN/Create/server.hpp \
xyz/openbmc_project/Network/IP/Create/server.cpp \
xyz/openbmc_project/Network/IP/Create/server.hpp
-
phosphor_network_manager_LDFLAGS = \
$(SYSTEMD_LIBS) \
$(SDBUSPLUS_LIBS) \
diff --git a/network_manager.cpp b/network_manager.cpp
index e140208..8ea82d5 100644
--- a/network_manager.cpp
+++ b/network_manager.cpp
@@ -1,8 +1,10 @@
#include "config.h"
#include "network_manager.hpp"
#include "network_config.hpp"
+#include "xyz/openbmc_project/Common/error.hpp"
#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog-errors.hpp>
#include <algorithm>
#include <bitset>
@@ -106,15 +108,15 @@
IntfAddrMap intfMap;
AddrList addrList;
struct ifaddrs* ifaddr;
+
+ using namespace sdbusplus::xyz::openbmc_project::Common::Error;
// attempt to fill struct with ifaddrs
if (getifaddrs(&ifaddr) == -1)
{
- log<level::ERR>("getifaddrs failed:",
- entry("ERRNO=%s", strerror(errno)));
-
- //TODO: openbmc/openbmc#1462 <create the error log>
-
- return intfMap;
+ auto error = errno;
+ log<level::ERR>("Error occurred during the getifaddrs call",
+ entry("ERRNO=%s", strerror(error)));
+ elog<InternalFailure>();
}
details::AddrPtr ifaddrPtr(ifaddr);