mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-14 15:40:30 +01:00
cli: add support for connection.autoconnect-slaves property
(cherry picked from commit c3093d9391)
This commit is contained in:
parent
8aa0b5b17d
commit
c8826630a3
1 changed files with 52 additions and 4 deletions
|
|
@ -51,8 +51,9 @@ NmcOutputField nmc_fields_setting_connection[] = {
|
|||
SETTING_FIELD (NM_SETTING_CONNECTION_ZONE, 10), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_MASTER, 20), /* 11 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_SLAVE_TYPE, 20), /* 12 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_SECONDARIES, 40), /* 13 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, 30), /* 14 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, 13), /* 13 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_SECONDARIES, 40), /* 14 */
|
||||
SETTING_FIELD (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, 30), /* 15 */
|
||||
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_CONNECTION_ALL "name"","\
|
||||
|
|
@ -68,6 +69,7 @@ NmcOutputField nmc_fields_setting_connection[] = {
|
|||
NM_SETTING_CONNECTION_ZONE","\
|
||||
NM_SETTING_CONNECTION_MASTER","\
|
||||
NM_SETTING_CONNECTION_SLAVE_TYPE","\
|
||||
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES","\
|
||||
NM_SETTING_CONNECTION_SECONDARIES","\
|
||||
NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT
|
||||
#define NMC_FIELDS_SETTING_CONNECTION_COMMON NMC_FIELDS_SETTING_CONNECTION_ALL
|
||||
|
|
@ -757,6 +759,20 @@ ip6_privacy_to_string (NMSettingIP6ConfigPrivacy ip6_privacy)
|
|||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
autoconnect_slaves_to_string (NMSettingConnectionAutoconnectSlaves autoconnect_slaves)
|
||||
{
|
||||
switch (autoconnect_slaves) {
|
||||
case NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO:
|
||||
return g_strdup_printf (_("%d (no)"), autoconnect_slaves);
|
||||
case NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES:
|
||||
return g_strdup_printf (_("%d (yes)"), autoconnect_slaves);
|
||||
case NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT:
|
||||
default:
|
||||
return g_strdup_printf (_("%d (default)"), autoconnect_slaves);
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
secret_flags_to_string (guint32 flags)
|
||||
{
|
||||
|
|
@ -1046,6 +1062,14 @@ nmc_property_connection_get_permissions (NMSetting *setting)
|
|||
DEFINE_GETTER (nmc_property_connection_get_zone, NM_SETTING_CONNECTION_ZONE)
|
||||
DEFINE_GETTER (nmc_property_connection_get_master, NM_SETTING_CONNECTION_MASTER)
|
||||
DEFINE_GETTER (nmc_property_connection_get_slave_type, NM_SETTING_CONNECTION_SLAVE_TYPE)
|
||||
|
||||
static char *
|
||||
nmc_property_connection_get_autoconnect_slaves (NMSetting *setting)
|
||||
{
|
||||
NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting);
|
||||
return autoconnect_slaves_to_string (nm_setting_connection_get_autoconnect_slaves (s_con));
|
||||
}
|
||||
|
||||
DEFINE_GETTER (nmc_property_connection_get_secondaries, NM_SETTING_CONNECTION_SECONDARIES)
|
||||
DEFINE_GETTER (nmc_property_connection_get_gateway_ping_timeout, NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT)
|
||||
|
||||
|
|
@ -2239,6 +2263,22 @@ nmc_property_set_bool (NMSetting *setting, const char *prop, const char *val, GE
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nmc_property_set_trilean (NMSetting *setting, const char *prop, const char *val, GError **error)
|
||||
{
|
||||
long int val_int;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (!nmc_string_to_int (val, TRUE, -1, 1, &val_int)) {
|
||||
g_set_error (error, 1, 0, _("'%s' is not a valid value; use -1, 0 or 1"), val);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set (setting, prop, val_int, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nmc_property_set_ssid (NMSetting *setting, const char *prop, const char *val, GError **error)
|
||||
{
|
||||
|
|
@ -5233,6 +5273,13 @@ nmc_properties_init (void)
|
|||
NULL,
|
||||
nmc_property_con_allowed_slave_type,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (CONNECTION, AUTOCONNECT_SLAVES),
|
||||
nmc_property_connection_get_autoconnect_slaves,
|
||||
nmc_property_set_trilean,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (CONNECTION, SECONDARIES),
|
||||
nmc_property_connection_get_secondaries,
|
||||
nmc_property_connection_set_secondaries,
|
||||
|
|
@ -6611,8 +6658,9 @@ setting_connection_details (NMSetting *setting, NmCli *nmc, const char *one_pro
|
|||
set_val_str (arr, 10, nmc_property_connection_get_zone (setting));
|
||||
set_val_str (arr, 11, nmc_property_connection_get_master (setting));
|
||||
set_val_str (arr, 12, nmc_property_connection_get_slave_type (setting));
|
||||
set_val_str (arr, 13, nmc_property_connection_get_secondaries (setting));
|
||||
set_val_str (arr, 14, nmc_property_connection_get_gateway_ping_timeout (setting));
|
||||
set_val_str (arr, 13, nmc_property_connection_get_autoconnect_slaves (setting));
|
||||
set_val_str (arr, 14, nmc_property_connection_get_secondaries (setting));
|
||||
set_val_str (arr, 15, nmc_property_connection_get_gateway_ping_timeout (setting));
|
||||
g_ptr_array_add (nmc->output_data, arr);
|
||||
|
||||
print_data (nmc); /* Print all data */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue