diff options
author | Ratan Gupta <ratagupt@in.ibm.com> | 2017-05-15 21:52:14 +0530 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-06-08 13:41:37 +0000 |
commit | 44ae86e7d1298b05f25be8d6cd9af2938bcda5a4 (patch) | |
tree | f32cf70ee52331eebfb4c9262be74834760f2a21 | |
parent | d8edf11d78e66afc86f3167dcf456a1205dffe9e (diff) | |
download | phosphor-networkd-44ae86e7d1298b05f25be8d6cd9af2938bcda5a4.tar.gz phosphor-networkd-44ae86e7d1298b05f25be8d6cd9af2938bcda5a4.zip |
Create error log if unable to fetch the interface info
Change-Id: I3e075fa04d7d0bb6f10b80d00a0aafd676be68e6
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | network_manager.cpp | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 29517f9..6c5aec9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,14 +32,12 @@ CLEANFILES = \ 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 Manager::getInterfaceAddrs() const 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); |