summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/channel.cpp16
-rw-r--r--transporthandler.cpp21
-rw-r--r--utils.cpp19
-rw-r--r--utils.hpp12
4 files changed, 36 insertions, 32 deletions
diff --git a/app/channel.cpp b/app/channel.cpp
index 72f1571..91d9987 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -97,10 +97,11 @@ ipmi_ret_t ipmi_set_channel_access(ipmi_netfn_t netfn,
// if the system is having ip object,then
// get the IP object.
- ipObject = ipmi::getDbusObject(bus,
- ipmi::network::IP_INTERFACE,
- ipmi::network::ROOT,
- ipmi::network::IP_TYPE);
+ ipObject = ipmi::getIPObject(
+ bus,
+ ipmi::network::IP_INTERFACE,
+ ipmi::network::ROOT,
+ ipmi::network::IP_TYPE);
// Get the parent interface of the IP object.
try
@@ -196,11 +197,8 @@ ipmi_ret_t ipmi_set_channel_access(ipmi_netfn_t netfn,
ipmi::network::IP_INTERFACE);
ipaddress = channelConfig.ipaddr.empty() ?
- ipmi::getIPAddress(bus,
- ipmi::network::IP_INTERFACE,
- ipmi::network::ROOT,
- ipmi::network::IP_TYPE) :
- channelConfig.ipaddr;
+ properties["Address"].get<std::string>() :
+ channelConfig.ipaddr;
prefix = channelConfig.netmask.empty() ?
properties["PrefixLength"].get<uint8_t>() :
diff --git a/transporthandler.cpp b/transporthandler.cpp
index a90891a..50bc473 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -49,10 +49,19 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data)
{
try
{
- ipaddress = ipmi::getIPAddress(bus,
- ipmi::network::IP_INTERFACE,
- ipmi::network::ROOT,
- ipmi::network::IP_TYPE);
+ auto ipObjectInfo = ipmi::getIPObject(
+ bus,
+ ipmi::network::IP_INTERFACE,
+ ipmi::network::ROOT,
+ ipmi::network::IP_TYPE);
+
+ auto properties = ipmi::getAllDbusProperties(
+ bus,
+ ipObjectInfo.second,
+ ipObjectInfo.first,
+ ipmi::network::IP_INTERFACE);
+
+ ipaddress = properties["Address"].get<std::string>();
}
// ignore the exception, as it is a valid condtion that
@@ -158,7 +167,7 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data)
{
try
{
- auto ipObjectInfo = ipmi::getDbusObject(
+ auto ipObjectInfo = ipmi::getIPObject(
bus,
ipmi::network::IP_INTERFACE,
ipmi::network::ROOT,
@@ -273,7 +282,7 @@ ipmi_ret_t getNetworkData(uint8_t lan_param, uint8_t* data)
{
try
{
- auto ipObjectInfo = ipmi::getDbusObject(
+ auto ipObjectInfo = ipmi::getIPObject(
bus,
ipmi::network::IP_INTERFACE,
ipmi::network::ROOT,
diff --git a/utils.cpp b/utils.cpp
index ea3a6aa..fa6bd04 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -96,10 +96,10 @@ DbusObjectInfo getDbusObject(sdbusplus::bus::bus& bus,
}
-std::string getIPAddress(sdbusplus::bus::bus& bus,
- const std::string& interface,
- const std::string& serviceRoot,
- const std::string& match)
+DbusObjectInfo getIPObject(sdbusplus::bus::bus& bus,
+ const std::string& interface,
+ const std::string& serviceRoot,
+ const std::string& match)
{
auto objectTree = getAllDbusObjects(bus, serviceRoot, interface, match);
@@ -110,7 +110,7 @@ std::string getIPAddress(sdbusplus::bus::bus& bus,
elog<InternalFailure>();
}
- std::string ipaddress;
+ DbusObjectInfo objectInfo;
for (auto& object : objectTree)
{
@@ -121,10 +121,10 @@ std::string getIPAddress(sdbusplus::bus::bus& bus,
ipmi::network::IP_INTERFACE,
"Address");
- ipaddress = std::move(variant.get<std::string>());
+ objectInfo = std::make_pair(object.first, object.second.begin()->first);
// if LinkLocalIP found look for Non-LinkLocalIP
- if (ipmi::network::isLinkLocalIP(ipaddress))
+ if (ipmi::network::isLinkLocalIP(variant.get<std::string>()))
{
continue;
}
@@ -132,11 +132,8 @@ std::string getIPAddress(sdbusplus::bus::bus& bus,
{
break;
}
-
}
-
- return ipaddress;
-
+ return objectInfo;
}
Value getDbusProperty(sdbusplus::bus::bus& bus,
diff --git a/utils.hpp b/utils.hpp
index 0b2b2db..55978fb 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -45,19 +45,19 @@ DbusObjectInfo getDbusObject(sdbusplus::bus::bus& bus,
const std::string& subtreePath = ROOT,
const std::string& match = {});
-/** @brief Gets the ipAddres of first dbus IP object of Non-LinkLocalIPAddress
+/** @brief Get the ipObject of first dbus IP object of Non-LinkLocalIPAddress
* type from the given subtree, if not available gets IP object of
* LinkLocalIPAddress type.
* @param[in] bus - DBUS Bus Object.
* @param[in] interface - Dbus interface.
* @param[in] subtreePath - subtree from where the search should start.
* @param[in] match - identifier for object.
- * @return On success returns the ipAddress.
+ * @return On success returns the object having objectpath and servicename.
*/
-std::string getIPAddress(sdbusplus::bus::bus& bus,
- const std::string& interface,
- const std::string& subtreePath,
- const std::string& match);
+DbusObjectInfo getIPObject(sdbusplus::bus::bus& bus,
+ const std::string& interface,
+ const std::string& subtreePath,
+ const std::string& match);
/** @brief Gets the value associated with the given object
* and the interface.
OpenPOWER on IntegriCloud