utils: _get_ip_config_method(): don't assert a connection has IP config

nm_utils_get_shared_wifi_permission() that is called for each AddAndActivate
uses this and triggers an assertion failure for InifnibandConnections which
don't have IPv4 configuration:

NetworkManager[54006]: nm_utils_get_ip_config_method: assertion 's_ip4 != NULL' failed

  #2  0x000055555562b833 in nm_utils_get_ip_config_method (connection=connection@entry=0x5555559c3b60, ip_setting_type=93824996202304) at NetworkManagerUtils.c:1329
  #3  0x000055555562b914 in nm_utils_get_shared_wifi_permission (connection=0x5555559c3b60) at NetworkManagerUtils.c:1105
  #4  0x00005555555fc012 in nm_active_connection_authorize (self=0x5555559b30a0, result_func=0x55555561b980 <_add_and_activate_auth_done>, user_data1=0x555555957210, user_data2=0x555555a055f0)
      at nm-active-connection.c:683
  #5  0x0000555555621b21 in impl_manager_add_and_activate_connection (self=0x555555957210, settings=<optimized out>, device_path=<optimized out>, specific_object_path=0x0, context=0x555555a055f0)
      at nm-manager.c:3495
This commit is contained in:
Lubomir Rintel
2015-06-17 12:50:21 +02:00
parent 35dcd8ac33
commit 5e8182279a

View File

@@ -1447,7 +1447,8 @@ nm_utils_get_ip_config_method (NMConnection *connection,
return NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
else {
s_ip4 = nm_connection_get_setting_ip4_config (connection);
g_return_val_if_fail (s_ip4 != NULL, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
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);
@@ -1461,7 +1462,8 @@ nm_utils_get_ip_config_method (NMConnection *connection,
return NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
else {
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_return_val_if_fail (s_ip6 != NULL, NM_SETTING_IP6_CONFIG_METHOD_AUTO);
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);