From 67b265182f4173f1af321b4d0674dc540a2241a2 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 23 Oct 2017 11:47:25 +0200 Subject: [PATCH] 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. --- src/NetworkManagerUtils.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index b7a2faaa1..596c5bb36 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -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 ();