ethernet_interface: Reduce error spam for addrs
Change-Id: I4c8a3ffdbd44f1c0a4cbc047dc6c5f41145b8324
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 3df966d..b3179f4 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -191,9 +191,17 @@
}
#endif
- this->addrs.insert_or_assign(
- info.ifaddr, std::make_unique<IPAddress>(bus, std::string_view(objPath),
- *this, info.ifaddr, origin));
+ auto it = addrs.find(info.ifaddr);
+ if (it == addrs.end())
+ {
+ addrs.emplace(info.ifaddr, std::make_unique<IPAddress>(
+ bus, std::string_view(objPath), *this,
+ info.ifaddr, origin));
+ }
+ else
+ {
+ it->second->IPIfaces::origin(origin);
+ }
}
void EthernetInterface::createIPAddressObjects()