utils: don't assume a device with master won't have IP configuration

Whether the ip[46]-config exists is a better way, and we already check
that.
This commit is contained in:
Lubomir Rintel
2017-10-23 11:47:25 +02:00
parent 4391ba82dd
commit 67b265182f

View File

@@ -175,32 +175,24 @@ nm_utils_get_ip_config_method (NMConnection *connection,
if (ip_setting_type == NM_TYPE_SETTING_IP4_CONFIG) {
g_return_val_if_fail (s_con != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
if (nm_setting_connection_get_master (s_con))
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4)
return NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
else {
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4)
return NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
method = nm_setting_ip_config_get_method (s_ip4);
g_return_val_if_fail (method != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
method = nm_setting_ip_config_get_method (s_ip4);
g_return_val_if_fail (method != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
return method;
}
return method;
} else if (ip_setting_type == NM_TYPE_SETTING_IP6_CONFIG) {
g_return_val_if_fail (s_con != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
if (nm_setting_connection_get_master (s_con))
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6)
return NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
else {
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6)
return NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
method = nm_setting_ip_config_get_method (s_ip6);
g_return_val_if_fail (method != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
method = nm_setting_ip_config_get_method (s_ip6);
g_return_val_if_fail (method != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
return method;
}
return method;
} else
g_assert_not_reached ();