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/test/test_ethernet_interface.cpp b/test/test_ethernet_interface.cpp
index 7b72166..f6c59b1 100644
--- a/test/test_ethernet_interface.cpp
+++ b/test/test_ethernet_interface.cpp
@@ -4,6 +4,7 @@
#include "test_network_manager.hpp"
#include <net/if.h>
+#include <net/if_arp.h>
#include <sdbusplus/bus.hpp>
#include <stdplus/gtest/tmp.hpp>
@@ -40,7 +41,8 @@
makeInterface(stdplus::PinnedRef<sdbusplus::bus_t> bus,
TestManager& manager)
{
- AllIntfInfo info{InterfaceInfo{.idx = 1, .flags = 0, .name = "test0"}};
+ AllIntfInfo info{InterfaceInfo{
+ .type = ARPHRD_ETHER, .idx = 1, .flags = 0, .name = "test0"}};
return {bus, manager, info, "/xyz/openbmc_test/network"sv,
config::Parser()};
}
@@ -72,7 +74,8 @@
constexpr ether_addr mac{0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
constexpr unsigned mtu = 150;
- AllIntfInfo info{InterfaceInfo{.idx = 2,
+ AllIntfInfo info{InterfaceInfo{.type = ARPHRD_ETHER,
+ .idx = 2,
.flags = IFF_RUNNING,
.name = "test1",
.mac = mac,
diff --git a/test/test_netlink.cpp b/test/test_netlink.cpp
index 4514fa4..f256c3a 100644
--- a/test/test_netlink.cpp
+++ b/test/test_netlink.cpp
@@ -299,8 +299,10 @@
system::mock_clear();
for (unsigned i = 0; i < ifs; ++i)
{
- system::mock_addIF(InterfaceInfo{
- .idx = i + 1u, .flags = 0, .name = fmt::format("eth{}", i)});
+ system::mock_addIF(InterfaceInfo{.type = 1u,
+ .idx = i + 1u,
+ .flags = 0,
+ .name = fmt::format("eth{}", i)});
}
size_t cbCalls = 0;
diff --git a/test/test_network_manager.cpp b/test/test_network_manager.cpp
index 03d2944..304ddcd 100644
--- a/test/test_network_manager.cpp
+++ b/test/test_network_manager.cpp
@@ -2,6 +2,8 @@
#include "config_parser.hpp"
+#include <net/if_arp.h>
+
#include <sdbusplus/bus.hpp>
#include <stdplus/gtest/tmp.hpp>
@@ -40,7 +42,8 @@
TEST_F(TestNetworkManager, WithSingleInterface)
{
- manager.addInterface({.idx = 2, .flags = 0, .name = "igb1"});
+ manager.addInterface(
+ {.type = ARPHRD_ETHER, .idx = 2, .flags = 0, .name = "igb1"});
manager.handleAdminState("managed", 2);
// Now create the interfaces which will call the mocked getifaddrs
@@ -51,10 +54,12 @@
// getifaddrs returns two interfaces.
TEST_F(TestNetworkManager, WithMultipleInterfaces)
{
- manager.addInterface({.idx = 1, .flags = 0, .name = "igb0"});
+ manager.addInterface(
+ {.type = ARPHRD_ETHER, .idx = 1, .flags = 0, .name = "igb0"});
manager.handleAdminState("managed", 1);
manager.handleAdminState("unmanaged", 2);
- manager.addInterface({.idx = 2, .flags = 0, .name = "igb1"});
+ manager.addInterface(
+ {.type = ARPHRD_ETHER, .idx = 2, .flags = 0, .name = "igb1"});
EXPECT_THAT(manager.interfaces,
UnorderedElementsAre(Key("igb0"), Key("igb1")));
@@ -66,7 +71,8 @@
EXPECT_THROW(manager.vlan("", 0), std::exception);
EXPECT_THROW(manager.vlan("eth0", 2), std::exception);
- manager.addInterface({.idx = 1, .flags = 0, .name = "eth0"});
+ manager.addInterface(
+ {.type = ARPHRD_ETHER, .idx = 1, .flags = 0, .name = "eth0"});
manager.handleAdminState("managed", 1);
EXPECT_NO_THROW(manager.vlan("eth0", 2));
EXPECT_NO_THROW(manager.vlan("eth0", 4094));
diff --git a/test/test_rtnetlink.cpp b/test/test_rtnetlink.cpp
index 73a0f00..a0dddfe 100644
--- a/test/test_rtnetlink.cpp
+++ b/test/test_rtnetlink.cpp
@@ -21,10 +21,11 @@
{
ifinfomsg hdr __attribute__((aligned(NLMSG_ALIGNTO)));
} msg;
+ msg.hdr.ifi_type = 3;
msg.hdr.ifi_index = 1;
msg.hdr.ifi_flags = 2;
EXPECT_EQ(intfFromRtm(stdplus::raw::asView<char>(msg)),
- (InterfaceInfo{.idx = 1, .flags = 2}));
+ (InterfaceInfo{.type = 3, .idx = 1, .flags = 2}));
}
TEST(IntfFromRtm, AllAttrs)
@@ -40,6 +41,7 @@
rtattr mtu_hdr __attribute__((aligned((RTA_ALIGNTO))));
unsigned mtu __attribute__((aligned((RTA_ALIGNTO)))) = 50;
} msg;
+ msg.hdr.ifi_type = 4;
msg.hdr.ifi_index = 1;
msg.hdr.ifi_flags = 2;
msg.addr_hdr.rta_type = IFLA_ADDRESS;
@@ -50,7 +52,8 @@
msg.mtu_hdr.rta_len = RTA_LENGTH(sizeof(msg.mtu));
auto info = intfFromRtm(stdplus::raw::asView<char>(msg));
- auto expected = InterfaceInfo{.idx = 1,
+ auto expected = InterfaceInfo{.type = 4,
+ .idx = 1,
.flags = 2,
.name = "eth0",
.mac = ether_addr{0, 1, 2, 3, 4, 5},