summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Giudici <fgiudici@redhat.com>2018-01-10 18:14:16 +0100
committerFrancesco Giudici <fgiudici@redhat.com>2018-01-15 11:44:33 +0100
commit21fdaa0a1b26e0126c4337c09bfa5fe9ac692c41 (patch)
treefe5510681d2e5f2fd8370fd984afcab32380967a
parent1cf1843f9c511c36352cc15d5d8c94af2e307e91 (diff)
downloadNetworkManager-21fdaa0a1b26e0126c4337c09bfa5fe9ac692c41.tar.gz
device: always consider both ip families when deciding to fail
Example: when dhcpv4 lease renewal fails, if ipv4.may-fail was "yes", check also if we have a successful ipv6 conf: if not fail. Previously we just ignored the other ip family status.
-rw-r--r--src/devices/nm-device.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index a3a7be89f5..909233302e 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5598,6 +5598,32 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self)
activation_source_schedule (self, activate_stage2_device_config, AF_INET);
}
+static gboolean
+nm_device_ip_other_family_successful (NMDevice *self,
+ int addr_family)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ NMSettingIPConfig *s_ip;
+
+ s_ip = (NMSettingIPConfig *) nm_device_get_applied_setting (self,
+ addr_family == AF_INET ?
+ NM_TYPE_SETTING_IP6_CONFIG :
+ NM_TYPE_SETTING_IP4_CONFIG);
+ if (s_ip && nm_streq0 (nm_setting_ip_config_get_method (s_ip),
+ addr_family == AF_INET ?
+ NM_SETTING_IP6_CONFIG_METHOD_IGNORE :
+ NM_SETTING_IP4_CONFIG_METHOD_DISABLED))
+ return FALSE;
+
+ if ( addr_family == AF_INET
+ && priv->ip6_state != IP_DONE)
+ return FALSE;
+ if ( addr_family == AF_INET6
+ && priv->ip4_state != IP_DONE)
+ return FALSE;
+ return TRUE;
+}
+
void
nm_device_ip_method_failed (NMDevice *self,
int addr_family,
@@ -5608,9 +5634,11 @@ nm_device_ip_method_failed (NMDevice *self,
_set_ip_state (self, addr_family, IP_FAIL);
- if (get_ip_config_may_fail (self, addr_family))
+ if (!get_ip_config_may_fail (self, addr_family))
+ nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
+ else if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
check_ip_state (self, FALSE);
- else
+ else if (!nm_device_ip_other_family_successful (self, addr_family))
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
}