summaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-10-29 16:11:14 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-11-02 20:27:00 +0100
commit4d6649fa0e60c5790aaa87936ec295039be0498a (patch)
tree4e08d040a17181f148e984cc88f099a723c72dcd /clients
parent60d25042911f0554e196f78210ff05a9cde2adc9 (diff)
downloadNetworkManager-4d6649fa0e60c5790aaa87936ec295039be0498a.tar.gz
cli: add addr-gen-mode property
Diffstat (limited to 'clients')
-rw-r--r--clients/cli/settings.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c
index e5139aeb11..1fbc6959c0 100644
--- a/clients/cli/settings.c
+++ b/clients/cli/settings.c
@@ -322,8 +322,9 @@ NmcOutputField nmc_fields_setting_ip6_config[] = {
SETTING_FIELD (NM_SETTING_IP_CONFIG_NEVER_DEFAULT), /* 11 */
SETTING_FIELD (NM_SETTING_IP_CONFIG_MAY_FAIL), /* 12 */
SETTING_FIELD (NM_SETTING_IP6_CONFIG_IP6_PRIVACY), /* 13 */
- SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 14 */
- SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 15 */
+ SETTING_FIELD (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE), /* 14 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME), /* 15 */
+ SETTING_FIELD (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME), /* 16 */
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
};
#define NMC_FIELDS_SETTING_IP6_CONFIG_ALL "name"","\
@@ -340,6 +341,7 @@ NmcOutputField nmc_fields_setting_ip6_config[] = {
NM_SETTING_IP_CONFIG_NEVER_DEFAULT","\
NM_SETTING_IP_CONFIG_MAY_FAIL","\
NM_SETTING_IP6_CONFIG_IP6_PRIVACY","\
+ NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE","\
NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME","\
NM_SETTING_IP_CONFIG_DHCP_HOSTNAME
#define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL
@@ -4129,6 +4131,36 @@ nmc_property_ipv6_set_ip6_privacy (NMSetting *setting, const char *prop, const c
return TRUE;
}
+/* 'addr_gen_mode' */
+static char *
+nmc_property_ipv6_get_addr_gen_mode (NMSetting *setting, NmcPropertyGetType get_type)
+{
+ NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting);
+ NMSettingIP6ConfigAddrGenMode addr_gen_mode;
+
+ addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode (s_ip6);
+ return nm_utils_enum_to_str (nm_setting_ip6_config_addr_gen_mode_get_type (), addr_gen_mode);
+}
+
+
+static gboolean
+nmc_property_ipv6_set_addr_gen_mode (NMSetting *setting, const char *prop,
+ const char *val, GError **error)
+{
+ NMSettingIP6ConfigAddrGenMode addr_gen_mode;
+
+ if (!nm_utils_enum_from_str (nm_setting_ip6_config_addr_gen_mode_get_type (), val,
+ (int *) &addr_gen_mode, NULL)) {
+ g_set_error (error, 1, 0, _("invalid option '%s', use one of [%s]"),
+ val, "eui64,stable-privacy");
+ return FALSE;
+ }
+
+ g_object_set (setting, prop, addr_gen_mode, NULL);
+ return TRUE;
+}
+
+
/* --- NM_SETTING_OLPC_MESH_SETTING_NAME property setter functions --- */
static gboolean
nmc_property_olpc_set_channel (NMSetting *setting, const char *prop, const char *val, GError **error)
@@ -6104,6 +6136,13 @@ nmc_properties_init (void)
NULL,
NULL,
NULL);
+ nmc_add_prop_funcs (GLUE (IP6_CONFIG, ADDR_GEN_MODE),
+ nmc_property_ipv6_get_addr_gen_mode,
+ nmc_property_ipv6_set_addr_gen_mode,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
nmc_add_prop_funcs (GLUE_IP (6, DHCP_SEND_HOSTNAME),
nmc_property_ipv6_get_dhcp_send_hostname,
nmc_property_set_bool,
@@ -7355,8 +7394,9 @@ setting_ip6_config_details (NMSetting *setting, NmCli *nmc, const char *one_pro
set_val_str (arr, 11, nmc_property_ipv6_get_never_default (setting, NMC_PROPERTY_GET_PRETTY));
set_val_str (arr, 12, nmc_property_ipv6_get_may_fail (setting, NMC_PROPERTY_GET_PRETTY));
set_val_str (arr, 13, nmc_property_ipv6_get_ip6_privacy (setting, NMC_PROPERTY_GET_PRETTY));
- set_val_str (arr, 14, nmc_property_ipv6_get_dhcp_send_hostname (setting, NMC_PROPERTY_GET_PRETTY));
- set_val_str (arr, 15, nmc_property_ipv6_get_dhcp_hostname (setting, NMC_PROPERTY_GET_PRETTY));
+ set_val_str (arr, 14, nmc_property_ipv6_get_addr_gen_mode (setting, NMC_PROPERTY_GET_PRETTY));
+ set_val_str (arr, 15, nmc_property_ipv6_get_dhcp_send_hostname (setting, NMC_PROPERTY_GET_PRETTY));
+ set_val_str (arr, 16, nmc_property_ipv6_get_dhcp_hostname (setting, NMC_PROPERTY_GET_PRETTY));
g_ptr_array_add (nmc->output_data, arr);
print_data (nmc); /* Print all data */