neighbor: Refactor out netlink code
This will allow us to re-use the generic netlink bits for other netlink
request operations.
Adds test coverage to the netlink message parsing routines for sanity
and regression prevention.
Tested:
Neighbor population still works when static neighbors are created on
the BMC.
Change-Id: I755e86eb76a8f6f825616c13279328134de87da9
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/neighbor.hpp b/neighbor.hpp
index e103d95..074cae0 100644
--- a/neighbor.hpp
+++ b/neighbor.hpp
@@ -3,12 +3,13 @@
#include "types.hpp"
#include "util.hpp"
-#include <netinet/in.h>
+#include <linux/netlink.h>
#include <optional>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
#include <string>
+#include <string_view>
#include <vector>
#include <xyz/openbmc_project/Network/Neighbor/server.hpp>
#include <xyz/openbmc_project/Object/Delete/server.hpp>
@@ -78,5 +79,13 @@
EthernetInterface& parent;
};
+namespace detail
+{
+
+void parseNeighbor(const nlmsghdr& hdr, std::string_view msg,
+ std::vector<NeighborInfo>& neighbors);
+
+} // namespace detail
+
} // namespace network
} // namespace phosphor