test-local-addresses: enable IPv6 on the test interface

If IPv6 is disabled by default, we need to explicitly enable IPv6 on the
interface. Otherwise, adding an IPv6 address or route will fail.
This commit is contained in:
Yu Watanabe
2025-07-03 12:31:55 +09:00
parent 11ad2b7169
commit 16eaed02bc

View 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));