From 839feb3585820979e280b4215d80a3d7dff22ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 11 Jun 2015 15:13:01 +0200 Subject: fixup! ifcfg-rh: read/write autoconnect-slaves property as AUTOCONNECT_SLAVES If the AUTOCONNECT_SLAVES variable is missing, we suppose values compatible with initscripts, i.e. "yes" for bonds and teams, "no" for bridges. --- libnm-core/nm-setting-connection.c | 2 +- src/settings/plugins/ifcfg-rh/reader.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index 57a5fb8128..620f719d79 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -1606,7 +1606,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) /* ---ifcfg-rh--- * property: autoconnect-slaves * variable: AUTOCONNECT-SLAVES(+) - * default: missing variable means global default + * default: yes (for bond and team); no (for bridge) * description: Whether slaves of this connection should be auto-connected * when this connection is activated. * ---end--- diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 9dcf5f3b59..fd83e11cdb 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -133,6 +133,7 @@ make_connection_setting (const char *file, NMSettingConnection *s_con; const char *ifcfg_name = NULL; char *new_id, *uuid = NULL, *zone = NULL, *value; + NMSettingConnectionAutoconnectSlaves autoconnect_slaves_default; ifcfg_name = utils_get_ifcfg_name (file, TRUE); if (!ifcfg_name) @@ -168,6 +169,15 @@ make_connection_setting (const char *file, g_free (value); } + /* Default to AUTOCONNECT_SLAVES=yes for bond and team to be compatible with initscripts */ + if ( !strcmp (type, NM_SETTING_TEAM_SETTING_NAME) + || !strcmp (type, NM_SETTING_BOND_SETTING_NAME)) + autoconnect_slaves_default = + NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT_YES; + else + autoconnect_slaves_default = + NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT_NO; + /* Missing ONBOOT is treated as "ONBOOT=true" by the old network service */ g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT, @@ -178,7 +188,7 @@ make_connection_setting (const char *file, NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX, NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT), NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, - svTrueValue (ifcfg, "AUTOCONNECT_SLAVES", NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT), + svTrueValue (ifcfg, "AUTOCONNECT_SLAVES", autoconnect_slaves_default), NULL); value = svGetValue (ifcfg, "USERS", FALSE); -- cgit v1.2.1