rtnetlink_server: Don't refresh for neighbors
They can be dynamically added and removed now.
Change-Id: Ia09cf6378d54b31e4957fb8e6f09d2e110dd53ae
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 4664655..e5a3110 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -213,20 +213,31 @@
}
}
+void EthernetInterface::addStaticNeigh(const NeighborInfo& info)
+{
+ if ((info.state & NUD_PERMANENT) == 0)
+ {
+ return;
+ }
+ if (!info.mac)
+ {
+ auto msg = fmt::format("Missing neighbor mac for `{}` on {}\n",
+ info.addr, interfaceName());
+ log<level::ERR>(msg.c_str());
+ return;
+ }
+ staticNeighbors.emplace(
+ info.addr, std::make_unique<Neighbor>(bus, std::string_view(objPath),
+ *this, info.addr, *info.mac,
+ Neighbor::State::Permanent));
+}
+
void EthernetInterface::createStaticNeighborObjects()
{
staticNeighbors.clear();
for (const auto& neighbor : system::getNeighbors({.ifidx = ifIdx}))
{
- if (!neighbor.mac || (neighbor.state & NUD_PERMANENT) == 0)
- {
- continue;
- }
- staticNeighbors.emplace(
- neighbor.addr,
- std::make_unique<Neighbor>(bus, std::string_view(objPath), *this,
- neighbor.addr, *neighbor.mac,
- Neighbor::State::Permanent));
+ addStaticNeigh(neighbor);
}
}
@@ -320,7 +331,7 @@
lladdr, Neighbor::State::Permanent));
writeConfigurationFile();
- manager.reloadConfigs();
+ manager.reloadConfigsNoRefresh();
return it->second->getObjPath();
}