Currently, the value is read only once.
Fixes #11711.
if (link->network->bond)
return false;
+ if (manager_sysctl_ipv6_enabled(link->manager) == 0)
+ return false;
+
return link->network->dhcp & ADDRESS_FAMILY_IPV6;
}
if (link->network->bond)
return false;
+ if (manager_sysctl_ipv6_enabled(link->manager) == 0)
+ return false;
+
return link->network->link_local & ADDRESS_FAMILY_IPV6;
}
if (link->network->bridge || link->network->bond)
return false;
+ if (manager_sysctl_ipv6_enabled(link->manager) == 0)
+ return false;
+
/* DHCPv6 client will not be started if no IPv6 link-local address is configured. */
return link_ipv6ll_enabled(link) || network_has_static_ipv6_addresses(link->network);
}
if (link->network->ip_forward == _ADDRESS_FAMILY_BOOLEAN_INVALID)
return false;
+ if (manager_sysctl_ipv6_enabled(link->manager) == 0)
+ return false;
+
return link->network->ip_forward & ADDRESS_FAMILY_IPV6;
}
#include "path-util.h"
#include "set.h"
#include "strv.h"
+#include "sysctl-util.h"
#include "tmpfile-util.h"
#include "virt.h"
if (!m->state_file)
return -ENOMEM;
+ m->sysctl_ipv6_enabled = -1;
+
r = sd_event_default(&m->event);
if (r < 0)
return r;
return 0;
}
+
+int manager_sysctl_ipv6_enabled(Manager *manager) {
+ _cleanup_free_ char *value = NULL;
+ int r;
+
+ if (manager->sysctl_ipv6_enabled >= 0)
+ return manager->sysctl_ipv6_enabled;
+
+ r = sysctl_read_ip_property(AF_INET6, "all", "disable_ipv6", &value);
+ if (r < 0)
+ return log_warning_errno(r, "Failed to read net.ipv6.conf.all.disable_ipv6 sysctl property: %m");
+
+ manager->sysctl_ipv6_enabled = value[0] == '0';
+ return manager->sysctl_ipv6_enabled;
+}
Set *rules;
Set *rules_foreign;
Set *rules_saved;
+
+ int sysctl_ipv6_enabled;
};
extern const sd_bus_vtable manager_vtable[];
int manager_dhcp6_prefix_add(Manager *m, struct in6_addr *addr, Link *link);
int manager_dhcp6_prefix_remove_all(Manager *m, Link *link);
+int manager_sysctl_ipv6_enabled(Manager *manager);
+
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);