diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-05-06 10:59:11 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-06-19 09:32:58 +0200 |
commit | 2a497eeadc7e78e624941b2f6e61a0dcbe7da0d4 (patch) | |
tree | 859dd6d46c492ffcc5cca82b3cfc3ffff73b2f41 | |
parent | 6caafab258762713a354cf37591510b6ac29936c (diff) | |
download | NetworkManager-2a497eeadc7e78e624941b2f6e61a0dcbe7da0d4.tar.gz |
ifcfg-rh: read/write autoconnect-slaves property as AUTOCONNECT_SLAVES
AUTOCONNECT_SLAVES is an NetworkManager extension. initscripts always activate
slaves with the master connection for bond and team, and doesn't activate
automatically slaves for bridge.
NetworkManager behaviour is controlled by this variable. If the variable is
missing the default value from configuration file is used.
-rw-r--r-- | libnm-core/nm-setting-connection.c | 2 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/reader.c | 2 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/writer.c | 16 |
3 files changed, 18 insertions, 2 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index 6832a985d6..3ab8873dcf 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -1604,7 +1604,7 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) /* ---ifcfg-rh--- * property: autoconnect-slaves * variable: AUTOCONNECT-SLAVES(+) - * default: no + * default: missing variable means global default * 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 2387be3fcd..9dcf5f3b59 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -177,6 +177,8 @@ make_connection_setting (const char *file, NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN, 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), NULL); value = svGetValue (ifcfg, "USERS", FALSE); diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index df2308e405..c93d167936 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -1694,7 +1694,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) { guint32 n, i; GString *str; - const char *master; + const char *master, *type; char *tmp; gint i_int; @@ -1711,6 +1711,20 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) svSetValue (ifcfg, "AUTOCONNECT_PRIORITY", tmp, FALSE); g_free (tmp); + /* Only save the value for master connections */ + svSetValue (ifcfg, "AUTOCONNECT_SLAVES", NULL, FALSE); + type = nm_setting_connection_get_connection_type (s_con); + if ( !g_strcmp0 (type, NM_SETTING_BOND_SETTING_NAME) + || !g_strcmp0 (type, NM_SETTING_TEAM_SETTING_NAME) + || !g_strcmp0 (type, NM_SETTING_BRIDGE_SETTING_NAME)) { + NMSettingConnectionAutoconnectSlaves autoconnect_slaves; + autoconnect_slaves = nm_setting_connection_get_autoconnect_slaves (s_con); + svSetValue (ifcfg, "AUTOCONNECT_SLAVES", + autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES ? "yes" : + autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO ? "no" : NULL, + FALSE); + } + /* Permissions */ svSetValue (ifcfg, "USERS", NULL, FALSE); n = nm_setting_connection_get_num_permissions (s_con); |