ethernet_interface: Fix updating sub objects

Neighbors and addresses should not fail to be added if similar objects
exist in the tree that need to be upgraded.

Change-Id: I6416c14025af28234de8a531753d7d59be11c455
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index e836268..1abcad2 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -241,10 +241,18 @@
             Argument::ARGUMENT_VALUE(std::to_string(prefixLength).c_str()));
     }
 
-    auto [it, _] = this->addrs.insert_or_assign(
-        ifaddr,
-        std::make_unique<IPAddress>(bus, std::string_view(objPath), *this,
-                                    ifaddr, IP::AddressOrigin::Static));
+    auto it = addrs.find(ifaddr);
+    if (it == addrs.end())
+    {
+        it = std::get<0>(addrs.emplace(
+            ifaddr,
+            std::make_unique<IPAddress>(bus, std::string_view(objPath), *this,
+                                        ifaddr, IP::AddressOrigin::Static)));
+    }
+    else
+    {
+        it->second->IPIfaces::origin(IP::AddressOrigin::Static);
+    }
 
     writeConfigurationFile();
     manager.reloadConfigs();
@@ -284,10 +292,18 @@
                               Argument::ARGUMENT_VALUE(macAddress.c_str()));
     }
 
-    auto [it, _] = staticNeighbors.emplace(
-        addr,
-        std::make_unique<Neighbor>(bus, std::string_view(objPath), *this, addr,
-                                   lladdr, Neighbor::State::Permanent));
+    auto it = staticNeighbors.find(addr);
+    if (it == staticNeighbors.end())
+    {
+        it = std::get<0>(staticNeighbors.emplace(
+            addr, std::make_unique<Neighbor>(bus, std::string_view(objPath),
+                                             *this, addr, lladdr,
+                                             Neighbor::State::Permanent)));
+    }
+    else
+    {
+        it->second->NeighborObj::macAddress(std::to_string(lladdr));
+    }
 
     writeConfigurationFile();
     manager.reloadConfigs();