system_queries: Get Interface Info from netlink

This reduces all of the interface information probing down to a single
netlink request for all the label + mac information needed to build an
ethernet interface.

If we ever plumb the ethernet stats into dbus, we can get that
information with this same netlink code.

Change-Id: Ied8a73639dcd74bcfecda392905638573ab7970f
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index 3480a57..4db338e 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -5,8 +5,6 @@
 #include "xyz/openbmc_project/Network/IP/Create/server.hpp"
 #include "xyz/openbmc_project/Network/Neighbor/CreateStatic/server.hpp"
 
-#include <netinet/ether.h>
-
 #include <optional>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
@@ -49,23 +47,11 @@
 {
 class Parser;
 }
-
-/** @class InterfaceInfo
- *  @brief Information about interfaces from the kernel
- */
-struct InterfaceInfo
+namespace system
 {
-    bool running;
-    unsigned index;
-    std::string name;
-    std::optional<ether_addr> mac;
-    std::optional<unsigned> mtu;
+struct InterfaceInfo;
 };
 
-/** @brief Returns an InterfaceInfo for the given string name
- */
-InterfaceInfo getInterfaceInfo(stdplus::zstring_view ifname);
-
 /** @class EthernetInterface
  *  @brief OpenBMC Ethernet Interface implementation.
  *  @details A concrete implementation for the
@@ -92,12 +78,13 @@
      *  @param[in] enabled - Override the lookup of nicEnabled
      */
     EthernetInterface(sdbusplus::bus_t& bus, Manager& manager,
-                      const InterfaceInfo& info, std::string_view objRoot,
-                      const config::Parser& config, bool emitSignal = true,
+                      const system::InterfaceInfo& info,
+                      std::string_view objRoot, const config::Parser& config,
+                      bool emitSignal = true,
                       std::optional<bool> enabled = std::nullopt);
 
     /** @brief Updates the interface information based on new InterfaceInfo */
-    void updateInfo(const InterfaceInfo& info);
+    void updateInfo(const system::InterfaceInfo& info);
 
     /** @brief Function used to load the ntpservers
      */
@@ -221,7 +208,8 @@
      *         and creates the ip address dbus objects.
      *  @param[in] vlanID- VLAN identifier.
      */
-    void loadVLAN(std::string_view objRoot, uint16_t vlanID);
+    void loadVLAN(std::string_view objRoot, uint16_t vlanID,
+                  system::InterfaceInfo&& info);
 
     /** @brief write the network conf file with the in-memory objects.
      */
@@ -308,7 +296,7 @@
 
   private:
     EthernetInterface(sdbusplus::bus_t& bus, Manager& manager,
-                      const InterfaceInfo& info, std::string&& objPath,
+                      const system::InterfaceInfo& info, std::string&& objPath,
                       const config::Parser& config, bool emitSignal,
                       std::optional<bool> enabled);