test: assume RTA_VIA is supported

RTA_VIA support was added in kernel v5.2:
d15662682d

Our baseline on the kernel is v5.4. Hence, we can assume that the
attribute is supported.
This commit is contained in:
Yu Watanabe
2025-07-03 12:35:37 +09:00
parent 16eaed02bc
commit 3d38732179
2 changed files with 3 additions and 22 deletions

View File

@@ -13,8 +13,6 @@
#include "sysctl-util.h"
#include "tests.h"
static bool support_rta_via = false;
static void print_local_addresses(const struct local_address *a, size_t n) {
FOREACH_ARRAY(i, a, n)
log_debug("%s ifindex=%i scope=%u priority=%"PRIu32" weight=%"PRIu32" address=%s",
@@ -136,7 +134,7 @@ static void check_local_gateways(sd_netlink *rtnl, int ifindex, int request_ifin
.family = AF_INET6,
.address = u,
}),
family == AF_UNSPEC && support_rta_via);
family == AF_UNSPEC);
ASSERT_OK(in_addr_from_string(AF_INET6, "2001:db8:1:123::1", &u));
ASSERT_EQ(has_local_address(a, n,
@@ -176,7 +174,7 @@ static void check_local_outbounds(sd_netlink *rtnl, int ifindex, int request_ifi
.family = AF_INET6,
.address = u,
}),
family == AF_UNSPEC && support_rta_via);
family == AF_UNSPEC);
ASSERT_OK(in_addr_from_string(AF_INET6, ipv6_expected, &u));
ASSERT_EQ(has_local_address(a, n,
@@ -282,12 +280,7 @@ TEST(local_addresses_with_dummy) {
.address = u,
}, sizeof(RouteVia)));
ASSERT_OK(sd_netlink_message_append_u32(message, RTA_OIF, ifindex));
r = sd_netlink_call(rtnl, message, 0, NULL);
if (r == -EINVAL)
log_debug_errno(r, "RTA_VIA is not supported, ignoring: %m");
else
ASSERT_OK(r);
support_rta_via = r >= 0;
ASSERT_OK(sd_netlink_call(rtnl, message, 0, NULL));
message = sd_netlink_message_unref(message);
/* Add an IPv6 default gateway */

View File

@@ -239,17 +239,6 @@ def expectedFailureIfNexthopIsNotAvailable():
return f
def expectedFailureIfRTA_VIAIsNotSupported():
def f(func):
call_quiet('ip link add dummy98 type dummy')
call_quiet('ip link set up dev dummy98')
call_quiet('ip route add 2001:1234:5:8fff:ff:ff:ff:fe/128 dev dummy98')
rc = call_quiet('ip route add 10.10.10.10 via inet6 2001:1234:5:8fff:ff:ff:ff:fe dev dummy98')
remove_link('dummy98')
return func if rc == 0 else unittest.expectedFailure(func)
return f
def expectedFailureIfAlternativeNameIsNotAvailable():
def f(func):
call_quiet('ip link add dummy98 type dummy')
@@ -4510,7 +4499,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'local fe80:[a-f0-9:]* table local proto kernel metric 0 pref medium', output)
self.assertIn('multicast ff00::/8 table local proto kernel metric 256 pref medium', output)
@expectedFailureIfRTA_VIAIsNotSupported()
def test_route_via_ipv6(self):
copy_network_unit('25-route-via-ipv6.network', '12-dummy.netdev')
start_networkd()