Blame SOURCES/0012-rh1262972-ifcfg-rh-network-GATEWAY.patch

ab7d06
From 12af09b779d70979516529c63633b7d296f82b47 Mon Sep 17 00:00:00 2001
ab7d06
From: Lubomir Rintel <lkundrak@v3.sk>
ab7d06
Date: Thu, 3 Sep 2015 18:15:46 +0200
ab7d06
Subject: [PATCH] test: fix duplicate test names
ab7d06
MIME-Version: 1.0
ab7d06
Content-Type: text/plain; charset=UTF-8
ab7d06
Content-Transfer-Encoding: 8bit
ab7d06
ab7d06
New glib complains.
ab7d06
ab7d06
(cherry picked from commit 874f455d6d47c5a34ed9861a6710f4b78202e0d6)
ab7d06
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
ab7d06
---
ab7d06
 libnm-core/tests/test-general.c                    |  20 +--
ab7d06
 src/devices/wifi/tests/test-wifi-ap-utils.c        | 137 +++++++--------------
ab7d06
 .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c         |  14 +--
ab7d06
 3 files changed, 62 insertions(+), 109 deletions(-)
ab7d06
ab7d06
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
ab7d06
index e948365..a73604b 100644
ab7d06
--- a/libnm-core/tests/test-general.c
ab7d06
+++ b/libnm-core/tests/test-general.c
ab7d06
@@ -4637,18 +4637,18 @@ int main (int argc, char **argv)
ab7d06
 	g_test_add_func ("/core/general/test_setting_to_dbus_enum", test_setting_to_dbus_enum);
ab7d06
 	g_test_add_func ("/core/general/test_setting_compare_id", test_setting_compare_id);
ab7d06
 	g_test_add_func ("/core/general/test_setting_compare_timestamp", test_setting_compare_timestamp);
ab7d06
-#define ADD_FUNC(func, secret_flags, comp_flags, remove_secret) \
ab7d06
-	g_test_add_data_func_full ("/core/general/" G_STRINGIFY (func), \
ab7d06
+#define ADD_FUNC(name, func, secret_flags, comp_flags, remove_secret) \
ab7d06
+	g_test_add_data_func_full ("/core/general/" G_STRINGIFY (func) "_" name, \
ab7d06
 	                           test_data_compare_secrets_new (secret_flags, comp_flags, remove_secret), \
ab7d06
 	                           func, g_free)
ab7d06
-	ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
ab7d06
-	ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
ab7d06
-	ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
ab7d06
-	ADD_FUNC (test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
ab7d06
-	ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
ab7d06
-	ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
ab7d06
-	ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
ab7d06
-	ADD_FUNC (test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
ab7d06
+	ADD_FUNC ("agent_owned", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
ab7d06
+	ADD_FUNC ("not_saved", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
ab7d06
+	ADD_FUNC ("secrets", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
ab7d06
+	ADD_FUNC ("exact", test_setting_compare_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
ab7d06
+	ADD_FUNC ("agent_owned", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_AGENT_OWNED, NM_SETTING_COMPARE_FLAG_IGNORE_AGENT_OWNED_SECRETS, TRUE);
ab7d06
+	ADD_FUNC ("not_saved", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
ab7d06
+	ADD_FUNC ("secrets", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
ab7d06
+	ADD_FUNC ("exact", test_setting_compare_vpn_secrets, NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
ab7d06
 	g_test_add_func ("/core/general/test_setting_old_uuid", test_setting_old_uuid);
ab7d06
 
ab7d06
 	g_test_add_func ("/core/general/test_connection_to_dbus_setting_name", test_connection_to_dbus_setting_name);
ab7d06
diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c
ab7d06
index 3c405e2..a5dc545 100644
ab7d06
--- a/src/devices/wifi/tests/test-wifi-ap-utils.c
ab7d06
+++ b/src/devices/wifi/tests/test-wifi-ap-utils.c
ab7d06
@@ -1364,10 +1364,10 @@ main (int argc, char **argv)
ab7d06
 	                      test_open_ap_leap_connection_1);
ab7d06
 	g_test_add_func ("/wifi/open_ap/leap_connection/2",
ab7d06
 	                 test_open_ap_leap_connection_2);
ab7d06
-	g_test_add_data_func ("/wifi/open_ap/wep_connection",
ab7d06
+	g_test_add_data_func ("/wifi/open_ap/wep_connection_true",
ab7d06
 	                      (gconstpointer) TRUE,
ab7d06
 	                      test_open_ap_wep_connection);
ab7d06
-	g_test_add_data_func ("/wifi/open_ap/wep_connection",
ab7d06
+	g_test_add_data_func ("/wifi/open_ap/wep_connection_false",
ab7d06
 	                      (gconstpointer) FALSE,
ab7d06
 	                      test_open_ap_wep_connection);
ab7d06
 
ab7d06
@@ -1441,104 +1441,57 @@ main (int argc, char **argv)
ab7d06
 	                      (gconstpointer) IDX_PRIV,
ab7d06
 	                      test_ap_wpa_eap_connection_5);
ab7d06
 
ab7d06
+#define ADD_FUNC(func) do { \
ab7d06
+		gchar *name_idx = g_strdup_printf ("/wifi/wpa_psk/" G_STRINGIFY (func) "/%ld", i); \
ab7d06
+		g_test_add_data_func (name_idx, (gconstpointer) i, func); \
ab7d06
+		g_free (name_idx); \
ab7d06
+	} while (0)
ab7d06
+
ab7d06
 	/* WPA-PSK tests */
ab7d06
 	for (i = IDX_WPA_PSK_PTKIP_GTKIP; i <= IDX_WPA_RSN_PSK_PCCMP_GCCMP; i++) {
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/empty_connection",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_empty_connection);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/leap_connection/1",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_leap_connection_1);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/leap_connection/2",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_leap_connection_2);
ab7d06
-
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/dynamic_wep_connection",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_dynamic_wep_connection);
ab7d06
-
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/1",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_1);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/2",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_2);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/3",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_3);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/4",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_4);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_psk_connection/5",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_5);
ab7d06
-
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/1",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_1);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/2",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_2);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/3",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_3);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/4",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_4);
ab7d06
-		g_test_add_data_func ("/wifi/wpa_psk/wpa_eap_connection/5",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_5);
ab7d06
+		ADD_FUNC(test_wpa_ap_empty_connection);
ab7d06
+		ADD_FUNC(test_wpa_ap_leap_connection_1);
ab7d06
+		ADD_FUNC(test_wpa_ap_leap_connection_2);
ab7d06
+		ADD_FUNC(test_wpa_ap_dynamic_wep_connection);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_1);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_2);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_3);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_4);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_5);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_1);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_2);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_3);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_4);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_5);
ab7d06
 	}
ab7d06
 
ab7d06
+#undef ADD_FUNC
ab7d06
+#define ADD_FUNC(func) do { \
ab7d06
+		gchar *name_idx = g_strdup_printf ("/wifi/rsn_psk/" G_STRINGIFY (func) "/%ld", i); \
ab7d06
+		g_test_add_data_func (name_idx, (gconstpointer) i, func); \
ab7d06
+		g_free (name_idx); \
ab7d06
+	} while (0)
ab7d06
+
ab7d06
 	/* RSN-PSK tests */
ab7d06
 	for (i = IDX_WPA_RSN_PSK_PTKIP_PCCMP_GTKIP; i <= IDX_RSN_PSK_PTKIP_PCCMP_GTKIP; i++) {
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/empty_connection",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_empty_connection);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/leap_connection/1",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_leap_connection_1);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/leap_connection/2",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_leap_connection_2);
ab7d06
-
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/dynamic_wep_connection",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_dynamic_wep_connection);
ab7d06
-
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/1",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_1);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/2",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_2);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/3",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_3);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/4",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_4);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_psk_connection/5",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_wpa_ap_wpa_psk_connection_5);
ab7d06
-
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/1",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_1);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/2",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_2);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/3",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_3);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/4",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_4);
ab7d06
-		g_test_add_data_func ("/wifi/rsn_psk/wpa_eap_connection/5",
ab7d06
-		                      (gconstpointer) i,
ab7d06
-		                      test_ap_wpa_eap_connection_5);
ab7d06
+		ADD_FUNC(test_wpa_ap_empty_connection);
ab7d06
+		ADD_FUNC(test_wpa_ap_leap_connection_1);
ab7d06
+		ADD_FUNC(test_wpa_ap_leap_connection_2);
ab7d06
+		ADD_FUNC(test_wpa_ap_dynamic_wep_connection);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_1);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_2);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_3);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_4);
ab7d06
+		ADD_FUNC(test_wpa_ap_wpa_psk_connection_5);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_1);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_2);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_3);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_4);
ab7d06
+		ADD_FUNC(test_ap_wpa_eap_connection_5);
ab7d06
 	}
ab7d06
 
ab7d06
+#undef ADD_FUNC
ab7d06
+
ab7d06
 	/* Scanned signal strength conversion tests */
ab7d06
 	g_test_add_func ("/wifi/strength/dbm",
ab7d06
 	                 test_strength_dbm);
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
ab7d06
index f2f85d3..953b0c7 100644
ab7d06
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
ab7d06
@@ -12604,12 +12604,12 @@ int main (int argc, char **argv)
ab7d06
 	test_read_wired_static (TEST_IFCFG_WIRED_STATIC, "System test-wired-static", TRUE);
ab7d06
 	test_read_wired_static (TEST_IFCFG_WIRED_STATIC_BOOTPROTO, "System test-wired-static-bootproto", FALSE);
ab7d06
 	test_read_wired_dhcp ();
ab7d06
-	g_test_add_func (TPATH "dhcp-plus-ip", test_read_wired_dhcp_plus_ip);
ab7d06
-	g_test_add_func (TPATH "shared-plus-ip", test_read_wired_shared_plus_ip);
ab7d06
-	g_test_add_func (TPATH "dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname);
ab7d06
-	g_test_add_func (TPATH "global-gateway", test_read_wired_global_gateway);
ab7d06
-	g_test_add_func (TPATH "obsolete-gateway-n", test_read_wired_obsolete_gateway_n);
ab7d06
-	g_test_add_func (TPATH "never-default", test_read_wired_never_default);
ab7d06
+	g_test_add_func (TPATH "read-dhcp-plus-ip", test_read_wired_dhcp_plus_ip);
ab7d06
+	g_test_add_func (TPATH "read-shared-plus-ip", test_read_wired_shared_plus_ip);
ab7d06
+	g_test_add_func (TPATH "read-dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname);
ab7d06
+	g_test_add_func (TPATH "read-global-gateway", test_read_wired_global_gateway);
ab7d06
+	g_test_add_func (TPATH "read-obsolete-gateway-n", test_read_wired_obsolete_gateway_n);
ab7d06
+	g_test_add_func (TPATH "read-never-default", test_read_wired_never_default);
ab7d06
 	test_read_wired_defroute_no ();
ab7d06
 	test_read_wired_defroute_no_gatewaydev_yes ();
ab7d06
 	g_test_add_func (TPATH "routes/read-static", test_read_wired_static_routes);
ab7d06
@@ -12679,7 +12679,7 @@ int main (int argc, char **argv)
ab7d06
 	test_write_wired_static_routes ();
ab7d06
 	test_read_write_static_routes_legacy ();
ab7d06
 	test_write_wired_dhcp ();
ab7d06
-	g_test_add_func (TPATH "dhcp-plus-ip", test_write_wired_dhcp_plus_ip);
ab7d06
+	g_test_add_func (TPATH "wired/write-dhcp-plus-ip", test_write_wired_dhcp_plus_ip);
ab7d06
 	test_write_wired_dhcp_8021x_peap_mschapv2 ();
ab7d06
 	test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_AGENT_OWNED);
ab7d06
 	test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_NOT_SAVED);
ab7d06
-- 
ab7d06
2.1.0
ab7d06
ab7d06
ab7d06
From 317b6cb880b6afbb11a6578bc3791cb6eba5f2e7 Mon Sep 17 00:00:00 2001
ab7d06
From: Lubomir Rintel <lkundrak@v3.sk>
ab7d06
Date: Fri, 4 Sep 2015 12:49:54 +0200
ab7d06
Subject: [PATCH] tests: fix 32-bit build
ab7d06
MIME-Version: 1.0
ab7d06
Content-Type: text/plain; charset=UTF-8
ab7d06
Content-Transfer-Encoding: 8bit
ab7d06
ab7d06
Fixes: 874f455d6d47c5a34ed9861a6710f4b78202e0d6
ab7d06
(cherry picked from commit f71f9d5fcf5726f9be5ac0c97e7dbc26c3e57ecc)
ab7d06
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
ab7d06
---
ab7d06
 src/devices/wifi/tests/test-wifi-ap-utils.c | 4 ++--
ab7d06
 1 file changed, 2 insertions(+), 2 deletions(-)
ab7d06
ab7d06
diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c
ab7d06
index a5dc545..26e130c 100644
ab7d06
--- a/src/devices/wifi/tests/test-wifi-ap-utils.c
ab7d06
+++ b/src/devices/wifi/tests/test-wifi-ap-utils.c
ab7d06
@@ -1442,7 +1442,7 @@ main (int argc, char **argv)
ab7d06
 	                      test_ap_wpa_eap_connection_5);
ab7d06
 
ab7d06
 #define ADD_FUNC(func) do { \
ab7d06
-		gchar *name_idx = g_strdup_printf ("/wifi/wpa_psk/" G_STRINGIFY (func) "/%ld", i); \
ab7d06
+		gchar *name_idx = g_strdup_printf ("/wifi/wpa_psk/" G_STRINGIFY (func) "/%zd", i); \
ab7d06
 		g_test_add_data_func (name_idx, (gconstpointer) i, func); \
ab7d06
 		g_free (name_idx); \
ab7d06
 	} while (0)
ab7d06
@@ -1467,7 +1467,7 @@ main (int argc, char **argv)
ab7d06
 
ab7d06
 #undef ADD_FUNC
ab7d06
 #define ADD_FUNC(func) do { \
ab7d06
-		gchar *name_idx = g_strdup_printf ("/wifi/rsn_psk/" G_STRINGIFY (func) "/%ld", i); \
ab7d06
+		gchar *name_idx = g_strdup_printf ("/wifi/rsn_psk/" G_STRINGIFY (func) "/%zd", i); \
ab7d06
 		g_test_add_data_func (name_idx, (gconstpointer) i, func); \
ab7d06
 		g_free (name_idx); \
ab7d06
 	} while (0)
ab7d06
-- 
ab7d06
2.1.0
ab7d06
ab7d06
ab7d06
From 827b49f0894168197096f3e2249b5f621b94617a Mon Sep 17 00:00:00 2001
ab7d06
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
ab7d06
Date: Tue, 15 Sep 2015 15:27:25 +0200
ab7d06
Subject: [PATCH 1/2] ifcfg-rh: (trivial) remove unused network_file parameter
ab7d06
MIME-Version: 1.0
ab7d06
Content-Type: text/plain; charset=UTF-8
ab7d06
Content-Transfer-Encoding: 8bit
ab7d06
ab7d06
(cherry picked from commit 64e3873faf290f07404745ec3b78348c4527bcd6)
ab7d06
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
ab7d06
---
ab7d06
 src/settings/plugins/ifcfg-rh/reader.c | 19 +++++++------------
ab7d06
 1 file changed, 7 insertions(+), 12 deletions(-)
ab7d06
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
ab7d06
index 72123e6..1c0f55c 100644
ab7d06
--- a/src/settings/plugins/ifcfg-rh/reader.c
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/reader.c
ab7d06
@@ -346,7 +346,6 @@ is_any_ip4_address_defined (shvarFile *ifcfg, int *idx)
ab7d06
 /* Returns TRUE on missing address or valid address */
ab7d06
 static gboolean
ab7d06
 read_full_ip4_address (shvarFile *ifcfg,
ab7d06
-                       const char *network_file,
ab7d06
                        gint32 which,
ab7d06
                        NMIPAddress *base_addr,
ab7d06
                        NMIPAddress **out_address,
ab7d06
@@ -362,7 +361,6 @@ read_full_ip4_address (shvarFile *ifcfg,
ab7d06
 
ab7d06
 	g_return_val_if_fail (which >= -1, FALSE);
ab7d06
 	g_return_val_if_fail (ifcfg != NULL, FALSE);
ab7d06
-	g_return_val_if_fail (network_file != NULL, FALSE);
ab7d06
 	g_return_val_if_fail (out_address != NULL, FALSE);
ab7d06
 	g_return_val_if_fail (*out_address == NULL, FALSE);
ab7d06
 	if (error)
ab7d06
@@ -452,7 +450,6 @@ done:
ab7d06
 /* Returns TRUE on missing route or valid route */
ab7d06
 static gboolean
ab7d06
 read_one_ip4_route (shvarFile *ifcfg,
ab7d06
-                    const char *network_file,
ab7d06
                     guint32 which,
ab7d06
                     NMIPRoute **out_route,
ab7d06
                     GError **error)
ab7d06
@@ -463,7 +460,6 @@ read_one_ip4_route (shvarFile *ifcfg,
ab7d06
 	gboolean success = FALSE;
ab7d06
 
ab7d06
 	g_return_val_if_fail (ifcfg != NULL, FALSE);
ab7d06
-	g_return_val_if_fail (network_file != NULL, FALSE);
ab7d06
 	g_return_val_if_fail (out_route != NULL, FALSE);
ab7d06
 	g_return_val_if_fail (*out_route == NULL, FALSE);
ab7d06
 	if (error)
ab7d06
@@ -684,7 +680,6 @@ error:
ab7d06
 
ab7d06
 static gboolean
ab7d06
 parse_full_ip6_address (shvarFile *ifcfg,
ab7d06
-                        const char *network_file,
ab7d06
                         const char *addr_str,
ab7d06
                         int i,
ab7d06
                         NMIPAddress **out_address,
ab7d06
@@ -962,7 +957,7 @@ make_ip4_setting (shvarFile *ifcfg,
ab7d06
 		if (is_any_ip4_address_defined (ifcfg, &idx)) {
ab7d06
 			NMIPAddress *addr = NULL;
ab7d06
 
ab7d06
-			if (!read_full_ip4_address (ifcfg, network_file, idx, NULL, &addr, NULL, error))
ab7d06
+			if (!read_full_ip4_address (ifcfg, idx, NULL, &addr, NULL, error))
ab7d06
 				goto done;
ab7d06
 			if (!read_ip4_address (ifcfg, "GATEWAY", &gateway, error))
ab7d06
 				goto done;
ab7d06
@@ -1020,7 +1015,7 @@ make_ip4_setting (shvarFile *ifcfg,
ab7d06
 
ab7d06
 		/* gateway will only be set if still unset. Hence, we don't leak gateway
ab7d06
 		 * here by calling read_full_ip4_address() repeatedly */
ab7d06
-		if (!read_full_ip4_address (ifcfg, network_file, i, NULL, &addr, &gateway, error))
ab7d06
+		if (!read_full_ip4_address (ifcfg, i, NULL, &addr, &gateway, error))
ab7d06
 			goto done;
ab7d06
 
ab7d06
 		if (!addr) {
ab7d06
@@ -1108,7 +1103,7 @@ make_ip4_setting (shvarFile *ifcfg,
ab7d06
 			for (i = 0; i < 256; i++) {
ab7d06
 				NMIPRoute *route = NULL;
ab7d06
 
ab7d06
-				if (!read_one_ip4_route (route_ifcfg, network_file, i, &route, error)) {
ab7d06
+				if (!read_one_ip4_route (route_ifcfg, i, &route, error)) {
ab7d06
 					svCloseFile (route_ifcfg);
ab7d06
 					goto done;
ab7d06
 				}
ab7d06
@@ -1158,7 +1153,7 @@ done:
ab7d06
 }
ab7d06
 
ab7d06
 static void
ab7d06
-read_aliases (NMSettingIPConfig *s_ip4, const char *filename, const char *network_file)
ab7d06
+read_aliases (NMSettingIPConfig *s_ip4, const char *filename)
ab7d06
 {
ab7d06
 	GDir *dir;
ab7d06
 	char *dirname, *base;
ab7d06
@@ -1230,7 +1225,7 @@ read_aliases (NMSettingIPConfig *s_ip4, const char *filename, const char *networ
ab7d06
 			}
ab7d06
 
ab7d06
 			addr = NULL;
ab7d06
-			ok = read_full_ip4_address (parsed, network_file, -1, base_addr, &addr, NULL, &err;;
ab7d06
+			ok = read_full_ip4_address (parsed, -1, base_addr, &addr, NULL, &err;;
ab7d06
 			svCloseFile (parsed);
ab7d06
 			if (ok) {
ab7d06
 				nm_ip_address_set_attribute (addr, "label", g_variant_new_string (device));
ab7d06
@@ -1417,7 +1412,7 @@ make_ip6_setting (shvarFile *ifcfg,
ab7d06
 	for (iter = list, i = 0; iter && *iter; iter++, i++) {
ab7d06
 		NMIPAddress *addr = NULL;
ab7d06
 
ab7d06
-		if (!parse_full_ip6_address (ifcfg, network_file, *iter, i, &addr, error)) {
ab7d06
+		if (!parse_full_ip6_address (ifcfg, *iter, i, &addr, error)) {
ab7d06
 			g_strfreev (list);
ab7d06
 			goto error;
ab7d06
 		}
ab7d06
@@ -4884,7 +4879,7 @@ connection_from_file_full (const char *filename,
ab7d06
 		connection = NULL;
ab7d06
 		goto done;
ab7d06
 	} else {
ab7d06
-		read_aliases (NM_SETTING_IP_CONFIG (s_ip4), filename, network_file);
ab7d06
+		read_aliases (NM_SETTING_IP_CONFIG (s_ip4), filename);
ab7d06
 		nm_connection_add_setting (connection, s_ip4);
ab7d06
 	}
ab7d06
 
ab7d06
-- 
ab7d06
2.1.0
ab7d06
ab7d06
ab7d06
From 0aa99069ed8a241ca2ae8c9a156a8774132c9c7d Mon Sep 17 00:00:00 2001
ab7d06
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
ab7d06
Date: Tue, 15 Sep 2015 16:54:09 +0200
ab7d06
Subject: [PATCH 2/2] ifcfg-rh: ignore GATEWAY from network file for DHCP
ab7d06
 connections (rh #1262972)
ab7d06
MIME-Version: 1.0
ab7d06
Content-Type: text/plain; charset=UTF-8
ab7d06
Content-Transfer-Encoding: 8bit
ab7d06
ab7d06
The GATEWAY from /etc/sysconfig/network file is used as a default value when
ab7d06
no GATEWAY is in ifcfg file. However, we have to ignore that GATEWAY for
ab7d06
connections without static addresses. Otherwise such connections would be
ab7d06
invalid and would disappear after restart/reaload.
ab7d06
ab7d06
Some notes:
ab7d06
Putting GATEWAY into /etc/sysconfig/network is not recommended, because it
ab7d06
inherently belongs to the ifcfg file as it is a per-interface property.
ab7d06
The recommended practice is to specify GATEWAY in individual ifcfg files and
ab7d06
define DEFROUTE=no if the interface should not get the default route.
ab7d06
But we continue to read GATEWAY from /etc/sysconfig/network for compatibility
ab7d06
reasons.
ab7d06
See also
ab7d06
https://bugzilla.redhat.com/show_bug.cgi?id=896198#c25
ab7d06
https://bugzilla.redhat.com/show_bug.cgi?id=896198#c27
ab7d06
ab7d06
Fixes: f17699f4e3dacb9358a8503c8b15efe3cb852b48
ab7d06
ab7d06
https://bugzilla.redhat.com/show_bug.cgi?id=1262972
ab7d06
ab7d06
(cherry picked from commit ed85fcc711ca4ff6fa394e92ac33c5ead5c460f5)
ab7d06
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
ab7d06
---
ab7d06
 src/settings/plugins/ifcfg-rh/reader.c             |  7 ++++
ab7d06
 .../ifcfg-rh/tests/network-scripts/Makefile.am     |  2 +
ab7d06
 .../ifcfg-test-wired-global-gateway-ignore         |  8 ++++
ab7d06
 .../network-test-wired-global-gateway-ignore       |  1 +
ab7d06
 .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c         | 43 ++++++++++++++++++++++
ab7d06
 5 files changed, 61 insertions(+)
ab7d06
 create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway-ignore
ab7d06
 create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway-ignore
ab7d06
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
ab7d06
index 1c0f55c..5bba38f 100644
ab7d06
--- a/src/settings/plugins/ifcfg-rh/reader.c
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/reader.c
ab7d06
@@ -1041,6 +1041,13 @@ make_ip4_setting (shvarFile *ifcfg,
ab7d06
 			svCloseFile (network_ifcfg);
ab7d06
 			if (!read_success)
ab7d06
 				goto done;
ab7d06
+
ab7d06
+			if (gateway && nm_setting_ip_config_get_num_addresses (s_ip4) == 0) {
ab7d06
+				gs_free char *f = g_path_get_basename (ifcfg->fileName);
ab7d06
+				PARSE_WARNING ("ignoring GATEWAY (/etc/sysconfig/network) for %s "
ab7d06
+				               "because the connection has no static addresses", f);
ab7d06
+				g_clear_pointer (&gateway, g_free);
ab7d06
+			}
ab7d06
 		}
ab7d06
 	}
ab7d06
 	g_object_set (s_ip4, NM_SETTING_IP_CONFIG_GATEWAY, gateway, NULL);
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
ab7d06
index 7b5aaf1..63c10a3 100644
ab7d06
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
ab7d06
@@ -14,6 +14,8 @@ EXTRA_DIST = \
ab7d06
 	ifcfg-test-wired-dhcp6-only \
ab7d06
 	ifcfg-test-wired-global-gateway \
ab7d06
 	network-test-wired-global-gateway \
ab7d06
+	ifcfg-test-wired-global-gateway-ignore \
ab7d06
+	network-test-wired-global-gateway-ignore \
ab7d06
 	ifcfg-test-wired-obsolete-gateway-n \
ab7d06
 	ifcfg-test-wired-never-default \
ab7d06
 	network-test-wired-never-default \
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway-ignore b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway-ignore
ab7d06
new file mode 100644
ab7d06
index 0000000..bb81399
ab7d06
--- /dev/null
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-global-gateway-ignore
ab7d06
@@ -0,0 +1,8 @@
ab7d06
+TYPE=Ethernet
ab7d06
+DEVICE=eth0
ab7d06
+HWADDR=00:11:22:33:44:ee
ab7d06
+BOOTPROTO=dhcp
ab7d06
+ONBOOT=yes
ab7d06
+USERCTL=yes
ab7d06
+IPV6INIT=no
ab7d06
+
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway-ignore b/src/settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway-ignore
ab7d06
new file mode 100644
ab7d06
index 0000000..7987d10
ab7d06
--- /dev/null
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/network-test-wired-global-gateway-ignore
ab7d06
@@ -0,0 +1 @@
ab7d06
+GATEWAY=192.168.1.2
ab7d06
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
ab7d06
index 953b0c7..f42dbf4 100644
ab7d06
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
ab7d06
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
ab7d06
@@ -868,6 +868,48 @@ test_read_wired_global_gateway (void)
ab7d06
 	g_object_unref (connection);
ab7d06
 }
ab7d06
 
ab7d06
+/* Ignore GATEWAY from /etc/sysconfig/network for automatic connections */
ab7d06
+static void
ab7d06
+test_read_wired_global_gateway_ignore (void)
ab7d06
+{
ab7d06
+	NMConnection *connection;
ab7d06
+	NMSettingConnection *s_con;
ab7d06
+	NMSettingWired *s_wired;
ab7d06
+	NMSettingIPConfig *s_ip4;
ab7d06
+	GError *error = NULL;
ab7d06
+	char *unmanaged = NULL;
ab7d06
+
ab7d06
+	g_test_expect_message ("NetworkManager", G_LOG_LEVEL_WARNING,
ab7d06
+	                       "*ignoring GATEWAY (/etc/sysconfig/network) for * because the connection has no static addresses");
ab7d06
+	connection = connection_from_file_test (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-global-gateway-ignore",
ab7d06
+	                                        TEST_IFCFG_DIR"/network-scripts/network-test-wired-global-gateway-ignore",
ab7d06
+	                                        TYPE_ETHERNET, &unmanaged, &error);
ab7d06
+	nmtst_assert_connection_verifies_without_normalization (connection);
ab7d06
+	g_assert (unmanaged == NULL);
ab7d06
+
ab7d06
+	/* ===== CONNECTION SETTING ===== */
ab7d06
+	s_con = nm_connection_get_setting_connection (connection);
ab7d06
+	g_assert (s_con);
ab7d06
+	g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "System test-wired-global-gateway-ignore");
ab7d06
+
ab7d06
+	/* ===== WIRED SETTING ===== */
ab7d06
+	s_wired = nm_connection_get_setting_wired (connection);
ab7d06
+	g_assert (s_wired);
ab7d06
+
ab7d06
+	/* ===== IPv4 SETTING ===== */
ab7d06
+	s_ip4 = nm_connection_get_setting_ip4_config (connection);
ab7d06
+	g_assert (s_ip4);
ab7d06
+	g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
ab7d06
+
ab7d06
+	/* Addresses */
ab7d06
+	g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 0);
ab7d06
+
ab7d06
+	/* Gateway */
ab7d06
+	g_assert_cmpstr (nm_setting_ip_config_get_gateway (s_ip4), ==, NULL);
ab7d06
+
ab7d06
+	g_object_unref (connection);
ab7d06
+}
ab7d06
+
ab7d06
 static void
ab7d06
 test_read_wired_obsolete_gateway_n (void)
ab7d06
 {
ab7d06
@@ -12608,6 +12650,7 @@ int main (int argc, char **argv)
ab7d06
 	g_test_add_func (TPATH "read-shared-plus-ip", test_read_wired_shared_plus_ip);
ab7d06
 	g_test_add_func (TPATH "read-dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname);
ab7d06
 	g_test_add_func (TPATH "read-global-gateway", test_read_wired_global_gateway);
ab7d06
+	g_test_add_func (TPATH "read-global-gateway-ignore", test_read_wired_global_gateway_ignore);
ab7d06
 	g_test_add_func (TPATH "read-obsolete-gateway-n", test_read_wired_obsolete_gateway_n);
ab7d06
 	g_test_add_func (TPATH "read-never-default", test_read_wired_never_default);
ab7d06
 	test_read_wired_defroute_no ();
ab7d06
-- 
ab7d06
2.1.0
ab7d06