summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-03-14 23:35:35 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-03-15 16:41:20 +0100
commita75d6b8fbbdbcf39b02ed3ac2cddcae454aea3de (patch)
tree9e1ce0809c88fb267763fbd2aba81a80a26746da
parent135fa26dab204d2070e3afd4ec48664361961561 (diff)
downloadNetworkManager-a75d6b8fbbdbcf39b02ed3ac2cddcae454aea3de.tar.gz
device: fail DHCPv6 if a link-local address is not present
Instead of throwing an assertion, fail DHCPv6 when a IPv6 link-local address is not configured on the device. There are different reasons why the assertion may fail: for example the address was removed externally; or the device is gone (and thus the platform already received the notification of addresses removal) but the device is still connecting because its disposal happens in an idle callback. None of these deserves an assertion, which should only be for programming errors. https://bugzilla.redhat.com/show_bug.cgi?id=1432251 (cherry picked from commit 4987ec408a2e800de2278cd74e9f012dc69b8ed3) (cherry picked from commit 238fc872985809971c9439a08947dc29d22dad5c)
-rw-r--r--src/devices/nm-device.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 8155da03d9..1e4f7a763f 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5871,17 +5871,20 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection)
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);
+ if (priv->ext_ip6_config_captured)
+ ll_addr = nm_ip6_config_get_address_first_nontentative (priv->ext_ip6_config_captured, TRUE);
+
+ if (!ll_addr) {
+ _LOGW (LOGD_DHCP6, "can't start DHCPv6: no link-local address");
+ return FALSE;
+ }
+
hw_addr = nm_platform_link_get_address (NM_PLATFORM_GET, nm_device_get_ip_ifindex (self), &hw_addr_len);
if (hw_addr_len) {
tmp = g_byte_array_sized_new (hw_addr_len);
g_byte_array_append (tmp, hw_addr, hw_addr_len);
}
- if (priv->ext_ip6_config_captured)
- ll_addr = nm_ip6_config_get_address_first_nontentative (priv->ext_ip6_config_captured, TRUE);
-
- g_return_val_if_fail (ll_addr, FALSE);
-
priv->dhcp6.client = nm_dhcp_manager_start_ip6 (nm_dhcp_manager_get (),
nm_device_get_ip_iface (self),
nm_device_get_ip_ifindex (self),