]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: assume RTA_VIA is supported 38039/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Jul 2025 03:35:37 +0000 (12:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Jul 2025 03:51:22 +0000 (12:51 +0900)
RTA_VIA support was added in kernel v5.2:
https://github.com/torvalds/linux/commit/d15662682db232da77136cd348f4c9df312ca6f9

Our baseline on the kernel is v5.4. Hence, we can assume that the
attribute is supported.

src/test/test-local-addresses.c
test/test-network/systemd-networkd-tests.py

index 2380f28d19e6931caa050c7dad713daaef4f40fa..52622a851ff2b0b67c6a59e606e1405dc692519d 100644 (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 */
index 3aa288e6e9e9b2d553a9951af87fc327c6f1f607..dc867cd1d47da9e026177da9a6988a64f01b9618 100755 (executable)
@@ -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()