]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-local-addresses: enable IPv6 on the test interface
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Jul 2025 03:31:55 +0000 (12:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Jul 2025 03:51:22 +0000 (12:51 +0900)
If IPv6 is disabled by default, we need to explicitly enable IPv6 on the
interface. Otherwise, adding an IPv6 address or route will fail.

src/test/test-local-addresses.c

index bf89d3420c30ea1c1d9c49aaa74de9a2cfe55c83..2380f28d19e6931caa050c7dad713daaef4f40fa 100644 (file)
@@ -10,6 +10,7 @@
 #include "in-addr-util.h"
 #include "local-addresses.h"
 #include "netlink-util.h"
+#include "sysctl-util.h"
 #include "tests.h"
 
 static bool support_rta_via = false;
@@ -217,6 +218,9 @@ TEST(local_addresses_with_dummy) {
         message = sd_netlink_message_unref(message);
         reply = sd_netlink_message_unref(reply);
 
+        /* Enable IPv6 for the case that it is disabled by default. */
+        ASSERT_OK(sysctl_write_ip_property_boolean(AF_INET6, "test-local-addr", "disable_ipv6", false, /* shadow = */ NULL));
+
         /* Bring the interface up */
         ASSERT_OK(sd_rtnl_message_new_link(rtnl, &message, RTM_SETLINK, ifindex));
         ASSERT_OK(sd_rtnl_message_link_set_flags(message, IFF_UP, IFF_UP));