summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-09-11 17:07:23 +0200
committerThomas Haller <thaller@redhat.com>2015-09-13 15:51:49 +0200
commit1ec0b4e7e889b7cedfd1883a48561c35b19cafdf (patch)
treec044fcffc516c025e793a03848e4b8ec39856f48
parent8192ef04dce336cc19d96f5997ee1787197662a7 (diff)
downloadNetworkManager-1ec0b4e7e889b7cedfd1883a48561c35b19cafdf.tar.gz
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)
-rw-r--r--src/devices/nm-device.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 99eaecc6ea..3a7d9919b9 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8226,15 +8226,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);
@@ -8247,29 +8241,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;