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 b0815813fa)
This commit is contained in:
Thomas Haller 2015-09-11 17:07:23 +02:00
parent 8192ef04dc
commit 1ec0b4e7e8

View file

@ -8226,15 +8226,9 @@ nm_device_spawn_iface_helper (NMDevice *self)
dhcp4_address = find_dhcp4_address (self); dhcp4_address = find_dhcp4_address (self);
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG);
if ( priv->ip4_config if (g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) {
&& priv->ip4_state == IP_DONE
&& g_strcmp0 (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0
&& priv->dhcp4_client
&& dhcp4_address) {
NMSettingIPConfig *s_ip4; NMSettingIPConfig *s_ip4;
GBytes *client_id;
char *hex_client_id; char *hex_client_id;
const char *hostname;
s_ip4 = nm_connection_get_setting_ip4_config (connection); s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_assert (s_ip4); 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) if (nm_setting_ip_config_get_may_fail (s_ip4) == FALSE)
g_ptr_array_add (argv, g_strdup ("--dhcp4-required")); g_ptr_array_add (argv, g_strdup ("--dhcp4-required"));
client_id = nm_dhcp_client_get_client_id (priv->dhcp4_client); if (priv->dhcp4_client) {
if (client_id) { const char *hostname;
g_ptr_array_add (argv, g_strdup ("--dhcp4-clientid")); GBytes *client_id;
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); client_id = nm_dhcp_client_get_client_id (priv->dhcp4_client);
if (hostname) { if (client_id) {
g_ptr_array_add (argv, g_strdup ("--dhcp4-hostname")); g_ptr_array_add (argv, g_strdup ("--dhcp4-clientid"));
g_ptr_array_add (argv, g_strdup (hostname)); 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; configured = TRUE;
} }
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG);
if ( priv->ip6_config if (g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0) {
&& priv->ip6_state == IP_DONE
&& g_strcmp0 (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0
&& priv->rdisc
&& priv->ac_ip6_config) {
NMSettingIPConfig *s_ip6; NMSettingIPConfig *s_ip6;
char *hex_iid; char *hex_iid;
NMUtilsIPv6IfaceId iid = NM_UTILS_IPV6_IFACE_ID_INIT; NMUtilsIPv6IfaceId iid = NM_UTILS_IPV6_IFACE_ID_INIT;