1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-27 03:21:32 +03:00

network: Do not disable IPv6 by writing to sysctl

Only enable is and do not disable IPv6
This commit is contained in:
Susant Sahani 2019-08-19 15:30:35 +05:30 committed by Zbigniew Jędrzejewski-Szmek
parent d0696f3b75
commit 482efedc08

View File

@ -330,19 +330,20 @@ static IPv6PrivacyExtensions link_ipv6_privacy_extensions(Link *link) {
}
static int link_enable_ipv6(Link *link) {
bool disabled;
bool enabled;
int r;
if (link->flags & IFF_LOOPBACK)
return 0;
disabled = !link_ipv6_enabled(link);
r = sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", disabled);
if (r < 0)
log_link_warning_errno(link, r, "Cannot %s IPv6: %m", enable_disable(!disabled));
else
log_link_info(link, "IPv6 successfully %sd", enable_disable(!disabled));
enabled = link_ipv6_enabled(link);
if (enabled) {
r = sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", false);
if (r < 0)
log_link_warning_errno(link, r, "Cannot enable IPv6: %m");
else
log_link_info(link, "IPv6 successfully enabled");
}
return 0;
}
@ -1281,10 +1282,6 @@ int link_set_mtu(Link *link, uint32_t mtu) {
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate RTM_SETLINK message: %m");
/* If IPv6 not configured (no static IPv6 address and IPv6LL autoconfiguration is disabled)
* for this interface, then disable IPv6 else enable it. */
(void) link_enable_ipv6(link);
/* IPv6 protocol requires a minimum MTU of IPV6_MTU_MIN(1280) bytes
* on the interface. Bump up MTU bytes to IPV6_MTU_MIN. */
if (link_ipv6_enabled(link) && mtu < IPV6_MIN_MTU) {
@ -2554,6 +2551,10 @@ static int link_configure(Link *link) {
return r;
}
/* If IPv6 configured that is static IPv6 address and IPv6LL autoconfiguration is enabled
* for this interface, then enable IPv6 */
(void) link_enable_ipv6(link);
r = link_set_proxy_arp(link);
if (r < 0)
return r;