mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 14:30:18 +01:00
ifcfg-rh: read/write 'secondaries' property of 'connection' setting
as SECONDARY_UUIDS variable
This commit is contained in:
parent
4ee617ddf2
commit
eb407143fd
2 changed files with 38 additions and 0 deletions
|
|
@ -168,6 +168,22 @@ make_connection_setting (const char *file,
|
|||
g_object_set (s_con, NM_SETTING_CONNECTION_ZONE, zone, NULL);
|
||||
g_free (zone);
|
||||
|
||||
value = svGetValue (ifcfg, "SECONDARY_UUIDS", FALSE);
|
||||
if (value) {
|
||||
char **items, **iter;
|
||||
|
||||
items = g_strsplit_set (value, " \t", -1);
|
||||
for (iter = items; iter && *iter; iter++) {
|
||||
if (strlen (*iter)) {
|
||||
if (!nm_setting_connection_add_secondary (s_con, *iter))
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME,
|
||||
" warning: secondary connection UUID '%s' already added", *iter);
|
||||
}
|
||||
}
|
||||
g_free (value);
|
||||
g_strfreev (items);
|
||||
}
|
||||
|
||||
return NM_SETTING (s_con);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1296,6 +1296,28 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
|
|||
if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME))
|
||||
svSetValue (ifcfg, "MASTER", master, FALSE);
|
||||
}
|
||||
|
||||
/* secondary connection UUIDs */
|
||||
svSetValue (ifcfg, "SECONDARY_UUIDS", NULL, FALSE);
|
||||
n = nm_setting_connection_get_num_secondaries (s_con);
|
||||
if (n > 0) {
|
||||
str = g_string_sized_new (n * 37);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
const char *uuid;
|
||||
|
||||
/* Items separated by space for consistency with eg
|
||||
* IPV6ADDR_SECONDARIES and DOMAIN.
|
||||
*/
|
||||
if (str->len)
|
||||
g_string_append_c (str, ' ');
|
||||
|
||||
if ((uuid = nm_setting_connection_get_secondary (s_con, i)) != NULL)
|
||||
g_string_append (str, uuid);
|
||||
}
|
||||
svSetValue (ifcfg, "SECONDARY_UUIDS", str->str, FALSE);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue