diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-06-11 15:13:01 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-06-11 15:15:37 +0200 |
commit | 839feb3585820979e280b4215d80a3d7dff22ae2 (patch) | |
tree | 9308f562e2f0894e90400f2a76e6ac9cbf9c9c80 | |
parent | 71147612d1608c1fd5defe503c089f02fb467da6 (diff) | |
download | NetworkManager-839feb3585820979e280b4215d80a3d7dff22ae2.tar.gz |
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.
-rw-r--r-- | libnm-core/nm-setting-connection.c | 2 | ||||
-rw-r--r-- | 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); |