From 60b7ecc242c6b6e485385c045b848702b0e9e0fb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 11 Sep 2015 17:07:23 +0200 Subject: [PATCH 1/1] iface-helper: enabled dhcp4/slaac according to IP method If at the moment when spawning nm-iface-helper dhcp4/slaac did not yet complete, we would not enable it. That is wrong. If the connection indicates to use dhcp4/slaac, it should be used by nm-iface-helper without considering the current state on the device. https://bugzilla.redhat.com/show_bug.cgi?id=1260243 (cherry picked from commit b0815813fa450c40e3a34ce5d6bb9c99aa26e605) (cherry picked from commit 1ec0b4e7e889b7cedfd1883a48561c35b19cafdf) --- src/devices/nm-device.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index b4e9252..d75bf5e 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -8206,15 +8206,9 @@ nm_device_spawn_iface_helper (NMDevice *self) dhcp4_address = find_dhcp4_address (self); method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); - if ( priv->ip4_config - && priv->ip4_state == IP_DONE - && g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0 - && priv->dhcp4_client - && dhcp4_address) { + if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) { NMSettingIPConfig *s_ip4; - GBytes *client_id; char *hex_client_id; - const char *hostname; s_ip4 = nm_connection_get_setting_ip4_config (connection); g_assert (s_ip4); @@ -8227,29 +8221,30 @@ nm_device_spawn_iface_helper (NMDevice *self) if (nm_setting_ip_config_get_may_fail (s_ip4) == FALSE) g_ptr_array_add (argv, g_strdup ("--dhcp4-required")); - client_id = nm_dhcp_client_get_client_id (priv->dhcp4_client); - if (client_id) { - g_ptr_array_add (argv, g_strdup ("--dhcp4-clientid")); - hex_client_id = bin2hexstr (g_bytes_get_data (client_id, NULL), - g_bytes_get_size (client_id)); - g_ptr_array_add (argv, hex_client_id); - } + if (priv->dhcp4_client) { + const char *hostname; + GBytes *client_id; - hostname = nm_dhcp_client_get_hostname (priv->dhcp4_client); - if (hostname) { - g_ptr_array_add (argv, g_strdup ("--dhcp4-hostname")); - g_ptr_array_add (argv, g_strdup (hostname)); + client_id = nm_dhcp_client_get_client_id (priv->dhcp4_client); + if (client_id) { + g_ptr_array_add (argv, g_strdup ("--dhcp4-clientid")); + hex_client_id = bin2hexstr (g_bytes_get_data (client_id, NULL), + g_bytes_get_size (client_id)); + g_ptr_array_add (argv, hex_client_id); + } + + hostname = nm_dhcp_client_get_hostname (priv->dhcp4_client); + if (hostname) { + g_ptr_array_add (argv, g_strdup ("--dhcp4-hostname")); + g_ptr_array_add (argv, g_strdup (hostname)); + } } configured = TRUE; } method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); - if ( priv->ip6_config - && priv->ip6_state == IP_DONE - && g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 - && priv->rdisc - && priv->ac_ip6_config) { + if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0) { NMSettingIPConfig *s_ip6; char *hex_iid; NMUtilsIPv6IfaceId iid = NM_UTILS_IPV6_IFACE_ID_INIT; -- 2.4.3