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:33:05 +0100
commit4987ec408a2e800de2278cd74e9f012dc69b8ed3 (patch)
treec403d4b925625cf4e18e25b26c7be1060bb6c5dd
parenta1325ebd7585e3cd596b78cfa5b0172b65dcdf02 (diff)
downloadNetworkManager-4987ec408a2e800de2278cd74e9f012dc69b8ed3.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
-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 5857b8f84c..aabea840ea 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6226,17 +6226,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),