device: don't disable IPv6 when NM is managing IPv6

If NM set addrgenmode=none, it's because it manages the IPv6 in user
space. In such case it should never disable IPv6.
This commit is contained in:
Beniamino Galvani 2021-11-05 15:17:33 +01:00
parent a319193333
commit bd7b5aa707

View file

@ -11398,6 +11398,14 @@ _dev_sysctl_restore_ip6_properties(NMDevice *self)
static void
_dev_sysctl_set_disable_ipv6(NMDevice *self, gboolean do_disable)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
/* If we previously set addrgenmode=none, we are managing
* IPv6 in user space and we should not disable it. */
if (do_disable && priv->addrgenmode6_data.previous_mode_has
&& priv->addrgenmode6_data.previous_mode_val == NM_IN6_ADDR_GEN_MODE_NONE)
return;
nm_device_sysctl_ip_conf_set(self, AF_INET6, "disable_ipv6", do_disable ? "1" : "0");
}