Change the pointer type of ip address object
Make the ip address pointer shared as it was declared as shared,
but during creation of object it was being created as
unique.
It is required to be shared as the ip addresses
is being exposed through API to network manager.
Change-Id: Id520e89b1105dddb7178be638ce708eeeefa5be3
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
diff --git a/ethernet_interface.cpp b/ethernet_interface.cpp
index f29c482..3070670 100644
--- a/ethernet_interface.cpp
+++ b/ethernet_interface.cpp
@@ -79,9 +79,8 @@
gateway);
this->addrs.emplace(
- std::make_pair(
- addr.ipaddress,
- std::make_unique<phosphor::network::IPAddress>(
+ std::move(addr.ipaddress),
+ std::make_shared<phosphor::network::IPAddress>(
bus,
ipAddressObjectPath.c_str(),
*this,
@@ -89,7 +88,7 @@
addr.ipaddress,
origin,
addr.prefix,
- gateway)));
+ gateway));
}
}
@@ -115,16 +114,16 @@
gateway);
this->addrs.emplace(
- std::make_pair(ipaddress,
- std::make_unique<phosphor::network::IPAddress>(
- bus,
- objectPath.c_str(),
- *this,
- protType,
- ipaddress,
- origin,
- prefixLength,
- gateway)));
+ std::move(ipaddress),
+ std::make_shared<phosphor::network::IPAddress>(
+ bus,
+ objectPath.c_str(),
+ *this,
+ protType,
+ ipaddress,
+ origin,
+ prefixLength,
+ gateway));
manager.writeToConfigurationFile();
}