treewide: Ignore non-ethernet devices

These are not regular ethernet devices that use INET protocols. We can
ignore them as they just produce journal spam otherwise.

Tested: Verified that our MCTP interfaces are no longer reported as
objects and that our NCSI and ETH interfaces are still added.

Change-Id: Idd5723e443b358fe76f039bcc4ce70390824094d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index a2d123d..e4108f3 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -11,6 +11,7 @@
 #include <fmt/format.h>
 #include <linux/rtnetlink.h>
 #include <net/if.h>
+#include <net/if_arp.h>
 
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/lg2.hpp>
@@ -563,6 +564,7 @@
         mac.emplace(ToAddr<ether_addr>{}(macStr));
     }
     auto info = AllIntfInfo{InterfaceInfo{
+        .type = ARPHRD_ETHER,
         .idx = 0, // TODO: Query the correct value after creation
         .flags = 0,
         .name = intfName,
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 85133c7..ca3b517 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -9,6 +9,7 @@
 #include <linux/if_addr.h>
 #include <linux/neighbour.h>
 #include <net/if.h>
+#include <net/if_arp.h>
 
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/lg2.hpp>
@@ -202,7 +203,7 @@
 
 void Manager::addInterface(const InterfaceInfo& info)
 {
-    if (info.flags & IFF_LOOPBACK)
+    if (info.type != ARPHRD_ETHER)
     {
         ignoredIntf.emplace(info.idx);
         return;
diff --git a/src/rtnetlink.cpp b/src/rtnetlink.cpp
index fd68671..1c80c1d 100644
--- a/src/rtnetlink.cpp
+++ b/src/rtnetlink.cpp
@@ -55,8 +55,9 @@
 {
     const auto& ifinfo = netlink::extractRtData<ifinfomsg>(msg);
     InterfaceInfo ret;
-    ret.flags = ifinfo.ifi_flags;
+    ret.type = ifinfo.ifi_type;
     ret.idx = ifinfo.ifi_index;
+    ret.flags = ifinfo.ifi_flags;
     while (!msg.empty())
     {
         auto [hdr, data] = netlink::extractRtAttr(msg);
diff --git a/src/types.hpp b/src/types.hpp
index ba4ee1a..6351b24 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -81,6 +81,7 @@
  */
 struct InterfaceInfo
 {
+    unsigned short type;
     unsigned idx;
     unsigned flags;
     std::optional<std::string> name = std::nullopt;