diff options
| author | Michael Biebl <biebl@debian.org> | 2017-11-07 00:14:39 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-11-07 00:14:39 +0100 |
| commit | 90e8691111889a7b5f3c812f5a41f15a8a058913 (patch) | |
| tree | f101a879eca27c34a9bfa5f3da52266b22539a36 /clients/common | |
| parent | bdb6eeb0670658255c2a4c3c501c0a27fa8cfe55 (diff) | |
New upstream version 1.9.90 upstream/1.9.90
Diffstat (limited to 'clients/common')
| -rw-r--r-- | clients/common/nm-client-utils.c | 517 | ||||
| -rw-r--r-- | clients/common/nm-client-utils.h | 59 | ||||
| -rw-r--r-- | clients/common/nm-meta-setting-access.c | 638 | ||||
| -rw-r--r-- | clients/common/nm-meta-setting-access.h | 101 | ||||
| -rw-r--r-- | clients/common/nm-meta-setting-desc.c | 7284 | ||||
| -rw-r--r-- | clients/common/nm-meta-setting-desc.h | 444 | ||||
| -rw-r--r-- | clients/common/nm-secret-agent-simple.c | 73 | ||||
| -rw-r--r-- | clients/common/nm-vpn-helpers.c | 41 | ||||
| -rw-r--r-- | clients/common/settings-docs.c | 363 | ||||
| -rw-r--r-- | clients/common/settings-docs.c.in | 363 | ||||
| -rw-r--r-- | clients/common/settings-docs.xsl | 49 | ||||
| -rw-r--r-- | clients/common/tests/test-general.c | 162 |
12 files changed, 10054 insertions, 40 deletions
diff --git a/clients/common/nm-client-utils.c b/clients/common/nm-client-utils.c new file mode 100644 index 00000000..bf4dcc77 --- /dev/null +++ b/clients/common/nm-client-utils.c @@ -0,0 +1,517 @@ +/* nmcli - command-line tool to control NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2010 - 2017 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-client-utils.h" + +#include "nm-device-bond.h" +#include "nm-device-bridge.h" +#include "nm-device-team.h" + +/* + * Convert string to unsigned integer. + * If required, the resulting number is checked to be in the <min,max> range. + */ +static gboolean +nmc_string_to_uint_base (const char *str, + int base, + gboolean range_check, + unsigned long int min, + unsigned long int max, + unsigned long int *value) +{ + char *end; + unsigned long int tmp; + + errno = 0; + tmp = strtoul (str, &end, base); + if (errno || *end != '\0' || (range_check && (tmp < min || tmp > max))) { + return FALSE; + } + *value = tmp; + return TRUE; +} + +gboolean +nmc_string_to_uint (const char *str, + gboolean range_check, + unsigned long int min, + unsigned long int max, + unsigned long int *value) +{ + return nmc_string_to_uint_base (str, 10, range_check, min, max, value); +} + +gboolean +nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error) +{ + const char *s_true[] = { "true", "yes", "on", "1", NULL }; + const char *s_false[] = { "false", "no", "off", "0", NULL }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (g_strcmp0 (str, "o") == 0) { + g_set_error (error, 1, 0, + /* Translators: the first %s is the partial value entered by + * the user, the second %s a list of compatible values. + */ + _("'%s' is ambiguous (%s)"), str, "on x off"); + return FALSE; + } + + if (nmc_string_is_valid (str, s_true, NULL)) + *val_bool = TRUE; + else if (nmc_string_is_valid (str, s_false, NULL)) + *val_bool = FALSE; + else { + g_set_error (error, 1, 0, + _("'%s' is not valid; use [%s] or [%s]"), + str, "true, yes, on", "false, no, off"); + return FALSE; + } + return TRUE; +} + +gboolean +nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error) +{ + const char *s_true[] = { "true", "yes", "on", NULL }; + const char *s_false[] = { "false", "no", "off", NULL }; + const char *s_unknown[] = { "unknown", NULL }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (g_strcmp0 (str, "o") == 0) { + g_set_error (error, 1, 0, + /* Translators: the first %s is the partial value entered by + * the user, the second %s a list of compatible values. + */ + _("'%s' is ambiguous (%s)"), str, "on x off"); + return FALSE; + } + + if (nmc_string_is_valid (str, s_true, NULL)) + *val = NMC_TRI_STATE_YES; + else if (nmc_string_is_valid (str, s_false, NULL)) + *val = NMC_TRI_STATE_NO; + else if (nmc_string_is_valid (str, s_unknown, NULL)) + *val = NMC_TRI_STATE_UNKNOWN; + else { + g_set_error (error, 1, 0, + _("'%s' is not valid; use [%s], [%s] or [%s]"), + str, "true, yes, on", "false, no, off", "unknown"); + return FALSE; + } + return TRUE; +} + +/* + * Check whether 'input' is contained in 'allowed' array. It performs case + * insensitive comparison and supports shortcut strings if they are unique. + * Returns: a pointer to found string in allowed array on success or NULL. + * On failure: error->code : 0 - string not found; 1 - string is ambiguous + */ +const char * +nmc_string_is_valid (const char *input, const char **allowed, GError **error) +{ + const char **p; + size_t input_ln, p_len; + gboolean prev_match = FALSE; + const char *ret = NULL; + + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + if (!input || !*input) + goto finish; + + input_ln = strlen (input); + for (p = allowed; p && *p; p++) { + p_len = strlen (*p); + if (g_ascii_strncasecmp (input, *p, input_ln) == 0) { + if (input_ln == p_len) { + ret = *p; + break; + } + if (!prev_match) + ret = *p; + else { + g_set_error (error, 1, 1, _("'%s' is ambiguous (%s x %s)"), + input, ret, *p); + return NULL; + } + prev_match = TRUE; + } + } + +finish: + if (ret == NULL) { + char *valid_vals = g_strjoinv (", ", (char **) allowed); + if (!input || !*input) + g_set_error (error, 1, 0, _("missing name, try one of [%s]"), valid_vals); + else + g_set_error (error, 1, 0, _("'%s' not among [%s]"), input, valid_vals); + + g_free (valid_vals); + } + return ret; +} + +/* + * Wrapper function for g_strsplit_set() that removes empty strings + * from the vector as they are not useful in most cases. + */ +char ** +nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens) +{ + /* remove empty strings */ + return _nm_utils_strv_cleanup (g_strsplit_set (str, delimiter, max_tokens), + FALSE, TRUE, FALSE); +} + +gboolean +matches (const char *cmd, const char *pattern) +{ + size_t len = strlen (cmd); + if (!len || len > strlen (pattern)) + return FALSE; + return memcmp (pattern, cmd, len) == 0; +} + +const char * +nmc_bond_validate_mode (const char *mode, GError **error) +{ + unsigned long mode_int; + static const char *valid_modes[] = { "balance-rr", + "active-backup", + "balance-xor", + "broadcast", + "802.3ad", + "balance-tlb", + "balance-alb", + NULL }; + if (nmc_string_to_uint (mode, TRUE, 0, 6, &mode_int)) { + /* Translate bonding mode numbers to mode names: + * https://www.kernel.org/doc/Documentation/networking/bonding.txt + */ + return valid_modes[mode_int]; + } else + return nmc_string_is_valid (mode, valid_modes, error); +} + +const char * +nmc_device_state_to_string (NMDeviceState state) +{ + switch (state) { + case NM_DEVICE_STATE_UNMANAGED: + return _("unmanaged"); + case NM_DEVICE_STATE_UNAVAILABLE: + return _("unavailable"); + case NM_DEVICE_STATE_DISCONNECTED: + return _("disconnected"); + case NM_DEVICE_STATE_PREPARE: + return _("connecting (prepare)"); + case NM_DEVICE_STATE_CONFIG: + return _("connecting (configuring)"); + case NM_DEVICE_STATE_NEED_AUTH: + return _("connecting (need authentication)"); + case NM_DEVICE_STATE_IP_CONFIG: + return _("connecting (getting IP configuration)"); + case NM_DEVICE_STATE_IP_CHECK: + return _("connecting (checking IP connectivity)"); + case NM_DEVICE_STATE_SECONDARIES: + return _("connecting (starting secondary connections)"); + case NM_DEVICE_STATE_ACTIVATED: + return _("connected"); + case NM_DEVICE_STATE_DEACTIVATING: + return _("deactivating"); + case NM_DEVICE_STATE_FAILED: + return _("connection failed"); + case NM_DEVICE_STATE_UNKNOWN: + return _("unknown"); + } + + return _("unknown"); +} + +const char * +nmc_device_metered_to_string (NMMetered value) +{ + switch (value) { + case NM_METERED_YES: + return _("yes"); + case NM_METERED_NO: + return _("no"); + case NM_METERED_GUESS_YES: + return _("yes (guessed)"); + case NM_METERED_GUESS_NO: + return _("no (guessed)"); + case NM_METERED_UNKNOWN: + return _("unknown"); + } + + return _("unknown"); +} + +const char * +nmc_device_reason_to_string (NMDeviceStateReason reason) +{ + switch (reason) { + case NM_DEVICE_STATE_REASON_NONE: + return _("No reason given"); + case NM_DEVICE_STATE_REASON_UNKNOWN: + return _("Unknown error"); + case NM_DEVICE_STATE_REASON_NOW_MANAGED: + return _("Device is now managed"); + case NM_DEVICE_STATE_REASON_NOW_UNMANAGED: + return _("Device is now unmanaged"); + case NM_DEVICE_STATE_REASON_CONFIG_FAILED: + return _("The device could not be readied for configuration"); + case NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE: + return _("IP configuration could not be reserved (no available address, timeout, etc.)"); + case NM_DEVICE_STATE_REASON_IP_CONFIG_EXPIRED: + return _("The IP configuration is no longer valid"); + case NM_DEVICE_STATE_REASON_NO_SECRETS: + return _("Secrets were required, but not provided"); + case NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT: + return _("802.1X supplicant disconnected"); + case NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED: + return _("802.1X supplicant configuration failed"); + case NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED: + return _("802.1X supplicant failed"); + case NM_DEVICE_STATE_REASON_SUPPLICANT_TIMEOUT: + return _("802.1X supplicant took too long to authenticate"); + case NM_DEVICE_STATE_REASON_PPP_START_FAILED: + return _("PPP service failed to start"); + case NM_DEVICE_STATE_REASON_PPP_DISCONNECT: + return _("PPP service disconnected"); + case NM_DEVICE_STATE_REASON_PPP_FAILED: + return _("PPP failed"); + case NM_DEVICE_STATE_REASON_DHCP_START_FAILED: + return _("DHCP client failed to start"); + case NM_DEVICE_STATE_REASON_DHCP_ERROR: + return _("DHCP client error"); + case NM_DEVICE_STATE_REASON_DHCP_FAILED: + return _("DHCP client failed"); + case NM_DEVICE_STATE_REASON_SHARED_START_FAILED: + return _("Shared connection service failed to start"); + case NM_DEVICE_STATE_REASON_SHARED_FAILED: + return _("Shared connection service failed"); + case NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED: + return _("AutoIP service failed to start"); + case NM_DEVICE_STATE_REASON_AUTOIP_ERROR: + return _("AutoIP service error"); + case NM_DEVICE_STATE_REASON_AUTOIP_FAILED: + return _("AutoIP service failed"); + case NM_DEVICE_STATE_REASON_MODEM_BUSY: + return _("The line is busy"); + case NM_DEVICE_STATE_REASON_MODEM_NO_DIAL_TONE: + return _("No dial tone"); + case NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER: + return _("No carrier could be established"); + case NM_DEVICE_STATE_REASON_MODEM_DIAL_TIMEOUT: + return _("The dialing request timed out"); + case NM_DEVICE_STATE_REASON_MODEM_DIAL_FAILED: + return _("The dialing attempt failed"); + case NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED: + return _("Modem initialization failed"); + case NM_DEVICE_STATE_REASON_GSM_APN_FAILED: + return _("Failed to select the specified APN"); + case NM_DEVICE_STATE_REASON_GSM_REGISTRATION_NOT_SEARCHING: + return _("Not searching for networks"); + case NM_DEVICE_STATE_REASON_GSM_REGISTRATION_DENIED: + return _("Network registration denied"); + case NM_DEVICE_STATE_REASON_GSM_REGISTRATION_TIMEOUT: + return _("Network registration timed out"); + case NM_DEVICE_STATE_REASON_GSM_REGISTRATION_FAILED: + return _("Failed to register with the requested network"); + case NM_DEVICE_STATE_REASON_GSM_PIN_CHECK_FAILED: + return _("PIN check failed"); + case NM_DEVICE_STATE_REASON_FIRMWARE_MISSING: + return _("Necessary firmware for the device may be missing"); + case NM_DEVICE_STATE_REASON_REMOVED: + return _("The device was removed"); + case NM_DEVICE_STATE_REASON_SLEEPING: + return _("NetworkManager went to sleep"); + case NM_DEVICE_STATE_REASON_CONNECTION_REMOVED: + return _("The device's active connection disappeared"); + case NM_DEVICE_STATE_REASON_USER_REQUESTED: + return _("Device disconnected by user or client"); + case NM_DEVICE_STATE_REASON_CARRIER: + return _("Carrier/link changed"); + case NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED: + return _("The device's existing connection was assumed"); + case NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE: + return _("The supplicant is now available"); + case NM_DEVICE_STATE_REASON_MODEM_NOT_FOUND: + return _("The modem could not be found"); + case NM_DEVICE_STATE_REASON_BT_FAILED: + return _("The Bluetooth connection failed or timed out"); + case NM_DEVICE_STATE_REASON_GSM_SIM_NOT_INSERTED: + return _("GSM Modem's SIM card not inserted"); + case NM_DEVICE_STATE_REASON_GSM_SIM_PIN_REQUIRED: + return _("GSM Modem's SIM PIN required"); + case NM_DEVICE_STATE_REASON_GSM_SIM_PUK_REQUIRED: + return _("GSM Modem's SIM PUK required"); + case NM_DEVICE_STATE_REASON_GSM_SIM_WRONG: + return _("GSM Modem's SIM wrong"); + case NM_DEVICE_STATE_REASON_INFINIBAND_MODE: + return _("InfiniBand device does not support connected mode"); + case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED: + return _("A dependency of the connection failed"); + case NM_DEVICE_STATE_REASON_BR2684_FAILED: + return _("A problem with the RFC 2684 Ethernet over ADSL bridge"); + case NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE: + return _("ModemManager is unavailable"); + case NM_DEVICE_STATE_REASON_SSID_NOT_FOUND: + return _("The Wi-Fi network could not be found"); + case NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED: + return _("A secondary connection of the base connection failed"); + case NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED: + return _("DCB or FCoE setup failed"); + case NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED: + return _("teamd control failed"); + case NM_DEVICE_STATE_REASON_MODEM_FAILED: + return _("Modem failed or no longer available"); + case NM_DEVICE_STATE_REASON_MODEM_AVAILABLE: + return _("Modem now ready and available"); + case NM_DEVICE_STATE_REASON_SIM_PIN_INCORRECT: + return _("SIM PIN was incorrect"); + case NM_DEVICE_STATE_REASON_NEW_ACTIVATION: + return _("New connection activation was enqueued"); + case NM_DEVICE_STATE_REASON_PARENT_CHANGED: + return _("The device's parent changed"); + case NM_DEVICE_STATE_REASON_PARENT_MANAGED_CHANGED: + return _("The device parent's management changed"); + + case NM_DEVICE_STATE_REASON_OVSDB_FAILED: + return _("OpenVSwitch database connection failed"); + } + + /* TRANSLATORS: Unknown reason for a device state change (NMDeviceStateReason) */ + return _("Unknown"); +} + +const char * +nm_active_connection_state_reason_to_string (NMActiveConnectionStateReason reason) +{ + switch (reason) { + case NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN: + return _("Unknown reason"); + case NM_ACTIVE_CONNECTION_STATE_REASON_NONE: + return _("The connection was disconnected"); + case NM_ACTIVE_CONNECTION_STATE_REASON_USER_DISCONNECTED: + return _("Disconnected by user"); + case NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED: + return _("The base network connection was interrupted"); + case NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_STOPPED: + return _("The VPN service stopped unexpectedly"); + case NM_ACTIVE_CONNECTION_STATE_REASON_IP_CONFIG_INVALID: + return _("The VPN service returned invalid configuration"); + case NM_ACTIVE_CONNECTION_STATE_REASON_CONNECT_TIMEOUT: + return _("The connection attempt timed out"); + case NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT: + return _("The VPN service did not start in time"); + case NM_ACTIVE_CONNECTION_STATE_REASON_SERVICE_START_FAILED: + return _("The VPN service failed to start"); + case NM_ACTIVE_CONNECTION_STATE_REASON_NO_SECRETS: + return _("No valid secrets"); + case NM_ACTIVE_CONNECTION_STATE_REASON_LOGIN_FAILED: + return _("Invalid secrets"); + case NM_ACTIVE_CONNECTION_STATE_REASON_CONNECTION_REMOVED: + return _("The connection was removed"); + case NM_ACTIVE_CONNECTION_STATE_REASON_DEPENDENCY_FAILED: + return _("Master connection failed"); + case NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_REALIZE_FAILED: + return _("Could not create a software link"); + case NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_REMOVED: + return _("The device disappeared"); + default: + /* TRANSLATORS: Unknown reason for a connection state change (NMActiveConnectionStateReason) */ + return _("Unknown"); + } +} + +NMActiveConnectionState +nmc_activation_get_effective_state (NMActiveConnection *active, + NMDevice *device, + const char **reason) +{ + NMActiveConnectionState ac_state; + NMActiveConnectionStateReason ac_reason; + NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN; + NMDeviceStateReason dev_reason = NM_DEVICE_STATE_REASON_UNKNOWN; + + g_return_val_if_fail (active, NM_ACTIVE_CONNECTION_STATE_UNKNOWN); + g_return_val_if_fail (reason, NM_ACTIVE_CONNECTION_STATE_UNKNOWN); + + *reason = NULL; + ac_reason = nm_active_connection_get_state_reason (active); + + if (device) { + dev_state = nm_device_get_state (device); + dev_reason = nm_device_get_state_reason (device); + } + + ac_state = nm_active_connection_get_state (active); + switch (ac_state) { + case NM_ACTIVE_CONNECTION_STATE_DEACTIVATED: + if ( !device + || ac_reason != NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED + || nm_device_get_active_connection (device) != active) { + /* (1) + * - we have no device, + * - or, @ac_reason is specific + * - or, @device no longer references the current @active + * >> we complete with @ac_reason. */ + *reason = nm_active_connection_state_reason_to_string (ac_reason); + } else if ( dev_state <= NM_DEVICE_STATE_DISCONNECTED + || dev_state >= NM_DEVICE_STATE_FAILED) { + /* (2) + * - not (1) + * - and, the device is no longer in an activated state, + * >> we complete with @dev_reason. */ + *reason = nmc_device_reason_to_string (dev_reason); + } else { + /* (3) + * we wait for the device go disconnect. We will get a better + * failure reason from the device (2). */ + return NM_ACTIVE_CONNECTION_STATE_UNKNOWN; + } + break; + case NM_ACTIVE_CONNECTION_STATE_ACTIVATING: + /* activating master connection does not automatically activate any slaves, so their + * active connection state will not progress beyond ACTIVATING state. + * Monitor the device instead. */ + if ( device + && ( NM_IS_DEVICE_BOND (device) + || NM_IS_DEVICE_TEAM (device) + || NM_IS_DEVICE_BRIDGE (device)) + && dev_state >= NM_DEVICE_STATE_IP_CONFIG + && dev_state <= NM_DEVICE_STATE_ACTIVATED) { + *reason = "master waiting for slaves"; + return NM_ACTIVE_CONNECTION_STATE_ACTIVATED; + } + break; + default: + break; + } + + return ac_state; +} diff --git a/clients/common/nm-client-utils.h b/clients/common/nm-client-utils.h new file mode 100644 index 00000000..ac18fe94 --- /dev/null +++ b/clients/common/nm-client-utils.h @@ -0,0 +1,59 @@ +/* nmcli - command-line tool to control NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2010 - 2017 Red Hat, Inc. + */ + +#ifndef __NM_CLIENT_UTILS_H__ +#define __NM_CLIENT_UTILS_H__ + +#include "nm-meta-setting.h" +#include "nm-active-connection.h" +#include "nm-device.h" + +typedef enum { + NMC_TRI_STATE_NO, + NMC_TRI_STATE_YES, + NMC_TRI_STATE_UNKNOWN, +} NMCTriStateValue; + +const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error); + +char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens); + +gboolean nmc_string_to_uint (const char *str, + gboolean range_check, + unsigned long int min, + unsigned long int max, + unsigned long int *value); +gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error); +gboolean nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error); + +gboolean matches (const char *cmd, const char *pattern); + +/* FIXME: don't expose this function on it's own, at least not from this file. */ +const char *nmc_bond_validate_mode (const char *mode, GError **error); + +const char *nm_active_connection_state_reason_to_string (NMActiveConnectionStateReason reason); +const char *nmc_device_state_to_string (NMDeviceState state); +const char *nmc_device_reason_to_string (NMDeviceStateReason reason); +const char *nmc_device_metered_to_string (NMMetered value); + +NMActiveConnectionState nmc_activation_get_effective_state (NMActiveConnection *active, + NMDevice *device, + const char **reason); + +#endif /* __NM_CLIENT_UTILS_H__ */ diff --git a/clients/common/nm-meta-setting-access.c b/clients/common/nm-meta-setting-access.c new file mode 100644 index 00000000..cd7ef783 --- /dev/null +++ b/clients/common/nm-meta-setting-access.c @@ -0,0 +1,638 @@ +/* NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2010 - 2017 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-meta-setting-access.h" + +/*****************************************************************************/ + +const NMMetaSettingInfoEditor * +nm_meta_setting_info_editor_find_by_name (const char *setting_name, gboolean use_alias) +{ + const NMMetaSettingInfo *meta_setting_info; + const NMMetaSettingInfoEditor *setting_info; + guint i; + + g_return_val_if_fail (setting_name, NULL); + + meta_setting_info = nm_meta_setting_infos_by_name (setting_name); + setting_info = NULL; + if (meta_setting_info) { + nm_assert (nm_streq0 (meta_setting_info->setting_name, setting_name)); + if (meta_setting_info->meta_type < G_N_ELEMENTS (nm_meta_setting_infos_editor)) { + setting_info = &nm_meta_setting_infos_editor[meta_setting_info->meta_type]; + nm_assert (setting_info->general == meta_setting_info); + } + } + if (!setting_info && use_alias) { + for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) { + if (nm_streq0 (nm_meta_setting_infos_editor[i].alias, setting_name)) { + setting_info = &nm_meta_setting_infos_editor[i]; + break; + } + } + } + + return setting_info; +} + +const NMMetaSettingInfoEditor * +nm_meta_setting_info_editor_find_by_gtype (GType gtype) +{ + const NMMetaSettingInfo *meta_setting_info; + const NMMetaSettingInfoEditor *setting_info; + + meta_setting_info = nm_meta_setting_infos_by_gtype (gtype); + + if (!meta_setting_info) + return NULL; + + g_return_val_if_fail (meta_setting_info->get_setting_gtype, NULL); + g_return_val_if_fail (meta_setting_info->get_setting_gtype () == gtype, NULL); + + if (meta_setting_info->meta_type >= G_N_ELEMENTS (nm_meta_setting_infos_editor)) + return NULL; + + setting_info = &nm_meta_setting_infos_editor[meta_setting_info->meta_type]; + + g_return_val_if_fail (setting_info->general == meta_setting_info, NULL); + + return setting_info; +} + +const NMMetaSettingInfoEditor * +nm_meta_setting_info_editor_find_by_setting (NMSetting *setting) +{ + const NMMetaSettingInfoEditor *setting_info; + + g_return_val_if_fail (NM_IS_SETTING (setting), NULL); + + setting_info = nm_meta_setting_info_editor_find_by_gtype (G_OBJECT_TYPE (setting)); + + nm_assert (setting_info == nm_meta_setting_info_editor_find_by_name (nm_setting_get_name (setting), FALSE)); + nm_assert (!setting_info || G_TYPE_CHECK_INSTANCE_TYPE (setting, setting_info->general->get_setting_gtype ())); + + return setting_info; +} + +const NMMetaPropertyInfo * +nm_meta_setting_info_editor_get_property_info (const NMMetaSettingInfoEditor *setting_info, const char *property_name) +{ + guint i; + + g_return_val_if_fail (setting_info, NULL); + g_return_val_if_fail (property_name, NULL); + + for (i = 0; i < setting_info->properties_num; i++) { + nm_assert (setting_info->properties[i]->property_name); + nm_assert (setting_info->properties[i]->setting_info == setting_info); + if (nm_streq (setting_info->properties[i]->property_name, property_name)) + return setting_info->properties[i]; + } + + return NULL; +} + +const NMMetaPropertyInfo * +nm_meta_property_info_find_by_name (const char *setting_name, const char *property_name) +{ + const NMMetaSettingInfoEditor *setting_info; + const NMMetaPropertyInfo *property_info; + + setting_info = nm_meta_setting_info_editor_find_by_name (setting_name, FALSE); + if (!setting_info) + return NULL; + + property_info = nm_meta_setting_info_editor_get_property_info (setting_info, property_name); + if (!property_info) + return NULL; + + nm_assert (property_info->setting_info == setting_info); + + return property_info; +} + +const NMMetaPropertyInfo * +nm_meta_property_info_find_by_setting (NMSetting *setting, const char *property_name) +{ + const NMMetaSettingInfoEditor *setting_info; + const NMMetaPropertyInfo *property_info; + + setting_info = nm_meta_setting_info_editor_find_by_setting (setting); + if (!setting_info) + return NULL; + property_info = nm_meta_setting_info_editor_get_property_info (setting_info, property_name); + if (!property_info) + return NULL; + + nm_assert (property_info->setting_info == setting_info); + nm_assert (property_info == nm_meta_property_info_find_by_name (nm_setting_get_name (setting), property_name)); + + return property_info; +} + +NMSetting * +nm_meta_setting_info_editor_new_setting (const NMMetaSettingInfoEditor *setting_info, + NMMetaAccessorSettingInitType init_type) +{ + NMSetting *setting; + + g_return_val_if_fail (setting_info, NULL); + + setting = g_object_new (setting_info->general->get_setting_gtype (), NULL); + + if ( setting_info->setting_init_fcn + && init_type != NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT) { + setting_info->setting_init_fcn (setting_info, + setting, + init_type); + } + + return setting; +} + +/*****************************************************************************/ + +const NMMetaSettingInfoEditor *const* +nm_meta_setting_infos_editor_p (void) +{ + static const NMMetaSettingInfoEditor *cache[_NM_META_SETTING_TYPE_NUM + 1] = { NULL }; + guint i; + + if (G_UNLIKELY (!cache[0])) { + for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) + cache[i] = &nm_meta_setting_infos_editor[i]; + } + return cache; +} + +/*****************************************************************************/ + +const char * +nm_meta_abstract_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header) +{ + const char *n; + + nm_assert (abstract_info); + nm_assert (abstract_info->meta_type); + nm_assert (abstract_info->meta_type->get_name); + n = abstract_info->meta_type->get_name (abstract_info, for_header); + nm_assert (n && n[0]); + return n; +} + +const NMMetaAbstractInfo *const* +nm_meta_abstract_info_get_nested (const NMMetaAbstractInfo *abstract_info, + guint *out_len, + gpointer *nested_to_free) +{ + const NMMetaAbstractInfo *const*nested; + guint l = 0; + gs_free gpointer f = NULL; + + nm_assert (abstract_info); + nm_assert (abstract_info->meta_type); + nm_assert (nested_to_free && !*nested_to_free); + + if (abstract_info->meta_type->get_nested) { + nested = abstract_info->meta_type->get_nested (abstract_info, &l, &f); + nm_assert ((nested ? g_strv_length ((char **) nested) : 0) == l); + if (nested && nested[0]) { + NM_SET_OUT (out_len, l); + *nested_to_free = g_steal_pointer (&f); + return nested; + } + } + NM_SET_OUT (out_len, 0); + return NULL; +} + +gconstpointer +nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + gpointer target, + NMMetaAccessorGetType get_type, + NMMetaAccessorGetFlags get_flags, + NMMetaAccessorGetOutFlags *out_flags, + gpointer *out_to_free) +{ + nm_assert (abstract_info); + nm_assert (abstract_info->meta_type); + nm_assert (!out_to_free || !*out_to_free); + nm_assert (out_flags); + + *out_flags = NM_META_ACCESSOR_GET_OUT_FLAGS_NONE; + + if (!abstract_info->meta_type->get_fcn) + g_return_val_if_reached (NULL); + + return abstract_info->meta_type->get_fcn (abstract_info, + environment, + environment_user_data, + target, + get_type, + get_flags, + out_flags, + out_to_free); +} + +const char *const* +nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + const NMMetaOperationContext *operation_context, + const char *text, + char ***out_to_free) +{ + const char *const*values; + gsize i, j, text_len; + + nm_assert (abstract_info); + nm_assert (abstract_info->meta_type); + nm_assert (out_to_free && !*out_to_free); + + *out_to_free = NULL; + + if (!abstract_info->meta_type->complete_fcn) + return NULL; + + values = abstract_info->meta_type->complete_fcn (abstract_info, + environment, + environment_user_data, + operation_context, + text, + out_to_free); + + nm_assert (!*out_to_free || values == (const char *const*) *out_to_free); + + if (!values) + return NULL; + + if (!values[0]) { + nm_clear_g_free (out_to_free); + return NULL; + } + + if (!text || !text[0]) + return values; + + /* for convenience, we allow the complete_fcn() implementations to + * ignore "text". We filter out invalid matches here. */ + + text_len = strlen (text); + + if (*out_to_free) { + char **v = *out_to_free; + + for (i = 0, j = 0; v[i]; i++) { + if (strncmp (v[i], text, text_len) != 0) { + g_free (v[i]); + continue; + } + v[j++] = v[i]; + } + if (j) + v[j++] = NULL; + else { + g_free (v); + *out_to_free = v = NULL; + } + return (const char *const*) v; + } else { + const char *const*v = values; + char **r; + + for (i = 0, j = 0; v[i]; i++) { + if (strncmp (v[i], text, text_len) != 0) + continue; + j++; + } + if (j == i) + return values; + else if (!j) + return NULL; + + r = g_new (char *, j + 1); + v = values; + for (i = 0, j = 0; v[i]; i++) { + if (strncmp (v[i], text, text_len) != 0) + continue; + r[j++] = g_strdup (v[i]); + } + r[j++] = NULL; + return (const char *const*) (*out_to_free = r); + } +} + +/*****************************************************************************/ + +char * +nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix) +{ + gs_free gpointer nested_to_free = NULL; + guint i; + const NMMetaAbstractInfo *const*nested; + GString *allowed_fields; + + nested = nm_meta_abstract_info_get_nested (abstract_info, NULL, &nested_to_free); + if (!nested) + return NULL; + + allowed_fields = g_string_sized_new (256); + + if (!name_prefix) + name_prefix = nm_meta_abstract_info_get_name (abstract_info, FALSE); + + for (i = 0; nested[i]; i++) { + g_string_append_printf (allowed_fields, "%s.%s,", + name_prefix, nm_meta_abstract_info_get_name (nested[i], FALSE)); + } + g_string_truncate (allowed_fields, allowed_fields->len - 1); + return g_string_free (allowed_fields, FALSE); +} + +char * +nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix) +{ + GString *allowed_fields; + guint i; + + if (!fields_array || !fields_array[0]) + return NULL; + + allowed_fields = g_string_sized_new (256); + for (i = 0; fields_array[i]; i++) { + if (name_prefix) + g_string_append_printf (allowed_fields, "%s.", name_prefix); + g_string_append_printf (allowed_fields, "%s,", nm_meta_abstract_info_get_name (fields_array[i], FALSE)); + } + g_string_truncate (allowed_fields, allowed_fields->len - 1); + return g_string_free (allowed_fields, FALSE); +} + +/*****************************************************************************/ + +typedef struct { + guint idx; + gsize self_offset_plus_1; + gsize sub_offset_plus_1; +} OutputSelectionItem; + +static NMMetaSelectionResultList * +_output_selection_pack (const NMMetaAbstractInfo *const* fields_array, + GArray *array, + GString *str) +{ + NMMetaSelectionResultList *result; + guint i; + guint len; + + len = array ? array->len : 0; + + /* re-organize the collected output data in one buffer that can be freed using + * g_free(). This makes allocation more complicated, but saves us from special + * handling for free. */ + result = g_malloc0 (sizeof (NMMetaSelectionResultList) + (len * sizeof (NMMetaSelectionItem)) + (str ? str->len : 0)); + *((guint *) &result->num) = len; + if (len > 0) { + char *pdata = &((char *) result)[sizeof (NMMetaSelectionResultList) + (len * sizeof (NMMetaSelectionItem))]; + + if (str) + memcpy (pdata, str->str, str->len); + for (i = 0; i < len; i++) { + const OutputSelectionItem *a = &g_array_index (array, OutputSelectionItem, i); + NMMetaSelectionItem *p = (NMMetaSelectionItem *) &result->items[i]; + + p->info = fields_array[a->idx]; + p->idx = a->idx; + if (a->self_offset_plus_1 > 0) + p->self_selection = &pdata[a->self_offset_plus_1 - 1]; + if (a->sub_offset_plus_1 > 0) + p->sub_selection = &pdata[a->sub_offset_plus_1 - 1]; + } + } + + return result; +} + +static gboolean +_output_selection_select_one (const NMMetaAbstractInfo *const* fields_array, + const char *fields_prefix, + const char *fields_str, + gboolean validate_nested, + GArray **p_array, + GString **p_str, + GError **error) +{ + guint i, j; + const char *i_name; + const char *right; + gboolean found = FALSE; + const NMMetaAbstractInfo *fields_array_failure = NULL; + gs_free char *fields_str_clone = NULL; + + nm_assert (fields_str); + nm_assert (p_array); + nm_assert (p_str); + nm_assert (!error || !*error); + + right = strchr (fields_str, '.'); + if (right) { + fields_str_clone = g_strdup (fields_str); + fields_str_clone[right - fields_str] = '\0'; + i_name = fields_str_clone; + right = &fields_str_clone[right - fields_str + 1]; + } else + i_name = fields_str; + + if (!fields_array) + goto not_found; + + for (i = 0; fields_array[i]; i++) { + const NMMetaAbstractInfo *fi = fields_array[i]; + const NMMetaAbstractInfo *const*nested; + gs_free gpointer nested_to_free = NULL; + + if (g_ascii_strcasecmp (i_name, nm_meta_abstract_info_get_name (fi, FALSE)) != 0) + continue; + + if (!right || !validate_nested) { + found = TRUE; + break; + } + + nested = nm_meta_abstract_info_get_nested (fi, NULL, &nested_to_free); + if (nested) { + for (j = 0; nested[j]; nested++) { + if (g_ascii_strcasecmp (right, nm_meta_abstract_info_get_name (nested[j], FALSE)) == 0) { + found = TRUE; + break; + } + } + } + fields_array_failure = fields_array[i]; + break; + } + + if (!found) { +not_found: + if ( !right + && !fields_prefix + && ( !g_ascii_strcasecmp (i_name, "all") + || !g_ascii_strcasecmp (i_name, "common"))) + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, _("field '%s' has to be alone"), i_name); + else { + gs_free char *allowed_fields = NULL; + + if (fields_array_failure) { + gs_free char *p = NULL; + + if (fields_prefix) { + p = g_strdup_printf ("%s.%s", fields_prefix, + nm_meta_abstract_info_get_name (fields_array_failure, FALSE)); + } + allowed_fields = nm_meta_abstract_info_get_nested_names_str (fields_array_failure, p); + } else + allowed_fields = nm_meta_abstract_infos_get_names_str (fields_array, NULL); + + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, _("invalid field '%s%s%s%s%s'; %s%s%s"), + fields_prefix ?: "", fields_prefix ? "." : "", + i_name, right ? "." : "", right ?: "", + NM_PRINT_FMT_QUOTED (allowed_fields, "allowed fields: ", allowed_fields, "", "no fields")); + } + return FALSE; + } + + { + GString *str; + OutputSelectionItem s = { + .idx = i, + }; + + if (!*p_str) + *p_str = g_string_sized_new (64); + str = *p_str; + + s.self_offset_plus_1 = str->len + 1; + if (fields_prefix) { + g_string_append (str, fields_prefix); + g_string_append_c (str, '.'); + } + g_string_append_len (str, i_name, strlen (i_name) + 1); + + if (right) { + s.sub_offset_plus_1 = str->len + 1; + g_string_append_len (str, right, strlen (right) + 1); + } + + if (!*p_array) + *p_array = g_array_new (FALSE, FALSE, sizeof (OutputSelectionItem)); + g_array_append_val (*p_array, s); + } + + return TRUE; +} + +NMMetaSelectionResultList * +nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array) +{ + gs_unref_array GArray *array = NULL; + guint i; + + if (fields_array) { + array = g_array_new (FALSE, FALSE, sizeof (OutputSelectionItem)); + for (i = 0; fields_array[i]; i++) { + OutputSelectionItem s = { + .idx = i, + }; + + g_array_append_val (array, s); + } + } + + return _output_selection_pack (fields_array, array, NULL); +} + +NMMetaSelectionResultList * +nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array, + const char *fields_prefix, + const char *fields_str, /* one field selector (contains no commas) and is already stripped of spaces. */ + gboolean validate_nested, + GError **error) +{ + gs_unref_array GArray *array = NULL; + nm_auto_free_gstring GString *str = NULL; + + g_return_val_if_fail (!error || !*error, NULL); + nm_assert (fields_str && !strchr (fields_str, ',')); + + if (!_output_selection_select_one (fields_array, + fields_prefix, + fields_str, + validate_nested, + &array, + &str, + error)) + return NULL; + return _output_selection_pack (fields_array, array, str); + +} + +NMMetaSelectionResultList * +nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array, + const char *fields_prefix, + const char *fields_str, /* a comma separated list of selectors */ + gboolean validate_nested, + GError **error) +{ + gs_unref_array GArray *array = NULL; + nm_auto_free_gstring GString *str = NULL; + gs_free char *fields_str_clone = NULL; + char *fields_str_cur; + char *fields_str_next; + + g_return_val_if_fail (!error || !*error, NULL); + + if (!fields_str) + return nm_meta_selection_create_all (fields_array); + + fields_str_clone = g_strdup (fields_str); + for (fields_str_cur = fields_str_clone; fields_str_cur; fields_str_cur = fields_str_next) { + fields_str_cur = nm_str_skip_leading_spaces (fields_str_cur); + fields_str_next = strchr (fields_str_cur, ','); + if (fields_str_next) + *fields_str_next++ = '\0'; + + g_strchomp (fields_str_cur); + if (!fields_str_cur[0]) + continue; + if (!_output_selection_select_one (fields_array, + fields_prefix, + fields_str_cur, + validate_nested, + &array, + &str, + error)) + return NULL; + } + + return _output_selection_pack (fields_array, array, str); +} diff --git a/clients/common/nm-meta-setting-access.h b/clients/common/nm-meta-setting-access.h new file mode 100644 index 00000000..54fc6c84 --- /dev/null +++ b/clients/common/nm-meta-setting-access.h @@ -0,0 +1,101 @@ +/* NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2010 - 2017 Red Hat, Inc. + */ + +#ifndef _NM_META_SETTING_ACCESS_H__ +#define _NM_META_SETTING_ACCESS_H__ + +#include "nm-meta-setting.h" +#include "nm-meta-setting-desc.h" + +/*****************************************************************************/ + +NMSetting *nm_meta_setting_info_editor_new_setting (const NMMetaSettingInfoEditor *setting_info, + NMMetaAccessorSettingInitType init_type); + +const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_name (const char *setting_name, gboolean use_alias); +const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_gtype (GType gtype); +const NMMetaSettingInfoEditor *nm_meta_setting_info_editor_find_by_setting (NMSetting *setting); + +const NMMetaPropertyInfo *nm_meta_setting_info_editor_get_property_info (const NMMetaSettingInfoEditor *setting_info, + const char *property_name); +const NMMetaPropertyInfo *nm_meta_property_info_find_by_name (const char *setting_name, + const char *property_name); +const NMMetaPropertyInfo *nm_meta_property_info_find_by_setting (NMSetting *setting, + const char *property_name); + +/*****************************************************************************/ + +const NMMetaSettingInfoEditor *const*nm_meta_setting_infos_editor_p (void); + +/*****************************************************************************/ + +const char *nm_meta_abstract_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header); + +const NMMetaAbstractInfo *const*nm_meta_abstract_info_get_nested (const NMMetaAbstractInfo *abstract_info, + guint *out_len, + gpointer *nested_to_free); + +gconstpointer nm_meta_abstract_info_get (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + gpointer target, + NMMetaAccessorGetType get_type, + NMMetaAccessorGetFlags get_flags, + NMMetaAccessorGetOutFlags *out_flags, + gpointer *out_to_free); + +const char *const*nm_meta_abstract_info_complete (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + const NMMetaOperationContext *operation_context, + const char *text, + char ***out_to_free); + +/*****************************************************************************/ + +char *nm_meta_abstract_info_get_nested_names_str (const NMMetaAbstractInfo *abstract_info, const char *name_prefix); +char *nm_meta_abstract_infos_get_names_str (const NMMetaAbstractInfo *const*fields_array, const char *name_prefix); + +/*****************************************************************************/ + +typedef struct { + const NMMetaAbstractInfo *info; + const char *self_selection; + const char *sub_selection; + guint idx; +} NMMetaSelectionItem; + +typedef struct { + const guint num; + const NMMetaSelectionItem items[]; +} NMMetaSelectionResultList; + +NMMetaSelectionResultList *nm_meta_selection_create_all (const NMMetaAbstractInfo *const* fields_array); +NMMetaSelectionResultList *nm_meta_selection_create_parse_one (const NMMetaAbstractInfo *const* fields_array, + const char *fields_prefix, + const char *fields_str, + gboolean validate_nested, + GError **error); +NMMetaSelectionResultList *nm_meta_selection_create_parse_list (const NMMetaAbstractInfo *const* fields_array, + const char *fields_prefix, + const char *fields_str, + gboolean validate_nested, + GError **error); + +#endif /* _NM_META_SETTING_ACCESS_H__ */ diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c new file mode 100644 index 00000000..1ed6b433 --- /dev/null +++ b/clients/common/nm-meta-setting-desc.c @@ -0,0 +1,7284 @@ +/* nmcli - command-line tool to control NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2010 - 2017 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-meta-setting-desc.h" + +#include <stdlib.h> +#include <arpa/inet.h> + +#include "nm-common-macros.h" +#include "nm-utils/nm-hash-utils.h" +#include "nm-utils/nm-enum-utils.h" + +#include "NetworkManager.h" +#include "nm-vpn-helpers.h" +#include "nm-client-utils.h" +#include "nm-meta-setting-access.h" + +/*****************************************************************************/ + +static char *secret_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type); + +#define ALL_SECRET_FLAGS \ + (NM_SETTING_SECRET_FLAG_NONE | \ + NM_SETTING_SECRET_FLAG_AGENT_OWNED | \ + NM_SETTING_SECRET_FLAG_NOT_SAVED | \ + NM_SETTING_SECRET_FLAG_NOT_REQUIRED) + +/*****************************************************************************/ + +static GType +_gobject_property_get_gtype (GObject *gobject, const char *property_name) +{ + GParamSpec *param_spec; + + param_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (gobject), property_name); + if (param_spec) + return param_spec->value_type; + g_return_val_if_reached (G_TYPE_INVALID); +} + +static GType +_gtype_property_get_gtype (GType gtype, const char *property_name) +{ + /* given @gtype, a type for a GObject, lookup the property @property_name + * and return its value_type. */ + if (G_TYPE_IS_CLASSED (gtype)) { + GParamSpec *param_spec; + nm_auto_unref_gtypeclass GTypeClass *gtypeclass = g_type_class_ref (gtype); + + if (G_IS_OBJECT_CLASS (gtypeclass)) { + param_spec = g_object_class_find_property (G_OBJECT_CLASS (gtypeclass), property_name); + if (param_spec) + return param_spec->value_type; + } + } + g_return_val_if_reached (G_TYPE_INVALID); +} + +/*****************************************************************************/ + +static NMIPAddress * +_parse_ip_address (int family, const char *address, GError **error) +{ + gs_free char *ip_str = NULL; + const int MAX_PREFIX = (family == AF_INET) ? 32 : 128; + NMIPAddress *addr; + char *plen; + int prefix; + GError *local = NULL; + + g_return_val_if_fail (address, NULL); + g_return_val_if_fail (!error || !*error, NULL); + + ip_str = g_strstrip (g_strdup (address)); + + prefix = MAX_PREFIX; + + plen = strchr (ip_str, '/'); + if (plen) { + *plen++ = '\0'; + if ((prefix = _nm_utils_ascii_str_to_int64 (plen, 10, 1, MAX_PREFIX, -1)) == -1) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid prefix '%s'; <1-%d> allowed"), plen, MAX_PREFIX); + return NULL; + } + } + + addr = nm_ip_address_new (family, ip_str, prefix, &local); + if (!addr) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid IP address: %s"), local->message); + g_clear_error (&local); + } + return addr; +} + +static NMIPRoute * +_parse_ip_route (int family, + const char *str, + GError **error) +{ + const int MAX_PREFIX = (family == AF_INET) ? 32 : 128; + char *plen = NULL; + const char *next_hop = NULL; + const char *canon_dest; + int prefix; + NMIPRoute *route = NULL; + GError *local = NULL; + gint64 metric = -1; + guint i; + gs_strfreev char **routev = NULL; + gs_free char *str_clean = NULL; + char *dest; + gs_unref_hashtable GHashTable *attrs = NULL; + GHashTable *tmp_attrs; +#define ROUTE_SYNTAX _("The valid syntax is: 'ip[/prefix] [next-hop] [metric] [attribute=val]... [,ip[/prefix] ...]'") + + nm_assert (NM_IN_SET (family, AF_INET, AF_INET6)); + nm_assert (str); + nm_assert (!error || !*error); + + str_clean = g_strstrip (g_strdup (str)); + routev = nmc_strsplit_set (str_clean, " \t", 0); + if (!routev || !routev[0]) { + g_set_error (error, 1, 0, + "'%s' is not valid. %s", + str, ROUTE_SYNTAX); + return NULL; + } + + dest = routev[0]; + plen = strchr (dest, '/'); /* prefix delimiter */ + if (plen) + *plen++ = '\0'; + prefix = MAX_PREFIX; + if (plen) { + if ((prefix = _nm_utils_ascii_str_to_int64 (plen, 10, 1, MAX_PREFIX, -1)) == -1) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid prefix '%s'; <1-%d> allowed"), + plen, MAX_PREFIX); + return NULL; + } + } + + for (i = 1; routev[i]; i++) { + gint64 tmp64; + + if (nm_utils_ipaddr_valid (family, routev[i])) { + if (metric != -1 || attrs) { + g_set_error (error, 1, 0, _("the next hop ('%s') must be first"), routev[i]); + return NULL; + } + next_hop = routev[i]; + } else if ((tmp64 = _nm_utils_ascii_str_to_int64 (routev[i], 10, 0, G_MAXUINT32, -1)) != -1) { + if (attrs) { + g_set_error (error, 1, 0, _("the metric ('%s') must be before attributes"), routev[i]); + return NULL; + } + metric = tmp64; + } else if (strchr (routev[i], '=')) { + GHashTableIter iter; + char *iter_key; + GVariant *iter_value; + + tmp_attrs = nm_utils_parse_variant_attributes (routev[i], ' ', '=', FALSE, + nm_ip_route_get_variant_attribute_spec(), + error); + if (!tmp_attrs) { + g_prefix_error (error, "invalid option '%s': ", routev[i]); + return NULL; + } + + if (!attrs) + attrs = g_hash_table_new (nm_str_hash, g_str_equal); + + g_hash_table_iter_init (&iter, tmp_attrs); + while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) { + if (!nm_ip_route_attribute_validate (iter_key, iter_value, family, NULL, error)) { + g_prefix_error (error, "%s: ", iter_key); + g_hash_table_unref (tmp_attrs); + return NULL; + } + g_hash_table_insert (attrs, iter_key, iter_value); + g_hash_table_iter_steal (&iter); + } + g_hash_table_unref (tmp_attrs); + } else { + g_set_error (error, 1, 0, "%s", ROUTE_SYNTAX); + return NULL; + } + } + + route = nm_ip_route_new (family, dest, prefix, next_hop, metric, &local); + if (!route) { + g_set_error (error, 1, 0, + _("invalid route: %s. %s"), local->message, ROUTE_SYNTAX); + g_clear_error (&local); + return NULL; + } + + /* We don't accept default routes as NetworkManager handles it + * itself. But we have to check this after @route has normalized the + * dest string. + */ + canon_dest = nm_ip_route_get_dest (route); + if (!strcmp (canon_dest, "0.0.0.0") || !strcmp (canon_dest, "::")) { + g_set_error_literal (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("default route cannot be added (NetworkManager handles it by itself)")); + g_clear_pointer (&route, nm_ip_route_unref); + return NULL; + } + + if (attrs) { + GHashTableIter iter; + char *name; + GVariant *variant; + + g_hash_table_iter_init (&iter, attrs); + while (g_hash_table_iter_next (&iter, (gpointer *) &name, (gpointer *) &variant)) + nm_ip_route_set_attribute (route, name, variant); + } + + return route; +} + +/* Max priority values from libnm-core/nm-setting-vlan.c */ +#define MAX_SKB_PRIO G_MAXUINT32 +#define MAX_8021P_PRIO 7 /* Max 802.1p priority */ + +/* + * Parse VLAN priority mappings from the following format: 2:1,3:4,7:3 + * and verify if the priority numbers are valid + * + * Return: string array with split maps, or NULL on error + * Caller is responsible for freeing the array. + */ +static char ** +_parse_vlan_priority_maps (const char *priority_map, + NMVlanPriorityMap map_type, + GError **error) +{ + char **mapping = NULL, **iter; + unsigned long from, to, from_max, to_max; + + g_return_val_if_fail (priority_map != NULL, NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + if (map_type == NM_VLAN_INGRESS_MAP) { + from_max = MAX_8021P_PRIO; + to_max = MAX_SKB_PRIO; + } else { + from_max = MAX_SKB_PRIO; + to_max = MAX_8021P_PRIO; + } + + mapping = g_strsplit (priority_map, ",", 0); + for (iter = mapping; iter && *iter; iter++) { + char *left, *right; + + left = g_strstrip (*iter); + right = strchr (left, ':'); + if (!right) { + g_set_error (error, 1, 0, _("invalid priority map '%s'"), *iter); + g_strfreev (mapping); + return NULL; + } + *right++ = '\0'; + + if (!nmc_string_to_uint (left, TRUE, 0, from_max, &from)) { + g_set_error (error, 1, 0, _("priority '%s' is not valid (<0-%ld>)"), + left, from_max); + g_strfreev (mapping); + return NULL; + } + if (!nmc_string_to_uint (right, TRUE, 0, to_max, &to)) { + g_set_error (error, 1, 0, _("priority '%s' is not valid (<0-%ld>)"), + right, to_max); + g_strfreev (mapping); + return NULL; + } + *(right-1) = ':'; /* Put back ':' */ + } + return mapping; +} + +/* + * nmc_proxy_check_script: + * @script: file name with PAC script, or raw PAC Script data + * @out_script: raw PAC Script (with removed new-line characters) + * @error: location to store error, or %NULL + * + * Check PAC Script from @script parameter and return the checked/sanitized + * config in @out_script. + * + * Returns: %TRUE if the script is valid, %FALSE if it is invalid + */ +static gboolean +nmc_proxy_check_script (const char *script, char **out_script, GError **error) +{ + enum { + _PAC_SCRIPT_TYPE_GUESS, + _PAC_SCRIPT_TYPE_FILE, + _PAC_SCRIPT_TYPE_JSON, + } desired_type = _PAC_SCRIPT_TYPE_GUESS; + const char *filename = NULL; + size_t c_len = 0; + gs_free char *script_clone = NULL; + + *out_script = NULL; + + if (!script || !script[0]) + return TRUE; + + if (g_str_has_prefix (script, "file://")) { + script += NM_STRLEN ("file://"); + desired_type = _PAC_SCRIPT_TYPE_FILE; + } else if (g_str_has_prefix (script, "js://")) { + script += NM_STRLEN ("js://"); + desired_type = _PAC_SCRIPT_TYPE_JSON; + } + + if (NM_IN_SET (desired_type, _PAC_SCRIPT_TYPE_FILE, _PAC_SCRIPT_TYPE_GUESS)) { + gs_free char *contents = NULL; + + if (!g_file_get_contents (script, &contents, &c_len, NULL)) { + if (desired_type == _PAC_SCRIPT_TYPE_FILE) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("cannot read pac-script from file '%s'"), + script); + return FALSE; + } + } else { + if (c_len != strlen (contents)) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("file '%s' contains non-valid utf-8"), + script); + return FALSE; + } + filename = script; + script = script_clone = g_steal_pointer (&contents); + } + } + + if ( !strstr (script, "FindProxyForURL") + || !g_utf8_validate (script, -1, NULL)) { + if (filename) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("'%s' does not contain a valid PAC Script"), filename); + } else { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("Not a valid PAC Script")); + } + return FALSE; + } + + *out_script = (script == script_clone) + ? g_steal_pointer (&script_clone) + : g_strdup (script); + return TRUE; +} + +/* + * nmc_team_check_config: + * @config: file name with team config, or raw team JSON config data + * @out_config: raw team JSON config data + * The value must be freed with g_free(). + * @error: location to store error, or %NUL + * + * Check team config from @config parameter and return the checked + * config in @out_config. + * + * Returns: %TRUE if the config is valid, %FALSE if it is invalid + */ +static gboolean +nmc_team_check_config (const char *config, char **out_config, GError **error) +{ + enum { + _TEAM_CONFIG_TYPE_GUESS, + _TEAM_CONFIG_TYPE_FILE, + _TEAM_CONFIG_TYPE_JSON, + } desired_type = _TEAM_CONFIG_TYPE_GUESS; + const char *filename = NULL; + size_t c_len = 0; + gs_free char *config_clone = NULL; + + *out_config = NULL; + + if (!config || !config[0]) + return TRUE; + + if (g_str_has_prefix (config, "file://")) { + config += NM_STRLEN ("file://"); + desired_type = _TEAM_CONFIG_TYPE_FILE; + } else if (g_str_has_prefix (config, "json://")) { + config += NM_STRLEN ("json://"); + desired_type = _TEAM_CONFIG_TYPE_JSON; + } + + if (NM_IN_SET (desired_type, _TEAM_CONFIG_TYPE_FILE, _TEAM_CONFIG_TYPE_GUESS)) { + gs_free char *contents = NULL; + + if (!g_file_get_contents (config, &contents, &c_len, NULL)) { + if (desired_type == _TEAM_CONFIG_TYPE_FILE) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("cannot read team config from file '%s'"), + config); + return FALSE; + } + } else { + if (c_len != strlen (contents)) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("team config file '%s' contains non-valid utf-8"), + config); + return FALSE; + } + filename = config; + config = config_clone = g_steal_pointer (&contents); + } + } + + if (!nm_utils_is_json_object (config, NULL)) { + if (filename) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("'%s' does not contain a valid team configuration"), filename); + } else { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("team configuration must be a JSON object")); + } + return FALSE; + } + + *out_config = (config == config_clone) + ? g_steal_pointer (&config_clone) + : g_strdup (config); + return TRUE; +} + +static const char * +_get_text_hidden (NMMetaAccessorGetType get_type) +{ + if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) + return _(NM_META_TEXT_HIDDEN); + return NM_META_TEXT_HIDDEN; +} + +/*****************************************************************************/ + +G_GNUC_PRINTF (4, 5) +static void +_env_warn_fcn (const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMMetaEnvWarnLevel warn_level, + const char *fmt_l10n, + ...) +{ + va_list ap; + + if (!environment || !environment->warn_fcn) + return; + + va_start (ap, fmt_l10n); + environment->warn_fcn (environment, + environment_user_data, + warn_level, + fmt_l10n, + ap); + va_end (ap); +} + +/*****************************************************************************/ + +#define ARGS_DESCRIBE_FCN \ + const NMMetaPropertyInfo *property_info, char **out_to_free + +#define ARGS_GET_FCN \ + const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, NMMetaAccessorGetType get_type, NMMetaAccessorGetFlags get_flags, NMMetaAccessorGetOutFlags *out_flags, gpointer *out_to_free + +#define ARGS_SET_FCN \ + const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, const char *value, GError **error + +#define ARGS_REMOVE_FCN \ + const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, NMSetting *setting, const char *value, guint32 idx, GError **error + +#define ARGS_COMPLETE_FCN \ + const NMMetaPropertyInfo *property_info, const NMMetaEnvironment *environment, gpointer environment_user_data, const NMMetaOperationContext *operation_context, const char *text, char ***out_to_free + +#define ARGS_VALUES_FCN \ + const NMMetaPropertyInfo *property_info, char ***out_to_free + +#define ARGS_SETTING_INIT_FCN \ + const NMMetaSettingInfoEditor *setting_info, NMSetting *setting, NMMetaAccessorSettingInitType init_type + +#define RETURN_UNSUPPORTED_GET_TYPE() \ + G_STMT_START { \ + if (!NM_IN_SET (get_type, \ + NM_META_ACCESSOR_GET_TYPE_PARSABLE, \ + NM_META_ACCESSOR_GET_TYPE_PRETTY)) { \ + nm_assert_not_reached (); \ + return NULL; \ + } \ + } G_STMT_END; + +#define RETURN_STR_TO_FREE(val) \ + G_STMT_START { \ + char *_val = (val); \ + return ((*(out_to_free)) = _val); \ + } G_STMT_END + +static gconstpointer +_get_fcn_nmc_with_default (ARGS_GET_FCN) +{ + const char *s; + char *s_full; + GValue val = G_VALUE_INIT; + + RETURN_UNSUPPORTED_GET_TYPE (); + + if (property_info->property_typ_data->subtype.get_with_default.fcn (setting)) { + if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) + return _("(default)"); + return ""; + } + + g_value_init (&val, G_TYPE_STRING); + g_object_get_property (G_OBJECT (setting), property_info->property_name, &val); + s = g_value_get_string (&val); + if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) + s_full = s ? g_strdup_printf ("\"%s\"", s) : g_strdup (""); + else + s_full = g_strdup (s && *s ? s : " "); + g_value_unset (&val); + RETURN_STR_TO_FREE (s_full); +} + +static gconstpointer +_get_fcn_gobject_impl (const NMMetaPropertyInfo *property_info, + NMSetting *setting, + NMMetaAccessorGetType get_type, + gpointer *out_to_free) +{ + char *s; + const char *s_c; + GType gtype_prop; + nm_auto_unset_gvalue GValue val = G_VALUE_INIT; + + RETURN_UNSUPPORTED_GET_TYPE (); + + gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name); + + if (gtype_prop == G_TYPE_BOOLEAN) { + gboolean b; + + g_value_init (&val, gtype_prop); + g_object_get_property (G_OBJECT (setting), property_info->property_name, &val); + b = g_value_get_boolean (&val); + if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) + s_c = b ? _("yes") : _("no"); + else + s_c = b ? "yes" : "no"; + return s_c; + } else { + g_value_init (&val, G_TYPE_STRING); + g_object_get_property (G_OBJECT (setting), property_info->property_name, &val); + s = g_value_dup_string (&val); + RETURN_STR_TO_FREE (s); + } +} + +static gconstpointer +_get_fcn_gobject (ARGS_GET_FCN) +{ + return _get_fcn_gobject_impl (property_info, setting, get_type, out_to_free); +} + +static gconstpointer +_get_fcn_gobject_int (ARGS_GET_FCN) +{ + const GParamSpec *pspec; + nm_auto_unset_gvalue GValue gval = G_VALUE_INIT; + gint64 v; + const NMMetaUtilsIntValueInfo *value_infos; + + RETURN_UNSUPPORTED_GET_TYPE (); + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), property_info->property_name); + if (!G_IS_PARAM_SPEC (pspec)) + g_return_val_if_reached (FALSE); + + g_value_init (&gval, pspec->value_type); + g_object_get_property (G_OBJECT (setting), property_info->property_name, &gval); + switch (pspec->value_type) { + case G_TYPE_INT: + v = g_value_get_int (&gval); + break; + case G_TYPE_UINT: + v = g_value_get_uint (&gval); + break; + case G_TYPE_INT64: + v = g_value_get_int64 (&gval); + break; + default: + g_return_val_if_reached (NULL); + break; + } + + if ( get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY + && property_info->property_typ_data + && (value_infos = property_info->property_typ_data->subtype.gobject_int.value_infos)) { + for (; value_infos->nick; value_infos++) { + if (value_infos->value == v) { + RETURN_STR_TO_FREE (g_strdup_printf ("%lli (%s)", + (long long) v, + value_infos->nick)); + } + } + } + + RETURN_STR_TO_FREE (g_strdup_printf ("%"G_GINT64_FORMAT, v)); +} + +static gconstpointer +_get_fcn_gobject_mtu (ARGS_GET_FCN) +{ + guint32 mtu; + + RETURN_UNSUPPORTED_GET_TYPE (); + + if ( !property_info->property_typ_data + || !property_info->property_typ_data->subtype.mtu.get_fcn) + return _get_fcn_gobject_impl (property_info, setting, get_type, out_to_free); + + mtu = property_info->property_typ_data->subtype.mtu.get_fcn (setting); + if (mtu == 0) { + if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) + return _("auto"); + return "auto"; + } + RETURN_STR_TO_FREE (g_strdup_printf ("%u", (unsigned) mtu)); +} + +static gconstpointer +_get_fcn_gobject_secret_flags (ARGS_GET_FCN) +{ + guint v; + GValue val = G_VALUE_INIT; + + RETURN_UNSUPPORTED_GET_TYPE (); + + g_value_init (&val, G_TYPE_UINT); + g_object_get_property (G_OBJECT (setting), property_info->property_name, &val); + v = g_value_get_uint (&val); + g_value_unset (&val); + RETURN_STR_TO_FREE (secret_flags_to_string (v, get_type)); +} + +static gconstpointer +_get_fcn_gobject_enum (ARGS_GET_FCN) +{ + GType gtype = 0; + GType gtype_prop; + nm_auto_unref_gtypeclass GTypeClass *gtype_class = NULL; + nm_auto_unref_gtypeclass GTypeClass *gtype_prop_class = NULL; + gboolean has_gtype = FALSE; + nm_auto_unset_gvalue GValue gval = G_VALUE_INIT; + gint64 v; + gboolean format_numeric = FALSE; + gboolean format_numeric_hex = FALSE; + gboolean format_numeric_hex_unknown = FALSE; + gboolean format_text = FALSE; + gboolean format_text_l10n = FALSE; + gs_free char *s = NULL; + char s_numeric[64]; + + RETURN_UNSUPPORTED_GET_TYPE (); + + if (property_info->property_typ_data) { + if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) { + gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype (); + has_gtype = TRUE; + } + } + + if ( property_info->property_typ_data + && get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY + && NM_FLAGS_ANY (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N)) { + format_numeric_hex = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX); + format_numeric = format_numeric_hex || NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC); + format_text_l10n = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N); + format_text = format_text_l10n || NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT); + } else if ( property_info->property_typ_data + && get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY + && NM_FLAGS_ANY (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT)) { + format_numeric_hex = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX); + format_numeric = format_numeric && NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC); + format_text = NM_FLAGS_HAS (property_info->property_typ_data->typ_flags, NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT); + } else if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) { + /* by default, output in format "%u (%s)" (with hex for flags and l10n). */ + format_numeric = TRUE; + format_numeric_hex_unknown = TRUE; + format_text = TRUE; + format_text_l10n = TRUE; + } else { + /* by default, output only numeric (with hex for flags). */ + format_numeric = TRUE; + format_numeric_hex_unknown = TRUE; + } + + nm_assert (format_text || format_numeric); + + gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name); + + g_value_init (&gval, gtype_prop); + + g_object_get_property (G_OBJECT (setting), property_info->property_name, &gval); + + if ( gtype_prop == G_TYPE_INT + || ( G_TYPE_IS_CLASSED (gtype_prop) + && G_IS_ENUM_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (gtype_prop)))))) { + if (gtype_prop == G_TYPE_INT) { + if (!has_gtype) + g_return_val_if_reached (NULL); + v = g_value_get_int (&gval); + } else + v = g_value_get_enum (&gval); + } else if ( gtype_prop == G_TYPE_UINT + || ( G_TYPE_IS_CLASSED (gtype_prop) + && G_IS_FLAGS_CLASS ((gtype_prop_class ?: (gtype_prop_class = g_type_class_ref (gtype_prop)))))) { + if (gtype_prop == G_TYPE_UINT) { + if (!has_gtype) + g_return_val_if_reached (NULL); + v = g_value_get_uint (&gval); + } else + v = g_value_get_flags (&gval); + } else + g_return_val_if_reached (NULL); + + if (!has_gtype) { + gtype = gtype_prop; + gtype_class = g_steal_pointer (>ype_prop_class); + } + + nm_assert (({ + nm_auto_unref_gtypeclass GTypeClass *t = NULL; + + ( G_TYPE_IS_CLASSED (gtype) + && (t = g_type_class_ref (gtype)) + && (G_IS_ENUM_CLASS (t) || G_IS_FLAGS_CLASS (t))); + })); + + if (format_numeric && !format_text) { + s = format_numeric_hex + || ( format_numeric_hex_unknown + && !G_IS_ENUM_CLASS (gtype_class ?: (gtype_class = g_type_class_ref (gtype)))) + ? g_strdup_printf ("0x%"G_GINT64_FORMAT, v) + : g_strdup_printf ("%"G_GINT64_FORMAT, v); + RETURN_STR_TO_FREE (g_steal_pointer (&s)); + } + + /* the gobject_enum.value_infos are currently ignored for the getter. They + * only declare additional aliases for the setter. */ + + s = nm_utils_enum_to_str (gtype, (int) v); + + if (!format_numeric) + RETURN_STR_TO_FREE (g_steal_pointer (&s)); + + if ( format_numeric_hex + || ( format_numeric_hex_unknown + && !G_IS_ENUM_CLASS (gtype_class ?: (gtype_class = g_type_class_ref (gtype))))) + nm_sprintf_buf (s_numeric, "0x%"G_GINT64_FORMAT, v); + else + nm_sprintf_buf (s_numeric, "%"G_GINT64_FORMAT, v); + + if (nm_streq0 (s, s_numeric)) + RETURN_STR_TO_FREE (g_steal_pointer (&s)); + + if (format_text_l10n) + RETURN_STR_TO_FREE (g_strdup_printf (_("%s (%s)"), s_numeric, s)); + else + RETURN_STR_TO_FREE (g_strdup_printf ("%s (%s)", s_numeric, s)); +} + +/*****************************************************************************/ + +static gboolean +_set_fcn_gobject_string (ARGS_SET_FCN) +{ + gs_free char *to_free = NULL; + + if (property_info->property_typ_data) { + if (property_info->property_typ_data->subtype.gobject_string.validate_fcn) { + value = property_info->property_typ_data->subtype.gobject_string.validate_fcn (value, &to_free, error); + if (!value) + return FALSE; + } else if (property_info->property_typ_data->values_static) { + value = nmc_string_is_valid (value, + (const char **) property_info->property_typ_data->values_static, + error); + if (!value) + return FALSE; + } + } + g_object_set (setting, property_info->property_name, value, NULL); + return TRUE; +} + +static gboolean +_set_fcn_gobject_bool (ARGS_SET_FCN) +{ + gboolean val_bool; + + if (!nmc_string_to_bool (value, &val_bool, error)) + return FALSE; + + g_object_set (setting, property_info->property_name, val_bool, NULL); + return TRUE; +} + +static gboolean +_set_fcn_gobject_int (ARGS_SET_FCN) +{ + int errsv; + const GParamSpec *pspec; + nm_auto_unset_gvalue GValue gval = G_VALUE_INIT; + gint64 v = 0; + gboolean has_minmax = FALSE; + gint64 min = G_MININT64; + gint64 max = G_MAXINT64; + guint base = 10; + const NMMetaUtilsIntValueInfo *value_infos = NULL; + gboolean has_value = FALSE; + + if (property_info->property_typ_data) { + + if ( value + && (value_infos = property_info->property_typ_data->subtype.gobject_int.value_infos)) { + gs_free char *vv_stripped = NULL; + const char *vv = nm_str_skip_leading_spaces (value); + + if (vv[0] && g_ascii_isspace (vv[strlen (vv) - 1])) { + vv_stripped = g_strstrip (g_strdup (vv)); + vv = vv_stripped; + } + + for (; value_infos->nick; value_infos++) { + if (nm_streq (value_infos->nick, vv)) { + v = value_infos->value; + has_value = TRUE; + break; + } + } + } + + if (property_info->property_typ_data->subtype.gobject_int.base > 0) + base = property_info->property_typ_data->subtype.gobject_int.base; + if ( property_info->property_typ_data->subtype.gobject_int.min + || property_info->property_typ_data->subtype.gobject_int.max) { + min = property_info->property_typ_data->subtype.gobject_int.min; + max = property_info->property_typ_data->subtype.gobject_int.max; + has_minmax = TRUE; + } + } + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), property_info->property_name); + if (!G_IS_PARAM_SPEC (pspec)) + g_return_val_if_reached (FALSE); + switch (pspec->value_type) { + case G_TYPE_INT: + if (!has_minmax) { + const GParamSpecInt *p = (GParamSpecInt *) pspec; + + min = p->minimum; + max = p->maximum; + } + break; + case G_TYPE_UINT: + if (!has_minmax) { + const GParamSpecUInt *p = (GParamSpecUInt *) pspec; + + min = p->minimum; + max = p->maximum; + } + break; + case G_TYPE_INT64: + if (!has_minmax) { + const GParamSpecInt64 *p = (GParamSpecInt64 *) pspec; + + min = p->minimum; + max = p->maximum; + } + break; + default: + g_return_val_if_reached (FALSE); + } + + if (!has_value) { + v = _nm_utils_ascii_str_to_int64 (value, base, min, max, 0); + + if ((errsv = errno) != 0) { + if (errsv == ERANGE) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("'%s' is out of range [%lli, %lli]"), + value, + (long long) min, + (long long) max); + } else { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("'%s' is not a valid number"), value); + } + return FALSE; + } + } + + g_value_init (&gval, pspec->value_type); + switch (pspec->value_type) { + case G_TYPE_INT: + g_value_set_int (&gval, v); + break; + case G_TYPE_UINT: + g_value_set_uint (&gval, v); + break; + case G_TYPE_INT64: + g_value_set_int64 (&gval, v); + break; + default: + nm_assert_not_reached (); + break; + } + + /* Validate the number according to the property spec */ + if (!nm_g_object_set_property (G_OBJECT (setting), + property_info->property_name, + &gval, + error)) + g_return_val_if_reached (FALSE); + + return TRUE; +} + +static gboolean +_set_fcn_gobject_mtu (ARGS_SET_FCN) +{ + nm_auto_unset_gvalue GValue gval = G_VALUE_INIT; + const GParamSpec *pspec; + gint64 v; + + if (nm_streq0 (value, "auto")) + value = "0"; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), + property_info->property_name); + if (!pspec || pspec->value_type != G_TYPE_UINT) + g_return_val_if_reached (FALSE); + + v = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1); + if (v < 0) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("'%s' is out of range [0, %u]"), value, (unsigned) G_MAXUINT32); + return FALSE; + } + + g_value_init (&gval, pspec->value_type); + g_value_set_uint (&gval, v); + + if (!nm_g_object_set_property (G_OBJECT (setting), + property_info->property_name, + &gval, + error)) + g_return_val_if_reached (FALSE); + + return TRUE; +} + +static gboolean +_set_fcn_gobject_mac (ARGS_SET_FCN) +{ + NMMetaPropertyTypeMacMode mode; + gboolean valid; + + if (property_info->property_typ_data) + mode = property_info->property_typ_data->subtype.mac.mode; + else + mode = NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT; + + + if (mode == NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND) + valid = nm_utils_hwaddr_valid (value, INFINIBAND_ALEN); + else { + valid = nm_utils_hwaddr_valid (value, ETH_ALEN) + || ( mode == NM_META_PROPERTY_TYPE_MAC_MODE_CLONED + && NM_CLONED_MAC_IS_SPECIAL (value)); + } + + if (!valid) { + g_set_error (error, 1, 0, _("'%s' is not a valid Ethernet MAC"), value); + return FALSE; + } + + g_object_set (setting, property_info->property_name, value, NULL); + return TRUE; +} + +static gboolean +_set_fcn_gobject_secret_flags (ARGS_SET_FCN) +{ + char **strv = NULL, **iter; + unsigned long flags = 0, val_int; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + strv = nmc_strsplit_set (value, " \t,", 0); + for (iter = strv; iter && *iter; iter++) { + if (!nmc_string_to_uint (*iter, TRUE, 0, ALL_SECRET_FLAGS, &val_int)) { + g_set_error (error, 1, 0, _("'%s' is not a valid flag number; use <0-%d>"), + *iter, ALL_SECRET_FLAGS); + g_strfreev (strv); + return FALSE; + } + flags += val_int; + } + g_strfreev (strv); + + /* Validate the flags number */ + if (flags > ALL_SECRET_FLAGS) { + flags = ALL_SECRET_FLAGS; + _env_warn_fcn (environment, environment_user_data, + NM_META_ENV_WARN_LEVEL_WARN, + N_("'%s' sum is higher than all flags => all flags set"), + value); + } + + g_object_set (setting, property_info->property_name, (guint) flags, NULL); + return TRUE; +} + +static gboolean +_set_fcn_gobject_enum (ARGS_SET_FCN) +{ + GType gtype = 0; + GType gtype_prop; + gboolean has_gtype = FALSE; + nm_auto_unset_gvalue GValue gval = G_VALUE_INIT; + nm_auto_unref_gtypeclass GTypeClass *gtype_class = NULL; + gboolean is_flags; + int v; + + if (property_info->property_typ_data) { + if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) { + gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype (); + has_gtype = TRUE; + } + } + + gtype_prop = _gobject_property_get_gtype (G_OBJECT (setting), property_info->property_name); + + if ( has_gtype + && NM_IN_SET (gtype_prop, + G_TYPE_INT, + G_TYPE_UINT) + && G_TYPE_IS_CLASSED (gtype) + && (gtype_class = g_type_class_ref (gtype)) + && ( (is_flags = G_IS_FLAGS_CLASS (gtype_class)) + || G_IS_ENUM_CLASS (gtype_class))) { + /* valid */ + } else if ( !has_gtype + && G_TYPE_IS_CLASSED (gtype_prop) + && (gtype_class = g_type_class_ref (gtype_prop)) + && ( (is_flags = G_IS_FLAGS_CLASS (gtype_class)) + || G_IS_ENUM_CLASS (gtype_class))) { + gtype = gtype_prop; + } else + g_return_val_if_reached (FALSE); + + if (!_nm_utils_enum_from_str_full (gtype, value, &v, NULL, + property_info->property_typ_data + ? property_info->property_typ_data->subtype.gobject_enum.value_infos + : NULL)) + goto fail; + + if ( property_info->property_typ_data + && property_info->property_typ_data->subtype.gobject_enum.pre_set_notify) { + property_info->property_typ_data->subtype.gobject_enum.pre_set_notify (property_info, + environment, + environment_user_data, + setting, + v); + } + + g_value_init (&gval, gtype_prop); + if (gtype_prop == G_TYPE_INT) + g_value_set_int (&gval, v); + else if (gtype_prop == G_TYPE_UINT) + g_value_set_uint (&gval, v); + else if (G_IS_ENUM_CLASS (gtype_class)) + g_value_set_enum (&gval, v); + else if (G_IS_FLAGS_CLASS (gtype_class)) + g_value_set_flags (&gval, v); + else + g_return_val_if_reached (FALSE); + + if (!nm_g_object_set_property (G_OBJECT (setting), property_info->property_name, &gval, NULL)) + goto fail; + + return TRUE; + +fail: + if (error) { + gs_free const char **valid_all = NULL; + gs_free const char *valid_str = NULL; + gboolean has_minmax = FALSE; + int min = G_MININT; + int max = G_MAXINT; + + if (property_info->property_typ_data) { + if ( property_info->property_typ_data->subtype.gobject_enum.min + || property_info->property_typ_data->subtype.gobject_enum.max) { + min = property_info->property_typ_data->subtype.gobject_enum.min; + max = property_info->property_typ_data->subtype.gobject_enum.max; + has_minmax = TRUE; + } + } + + if (!has_minmax && is_flags) { + min = 0; + max = (gint) G_MAXUINT; + } + + valid_all = nm_utils_enum_get_values (gtype, min, max); + valid_str = g_strjoinv (",", (char **) valid_all); + if (is_flags) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid option '%s', use a combination of [%s]"), + value, + valid_str); + } else { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid option '%s', use one of [%s]"), + value, + valid_str); + } + } + return FALSE; +} + +/*****************************************************************************/ + +static const char *const* +_values_fcn_gobject_enum (ARGS_VALUES_FCN) +{ + GType gtype = 0; + gboolean has_gtype = FALSE; + gboolean has_minmax = FALSE; + int min = G_MININT; + int max = G_MAXINT; + char **v, **w; + + if (property_info->property_typ_data) { + if ( property_info->property_typ_data->subtype.gobject_enum.min + || property_info->property_typ_data->subtype.gobject_enum.max) { + min = property_info->property_typ_data->subtype.gobject_enum.min; + max = property_info->property_typ_data->subtype.gobject_enum.max; + has_minmax = TRUE; + } + if (property_info->property_typ_data->subtype.gobject_enum.get_gtype) { + gtype = property_info->property_typ_data->subtype.gobject_enum.get_gtype (); + has_gtype = TRUE; + } + } + + if (!has_gtype) { + gtype = _gtype_property_get_gtype (property_info->setting_info->general->get_setting_gtype (), + property_info->property_name); + } + + if ( !has_minmax + && G_TYPE_IS_CLASSED (gtype)) { + nm_auto_unref_gtypeclass GTypeClass *class = NULL; + + class = g_type_class_ref (gtype); + if (G_IS_FLAGS_CLASS (class)) { + min = 0; + max = (gint) G_MAXUINT; + } + } + + /* the gobject_enum.value_infos are currently ignored for the list of + * values. They only declare additional (hidden) aliases for the setter. */ + + v = (char **) nm_utils_enum_get_values (gtype, min, max); + if (v) { + for (w = v; *w; w++) + *w = g_strdup (*w); + } + return (const char *const*) (*out_to_free = v); +} + +/*****************************************************************************/ + +static const char *const* +_complete_fcn_gobject_bool (ARGS_COMPLETE_FCN) +{ + static const char *const v[] = { + "true", + "false", + "on", + "off", + "1", + "0", + "yes", + "no", + NULL, + }; + + if (!text || !text[0]) + return &v[6]; + return v; +} + +static const char *const* +_complete_fcn_gobject_devices (ARGS_COMPLETE_FCN) +{ + NMDevice *const*devices = NULL; + guint i, j; + guint len = 0; + char **ifnames; + + if ( environment + && environment->get_nm_devices) { + devices = environment->get_nm_devices (environment, + environment_user_data, + &len); + } + + if (len == 0) + return NULL; + + ifnames = g_new (char *, len + 1); + for (i = 0, j = 0; i < len; i++) { + const char *ifname; + + nm_assert (NM_IS_DEVICE (devices[i])); + + ifname = nm_device_get_iface (devices[i]); + if (ifname) + ifnames[j++] = g_strdup (ifname); + } + ifnames[j++] = NULL; + + *out_to_free = ifnames; + return (const char *const*) ifnames; +} + +/*****************************************************************************/ + +static char * +wep_key_type_to_string (NMWepKeyType type) +{ + switch (type) { + case NM_WEP_KEY_TYPE_KEY: + return g_strdup_printf (_("%d (key)"), type); + case NM_WEP_KEY_TYPE_PASSPHRASE: + return g_strdup_printf (_("%d (passphrase)"), type); + case NM_WEP_KEY_TYPE_UNKNOWN: + default: + return g_strdup_printf (_("%d (unknown)"), type); + } +} + +static char * +bytes_to_string (GBytes *bytes) +{ + const guint8 *data; + gsize len; + GString *cert = NULL; + int i; + + if (!bytes) + return NULL; + data = g_bytes_get_data (bytes, &len); + + cert = g_string_new (NULL); + for (i = 0; i < len; i++) + g_string_append_printf (cert, "%02X", data[i]); + + return g_string_free (cert, FALSE); +} + +static char * +vlan_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type) +{ + GString *flag_str; + + if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) + return g_strdup_printf ("%u", flags); + + if (flags == 0) + return g_strdup (_("0 (NONE)")); + + flag_str = g_string_new (NULL); + g_string_printf (flag_str, "%d (", flags); + + if (flags & NM_VLAN_FLAG_REORDER_HEADERS) + g_string_append (flag_str, _("REORDER_HEADERS, ")); + if (flags & NM_VLAN_FLAG_GVRP) + g_string_append (flag_str, _("GVRP, ")); + if (flags & NM_VLAN_FLAG_LOOSE_BINDING) + g_string_append (flag_str, _("LOOSE_BINDING, ")); + if (flags & NM_VLAN_FLAG_MVRP) + g_string_append (flag_str, _("MVRP, ")); + + if (flag_str->str[flag_str->len-1] == '(') + g_string_append (flag_str, _("unknown")); + else + g_string_truncate (flag_str, flag_str->len-2); /* chop off trailing ', ' */ + + g_string_append_c (flag_str, ')'); + + return g_string_free (flag_str, FALSE); +} + +static char * +vlan_priorities_to_string (NMSettingVlan *s_vlan, NMVlanPriorityMap map) +{ + GString *priorities; + int i; + + priorities = g_string_new (NULL); + for (i = 0; i < nm_setting_vlan_get_num_priorities (s_vlan, map); i++) { + guint32 from, to; + + if (nm_setting_vlan_get_priority (s_vlan, map, i, &from, &to)) + g_string_append_printf (priorities, "%d:%d,", from, to); + } + if (priorities->len) + g_string_truncate (priorities, priorities->len-1); /* chop off trailing ',' */ + + return g_string_free (priorities, FALSE); +} + +static char * +ip6_privacy_to_string (NMSettingIP6ConfigPrivacy ip6_privacy, NMMetaAccessorGetType get_type) +{ + if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) + return g_strdup_printf ("%d", ip6_privacy); + + switch (ip6_privacy) { + case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED: + return g_strdup_printf (_("%d (disabled)"), ip6_privacy); + case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR: + return g_strdup_printf (_("%d (enabled, prefer public IP)"), ip6_privacy); + case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR: + return g_strdup_printf (_("%d (enabled, prefer temporary IP)"), ip6_privacy); + default: + return g_strdup_printf (_("%d (unknown)"), ip6_privacy); + } +} + +static char * +secret_flags_to_string (guint32 flags, NMMetaAccessorGetType get_type) +{ + GString *flag_str; + + if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) + return g_strdup_printf ("%u", flags); + + if (flags == 0) + return g_strdup (_("0 (none)")); + + flag_str = g_string_new (NULL); + g_string_printf (flag_str, "%u (", flags); + + if (flags & NM_SETTING_SECRET_FLAG_AGENT_OWNED) + g_string_append (flag_str, _("agent-owned, ")); + if (flags & NM_SETTING_SECRET_FLAG_NOT_SAVED) + g_string_append (flag_str, _("not saved, ")); + if (flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED) + g_string_append (flag_str, _("not required, ")); + + if (flag_str->str[flag_str->len-1] == '(') + g_string_append (flag_str, _("unknown")); + else + g_string_truncate (flag_str, flag_str->len-2); /* chop off trailing ', ' */ + + g_string_append_c (flag_str, ')'); + + return g_string_free (flag_str, FALSE); +} + +static void +vpn_data_item (const char *key, const char *value, gpointer user_data) +{ + GString *ret_str = (GString *) user_data; + + if (ret_str->len != 0) + g_string_append (ret_str, ", "); + + g_string_append_printf (ret_str, "%s = %s", key, value); +} + +#define DEFINE_SETTER_STR_LIST_MULTI(def_func, s_macro, set_func) \ + static gboolean \ + def_func (NMSetting *setting, \ + const char *prop, \ + const char *value, \ + const char **valid_strv, \ + GError **error) \ + { \ + char **strv = NULL, **iter; \ + const char *item; \ + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \ + strv = nmc_strsplit_set (value, " \t,", 0); \ + for (iter = strv; iter && *iter; iter++) { \ + if (!(item = nmc_string_is_valid (g_strstrip (*iter), valid_strv, error))) { \ + g_strfreev (strv); \ + return FALSE; \ + } \ + set_func (s_macro (setting), item); \ + } \ + g_strfreev (strv); \ + return TRUE; \ + } + +#define DEFINE_SETTER_OPTIONS(def_func, s_macro, s_type, add_func, valid_func1, valid_func2) \ + static gboolean \ + def_func (ARGS_SET_FCN) \ + { \ + char **strv = NULL, **iter; \ + const char **(*valid_func1_p) (s_type *) = valid_func1; \ + const char * (*valid_func2_p) (const char *, const char *, GError **) = valid_func2; \ + const char *opt_name, *opt_val; \ + \ + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \ + \ + strv = nmc_strsplit_set (value, ",", 0); \ + for (iter = strv; iter && *iter; iter++) { \ + char *left = g_strstrip (*iter); \ + char *right = strchr (left, '='); \ + if (!right) { \ + g_set_error (error, 1, 0, _("'%s' is not valid; use <option>=<value>"), *iter); \ + g_strfreev (strv); \ + return FALSE; \ + } \ + *right++ = '\0'; \ + \ + if (valid_func1_p) { \ + const char **valid_options = valid_func1_p (s_macro (setting)); \ + if (!(opt_name = nmc_string_is_valid (g_strstrip (left), valid_options, error))) { \ + g_strfreev (strv); \ + return FALSE; \ + } \ + } else \ + opt_name = g_strstrip (left);\ + \ + opt_val = g_strstrip (right); \ + if (valid_func2_p) { \ + if (!(opt_val = valid_func2_p ((const char *) left, (const char *) opt_val, error))) { \ + g_strfreev (strv); \ + return FALSE; \ + }\ + }\ + add_func (s_macro (setting), opt_name, opt_val); \ + } \ + g_strfreev (strv); \ + return TRUE; \ + } + +#define DEFINE_REMOVER_INDEX_OR_VALUE(def_func, s_macro, num_func, rem_func_idx, rem_func_val) \ + static gboolean \ + def_func (ARGS_REMOVE_FCN) \ + { \ + guint32 num; \ + if (value) { \ + gboolean ret; \ + char *value_stripped = g_strstrip (g_strdup (value)); \ + ret = rem_func_val (s_macro (setting), value_stripped, error); \ + g_free (value_stripped); \ + return ret; \ + } \ + num = num_func (s_macro (setting)); \ + if (num == 0) { \ + g_set_error_literal (error, 1, 0, _("no item to remove")); \ + return FALSE; \ + } \ + if (idx >= num) { \ + g_set_error (error, 1, 0, _("index '%d' is not in range <0-%d>"), idx, num - 1); \ + return FALSE; \ + } \ + rem_func_idx (s_macro (setting), idx); \ + return TRUE; \ + } + +#define DEFINE_REMOVER_OPTION(def_func, s_macro, rem_func) \ + static gboolean \ + def_func (ARGS_REMOVE_FCN) \ + { \ + gboolean success = FALSE; \ + if (value && *value) { \ + success = rem_func (s_macro (setting), value); \ + if (!success) \ + g_set_error (error, 1, 0, _("invalid option '%s'"), value); \ + } else \ + g_set_error_literal (error, 1, 0, _("missing option")); \ + return success; \ + } + +#define DEFINE_ALLOWED_VAL_FUNC(def_func, valid_values) \ + static const char *const* \ + def_func (NMSetting *setting, const char *prop) \ + { \ + return valid_values; \ + } + +#define DEFINE_SETTER_MAC_BLACKLIST(def_func, s_macro, add_func) \ + static gboolean \ + def_func (ARGS_SET_FCN) \ + { \ + guint8 buf[32]; \ + char **list = NULL, **iter; \ + GSList *macaddr_blacklist = NULL; \ + \ + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \ + \ + list = nmc_strsplit_set (value, " \t,", 0); \ + for (iter = list; iter && *iter; iter++) { \ + if (!nm_utils_hwaddr_aton (*iter, buf, ETH_ALEN)) { \ + g_set_error (error, 1, 0, _("'%s' is not a valid MAC"), *iter); \ + g_strfreev (list); \ + g_slist_free (macaddr_blacklist); \ + return FALSE; \ + } \ + } \ + \ + for (iter = list; iter && *iter; iter++) \ + add_func (s_macro (setting), *iter); \ + \ + g_strfreev (list); \ + return TRUE; \ + } + + +static gboolean +verify_string_list (char **strv, + const char *prop, + gboolean (*validate_func) (const char *), + GError **error) +{ + char **iter; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + for (iter = strv; iter && *iter; iter++) { + if (**iter == '\0') + continue; + if (validate_func) { + if (!validate_func (*iter)) { + g_set_error (error, 1, 0, _("'%s' is not valid"), + *iter); + return FALSE; + } + } + } + return TRUE; +} + +static char * +flag_values_to_string (GFlagsValue *array, guint n) +{ + GString *str; + guint i; + + str = g_string_new (NULL); + for (i = 0; i < n; i++) + g_string_append_printf (str, "%u, ", array[i].value); + if (str->len) + g_string_truncate (str, str->len-2); /* chop off trailing ', ' */ + return g_string_free (str, FALSE); +} + +static gboolean +validate_flags (NMSetting *setting, const char* prop, guint val, GError **error) +{ + GParamSpec *pspec; + GValue value = G_VALUE_INIT; + gboolean success = TRUE; + + pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (setting)), prop); + g_assert (G_IS_PARAM_SPEC (pspec)); + + g_value_init (&value, pspec->value_type); + g_value_set_flags (&value, val); + + if (g_param_value_validate (pspec, &value)) { + GParamSpecFlags *pspec_flags = (GParamSpecFlags *) pspec; + char *flag_values = flag_values_to_string (pspec_flags->flags_class->values, + pspec_flags->flags_class->n_values); + g_set_error (error, 1, 0, _("'%u' flags are not valid; use combination of %s"), + val, flag_values); + g_free (flag_values); + success = FALSE; + } + g_value_unset (&value); + return success; +} + +static gboolean +check_and_set_string (NMSetting *setting, + const char *prop, + const char *val, + const char **valid_strv, + GError **error) +{ + const char *checked_val; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + checked_val = nmc_string_is_valid (val, valid_strv, error); + if (!checked_val) + return FALSE; + + g_object_set (setting, prop, checked_val, NULL); + return TRUE; +} + +static gboolean +_set_fcn_gobject_flags (ARGS_SET_FCN) +{ + unsigned long val_int; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!nmc_string_to_uint (value, TRUE, 0, G_MAXUINT, &val_int)) { + g_set_error (error, 1, 0, _("'%s' is not a valid number (or out of range)"), value); + return FALSE; + } + + /* Validate the flags according to the property spec */ + if (!validate_flags (setting, property_info->property_name, (guint) val_int, error)) + return FALSE; + + g_object_set (setting, property_info->property_name, (guint) val_int, NULL); + return TRUE; +} + +static gboolean +_set_fcn_gobject_ssid (ARGS_SET_FCN) +{ + GBytes *ssid; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (strlen (value) > 32) { + g_set_error (error, 1, 0, _("'%s' is not valid"), value); + return FALSE; + } + + ssid = g_bytes_new (value, strlen (value)); + g_object_set (setting, property_info->property_name, ssid, NULL); + g_bytes_unref (ssid); + return TRUE; +} + +static gboolean +_set_fcn_gobject_ifname (ARGS_SET_FCN) +{ + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!nm_utils_is_valid_iface_name (value, error)) + return FALSE; + g_object_set (setting, property_info->property_name, value, NULL); + return TRUE; +} + +static gboolean +_set_fcn_vpn_service_type (ARGS_SET_FCN) +{ + gs_free char *service_name = NULL; + + service_name = nm_vpn_plugin_info_list_find_service_type (nm_vpn_get_plugin_infos (), value); + g_object_set (setting, property_info->property_name, service_name ? : value, NULL); + return TRUE; +} + +static const char *const* +_complete_fcn_vpn_service_type (ARGS_COMPLETE_FCN) +{ + gsize i, j; + char **values; + + values = nm_vpn_plugin_info_list_get_service_types (nm_vpn_get_plugin_infos (), FALSE, TRUE); + if (!values) + return NULL; + + if (!text || !*text) { + /* If the prompt text is empty or contains no '.', + * filter out full names. */ + for (i = 0, j = 0; values[i]; i++) { + if (strchr (values[i], '.')) { + g_free (values[i]); + continue; + } + + if (i != j) + values[j] = values[i]; + j++; + } + if (j) + values[j++] = NULL; + else { + g_free (values); + values = NULL; + } + } + return (const char *const*) (*out_to_free = values); +} + +static gboolean +nmc_util_is_domain (const char *domain) +{ + //FIXME: implement + return TRUE; +} + +static gboolean +nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *value, GError **error) +{ + gs_free char *val_strip = NULL; + gs_strfreev char **strv = NULL; + const char *delimiters = " \t,"; + char **iter; + GBytes *bytes; + GByteArray *array = NULL; + gboolean success = TRUE; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + val_strip = g_strstrip (g_strdup (value)); + + /* First try hex string in the format of AAbbCCDd */ + bytes = nm_utils_hexstr2bin (val_strip); + if (bytes) + goto done; + + /* Otherwise, consider the following format: AA b 0xCc D */ + strv = nmc_strsplit_set (val_strip, delimiters, 0); + array = g_byte_array_sized_new (g_strv_length (strv)); + for (iter = strv; iter && *iter; iter++) { + int v; + guint8 v8; + + v = _nm_utils_ascii_str_to_int64 (*iter, 16, 0, 255, -1); + if (v == -1) { + g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter); + g_byte_array_free (array, TRUE); + success = FALSE; + goto done; + } + v8 = v; + g_byte_array_append (array, &v8, 1); + } + bytes = g_byte_array_free_to_bytes (array); + +done: + if (success) + g_object_set (setting, prop, bytes, NULL); + + if (bytes) + g_bytes_unref (bytes); + + return success; +} + +/*****************************************************************************/ + +static gconstpointer +_get_fcn_802_1x_ca_cert (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + char *ca_cert_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_802_1x_get_ca_cert_scheme (s_8021X)) { + case NM_SETTING_802_1X_CK_SCHEME_BLOB: + ca_cert_str = bytes_to_string (nm_setting_802_1x_get_ca_cert_blob (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PATH: + ca_cert_str = g_strdup (nm_setting_802_1x_get_ca_cert_path (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PKCS11: + ca_cert_str = g_strdup (nm_setting_802_1x_get_ca_cert_uri (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN: + break; + } + + RETURN_STR_TO_FREE (ca_cert_str); +} + +static gconstpointer +_get_fcn_802_1x_client_cert (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + char *cert_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_802_1x_get_client_cert_scheme (s_8021X)) { + case NM_SETTING_802_1X_CK_SCHEME_BLOB: + if (NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) + cert_str = bytes_to_string (nm_setting_802_1x_get_client_cert_blob (s_8021X)); + else + return _get_text_hidden (get_type); + break; + case NM_SETTING_802_1X_CK_SCHEME_PATH: + cert_str = g_strdup (nm_setting_802_1x_get_client_cert_path (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PKCS11: + cert_str = g_strdup (nm_setting_802_1x_get_client_cert_uri (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN: + break; + } + + RETURN_STR_TO_FREE (cert_str); +} + +static gconstpointer +_get_fcn_802_1x_phase2_ca_cert (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + char *phase2_ca_cert_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_802_1x_get_phase2_ca_cert_scheme (s_8021X)) { + case NM_SETTING_802_1X_CK_SCHEME_BLOB: + phase2_ca_cert_str = bytes_to_string (nm_setting_802_1x_get_phase2_ca_cert_blob (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PATH: + phase2_ca_cert_str = g_strdup (nm_setting_802_1x_get_phase2_ca_cert_path (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PKCS11: + phase2_ca_cert_str = g_strdup (nm_setting_802_1x_get_phase2_ca_cert_uri (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN: + break; + } + + RETURN_STR_TO_FREE (phase2_ca_cert_str); +} + +static gconstpointer +_get_fcn_802_1x_phase2_client_cert (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + char *cert_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_802_1x_get_phase2_client_cert_scheme (s_8021X)) { + case NM_SETTING_802_1X_CK_SCHEME_BLOB: + if (NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) + cert_str = bytes_to_string (nm_setting_802_1x_get_phase2_client_cert_blob (s_8021X)); + else + return _get_text_hidden (get_type); + break; + case NM_SETTING_802_1X_CK_SCHEME_PATH: + cert_str = g_strdup (nm_setting_802_1x_get_phase2_client_cert_path (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PKCS11: + cert_str = g_strdup (nm_setting_802_1x_get_phase2_client_cert_uri (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN: + break; + } + + RETURN_STR_TO_FREE (cert_str); +} + +static gconstpointer +_get_fcn_802_1x_password_raw (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (bytes_to_string (nm_setting_802_1x_get_password_raw (s_8021X))); +} + +static gconstpointer +_get_fcn_802_1x_private_key (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + char *key_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_802_1x_get_private_key_scheme (s_8021X)) { + case NM_SETTING_802_1X_CK_SCHEME_BLOB: + if (NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) + key_str = bytes_to_string (nm_setting_802_1x_get_private_key_blob (s_8021X)); + else + return _get_text_hidden (get_type); + break; + case NM_SETTING_802_1X_CK_SCHEME_PATH: + key_str = g_strdup (nm_setting_802_1x_get_private_key_path (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PKCS11: + key_str = g_strdup (nm_setting_802_1x_get_private_key_uri (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN: + break; + } + + RETURN_STR_TO_FREE (key_str); +} + +static gconstpointer +_get_fcn_802_1x_phase2_private_key (ARGS_GET_FCN) +{ + NMSetting8021x *s_8021X = NM_SETTING_802_1X (setting); + char *key_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_802_1x_get_phase2_private_key_scheme (s_8021X)) { + case NM_SETTING_802_1X_CK_SCHEME_BLOB: + if (NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) + key_str = bytes_to_string (nm_setting_802_1x_get_phase2_private_key_blob (s_8021X)); + else + return _get_text_hidden (get_type); + break; + case NM_SETTING_802_1X_CK_SCHEME_PATH: + key_str = g_strdup (nm_setting_802_1x_get_phase2_private_key_path (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_PKCS11: + key_str = g_strdup (nm_setting_802_1x_get_phase2_private_key_uri (s_8021X)); + break; + case NM_SETTING_802_1X_CK_SCHEME_UNKNOWN: + break; + } + + RETURN_STR_TO_FREE (key_str); +} + +#define DEFINE_SETTER_STR_LIST(def_func, set_func) \ + static gboolean \ + def_func (ARGS_SET_FCN) \ + { \ + char **strv = NULL; \ + guint i = 0; \ + \ + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); \ + \ + strv = nmc_strsplit_set (value, " \t,", 0); \ + while (strv && strv[i]) \ + set_func (NM_SETTING_802_1X (setting), strv[i++]); \ + g_strfreev (strv); \ + return TRUE; \ + } + +#define DEFINE_SETTER_CERT(def_func, set_func) \ + static gboolean \ + def_func (ARGS_SET_FCN) \ + { \ + char *val_strip = g_strstrip (g_strdup (value)); \ + char *p = val_strip; \ + NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_PATH; \ + gboolean success; \ + \ + if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11)) == 0) \ + scheme = NM_SETTING_802_1X_CK_SCHEME_PKCS11; \ + else if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ + p += NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ + \ + success = set_func (NM_SETTING_802_1X (setting), p, scheme, NULL, error); \ + g_free (val_strip); \ + return success; \ + } + +#define DEFINE_SETTER_PRIV_KEY(def_func, pwd_func, set_func) \ + static gboolean \ + def_func (ARGS_SET_FCN) \ + { \ + char **strv = NULL; \ + char *val_strip = g_strstrip (g_strdup (value)); \ + char *p = val_strip; \ + const char *path, *password; \ + gs_free char *password_free = NULL; \ + NMSetting8021xCKScheme scheme = NM_SETTING_802_1X_CK_SCHEME_PATH; \ + gboolean success; \ + \ + if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PKCS11)) == 0) \ + scheme = NM_SETTING_802_1X_CK_SCHEME_PKCS11; \ + else if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ + p += NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ + \ + strv = nmc_strsplit_set (p, " \t,", 2); \ + path = strv[0]; \ + if (g_strv_length (strv) == 2) \ + password = strv[1]; \ + else \ + password = password_free = g_strdup (pwd_func (NM_SETTING_802_1X (setting))); \ + success = set_func (NM_SETTING_802_1X (setting), path, password, scheme, NULL, error); \ + g_free (val_strip); \ + g_strfreev (strv); \ + return success; \ + } + +DEFINE_SETTER_STR_LIST_MULTI (check_and_add_eap_method, + NM_SETTING_802_1X, + nm_setting_802_1x_add_eap_method) + +static gboolean +_set_fcn_802_1x_eap (ARGS_SET_FCN) +{ + return check_and_add_eap_method (setting, + property_info->property_name, + value, + (const char **) property_info->property_typ_data->values_static, + error); +} + +static gboolean +_validate_and_remove_eap_method (NMSetting8021x *setting, + const char *eap, + GError **error) +{ + gboolean ret; + + ret = nm_setting_802_1x_remove_eap_method_by_value (setting, eap); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain EAP method '%s'"), eap); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_802_1x_eap, + NM_SETTING_802_1X, + nm_setting_802_1x_get_num_eap_methods, + nm_setting_802_1x_remove_eap_method, + _validate_and_remove_eap_method) + +DEFINE_SETTER_CERT (_set_fcn_802_1x_ca_cert, nm_setting_802_1x_set_ca_cert) + +DEFINE_SETTER_STR_LIST (_set_fcn_802_1x_altsubject_matches, nm_setting_802_1x_add_altsubject_match) + +static gboolean +_validate_and_remove_altsubject_match (NMSetting8021x *setting, + const char *altsubject_match, + GError **error) +{ + gboolean ret; + + ret = nm_setting_802_1x_remove_altsubject_match_by_value (setting, altsubject_match); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain alternative subject match '%s'"), + altsubject_match); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_802_1x_altsubject_matches, + NM_SETTING_802_1X, + nm_setting_802_1x_get_num_altsubject_matches, + nm_setting_802_1x_remove_altsubject_match, + _validate_and_remove_altsubject_match) + +DEFINE_SETTER_CERT (_set_fcn_802_1x_client_cert, nm_setting_802_1x_set_client_cert) + +DEFINE_SETTER_CERT (_set_fcn_802_1x_phase2_ca_cert, nm_setting_802_1x_set_phase2_ca_cert) + +DEFINE_SETTER_STR_LIST (_set_fcn_802_1x_phase2_altsubject_matches, nm_setting_802_1x_add_phase2_altsubject_match) + +static gboolean +_validate_and_remove_phase2_altsubject_match (NMSetting8021x *setting, + const char *phase2_altsubject_match, + GError **error) +{ + gboolean ret; + + ret = nm_setting_802_1x_remove_phase2_altsubject_match_by_value (setting, phase2_altsubject_match); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain \"phase2\" alternative subject match '%s'"), + phase2_altsubject_match); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_802_1x_phase2_altsubject_matches, + NM_SETTING_802_1X, + nm_setting_802_1x_get_num_phase2_altsubject_matches, + nm_setting_802_1x_remove_phase2_altsubject_match, + _validate_and_remove_phase2_altsubject_match) + +DEFINE_SETTER_CERT (_set_fcn_802_1x_phase2_client_cert, nm_setting_802_1x_set_phase2_client_cert) + +DEFINE_SETTER_PRIV_KEY (_set_fcn_802_1x_private_key, + nm_setting_802_1x_get_private_key_password, + nm_setting_802_1x_set_private_key) + +DEFINE_SETTER_PRIV_KEY (_set_fcn_802_1x_phase2_private_key, + nm_setting_802_1x_get_phase2_private_key_password, + nm_setting_802_1x_set_phase2_private_key) + +static gboolean +_set_fcn_802_1x_password_raw (ARGS_SET_FCN) +{ + return nmc_property_set_bytes (setting, property_info->property_name, value, error); +} + +static gconstpointer +_get_fcn_bond_options (ARGS_GET_FCN) +{ + NMSettingBond *s_bond = NM_SETTING_BOND (setting); + GString *bond_options_s; + int i; + + RETURN_UNSUPPORTED_GET_TYPE (); + + bond_options_s = g_string_new (NULL); + for (i = 0; i < nm_setting_bond_get_num_options (s_bond); i++) { + const char *key, *value; + gs_free char *tmp_value = NULL; + char *p; + + nm_setting_bond_get_option (s_bond, i, &key, &value); + + if (nm_streq0 (key, NM_SETTING_BOND_OPTION_ARP_IP_TARGET)) { + value = tmp_value = g_strdup (value); + for (p = tmp_value; p && *p; p++) { + if (*p == ',') + *p = ' '; + } + } + + g_string_append_printf (bond_options_s, "%s=%s,", key, value); + } + g_string_truncate (bond_options_s, bond_options_s->len-1); /* chop off trailing ',' */ + + RETURN_STR_TO_FREE (g_string_free (bond_options_s, FALSE)); +} + +/* example: miimon=100,mode=balance-rr, updelay=5 */ +static gboolean +_validate_and_remove_bond_option (NMSettingBond *setting, const char *option) +{ + const char *opt; + const char **valid_options; + + valid_options = nm_setting_bond_get_valid_options (setting); + opt = nmc_string_is_valid (option, valid_options, NULL); + + if (opt) + return nm_setting_bond_remove_option (setting, opt); + else + return FALSE; +} + +static const char * +_validate_bond_option_value (const char *option, const char *value, GError **error) +{ + if (!g_strcmp0 (option, NM_SETTING_BOND_OPTION_MODE)) + return nmc_bond_validate_mode (value, error); + + return value; +} + +static gboolean +_bond_add_option (NMSettingBond *setting, + const char *name, + const char *value) +{ + gs_free char *tmp_value = NULL; + char *p; + + if (nm_streq0 (name, NM_SETTING_BOND_OPTION_ARP_IP_TARGET)) { + value = tmp_value = g_strdup (value); + for (p = tmp_value; p && *p; p++) + if (*p == ' ') + *p = ','; + } + + return nm_setting_bond_add_option (setting, name, value); +} + +DEFINE_SETTER_OPTIONS (_set_fcn_bond_options, + NM_SETTING_BOND, + NMSettingBond, + _bond_add_option, + nm_setting_bond_get_valid_options, + _validate_bond_option_value) +DEFINE_REMOVER_OPTION (_remove_fcn_bond_options, + NM_SETTING_BOND, + _validate_and_remove_bond_option) + +static const char * +_describe_fcn_bond_options (ARGS_DESCRIBE_FCN) +{ + gs_free char *options_str = NULL; + const char **valid_options; + char *s; + + valid_options = nm_setting_bond_get_valid_options (NULL); + options_str = g_strjoinv (", ", (char **) valid_options); + + s = g_strdup_printf (_("Enter a list of bonding options formatted as:\n" + " option = <value>, option = <value>,... \n" + "Valid options are: %s\n" + "'mode' can be provided as a name or a number:\n" + "balance-rr = 0\n" + "active-backup = 1\n" + "balance-xor = 2\n" + "broadcast = 3\n" + "802.3ad = 4\n" + "balance-tlb = 5\n" + "balance-alb = 6\n\n" + "Example: mode=2,miimon=120\n"), options_str); + return (*out_to_free = s); +} + +static const char *const* +_values_fcn_bond_options (ARGS_VALUES_FCN) +{ + return nm_setting_bond_get_valid_options (NULL); +} + +static gconstpointer +_get_fcn_connection_permissions (ARGS_GET_FCN) +{ + NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting); + GString *perm = NULL; + const char *perm_item; + const char *perm_type; + int i; + + RETURN_UNSUPPORTED_GET_TYPE (); + + perm = g_string_new (NULL); + for (i = 0; i < nm_setting_connection_get_num_permissions (s_con); i++) { + if (nm_setting_connection_get_permission (s_con, i, &perm_type, &perm_item, NULL)) + g_string_append_printf (perm, "%s:%s,", perm_type, perm_item); + } + if (perm->len > 0) { + g_string_truncate (perm, perm->len-1); /* remove trailing , */ + RETURN_STR_TO_FREE (g_string_free (perm, FALSE)); + } + + /* No value from get_permission */ + g_string_free (perm, TRUE); + return NULL; +} + +static gboolean +_set_fcn_connection_type (ARGS_SET_FCN) +{ + gs_free char *uuid = NULL; + + if (nm_setting_connection_get_uuid (NM_SETTING_CONNECTION (setting))) { + /* Don't allow setting type unless the connection is brand new. + * Just because it's a bad idea and the user wouldn't probably want that. + * No technical reason, really. + * Also, using uuid to see if the connection is brand new is a bit + * hacky: we can not see if the type is already set, because + * nmc_setting_set_property() is called only after the property + * we're setting (type) has been removed. */ + g_set_error (error, 1, 0, _("Can not change the connection type")); + return FALSE; + } + + uuid = nm_utils_uuid_generate (); + g_object_set (G_OBJECT (setting), + NM_SETTING_CONNECTION_UUID, uuid, + NULL); + + g_object_set (G_OBJECT (setting), property_info->property_name, value, NULL); + return TRUE; +} + +static const char *const* +_complete_fcn_connection_type (ARGS_COMPLETE_FCN) +{ + guint i, j; + char **result; + gsize text_len; + + result = g_new (char *, _NM_META_SETTING_TYPE_NUM * 2 + 1); + + text_len = text ? strlen (text) : 0; + + for (i = 0, j = 0; i < _NM_META_SETTING_TYPE_NUM; i++) { + const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[i]; + const char *v; + + v = setting_info->alias; + if (v) { + if (!text || strncmp (text, v, text_len) == 0) + result[j++] = g_strdup (v); + } + if (!text || !*text || !v) { + v = setting_info->general->setting_name; + if (!text || strncmp (text, v, text_len) == 0) + result[j++] = g_strdup (v); + } + } + if (j) + result[j++] = NULL; + else { + g_free (result); + result = NULL; + } + + return (const char *const*) (*out_to_free = result); +} + +/* define from libnm-core/nm-setting-connection.c */ +#define PERM_USER_PREFIX "user:" + +static gboolean +permissions_valid (const char *perm) +{ + if (!perm || perm[0] == '\0') + return FALSE; + + if (strncmp (perm, PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0) { + if ( strlen (perm) <= strlen (PERM_USER_PREFIX) + || strchr (perm + strlen (PERM_USER_PREFIX), ':')) + return FALSE; + } else { + if (strchr (perm, ':')) + return FALSE; + } + + return TRUE; +} + +static gboolean +_set_fcn_connection_permissions (ARGS_SET_FCN) +{ + char **strv = NULL; + guint i = 0; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + strv = nmc_strsplit_set (value, " \t,", 0); + if (!verify_string_list (strv, property_info->property_name, permissions_valid, error)) { + g_strfreev (strv); + return FALSE; + } + + for (i = 0; strv && strv[i]; i++) { + const char *user; + + if (strncmp (strv[i], PERM_USER_PREFIX, strlen (PERM_USER_PREFIX)) == 0) + user = strv[i]+strlen (PERM_USER_PREFIX); + else + user = strv[i]; + + nm_setting_connection_add_permission (NM_SETTING_CONNECTION (setting), "user", user, NULL); + } + + return TRUE; +} + +static gboolean +_validate_and_remove_connection_permission (NMSettingConnection *setting, + const char *perm, + GError **error) +{ + gboolean ret; + + ret = nm_setting_connection_remove_permission_by_value (setting, "user", perm, NULL); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain permission '%s'"), perm); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_connection_permissions, + NM_SETTING_CONNECTION, + nm_setting_connection_get_num_permissions, + nm_setting_connection_remove_permission, + _validate_and_remove_connection_permission) + +static gboolean +_set_fcn_connection_master (ARGS_SET_FCN) +{ + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!value) + ; + else if (!*value) + value = NULL; + else if ( !nm_utils_is_valid_iface_name (value, NULL) + && !nm_utils_is_uuid (value)) { + g_set_error (error, 1, 0, + _("'%s' is not valid master; use ifname or connection UUID"), + value); + return FALSE; + } + g_object_set (setting, property_info->property_name, value, NULL); + return TRUE; +} + +static const char *const* +_complete_fcn_connection_master (ARGS_COMPLETE_FCN) +{ + NMRemoteConnection *const*connections = NULL; + guint len = 0; + guint i, j; + char **result; + NMSettingConnection *s_con; + const char *expected_type = NULL; + gsize text_len; + + if ( environment + && environment->get_nm_connections) { + connections = environment->get_nm_connections (environment, + environment_user_data, + &len); + } + if (!len) + return NULL; + + if ( (!text || !*text) + && operation_context + && operation_context->connection) { + /* if we have no text yet, initially only complete for matching + * slave-type. */ + s_con = nm_connection_get_setting_connection (operation_context->connection); + if (s_con) + expected_type = nm_setting_connection_get_slave_type (s_con); + } + + text_len = strlen (text); + + result = g_new (char *, (2 * len) + 1); + for (i = 0, j = 0; i < len; i++) { + const char *v; + + s_con = nm_connection_get_setting_connection (NM_CONNECTION (connections[i])); + if (!s_con) + continue; + + if ( expected_type + && !nm_streq0 (nm_setting_connection_get_connection_type (s_con), + expected_type)) + continue; + + if (text && text[0]) { + /* if we have text, also complete for the UUID. */ + v = nm_setting_connection_get_uuid (s_con); + if (v && (!text || strncmp (text, v, text_len) == 0)) + result[j++] = g_strdup (v); + } + + v = nm_setting_connection_get_interface_name (s_con); + if (v && (!text || strncmp (text, v, text_len) == 0)) + result[j++] = g_strdup (v); + } + if (j) + result[j++] = NULL; + else { + g_free (result); + result = NULL; + } + + return (const char *const*) (*out_to_free = result); +} + +static gboolean +_set_fcn_connection_secondaries (ARGS_SET_FCN) +{ + gs_strfreev char **strv = NULL; + char **iter; + + strv = nmc_strsplit_set (value, " \t,", 0); + if (strv) { + for (iter = strv; *iter; iter++) { + if (**iter) + nm_setting_connection_add_secondary (NM_SETTING_CONNECTION (setting), *iter); + } + } + return TRUE; +} + +static gboolean +_validate_and_remove_connection_secondary (NMSettingConnection *setting, + const char *secondary_uuid, + GError **error) +{ + gboolean ret; + + if (!nm_utils_is_uuid (secondary_uuid)) { + g_set_error (error, 1, 0, + _("the value '%s' is not a valid UUID"), secondary_uuid); + return FALSE; + } + + ret = nm_setting_connection_remove_secondary_by_value (setting, secondary_uuid); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain UUID '%s'"), secondary_uuid); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_connection_secondaries, + NM_SETTING_CONNECTION, + nm_setting_connection_get_num_secondaries, + nm_setting_connection_remove_secondary, + _validate_and_remove_connection_secondary) + +static gconstpointer +_get_fcn_connection_metered (ARGS_GET_FCN) +{ + NMSettingConnection *s_conn = NM_SETTING_CONNECTION (setting); + const char *s; + + RETURN_UNSUPPORTED_GET_TYPE (); + + switch (nm_setting_connection_get_metered (s_conn)) { + case NM_METERED_YES: + s = N_("yes"); + break; + case NM_METERED_NO: + s = N_("no"); + break; + case NM_METERED_UNKNOWN: + default: + s = N_("unknown"); + break; + } + if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) + return _(s); + return s; +} + +static gboolean +_set_fcn_connection_metered (ARGS_SET_FCN) +{ + NMMetered metered; + NMCTriStateValue ts_val; + + if (!nmc_string_to_tristate (value, &ts_val, error)) + return FALSE; + + switch (ts_val) { + case NMC_TRI_STATE_YES: + metered = NM_METERED_YES; + break; + case NMC_TRI_STATE_NO: + metered = NM_METERED_NO; + break; + case NMC_TRI_STATE_UNKNOWN: + metered = NM_METERED_UNKNOWN; + break; + default: + g_assert_not_reached(); + } + + g_object_set (setting, property_info->property_name, metered, NULL); + return TRUE; +} + +static char * +dcb_flags_to_string (NMSettingDcbFlags flags) +{ + GString *flag_str; + + if (flags == 0) + return g_strdup (_("0 (disabled)")); + + flag_str = g_string_new (NULL); + g_string_printf (flag_str, "%d (", flags); + + if (flags & NM_SETTING_DCB_FLAG_ENABLE) + g_string_append (flag_str, _("enabled, ")); + if (flags & NM_SETTING_DCB_FLAG_ADVERTISE) + g_string_append (flag_str, _("advertise, ")); + if (flags & NM_SETTING_DCB_FLAG_WILLING) + g_string_append (flag_str, _("willing, ")); + + if (flag_str->str[flag_str->len-1] == '(') + g_string_append (flag_str, _("unknown")); + else + g_string_truncate (flag_str, flag_str->len-2); /* chop off trailing ', ' */ + + g_string_append_c (flag_str, ')'); + + return g_string_free (flag_str, FALSE); +} + +#define DEFINE_DCB_FLAGS_GETTER(func_name, property_name) \ + static gconstpointer \ + func_name (ARGS_GET_FCN) \ + { \ + guint v; \ + GValue val = G_VALUE_INIT; \ + \ + RETURN_UNSUPPORTED_GET_TYPE (); \ + g_value_init (&val, G_TYPE_UINT); \ + g_object_get_property (G_OBJECT (setting), property_name, &val); \ + v = g_value_get_uint (&val); \ + g_value_unset (&val); \ + RETURN_STR_TO_FREE (dcb_flags_to_string (v)); \ + } + +#define DEFINE_DCB_BOOL_GETTER(func_name, getter_func_name) \ + static gconstpointer \ + func_name (ARGS_GET_FCN) \ + { \ + NMSettingDcb *s_dcb = NM_SETTING_DCB (setting); \ + GString *str; \ + guint i; \ + \ + RETURN_UNSUPPORTED_GET_TYPE (); \ + \ + str = g_string_new (NULL); \ + for (i = 0; i < 8; i++) { \ + if (getter_func_name (s_dcb, i)) \ + g_string_append_c (str, '1'); \ + else \ + g_string_append_c (str, '0'); \ + if (i < 7) \ + g_string_append_c (str, ','); \ + } \ + \ + RETURN_STR_TO_FREE (g_string_free (str, FALSE)); \ + } + +#define DEFINE_DCB_UINT_GETTER(func_name, getter_func_name) \ + static gconstpointer \ + func_name (ARGS_GET_FCN) \ + { \ + NMSettingDcb *s_dcb = NM_SETTING_DCB (setting); \ + GString *str; \ + guint i; \ + \ + RETURN_UNSUPPORTED_GET_TYPE (); \ + \ + str = g_string_new (NULL); \ + for (i = 0; i < 8; i++) { \ + g_string_append_printf (str, "%u", getter_func_name (s_dcb, i)); \ + if (i < 7) \ + g_string_append_c (str, ','); \ + } \ + \ + RETURN_STR_TO_FREE (g_string_free (str, FALSE)); \ + } + +DEFINE_DCB_FLAGS_GETTER (_get_fcn_dcb_app_fcoe_flags, NM_SETTING_DCB_APP_FCOE_FLAGS) +DEFINE_DCB_FLAGS_GETTER (_get_fcn_dcb_app_iscsi_flags, NM_SETTING_DCB_APP_ISCSI_FLAGS) +DEFINE_DCB_FLAGS_GETTER (_get_fcn_dcb_app_fip_flags, NM_SETTING_DCB_APP_FIP_FLAGS) + +DEFINE_DCB_FLAGS_GETTER (_get_fcn_dcb_priority_flow_control_flags, NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS) +DEFINE_DCB_BOOL_GETTER (_get_fcn_dcb_priority_flow_control, nm_setting_dcb_get_priority_flow_control) + +DEFINE_DCB_FLAGS_GETTER (_get_fcn_dcb_priority_group_flags, NM_SETTING_DCB_PRIORITY_GROUP_FLAGS) +DEFINE_DCB_UINT_GETTER (_get_fcn_dcb_priority_group_id, nm_setting_dcb_get_priority_group_id) +DEFINE_DCB_UINT_GETTER (_get_fcn_dcb_priority_group_bandwidth, nm_setting_dcb_get_priority_group_bandwidth) +DEFINE_DCB_UINT_GETTER (_get_fcn_dcb_priority_bandwidth, nm_setting_dcb_get_priority_bandwidth) +DEFINE_DCB_BOOL_GETTER (_get_fcn_dcb_priority_strict, nm_setting_dcb_get_priority_strict_bandwidth) +DEFINE_DCB_UINT_GETTER (_get_fcn_dcb_priority_traffic_class, nm_setting_dcb_get_priority_traffic_class) + +#define DCB_ALL_FLAGS (NM_SETTING_DCB_FLAG_ENABLE | NM_SETTING_DCB_FLAG_ADVERTISE | NM_SETTING_DCB_FLAG_WILLING) + +static gboolean +_set_fcn_dcb_flags (ARGS_SET_FCN) +{ + char **strv = NULL, **iter; + NMSettingDcbFlags flags = NM_SETTING_DCB_FLAG_NONE; + long int t; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + /* Check for overall hex numeric value */ + t = _nm_utils_ascii_str_to_int64 (value, 0, 0, DCB_ALL_FLAGS, -1); + if (t != -1) + flags = (guint) t; + else { + /* Check for individual flag numbers */ + strv = nmc_strsplit_set (value, " \t,", 0); + for (iter = strv; iter && *iter; iter++) { + t = _nm_utils_ascii_str_to_int64 (*iter, 0, 0, DCB_ALL_FLAGS, -1); + + if ( g_ascii_strcasecmp (*iter, "enable") == 0 + || g_ascii_strcasecmp (*iter, "enabled") == 0 + || t == NM_SETTING_DCB_FLAG_ENABLE) + flags |= NM_SETTING_DCB_FLAG_ENABLE; + else if ( g_ascii_strcasecmp (*iter, "advertise") == 0 + || t == NM_SETTING_DCB_FLAG_ADVERTISE) + flags |= NM_SETTING_DCB_FLAG_ADVERTISE; + else if ( g_ascii_strcasecmp (*iter, "willing") == 0 + || t == NM_SETTING_DCB_FLAG_WILLING) + flags |= NM_SETTING_DCB_FLAG_WILLING; + else if ( g_ascii_strcasecmp (*iter, "disable") == 0 + || g_ascii_strcasecmp (*iter, "disabled") == 0 + || t == 0) { + /* pass */ + } else { + g_set_error (error, 1, 0, _("'%s' is not a valid DCB flag"), *iter); + return FALSE; + } + } + g_strfreev (strv); + } + + /* Validate the flags according to the property spec */ + if (!validate_flags (setting, property_info->property_name, (guint) flags, error)) + return FALSE; + + g_object_set (setting, property_info->property_name, (guint) flags, NULL); + return TRUE; +} + +static gboolean +dcb_parse_uint_array (const char *val, + guint max, + guint other, + guint *out_array, + GError **error) +{ + gs_strfreev char **items = NULL; + char **iter; + gsize i; + + nm_assert (out_array); + + items = g_strsplit_set (val, ",", -1); + if (g_strv_length (items) != 8) { + g_set_error_literal (error, 1, 0, _("must contain 8 comma-separated numbers")); + return FALSE; + } + + i = 0; + for (iter = items; *iter; iter++) { + gint64 num; + + *iter = g_strstrip (*iter); + + num = _nm_utils_ascii_str_to_int64 (*iter, 10, 0, other ? other : max, -1); + + /* If number is greater than 'max' it must equal 'other' */ + if ( num == -1 + || (other && (num > max) && (num != other))) { + if (other) { + g_set_error (error, 1, 0, _("'%s' not a number between 0 and %u (inclusive) or %u"), + *iter, max, other); + } else { + g_set_error (error, 1, 0, _("'%s' not a number between 0 and %u (inclusive)"), + *iter, max); + } + return FALSE; + } + nm_assert (i < 8); + out_array[i++] = (guint) num; + } + + return TRUE; +} + +static void +dcb_check_feature_enabled (const NMMetaEnvironment *environment, gpointer *environment_user_data, NMSettingDcb *s_dcb, const char *flags_prop) +{ + NMSettingDcbFlags flags = NM_SETTING_DCB_FLAG_NONE; + + g_object_get (s_dcb, flags_prop, &flags, NULL); + if (!(flags & NM_SETTING_DCB_FLAG_ENABLE)) { + _env_warn_fcn (environment, environment_user_data, + NM_META_ENV_WARN_LEVEL_WARN, + N_("changes will have no effect until '%s' includes 1 (enabled)"), + flags_prop); + } +} + +static gboolean +_set_fcn_dcb_priority_flow_control (ARGS_SET_FCN) +{ + guint i = 0; + guint nums[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!dcb_parse_uint_array (value, 1, 0, nums, error)) + return FALSE; + + for (i = 0; i < 8; i++) + nm_setting_dcb_set_priority_flow_control (NM_SETTING_DCB (setting), i, !!nums[i]); + + dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS); + return TRUE; +} + +static gboolean +_set_fcn_dcb_priority_group_id (ARGS_SET_FCN) +{ + guint i = 0; + guint nums[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!dcb_parse_uint_array (value, 7, 15, nums, error)) + return FALSE; + + for (i = 0; i < 8; i++) + nm_setting_dcb_set_priority_group_id (NM_SETTING_DCB (setting), i, nums[i]); + + dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_GROUP_FLAGS); + return TRUE; +} + +static gboolean +_set_fcn_dcb_priority_group_bandwidth (ARGS_SET_FCN) +{ + guint i = 0, sum = 0; + guint nums[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!dcb_parse_uint_array (value, 100, 0, nums, error)) + return FALSE; + + for (i = 0; i < 8; i++) + sum += nums[i]; + if (sum != 100) { + g_set_error_literal (error, 1, 0, _("bandwidth percentages must total 100%%")); + return FALSE; + } + + for (i = 0; i < 8; i++) + nm_setting_dcb_set_priority_group_bandwidth (NM_SETTING_DCB (setting), i, nums[i]); + + dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_GROUP_FLAGS); + return TRUE; +} + +static gboolean +_set_fcn_dcb_priority_bandwidth (ARGS_SET_FCN) +{ + guint i = 0; + guint nums[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!dcb_parse_uint_array (value, 100, 0, nums, error)) + return FALSE; + + for (i = 0; i < 8; i++) + nm_setting_dcb_set_priority_bandwidth (NM_SETTING_DCB (setting), i, nums[i]); + + dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_GROUP_FLAGS); + return TRUE; +} + +static gboolean +_set_fcn_dcb_priority_strict (ARGS_SET_FCN) +{ + guint i = 0; + guint nums[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!dcb_parse_uint_array (value, 1, 0, nums, error)) + return FALSE; + + for (i = 0; i < 8; i++) + nm_setting_dcb_set_priority_strict_bandwidth (NM_SETTING_DCB (setting), i, !!nums[i]); + + dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_GROUP_FLAGS); + return TRUE; +} + +static gboolean +_set_fcn_dcb_priority_traffic_class (ARGS_SET_FCN) +{ + guint i = 0; + guint nums[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!dcb_parse_uint_array (value, 7, 0, nums, error)) + return FALSE; + + for (i = 0; i < 8; i++) + nm_setting_dcb_set_priority_traffic_class (NM_SETTING_DCB (setting), i, nums[i]); + + dcb_check_feature_enabled (environment, environment_user_data, NM_SETTING_DCB (setting), NM_SETTING_DCB_PRIORITY_GROUP_FLAGS); + return TRUE; +} + +static gboolean +_set_fcn_gsm_sim_operator_id (ARGS_SET_FCN) +{ + const char *p = value; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (strlen (value) != 5 && strlen (value) != 6) { + g_set_error_literal (error, 1, 0, _("SIM operator ID must be a 5 or 6 number MCCMNC code")); + return FALSE; + } + + while (p && *p) { + if (!g_ascii_isdigit (*p++)) { + g_set_error_literal (error, 1, 0, _("SIM operator ID must be a 5 or 6 number MCCMNC code")); + return FALSE; + } + } + g_object_set (G_OBJECT (setting), + NM_SETTING_GSM_SIM_OPERATOR_ID, + value, + NULL); + return TRUE; +} + +static gboolean +_set_fcn_infiniband_p_key (ARGS_SET_FCN) +{ + const gint64 INVALID = G_MININT64; + gint64 p_key; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (nm_streq (value, "default")) + p_key = -1; + else { + p_key = _nm_utils_ascii_str_to_int64 (value, 0, -1, G_MAXUINT16, INVALID); + if (p_key == INVALID) { + g_set_error (error, 1, 0, _("'%s' is not a valid IBoIP P_Key"), value); + return FALSE; + } + } + + g_object_set (setting, property_info->property_name, (int) p_key, NULL); + return TRUE; +} + + +static gconstpointer +_get_fcn_infiniband_p_key (ARGS_GET_FCN) +{ + NMSettingInfiniband *s_infiniband = NM_SETTING_INFINIBAND (setting); + int p_key; + + RETURN_UNSUPPORTED_GET_TYPE (); + + p_key = nm_setting_infiniband_get_p_key (s_infiniband); + if (p_key == -1) { + if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) + return "default"; + else + return _("default"); + } else + RETURN_STR_TO_FREE (g_strdup_printf ("0x%04x", p_key)); +} + +static gconstpointer +_get_fcn_ip_config_addresses (ARGS_GET_FCN) +{ + NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting); + GString *printable; + guint32 num_addresses, i; + NMIPAddress *addr; + + RETURN_UNSUPPORTED_GET_TYPE (); + + printable = g_string_new (NULL); + + num_addresses = nm_setting_ip_config_get_num_addresses (s_ip); + for (i = 0; i < num_addresses; i++) { + addr = nm_setting_ip_config_get_address (s_ip, i); + + if (printable->len > 0) + g_string_append (printable, ", "); + + g_string_append_printf (printable, "%s/%u", + nm_ip_address_get_address (addr), + nm_ip_address_get_prefix (addr)); + } + + RETURN_STR_TO_FREE (g_string_free (printable, FALSE)); +} + +static gconstpointer +_get_fcn_ip_config_routes (ARGS_GET_FCN) +{ + NMSettingIPConfig *s_ip = NM_SETTING_IP_CONFIG (setting); + GString *printable; + guint32 num_routes, i; + NMIPRoute *route; + + RETURN_UNSUPPORTED_GET_TYPE (); + + printable = g_string_new (NULL); + + num_routes = nm_setting_ip_config_get_num_routes (s_ip); + for (i = 0; i < num_routes; i++) { + gs_free char *attr_str = NULL; + gs_strfreev char **attr_names = NULL; + gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal); + int j; + + route = nm_setting_ip_config_get_route (s_ip, i); + + attr_names = nm_ip_route_get_attribute_names (route); + for (j = 0; attr_names && attr_names[j]; j++) { + g_hash_table_insert (hash, attr_names[j], + nm_ip_route_get_attribute (route, attr_names[j])); + } + + attr_str = nm_utils_format_variant_attributes (hash, ' ', '='); + + if (get_type != NM_META_ACCESSOR_GET_TYPE_PRETTY) { + if (printable->len > 0) + g_string_append (printable, ", "); + + g_string_append_printf (printable, "%s/%u", + nm_ip_route_get_dest (route), + nm_ip_route_get_prefix (route)); + + if (nm_ip_route_get_next_hop (route)) + g_string_append_printf (printable, " %s", nm_ip_route_get_next_hop (route)); + if (nm_ip_route_get_metric (route) != -1) + g_string_append_printf (printable, " %u", (guint32) nm_ip_route_get_metric (route)); + if (attr_str) + g_string_append_printf (printable, " %s", attr_str); + } else { + + if (printable->len > 0) + g_string_append (printable, "; "); + + g_string_append (printable, "{ "); + + g_string_append_printf (printable, "ip = %s/%u", + nm_ip_route_get_dest (route), + nm_ip_route_get_prefix (route)); + + if (nm_ip_route_get_next_hop (route)) { + g_string_append_printf (printable, ", nh = %s", + nm_ip_route_get_next_hop (route)); + } + + if (nm_ip_route_get_metric (route) != -1) + g_string_append_printf (printable, ", mt = %u", (guint32) nm_ip_route_get_metric (route)); + if (attr_str) + g_string_append_printf (printable, " %s", attr_str); + + g_string_append (printable, " }"); + } + } + + RETURN_STR_TO_FREE (g_string_free (printable, FALSE)); +} + +static const char *ipv4_valid_methods[] = { + NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP4_CONFIG_METHOD_MANUAL, + NM_SETTING_IP4_CONFIG_METHOD_SHARED, + NM_SETTING_IP4_CONFIG_METHOD_DISABLED, + NULL +}; + +static gboolean +_set_fcn_ip4_config_method (ARGS_SET_FCN) +{ + /* Silently accept "static" and convert to "manual" */ + if (value && strlen (value) > 1 && matches (value, "static")) + value = NM_SETTING_IP4_CONFIG_METHOD_MANUAL; + + return check_and_set_string (setting, property_info->property_name, value, ipv4_valid_methods, error); +} + +static gboolean +_set_fcn_ip4_config_dns (ARGS_SET_FCN) +{ + char **strv = NULL, **iter, *addr; + guint32 ip4_addr; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + strv = nmc_strsplit_set (value, " \t,", 0); + for (iter = strv; iter && *iter; iter++) { + addr = g_strstrip (*iter); + if (inet_pton (AF_INET, addr, &ip4_addr) < 1) { + g_set_error (error, 1, 0, _("invalid IPv4 address '%s'"), addr); + g_strfreev (strv); + return FALSE; + } + nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr); + } + g_strfreev (strv); + return TRUE; +} + +static gboolean +_validate_and_remove_ipv4_dns (NMSettingIPConfig *setting, + const char *dns, + GError **error) +{ + guint32 ip4_addr; + gboolean ret; + + if (inet_pton (AF_INET, dns, &ip4_addr) < 1) { + g_set_error (error, 1, 0, _("invalid IPv4 address '%s'"), dns); + return FALSE; + } + + ret = nm_setting_ip_config_remove_dns_by_value (setting, dns); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv4_config_dns, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns, + nm_setting_ip_config_remove_dns, + _validate_and_remove_ipv4_dns) + +static gboolean +_set_fcn_ip4_config_dns_search (ARGS_SET_FCN) +{ + char **strv = NULL; + guint i = 0; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + strv = nmc_strsplit_set (value, " \t,", 0); + if (!verify_string_list (strv, property_info->property_name, nmc_util_is_domain, error)) { + g_strfreev (strv); + return FALSE; + } + + while (strv && strv[i]) + nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]); + g_strfreev (strv); + + return TRUE; +} + +static gboolean +_validate_and_remove_ipv4_dns_search (NMSettingIPConfig *setting, + const char *dns_search, + GError **error) +{ + gboolean ret; + + ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain DNS search domain '%s'"), + dns_search); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv4_config_dns_search, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns_searches, + nm_setting_ip_config_remove_dns_search, + _validate_and_remove_ipv4_dns_search) + +static gboolean +_set_fcn_ip4_config_dns_options (ARGS_SET_FCN) +{ + char **strv = NULL; + guint i = 0; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + nm_setting_ip_config_clear_dns_options (NM_SETTING_IP_CONFIG (setting), TRUE); + strv = nmc_strsplit_set (value, " \t,", 0); + while (strv && strv[i]) + nm_setting_ip_config_add_dns_option (NM_SETTING_IP_CONFIG (setting), strv[i++]); + g_strfreev (strv); + + return TRUE; +} + +static gboolean +_validate_and_remove_ipv4_dns_option (NMSettingIPConfig *setting, + const char *dns_option, + GError **error) +{ + gboolean ret; + + ret = nm_setting_ip_config_remove_dns_option_by_value (setting, dns_option); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain DNS option '%s'"), + dns_option); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv4_config_dns_options, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns_options, + nm_setting_ip_config_remove_dns_option, + _validate_and_remove_ipv4_dns_option) + +static gboolean +_set_fcn_ip4_config_addresses (ARGS_SET_FCN) +{ + gs_strfreev char **strv = NULL; + const char *const*iter; + NMIPAddress *ip4addr; + + strv = nmc_strsplit_set (value, ",", 0); + for (iter = (const char *const*) strv; *iter; iter++) { + ip4addr = _parse_ip_address (AF_INET, *iter, error); + if (!ip4addr) + return FALSE; + nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip4addr); + nm_ip_address_unref (ip4addr); + } + return TRUE; +} + +static gboolean +_validate_and_remove_ipv4_address (NMSettingIPConfig *setting, + const char *address, + GError **error) +{ + NMIPAddress *ip4addr; + gboolean ret; + + ip4addr = _parse_ip_address (AF_INET, address, error); + if (!ip4addr) + return FALSE; + + ret = nm_setting_ip_config_remove_address_by_value (setting, ip4addr); + if (!ret) { + g_set_error (error, 1, 0, + _("the property doesn't contain IP address '%s'"), address); + } + nm_ip_address_unref (ip4addr); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv4_config_addresses, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_addresses, + nm_setting_ip_config_remove_address, + _validate_and_remove_ipv4_address) + +static gboolean +_set_fcn_ip4_config_gateway (ARGS_SET_FCN) +{ + gs_free char *addr = NULL; + + addr = g_strstrip (g_strdup (value)); + + if (!nm_utils_ipaddr_valid (AF_INET, addr)) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid gateway address '%s'"), value); + return FALSE; + } + g_object_set (setting, property_info->property_name, addr, NULL); + return TRUE; +} + +static gboolean +_set_fcn_ip4_config_routes (ARGS_SET_FCN) +{ + gs_strfreev char **strv = NULL; + const char *const*iter; + NMIPRoute *ip4route; + + strv = nmc_strsplit_set (value, ",", 0); + for (iter = (const char *const*) strv; *iter; iter++) { + ip4route = _parse_ip_route (AF_INET, *iter, error); + if (!ip4route) + return FALSE; + nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip4route); + nm_ip_route_unref (ip4route); + } + return TRUE; +} + +static gboolean +_validate_and_remove_ipv4_route (NMSettingIPConfig *setting, + const char *route, + GError **error) +{ + NMIPRoute *ip4route; + gboolean ret; + + ip4route = _parse_ip_route (AF_INET, route, error); + if (!ip4route) + return FALSE; + + ret = nm_setting_ip_config_remove_route_by_value (setting, ip4route); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route); + nm_ip_route_unref (ip4route); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv4_config_routes, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_routes, + nm_setting_ip_config_remove_route, + _validate_and_remove_ipv4_route) + +static gconstpointer +_get_fcn_ip6_config_ip6_privacy (ARGS_GET_FCN) +{ + NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting); + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (ip6_privacy_to_string (nm_setting_ip6_config_get_ip6_privacy (s_ip6), get_type)); +} + +static const char *ipv6_valid_methods[] = { + NM_SETTING_IP6_CONFIG_METHOD_IGNORE, + NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NM_SETTING_IP6_CONFIG_METHOD_DHCP, + NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, + NM_SETTING_IP6_CONFIG_METHOD_MANUAL, + NM_SETTING_IP6_CONFIG_METHOD_SHARED, + NULL +}; + +static gboolean +_set_fcn_ip6_config_method (ARGS_SET_FCN) +{ + /* Silently accept "static" and convert to "manual" */ + if (value && strlen (value) > 1 && matches (value, "static")) + value = NM_SETTING_IP6_CONFIG_METHOD_MANUAL; + + return check_and_set_string (setting, property_info->property_name, value, ipv6_valid_methods, error); +} + +static gboolean +_set_fcn_ip6_config_dns (ARGS_SET_FCN) +{ + char **strv = NULL, **iter, *addr; + struct in6_addr ip6_addr; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + strv = nmc_strsplit_set (value, " \t,", 0); + for (iter = strv; iter && *iter; iter++) { + addr = g_strstrip (*iter); + if (inet_pton (AF_INET6, addr, &ip6_addr) < 1) { + g_set_error (error, 1, 0, _("invalid IPv6 address '%s'"), addr); + g_strfreev (strv); + return FALSE; + } + nm_setting_ip_config_add_dns (NM_SETTING_IP_CONFIG (setting), addr); + } + g_strfreev (strv); + return TRUE; +} + +static gboolean +_validate_and_remove_ipv6_dns (NMSettingIPConfig *setting, + const char *dns, + GError **error) +{ + struct in6_addr ip6_addr; + gboolean ret; + + if (inet_pton (AF_INET6, dns, &ip6_addr) < 1) { + g_set_error (error, 1, 0, _("invalid IPv6 address '%s'"), dns); + return FALSE; + } + + ret = nm_setting_ip_config_remove_dns_by_value (setting, dns); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain DNS server '%s'"), dns); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv6_config_dns, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns, + nm_setting_ip_config_remove_dns, + _validate_and_remove_ipv6_dns) + +static gboolean +_set_fcn_ip6_config_dns_search (ARGS_SET_FCN) +{ + char **strv = NULL; + guint i = 0; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + strv = nmc_strsplit_set (value, " \t,", 0); + if (!verify_string_list (strv, property_info->property_name, nmc_util_is_domain, error)) { + g_strfreev (strv); + return FALSE; + } + + while (strv && strv[i]) + nm_setting_ip_config_add_dns_search (NM_SETTING_IP_CONFIG (setting), strv[i++]); + g_strfreev (strv); + + return TRUE; +} + +static gboolean +_validate_and_remove_ipv6_dns_search (NMSettingIPConfig *setting, + const char *dns_search, + GError **error) +{ + gboolean ret; + + ret = nm_setting_ip_config_remove_dns_search_by_value (setting, dns_search); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain DNS search domain '%s'"), + dns_search); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv6_config_dns_search, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns_searches, + nm_setting_ip_config_remove_dns_search, + _validate_and_remove_ipv6_dns_search) + +static gboolean +_set_fcn_ip6_config_dns_options (ARGS_SET_FCN) +{ + char **strv = NULL; + guint i = 0; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + nm_setting_ip_config_clear_dns_options (NM_SETTING_IP_CONFIG (setting), TRUE); + strv = nmc_strsplit_set (value, " \t,", 0); + while (strv && strv[i]) + nm_setting_ip_config_add_dns_option (NM_SETTING_IP_CONFIG (setting), strv[i++]); + g_strfreev (strv); + + return TRUE; +} + +static gboolean +_validate_and_remove_ipv6_dns_option (NMSettingIPConfig *setting, + const char *dns_option, + GError **error) +{ + gboolean ret; + + ret = nm_setting_ip_config_remove_dns_option_by_value (setting, dns_option); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain DNS option '%s'"), + dns_option); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv6_config_dns_options, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_dns_options, + nm_setting_ip_config_remove_dns_option, + _validate_and_remove_ipv6_dns_option) + +static gboolean +_set_fcn_ip6_config_addresses (ARGS_SET_FCN) +{ + gs_strfreev char **strv = NULL; + const char *const*iter; + NMIPAddress *ip6addr; + + strv = nmc_strsplit_set (value, ",", 0); + for (iter = (const char *const*) strv; *iter; iter++) { + ip6addr = _parse_ip_address (AF_INET6, *iter, error); + if (!ip6addr) + return FALSE; + nm_setting_ip_config_add_address (NM_SETTING_IP_CONFIG (setting), ip6addr); + nm_ip_address_unref (ip6addr); + } + return TRUE; +} + +static gboolean +_validate_and_remove_ipv6_address (NMSettingIPConfig *setting, + const char *address, + GError **error) +{ + NMIPAddress *ip6addr; + gboolean ret; + + ip6addr = _parse_ip_address (AF_INET6, address, error); + if (!ip6addr) + return FALSE; + + ret = nm_setting_ip_config_remove_address_by_value (setting, ip6addr); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain IP address '%s'"), address); + nm_ip_address_unref (ip6addr); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv6_config_addresses, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_addresses, + nm_setting_ip_config_remove_address, + _validate_and_remove_ipv6_address) + +static gboolean +_set_fcn_ip6_config_gateway (ARGS_SET_FCN) +{ + gs_free char *addr = NULL; + + addr = g_strstrip (g_strdup (value)); + + if (!nm_utils_ipaddr_valid (AF_INET6, addr)) { + g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_INVALID_ARGUMENT, + _("invalid gateway address '%s'"), + addr); + return FALSE; + } + + g_object_set (setting, property_info->property_name, addr, NULL); + return TRUE; +} + +static gboolean +_set_fcn_ip6_config_routes (ARGS_SET_FCN) +{ + gs_strfreev char **strv = NULL; + const char *const*iter; + NMIPRoute *ip6route; + + strv = nmc_strsplit_set (value, ",", 0); + for (iter = (const char *const*) strv; *iter; iter++) { + ip6route = _parse_ip_route (AF_INET6, *iter, error); + if (!ip6route) + return FALSE; + nm_setting_ip_config_add_route (NM_SETTING_IP_CONFIG (setting), ip6route); + nm_ip_route_unref (ip6route); + } + return TRUE; +} + +static gboolean +_validate_and_remove_ipv6_route (NMSettingIPConfig *setting, + const char *route, + GError **error) +{ + NMIPRoute *ip6route; + gboolean ret; + + ip6route = _parse_ip_route (AF_INET6, route, error); + if (!ip6route) + return FALSE; + + ret = nm_setting_ip_config_remove_route_by_value (setting, ip6route); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain route '%s'"), route); + nm_ip_route_unref (ip6route); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_ipv6_config_routes, + NM_SETTING_IP_CONFIG, + nm_setting_ip_config_get_num_routes, + nm_setting_ip_config_remove_route, + _validate_and_remove_ipv6_route) + +static gboolean +_set_fcn_ip6_config_ip6_privacy (ARGS_SET_FCN) +{ + unsigned long val_int; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!nmc_string_to_uint (value, FALSE, 0, 0, &val_int)) { + g_set_error (error, 1, 0, _("'%s' is not a number"), value); + return FALSE; + } + + if ( val_int != NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED + && val_int != NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR + && val_int != NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR) { + g_set_error (error, 1, 0, _("'%s' is not valid; use 0, 1, or 2"), value); + return FALSE; + } + + g_object_set (setting, property_info->property_name, val_int, NULL); + return TRUE; +} + +static gconstpointer +_get_fcn_olpc_mesh_ssid (ARGS_GET_FCN) +{ + NMSettingOlpcMesh *s_olpc_mesh = NM_SETTING_OLPC_MESH (setting); + GBytes *ssid; + char *ssid_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + ssid = nm_setting_olpc_mesh_get_ssid (s_olpc_mesh); + if (ssid) { + ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), + g_bytes_get_size (ssid)); + } + + RETURN_STR_TO_FREE (ssid_str); +} + +static gboolean +_set_fcn_olpc_mesh_channel (ARGS_SET_FCN) +{ + unsigned long chan_int; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!nmc_string_to_uint (value, TRUE, 1, 13, &chan_int)) { + g_set_error (error, 1, 0, _("'%s' is not a valid channel; use <1-13>"), value); + return FALSE; + } + g_object_set (setting, property_info->property_name, chan_int, NULL); + return TRUE; +} + +static const char * +_validate_fcn_proxy_pac_script (const char *value, char **out_to_free, GError **error) +{ + char *script = NULL; + + if (!nmc_proxy_check_script (value, &script, error)) + return NULL; + RETURN_STR_TO_FREE (script); +} + +static const char * +_validate_fcn_team_config (const char *value, char **out_to_free, GError **error) +{ + char *json = NULL; + + if (!nmc_team_check_config (value, &json, error)) + return NULL; + RETURN_STR_TO_FREE (json); +} + +static gconstpointer +_get_fcn_vlan_flags (ARGS_GET_FCN) +{ + NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting); + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (vlan_flags_to_string (nm_setting_vlan_get_flags (s_vlan), get_type)); +} + +static gconstpointer +_get_fcn_vlan_ingress_priority_map (ARGS_GET_FCN) +{ + NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting); + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (vlan_priorities_to_string (s_vlan, NM_VLAN_INGRESS_MAP)); +} + +static gconstpointer +_get_fcn_vlan_egress_priority_map (ARGS_GET_FCN) +{ + NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting); + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (vlan_priorities_to_string (s_vlan, NM_VLAN_EGRESS_MAP)); +} + +static gboolean +_set_vlan_xgress_priority_map (NMSetting *setting, + const char *value, + NMVlanPriorityMap map_type, + GError **error) +{ + char **prio_map, **p; + + prio_map = _parse_vlan_priority_maps (value, map_type, error); + if (!prio_map) + return FALSE; + + for (p = prio_map; p && *p; p++) + nm_setting_vlan_add_priority_str (NM_SETTING_VLAN (setting), map_type, *p); + + g_strfreev (prio_map); + return TRUE; +} + +static gboolean +_set_fcn_vlan_ingress_priority_map (ARGS_SET_FCN) +{ + return _set_vlan_xgress_priority_map (setting, value, NM_VLAN_INGRESS_MAP, error); +} + +static gboolean +_set_fcn_vlan_egress_priority_map (ARGS_SET_FCN) +{ + return _set_vlan_xgress_priority_map (setting, value, NM_VLAN_EGRESS_MAP, error); +} + +static gboolean +_remove_vlan_xgress_priority_map (const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMSetting *setting, + const NMMetaPropertyInfo *property_info, + const char *value, + guint32 idx, + NMVlanPriorityMap map_type, + GError **error) +{ + guint32 num; + + /* If value != NULL, remove by value */ + if (value) { + gboolean ret; + char **prio_map; + gs_free char *v = g_strdup (value); + + prio_map = _parse_vlan_priority_maps (v, map_type, error); + if (!prio_map) + return FALSE; + if (prio_map[1]) { + _env_warn_fcn (environment, environment_user_data, + NM_META_ENV_WARN_LEVEL_WARN, + N_("only one mapping at a time is supported; taking the first one (%s)"), + prio_map[0]); + } + ret = nm_setting_vlan_remove_priority_str_by_value (NM_SETTING_VLAN (setting), + map_type, + prio_map[0]); + + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain mapping '%s'"), prio_map[0]); + g_strfreev (prio_map); + return ret; + } + + /* Else remove by index */ + num = nm_setting_vlan_get_num_priorities (NM_SETTING_VLAN (setting), map_type); + if (num == 0) { + g_set_error_literal (error, 1, 0, _("no priority to remove")); + return FALSE; + } + if (idx >= num) { + g_set_error (error, 1, 0, _("index '%d' is not in the range of <0-%d>"), + idx, num - 1); + return FALSE; + } + + nm_setting_vlan_remove_priority (NM_SETTING_VLAN (setting), map_type, idx); + return TRUE; +} + +static gboolean +_remove_fcn_vlan_ingress_priority_map (ARGS_REMOVE_FCN) +{ + return _remove_vlan_xgress_priority_map (environment, + environment_user_data, + setting, + property_info, + value, + idx, + NM_VLAN_INGRESS_MAP, + error); +} + +static gboolean +_remove_fcn_vlan_egress_priority_map (ARGS_REMOVE_FCN) +{ + return _remove_vlan_xgress_priority_map (environment, + environment_user_data, + setting, + property_info, + value, + idx, + NM_VLAN_EGRESS_MAP, + error); +} + +static gconstpointer +_get_fcn_vpn_data (ARGS_GET_FCN) +{ + NMSettingVpn *s_vpn = NM_SETTING_VPN (setting); + GString *data_item_str; + + RETURN_UNSUPPORTED_GET_TYPE (); + + data_item_str = g_string_new (NULL); + nm_setting_vpn_foreach_data_item (s_vpn, &vpn_data_item, data_item_str); + + RETURN_STR_TO_FREE (g_string_free (data_item_str, FALSE)); +} + +static gconstpointer +_get_fcn_vpn_secrets (ARGS_GET_FCN) +{ + NMSettingVpn *s_vpn = NM_SETTING_VPN (setting); + GString *secret_str; + + RETURN_UNSUPPORTED_GET_TYPE (); + + secret_str = g_string_new (NULL); + nm_setting_vpn_foreach_secret (s_vpn, &vpn_data_item, secret_str); + + RETURN_STR_TO_FREE (g_string_free (secret_str, FALSE)); +} + +static const char * +_validate_vpn_hash_value (const char *option, const char *value, GError **error) +{ + /* nm_setting_vpn_add_data_item() and nm_setting_vpn_add_secret() does not + * allow empty strings */ + if (!value || !*value) { + g_set_error (error, 1, 0, _("'%s' cannot be empty"), option); + return NULL; + } + return value; +} + +DEFINE_SETTER_OPTIONS (_set_fcn_vpn_data, + NM_SETTING_VPN, + NMSettingVpn, + nm_setting_vpn_add_data_item, + NULL, + _validate_vpn_hash_value) +DEFINE_REMOVER_OPTION (_remove_fcn_vpn_data, + NM_SETTING_VPN, + nm_setting_vpn_remove_data_item) + +DEFINE_SETTER_OPTIONS (_set_fcn_vpn_secrets, + NM_SETTING_VPN, + NMSettingVpn, + nm_setting_vpn_add_secret, + NULL, + _validate_vpn_hash_value) +DEFINE_REMOVER_OPTION (_remove_fcn_vpn_secrets, + NM_SETTING_VPN, + nm_setting_vpn_remove_secret) + +DEFINE_SETTER_MAC_BLACKLIST (_set_fcn_wired_mac_address_blacklist, + NM_SETTING_WIRED, + nm_setting_wired_add_mac_blacklist_item) + +static gboolean +_validate_and_remove_wired_mac_blacklist_item (NMSettingWired *setting, + const char *mac, + GError **error) +{ + gboolean ret; + guint8 buf[32]; + + if (!nm_utils_hwaddr_aton (mac, buf, ETH_ALEN)) { + g_set_error (error, 1, 0, _("'%s' is not a valid MAC address"), mac); + return FALSE; + } + + ret = nm_setting_wired_remove_mac_blacklist_item_by_value (setting, mac); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain MAC address '%s'"), mac); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_wired_mac_address_blacklist, + NM_SETTING_WIRED, + nm_setting_wired_get_num_mac_blacklist_items, + nm_setting_wired_remove_mac_blacklist_item, + _validate_and_remove_wired_mac_blacklist_item) + +static gboolean +_set_fcn_wired_s390_subchannels (ARGS_SET_FCN) +{ + char **strv = NULL; + int len; + + strv = nmc_strsplit_set (value, " ,\t", 0); + len = g_strv_length (strv); + if (len != 2 && len != 3) { + g_set_error (error, 1, 0, _("'%s' is not valid; 2 or 3 strings should be provided"), + value); + g_strfreev (strv); + return FALSE; + } + + g_object_set (setting, property_info->property_name, strv, NULL); + g_strfreev (strv); + return TRUE; +} + +static const char * +_validate_s390_option_value (const char *option, const char *value, GError **error) +{ + /* nm_setting_wired_add_s390_option() requires value len in <1,199> interval */ + if (!value || !*value || strlen (value) >= 200) { + g_set_error (error, 1, 0, _("'%s' string value should consist of 1 - 199 characters"), option); + return NULL; + } + return value; +} +DEFINE_SETTER_OPTIONS (_set_fcn_wired_s390_options, + NM_SETTING_WIRED, + NMSettingWired, + nm_setting_wired_add_s390_option, + nm_setting_wired_get_valid_s390_options, + _validate_s390_option_value) +DEFINE_REMOVER_OPTION (_remove_fcn_wired_s390_options, + NM_SETTING_WIRED, + nm_setting_wired_remove_s390_option) + +static const char *const* +_values_fcn__wired_s390_options (ARGS_VALUES_FCN) +{ + return nm_setting_wired_get_valid_s390_options (NULL); +} + +static const char * +_describe_fcn_wired_s390_options (ARGS_DESCRIBE_FCN) +{ + gs_free char *options_str = NULL; + const char **valid_options; + char *s; + + valid_options = nm_setting_wired_get_valid_s390_options (NULL); + + options_str = g_strjoinv (", ", (char **) valid_options); + + s = g_strdup_printf (_("Enter a list of S/390 options formatted as:\n" + " option = <value>, option = <value>,...\n" + "Valid options are: %s\n"), + options_str); + return (*out_to_free = s); +} + + +static gconstpointer +_get_fcn_wireless_ssid (ARGS_GET_FCN) +{ + NMSettingWireless *s_wireless = NM_SETTING_WIRELESS (setting); + GBytes *ssid; + char *ssid_str = NULL; + + RETURN_UNSUPPORTED_GET_TYPE (); + + ssid = nm_setting_wireless_get_ssid (s_wireless); + if (ssid) { + ssid_str = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), + g_bytes_get_size (ssid)); + } + + RETURN_STR_TO_FREE (ssid_str); +} + +static gboolean +_set_fcn_wireless_channel (ARGS_SET_FCN) +{ + unsigned long chan_int; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + if (!nmc_string_to_uint (value, FALSE, 0, 0, &chan_int)) { + g_set_error (error, 1, 0, _("'%s' is not a valid channel"), value); + return FALSE; + } + + if ( !nm_utils_wifi_is_channel_valid (chan_int, "a") + && !nm_utils_wifi_is_channel_valid (chan_int, "bg")) { + g_set_error (error, 1, 0, _("'%ld' is not a valid channel"), chan_int); + return FALSE; + } + + g_object_set (setting, property_info->property_name, chan_int, NULL); + return TRUE; +} + +DEFINE_SETTER_MAC_BLACKLIST (_set_fcn_wireless_mac_address_blacklist, + NM_SETTING_WIRELESS, + nm_setting_wireless_add_mac_blacklist_item) + +static gboolean +_validate_and_remove_wifi_mac_blacklist_item (NMSettingWireless *setting, + const char *mac, + GError **error) +{ + gboolean ret; + guint8 buf[32]; + + if (!nm_utils_hwaddr_aton (mac, buf, ETH_ALEN)) { + g_set_error (error, 1, 0, _("'%s' is not a valid MAC address"), mac); + return FALSE; + } + + ret = nm_setting_wireless_remove_mac_blacklist_item_by_value (setting, mac); + if (!ret) + g_set_error (error, 1, 0, _("the property doesn't contain MAC address '%s'"), mac); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_wireless_mac_address_blacklist, + NM_SETTING_WIRELESS, + nm_setting_wireless_get_num_mac_blacklist_items, + nm_setting_wireless_remove_mac_blacklist_item, + _validate_and_remove_wifi_mac_blacklist_item) + +static gconstpointer +_get_fcn_wireless_security_wep_key0 (ARGS_GET_FCN) +{ + NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting); + + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 0))); +} + +static gconstpointer +_get_fcn_wireless_security_wep_key1 (ARGS_GET_FCN) +{ + NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting); + + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 1))); +} + +static gconstpointer +_get_fcn_wireless_security_wep_key2 (ARGS_GET_FCN) +{ + NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting); + + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 2))); +} + +static gconstpointer +_get_fcn_wireless_security_wep_key3 (ARGS_GET_FCN) +{ + NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting); + + RETURN_UNSUPPORTED_GET_TYPE (); + RETURN_STR_TO_FREE (g_strdup (nm_setting_wireless_security_get_wep_key (s_wireless_sec, 3))); +} + +static const char *wifi_sec_valid_protos[] = { "wpa", "rsn", NULL }; + +DEFINE_SETTER_STR_LIST_MULTI (check_and_add_wifi_sec_proto, + NM_SETTING_WIRELESS_SECURITY, + nm_setting_wireless_security_add_proto) + +static gboolean +_set_fcn_wireless_security_proto (ARGS_SET_FCN) +{ + return check_and_add_wifi_sec_proto (setting, property_info->property_name, value, wifi_sec_valid_protos, error); +} + +static gboolean +_validate_and_remove_wifi_sec_proto (NMSettingWirelessSecurity *setting, + const char *proto, + GError **error) +{ + gboolean ret; + const char *valid; + + valid = nmc_string_is_valid (proto, wifi_sec_valid_protos, error); + if (!valid) + return FALSE; + + ret = nm_setting_wireless_security_remove_proto_by_value (setting, proto); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain protocol '%s'"), proto); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_wireless_security_proto, + NM_SETTING_WIRELESS_SECURITY, + nm_setting_wireless_security_get_num_protos, + nm_setting_wireless_security_remove_proto, + _validate_and_remove_wifi_sec_proto) + +static const char *wifi_sec_valid_pairwises[] = { "tkip", "ccmp", NULL }; + +DEFINE_SETTER_STR_LIST_MULTI (check_and_add_wifi_sec_pairwise, + NM_SETTING_WIRELESS_SECURITY, + nm_setting_wireless_security_add_pairwise) + +static gboolean +_set_fcn_wireless_security_pairwise (ARGS_SET_FCN) +{ + return check_and_add_wifi_sec_pairwise (setting, property_info->property_name, value, wifi_sec_valid_pairwises, error); +} + +static gboolean +_validate_and_remove_wifi_sec_pairwise (NMSettingWirelessSecurity *setting, + const char *pairwise, + GError **error) +{ + gboolean ret; + const char *valid; + + valid = nmc_string_is_valid (pairwise, wifi_sec_valid_pairwises, error); + if (!valid) + return FALSE; + + ret = nm_setting_wireless_security_remove_pairwise_by_value (setting, pairwise); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain protocol '%s'"), pairwise); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_wireless_security_pairwise, + NM_SETTING_WIRELESS_SECURITY, + nm_setting_wireless_security_get_num_pairwise, + nm_setting_wireless_security_remove_pairwise, + _validate_and_remove_wifi_sec_pairwise) + +static const char *wifi_sec_valid_groups[] = { "wep40", "wep104", "tkip", "ccmp", NULL }; + +DEFINE_SETTER_STR_LIST_MULTI (check_and_add_wifi_sec_group, + NM_SETTING_WIRELESS_SECURITY, + nm_setting_wireless_security_add_group) + +static gboolean +_set_fcn_wireless_security_group (ARGS_SET_FCN) +{ + return check_and_add_wifi_sec_group (setting, property_info->property_name, value, wifi_sec_valid_groups, error); +} + +static gboolean +_validate_and_remove_wifi_sec_group (NMSettingWirelessSecurity *setting, + const char *group, + GError **error) +{ + gboolean ret; + const char *valid; + + valid = nmc_string_is_valid (group, wifi_sec_valid_groups, error); + if (!valid) + return FALSE; + + ret = nm_setting_wireless_security_remove_group_by_value (setting, group); + if (!ret) + g_set_error (error, 1, 0, + _("the property doesn't contain protocol '%s'"), group); + return ret; +} +DEFINE_REMOVER_INDEX_OR_VALUE (_remove_fcn_wireless_security_group, + NM_SETTING_WIRELESS_SECURITY, + nm_setting_wireless_security_get_num_groups, + nm_setting_wireless_security_remove_group, + _validate_and_remove_wifi_sec_group) + +static gboolean +_set_fcn_wireless_wep_key (ARGS_SET_FCN) +{ + NMWepKeyType guessed_type = NM_WEP_KEY_TYPE_UNKNOWN; + NMWepKeyType type; + guint32 prev_idx, idx; + + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + /* Get currently set type */ + type = nm_setting_wireless_security_get_wep_key_type (NM_SETTING_WIRELESS_SECURITY (setting)); + + /* Guess key type */ + if (nm_utils_wep_key_valid (value, NM_WEP_KEY_TYPE_KEY)) + guessed_type = NM_WEP_KEY_TYPE_KEY; + else if (nm_utils_wep_key_valid (value, NM_WEP_KEY_TYPE_PASSPHRASE)) + guessed_type = NM_WEP_KEY_TYPE_PASSPHRASE; + + if (guessed_type == NM_WEP_KEY_TYPE_UNKNOWN) { + g_set_error (error, 1, 0, _("'%s' is not valid"), value); + return FALSE; + } + + if (type != NM_WEP_KEY_TYPE_UNKNOWN && type != guessed_type) { + if (nm_utils_wep_key_valid (value, type)) + guessed_type = type; + else { + g_set_error (error, 1, 0, + _("'%s' not compatible with %s '%s', please change the key or set the right %s first."), + value, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, wep_key_type_to_string (type), + NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE); + return FALSE; + } + } + prev_idx = nm_setting_wireless_security_get_wep_tx_keyidx (NM_SETTING_WIRELESS_SECURITY (setting)); + idx = property_info->property_name[strlen (property_info->property_name) - 1] - '0'; + _env_warn_fcn (environment, environment_user_data, + NM_META_ENV_WARN_LEVEL_INFO, + N_("WEP key is guessed to be of '%s'"), + wep_key_type_to_string (guessed_type)); + if (idx != prev_idx) { + _env_warn_fcn (environment, environment_user_data, + NM_META_ENV_WARN_LEVEL_INFO, + N_("WEP key index set to '%d'"), + idx); + } + + g_object_set (setting, property_info->property_name, value, NULL); + g_object_set (setting, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, guessed_type, NULL); + if (idx != prev_idx) + g_object_set (setting, NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, idx, NULL); + return TRUE; +} + +static void +_gobject_enum_pre_set_notify_fcn_wireless_security_wep_key_type (const NMMetaPropertyInfo *property_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMSetting *setting, + int value) +{ + guint i; + const char *key; + const char *keynames[] = { + NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, + NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, + NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, + NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, + }; + + /* Check type compatibility with set keys */ + if (!NM_IN_SET (value, + NM_WEP_KEY_TYPE_UNKNOWN, + NM_WEP_KEY_TYPE_KEY, + NM_WEP_KEY_TYPE_PASSPHRASE)) + return; + + for (i = 0; i < 4; i++) { + key = nm_setting_wireless_security_get_wep_key (NM_SETTING_WIRELESS_SECURITY (setting), i); + if (key && !nm_utils_wep_key_valid (key, value)) { + _env_warn_fcn (environment, environment_user_data, + NM_META_ENV_WARN_LEVEL_WARN, + N_("'%s' is not compatible with '%s' type, please change or delete the key."), + keynames[i], wep_key_type_to_string (value)); + } + } +} + +static const char * +_validate_fcn_wireless_security_psk (const char *value, char **out_to_free, GError **error) +{ + if (!nm_utils_wpa_psk_valid (value)) { + g_set_error (error, 1, 0, _("'%s' is not a valid PSK"), value); + return NULL; + } + return value; +} + +/*****************************************************************************/ + +static const NMMetaPropertyInfo property_info_BOND_OPTIONS; + +#define NESTED_PROPERTY_INFO_BOND(...) \ + .parent_info = &property_info_BOND_OPTIONS, \ + .base = { \ + .meta_type = &nm_meta_type_nested_property_info, \ + .setting_info = &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_BOND], \ + __VA_ARGS__ \ + } + +static const NMMetaNestedPropertyInfo meta_nested_property_infos_bond[] = { + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "mode", + .prompt = NM_META_TEXT_PROMPT_BOND_MODE, + .def_hint = "[balance-rr]", + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "primary", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("Bonding primary interface [none]"), + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + /* this is a virtual property, only needed during "ask" mode. */ + .prompt = N_("Bonding monitoring mode"), + .def_hint = NM_META_TEXT_PROMPT_BOND_MON_MODE_CHOICES, + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "miimon", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("Bonding miimon [100]"), + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "downdelay", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("Bonding downdelay [0]"), + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "updelay", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("Bonding updelay [0]"), + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "arp-interval", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("Bonding arp-interval [0]"), + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "arp-ip-target", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("Bonding arp-ip-target [none]"), + ) + }, + { + NESTED_PROPERTY_INFO_BOND ( + .property_name = NM_SETTING_BOND_OPTIONS, + .property_alias = "lacp-rate", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = N_("LACP rate ('slow' or 'fast') [slow]"), + ) + }, +}; + +const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond = { + .nested = meta_nested_property_infos_bond, + .nested_len = G_N_ELEMENTS (meta_nested_property_infos_bond), +}; + +/*****************************************************************************/ + +#define DEFINE_PROPERTY_TYPE(...) \ + (&((NMMetaPropertyType) { __VA_ARGS__ } )) + +#define DEFINE_PROPERTY_TYP_DATA(...) \ + (&((NMMetaPropertyTypData) { __VA_ARGS__ } )) + +#define PROPERTY_TYP_DATA_SUBTYPE(stype, ...) \ + .subtype = { \ + .stype = { __VA_ARGS__ }, \ + } + +#define DEFINE_PROPERTY_TYP_DATA_SUBTYPE(stype, ...) \ + DEFINE_PROPERTY_TYP_DATA ( \ + PROPERTY_TYP_DATA_SUBTYPE (stype, __VA_ARGS__), \ + ) + +static const NMMetaPropertyType _pt_gobject_readonly = { + .get_fcn = _get_fcn_gobject, +}; + +static const NMMetaPropertyType _pt_gobject_string = { + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gobject_string, +}; + +static const NMMetaPropertyType _pt_gobject_bool = { + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gobject_bool, + .complete_fcn = _complete_fcn_gobject_bool, +}; + +static const NMMetaPropertyType _pt_gobject_int = { + .get_fcn = _get_fcn_gobject_int, + .set_fcn = _set_fcn_gobject_int, +}; + +static const NMMetaPropertyType _pt_gobject_mtu = { + .get_fcn = _get_fcn_gobject_mtu, + .set_fcn = _set_fcn_gobject_mtu, +}; + +static const NMMetaPropertyType _pt_gobject_mac = { + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gobject_mac, +}; + +static const NMMetaPropertyType _pt_gobject_secret_flags = { + .get_fcn = _get_fcn_gobject_secret_flags, + .set_fcn = _set_fcn_gobject_secret_flags, +}; + +static const NMMetaPropertyType _pt_gobject_enum = { + .get_fcn = _get_fcn_gobject_enum, + .set_fcn = _set_fcn_gobject_enum, + .values_fcn = _values_fcn_gobject_enum, +}; + +static const NMMetaPropertyType _pt_gobject_devices = { + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gobject_string, + .complete_fcn = _complete_fcn_gobject_devices, +}; + +/*****************************************************************************/ + +#include "settings-docs.c" + +/*****************************************************************************/ + +#define PROPERTY_INFO_INIT(name, doc, ...) \ + { \ + .meta_type = &nm_meta_type_property_info, \ + .setting_info = &nm_meta_setting_infos_editor[_CURRENT_NM_META_SETTING_TYPE], \ + .property_name = name, \ + .describe_doc = doc, \ + __VA_ARGS__ \ + } + +#define PROPERTY_INFO(name, doc, ...) \ + (&((const NMMetaPropertyInfo) PROPERTY_INFO_INIT (name, doc, __VA_ARGS__))) + +#define PROPERTY_INFO_WITH_DESC(name, ...) \ + PROPERTY_INFO (name, DESCRIBE_DOC_##name, ##__VA_ARGS__) + +#define VALUES_STATIC(...) (((const char *[]) { __VA_ARGS__, NULL })) + +#define ENUM_VALUE_INFOS(...) (((const NMUtilsEnumValueInfo []) { __VA_ARGS__, { 0 } })) +#define INT_VALUE_INFOS(...) (((const NMMetaUtilsIntValueInfo []) { __VA_ARGS__, { 0 } })) + +#define GET_FCN_WITH_DEFAULT(type, func) \ + /* macro that returns @func as const (gboolean(*)(NMSetting*)) type, but checks + * that the actual type is (gboolean(*)(type *)). */ \ + ((gboolean (*) (NMSetting *)) ((sizeof (func == ((gboolean (*) (type *)) func))) ? func : func) ) + +#define MTU_GET_FCN(type, func) \ + /* macro that returns @func as const (guint32(*)(NMSetting*)) type, but checks + * that the actual type is (guint32(*)(type *)). */ \ + ((guint32 (*) (NMSetting *)) ((sizeof (func == ((guint32 (*) (type *)) func))) ? func : func) ) + +#define TEAM_DESCRIBE_MESSAGE \ + N_("nmcli can accepts both direct JSON configuration data and a file name containing " \ + "the configuration. In the latter case the file is read and the contents is put " \ + "into this property.\n\n" \ + "Examples: set team.config " \ + "{ \"device\": \"team0\", \"runner\": {\"name\": \"roundrobin\"}, \"ports\": {\"eth1\": {}, \"eth2\": {}} }\n" \ + " set team.config /etc/my-team.conf\n") + +#define DEFINE_DCB_PROPRITY_PROPERTY_TYPE \ + .property_type = &_pt_gobject_int, \ + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \ + .value_infos = INT_VALUE_INFOS ( \ + { \ + .value = -1, \ + .nick = "unset", \ + } \ + ), \ + ), + +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_802_1X +static const NMMetaPropertyInfo *const property_infos_802_1X[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_EAP, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_802_1x_eap, + .remove_fcn = _remove_fcn_802_1x_eap, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_IDENTITY, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_ANONYMOUS_IDENTITY, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PAC_FILE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_CERT, + .describe_message = + N_("Enter file path to CA certificate (optionally prefixed with file://).\n" + " [file://]<file path>\n" + "Note that nmcli does not support specifying certificates as raw blob data.\n" + "Example: /home/cimrman/cacert.crt\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_ca_cert, + .set_fcn = _set_fcn_802_1x_ca_cert, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_CERT_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_CERT_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CA_PATH, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_SUBJECT_MATCH, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_ALTSUBJECT_MATCHES, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_802_1x_altsubject_matches, + .remove_fcn = _remove_fcn_802_1x_altsubject_matches, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CLIENT_CERT, + .describe_message = + N_("Enter file path to client certificate (optionally prefixed with file://).\n" + " [file://]<file path>\n" + "Note that nmcli does not support specifying certificates as raw blob data.\n" + "Example: /home/cimrman/jara.crt\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_client_cert, + .set_fcn = _set_fcn_802_1x_client_cert, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CLIENT_CERT_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_CLIENT_CERT_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_PEAPVER, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("0", "1"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_PEAPLABEL, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("0", "1"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("0", "1", "2", "3"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE1_AUTH_FLAGS, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_802_1x_auth_flags_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_AUTH, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("pap", "chap", "mschap", "mschapv2", "gtc", "otp", "md5", "tls"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_AUTHEAP, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("md5", "mschapv2", "otp", "gtc", "tls"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT, + .describe_message = + N_("Enter file path to CA certificate for inner authentication (optionally prefixed\n" + "with file://).\n" + " [file://]<file path>\n" + "Note that nmcli does not support specifying certificates as raw blob data.\n" + "Example: /home/cimrman/ca-zweite-phase.crt\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_phase2_ca_cert, + .set_fcn = _set_fcn_802_1x_phase2_ca_cert, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CA_PATH, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_802_1x_phase2_altsubject_matches, + .remove_fcn = _remove_fcn_802_1x_phase2_altsubject_matches, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CLIENT_CERT, + .describe_message = + N_("Enter file path to client certificate for inner authentication (optionally prefixed\n" + "with file://).\n" + " [file://]<file path>\n" + "Note that nmcli does not support specifying certificates as raw blob data.\n" + "Example: /home/cimrman/jara-zweite-phase.crt\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_phase2_client_cert, + .set_fcn = _set_fcn_802_1x_phase2_client_cert, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD_RAW, + .is_secret = TRUE, + .describe_message = + N_("Enter bytes as a list of hexadecimal values.\n" + "Two formats are accepted:\n" + "(a) a string of hexadecimal digits, where each two digits represent one byte\n" + "(b) space-separated list of bytes written as hexadecimal digits " + "(with optional 0x/0X prefix, and optional leading 0).\n\n" + "Examples: ab0455a6ea3a74C2\n" + " ab 4 55 0xa6 ea 3a 74 C2\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_password_raw, + .set_fcn = _set_fcn_802_1x_password_raw, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PASSWORD_RAW_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PRIVATE_KEY, + .describe_message = + N_("Enter path to a private key and the key password (if not set yet):\n" + " [file://]<file path> [<password>]\n" + "Note that nmcli does not support specifying private key as raw blob data.\n" + "Example: /home/cimrman/jara-priv-key Dardanely\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_private_key, + .set_fcn = _set_fcn_802_1x_private_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, + .describe_message = + N_("Enter path to a private key and the key password (if not set yet):\n" + " [file://]<file path> [<password>]\n" + "Note that nmcli does not support specifying private key as raw blob data.\n" + "Example: /home/cimrman/jara-priv-key Dardanely\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_802_1x_phase2_private_key, + .set_fcn = _set_fcn_802_1x_phase2_private_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PIN, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_PIN_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_SYSTEM_CA_CERTS, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_802_1X_AUTH_TIMEOUT, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_ADSL +static const NMMetaPropertyInfo *const property_infos_ADSL[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_USERNAME, + .is_cli_option = TRUE, + .property_alias = "username", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("Username"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_PASSWORD, + .is_cli_option = TRUE, + .property_alias = "password", + .prompt = N_("Password [none]"), + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_PROTOCOL, + .is_cli_option = TRUE, + .property_alias = "protocol", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_ADSL_PROTO, + .def_hint = NM_META_TEXT_PROMPT_ADSL_PROTO_CHOICES, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC (NM_SETTING_ADSL_PROTOCOL_PPPOA, + NM_SETTING_ADSL_PROTOCOL_PPPOE, + NM_SETTING_ADSL_PROTOCOL_IPOATM), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_ENCAPSULATION, + .is_cli_option = TRUE, + .property_alias = "encapsulation", + .prompt = NM_META_TEXT_PROMPT_ADSL_ENCAP, + .def_hint = NM_META_TEXT_PROMPT_ADSL_ENCAP_CHOICES, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC (NM_SETTING_ADSL_ENCAPSULATION_VCMUX, + NM_SETTING_ADSL_ENCAPSULATION_LLC), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_VPI, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_ADSL_VCI, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BLUETOOTH +static const NMMetaPropertyInfo *const property_infos_BLUETOOTH[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_BLUETOOTH_BDADDR, + .is_cli_option = TRUE, + .property_alias = "addr", + .prompt = N_("Bluetooth device address"), + .property_type = &_pt_gobject_mac, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BLUETOOTH_TYPE, + .is_cli_option = TRUE, + .property_alias = "bt-type", + .prompt = NM_META_TEXT_PROMPT_BT_TYPE, + .def_hint = NM_META_TEXT_PROMPT_BT_TYPE_CHOICES, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC (NM_SETTING_BLUETOOTH_TYPE_DUN, + NM_SETTING_BLUETOOTH_TYPE_PANU, + NM_SETTING_BLUETOOTH_TYPE_NAP), + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BOND +static const NMMetaPropertyInfo property_info_BOND_OPTIONS = + PROPERTY_INFO_INIT (NM_SETTING_BOND_OPTIONS, DESCRIBE_DOC_NM_SETTING_BOND_OPTIONS, + .property_type = DEFINE_PROPERTY_TYPE ( + .describe_fcn = _describe_fcn_bond_options, + .get_fcn = _get_fcn_bond_options, + .set_fcn = _set_fcn_bond_options, + .remove_fcn = _remove_fcn_bond_options, + .values_fcn = _values_fcn_bond_options, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .nested = &nm_meta_property_typ_data_bond, + ), + ); + +static const NMMetaPropertyInfo *const property_infos_BOND[] = { + &property_info_BOND_OPTIONS, + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BRIDGE +static const NMMetaPropertyInfo *const property_infos_BRIDGE[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MAC_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "mac", + .prompt = N_("MAC [none]"), + .property_type = &_pt_gobject_mac, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_STP, + .is_cli_option = TRUE, + .property_alias = "stp", + .prompt = N_("Enable STP [no]"), + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PRIORITY, + .is_cli_option = TRUE, + .property_alias = "priority", + .prompt = N_("STP priority [32768]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_FORWARD_DELAY, + .is_cli_option = TRUE, + .property_alias = "forward-delay", + .prompt = N_("Forward delay [15]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_HELLO_TIME, + .is_cli_option = TRUE, + .property_alias = "hello-time", + .prompt = N_("Hello time [2]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MAX_AGE, + .is_cli_option = TRUE, + .property_alias = "max-age", + .prompt = N_("Max age [20]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_AGEING_TIME, + .is_cli_option = TRUE, + .property_alias = "ageing-time", + .prompt = N_("MAC address ageing time [300]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_GROUP_FORWARD_MASK, + .is_cli_option = TRUE, + .property_alias = "group-forward-mask", + .prompt = N_("Group forward mask [0]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_MULTICAST_SNOOPING, + .is_cli_option = TRUE, + .property_alias = "multicast-snooping", + .prompt = N_("Enable IGMP snooping [no]"), + .property_type = &_pt_gobject_bool, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_BRIDGE_PORT +static const NMMetaPropertyInfo *const property_infos_BRIDGE_PORT[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_PRIORITY, + .is_cli_option = TRUE, + .property_alias = "priority", + .prompt = N_("Bridge port priority [32]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_PATH_COST, + .is_cli_option = TRUE, + .property_alias = "path-cost", + .prompt = N_("Bridge port STP path cost [100]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE, + .is_cli_option = TRUE, + .property_alias = "hairpin", + .prompt = N_("Hairpin [no]"), + .property_type = &_pt_gobject_bool, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_CDMA +static const NMMetaPropertyInfo *const property_infos_CDMA[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_NUMBER, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_USERNAME, + .is_cli_option = TRUE, + .property_alias = "user", + .prompt = N_("Username [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_PASSWORD, + .is_cli_option = TRUE, + .property_alias = "password", + .prompt = N_("Password [none]"), + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CDMA_MTU, + .property_type = &_pt_gobject_mtu, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu, + .get_fcn = MTU_GET_FCN (NMSettingCdma, nm_setting_cdma_get_mtu), + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_CONNECTION +static const NMMetaPropertyInfo *const property_infos_CONNECTION[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_ID, + .is_cli_option = TRUE, + .property_alias = "con-name", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_UUID, + .property_type = DEFINE_PROPERTY_TYPE ( .get_fcn = _get_fcn_gobject ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_STABLE_ID, + .property_type = &_pt_gobject_string, + ), +[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE] = + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_TYPE, + .is_cli_option = TRUE, + .property_alias = "type", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_CON_TYPE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_connection_type, + .complete_fcn = _complete_fcn_connection_type, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_INTERFACE_NAME, + .is_cli_option = TRUE, + .property_alias = "ifname", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_IFNAME, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gobject_ifname, + .complete_fcn = _complete_fcn_gobject_devices, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT, + .is_cli_option = TRUE, + .property_alias = "autoconnect", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, + .property_type = &_pt_gobject_int, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, + .value_infos = INT_VALUE_INFOS ( + { + .value = -1, + .nick = "default", + }, + { + .value = 0, + .nick = "forever", + } + ), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTH_RETRIES, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_TIMESTAMP, + .property_type = &_pt_gobject_readonly, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_READ_ONLY, + .property_type = &_pt_gobject_readonly, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_PERMISSIONS, + .describe_message = + N_("Enter a list of user permissions. This is a list of user names formatted as:\n" + " [user:]<user name 1>, [user:]<user name 2>,...\n" + "The items can be separated by commas or spaces.\n\n" + "Example: alice bob charlie\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_connection_permissions, + .set_fcn = _set_fcn_connection_permissions, + .remove_fcn = _remove_fcn_connection_permissions, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_ZONE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_MASTER, + .is_cli_option = TRUE, + .property_alias = "master", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .prompt = NM_META_TEXT_PROMPT_MASTER, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_connection_master, + .complete_fcn = _complete_fcn_connection_master, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_SLAVE_TYPE, + .is_cli_option = TRUE, + .property_alias = "slave-type", + .inf_flags = NM_META_PROPERTY_INF_FLAG_DONT_ASK, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC (NM_SETTING_BOND_SETTING_NAME, + NM_SETTING_BRIDGE_SETTING_NAME, + NM_SETTING_OVS_BRIDGE_SETTING_NAME, + NM_SETTING_OVS_PORT_SETTING_NAME, + NM_SETTING_TEAM_SETTING_NAME), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES, + .property_type = &_pt_gobject_enum, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_SECONDARIES, + .describe_message = + N_("Enter secondary connections that should be activated when this connection is\n" + "activated. Connections can be specified either by UUID or ID (name). nmcli\n" + "transparently translates names to UUIDs. Note that NetworkManager only supports\n" + "VPNs as secondary connections at the moment.\n" + "The items can be separated by commas or spaces.\n\n" + "Example: private-openvpn, fe6ba5d8-c2fc-4aae-b2e3-97efddd8d9a7\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_connection_secondaries, + .remove_fcn = _remove_fcn_connection_secondaries, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_METERED, + .describe_message = + N_("Enter a value which indicates whether the connection is subject to a data\n" + "quota, usage costs or other limitations. Accepted options are:\n" + "'true','yes','on' to set the connection as metered\n" + "'false','no','off' to set the connection as not metered\n" + "'unknown' to let NetworkManager choose a value using some heuristics\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_connection_metered, + .set_fcn = _set_fcn_connection_metered, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("yes", "no", "unknown"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_CONNECTION_LLDP, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_connection_lldp_get_type, + .value_infos = ENUM_VALUE_INFOS ( + { + .value = NM_SETTING_CONNECTION_LLDP_ENABLE_RX, + .nick = "enable", + } + ), + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_DCB +static const NMMetaPropertyInfo *const property_infos_DCB[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_FLAGS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_app_fcoe_flags, + .set_fcn = _set_fcn_dcb_flags, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_PRIORITY, + DEFINE_DCB_PROPRITY_PROPERTY_TYPE + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FCOE_MODE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC (NM_SETTING_DCB_FCOE_MODE_FABRIC, + NM_SETTING_DCB_FCOE_MODE_VN2VN), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_ISCSI_FLAGS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_app_iscsi_flags, + .set_fcn = _set_fcn_dcb_flags, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_ISCSI_PRIORITY, + DEFINE_DCB_PROPRITY_PROPERTY_TYPE + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FIP_FLAGS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_app_fip_flags, + .set_fcn = _set_fcn_dcb_flags, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_APP_FIP_PRIORITY, + DEFINE_DCB_PROPRITY_PROPERTY_TYPE + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_flow_control_flags, + .set_fcn = _set_fcn_dcb_flags, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_FLOW_CONTROL, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_flow_control, + .set_fcn = _set_fcn_dcb_priority_flow_control, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_GROUP_FLAGS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_group_flags, + .set_fcn = _set_fcn_dcb_flags, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_GROUP_ID, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_group_id, + .set_fcn = _set_fcn_dcb_priority_group_id, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_group_bandwidth, + .set_fcn = _set_fcn_dcb_priority_group_bandwidth, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_BANDWIDTH, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_bandwidth, + .set_fcn = _set_fcn_dcb_priority_bandwidth, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_strict, + .set_fcn = _set_fcn_dcb_priority_strict, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_dcb_priority_traffic_class, + .set_fcn = _set_fcn_dcb_priority_traffic_class, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_GSM +static const NMMetaPropertyInfo *const property_infos_GSM[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_NUMBER, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_USERNAME, + .is_cli_option = TRUE, + .property_alias = "user", + .prompt = N_("Username [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PASSWORD, + .is_cli_option = TRUE, + .property_alias = "password", + .prompt = N_("Password [none]"), + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_APN, + .is_cli_option = TRUE, + .property_alias = "apn", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("APN"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_NETWORK_ID, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PIN, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_PIN_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_HOME_ONLY, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_DEVICE_ID, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_SIM_ID, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_SIM_OPERATOR_ID, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gsm_sim_operator_id, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_GSM_MTU, + .property_type = &_pt_gobject_mtu, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu, + .get_fcn = MTU_GET_FCN (NMSettingGsm, nm_setting_gsm_get_mtu), + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_INFINIBAND +static const NMMetaPropertyInfo *const property_infos_INFINIBAND[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_MAC_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "mac", + .prompt = N_("MAC [none]"), + .property_type = &_pt_gobject_mac, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac, + .mode = NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_MTU, + .is_cli_option = TRUE, + .property_alias = "mtu", + .prompt = N_("MTU [auto]"), + .property_type = &_pt_gobject_mtu, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu, + .get_fcn = MTU_GET_FCN (NMSettingInfiniband, nm_setting_infiniband_get_mtu), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_TRANSPORT_MODE, + .is_cli_option = TRUE, + .property_alias = "transport-mode", + .prompt = NM_META_TEXT_PROMPT_IB_MODE, + .def_hint = NM_META_TEXT_PROMPT_IB_MODE_CHOICES, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("datagram", "connected"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_P_KEY, + .is_cli_option = TRUE, + .property_alias = "p-key", + .prompt = N_("P_KEY [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_infiniband_p_key, + .set_fcn = _set_fcn_infiniband_p_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_INFINIBAND_PARENT, + .is_cli_option = TRUE, + .property_alias = "parent", + .prompt = N_("Parent interface [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_gobject_ifname, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_IP4_CONFIG +static const NMMetaPropertyInfo *const property_infos_IP4_CONFIG[] = { + PROPERTY_INFO (NM_SETTING_IP_CONFIG_METHOD, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip4_config_method, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = ipv4_valid_methods, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS, + .describe_message = + N_("Enter a list of IPv4 addresses of DNS servers.\n\n" + "Example: 8.8.8.8, 8.8.4.4\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip4_config_dns, + .remove_fcn = _remove_fcn_ipv4_config_dns, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_SEARCH, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_SEARCH, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip4_config_dns_search, + .remove_fcn = _remove_fcn_ipv4_config_dns_search, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_OPTIONS, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_OPTIONS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_nmc_with_default, + .set_fcn = _set_fcn_ip4_config_dns_options, + .remove_fcn = _remove_fcn_ipv4_config_dns_options, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (get_with_default, + .fcn = GET_FCN_WITH_DEFAULT (NMSettingIPConfig, nm_setting_ip_config_has_dns_options), + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_PRIORITY, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_PRIORITY, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ADDRESSES, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES, + .is_cli_option = TRUE, + .property_alias = "ip4", + .inf_flags = NM_META_PROPERTY_INF_FLAG_MULTI, + .prompt = N_("IPv4 address (IP[/plen]) [none]"), + .describe_message = + N_("Enter a list of IPv4 addresses formatted as:\n" + " ip[/prefix], ip[/prefix],...\n" + "Missing prefix is regarded as prefix of 32.\n\n" + "Example: 192.168.1.5/24, 10.0.0.11/24\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_ip_config_addresses, + .set_fcn = _set_fcn_ip4_config_addresses, + .remove_fcn = _remove_fcn_ipv4_config_addresses, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY, + .is_cli_option = TRUE, + .property_alias = "gw4", + .prompt = N_("IPv4 gateway [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip4_config_gateway, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTES, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES, + .describe_message = + N_("Enter a list of IPv4 routes formatted as:\n" + " ip[/prefix] [next-hop] [metric],...\n\n" + "Missing prefix is regarded as a prefix of 32.\n" + "Missing next-hop is regarded as 0.0.0.0.\n" + "Missing metric means default (NM/kernel will set a default value).\n\n" + "Examples: 192.168.2.0/24 192.168.2.1 3, 10.1.0.0/16 10.0.0.254\n" + " 10.1.2.0/24\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_ip_config_routes, + .set_fcn = _set_fcn_ip4_config_routes, + .remove_fcn = _remove_fcn_ipv4_config_routes, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_TABLE, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE, + .property_type = &_pt_gobject_int, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, + .value_infos = INT_VALUE_INFOS ( + { + .value = 0, + .nick = "unspec", + }, + { + .value = 254, + .nick = "main", + } + ), + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT, + .property_type = &_pt_gobject_int, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, + .value_infos = INT_VALUE_INFOS ( + { + .value = 0, + .nick = "default", + }, + { + .value = G_MAXINT32, + .nick = "infinity", + } + ), + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP4_CONFIG_DHCP_FQDN, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_MAY_FAIL, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DAD_TIMEOUT, DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT, + .property_type = &_pt_gobject_int, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, + .value_infos = INT_VALUE_INFOS ( + { + .value = -1, + .nick = "default", + }, + { + .value = 0, + .nick = "off", + } + ), + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_IP6_CONFIG +static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = { + PROPERTY_INFO (NM_SETTING_IP_CONFIG_METHOD, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_METHOD, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip6_config_method, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = ipv6_valid_methods, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS, + .describe_message = + N_("Enter a list of IPv6 addresses of DNS servers. If the IPv6 " + "configuration method is 'auto' these DNS servers are appended " + "to those (if any) returned by automatic configuration. DNS " + "servers cannot be used with the 'shared' or 'link-local' IPv6 " + "configuration methods, as there is no upstream network. In " + "all other IPv6 configuration methods, these DNS " + "servers are used as the only DNS servers for this connection.\n\n" + "Example: 2607:f0d0:1002:51::4, 2607:f0d0:1002:51::1\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip6_config_dns, + .remove_fcn = _remove_fcn_ipv6_config_dns, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_SEARCH, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_SEARCH, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip6_config_dns_search, + .remove_fcn = _remove_fcn_ipv6_config_dns_search, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_OPTIONS, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_OPTIONS, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_nmc_with_default, + .set_fcn = _set_fcn_ip6_config_dns_options, + .remove_fcn = _remove_fcn_ipv6_config_dns_options, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (get_with_default, + .fcn = GET_FCN_WITH_DEFAULT (NMSettingIPConfig, nm_setting_ip_config_has_dns_options), + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DNS_PRIORITY, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_PRIORITY, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ADDRESSES, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES, + .is_cli_option = TRUE, + .property_alias = "ip6", + .inf_flags = NM_META_PROPERTY_INF_FLAG_MULTI, + .prompt = N_("IPv6 address (IP[/plen]) [none]"), + .describe_message = + N_("Enter a list of IPv6 addresses formatted as:\n" + " ip[/prefix], ip[/prefix],...\n" + "Missing prefix is regarded as prefix of 128.\n\n" + "Example: 2607:f0d0:1002:51::4/64, 1050:0:0:0:5:600:300c:326b\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_ip_config_addresses, + .set_fcn = _set_fcn_ip6_config_addresses, + .remove_fcn = _remove_fcn_ipv6_config_addresses, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_GATEWAY, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY, + .is_cli_option = TRUE, + .property_alias = "gw6", + .prompt = N_("IPv6 gateway [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_ip6_config_gateway, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTES, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTES, + .describe_message = + N_("Enter a list of IPv6 routes formatted as:\n" + " ip[/prefix] [next-hop] [metric],...\n\n" + "Missing prefix is regarded as a prefix of 128.\n" + "Missing next-hop is regarded as \"::\".\n" + "Missing metric means default (NM/kernel will set a default value).\n\n" + "Examples: 2001:db8:beef:2::/64 2001:db8:beef::2, 2001:db8:beef:3::/64 2001:db8:beef::3 2\n" + " abbe::/64 55\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_ip_config_routes, + .set_fcn = _set_fcn_ip6_config_routes, + .remove_fcn = _remove_fcn_ipv6_config_routes, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_METRIC, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_ROUTE_TABLE, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_TABLE, + .property_type = &_pt_gobject_int, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, + .value_infos = INT_VALUE_INFOS ( + { + .value = 0, + .nick = "unspec", + }, + { + .value = 254, + .nick = "main", + } + ), + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_NEVER_DEFAULT, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_MAY_FAIL, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MAY_FAIL, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP6_CONFIG_IP6_PRIVACY, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_ip6_config_ip6_privacy, + .set_fcn = _set_fcn_ip6_config_ip6_privacy, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_ip6_config_addr_gen_mode_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO (NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP6_CONFIG_TOKEN, + .property_type = &_pt_gobject_string, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_IP_TUNNEL +static const NMMetaPropertyInfo *const property_infos_IP_TUNNEL[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_MODE, + .is_cli_option = TRUE, + .property_alias = "mode", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_IP_TUNNEL_MODE, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_ip_tunnel_mode_get_type, + .min = NM_IP_TUNNEL_MODE_UNKNOWN + 1, + .max = G_MAXINT, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_PARENT, + .is_cli_option = TRUE, + .property_alias = "dev", + .prompt = N_("Parent device [none]"), + .property_type = &_pt_gobject_devices, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_LOCAL, + .is_cli_option = TRUE, + .property_alias = "local", + .prompt = N_("Local endpoint [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_REMOTE, + .is_cli_option = TRUE, + .property_alias = "remote", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("Remote"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_TTL, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_TOS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_INPUT_KEY, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_OUTPUT_KEY, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_FLOW_LABEL, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_IP_TUNNEL_MTU, + .property_type = &_pt_gobject_mtu, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_MACSEC +static const NMMetaPropertyInfo *const property_infos_MACSEC[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_PARENT, + .is_cli_option = TRUE, + .property_alias = "dev", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("MACsec parent device or connection UUID"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MODE, + .is_cli_option = TRUE, + .property_alias = "mode", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_MACSEC_MODE, + .def_hint = NM_META_TEXT_PROMPT_MACSEC_MODE_CHOICES, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_macsec_mode_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_ENCRYPT, + .is_cli_option = TRUE, + .property_alias = "encrypt", + .prompt = N_("Enable encryption [yes]"), + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MKA_CAK, + .is_cli_option = TRUE, + .property_alias = "cak", + .prompt = N_("MKA CAK"), + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MKA_CAK_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_MKA_CKN, + .is_cli_option = TRUE, + .property_alias = "ckn", + .prompt = N_("MKA_CKN"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_PORT, + .is_cli_option = TRUE, + .property_alias = "port", + .prompt = N_("SCI port [1]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACSEC_VALIDATION, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_macsec_validation_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_MACVLAN +static const NMMetaPropertyInfo *const property_infos_MACVLAN[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_PARENT, + .is_cli_option = TRUE, + .property_alias = "dev", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("MACVLAN parent device or connection UUID"), + .property_type = &_pt_gobject_devices, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_MODE, + .is_cli_option = TRUE, + .property_alias = "mode", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_MACVLAN_MODE, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_macvlan_mode_get_type, + .min = NM_SETTING_MACVLAN_MODE_UNKNOWN + 1, + .max = G_MAXINT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_PROMISCUOUS, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_MACVLAN_TAP, + .is_cli_option = TRUE, + .property_alias = "tap", + .prompt = N_("Tap [no]"), + .property_type = &_pt_gobject_bool, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OLPC_MESH +static const NMMetaPropertyInfo *const property_infos_OLPC_MESH[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_SSID, + .is_cli_option = TRUE, + .property_alias = "ssid", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("SSID"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_olpc_mesh_ssid, + .set_fcn = _set_fcn_gobject_ssid, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_CHANNEL, + .is_cli_option = TRUE, + .property_alias = "channel", + .prompt = N_("OLPC Mesh channel [1]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_olpc_mesh_channel, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "dhcp-anycast", + .prompt = N_("DHCP anycast MAC address [none]"), + .property_type = &_pt_gobject_mac, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPPOE +static const NMMetaPropertyInfo *const property_infos_PPPOE[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PARENT, + .is_cli_option = TRUE, + .property_alias = "parent", + .prompt = N_("PPPoE parent device"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_SERVICE, + .is_cli_option = TRUE, + .property_alias = "service", + .prompt = N_("Service [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_USERNAME, + .is_cli_option = TRUE, + .property_alias = "username", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("PPPoE username"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD, + .is_cli_option = TRUE, + .property_alias = "password", + .prompt = N_("Password [none]"), + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPPOE_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_BRIDGE +static const NMMetaPropertyInfo *const property_infos_OVS_BRIDGE[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_FAIL_MODE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("secure", "standalone"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_RSTP_ENABLE, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_BRIDGE_STP_ENABLE, + .property_type = &_pt_gobject_bool, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_INTERFACE +static const NMMetaPropertyInfo *const property_infos_OVS_INTERFACE[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_INTERFACE_TYPE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("internal", "patch"), + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_PATCH +static const NMMetaPropertyInfo *const property_infos_OVS_PATCH[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PATCH_PEER, + .property_type = &_pt_gobject_string, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_OVS_PORT +static const NMMetaPropertyInfo *const property_infos_OVS_PORT[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_VLAN_MODE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("access", "native-tagged", "native-untagged", "trunk"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_TAG, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_LACP, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("active", "off", "passive"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_MODE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("active-backup", "balance-slb", "balance-tcp"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_UPDELAY, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_OVS_PORT_BOND_DOWNDELAY, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PPP +static const NMMetaPropertyInfo *const property_infos_PPP[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NOAUTH, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_EAP, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_PAP, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_CHAP, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_MSCHAP, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REFUSE_MSCHAPV2, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NOBSDCOMP, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NODEFLATE, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_NO_VJ_COMP, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REQUIRE_MPPE, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_REQUIRE_MPPE_128, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_MPPE_STATEFUL, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_CRTSCTS, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_BAUD, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_MRU, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_MTU, + .property_type = &_pt_gobject_mtu, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu, + .get_fcn = MTU_GET_FCN (NMSettingPpp, nm_setting_ppp_get_mtu), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_LCP_ECHO_FAILURE, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PPP_LCP_ECHO_INTERVAL, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_PROXY +static const NMMetaPropertyInfo *const property_infos_PROXY[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_METHOD, + .is_cli_option = TRUE, + .property_alias = "method", + .prompt = NM_META_TEXT_PROMPT_PROXY_METHOD, + .def_hint = NM_META_TEXT_PROMPT_PROXY_METHOD_CHOICES, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_proxy_method_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_BROWSER_ONLY, + .is_cli_option = TRUE, + .property_alias = "browser-only", + .prompt = N_("Browser only [no]"), + .property_type = &_pt_gobject_bool + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_PAC_URL, + .is_cli_option = TRUE, + .property_alias = "pac-url", + .prompt = N_("PAC URL"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_PROXY_PAC_SCRIPT, + .is_cli_option = TRUE, + .property_alias = "pac-script", + .prompt = N_("PAC script"), + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string, + .validate_fcn = _validate_fcn_proxy_pac_script, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TEAM +static const NMMetaPropertyInfo *const property_infos_TEAM[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_CONFIG, + .is_cli_option = TRUE, + .property_alias = "config", + .prompt = N_("Team JSON configuration [none]"), + .describe_message = TEAM_DESCRIBE_MESSAGE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string, + .validate_fcn = _validate_fcn_team_config, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TEAM_PORT +static const NMMetaPropertyInfo *const property_infos_TEAM_PORT[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_TEAM_PORT_CONFIG, + .is_cli_option = TRUE, + .property_alias = "config", + .prompt = N_("Team JSON configuration [none]"), + .describe_message = TEAM_DESCRIBE_MESSAGE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string, + .validate_fcn = _validate_fcn_team_config, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_SERIAL +static const NMMetaPropertyInfo *const property_infos_SERIAL[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BAUD, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_BITS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_PARITY, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_serial_parity_get_type, + .value_infos = ENUM_VALUE_INFOS ( + { + .value = NM_SETTING_SERIAL_PARITY_EVEN, + .nick = "E", + }, + { + .value = NM_SETTING_SERIAL_PARITY_EVEN, + .nick = "e", + }, + { + .value = NM_SETTING_SERIAL_PARITY_ODD, + .nick = "O", + }, + { + .value = NM_SETTING_SERIAL_PARITY_ODD, + .nick = "o", + }, + { + .value = NM_SETTING_SERIAL_PARITY_NONE, + .nick = "N", + }, + { + .value = NM_SETTING_SERIAL_PARITY_NONE, + .nick = "n", + } + ), + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_STOPBITS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SERIAL_SEND_DELAY, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_TUN +static const NMMetaPropertyInfo *const property_infos_TUN[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_MODE, + .is_cli_option = TRUE, + .property_alias = "mode", + .prompt = NM_META_TEXT_PROMPT_TUN_MODE, + .def_hint = NM_META_TEXT_PROMPT_TUN_MODE_CHOICES, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_tun_mode_get_type, + .min = NM_SETTING_TUN_MODE_UNKNOWN + 1, + .max = G_MAXINT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_OWNER, + .is_cli_option = TRUE, + .property_alias = "owner", + .prompt = N_("User ID [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_GROUP, + .is_cli_option = TRUE, + .property_alias = "group", + .prompt = N_("Group ID [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_PI, + .is_cli_option = TRUE, + .property_alias = "pi", + .prompt = N_("Enable PI [no]"), + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_VNET_HDR, + .is_cli_option = TRUE, + .property_alias = "vnet-hdr", + .prompt = N_("Enable VNET header [no]"), + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_TUN_MULTI_QUEUE, + .is_cli_option = TRUE, + .property_alias = "multi-queue", + .prompt = N_("Enable multi queue [no]"), + .property_type = &_pt_gobject_bool, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VLAN +static const NMMetaPropertyInfo *const property_infos_VLAN[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_PARENT, + .is_cli_option = TRUE, + .property_alias = "dev", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("VLAN parent device or connection UUID"), + .property_type = &_pt_gobject_devices, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_ID, + .is_cli_option = TRUE, + .property_alias = "id", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("VLAN ID (<0-4094>)"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_FLAGS, + .is_cli_option = TRUE, + .property_alias = "flags", + .prompt = N_("VLAN flags (<0-7>) [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_vlan_flags, + .set_fcn = _set_fcn_gobject_flags, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP, + .is_cli_option = TRUE, + .property_alias = "ingress", + .prompt = N_("Ingress priority maps [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_vlan_ingress_priority_map, + .set_fcn = _set_fcn_vlan_ingress_priority_map, + .remove_fcn = _remove_fcn_vlan_ingress_priority_map, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP, + .is_cli_option = TRUE, + .property_alias = "egress", + .prompt = N_("Egress priority maps [none]"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_vlan_egress_priority_map, + .set_fcn = _set_fcn_vlan_egress_priority_map, + .remove_fcn = _remove_fcn_vlan_egress_priority_map, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VPN +static const NMMetaPropertyInfo *const property_infos_VPN[] = { +[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE] = + PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_SERVICE_TYPE, + .is_cli_option = TRUE, + .property_alias = "vpn-type", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = NM_META_TEXT_PROMPT_VPN_TYPE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_vpn_service_type, + .complete_fcn = _complete_fcn_vpn_service_type, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_USER_NAME, + .is_cli_option = TRUE, + .property_alias = "user", + .prompt = N_("Username [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_DATA, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_vpn_data, + .set_fcn = _set_fcn_vpn_data, + .remove_fcn = _remove_fcn_vpn_data, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_SECRETS, + .is_secret = TRUE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_vpn_secrets, + .set_fcn = _set_fcn_vpn_secrets, + .remove_fcn = _remove_fcn_vpn_secrets, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_PERSISTENT, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_TIMEOUT, + .property_type = &_pt_gobject_int, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_VXLAN +static const NMMetaPropertyInfo *const property_infos_VXLAN[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_PARENT, + .is_cli_option = TRUE, + .property_alias = "dev", + .prompt = N_("Parent device [none]"), + .property_type = &_pt_gobject_devices, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_ID, + .is_cli_option = TRUE, + .property_alias = "id", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("VXLAN ID"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_LOCAL, + .is_cli_option = TRUE, + .property_alias = "local", + .prompt = N_("Local address [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_REMOTE, + .is_cli_option = TRUE, + .property_alias = "remote", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("Remote"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_SOURCE_PORT_MIN, + .is_cli_option = TRUE, + .property_alias = "source-port-min", + .prompt = N_("Minimum source port [0]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_SOURCE_PORT_MAX, + .is_cli_option = TRUE, + .property_alias = "source-port-max", + .prompt = N_("Maximum source port [0]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_DESTINATION_PORT, + .is_cli_option = TRUE, + .property_alias = "destination-port", + .prompt = N_("Destination port [8472]"), + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_TOS, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_TTL, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_AGEING, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_LIMIT, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_LEARNING, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_PROXY, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_RSC, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_L2_MISS, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_VXLAN_L3_MISS, + .property_type = &_pt_gobject_bool, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIMAX +static const NMMetaPropertyInfo *const property_infos_WIMAX[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIMAX_MAC_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "mac", + .prompt = N_("MAC [none]"), + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIMAX_NETWORK_NAME, + .is_cli_option = TRUE, + .property_alias = "nsp", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("WiMAX NSP name"), + .property_type = &_pt_gobject_mac, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIRED +static const NMMetaPropertyInfo *const property_infos_WIRED[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_PORT, + /* Do not allow setting 'port' for now. It is not implemented in + * NM core, nor in ifcfg-rh plugin. Enable this when it gets done. + * wired_valid_ports[] = { "tp", "aui", "bnc", "mii", NULL }; + */ + .property_type = &_pt_gobject_readonly, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_SPEED, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_DUPLEX, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("half", "full"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_AUTO_NEGOTIATE, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_MAC_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "mac", + .prompt = N_("MAC [none]"), + .property_type = &_pt_gobject_mac, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_CLONED_MAC_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "cloned-mac", + .prompt = N_("Cloned MAC [none]"), + .property_type = &_pt_gobject_mac, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac, + .mode = NM_META_PROPERTY_TYPE_MAC_MODE_CLONED, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wired_mac_address_blacklist, + .remove_fcn = _remove_fcn_wired_mac_address_blacklist, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_MTU, + .is_cli_option = TRUE, + .property_alias = "mtu", + .prompt = N_("MTU [auto]"), + .property_type = &_pt_gobject_mtu, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu, + .get_fcn = MTU_GET_FCN (NMSettingWired, nm_setting_wired_get_mtu), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_SUBCHANNELS, + .describe_message = + N_("Enter a list of subchannels (comma or space separated).\n\n" + "Example: 0.0.0e20 0.0.0e21 0.0.0e22\n"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wired_s390_subchannels, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_NETTYPE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("qeth", "lcs", "ctc"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_S390_OPTIONS, + .property_type = DEFINE_PROPERTY_TYPE ( + .describe_fcn = _describe_fcn_wired_s390_options, + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wired_s390_options, + .remove_fcn = _remove_fcn_wired_s390_options, + .values_fcn = _values_fcn__wired_s390_options, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_WAKE_ON_LAN, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_wired_wake_on_lan_get_type, + .value_infos = ENUM_VALUE_INFOS ( + { + .value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE, + .nick = "none", + }, + { + .value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE, + .nick = "disable", + }, + { + .value = NM_SETTING_WIRED_WAKE_ON_LAN_NONE, + .nick = "disabled", + } + ), + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD, + .property_type = &_pt_gobject_mac, + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIRELESS +static const NMMetaPropertyInfo *const property_infos_WIRELESS[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SSID, + .is_cli_option = TRUE, + .property_alias = "ssid", + .inf_flags = NM_META_PROPERTY_INF_FLAG_REQD, + .prompt = N_("SSID"), + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_wireless_ssid, + .set_fcn = _set_fcn_gobject_ssid, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MODE, + .is_cli_option = TRUE, + .property_alias = "mode", + .prompt = NM_META_TEXT_PROMPT_WIFI_MODE, + .def_hint = NM_META_TEXT_PROMPT_WIFI_MODE_CHOICES, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC (NM_SETTING_WIRELESS_MODE_INFRA, + NM_SETTING_WIRELESS_MODE_ADHOC, + NM_SETTING_WIRELESS_MODE_AP), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_BAND, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("a", "bg"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_CHANNEL, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wireless_channel, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_BSSID, + .property_type = &_pt_gobject_mac, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_RATE, + /* Do not allow setting 'rate'. It is not implemented in NM core. */ + .property_type = &_pt_gobject_readonly, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_TX_POWER, + /* Do not allow setting 'tx-power'. It is not implemented in NM core. */ + .property_type = &_pt_gobject_readonly, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MAC_ADDRESS, + .property_type = &_pt_gobject_mac, + .is_cli_option = TRUE, + .property_alias = "mac", + .prompt = N_("MAC [none]"), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, + .is_cli_option = TRUE, + .property_alias = "cloned-mac", + .prompt = N_("Cloned MAC [none]"), + .property_type = &_pt_gobject_mac, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac, + .mode = NM_META_PROPERTY_TYPE_MAC_MODE_CLONED, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wireless_mac_address_blacklist, + .remove_fcn = _remove_fcn_wireless_mac_address_blacklist, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_mac_randomization_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_MTU, + .is_cli_option = TRUE, + .property_alias = "mtu", + .prompt = N_("MTU [auto]"), + .property_type = &_pt_gobject_mtu, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu, + .get_fcn = MTU_GET_FCN (NMSettingWireless, nm_setting_wireless_get_mtu), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SEEN_BSSIDS, + .property_type = &_pt_gobject_readonly, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_HIDDEN, + .property_type = &_pt_gobject_bool, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_POWERSAVE, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_wireless_powersave_get_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT, + ), + ), + NULL +}; + +#undef _CURRENT_NM_META_SETTING_TYPE +#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WIRELESS_SECURITY +static const NMMetaPropertyInfo *const property_infos_WIRELESS_SECURITY[] = { + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("none", "ieee8021x", "wpa-none", "wpa-psk", "wpa-eap"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, + .property_type = &_pt_gobject_int, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = VALUES_STATIC ("open", "shared", "leap"), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PROTO, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wireless_security_proto, + .remove_fcn = _remove_fcn_wireless_security_proto, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = wifi_sec_valid_protos, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PAIRWISE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wireless_security_pairwise, + .remove_fcn = _remove_fcn_wireless_security_pairwise, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = wifi_sec_valid_pairwises, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_GROUP, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_gobject, + .set_fcn = _set_fcn_wireless_security_group, + .remove_fcn = _remove_fcn_wireless_security_group, + ), + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + .values_static = wifi_sec_valid_groups, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PMF, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_wireless_security_pmf_get_type, + ), + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, + .is_secret = TRUE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_wireless_security_wep_key0, + .set_fcn = _set_fcn_wireless_wep_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, + .is_secret = TRUE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_wireless_security_wep_key1, + .set_fcn = _set_fcn_wireless_wep_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, + .is_secret = TRUE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_wireless_security_wep_key2, + .set_fcn = _set_fcn_wireless_wep_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, + .is_secret = TRUE, + .property_type = DEFINE_PROPERTY_TYPE ( + .get_fcn = _get_fcn_wireless_security_wep_key3, + .set_fcn = _set_fcn_wireless_wep_key, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, + .describe_message = + N_("Enter the type of WEP keys. The accepted values are: " + "0 or unknown, 1 or key, and 2 or passphrase.\n"), + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .pre_set_notify = _gobject_enum_pre_set_notify_fcn_wireless_security_wep_key_type, + ), + .typ_flags = NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT + | NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PSK, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_string, + .validate_fcn = _validate_fcn_wireless_security_psk, + ), + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, + .is_secret = TRUE, + .property_type = &_pt_gobject_string, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS, + .property_type = &_pt_gobject_secret_flags, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_WIRELESS_SECURITY_WPS_METHOD, + .property_type = &_pt_gobject_enum, + .property_typ_data = DEFINE_PROPERTY_TYP_DATA ( + PROPERTY_TYP_DATA_SUBTYPE (gobject_enum, + .get_gtype = nm_setting_wireless_security_wps_method_get_type, + ), + ), + ), + NULL +}; + +/*****************************************************************************/ + +static void +_setting_init_fcn_adsl (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + /* Initialize a protocol */ + g_object_set (NM_SETTING_ADSL (setting), + NM_SETTING_ADSL_PROTOCOL, NM_SETTING_ADSL_PROTOCOL_PPPOE, + NULL); + } +} + +static void +_setting_init_fcn_cdma (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + /* Initialize 'number' so that 'cdma' is valid */ + g_object_set (NM_SETTING_CDMA (setting), + NM_SETTING_CDMA_NUMBER, "#777", + NULL); + } +} + +static void +_setting_init_fcn_gsm (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + /* Initialize 'number' so that 'gsm' is valid */ + g_object_set (NM_SETTING_GSM (setting), + NM_SETTING_GSM_NUMBER, "*99#", + NULL); + } +} + +static void +_setting_init_fcn_infiniband (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + /* Initialize 'transport-mode' so that 'infiniband' is valid */ + g_object_set (NM_SETTING_INFINIBAND (setting), + NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", + NULL); + } +} + +static void +_setting_init_fcn_ip4_config (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + g_object_set (NM_SETTING_IP_CONFIG (setting), + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, + NULL); + } +} + +static void +_setting_init_fcn_ip6_config (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + g_object_set (NM_SETTING_IP_CONFIG (setting), + NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO, + NULL); + } +} + +static void +_setting_init_fcn_olpc_mesh (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + g_object_set (NM_SETTING_OLPC_MESH (setting), + NM_SETTING_OLPC_MESH_CHANNEL, 1, + NULL); + } +} + +static void +_setting_init_fcn_proxy (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + g_object_set (NM_SETTING_PROXY (setting), + NM_SETTING_PROXY_METHOD, (int) NM_SETTING_PROXY_METHOD_NONE, + NULL); + } +} + +static void +_setting_init_fcn_tun (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + g_object_set (NM_SETTING_TUN (setting), + NM_SETTING_TUN_MODE, NM_SETTING_TUN_MODE_TUN, + NULL); + } +} + +static void +_setting_init_fcn_vlan (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + g_object_set (setting, + NM_SETTING_VLAN_ID, 1, + NULL); + } +} + +static void +_setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN) +{ + if (init_type == NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI) { + /* For Wi-Fi set mode to "infrastructure". Even though mode == NULL + * is regarded as "infrastructure", explicit value makes no doubts. + */ + g_object_set (NM_SETTING_WIRELESS (setting), + NM_SETTING_WIRELESS_MODE, NM_SETTING_WIRELESS_MODE_INFRA, + NULL); + } +} + +/*****************************************************************************/ + +#define SETTING_PRETTY_NAME_802_1X N_("802-1x settings") +#define SETTING_PRETTY_NAME_ADSL N_("ADSL connection") +#define SETTING_PRETTY_NAME_BLUETOOTH N_("bluetooth connection") +#define SETTING_PRETTY_NAME_BOND N_("Bond device") +#define SETTING_PRETTY_NAME_BRIDGE N_("Bridge device") +#define SETTING_PRETTY_NAME_BRIDGE_PORT N_("Bridge port") +#define SETTING_PRETTY_NAME_CDMA N_("CDMA mobile broadband connection") +#define SETTING_PRETTY_NAME_CONNECTION N_("General settings") +#define SETTING_PRETTY_NAME_DCB N_("DCB settings") +#define SETTING_PRETTY_NAME_DUMMY N_("Dummy settings") +#define SETTING_PRETTY_NAME_GENERIC N_("Generic settings") +#define SETTING_PRETTY_NAME_GSM N_("GSM mobile broadband connection") +#define SETTING_PRETTY_NAME_INFINIBAND N_("InfiniBand connection") +#define SETTING_PRETTY_NAME_IP4_CONFIG N_("IPv4 protocol") +#define SETTING_PRETTY_NAME_IP6_CONFIG N_("IPv6 protocol") +#define SETTING_PRETTY_NAME_IP_TUNNEL N_("IP-tunnel settings") +#define SETTING_PRETTY_NAME_MACSEC N_("MACsec connection") +#define SETTING_PRETTY_NAME_MACVLAN N_("macvlan connection") +#define SETTING_PRETTY_NAME_OLPC_MESH N_("OLPC Mesh connection") +#define SETTING_PRETTY_NAME_OVS_BRIDGE N_("OpenVSwitch bridge settings") +#define SETTING_PRETTY_NAME_OVS_INTERFACE N_("OpenVSwitch interface settings") +#define SETTING_PRETTY_NAME_OVS_PATCH N_("OpenVSwitch patch interface settings") +#define SETTING_PRETTY_NAME_OVS_PORT N_("OpenVSwitch port settings") +#define SETTING_PRETTY_NAME_PPP N_("PPP settings") +#define SETTING_PRETTY_NAME_PPPOE N_("PPPoE") +#define SETTING_PRETTY_NAME_PROXY N_("Proxy") +#define SETTING_PRETTY_NAME_SERIAL N_("Serial settings") +#define SETTING_PRETTY_NAME_TEAM N_("Team device") +#define SETTING_PRETTY_NAME_TEAM_PORT N_("Team port") +#define SETTING_PRETTY_NAME_TUN N_("Tun device") +#define SETTING_PRETTY_NAME_USER N_("User settings") +#define SETTING_PRETTY_NAME_VLAN N_("VLAN connection") +#define SETTING_PRETTY_NAME_VPN N_("VPN connection") +#define SETTING_PRETTY_NAME_VXLAN N_("VXLAN connection") +#define SETTING_PRETTY_NAME_WIMAX N_("WiMAX connection") +#define SETTING_PRETTY_NAME_WIRED N_("Wired Ethernet") +#define SETTING_PRETTY_NAME_WIRELESS N_("Wi-Fi connection") +#define SETTING_PRETTY_NAME_WIRELESS_SECURITY N_("Wi-Fi security settings") + +#define NM_META_SETTING_VALID_PARTS(...) \ + ((const NMMetaSettingValidPartItem *const[]) { __VA_ARGS__ NULL }) + +#define NM_META_SETTING_VALID_PART_ITEM(type, mand) \ + (&((const NMMetaSettingValidPartItem) { \ + .setting_info = &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_##type], \ + .mandatory = mand, \ + })) + +const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = { +#define SETTING_INFO_EMPTY(type, ...) \ + [NM_META_SETTING_TYPE_##type] = { \ + .meta_type = &nm_meta_type_setting_info_editor, \ + .general = &nm_meta_setting_infos[NM_META_SETTING_TYPE_##type], \ + .pretty_name = SETTING_PRETTY_NAME_##type, \ + __VA_ARGS__ \ + } +#define SETTING_INFO(type, ...) \ + [NM_META_SETTING_TYPE_##type] = { \ + .meta_type = &nm_meta_type_setting_info_editor, \ + .general = &nm_meta_setting_infos[NM_META_SETTING_TYPE_##type], \ + .properties = property_infos_##type, \ + .properties_num = G_N_ELEMENTS (property_infos_##type) - 1, \ + .pretty_name = SETTING_PRETTY_NAME_##type, \ + __VA_ARGS__ \ + } + SETTING_INFO (802_1X), + SETTING_INFO (ADSL, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (ADSL, TRUE), + ), + .setting_init_fcn = _setting_init_fcn_adsl, + ), + SETTING_INFO (BLUETOOTH, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (BLUETOOTH, TRUE), + NM_META_SETTING_VALID_PART_ITEM (BRIDGE, FALSE), + NM_META_SETTING_VALID_PART_ITEM (GSM, FALSE), + NM_META_SETTING_VALID_PART_ITEM (CDMA, FALSE), + ), + ), + SETTING_INFO (BOND, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (BOND, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO (BRIDGE, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (BRIDGE, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO (BRIDGE_PORT), + SETTING_INFO (CDMA, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (CDMA, TRUE), + NM_META_SETTING_VALID_PART_ITEM (SERIAL, FALSE), + NM_META_SETTING_VALID_PART_ITEM (PPP, FALSE), + ), + .setting_init_fcn = _setting_init_fcn_cdma, + ), + SETTING_INFO (CONNECTION), + SETTING_INFO (DCB), + SETTING_INFO_EMPTY (DUMMY, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (DUMMY, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO_EMPTY (GENERIC, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (GENERIC, TRUE), + ), + ), + SETTING_INFO (GSM, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (GSM, TRUE), + NM_META_SETTING_VALID_PART_ITEM (SERIAL, FALSE), + NM_META_SETTING_VALID_PART_ITEM (PPP, FALSE), + ), + .setting_init_fcn = _setting_init_fcn_gsm, + ), + SETTING_INFO (INFINIBAND, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (INFINIBAND, TRUE), + ), + .setting_init_fcn = _setting_init_fcn_infiniband, + ), + SETTING_INFO (IP4_CONFIG, + .setting_init_fcn = _setting_init_fcn_ip4_config, + ), + SETTING_INFO (IP6_CONFIG, + .setting_init_fcn = _setting_init_fcn_ip6_config, + ), + SETTING_INFO (IP_TUNNEL, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (IP_TUNNEL, TRUE), + ), + ), + SETTING_INFO (MACSEC, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (MACSEC, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE), + ), + ), + SETTING_INFO (MACVLAN, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (MACVLAN, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO (OLPC_MESH, + .alias = "olpc-mesh", + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (OLPC_MESH, TRUE), + ), + .setting_init_fcn = _setting_init_fcn_olpc_mesh, + ), + SETTING_INFO (OVS_BRIDGE, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (OVS_BRIDGE, TRUE), + ), + ), + SETTING_INFO (OVS_INTERFACE, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (OVS_INTERFACE, TRUE), + NM_META_SETTING_VALID_PART_ITEM (OVS_PATCH, FALSE), + NM_META_SETTING_VALID_PART_ITEM (IP4_CONFIG, FALSE), + NM_META_SETTING_VALID_PART_ITEM (IP6_CONFIG, FALSE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO (OVS_PATCH), + SETTING_INFO (OVS_PORT, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (OVS_PORT, TRUE), + ), + ), + SETTING_INFO (PPPOE, + /* PPPoE is a base connection type from historical reasons. + * See libnm-core/nm-setting.c:_nm_setting_is_base_type() + */ + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (PPPOE, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, TRUE), + NM_META_SETTING_VALID_PART_ITEM (PPP, FALSE), + NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE), + ), + ), + SETTING_INFO (PPP), + SETTING_INFO (PROXY, + .setting_init_fcn = _setting_init_fcn_proxy, + ), + SETTING_INFO (SERIAL), + SETTING_INFO (TEAM, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (TEAM, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO (TEAM_PORT), + SETTING_INFO (TUN, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (TUN, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + .setting_init_fcn = _setting_init_fcn_tun, + ), + SETTING_INFO_EMPTY (USER), + SETTING_INFO (VLAN, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (VLAN, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + .setting_init_fcn = _setting_init_fcn_vlan, + ), + SETTING_INFO (VPN, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (VPN, TRUE), + ), + ), + SETTING_INFO (VXLAN, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (VXLAN, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE), + ), + ), + SETTING_INFO (WIMAX, + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIMAX, TRUE), + ), + ), + SETTING_INFO (WIRED, + .alias = "ethernet", + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRED, TRUE), + NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE), + NM_META_SETTING_VALID_PART_ITEM (DCB, FALSE), + ), + ), + SETTING_INFO (WIRELESS, + .alias = "wifi", + .valid_parts = NM_META_SETTING_VALID_PARTS ( + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRELESS, TRUE), + NM_META_SETTING_VALID_PART_ITEM (WIRELESS_SECURITY, FALSE), + NM_META_SETTING_VALID_PART_ITEM (802_1X, FALSE), + ), + .setting_init_fcn = _setting_init_fcn_wireless, + ), + SETTING_INFO (WIRELESS_SECURITY, + .alias = "wifi-sec", + ), +}; + +/*****************************************************************************/ + +const NMMetaSettingValidPartItem *const nm_meta_setting_info_valid_parts_default[] = { + NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE), + NULL +}; + +/*****************************************************************************/ + +static const NMMetaSettingValidPartItem *const valid_settings_noslave[] = { + NM_META_SETTING_VALID_PART_ITEM (IP4_CONFIG, FALSE), + NM_META_SETTING_VALID_PART_ITEM (IP6_CONFIG, FALSE), + NM_META_SETTING_VALID_PART_ITEM (PROXY, FALSE), + NULL, +}; + +static const NMMetaSettingValidPartItem *const valid_settings_slave_bridge[] = { + NM_META_SETTING_VALID_PART_ITEM (BRIDGE_PORT, TRUE), + NULL, +}; + +static const NMMetaSettingValidPartItem *const valid_settings_slave_ovs_bridge[] = { + NM_META_SETTING_VALID_PART_ITEM (OVS_PORT, FALSE), + NULL, +}; + +static const NMMetaSettingValidPartItem *const valid_settings_slave_ovs_port[] = { + NM_META_SETTING_VALID_PART_ITEM (OVS_INTERFACE, FALSE), + NULL, +}; + +static const NMMetaSettingValidPartItem *const valid_settings_slave_team[] = { + NM_META_SETTING_VALID_PART_ITEM (TEAM_PORT, TRUE), + NULL, +}; + +const NMMetaSettingValidPartItem *const* +nm_meta_setting_info_valid_parts_for_slave_type (const char *slave_type, const char **out_slave_name) +{ + if (!slave_type) { + NM_SET_OUT (out_slave_name, NULL); + return valid_settings_noslave; + } + if (nm_streq (slave_type, NM_SETTING_BOND_SETTING_NAME)) { + NM_SET_OUT (out_slave_name, "bond-slave"); + return NM_PTRARRAY_EMPTY (const NMMetaSettingValidPartItem *); + } + if (nm_streq (slave_type, NM_SETTING_BRIDGE_SETTING_NAME)) { + NM_SET_OUT (out_slave_name, "bridge-slave"); + return valid_settings_slave_bridge; + } + if (nm_streq (slave_type, NM_SETTING_OVS_BRIDGE_SETTING_NAME)) { + NM_SET_OUT (out_slave_name, "ovs-slave"); + return valid_settings_slave_ovs_bridge; + } + if (nm_streq (slave_type, NM_SETTING_OVS_PORT_SETTING_NAME)) { + NM_SET_OUT (out_slave_name, "ovs-slave"); + return valid_settings_slave_ovs_port; + } + if (nm_streq (slave_type, NM_SETTING_TEAM_SETTING_NAME)) { + NM_SET_OUT (out_slave_name, "team-slave"); + return valid_settings_slave_team; + } + return NULL; +} + +/*****************************************************************************/ + +static const char * +_meta_type_setting_info_editor_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header) +{ + if (for_header) + return N_("name"); + return ((const NMMetaSettingInfoEditor *) abstract_info)->general->setting_name; +} + +static const char * +_meta_type_property_info_get_name (const NMMetaAbstractInfo *abstract_info, gboolean for_header) +{ + return ((const NMMetaPropertyInfo *) abstract_info)->property_name; +} + +static gconstpointer +_meta_type_setting_info_editor_get_fcn (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + gpointer target, + NMMetaAccessorGetType get_type, + NMMetaAccessorGetFlags get_flags, + NMMetaAccessorGetOutFlags *out_flags, + gpointer *out_to_free) +{ + const NMMetaSettingInfoEditor *info = (const NMMetaSettingInfoEditor *) abstract_info; + + nm_assert (!out_to_free || !*out_to_free); + nm_assert (out_flags && !*out_flags); + + if (!NM_IN_SET (get_type, + NM_META_ACCESSOR_GET_TYPE_PARSABLE, + NM_META_ACCESSOR_GET_TYPE_PRETTY)) + return NULL; + + nm_assert (out_to_free); + + return info->general->setting_name; +} + +static gconstpointer +_meta_type_property_info_get_fcn (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + gpointer target, + NMMetaAccessorGetType get_type, + NMMetaAccessorGetFlags get_flags, + NMMetaAccessorGetOutFlags *out_flags, + gpointer *out_to_free) +{ + const NMMetaPropertyInfo *info = (const NMMetaPropertyInfo *) abstract_info; + + nm_assert (!out_to_free || !*out_to_free); + nm_assert (out_flags && !*out_flags); + + if (!NM_IN_SET (get_type, + NM_META_ACCESSOR_GET_TYPE_PARSABLE, + NM_META_ACCESSOR_GET_TYPE_PRETTY)) + return NULL; + + nm_assert (out_to_free); + + if ( info->is_secret + && !NM_FLAGS_HAS (get_flags, NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS)) + return _get_text_hidden (get_type); + + return info->property_type->get_fcn (info, + environment, + environment_user_data, + target, + get_type, + get_flags, + out_flags, + out_to_free); + +} + +static const NMMetaAbstractInfo *const* +_meta_type_setting_info_editor_get_nested (const NMMetaAbstractInfo *abstract_info, + guint *out_len, + gpointer *out_to_free) +{ + const NMMetaSettingInfoEditor *info; + + info = (const NMMetaSettingInfoEditor *) abstract_info; + + NM_SET_OUT (out_len, info->properties_num); + *out_to_free = NULL; + return (const NMMetaAbstractInfo *const*) info->properties; +} + +static const NMMetaAbstractInfo *const* +_meta_type_property_info_get_nested (const NMMetaAbstractInfo *abstract_info, + guint *out_len, + gpointer *out_to_free) +{ + NM_SET_OUT (out_len, 0); + *out_to_free = NULL; + return NULL; +} + +static const char *const* +_meta_type_property_info_complete_fcn (const NMMetaAbstractInfo *abstract_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + const NMMetaOperationContext *operation_context, + const char *text, + char ***out_to_free) +{ + const NMMetaPropertyInfo *info = (const NMMetaPropertyInfo *) abstract_info; + + nm_assert (out_to_free && !*out_to_free); + + if (info->property_type->complete_fcn) { + return info->property_type->complete_fcn (info, + environment, + environment_user_data, + operation_context, + text, + out_to_free); + } + + if (info->property_type->values_fcn) { + return info->property_type->values_fcn (info, + out_to_free); + } + + if ( info->property_typ_data + && info->property_typ_data->values_static) + return info->property_typ_data->values_static; + + return NULL; +} + +const NMMetaType nm_meta_type_setting_info_editor = { + .type_name = "setting_info_editor", + .get_name = _meta_type_setting_info_editor_get_name, + .get_nested = _meta_type_setting_info_editor_get_nested, + .get_fcn = _meta_type_setting_info_editor_get_fcn, +}; + +const NMMetaType nm_meta_type_property_info = { + .type_name = "property_info", + .get_name = _meta_type_property_info_get_name, + .get_nested = _meta_type_property_info_get_nested, + .get_fcn = _meta_type_property_info_get_fcn, + .complete_fcn = _meta_type_property_info_complete_fcn, +}; + +const NMMetaType nm_meta_type_nested_property_info = { + .type_name = "nested_property_info", +}; diff --git a/clients/common/nm-meta-setting-desc.h b/clients/common/nm-meta-setting-desc.h new file mode 100644 index 00000000..e61b1fc4 --- /dev/null +++ b/clients/common/nm-meta-setting-desc.h @@ -0,0 +1,444 @@ +/* nmcli - command-line tool to control NetworkManager + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2010 - 2017 Red Hat, Inc. + */ + +#ifndef __NM_META_SETTING_DESC_H__ +#define __NM_META_SETTING_DESC_H__ + +#include "nm-utils/nm-obj.h" +#include "nm-meta-setting.h" + +struct _NMDevice; + +#define NM_META_TEXT_HIDDEN N_("<hidden>") + +#define NM_META_TEXT_PROMPT_ADSL_PROTO N_("Protocol") +#define NM_META_TEXT_PROMPT_ADSL_PROTO_CHOICES "(" NM_SETTING_ADSL_PROTOCOL_PPPOA "/" NM_SETTING_ADSL_PROTOCOL_PPPOE "/" NM_SETTING_ADSL_PROTOCOL_IPOATM ")" + +#define NM_META_TEXT_PROMPT_ADSL_ENCAP N_("ADSL encapsulation") +#define NM_META_TEXT_PROMPT_ADSL_ENCAP_CHOICES "(" NM_SETTING_ADSL_ENCAPSULATION_VCMUX "/" NM_SETTING_ADSL_ENCAPSULATION_LLC ") [none]" + +#define NM_META_TEXT_PROMPT_CON_TYPE N_("Connection type") +#define NM_META_TEXT_PROMPT_IFNAME N_("Interface name [*]") +#define NM_META_TEXT_PROMPT_VPN_TYPE N_("VPN type") +#define NM_META_TEXT_PROMPT_MASTER N_("Master") + +#define NM_META_TEXT_PROMPT_IB_MODE N_("Transport mode") +#define NM_META_TEXT_WORD_DATAGRAM "datagram" +#define NM_META_TEXT_WORD_CONNECTED "connected" +#define NM_META_TEXT_PROMPT_IB_MODE_CHOICES "(" NM_META_TEXT_WORD_DATAGRAM "/" NM_META_TEXT_WORD_CONNECTED ") [" NM_META_TEXT_WORD_DATAGRAM "]" + +#define NM_META_TEXT_PROMPT_BT_TYPE N_("Bluetooth type") +#define NM_META_TEXT_WORD_PANU "panu" +#define NM_META_TEXT_WORD_NAP "nap" +#define NM_META_TEXT_WORD_DUN_GSM "dun-gsm" +#define NM_META_TEXT_WORD_DUN_CDMA "dun-cdma" +#define NM_META_TEXT_PROMPT_BT_TYPE_CHOICES "(" NM_META_TEXT_WORD_PANU "/" NM_META_TEXT_WORD_NAP "/" NM_META_TEXT_WORD_DUN_GSM "/" NM_META_TEXT_WORD_DUN_CDMA ") [" NM_META_TEXT_WORD_PANU "]" + +#define NM_META_TEXT_PROMPT_BOND_MODE N_("Bonding mode") + +#define NM_META_TEXT_PROMPT_BOND_MON_MODE N_("Bonding monitoring mode") +#define NM_META_TEXT_WORD_MIIMON "miimon" +#define NM_META_TEXT_WORD_ARP "arp" +#define NM_META_TEXT_PROMPT_BOND_MON_MODE_CHOICES "(" NM_META_TEXT_WORD_MIIMON "/" NM_META_TEXT_WORD_ARP ") [" NM_META_TEXT_WORD_MIIMON "]" + +#define NM_META_TEXT_PROMPT_WIFI_MODE N_("Wi-Fi mode") +#define NM_META_TEXT_WORD_INFRA "infrastructure" +#define NM_META_TEXT_WORD_AP "ap" +#define NM_META_TEXT_WORD_ADHOC "adhoc" +#define NM_META_TEXT_PROMPT_WIFI_MODE_CHOICES "(" NM_META_TEXT_WORD_INFRA "/" NM_META_TEXT_WORD_AP "/" NM_META_TEXT_WORD_ADHOC ") [" NM_META_TEXT_WORD_INFRA "]" + +#define NM_META_TEXT_PROMPT_TUN_MODE N_("Tun mode") +#define NM_META_TEXT_WORD_TUN "tun" +#define NM_META_TEXT_WORD_TAP "tap" +#define NM_META_TEXT_PROMPT_TUN_MODE_CHOICES "(" NM_META_TEXT_WORD_TUN "/" NM_META_TEXT_WORD_TAP ") [" NM_META_TEXT_WORD_TUN "]" + +#define NM_META_TEXT_PROMPT_IP_TUNNEL_MODE N_("IP Tunnel mode") + +#define NM_META_TEXT_PROMPT_MACVLAN_MODE N_("MACVLAN mode") + +#define NM_META_TEXT_PROMPT_MACSEC_MODE N_("MACsec mode") +#define NM_META_TEXT_WORD_PSK "psk" +#define NM_META_TEXT_WORD_EAP "eap" +#define NM_META_TEXT_PROMPT_MACSEC_MODE_CHOICES "(" NM_META_TEXT_WORD_PSK "/" NM_META_TEXT_WORD_EAP ")" + +#define NM_META_TEXT_PROMPT_PROXY_METHOD N_("Proxy method") +#define NM_META_TEXT_WORD_NONE "none" +#define NM_META_TEXT_WORD_AUTO "auto" +#define NM_META_TEXT_PROMPT_PROXY_METHOD_CHOICES "(" NM_META_TEXT_WORD_NONE "/" NM_META_TEXT_WORD_AUTO ") [" NM_META_TEXT_WORD_NONE "]" + +typedef enum { + NM_META_TERM_COLOR_NORMAL = 0, + NM_META_TERM_COLOR_BLACK = 1, + NM_META_TERM_COLOR_RED = 2, + NM_META_TERM_COLOR_GREEN = 3, + NM_META_TERM_COLOR_YELLOW = 4, + NM_META_TERM_COLOR_BLUE = 5, + NM_META_TERM_COLOR_MAGENTA = 6, + NM_META_TERM_COLOR_CYAN = 7, + NM_META_TERM_COLOR_WHITE = 8, +} NMMetaTermColor; + +typedef enum { + NM_META_TERM_FORMAT_NORMAL = 0, + NM_META_TERM_FORMAT_BOLD = 1, + NM_META_TERM_FORMAT_DIM = 2, + NM_META_TERM_FORMAT_UNDERLINE = 3, + NM_META_TERM_FORMAT_BLINK = 4, + NM_META_TERM_FORMAT_REVERSE = 5, + NM_META_TERM_FORMAT_HIDDEN = 6, +} NMMetaTermFormat; + +typedef enum { + NM_META_ACCESSOR_GET_TYPE_PRETTY, + NM_META_ACCESSOR_GET_TYPE_PARSABLE, + NM_META_ACCESSOR_GET_TYPE_TERMFORMAT, +} NMMetaAccessorGetType; + +typedef enum { + NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT, + NM_META_ACCESSOR_SETTING_INIT_TYPE_CLI, +} NMMetaAccessorSettingInitType; + +static inline void +nm_meta_termformat_unpack (gconstpointer value, NMMetaTermColor *out_color, NMMetaTermFormat *out_format) +{ + /* get_fcn() with NM_META_ACCESSOR_GET_TYPE_TERMFORMAT returns a pointer + * that encodes NMMetaTermColor and NMMetaTermFormat. Unpack it. */ + if (!value) { + /* by default, objects that don't support NM_META_ACCESSOR_GET_TYPE_TERMFORMAT + * return NULL. This allows for an explicit fallback value here... */ + NM_SET_OUT (out_color, NM_META_TERM_COLOR_NORMAL); + NM_SET_OUT (out_format, NM_META_TERM_FORMAT_NORMAL); + } else { + NM_SET_OUT (out_color, GPOINTER_TO_UINT (value) & 0xFF); + NM_SET_OUT (out_format, (GPOINTER_TO_UINT (value) & 0xFF00) >> 8); + } +} + +static inline gconstpointer +nm_meta_termformat_pack (NMMetaTermColor color, NMMetaTermFormat format) +{ + /* get_fcn() with NM_META_ACCESSOR_GET_TYPE_TERMFORMAT returns a pointer + * that encodes NMMetaTermColor and NMMetaTermFormat. Pack it. */ + return GUINT_TO_POINTER (((guint) 0x10000) | (((guint) color) & 0xFFu) | ((((guint) format) & 0xFFu) << 8)); +} + +#define NM_META_TERMFORMAT_DEFAULT() (nm_meta_termformat_pack (NM_META_TERM_COLOR_NORMAL, NM_META_TERM_FORMAT_NORMAL)) + +typedef enum { + NM_META_ACCESSOR_GET_FLAGS_NONE = 0, + NM_META_ACCESSOR_GET_FLAGS_ACCEPT_STRV = (1LL << 0), + NM_META_ACCESSOR_GET_FLAGS_SHOW_SECRETS = (1LL << 1), +} NMMetaAccessorGetFlags; + +typedef enum { + NM_META_ACCESSOR_GET_OUT_FLAGS_NONE = 0, + NM_META_ACCESSOR_GET_OUT_FLAGS_STRV = (1LL << 0), +} NMMetaAccessorGetOutFlags; + +typedef enum { + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC = (1LL << 0), + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_NUMERIC_HEX = (1LL << 1), + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT = (1LL << 2), + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PRETTY_TEXT_L10N = (1LL << 3), + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC = (1LL << 4), + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_NUMERIC_HEX = (1LL << 5), + NM_META_PROPERTY_TYP_FLAG_ENUM_GET_PARSABLE_TEXT = (1LL << 6), +} NMMetaPropertyTypFlags; + +typedef enum { + NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT, + NM_META_PROPERTY_TYPE_MAC_MODE_CLONED, + NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND, +} NMMetaPropertyTypeMacMode; + +typedef struct _NMMetaEnvironment NMMetaEnvironment; +typedef struct _NMMetaType NMMetaType; +typedef struct _NMMetaAbstractInfo NMMetaAbstractInfo; +typedef struct _NMMetaSettingInfoEditor NMMetaSettingInfoEditor; +typedef struct _NMMetaPropertyInfo NMMetaPropertyInfo; +typedef struct _NMMetaPropertyType NMMetaPropertyType; +typedef struct _NMMetaPropertyTypData NMMetaPropertyTypData; +typedef struct _NMMetaOperationContext NMMetaOperationContext; +typedef struct _NMMetaNestedPropertyInfo NMMetaNestedPropertyInfo; +typedef struct _NMMetaPropertyTypDataNested NMMetaPropertyTypDataNested; + +/* this gives some context information for virtual functions. + * This command actually violates layering, and should be considered + * a hack. In the future, try to replace it's use. */ +struct _NMMetaOperationContext { + NMConnection *connection; +}; + +struct _NMMetaPropertyType { + + /* should return a translated string */ + const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info, + char **out_to_free); + + gconstpointer (*get_fcn) (const NMMetaPropertyInfo *property_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMSetting *setting, + NMMetaAccessorGetType get_type, + NMMetaAccessorGetFlags get_flags, + NMMetaAccessorGetOutFlags *out_flags, + gpointer *out_to_free); + gboolean (*set_fcn) (const NMMetaPropertyInfo *property_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMSetting *setting, + const char *value, + GError **error); + gboolean (*remove_fcn) (const NMMetaPropertyInfo *property_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMSetting *setting, + const char *option, + guint32 idx, + GError **error); + + const char *const*(*values_fcn) (const NMMetaPropertyInfo *property_info, + char ***out_to_free); + + const char *const*(*complete_fcn) (const NMMetaPropertyInfo *property_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + const NMMetaOperationContext *operation_context, + const char *text, + char ***out_to_free); +}; + +struct _NMUtilsEnumValueInfo; + +typedef struct { + const char *nick; + gint64 value; +} NMMetaUtilsIntValueInfo; + +struct _NMMetaPropertyTypData { + union { + struct { + gboolean (*fcn) (NMSetting *setting); + } get_with_default; + struct { + GType (*get_gtype) (void); + int min; + int max; + const struct _NMUtilsEnumValueInfo *value_infos; + void (*pre_set_notify) (const NMMetaPropertyInfo *property_info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMSetting *setting, + int value); + } gobject_enum; + struct { + gint64 min; + gint64 max; + guint base; + const NMMetaUtilsIntValueInfo *value_infos; + } gobject_int; + struct { + const char *(*validate_fcn) (const char *value, char **out_to_free, GError **error); + } gobject_string; + struct { + guint32 (*get_fcn) (NMSetting *setting); + } mtu; + struct { + NMMetaPropertyTypeMacMode mode; + } mac; + } subtype; + const char *const*values_static; + const NMMetaPropertyTypDataNested *nested; + NMMetaPropertyTypFlags typ_flags; +}; + +typedef enum { + NM_META_PROPERTY_INF_FLAG_NONE = 0x00, + NM_META_PROPERTY_INF_FLAG_REQD = 0x01, /* Don't ask to ask. */ + NM_META_PROPERTY_INF_FLAG_DONT_ASK = 0x02, /* Don't ask interactively by default */ + NM_META_PROPERTY_INF_FLAG_MULTI = 0x04, /* Ask multiple times, do an append instead of set. */ +} NMMetaPropertyInfFlags; + +enum { + _NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE = 0, + _NM_META_PROPERTY_TYPE_CONNECTION_TYPE = 3, +}; + +#define nm_meta_property_info_connection_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION].properties[_NM_META_PROPERTY_TYPE_CONNECTION_TYPE]) +#define nm_meta_property_info_vpn_service_type (nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_VPN].properties[_NM_META_PROPERTY_TYPE_VPN_SERVICE_TYPE]) + +struct _NMMetaPropertyInfo { + union { + NMObjBaseInst parent; + const NMMetaType *meta_type; + }; + + const NMMetaSettingInfoEditor *setting_info; + + const char *property_name; + + const char *property_alias; + + NMMetaPropertyInfFlags inf_flags; + bool is_secret:1; + + bool is_cli_option:1; + + const char *prompt; + + const char *def_hint; + + const char *describe_doc; + + /* a non-translated but translatable static description (marked with N_()). */ + const char *describe_message; + + const NMMetaPropertyType *property_type; + const NMMetaPropertyTypData *property_typ_data; +}; + +typedef struct _NMMetaSettingValidPartItem { + const NMMetaSettingInfoEditor *setting_info; + bool mandatory; +} NMMetaSettingValidPartItem; + +struct _NMMetaSettingInfoEditor { + union { + NMObjBaseInst parent; + const NMMetaType *meta_type; + }; + const NMMetaSettingInfo *general; + const char *alias; + const char *pretty_name; + const NMMetaPropertyInfo *const*properties; + guint properties_num; + + /* a NMConnection has a main type (connection.type), which is a + * main NMSetting instance. Depending on the type, a connection + * may have a list of other allowed settings. + * + * For example, a connection of type "vlan" may have settings + * of type "connection", "vlan", and "wired". + * + * Some setting types a not a main type (NMSettingProxy). They + * don't have valid_settings but are usually referenced by other + * settings to be valid for them. */ + const NMMetaSettingValidPartItem *const*valid_parts; + + void (*setting_init_fcn) (const NMMetaSettingInfoEditor *setting_info, + NMSetting *setting, + NMMetaAccessorSettingInitType init_type); +}; + +struct _NMMetaType { + NMObjBaseClass parent; + const char *type_name; + const char *(*get_name) (const NMMetaAbstractInfo *abstract_info, + gboolean for_header); + const NMMetaAbstractInfo *const*(*get_nested) (const NMMetaAbstractInfo *abstract_info, + guint *out_len, + gpointer *out_to_free); + gconstpointer (*get_fcn) (const NMMetaAbstractInfo *info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + gpointer target, + NMMetaAccessorGetType get_type, + NMMetaAccessorGetFlags get_flags, + NMMetaAccessorGetOutFlags *out_flags, + gpointer *out_to_free); + const char *const*(*complete_fcn) (const NMMetaAbstractInfo *info, + const NMMetaEnvironment *environment, + gpointer environment_user_data, + const NMMetaOperationContext *operation_context, + const char *text, + char ***out_to_free); +}; + +struct _NMMetaAbstractInfo { + union { + NMObjBaseInst parent; + const NMMetaType *meta_type; + }; +}; + +extern const NMMetaType nm_meta_type_setting_info_editor; +extern const NMMetaType nm_meta_type_property_info; + +extern const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[_NM_META_SETTING_TYPE_NUM]; + +extern const NMMetaSettingValidPartItem *const nm_meta_setting_info_valid_parts_default[]; + +const NMMetaSettingValidPartItem *const*nm_meta_setting_info_valid_parts_for_slave_type (const char *slave_type, const char **out_slave_name); + +/*****************************************************************************/ + +typedef enum { + NM_META_ENV_WARN_LEVEL_INFO, + NM_META_ENV_WARN_LEVEL_WARN, +} NMMetaEnvWarnLevel; + +/* the settings-meta data is supposed to be independent of an actual client + * implementation. Hence, there is a need for hooks to the meta-data. + * The meta-data handlers may call back to the enviroment with certain + * actions. */ +struct _NMMetaEnvironment { + + void (*warn_fcn) (const NMMetaEnvironment *environment, + gpointer environment_user_data, + NMMetaEnvWarnLevel warn_level, + const char *fmt_l10n, /* the untranslated format string, but it is marked for translation using N_(). */ + va_list ap); + + struct _NMDevice *const*(*get_nm_devices) (const NMMetaEnvironment *environment, + gpointer environment_user_data, + guint *out_len); + + struct _NMRemoteConnection *const*(*get_nm_connections) (const NMMetaEnvironment *environment, + gpointer environment_user_data, + guint *out_len); + +}; + +/*****************************************************************************/ + +/* NMSettingBond is special in that it has nested properties. + * We will add API to proper handle such types (Bond, VPN, User), + * but for now just expose the type info directly. */ + +extern const NMMetaType nm_meta_type_nested_property_info; + +struct _NMMetaNestedPropertyInfo { + union { + const NMMetaType *meta_type; + NMMetaPropertyInfo base; + }; + const NMMetaPropertyInfo *parent_info; +}; + +struct _NMMetaPropertyTypDataNested { + const NMMetaNestedPropertyInfo *nested; + guint nested_len; +}; + +const NMMetaPropertyTypDataNested nm_meta_property_typ_data_bond; + +/*****************************************************************************/ + +#endif /* __NM_META_SETTING_DESC_H__ */ diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index b763bf89..4ef1be23 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -33,6 +33,8 @@ #include <string.h> +#include "nm-utils/nm-hash-utils.h" + #include "NetworkManager.h" #include "nm-vpn-service-plugin.h" @@ -86,7 +88,7 @@ nm_secret_agent_simple_init (NMSecretAgentSimple *agent) { NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent); - priv->requests = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->requests = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, nm_secret_agent_simple_request_free); } @@ -399,20 +401,20 @@ add_vpn_secrets (NMSecretAgentSimpleRequest *request, { NMSettingVpn *s_vpn = nm_connection_get_setting_vpn (request->connection); const VpnPasswordName *secret_names, *p; - char *tmp = NULL; + const char *vpn_msg = NULL; char **iter; /* If hints are given, then always ask for what the hints require */ - if (request->hints && g_strv_length (request->hints)) { - for (iter = request->hints; iter && *iter; iter++) { - if (!tmp && g_str_has_prefix (*iter, VPN_MSG_TAG)) - tmp = g_strdup (*iter + strlen (VPN_MSG_TAG)); + if (request->hints) { + for (iter = request->hints; *iter; iter++) { + if (!vpn_msg && g_str_has_prefix (*iter, VPN_MSG_TAG)) + vpn_msg = &(*iter)[NM_STRLEN (VPN_MSG_TAG)]; else add_vpn_secret_helper (secrets, s_vpn, *iter, *iter); } } - if (msg) - *msg = g_strdup (tmp); + + NM_SET_OUT (msg, g_strdup (vpn_msg)); /* Now add what client thinks might be required, because hints may be empty or incomplete */ p = secret_names = nm_vpn_get_secret_names (nm_setting_vpn_get_service_type (s_vpn)); @@ -543,23 +545,30 @@ request_secrets_from_ui (NMSecretAgentSimpleRequest *request) TRUE); g_ptr_array_add (secrets, secret); } else if (nm_connection_is_type (request->connection, NM_SETTING_BLUETOOTH_SETTING_NAME)) { - NMSetting *setting; - - setting = nm_connection_get_setting_by_name (request->connection, NM_SETTING_GSM_SETTING_NAME); - if (!setting) - setting = nm_connection_get_setting_by_name (request->connection, NM_SETTING_CDMA_SETTING_NAME); + NMSetting *setting = NULL; + + setting = nm_connection_get_setting_by_name (request->connection, NM_SETTING_BLUETOOTH_SETTING_NAME); + if ( setting + && !nm_streq0 (nm_setting_bluetooth_get_connection_type (NM_SETTING_BLUETOOTH (setting)), NM_SETTING_BLUETOOTH_TYPE_NAP)) { + setting = nm_connection_get_setting_by_name (request->connection, NM_SETTING_GSM_SETTING_NAME); + if (!setting) + setting = nm_connection_get_setting_by_name (request->connection, NM_SETTING_CDMA_SETTING_NAME); + } - title = _("Mobile broadband network password"); - msg = g_strdup_printf (_("A password is required to connect to '%s'."), - nm_connection_get_id (request->connection)); + if (setting) { + title = _("Mobile broadband network password"); + msg = g_strdup_printf (_("A password is required to connect to '%s'."), + nm_connection_get_id (request->connection)); - secret = nm_secret_agent_simple_secret_new (_("Password"), - setting, - "password", - NULL, - NULL, - TRUE); - g_ptr_array_add (secrets, secret); + secret = nm_secret_agent_simple_secret_new (_("Password"), + setting, + "password", + NULL, + NULL, + TRUE); + g_ptr_array_add (secrets, secret); + } else + ok = FALSE; } else if (nm_connection_is_type (request->connection, NM_SETTING_VPN_SETTING_NAME)) { NMSettingConnection *s_con; @@ -576,6 +585,15 @@ request_secrets_from_ui (NMSecretAgentSimpleRequest *request) ok = FALSE; if (!ok) { + gs_free_error GError *error = NULL; + + error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED, + "Cannot service a secrets request %s for a %s connection", + request->request_id, + nm_connection_get_connection_type (request->connection)); + request->callback (NM_SECRET_AGENT_OLD (request->self), request->connection, + NULL, error, request->callback_data); + g_hash_table_remove (priv->requests, request->request_id); g_ptr_array_unref (secrets); return; } @@ -678,7 +696,7 @@ nm_secret_agent_simple_response (NMSecretAgentSimple *self, g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}")); - settings = g_hash_table_new (g_str_hash, g_str_equal); + settings = g_hash_table_new (nm_str_hash, g_str_equal); for (i = 0; i < secrets->len; i++) { NMSecretAgentSimpleSecretReal *secret = secrets->pdata[i]; @@ -730,7 +748,12 @@ nm_secret_agent_simple_cancel_get_secrets (NMSecretAgentOld *agent, const gchar *connection_path, const gchar *setting_name) { - /* We don't support cancellation. Sorry! */ + NMSecretAgentSimple *self = NM_SECRET_AGENT_SIMPLE (agent); + NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (self); + gs_free char *request_id = NULL; + + request_id = g_strdup_printf ("%s/%s", connection_path, setting_name); + g_hash_table_remove (priv->requests, request_id); } static void diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c index d2bb8cba..15611c45 100644 --- a/clients/common/nm-vpn-helpers.c +++ b/clients/common/nm-vpn-helpers.c @@ -115,22 +115,33 @@ nm_vpn_supports_ipv6 (NMConnection *connection) const VpnPasswordName * nm_vpn_get_secret_names (const char *service_type) { + static const VpnPasswordName const generic_vpn_secrets[] = { + { "password", N_("Password") }, + { 0 } + }; + static const VpnPasswordName const openvpn_secrets[] = { + { "password", N_("Password") }, + { "cert-pass", N_("Certificate password") }, + { "http-proxy-password", N_("HTTP proxy password") }, + { 0 } + }; + static const VpnPasswordName const vpnc_secrets[] = { + { "Xauth password", N_("Password") }, + { "IPSec secret", N_("Group password") }, + { 0 } + }; + static const VpnPasswordName const swan_secrets[] = { + { "xauthpassword", N_("Password") }, + { "pskvalue", N_("Group password") }, + { 0 } + }; + static const VpnPasswordName const openconnect_secrets[] = { + { "gateway", N_("Gateway") }, + { "cookie", N_("Cookie") }, + { "gwcert", N_("Gateway certificate hash") }, + { 0 } + }; const char *type; - static VpnPasswordName generic_vpn_secrets[] = { {"password", N_("Password")}, {NULL, NULL} }; - static VpnPasswordName openvpn_secrets[] = { {"password", N_("Password")}, - {"cert-pass", N_("Certificate password")}, - {"http-proxy-password", N_("HTTP proxy password")}, - {NULL, NULL} }; - static VpnPasswordName vpnc_secrets[] = { {"Xauth password", N_("Password")}, - {"IPSec secret", N_("Group password")}, - {NULL, NULL} }; - static VpnPasswordName swan_secrets[] = { {"xauthpassword", N_("Password")}, - {"pskvalue", N_("Group password")}, - {NULL, NULL} }; - static VpnPasswordName openconnect_secrets[] = { {"gateway", N_("Gateway")}, - {"cookie", N_("Cookie")}, - {"gwcert", N_("Gateway certificate hash")}, - {NULL, NULL} }; if (!service_type) return NULL; diff --git a/clients/common/settings-docs.c b/clients/common/settings-docs.c new file mode 100644 index 00000000..b523a394 --- /dev/null +++ b/clients/common/settings-docs.c @@ -0,0 +1,363 @@ +/* Generated file. Do not edit. */ + +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_CHANNEL N_("Channel on which the mesh network to join is located.") +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS N_("Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request.") +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_SSID N_("SSID of the mesh network to join.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("802.11 frequency band of the network. One of \"a\" for 5GHz 802.11a or \"bg\" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if \"a\" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BSSID N_("If specified, directs the device to only associate with the given access point. This capability is highly driver dependent and not supported by all devices. Note: this property does not control the BSSID used when creating an Ad-Hoc network and is unlikely to in the future.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL N_("Wireless channel to use for the Wi-Fi connection. The device will only join (or create for Ad-Hoc networks) a Wi-Fi network on the specified channel. Because channel numbers overlap between bands, this property also requires the \"band\" property to be set.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_HIDDEN N_("If TRUE, indicates this network is a non-broadcasting network that hides its SSID. In this case various workarounds may take place, such as probe-scanning the SSID for more reliable network discovery. However, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS N_("If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST N_("A list of permanent MAC addresses of Wi-Fi devices to which this connection should never apply. Each MAC address should be given in the standard hex-digits-and-colons notation (eg \"00:11:22:33:44:55\").") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION N_("One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address). This property is deprecated for 'cloned-mac-address'. Deprecated: 1") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MODE N_("Wi-Fi network mode; one of \"infrastructure\", \"adhoc\" or \"ap\". If blank, infrastructure is assumed.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_POWERSAVE N_("One of NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2) (disable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_ENABLE (3) (enable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1) (don't touch currently configure setting) or NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0) (use the globally configured value). All other values are reserved.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_RATE N_("If non-zero, directs the device to only use the specified bitrate for communication with the access point. Units are in Kb/s, ie 5500 = 5.5 Mbit/s. This property is highly driver dependent and not all devices support setting a static bitrate.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SEEN_BSSIDS N_("A list of BSSIDs (each BSSID formatted as a MAC address like \"00:11:22:33:44:55\") that have been detected as part of the Wi-Fi network. NetworkManager internally tracks previously seen BSSIDs. The property is only meant for reading and reflects the BSSID list of NetworkManager. The changes you make to this property will not be preserved.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SSID N_("SSID of the Wi-Fi network. Must be specified.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_TX_POWER N_("If non-zero, directs the device to use the specified transmit power. Units are dBm. This property is highly driver dependent and not all devices support setting a static transmit power.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_AUTH_ALG N_("When WEP is used (ie, key-mgmt = \"none\" or \"ieee8021x\") indicate the 802.11 authentication algorithm required by the AP here. One of \"open\" for Open System, \"shared\" for Shared Key, or \"leap\" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\") the \"leap-username\" and \"leap-password\" properties must be specified.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_GROUP N_("A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"wep40\", \"wep104\", \"tkip\", or \"ccmp\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-none\" (Ad-Hoc WPA-PSK), \"wpa-psk\" (infrastructure WPA-PSK), or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD N_("The login password for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS N_("Flags indicating how to handle the \"leap-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME N_("The login username for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PAIRWISE N_("A list of pairwise encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"tkip\" or \"ccmp\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PMF N_("Indicates whether Protected Management Frames (802.11w) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE (1) (disable PMF), NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (2) (enable PMF if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (3) (enable PMF and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) and no global default is set, PMF will be optionally enabled.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PROTO N_("List of strings specifying the allowed WPA protocol versions to use. Each element may be one \"wpa\" (allow WPA) or \"rsn\" (allow WPA2/RSN). If not specified, both WPA and RSN connections are allowed.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK N_("Pre-Shared-Key for WPA networks. If the key is 64-characters long, it must contain only hexadecimal characters and is interpreted as a hexadecimal WPA key. Otherwise, the key must be between 8 and 63 ASCII characters (as specified in the 802.11i standard) and is interpreted as a WPA passphrase, and is hashed to derive the actual WPA-PSK used when connecting to the Wi-Fi network.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS N_("Flags indicating how to handle the \"psk\" property.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS N_("Flags indicating how to handle the \"wep-key0\", \"wep-key1\", \"wep-key2\", and \"wep-key3\" properties.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE N_("Controls the interpretation of WEP keys. Allowed values are NM_WEP_KEY_TYPE_KEY (1), in which case the key is either a 10- or 26-character hexadecimal string, or a 5- or 13-character ASCII password; or NM_WEP_KEY_TYPE_PASSPHRASE (2), in which case the passphrase is provided as a string and will be hashed using the de-facto MD5 method to derive the actual WEP key.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY0 N_("Index 0 WEP key. This is the WEP key used in most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY1 N_("Index 1 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY2 N_("Index 2 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY3 N_("Index 3 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX N_("When static WEP is used (ie, key-mgmt = \"none\") and a non-default WEP key index is used by the AP, put that WEP key index here. Valid values are 0 (default key) through 3. Note that some consumer access points (like the Linksys WRT54G) number the keys 1 - 4.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WPS_METHOD N_("Flags indicating which mode of WPS is to be used if any. There's little point in changing the default setting as NetworkManager will automatically determine whether it's feasible to start WPS enrollment from the Access Point capabilities. WPS can be disabled by setting this property to a value of 1.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_ANONYMOUS_IDENTITY N_("Anonymous identity string for EAP authentication methods. Used as the unencrypted identity with EAP types that support different tunneled identity like EAP-TTLS.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_AUTH_TIMEOUT N_("A timeout for the authentication. Zero means the global default; if the global default is not set, the authentication timeout is 25 seconds.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT N_("Contains the CA certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD N_("The password used to access the CA certificate stored in \"ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"ca-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"ca-cert\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT N_("Contains the client certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD N_("The password used to access the client certificate stored in \"client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"client-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_EAP N_("The allowed EAP method to be used when authenticating to the network with 802.1x. Valid methods are: \"leap\", \"md5\", \"tls\", \"peap\", \"ttls\", \"pwd\", and \"fast\". Each method requires different configuration using the properties of this setting; refer to wpa_supplicant documentation for the allowed combinations.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_IDENTITY N_("Identity string for EAP authentication methods. Often the user's user or login name.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PAC_FILE N_("UTF-8 encoded file path containing PAC for EAP-FAST.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD N_("UTF-8 encoded password used for EAP authentication methods. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW N_("Password used for EAP authentication methods, given as a byte array to allow passwords in other encodings than UTF-8 to be used. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW_FLAGS N_("Flags indicating how to handle the \"password-raw\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_AUTH_FLAGS N_("Specifies authentication flags to use in \"phase 1\" outer authentication using NMSetting8021xAuthFlags options. The individual TLS versions can be explicitly disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x settings. See the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING N_("Enables or disables in-line provisioning of EAP-FAST credentials when FAST is specified as the EAP method in the \"eap\" property. Recognized values are \"0\" (disabled), \"1\" (allow unauthenticated provisioning), \"2\" (allow authenticated provisioning), and \"3\" (allow both authenticated and unauthenticated provisioning). See the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPLABEL N_("Forces use of the new PEAP label during key derivation. Some RADIUS servers may require forcing the new PEAP label to interoperate with PEAPv1. Set to \"1\" to force use of the new PEAP label. See the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPVER N_("Forces which PEAP version is used when PEAP is set as the EAP method in the \"eap\" property. When unset, the version reported by the server will be used. Sometimes when using older RADIUS servers, it is necessary to force the client to use a particular PEAP version. To do so, this property may be set to \"0\" or \"1\" to force that specific PEAP version.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTH N_("Specifies the allowed \"phase 2\" inner non-EAP authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized non-EAP \"phase 2\" methods are \"pap\", \"chap\", \"mschap\", \"mschapv2\", \"gtc\", \"otp\", \"md5\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTHEAP N_("Specifies the allowed \"phase 2\" inner EAP-based authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized EAP-based \"phase 2\" methods are \"md5\", \"mschapv2\", \"otp\", \"gtc\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT N_("Contains the \"phase 2\" CA certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD N_("The password used to access the \"phase2\" CA certificate stored in \"phase2-ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-ca-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"phase2-ca-cert\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT N_("Contains the \"phase 2\" client certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD N_("The password used to access the \"phase2\" client certificate stored in \"phase2-client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-client-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY N_("Contains the \"phase 2\" inner private key when the \"phase2-auth\" or \"phase2-autheap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"phase2-private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"phase2-private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the \"phase 2\" private key specified in the \"phase2-private-key\" property when the private key either uses the path scheme, or is a PKCS#12 format key.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-private-key-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server during the inner \"phase 2\" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:phase2-domain-suffix-match.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN N_("PIN used for EAP authentication methods.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY N_("Contains the private key when the \"eap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate. WARNING: \"private-key\" is not a \"secret\" property, and thus unencrypted private key data using the BLOB scheme may be readable by unprivileged users. Private keys should always be encrypted with a private key password to prevent unauthorized access to unencrypted private key data.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the private key specified in the \"private-key\" property when the private key either uses the path scheme, or if the private key is a PKCS#12 format key.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"private-key-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_SYSTEM_CA_CERTS N_("When TRUE, overrides the \"ca-path\" and \"phase2-ca-path\" properties using the system CA directory specified at configure time with the --system-ca-path switch. The certificates in this directory are added to the verification chain in addition to any certificates specified by the \"ca-cert\" and \"phase2-ca-cert\" properties. If the path provided with --system-ca-path is rather a file name (bundle of trusted CA certificates), it overrides \"ca-cert\" and \"phase2-ca-cert\" properties instead (sets ca_cert/ca_cert2 options for wpa_supplicant).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_AUTO_NEGOTIATE N_("If TRUE, enforce auto-negotiation of port speed and duplex mode. If FALSE, \"speed\" and \"duplex\" properties should be both set or link configuration will be skipped.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address if the device has one (otherwise this is treated as \"preserve\"). \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".") +#define DESCRIBE_DOC_NM_SETTING_WIRED_DUPLEX N_("Can be specified only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified duplex mode, either \"half\" or \"full\". Must be set together with the \"speed\" property if specified. Before specifying a duplex mode be sure your device supports it.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS N_("If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST N_("If specified, this connection will never apply to the Ethernet device whose permanent MAC address matches an address in the list. Each MAC address is in the standard hex-digits-and-colons notation (00:11:22:33:44:55).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIRED_PORT N_("Specific port type to use if the device supports multiple attachment methods. One of \"tp\" (Twisted Pair), \"aui\" (Attachment Unit Interface), \"bnc\" (Thin Ethernet) or \"mii\" (Media Independent Interface). If the device supports only one port type, this setting is ignored.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_NETTYPE N_("s390 network device type; one of \"qeth\", \"lcs\", or \"ctc\", representing the different types of virtual network devices available on s390 systems.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_OPTIONS N_("Dictionary of key/value pairs of s390-specific device options. Both keys and values must be strings. Allowed keys include \"portno\", \"layer2\", \"portname\", \"protocol\", among others. Key names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_SUBCHANNELS N_("Identifies specific subchannels that this network device uses for communication with z/VM or s390 host. Like the \"mac-address\" property for non-z/VM devices, this property can be used to ensure this connection only applies to the network device that uses these subchannels. The list should contain exactly 3 strings, and each string may only be composed of hexadecimal characters and the period (.) character.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_SPEED N_("Can be set to a value greater than zero only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified speed. In Mbit/s, ie 100 == 100Mbit/s. Must be set together with the \"duplex\" property when non-zero. Before specifying a speed value be sure your device supports it.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN N_("The NMSettingWiredWakeOnLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRED_WAKE_ON_LAN_PHY (0x2), NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST (0x4), NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST (0x8), NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST (0x10), NM_SETTING_WIRED_WAKE_ON_LAN_ARP (0x20), NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC (0x40) or the special values NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD N_("If specified, the password used with magic-packet-based Wake-on-LAN, represented as an Ethernet MAC address. If NULL, no password will be required.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_ENCAPSULATION N_("Encapsulation of ADSL connection. Can be \"vcmux\" or \"llc\".") +#define DESCRIBE_DOC_NM_SETTING_ADSL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD N_("Password used to authenticate with the ADSL service.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_PROTOCOL N_("ADSL connection protocol. Can be \"pppoa\", \"pppoe\" or \"ipoatm\".") +#define DESCRIBE_DOC_NM_SETTING_ADSL_USERNAME N_("Username used to authenticate with the ADSL service.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_VCI N_("VCI of ADSL connection") +#define DESCRIBE_DOC_NM_SETTING_ADSL_VPI N_("VPI of ADSL connection") +#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_BDADDR N_("The Bluetooth address of the device.") +#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_TYPE N_("Either \"dun\" for Dial-Up Networking connections or \"panu\" for Personal Area Networking connections to devices supporting the NAP profile.") +#define DESCRIBE_DOC_NM_SETTING_BOND_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BOND_OPTIONS N_("Dictionary of key/value pairs of bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_AGEING_TIME N_("The Ethernet MAC address aging time, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_FORWARD_DELAY N_("The Spanning Tree Protocol (STP) forwarding delay, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_GROUP_FORWARD_MASK N_("A mask of group addresses to forward. Usually, group addresses in the range from 01:80:C2:00:00:00 to 01:80:C2:00:00:0F are not forwarded according to standards. This property is a mask of 16 bits, each corresponding to a group address in that range that must be forwarded. The mask can't have bits 0, 1 or 2 set because they are used for STP, MAC pause frames and LACP.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_HELLO_TIME N_("The Spanning Tree Protocol (STP) hello time, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAC_ADDRESS N_("If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the \"ethernet.cloned-mac-address\" is referred instead to generate the initial MAC address. Note that setting \"ethernet.cloned-mac-address\" anyway overwrites the MAC address of the bridge later while activating the bridge. Hence, this property is deprecated.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAX_AGE N_("The Spanning Tree Protocol (STP) maximum message age, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_SNOOPING N_("Controls whether IGMP snooping is enabled for this bridge. Note that if snooping was automatically disabled due to hash collisions, the system may refuse to enable the feature until the collisions are resolved.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PRIORITY N_("Sets the Spanning Tree Protocol (STP) priority for this bridge. Lower values are \"better\"; the lowest priority bridge will be elected the root bridge.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_STP N_("Controls whether Spanning Tree Protocol (STP) is enabled for this bridge.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE N_("Enables or disables \"hairpin mode\" for the port, which allows frames to be sent back out through the port the frame was received on.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PATH_COST N_("The Spanning Tree Protocol (STP) port cost for destinations via this port.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PRIORITY N_("The Spanning Tree Protocol (STP) priority of this bridge port.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_CDMA_NUMBER N_("The number to dial to establish the connection to the CDMA-based mobile broadband network, if any. If not specified, the default number (#777) is used when required.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTH_RETRIES N_("The number of retries for the authentication. Zero means to try indefinitely; -1 means to use a global default. If the global default is not set, the authentication retries for 3 times before failing the connection. Currently this only applies to 802-1x authentication.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT N_("Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available. TRUE to automatically activate the connection, FALSE to require manual intervention to activate the connection.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY N_("The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES N_("The number of times a connection should be tried when autoactivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden). Setting this to 1 means to try activation only once before blocking autoconnect. Note that after a timeout, NetworkManager will try to autoconnect again.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES N_("Whether or not slaves of this connection should be automatically brought up when NetworkManager activates this connection. This only has a real effect for master connections. The permitted values are: 0: leave slave connections untouched, 1: activate all the slave connections with this connection, -1: default. If -1 (default) is set, global connection.autoconnect-slaves is read to determine the real value. If it is default as well, this fallbacks to 0.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT N_("If greater than zero, delay success of IP addressing until either the timeout is reached, or an IP gateway replies to a ping.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ID N_("A human readable unique identifier for the connection, like \"Work Wi-Fi\" or \"T-Mobile 3G\".") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_INTERFACE_NAME N_("The name of the network interface this connection is bound to. If not set, then the connection can be attached to any interface of the appropriate type (subject to restrictions imposed by other settings). For software devices this specifies the name of the created device. For connection types where interface names cannot easily be made persistent (e.g. mobile broadband or USB Ethernet), this property should not be used. Setting this property restricts the interfaces a connection can be used with, and if interface names change or are reordered the connection may be applied to the wrong interface.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLDP N_("Whether LLDP is enabled for the connection.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MASTER N_("Interface name of the master device or UUID of the master connection.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_METERED N_("Whether the connection is metered. When updating this property on a currently activated connection, the change takes effect immediately.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_PERMISSIONS N_("An array of strings defining what access a given user has to this connection. If this is NULL or empty, all users are allowed to access this connection; otherwise users are allowed if and only if they are in this list. When this is not empty, the connection can be active only when one of the specified users is logged into an active session. Each entry is of the form \"[type]:[id]:[reserved]\"; for example, \"user:dcbw:blah\". At this time only the \"user\" [type] is allowed. Any other values are ignored and reserved for future use. [id] is the username that this permission refers to, which may not contain the \":\" character. Any [reserved] information present must be ignored and is reserved for future use. All of [type], [id], and [reserved] must be valid UTF-8.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_READ_ONLY N_("FALSE if the connection can be modified using the provided settings service's D-Bus interface with the right privileges, or TRUE if the connection is read-only and cannot be modified.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SECONDARIES N_("List of connection UUIDs that should be activated when the base connection itself is activated. Currently only VPN connections are supported.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SLAVE_TYPE N_("Setting name of the device type of this slave's master connection (eg, \"bond\"), or NULL if this connection is not a slave.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_STABLE_ID N_("Token to generate stable IDs for the connection. The stable-id is used for generating IPv6 stable private addresses with ipv6.addr-gen-mode=stable-privacy. It is also used to seed the generated cloned MAC address for ethernet.cloned-mac-address=stable and wifi.cloned-mac-address=stable. Note that also the interface name of the activating connection and a per-host secret key is included into the address generation so that the same stable-id on different hosts/devices yields different addresses. If the value is unset, an ID unique for the connection is used. Specifying a stable-id allows multiple connections to generate the same addresses. Another use is to generate IDs at runtime via dynamic substitutions. The '$' character is treated special to perform dynamic substitutions at runtime. Currently supported are \"${CONNECTION}\", \"${BOOT}\", \"${RANDOM}\". These effectively create unique IDs per-connection, per-boot, or every time. Any unrecognized patterns following '$' are treated verbatim, however are reserved for future use. You are thus advised to avoid '$' or escape it as \"$$\". For example, set it to \"${CONNECTION}/${BOOT}\" to create a unique id for this connection that changes with every reboot. Note that two connections only use the same effective id if their stable-id is also identical before performing dynamic substitutions.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TIMESTAMP N_("The time, in seconds since the Unix Epoch, that the connection was last _successfully_ fully activated. NetworkManager updates the connection timestamp periodically when the connection is active to ensure that an active connection has the latest timestamp. The property is only meant for reading (changes to this property will not be preserved).") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TYPE N_("Base type of the connection. For hardware-dependent connections, should contain the setting name of the hardware-type specific setting (ie, \"802-3-ethernet\" or \"802-11-wireless\" or \"bluetooth\", etc), and for non-hardware dependent connections like VPN or otherwise, should contain the setting name of that setting type (ie, \"vpn\" or \"bridge\", etc).") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_UUID N_("A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the \"id\" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or \"type\" property changes. The UUID must be in the format \"2815492f-7e56-435e-b2e9-246bd7cdc664\" (ie, contains only hexadecimal characters and \"-\").") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ZONE N_("The trust level of a the connection. Free form case-insensitive string (for example \"Home\", \"Work\", \"Public\"). NULL or unspecified zone means the connection will be placed in the default zone as defined by the firewall. When updating this property on a currently activated connection, the change takes effect immediately.") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FCoE application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_MODE N_("The FCoE controller mode; either \"fabric\" (default) or \"vn2vn\".") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_PRIORITY N_("The highest User Priority (0 - 7) which FCoE frames should use, or -1 for default priority. Only used when the \"app-fcoe-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FIP application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_PRIORITY N_("The highest User Priority (0 - 7) which FIP frames should use, or -1 for default priority. Only used when the \"app-fip-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB iSCSI application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_PRIORITY N_("The highest User Priority (0 - 7) which iSCSI frames should use, or -1 for default priority. Only used when the \"app-iscsi-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.") +#define DESCRIBE_DOC_NM_SETTING_DCB_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the percentage of bandwidth of the priority's assigned group that the priority may use. The sum of all percentages for priorities which belong to the same group must total 100 percents.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the corresponding priority should transmit priority pause.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Flow Control (PFC). Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the Priority Group ID (0 - 7) and the value indicates the percentage of link bandwidth allocated to that group. Allowed values are 0 - 100, and the sum of all values must total 100 percents.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Groups. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_ID N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the Priority Group ID. Allowed Priority Group ID values are 0 - 7 or 15 for the unrestricted group.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the priority may use all of the bandwidth allocated to its assigned group.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the traffic class (0 - 7) to which the priority is mapped.") +#define DESCRIBE_DOC_NM_SETTING_DUMMY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_GENERIC_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_GSM_APN N_("The GPRS Access Point Name specifying the APN used when establishing a data session with the GSM-based network. The APN often determines how the user will be billed for their network usage and whether the user has access to the Internet or just a provider-specific walled-garden, so it is important to use the correct APN for the user's mobile broadband plan. The APN may only be composed of the characters a-z, 0-9, ., and - per GSM 03.60 Section 14.9.") +#define DESCRIBE_DOC_NM_SETTING_GSM_DEVICE_ID N_("The device unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will only apply to the specified device.") +#define DESCRIBE_DOC_NM_SETTING_GSM_HOME_ONLY N_("When TRUE, only connections to the home network will be allowed. Connections to roaming networks will not be made.") +#define DESCRIBE_DOC_NM_SETTING_GSM_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") +#define DESCRIBE_DOC_NM_SETTING_GSM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_GSM_NETWORK_ID N_("The Network ID (GSM LAI format, ie MCC-MNC) to force specific network registration. If the Network ID is specified, NetworkManager will attempt to force the device to register only on the specified network. This can be used to ensure that the device does not roam when direct roaming control of the device is not otherwise possible.") +#define DESCRIBE_DOC_NM_SETTING_GSM_NUMBER N_("Number to dial when establishing a PPP data session with the GSM-based mobile broadband network. Many modems do not require PPP for connections to the mobile network and thus this property should be left blank, which allows NetworkManager to select the appropriate settings automatically.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PIN N_("If the SIM is locked with a PIN it must be unlocked before any other operations are requested. Specify the PIN here to allow operation of the device.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.") +#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_ID N_("The SIM card unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" which contains a SIM card matching the given identifier.") +#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_OPERATOR_ID N_("A MCC/MNC string like \"310260\" or \"21601\" identifying the specific mobile network operator which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" and \"sim-id\" which contains a SIM card provisioned by the given operator.") +#define DESCRIBE_DOC_NM_SETTING_GSM_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MAC_ADDRESS N_("If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_P_KEY N_("The InfiniBand P_Key to use for this device. A value of -1 means to use the default P_Key (aka \"the P_Key at index 0\"). Otherwise it is a 16-bit unsigned integer, whose high bit is set if it is a \"full membership\" P_Key.") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_PARENT N_("The interface name of the parent device of this device. Normally NULL, but if the \"p_key\" property is set, then you must specify the base device by setting either this property or \"mac-address\".") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_TRANSPORT_MODE N_("The IP-over-InfiniBand transport mode. Either \"datagram\" or \"connected\".") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT N_("How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_FLOW_LABEL N_("The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_INPUT_KEY N_("The key used for tunnel input packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_LOCAL N_("The local endpoint of the tunnel; the value can be empty, otherwise it must contain an IPv4 or IPv6 address.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MODE N_("The tunneling mode, for example NM_IP_TUNNEL_MODE_IPIP (1) or NM_IP_TUNNEL_MODE_GRE (2).") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_OUTPUT_KEY N_("The key used for tunnel output packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PARENT N_("If given, specifies the parent interface name or parent connection UUID the new device will be bound to so that tunneled packets will only be routed via that interface.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY N_("Whether to enable Path MTU Discovery on this tunnel.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_REMOTE N_("The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6 address.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TOS N_("The type of service (IPv4) or traffic class (IPv6) field to be set on tunneled packets.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TTL N_("The TTL to assign to tunneled packets. 0 is a special value meaning that packets inherit the TTL value.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES N_("Array of IP addresses.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or 3 seconds). A value greater than zero is a timeout in milliseconds.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID N_("A string sent to the DHCP server to identify the local machine which the DHCP server may use to customize the DHCP lease and options. When the property is a hex string ('aa:bb:cc') it is interpreted as a binary client ID, in which case the first byte is assumed to be the 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet ARP type and the rest is a MAC address). If the property is not a hex string it is considered as a non-hardware-address client ID and the 'type' field is set to 0.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_FQDN N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified FQDN will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-hostname\" are mutually exclusive and cannot be set at the same time.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS N_("Array of IP addresses of DNS servers.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_PRIORITY N_("Intra-connection DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. For that, just specify the DNS servers in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_SEARCH N_("Array of DNS search domains.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES N_("Array of IP routes.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. On D-Bus, the absence of an addr-gen-mode setting equals enabling stable-privacy. For keyfile plugin, the absence of the setting on disk means EUI64 so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by \"ip6-privacy\" property and it does not affect the temporary addresses configured with this option.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES N_("Array of IP addresses.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or 3 seconds). A value greater than zero is a timeout in milliseconds.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS N_("Array of IP addresses of DNS servers.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_PRIORITY N_("Intra-connection DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. For that, just specify the DNS servers in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_SEARCH N_("Array of DNS search domains.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IP6_PRIVACY N_("Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address via modified EUI-64. This enhances privacy, but could cause problems in some applications, on the other hand. The permitted values are: -1: unknown, 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary addresses). Having a per-connection setting set to \"-1\" (unknown) means fallback to global configuration \"ipv6.ip6-privacy\". If also global configuration is unspecified or set to \"-1\", fallback to read \"/proc/sys/net/ipv6/conf/default/use_tempaddr\". Note that this setting is distinct from the Stable Privacy addresses that can be enabled with the \"addr-gen-mode\" property's \"stable-privacy\" setting as another way of avoiding host tracking with IPv6 addresses.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTES N_("Array of IP routes.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_TOKEN N_("Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 IPv6 tokenized interface identifiers. Useful with eui64 addr-gen-mode.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_ENCRYPT N_("Whether the transmitted traffic must be encrypted.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK N_("The pre-shared CAK (Connectivity Association Key) for MACsec Key Agreement.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK_FLAGS N_("Flags indicating how to handle the \"mka-cak\" property.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CKN N_("The pre-shared CKN (Connectivity-association Key Name) for MACsec Key Agreement.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MODE N_("Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key Agreement) is obtained.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MACSEC interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_PORT N_("The port component of the SCI (Secure Channel Identifier), between 1 and 65534.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_VALIDATION N_("Specifies the validation mode for incoming frames.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_MODE N_("The macvlan mode, which specifies the communication mechanism between multiple macvlans on the same lower device.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_FAIL_MODE N_("The bridge failure mode. One of \"secure\", \"standalone\" or empty.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_STP_ENABLE N_("Enable or disable STP.") +#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", or empty.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_PEER N_("Specifies the unicast destination IP address of a remote OpenVSwitch bridge port to connect to.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_DOWNDELAY N_("The time port must be inactive in order to be considered down.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_MODE N_("Bonding mode. One of \"active-backup\", \"balance-slb\", or \"balance-tcp\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_UPDELAY N_("The time port must be active befor it starts forwarding traffic.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_LACP N_("LACP mode. One of \"active\", \"off\", or \"passive\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_TAG N_("The VLAN tag in the range 0-4095.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_VLAN_MODE N_("The VLAN mode. One of \"access\", \"native-tagged\", \"native-untagged\", \"trunk\" or unset.") +#define DESCRIBE_DOC_NM_SETTING_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.") +#define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.") +#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_INTERVAL N_("If non-zero, instruct pppd to send an LCP echo-request frame to the peer every n seconds (where n is the specified value). Note that some PPP peers will respond to echo requests and some will not, and it is not possible to autodetect this.") +#define DESCRIBE_DOC_NM_SETTING_PPP_MPPE_STATEFUL N_("If TRUE, stateful MPPE is used. See pppd documentation for more information on stateful MPPE.") +#define DESCRIBE_DOC_NM_SETTING_PPP_MRU N_("If non-zero, instruct pppd to request that the peer send packets no larger than the specified size. If non-zero, the MRU should be between 128 and 16384.") +#define DESCRIBE_DOC_NM_SETTING_PPP_MTU N_("If non-zero, instruct pppd to send packets no larger than the specified size.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_PPP_NO_VJ_COMP N_("If TRUE, Van Jacobsen TCP header compression will not be requested.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NOAUTH N_("If TRUE, do not require the other side (usually the PPP server) to authenticate itself to the client. If FALSE, require authentication from the remote side. In almost all cases, this should be TRUE.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NOBSDCOMP N_("If TRUE, BSD compression will not be requested.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NODEFLATE N_("If TRUE, \"deflate\" compression will not be requested.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_CHAP N_("If TRUE, the CHAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_EAP N_("If TRUE, the EAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAP N_("If TRUE, the MSCHAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAPV2 N_("If TRUE, the MSCHAPv2 authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_PAP N_("If TRUE, the PAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE N_("If TRUE, MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session. If either 64-bit or 128-bit MPPE is not available the session will fail. Note that MPPE is not used on mobile broadband connections.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE_128 N_("If TRUE, 128-bit MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session, and the \"require-mppe\" property must also be set to TRUE. If 128-bit MPPE is not available the session will fail.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_PARENT N_("If given, specifies the parent interface name on which this PPPoE connection should be created. If this property is not specified, the connection is activated on the interface specified in \"interface-name\" of NMSettingConnection.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD N_("Password used to authenticate with the PPPoE service.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_SERVICE N_("If specified, instruct PPPoE to only initiate sessions with access concentrators that provide the specified service. For most providers, this should be left blank. It is only required if there are multiple access concentrators or a specific service is known to be required.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_USERNAME N_("Username used to authenticate with the PPPoE service.") +#define DESCRIBE_DOC_NM_SETTING_PROXY_BROWSER_ONLY N_("Whether the proxy configuration is for browser only.") +#define DESCRIBE_DOC_NM_SETTING_PROXY_METHOD N_("Method for proxy configuration, Default is NM_SETTING_PROXY_METHOD_NONE (0)") +#define DESCRIBE_DOC_NM_SETTING_PROXY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_SCRIPT N_("PAC script for the connection.") +#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_URL N_("PAC URL for obtaining PAC file.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_BAUD N_("Speed to use for communication over the serial port. Note that this value usually has no effect for mobile broadband modems as they generally ignore speed settings and use the highest available speed.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_BITS N_("Byte-width of the serial communication. The 8 in \"8n1\" for example.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_PARITY N_("Parity setting of the serial port.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_SEND_DELAY N_("Time to delay between each byte sent to the modem, in microseconds.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_STOPBITS N_("Number of stop bits for communication on the serial port. Either 1 or 2. The 1 in \"8n1\" for example.") +#define DESCRIBE_DOC_NM_SETTING_TEAM_CONFIG N_("The JSON configuration for the team network interface. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.") +#define DESCRIBE_DOC_NM_SETTING_TEAM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_CONFIG N_("The JSON configuration for the team port. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.") +#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_TUN_GROUP N_("The group ID which will own the device. If set to NULL everyone will be able to use the device.") +#define DESCRIBE_DOC_NM_SETTING_TUN_MODE N_("The operating mode of the virtual device. Allowed values are NM_SETTING_TUN_MODE_TUN (1) to create a layer 3 device and NM_SETTING_TUN_MODE_TAP (2) to create an Ethernet-like layer 2 one.") +#define DESCRIBE_DOC_NM_SETTING_TUN_MULTI_QUEUE N_("If the property is set to TRUE, the interface will support multiple file descriptors (queues) to parallelize packet sending or receiving. Otherwise, the interface will only support a single queue.") +#define DESCRIBE_DOC_NM_SETTING_TUN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_TUN_OWNER N_("The user ID which will own the device. If set to NULL everyone will be able to use the device.") +#define DESCRIBE_DOC_NM_SETTING_TUN_PI N_("If TRUE the interface will prepend a 4 byte header describing the physical interface to the packets.") +#define DESCRIBE_DOC_NM_SETTING_TUN_VNET_HDR N_("If TRUE the IFF_VNET_HDR the tunnel packets will include a virtio network header.") +#define DESCRIBE_DOC_NM_SETTING_USER_DATA N_("A dictionary of key/value pairs with user data. This data is ignored by NetworkManager and can be used at the users discretion. The keys only support a strict ascii format, but the values can be arbitrary UTF8 strings up to a certain length.") +#define DESCRIBE_DOC_NM_SETTING_USER_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_EGRESS_PRIORITY_MAP N_("For outgoing packets, a list of mappings from Linux SKB priorities to 802.1p priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_FLAGS N_("One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0.") +#define DESCRIBE_DOC_NM_SETTING_VLAN_ID N_("The VLAN identifier that the interface created by this connection should be assigned. The valid range is from 0 to 4094, without the reserved id 4095.") +#define DESCRIBE_DOC_NM_SETTING_VLAN_INGRESS_PRIORITY_MAP N_("For incoming packets, a list of mappings from 802.1p priorities to Linux SKB priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") +#define DESCRIBE_DOC_NM_SETTING_VPN_DATA N_("Dictionary of key/value pairs of VPN plugin specific data. Both keys and values must be strings.") +#define DESCRIBE_DOC_NM_SETTING_VPN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VPN_PERSISTENT N_("If the VPN service supports persistence, and this property is TRUE, the VPN will attempt to stay connected across link changes and outages, until explicitly disconnected.") +#define DESCRIBE_DOC_NM_SETTING_VPN_SECRETS N_("Dictionary of key/value pairs of VPN plugin specific secrets like passwords or private keys. Both keys and values must be strings.") +#define DESCRIBE_DOC_NM_SETTING_VPN_SERVICE_TYPE N_("D-Bus service name of the VPN plugin that this setting uses to connect to its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc plugin.") +#define DESCRIBE_DOC_NM_SETTING_VPN_TIMEOUT N_("Timeout for the VPN service to establish the connection. Some services may take quite a long time to connect. Value of 0 means a default timeout, which is 60 seconds (unless overridden by vpn.timeout in configuration file). Values greater than zero mean timeout in seconds.") +#define DESCRIBE_DOC_NM_SETTING_VPN_USER_NAME N_("If the VPN connection requires a user name for authentication, that name should be provided here. If the connection is available to more than one user, and the VPN requires each user to supply a different name, then leave this property empty. If this property is empty, NetworkManager will automatically supply the username of the user which requested the VPN connection.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_AGEING N_("Specifies the lifetime in seconds of FDB entries learnt by the kernel.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_DESTINATION_PORT N_("Specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_ID N_("Specifies the VXLAN Network Identifier (or VXLAN Segment Identifier) to use.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_L2_MISS N_("Specifies whether netlink LL ADDR miss notifications are generated.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_L3_MISS N_("Specifies whether netlink IP ADDR miss notifications are generated.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_LEARNING N_("Specifies whether unknown source link layer addresses and IP addresses are entered into the VXLAN device forwarding database.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_LIMIT N_("Specifies the maximum number of FDB entries. A value of zero means that the kernel will store unlimited entries.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_LOCAL N_("If given, specifies the source IP address to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_PROXY N_("Specifies whether ARP proxy is turned on.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_REMOTE N_("Specifies the unicast destination IP address to use in outgoing packets when the destination link layer address is not known in the VXLAN device forwarding database, or the multicast IP address to join.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_RSC N_("Specifies whether route short circuit is turned on.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MAX N_("Specifies the maximum UDP source port to communicate to the remote VXLAN tunnel endpoint.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MIN N_("Specifies the minimum UDP source port to communicate to the remote VXLAN tunnel endpoint.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_TOS N_("Specifies the TOS value to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_TTL N_("Specifies the time-to-live value to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_WIMAX_MAC_ADDRESS N_("If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1") +#define DESCRIBE_DOC_NM_SETTING_WIMAX_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIMAX_NETWORK_NAME N_("Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1") diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in new file mode 100644 index 00000000..b523a394 --- /dev/null +++ b/clients/common/settings-docs.c.in @@ -0,0 +1,363 @@ +/* Generated file. Do not edit. */ + +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_CHANNEL N_("Channel on which the mesh network to join is located.") +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS N_("Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request.") +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_SSID N_("SSID of the mesh network to join.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("802.11 frequency band of the network. One of \"a\" for 5GHz 802.11a or \"bg\" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if \"a\" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BSSID N_("If specified, directs the device to only associate with the given access point. This capability is highly driver dependent and not supported by all devices. Note: this property does not control the BSSID used when creating an Ad-Hoc network and is unlikely to in the future.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CHANNEL N_("Wireless channel to use for the Wi-Fi connection. The device will only join (or create for Ad-Hoc networks) a Wi-Fi network on the specified channel. Because channel numbers overlap between bands, this property also requires the \"band\" property to be set.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address of the device. \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_HIDDEN N_("If TRUE, indicates this network is a non-broadcasting network that hides its SSID. In this case various workarounds may take place, such as probe-scanning the SSID for more reliable network discovery. However, these workarounds expose inherent insecurities with hidden SSID networks, and thus hidden SSID networks should be used with caution.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS N_("If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST N_("A list of permanent MAC addresses of Wi-Fi devices to which this connection should never apply. Each MAC address should be given in the standard hex-digits-and-colons notation (eg \"00:11:22:33:44:55\").") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION N_("One of NM_SETTING_MAC_RANDOMIZATION_DEFAULT (0) (never randomize unless the user has set a global default to randomize and the supplicant supports randomization), NM_SETTING_MAC_RANDOMIZATION_NEVER (1) (never randomize the MAC address), or NM_SETTING_MAC_RANDOMIZATION_ALWAYS (2) (always randomize the MAC address). This property is deprecated for 'cloned-mac-address'. Deprecated: 1") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MODE N_("Wi-Fi network mode; one of \"infrastructure\", \"adhoc\" or \"ap\". If blank, infrastructure is assumed.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_POWERSAVE N_("One of NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2) (disable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_ENABLE (3) (enable Wi-Fi power saving), NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1) (don't touch currently configure setting) or NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0) (use the globally configured value). All other values are reserved.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_RATE N_("If non-zero, directs the device to only use the specified bitrate for communication with the access point. Units are in Kb/s, ie 5500 = 5.5 Mbit/s. This property is highly driver dependent and not all devices support setting a static bitrate.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SEEN_BSSIDS N_("A list of BSSIDs (each BSSID formatted as a MAC address like \"00:11:22:33:44:55\") that have been detected as part of the Wi-Fi network. NetworkManager internally tracks previously seen BSSIDs. The property is only meant for reading and reflects the BSSID list of NetworkManager. The changes you make to this property will not be preserved.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SSID N_("SSID of the Wi-Fi network. Must be specified.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_TX_POWER N_("If non-zero, directs the device to use the specified transmit power. Units are dBm. This property is highly driver dependent and not all devices support setting a static transmit power.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_AUTH_ALG N_("When WEP is used (ie, key-mgmt = \"none\" or \"ieee8021x\") indicate the 802.11 authentication algorithm required by the AP here. One of \"open\" for Open System, \"shared\" for Shared Key, or \"leap\" for Cisco LEAP. When using Cisco LEAP (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\") the \"leap-username\" and \"leap-password\" properties must be specified.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_GROUP N_("A list of group/broadcast encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"wep40\", \"wep104\", \"tkip\", or \"ccmp\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_KEY_MGMT N_("Key management used for the connection. One of \"none\" (WEP), \"ieee8021x\" (Dynamic WEP), \"wpa-none\" (Ad-Hoc WPA-PSK), \"wpa-psk\" (infrastructure WPA-PSK), or \"wpa-eap\" (WPA-Enterprise). This property must be set for any Wi-Fi connection that uses security.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD N_("The login password for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS N_("Flags indicating how to handle the \"leap-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME N_("The login username for legacy LEAP connections (ie, key-mgmt = \"ieee8021x\" and auth-alg = \"leap\").") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PAIRWISE N_("A list of pairwise encryption algorithms which prevents connections to Wi-Fi networks that do not utilize one of the algorithms in the list. For maximum compatibility leave this property empty. Each list element may be one of \"tkip\" or \"ccmp\".") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PMF N_("Indicates whether Protected Management Frames (802.11w) must be enabled for the connection. One of NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) (use global default value), NM_SETTING_WIRELESS_SECURITY_PMF_DISABLE (1) (disable PMF), NM_SETTING_WIRELESS_SECURITY_PMF_OPTIONAL (2) (enable PMF if the supplicant and the access point support it) or NM_SETTING_WIRELESS_SECURITY_PMF_REQUIRED (3) (enable PMF and fail if not supported). When set to NM_SETTING_WIRELESS_SECURITY_PMF_DEFAULT (0) and no global default is set, PMF will be optionally enabled.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PROTO N_("List of strings specifying the allowed WPA protocol versions to use. Each element may be one \"wpa\" (allow WPA) or \"rsn\" (allow WPA2/RSN). If not specified, both WPA and RSN connections are allowed.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK N_("Pre-Shared-Key for WPA networks. If the key is 64-characters long, it must contain only hexadecimal characters and is interpreted as a hexadecimal WPA key. Otherwise, the key must be between 8 and 63 ASCII characters (as specified in the 802.11i standard) and is interpreted as a WPA passphrase, and is hashed to derive the actual WPA-PSK used when connecting to the Wi-Fi network.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS N_("Flags indicating how to handle the \"psk\" property.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS N_("Flags indicating how to handle the \"wep-key0\", \"wep-key1\", \"wep-key2\", and \"wep-key3\" properties.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE N_("Controls the interpretation of WEP keys. Allowed values are NM_WEP_KEY_TYPE_KEY (1), in which case the key is either a 10- or 26-character hexadecimal string, or a 5- or 13-character ASCII password; or NM_WEP_KEY_TYPE_PASSPHRASE (2), in which case the passphrase is provided as a string and will be hashed using the de-facto MD5 method to derive the actual WEP key.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY0 N_("Index 0 WEP key. This is the WEP key used in most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY1 N_("Index 1 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY2 N_("Index 2 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_KEY3 N_("Index 3 WEP key. This WEP index is not used by most networks. See the \"wep-key-type\" property for a description of how this key is interpreted.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX N_("When static WEP is used (ie, key-mgmt = \"none\") and a non-default WEP key index is used by the AP, put that WEP key index here. Valid values are 0 (default key) through 3. Note that some consumer access points (like the Linksys WRT54G) number the keys 1 - 4.") +#define DESCRIBE_DOC_NM_SETTING_WIRELESS_SECURITY_WPS_METHOD N_("Flags indicating which mode of WPS is to be used if any. There's little point in changing the default setting as NetworkManager will automatically determine whether it's feasible to start WPS enrollment from the Access Point capabilities. WPS can be disabled by setting this property to a value of 1.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server. If the list is empty, no verification of the server certificate's altSubjectName is performed.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_ANONYMOUS_IDENTITY N_("Anonymous identity string for EAP authentication methods. Used as the unencrypted identity with EAP types that support different tunneled identity like EAP-TTLS.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_AUTH_TIMEOUT N_("A timeout for the authentication. Zero means the global default; if the global default is not set, the authentication timeout is 25 seconds.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT N_("Contains the CA certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD N_("The password used to access the CA certificate stored in \"ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"ca-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"ca-cert\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT N_("Contains the client certificate if used by the EAP method specified in the \"eap\" property. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD N_("The password used to access the client certificate stored in \"client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"client-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_EAP N_("The allowed EAP method to be used when authenticating to the network with 802.1x. Valid methods are: \"leap\", \"md5\", \"tls\", \"peap\", \"ttls\", \"pwd\", and \"fast\". Each method requires different configuration using the properties of this setting; refer to wpa_supplicant documentation for the allowed combinations.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_IDENTITY N_("Identity string for EAP authentication methods. Often the user's user or login name.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PAC_FILE N_("UTF-8 encoded file path containing PAC for EAP-FAST.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD N_("UTF-8 encoded password used for EAP authentication methods. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW N_("Password used for EAP authentication methods, given as a byte array to allow passwords in other encodings than UTF-8 to be used. If both the \"password\" property and the \"password-raw\" property are specified, \"password\" is preferred.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PASSWORD_RAW_FLAGS N_("Flags indicating how to handle the \"password-raw\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_AUTH_FLAGS N_("Specifies authentication flags to use in \"phase 1\" outer authentication using NMSetting8021xAuthFlags options. The individual TLS versions can be explicitly disabled. If a certain TLS disable flag is not set, it is up to the supplicant to allow or forbid it. The TLS options map to tls_disable_tlsv1_x settings. See the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING N_("Enables or disables in-line provisioning of EAP-FAST credentials when FAST is specified as the EAP method in the \"eap\" property. Recognized values are \"0\" (disabled), \"1\" (allow unauthenticated provisioning), \"2\" (allow authenticated provisioning), and \"3\" (allow both authenticated and unauthenticated provisioning). See the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPLABEL N_("Forces use of the new PEAP label during key derivation. Some RADIUS servers may require forcing the new PEAP label to interoperate with PEAPv1. Set to \"1\" to force use of the new PEAP label. See the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE1_PEAPVER N_("Forces which PEAP version is used when PEAP is set as the EAP method in the \"eap\" property. When unset, the version reported by the server will be used. Sometimes when using older RADIUS servers, it is necessary to force the client to use a particular PEAP version. To do so, this property may be set to \"0\" or \"1\" to force that specific PEAP version.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES N_("List of strings to be matched against the altSubjectName of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If the list is empty, no verification of the server certificate's altSubjectName is performed.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTH N_("Specifies the allowed \"phase 2\" inner non-EAP authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized non-EAP \"phase 2\" methods are \"pap\", \"chap\", \"mschap\", \"mschapv2\", \"gtc\", \"otp\", \"md5\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_AUTHEAP N_("Specifies the allowed \"phase 2\" inner EAP-based authentication methods when an EAP method that uses an inner TLS tunnel is specified in the \"eap\" property. Recognized EAP-based \"phase 2\" methods are \"md5\", \"mschapv2\", \"otp\", \"gtc\", and \"tls\". Each \"phase 2\" inner method requires specific parameters for successful authentication; see the wpa_supplicant documentation for more details.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT N_("Contains the \"phase 2\" CA certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD N_("The password used to access the \"phase2\" CA certificate stored in \"phase2-ca-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-ca-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CA_PATH N_("UTF-8 encoded path to a directory containing PEM or DER formatted certificates to be added to the verification chain in addition to the certificate specified in the \"phase2-ca-cert\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT N_("Contains the \"phase 2\" client certificate if used by the EAP method specified in the \"phase2-auth\" or \"phase2-autheap\" properties. Certificate data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme (which is backwards compatible with NM 0.7.x) this property should be set to the certificate's DER encoded data. When using the path scheme, this property should be set to the full UTF-8 encoded path of the certificate, prefixed with the string \"file://\" and ending with a terminating NUL byte. This property can be unset even if the EAP method supports CA certificates, but this allows man-in-the-middle attacks and is NOT recommended.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD N_("The password used to access the \"phase2\" client certificate stored in \"phase2-client-cert\" property. Only makes sense if the certificate is stored on a PKCS#11 token that requires a login.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_CLIENT_CERT_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-client-cert-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH N_("Constraint for server domain name. If set, this FQDN is used as a suffix match requirement for dNSName element(s) of the certificate presented by the authentication server during the inner \"phase 2\" authentication. If a matching dNSName is found, this constraint is met. If no dNSName values are present, this constraint is matched against SubjectName CN using same suffix match comparison.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY N_("Contains the \"phase 2\" inner private key when the \"phase2-auth\" or \"phase2-autheap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"phase2-private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"phase2-private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the \"phase 2\" private key specified in the \"phase2-private-key\" property when the private key either uses the path scheme, or is a PKCS#12 format key.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"phase2-private-key-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server during the inner \"phase 2\" authentication. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:phase2-domain-suffix-match.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN N_("PIN used for EAP authentication methods.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY N_("Contains the private key when the \"eap\" property is set to \"tls\". Key data is specified using a \"scheme\"; two are currently supported: blob and path. When using the blob scheme and private keys, this property should be set to the key's encrypted PEM encoded data. When using private keys with the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte. When using PKCS#12 format private keys and the blob scheme, this property should be set to the PKCS#12 data and the \"private-key-password\" property must be set to password used to decrypt the PKCS#12 certificate and key. When using PKCS#12 files and the path scheme, this property should be set to the full UTF-8 encoded path of the key, prefixed with the string \"file://\" and ending with a terminating NUL byte, and as with the blob scheme the \"private-key-password\" property must be set to the password used to decode the PKCS#12 private key and certificate. WARNING: \"private-key\" is not a \"secret\" property, and thus unencrypted private key data using the BLOB scheme may be readable by unprivileged users. Private keys should always be encrypted with a private key password to prevent unauthorized access to unencrypted private key data.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD N_("The password used to decrypt the private key specified in the \"private-key\" property when the private key either uses the path scheme, or if the private key is a PKCS#12 format key.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS N_("Flags indicating how to handle the \"private-key-password\" property.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_SUBJECT_MATCH N_("Substring to be matched against the subject of the certificate presented by the authentication server. When unset, no verification of the authentication server certificate's subject is performed. This property provides little security, if any, and its use is deprecated in favor of NMSetting8021x:domain-suffix-match.") +#define DESCRIBE_DOC_NM_SETTING_802_1X_SYSTEM_CA_CERTS N_("When TRUE, overrides the \"ca-path\" and \"phase2-ca-path\" properties using the system CA directory specified at configure time with the --system-ca-path switch. The certificates in this directory are added to the verification chain in addition to any certificates specified by the \"ca-cert\" and \"phase2-ca-cert\" properties. If the path provided with --system-ca-path is rather a file name (bundle of trusted CA certificates), it overrides \"ca-cert\" and \"phase2-ca-cert\" properties instead (sets ca_cert/ca_cert2 options for wpa_supplicant).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_AUTO_NEGOTIATE N_("If TRUE, enforce auto-negotiation of port speed and duplex mode. If FALSE, \"speed\" and \"duplex\" properties should be both set or link configuration will be skipped.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_CLONED_MAC_ADDRESS N_("If specified, request that the device use this MAC address instead. This is known as MAC cloning or spoofing. Beside explicitly specifying a MAC address, the special values \"preserve\", \"permanent\", \"random\" and \"stable\" are supported. \"preserve\" means not to touch the MAC address on activation. \"permanent\" means to use the permanent hardware address if the device has one (otherwise this is treated as \"preserve\"). \"random\" creates a random MAC address on each connect. \"stable\" creates a hashed MAC address based on connection.stable-id and a machine dependent key. If unspecified, the value can be overwritten via global defaults, see manual of NetworkManager.conf. If still unspecified, it defaults to \"preserve\" (older versions of NetworkManager may use a different default value). On D-Bus, this field is expressed as \"assigned-mac-address\" or the deprecated \"cloned-mac-address\".") +#define DESCRIBE_DOC_NM_SETTING_WIRED_DUPLEX N_("Can be specified only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified duplex mode, either \"half\" or \"full\". Must be set together with the \"speed\" property if specified. Before specifying a duplex mode be sure your device supports it.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK N_("With \"cloned-mac-address\" setting \"random\" or \"stable\", by default all bits of the MAC address are scrambled and a locally-administered, unicast MAC address is created. This property allows to specify that certain bits are fixed. Note that the least significant bit of the first MAC address will always be unset to create a unicast MAC address. If the property is NULL, it is eligible to be overwritten by a default connection setting. If the value is still NULL or an empty string, the default is to create a locally-administered, unicast MAC address. If the value contains one MAC address, this address is used as mask. The set bits of the mask are to be filled with the current MAC address of the device, while the unset bits are subject to randomization. Setting \"FE:FF:FF:00:00:00\" means to preserve the OUI of the current MAC address and only randomize the lower 3 bytes using the \"random\" or \"stable\" algorithm. If the value contains one additional MAC address after the mask, this address is used instead of the current MAC address to fill the bits that shall not be randomized. For example, a value of \"FE:FF:FF:00:00:00 68:F7:28:00:00:00\" will set the OUI of the MAC address to 68:F7:28, while the lower bits are randomized. A value of \"02:00:00:00:00:00 00:00:00:00:00:00\" will create a fully scrambled globally-administered, burned-in MAC address. If the value contains more than one additional MAC addresses, one of them is chosen randomly. For example, \"02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00\" will create a fully scrambled MAC address, randomly locally or globally administered.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS N_("If specified, this connection will only apply to the Ethernet device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST N_("If specified, this connection will never apply to the Ethernet device whose permanent MAC address matches an address in the list. Each MAC address is in the standard hex-digits-and-colons notation (00:11:22:33:44:55).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple Ethernet frames.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIRED_PORT N_("Specific port type to use if the device supports multiple attachment methods. One of \"tp\" (Twisted Pair), \"aui\" (Attachment Unit Interface), \"bnc\" (Thin Ethernet) or \"mii\" (Media Independent Interface). If the device supports only one port type, this setting is ignored.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_NETTYPE N_("s390 network device type; one of \"qeth\", \"lcs\", or \"ctc\", representing the different types of virtual network devices available on s390 systems.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_OPTIONS N_("Dictionary of key/value pairs of s390-specific device options. Both keys and values must be strings. Allowed keys include \"portno\", \"layer2\", \"portname\", \"protocol\", among others. Key names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_S390_SUBCHANNELS N_("Identifies specific subchannels that this network device uses for communication with z/VM or s390 host. Like the \"mac-address\" property for non-z/VM devices, this property can be used to ensure this connection only applies to the network device that uses these subchannels. The list should contain exactly 3 strings, and each string may only be composed of hexadecimal characters and the period (.) character.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_SPEED N_("Can be set to a value greater than zero only when \"auto-negotiate\" is \"off\". In that case, statically configures the device to use that specified speed. In Mbit/s, ie 100 == 100Mbit/s. Must be set together with the \"duplex\" property when non-zero. Before specifying a speed value be sure your device supports it.") +#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN N_("The NMSettingWiredWakeOnLan options to enable. Not all devices support all options. May be any combination of NM_SETTING_WIRED_WAKE_ON_LAN_PHY (0x2), NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST (0x4), NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST (0x8), NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST (0x10), NM_SETTING_WIRED_WAKE_ON_LAN_ARP (0x20), NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC (0x40) or the special values NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (0x1) (to use global settings) and NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (0x8000) (to disable management of Wake-on-LAN in NetworkManager).") +#define DESCRIBE_DOC_NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD N_("If specified, the password used with magic-packet-based Wake-on-LAN, represented as an Ethernet MAC address. If NULL, no password will be required.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_ENCAPSULATION N_("Encapsulation of ADSL connection. Can be \"vcmux\" or \"llc\".") +#define DESCRIBE_DOC_NM_SETTING_ADSL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD N_("Password used to authenticate with the ADSL service.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_PROTOCOL N_("ADSL connection protocol. Can be \"pppoa\", \"pppoe\" or \"ipoatm\".") +#define DESCRIBE_DOC_NM_SETTING_ADSL_USERNAME N_("Username used to authenticate with the ADSL service.") +#define DESCRIBE_DOC_NM_SETTING_ADSL_VCI N_("VCI of ADSL connection") +#define DESCRIBE_DOC_NM_SETTING_ADSL_VPI N_("VPI of ADSL connection") +#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_BDADDR N_("The Bluetooth address of the device.") +#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BLUETOOTH_TYPE N_("Either \"dun\" for Dial-Up Networking connections or \"panu\" for Personal Area Networking connections to devices supporting the NAP profile.") +#define DESCRIBE_DOC_NM_SETTING_BOND_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BOND_OPTIONS N_("Dictionary of key/value pairs of bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters (ie, [a-zA-Z0-9]).") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_AGEING_TIME N_("The Ethernet MAC address aging time, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_FORWARD_DELAY N_("The Spanning Tree Protocol (STP) forwarding delay, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_GROUP_FORWARD_MASK N_("A mask of group addresses to forward. Usually, group addresses in the range from 01:80:C2:00:00:00 to 01:80:C2:00:00:0F are not forwarded according to standards. This property is a mask of 16 bits, each corresponding to a group address in that range that must be forwarded. The mask can't have bits 0, 1 or 2 set because they are used for STP, MAC pause frames and LACP.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_HELLO_TIME N_("The Spanning Tree Protocol (STP) hello time, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAC_ADDRESS N_("If specified, the MAC address of bridge. When creating a new bridge, this MAC address will be set. If this field is left unspecified, the \"ethernet.cloned-mac-address\" is referred instead to generate the initial MAC address. Note that setting \"ethernet.cloned-mac-address\" anyway overwrites the MAC address of the bridge later while activating the bridge. Hence, this property is deprecated.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MAX_AGE N_("The Spanning Tree Protocol (STP) maximum message age, in seconds.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_MULTICAST_SNOOPING N_("Controls whether IGMP snooping is enabled for this bridge. Note that if snooping was automatically disabled due to hash collisions, the system may refuse to enable the feature until the collisions are resolved.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PRIORITY N_("Sets the Spanning Tree Protocol (STP) priority for this bridge. Lower values are \"better\"; the lowest priority bridge will be elected the root bridge.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_STP N_("Controls whether Spanning Tree Protocol (STP) is enabled for this bridge.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_HAIRPIN_MODE N_("Enables or disables \"hairpin mode\" for the port, which allows frames to be sent back out through the port the frame was received on.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PATH_COST N_("The Spanning Tree Protocol (STP) port cost for destinations via this port.") +#define DESCRIBE_DOC_NM_SETTING_BRIDGE_PORT_PRIORITY N_("The Spanning Tree Protocol (STP) priority of this bridge port.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_CDMA_NUMBER N_("The number to dial to establish the connection to the CDMA-based mobile broadband network, if any. If not specified, the default number (#777) is used when required.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_CDMA_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTH_RETRIES N_("The number of retries for the authentication. Zero means to try indefinitely; -1 means to use a global default. If the global default is not set, the authentication retries for 3 times before failing the connection. Currently this only applies to 802-1x authentication.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT N_("Whether or not the connection should be automatically connected by NetworkManager when the resources for the connection are available. TRUE to automatically activate the connection, FALSE to require manual intervention to activate the connection.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY N_("The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES N_("The number of times a connection should be tried when autoactivating before giving up. Zero means forever, -1 means the global default (4 times if not overridden). Setting this to 1 means to try activation only once before blocking autoconnect. Note that after a timeout, NetworkManager will try to autoconnect again.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES N_("Whether or not slaves of this connection should be automatically brought up when NetworkManager activates this connection. This only has a real effect for master connections. The permitted values are: 0: leave slave connections untouched, 1: activate all the slave connections with this connection, -1: default. If -1 (default) is set, global connection.autoconnect-slaves is read to determine the real value. If it is default as well, this fallbacks to 0.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT N_("If greater than zero, delay success of IP addressing until either the timeout is reached, or an IP gateway replies to a ping.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ID N_("A human readable unique identifier for the connection, like \"Work Wi-Fi\" or \"T-Mobile 3G\".") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_INTERFACE_NAME N_("The name of the network interface this connection is bound to. If not set, then the connection can be attached to any interface of the appropriate type (subject to restrictions imposed by other settings). For software devices this specifies the name of the created device. For connection types where interface names cannot easily be made persistent (e.g. mobile broadband or USB Ethernet), this property should not be used. Setting this property restricts the interfaces a connection can be used with, and if interface names change or are reordered the connection may be applied to the wrong interface.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_LLDP N_("Whether LLDP is enabled for the connection.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_MASTER N_("Interface name of the master device or UUID of the master connection.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_METERED N_("Whether the connection is metered. When updating this property on a currently activated connection, the change takes effect immediately.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_PERMISSIONS N_("An array of strings defining what access a given user has to this connection. If this is NULL or empty, all users are allowed to access this connection; otherwise users are allowed if and only if they are in this list. When this is not empty, the connection can be active only when one of the specified users is logged into an active session. Each entry is of the form \"[type]:[id]:[reserved]\"; for example, \"user:dcbw:blah\". At this time only the \"user\" [type] is allowed. Any other values are ignored and reserved for future use. [id] is the username that this permission refers to, which may not contain the \":\" character. Any [reserved] information present must be ignored and is reserved for future use. All of [type], [id], and [reserved] must be valid UTF-8.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_READ_ONLY N_("FALSE if the connection can be modified using the provided settings service's D-Bus interface with the right privileges, or TRUE if the connection is read-only and cannot be modified.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SECONDARIES N_("List of connection UUIDs that should be activated when the base connection itself is activated. Currently only VPN connections are supported.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_SLAVE_TYPE N_("Setting name of the device type of this slave's master connection (eg, \"bond\"), or NULL if this connection is not a slave.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_STABLE_ID N_("Token to generate stable IDs for the connection. The stable-id is used for generating IPv6 stable private addresses with ipv6.addr-gen-mode=stable-privacy. It is also used to seed the generated cloned MAC address for ethernet.cloned-mac-address=stable and wifi.cloned-mac-address=stable. Note that also the interface name of the activating connection and a per-host secret key is included into the address generation so that the same stable-id on different hosts/devices yields different addresses. If the value is unset, an ID unique for the connection is used. Specifying a stable-id allows multiple connections to generate the same addresses. Another use is to generate IDs at runtime via dynamic substitutions. The '$' character is treated special to perform dynamic substitutions at runtime. Currently supported are \"${CONNECTION}\", \"${BOOT}\", \"${RANDOM}\". These effectively create unique IDs per-connection, per-boot, or every time. Any unrecognized patterns following '$' are treated verbatim, however are reserved for future use. You are thus advised to avoid '$' or escape it as \"$$\". For example, set it to \"${CONNECTION}/${BOOT}\" to create a unique id for this connection that changes with every reboot. Note that two connections only use the same effective id if their stable-id is also identical before performing dynamic substitutions.") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TIMESTAMP N_("The time, in seconds since the Unix Epoch, that the connection was last _successfully_ fully activated. NetworkManager updates the connection timestamp periodically when the connection is active to ensure that an active connection has the latest timestamp. The property is only meant for reading (changes to this property will not be preserved).") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_TYPE N_("Base type of the connection. For hardware-dependent connections, should contain the setting name of the hardware-type specific setting (ie, \"802-3-ethernet\" or \"802-11-wireless\" or \"bluetooth\", etc), and for non-hardware dependent connections like VPN or otherwise, should contain the setting name of that setting type (ie, \"vpn\" or \"bridge\", etc).") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_UUID N_("A universally unique identifier for the connection, for example generated with libuuid. It should be assigned when the connection is created, and never changed as long as the connection still applies to the same network. For example, it should not be changed when the \"id\" property or NMSettingIP4Config changes, but might need to be re-created when the Wi-Fi SSID, mobile broadband network provider, or \"type\" property changes. The UUID must be in the format \"2815492f-7e56-435e-b2e9-246bd7cdc664\" (ie, contains only hexadecimal characters and \"-\").") +#define DESCRIBE_DOC_NM_SETTING_CONNECTION_ZONE N_("The trust level of a the connection. Free form case-insensitive string (for example \"Home\", \"Work\", \"Public\"). NULL or unspecified zone means the connection will be placed in the default zone as defined by the firewall. When updating this property on a currently activated connection, the change takes effect immediately.") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FCoE application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_MODE N_("The FCoE controller mode; either \"fabric\" (default) or \"vn2vn\".") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FCOE_PRIORITY N_("The highest User Priority (0 - 7) which FCoE frames should use, or -1 for default priority. Only used when the \"app-fcoe-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB FIP application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_FIP_PRIORITY N_("The highest User Priority (0 - 7) which FIP frames should use, or -1 for default priority. Only used when the \"app-fip-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_FLAGS N_("Specifies the NMSettingDcbFlags for the DCB iSCSI application. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_APP_ISCSI_PRIORITY N_("The highest User Priority (0 - 7) which iSCSI frames should use, or -1 for default priority. Only used when the \"app-iscsi-flags\" property includes the NM_SETTING_DCB_FLAG_ENABLE (0x1) flag.") +#define DESCRIBE_DOC_NM_SETTING_DCB_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the percentage of bandwidth of the priority's assigned group that the priority may use. The sum of all percentages for priorities which belong to the same group must total 100 percents.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the corresponding priority should transmit priority pause.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Flow Control (PFC). Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH N_("An array of 8 uint values, where the array index corresponds to the Priority Group ID (0 - 7) and the value indicates the percentage of link bandwidth allocated to that group. Allowed values are 0 - 100, and the sum of all values must total 100 percents.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_FLAGS N_("Specifies the NMSettingDcbFlags for DCB Priority Groups. Flags may be any combination of NM_SETTING_DCB_FLAG_ENABLE (0x1), NM_SETTING_DCB_FLAG_ADVERTISE (0x2), and NM_SETTING_DCB_FLAG_WILLING (0x4).") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_GROUP_ID N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the Priority Group ID. Allowed Priority Group ID values are 0 - 7 or 15 for the unrestricted group.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH N_("An array of 8 boolean values, where the array index corresponds to the User Priority (0 - 7) and the value indicates whether or not the priority may use all of the bandwidth allocated to its assigned group.") +#define DESCRIBE_DOC_NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS N_("An array of 8 uint values, where the array index corresponds to the User Priority (0 - 7) and the value indicates the traffic class (0 - 7) to which the priority is mapped.") +#define DESCRIBE_DOC_NM_SETTING_DUMMY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_GENERIC_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_GSM_APN N_("The GPRS Access Point Name specifying the APN used when establishing a data session with the GSM-based network. The APN often determines how the user will be billed for their network usage and whether the user has access to the Internet or just a provider-specific walled-garden, so it is important to use the correct APN for the user's mobile broadband plan. The APN may only be composed of the characters a-z, 0-9, ., and - per GSM 03.60 Section 14.9.") +#define DESCRIBE_DOC_NM_SETTING_GSM_DEVICE_ID N_("The device unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will only apply to the specified device.") +#define DESCRIBE_DOC_NM_SETTING_GSM_HOME_ONLY N_("When TRUE, only connections to the home network will be allowed. Connections to roaming networks will not be made.") +#define DESCRIBE_DOC_NM_SETTING_GSM_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") +#define DESCRIBE_DOC_NM_SETTING_GSM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_GSM_NETWORK_ID N_("The Network ID (GSM LAI format, ie MCC-MNC) to force specific network registration. If the Network ID is specified, NetworkManager will attempt to force the device to register only on the specified network. This can be used to ensure that the device does not roam when direct roaming control of the device is not otherwise possible.") +#define DESCRIBE_DOC_NM_SETTING_GSM_NUMBER N_("Number to dial when establishing a PPP data session with the GSM-based mobile broadband network. Many modems do not require PPP for connections to the mobile network and thus this property should be left blank, which allows NetworkManager to select the appropriate settings automatically.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD N_("The password used to authenticate with the network, if required. Many providers do not require a password, or accept any password. But if a password is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PIN N_("If the SIM is locked with a PIN it must be unlocked before any other operations are requested. Specify the PIN here to allow operation of the device.") +#define DESCRIBE_DOC_NM_SETTING_GSM_PIN_FLAGS N_("Flags indicating how to handle the \"pin\" property.") +#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_ID N_("The SIM card unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" which contains a SIM card matching the given identifier.") +#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_OPERATOR_ID N_("A MCC/MNC string like \"310260\" or \"21601\" identifying the specific mobile network operator which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" and \"sim-id\" which contains a SIM card provisioned by the given operator.") +#define DESCRIBE_DOC_NM_SETTING_GSM_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MAC_ADDRESS N_("If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_P_KEY N_("The InfiniBand P_Key to use for this device. A value of -1 means to use the default P_Key (aka \"the P_Key at index 0\"). Otherwise it is a 16-bit unsigned integer, whose high bit is set if it is a \"full membership\" P_Key.") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_PARENT N_("The interface name of the parent device of this device. Normally NULL, but if the \"p_key\" property is set, then you must specify the base device by setting either this property or \"mac-address\".") +#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_TRANSPORT_MODE N_("The IP-over-InfiniBand transport mode. Either \"datagram\" or \"connected\".") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_ENCAPSULATION_LIMIT N_("How many additional levels of encapsulation are permitted to be prepended to packets. This property applies only to IPv6 tunnels.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_FLOW_LABEL N_("The flow label to assign to tunnel packets. This property applies only to IPv6 tunnels.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_INPUT_KEY N_("The key used for tunnel input packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_LOCAL N_("The local endpoint of the tunnel; the value can be empty, otherwise it must contain an IPv4 or IPv6 address.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MODE N_("The tunneling mode, for example NM_IP_TUNNEL_MODE_IPIP (1) or NM_IP_TUNNEL_MODE_GRE (2).") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple fragments.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_OUTPUT_KEY N_("The key used for tunnel output packets; the property is valid only for certain tunnel modes (GRE, IP6GRE). If empty, no key is used.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PARENT N_("If given, specifies the parent interface name or parent connection UUID the new device will be bound to so that tunneled packets will only be routed via that interface.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_PATH_MTU_DISCOVERY N_("Whether to enable Path MTU Discovery on this tunnel.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_REMOTE N_("The remote endpoint of the tunnel; the value must contain an IPv4 or IPv6 address.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TOS N_("The type of service (IPv4) or traffic class (IPv6) field to be set on tunneled packets.") +#define DESCRIBE_DOC_NM_SETTING_IP_TUNNEL_TTL N_("The TTL to assign to tunneled packets. 0 is a special value meaning that packets inherit the TTL value.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES N_("Array of IP addresses.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or 3 seconds). A value greater than zero is a timeout in milliseconds.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID N_("A string sent to the DHCP server to identify the local machine which the DHCP server may use to customize the DHCP lease and options. When the property is a hex string ('aa:bb:cc') it is interpreted as a binary client ID, in which case the first byte is assumed to be the 'type' field as per RFC 2132 section 9.14 and the remaining bytes may be an hardware address (e.g. '01:xx:xx:xx:xx:xx:xx' where 1 is the Ethernet ARP type and the rest is a MAC address). If the property is not a hex string it is considered as a non-hardware-address client ID and the 'type' field is set to 0.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_FQDN N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified FQDN will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-hostname\" are mutually exclusive and cannot be set at the same time.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS N_("Array of IP addresses of DNS servers.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_PRIORITY N_("Intra-connection DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. For that, just specify the DNS servers in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DNS_SEARCH N_("Array of DNS search domains.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES N_("Array of IP routes.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. On D-Bus, the absence of an addr-gen-mode setting equals enabling stable-privacy. For keyfile plugin, the absence of the setting on disk means EUI64 so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by \"ip6-privacy\" property and it does not affect the temporary addresses configured with this option.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES N_("Array of IP addresses.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or 3 seconds). A value greater than zero is a timeout in milliseconds.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME N_("If the \"dhcp-send-hostname\" property is TRUE, then the specified name will be sent to the DHCP server when acquiring a lease. This property and \"dhcp-fqdn\" are mutually exclusive and cannot be set at the same time.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_SEND_HOSTNAME N_("If TRUE, a hostname is sent to the DHCP server when acquiring a lease. Some DHCP servers use this hostname to update DNS databases, essentially providing a static hostname for the computer. If the \"dhcp-hostname\" property is NULL and this property is TRUE, the current persistent hostname of the computer is sent.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_TIMEOUT N_("A timeout for a DHCP transaction in seconds.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS N_("Array of IP addresses of DNS servers.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_OPTIONS N_("Array of DNS options as described in man 5 resolv.conf. NULL means that the options are unset and left at the default. In this case NetworkManager will use default options. This is distinct from an empty list of properties.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_PRIORITY N_("Intra-connection DNS priority. The relative priority to be used when determining the order of DNS servers in resolv.conf. A lower value means that servers will be on top of the file. Zero selects the default value, which is 50 for VPNs and 100 for other connections. Note that the priority is to order DNS settings for multiple active connections. It does not disambiguate multiple DNS servers within the same connection profile. For that, just specify the DNS servers in the desired order. When multiple devices have configurations with the same priority, the one with an active default route will be preferred. Note that when using dns=dnsmasq the order is meaningless since dnsmasq forwards queries to all known servers at the same time. Negative values have the special effect of excluding other configurations with a greater priority value; so in presence of at least a negative priority, only DNS servers from connections with the lowest priority value will be used.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DNS_SEARCH N_("Array of DNS search domains.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_GATEWAY N_("The gateway associated with this configuration. This is only meaningful if \"addresses\" is also set.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured nameservers and search domains are ignored and only nameservers and search domains specified in the \"dns\" and \"dns-search\" properties, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES N_("When \"method\" is set to \"auto\" and this property to TRUE, automatically configured routes are ignored and only routes specified in the \"routes\" property, if any, are used.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_IP6_PRIVACY N_("Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address via modified EUI-64. This enhances privacy, but could cause problems in some applications, on the other hand. The permitted values are: -1: unknown, 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary addresses). Having a per-connection setting set to \"-1\" (unknown) means fallback to global configuration \"ipv6.ip6-privacy\". If also global configuration is unspecified or set to \"-1\", fallback to read \"/proc/sys/net/ipv6/conf/default/use_tempaddr\". Note that this setting is distinct from the Stable Privacy addresses that can be enabled with the \"addr-gen-mode\" property's \"stable-privacy\" setting as another way of avoiding host tracking with IPv6 addresses.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MAY_FAIL N_("If TRUE, allow overall network configuration to proceed even if the configuration specified by this property times out. Note that at least one IP configuration must succeed or overall network configuration will still fail. For example, in IPv6-only networks, setting this property to TRUE on the NMSettingIP4Config allows the overall network configuration to succeed if IPv4 configuration fails but IPv6 configuration completes successfully.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_METHOD N_("IP configuration method. NMSettingIP4Config and NMSettingIP6Config both support \"auto\", \"manual\", and \"link-local\". See the subclass-specific documentation for other values. In general, for the \"auto\" method, properties such as \"dns\" and \"routes\" specify information that is added on to the information returned from automatic configuration. The \"ignore-auto-routes\" and \"ignore-auto-dns\" properties modify this behavior. For methods that imply no upstream network, such as \"shared\" or \"link-local\", these properties must be empty. For IPv4 method \"shared\", the IP subnet can be configured by adding one manual IPv4 address or otherwise 10.42.x.0/24 is chosen.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_NEVER_DEFAULT N_("If TRUE, this connection will never be the default connection for this IP type, meaning it will never be assigned the default route by NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_METRIC N_("The default metric for routes that don't explicitly specify a metric. The default value -1 means that the metric is chosen automatically based on the device type. The metric applies to dynamic routes, manual (static) routes that don't have an explicit metric setting, address prefix routes, and the default route. Note that for IPv6, the kernel accepts zero (0) but coerces it to 1024 (user default). Hence, setting this property to zero effectively mean setting it to 1024. For IPv4, zero is a regular value for the metric.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ROUTES N_("Array of IP routes.") +#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_TOKEN N_("Configure the token for draft-chown-6man-tokenised-ipv6-identifiers-02 IPv6 tokenized interface identifiers. Useful with eui64 addr-gen-mode.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_ENCRYPT N_("Whether the transmitted traffic must be encrypted.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK N_("The pre-shared CAK (Connectivity Association Key) for MACsec Key Agreement.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CAK_FLAGS N_("Flags indicating how to handle the \"mka-cak\" property.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MKA_CKN N_("The pre-shared CKN (Connectivity-association Key Name) for MACsec Key Agreement.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_MODE N_("Specifies how the CAK (Connectivity Association Key) for MKA (MACsec Key Agreement) is obtained.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MACSEC interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_PORT N_("The port component of the SCI (Secure Channel Identifier), between 1 and 65534.") +#define DESCRIBE_DOC_NM_SETTING_MACSEC_VALIDATION N_("Specifies the validation mode for incoming frames.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_MODE N_("The macvlan mode, which specifies the communication mechanism between multiple macvlans on the same lower device.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this MAC-VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_PROMISCUOUS N_("Whether the interface should be put in promiscuous mode.") +#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_FAIL_MODE N_("The bridge failure mode. One of \"secure\", \"standalone\" or empty.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE N_("Enable or disable multicast snooping.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_RSTP_ENABLE N_("Enable or disable RSTP.") +#define DESCRIBE_DOC_NM_SETTING_OVS_BRIDGE_STP_ENABLE N_("Enable or disable STP.") +#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", or empty.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PATCH_PEER N_("Specifies the unicast destination IP address of a remote OpenVSwitch bridge port to connect to.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_DOWNDELAY N_("The time port must be inactive in order to be considered down.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_MODE N_("Bonding mode. One of \"active-backup\", \"balance-slb\", or \"balance-tcp\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_UPDELAY N_("The time port must be active befor it starts forwarding traffic.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_LACP N_("LACP mode. One of \"active\", \"off\", or \"passive\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_TAG N_("The VLAN tag in the range 0-4095.") +#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_VLAN_MODE N_("The VLAN mode. One of \"access\", \"native-tagged\", \"native-untagged\", \"trunk\" or unset.") +#define DESCRIBE_DOC_NM_SETTING_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.") +#define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.") +#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_INTERVAL N_("If non-zero, instruct pppd to send an LCP echo-request frame to the peer every n seconds (where n is the specified value). Note that some PPP peers will respond to echo requests and some will not, and it is not possible to autodetect this.") +#define DESCRIBE_DOC_NM_SETTING_PPP_MPPE_STATEFUL N_("If TRUE, stateful MPPE is used. See pppd documentation for more information on stateful MPPE.") +#define DESCRIBE_DOC_NM_SETTING_PPP_MRU N_("If non-zero, instruct pppd to request that the peer send packets no larger than the specified size. If non-zero, the MRU should be between 128 and 16384.") +#define DESCRIBE_DOC_NM_SETTING_PPP_MTU N_("If non-zero, instruct pppd to send packets no larger than the specified size.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_PPP_NO_VJ_COMP N_("If TRUE, Van Jacobsen TCP header compression will not be requested.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NOAUTH N_("If TRUE, do not require the other side (usually the PPP server) to authenticate itself to the client. If FALSE, require authentication from the remote side. In almost all cases, this should be TRUE.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NOBSDCOMP N_("If TRUE, BSD compression will not be requested.") +#define DESCRIBE_DOC_NM_SETTING_PPP_NODEFLATE N_("If TRUE, \"deflate\" compression will not be requested.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_CHAP N_("If TRUE, the CHAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_EAP N_("If TRUE, the EAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAP N_("If TRUE, the MSCHAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_MSCHAPV2 N_("If TRUE, the MSCHAPv2 authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REFUSE_PAP N_("If TRUE, the PAP authentication method will not be used.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE N_("If TRUE, MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session. If either 64-bit or 128-bit MPPE is not available the session will fail. Note that MPPE is not used on mobile broadband connections.") +#define DESCRIBE_DOC_NM_SETTING_PPP_REQUIRE_MPPE_128 N_("If TRUE, 128-bit MPPE (Microsoft Point-to-Point Encryption) will be required for the PPP session, and the \"require-mppe\" property must also be set to TRUE. If 128-bit MPPE is not available the session will fail.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_PARENT N_("If given, specifies the parent interface name on which this PPPoE connection should be created. If this property is not specified, the connection is activated on the interface specified in \"interface-name\" of NMSettingConnection.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD N_("Password used to authenticate with the PPPoE service.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_PASSWORD_FLAGS N_("Flags indicating how to handle the \"password\" property.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_SERVICE N_("If specified, instruct PPPoE to only initiate sessions with access concentrators that provide the specified service. For most providers, this should be left blank. It is only required if there are multiple access concentrators or a specific service is known to be required.") +#define DESCRIBE_DOC_NM_SETTING_PPPOE_USERNAME N_("Username used to authenticate with the PPPoE service.") +#define DESCRIBE_DOC_NM_SETTING_PROXY_BROWSER_ONLY N_("Whether the proxy configuration is for browser only.") +#define DESCRIBE_DOC_NM_SETTING_PROXY_METHOD N_("Method for proxy configuration, Default is NM_SETTING_PROXY_METHOD_NONE (0)") +#define DESCRIBE_DOC_NM_SETTING_PROXY_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_SCRIPT N_("PAC script for the connection.") +#define DESCRIBE_DOC_NM_SETTING_PROXY_PAC_URL N_("PAC URL for obtaining PAC file.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_BAUD N_("Speed to use for communication over the serial port. Note that this value usually has no effect for mobile broadband modems as they generally ignore speed settings and use the highest available speed.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_BITS N_("Byte-width of the serial communication. The 8 in \"8n1\" for example.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_PARITY N_("Parity setting of the serial port.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_SEND_DELAY N_("Time to delay between each byte sent to the modem, in microseconds.") +#define DESCRIBE_DOC_NM_SETTING_SERIAL_STOPBITS N_("Number of stop bits for communication on the serial port. Either 1 or 2. The 1 in \"8n1\" for example.") +#define DESCRIBE_DOC_NM_SETTING_TEAM_CONFIG N_("The JSON configuration for the team network interface. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.") +#define DESCRIBE_DOC_NM_SETTING_TEAM_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_CONFIG N_("The JSON configuration for the team port. The property should contain raw JSON configuration data suitable for teamd, because the value is passed directly to teamd. If not specified, the default configuration is used. See man teamd.conf for the format details.") +#define DESCRIBE_DOC_NM_SETTING_TEAM_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_TUN_GROUP N_("The group ID which will own the device. If set to NULL everyone will be able to use the device.") +#define DESCRIBE_DOC_NM_SETTING_TUN_MODE N_("The operating mode of the virtual device. Allowed values are NM_SETTING_TUN_MODE_TUN (1) to create a layer 3 device and NM_SETTING_TUN_MODE_TAP (2) to create an Ethernet-like layer 2 one.") +#define DESCRIBE_DOC_NM_SETTING_TUN_MULTI_QUEUE N_("If the property is set to TRUE, the interface will support multiple file descriptors (queues) to parallelize packet sending or receiving. Otherwise, the interface will only support a single queue.") +#define DESCRIBE_DOC_NM_SETTING_TUN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_TUN_OWNER N_("The user ID which will own the device. If set to NULL everyone will be able to use the device.") +#define DESCRIBE_DOC_NM_SETTING_TUN_PI N_("If TRUE the interface will prepend a 4 byte header describing the physical interface to the packets.") +#define DESCRIBE_DOC_NM_SETTING_TUN_VNET_HDR N_("If TRUE the IFF_VNET_HDR the tunnel packets will include a virtio network header.") +#define DESCRIBE_DOC_NM_SETTING_USER_DATA N_("A dictionary of key/value pairs with user data. This data is ignored by NetworkManager and can be used at the users discretion. The keys only support a strict ascii format, but the values can be arbitrary UTF8 strings up to a certain length.") +#define DESCRIBE_DOC_NM_SETTING_USER_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_EGRESS_PRIORITY_MAP N_("For outgoing packets, a list of mappings from Linux SKB priorities to 802.1p priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_FLAGS N_("One or more flags which control the behavior and features of the VLAN interface. Flags include NM_VLAN_FLAG_REORDER_HEADERS (0x1) (reordering of output packet headers), NM_VLAN_FLAG_GVRP (0x2) (use of the GVRP protocol), and NM_VLAN_FLAG_LOOSE_BINDING (0x4) (loose binding of the interface to its master device's operating state). NM_VLAN_FLAG_MVRP (0x8) (use of the MVRP protocol). The default value of this property is NM_VLAN_FLAG_REORDER_HEADERS, but it used to be 0. To preserve backward compatibility, the default-value in the D-Bus API continues to be 0 and a missing property on D-Bus is still considered as 0.") +#define DESCRIBE_DOC_NM_SETTING_VLAN_ID N_("The VLAN identifier that the interface created by this connection should be assigned. The valid range is from 0 to 4094, without the reserved id 4095.") +#define DESCRIBE_DOC_NM_SETTING_VLAN_INGRESS_PRIORITY_MAP N_("For incoming packets, a list of mappings from 802.1p priorities to Linux SKB priorities. The mapping is given in the format \"from:to\" where both \"from\" and \"to\" are unsigned integers, ie \"7:3\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this VLAN interface should be created. If this property is not specified, the connection must contain an \"802-3-ethernet\" setting with a \"mac-address\" property.") +#define DESCRIBE_DOC_NM_SETTING_VPN_DATA N_("Dictionary of key/value pairs of VPN plugin specific data. Both keys and values must be strings.") +#define DESCRIBE_DOC_NM_SETTING_VPN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VPN_PERSISTENT N_("If the VPN service supports persistence, and this property is TRUE, the VPN will attempt to stay connected across link changes and outages, until explicitly disconnected.") +#define DESCRIBE_DOC_NM_SETTING_VPN_SECRETS N_("Dictionary of key/value pairs of VPN plugin specific secrets like passwords or private keys. Both keys and values must be strings.") +#define DESCRIBE_DOC_NM_SETTING_VPN_SERVICE_TYPE N_("D-Bus service name of the VPN plugin that this setting uses to connect to its network. i.e. org.freedesktop.NetworkManager.vpnc for the vpnc plugin.") +#define DESCRIBE_DOC_NM_SETTING_VPN_TIMEOUT N_("Timeout for the VPN service to establish the connection. Some services may take quite a long time to connect. Value of 0 means a default timeout, which is 60 seconds (unless overridden by vpn.timeout in configuration file). Values greater than zero mean timeout in seconds.") +#define DESCRIBE_DOC_NM_SETTING_VPN_USER_NAME N_("If the VPN connection requires a user name for authentication, that name should be provided here. If the connection is available to more than one user, and the VPN requires each user to supply a different name, then leave this property empty. If this property is empty, NetworkManager will automatically supply the username of the user which requested the VPN connection.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_AGEING N_("Specifies the lifetime in seconds of FDB entries learnt by the kernel.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_DESTINATION_PORT N_("Specifies the UDP destination port to communicate to the remote VXLAN tunnel endpoint.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_ID N_("Specifies the VXLAN Network Identifier (or VXLAN Segment Identifier) to use.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_L2_MISS N_("Specifies whether netlink LL ADDR miss notifications are generated.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_L3_MISS N_("Specifies whether netlink IP ADDR miss notifications are generated.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_LEARNING N_("Specifies whether unknown source link layer addresses and IP addresses are entered into the VXLAN device forwarding database.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_LIMIT N_("Specifies the maximum number of FDB entries. A value of zero means that the kernel will store unlimited entries.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_LOCAL N_("If given, specifies the source IP address to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_PROXY N_("Specifies whether ARP proxy is turned on.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_REMOTE N_("Specifies the unicast destination IP address to use in outgoing packets when the destination link layer address is not known in the VXLAN device forwarding database, or the multicast IP address to join.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_RSC N_("Specifies whether route short circuit is turned on.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MAX N_("Specifies the maximum UDP source port to communicate to the remote VXLAN tunnel endpoint.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_SOURCE_PORT_MIN N_("Specifies the minimum UDP source port to communicate to the remote VXLAN tunnel endpoint.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_TOS N_("Specifies the TOS value to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_VXLAN_TTL N_("Specifies the time-to-live value to use in outgoing packets.") +#define DESCRIBE_DOC_NM_SETTING_WIMAX_MAC_ADDRESS N_("If specified, this connection will only apply to the WiMAX device whose MAC address matches. This property does not change the MAC address of the device (known as MAC spoofing). Deprecated: 1") +#define DESCRIBE_DOC_NM_SETTING_WIMAX_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".") +#define DESCRIBE_DOC_NM_SETTING_WIMAX_NETWORK_NAME N_("Network Service Provider (NSP) name of the WiMAX network this connection should use. Deprecated: 1") diff --git a/clients/common/settings-docs.xsl b/clients/common/settings-docs.xsl new file mode 100644 index 00000000..0d08a0c8 --- /dev/null +++ b/clients/common/settings-docs.xsl @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:output + method="text" + doctype-public="-//OASIS//DTD DocBook XML V4.3//EN" + doctype-system="http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" + /> + + <xsl:template match="nm-setting-docs">/* Generated file. Do not edit. */ + +<xsl:apply-templates select="setting" mode="properties"><xsl:sort select="@name"/></xsl:apply-templates> + </xsl:template> + + + <xsl:template match="setting" mode="properties"> +<xsl:apply-templates select="property"> + <xsl:sort select="@name"/> + <xsl:with-param name="setting_name_upper" select="@name_upper"/> +</xsl:apply-templates> + +</xsl:template> + + <xsl:template match="property"> + <xsl:param name="setting_name_upper" /> + <xsl:variable name="docs"> + <xsl:call-template name="escape_quotes"> + <xsl:with-param name="string" select="@description"/> + </xsl:call-template> + </xsl:variable>#define DESCRIBE_DOC_NM_SETTING_<xsl:value-of select="$setting_name_upper"/>_<xsl:value-of select="@name_upper"/> N_("<xsl:value-of select="$docs"/>") +</xsl:template> + + <xsl:template match="setting" mode="settings"> + { "<xsl:value-of select="@name"/>", setting_<xsl:value-of select="translate(@name,'-','_')"/>, <xsl:value-of select="count(./property)"/> },</xsl:template> + + <xsl:template name="escape_quotes"> + <xsl:param name="string" /> + <xsl:choose> + <xsl:when test="contains($string, '"')"> + <xsl:value-of select="substring-before($string, '"')" />\"<xsl:call-template name="escape_quotes"><xsl:with-param name="string" select="substring-after($string, '"')" /></xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$string" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet> diff --git a/clients/common/tests/test-general.c b/clients/common/tests/test-general.c new file mode 100644 index 00000000..64efd14d --- /dev/null +++ b/clients/common/tests/test-general.c @@ -0,0 +1,162 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright 2017 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "NetworkManager.h" + +#include "nm-utils/nm-hash-utils.h" + +#include "nm-meta-setting-access.h" + +#include "nm-utils/nm-test-utils.h" + +/*****************************************************************************/ + +static void +test_client_meta_check (void) +{ + const NMMetaSettingInfoEditor *const*infos_p; + NMMetaSettingType m; + guint p; + + G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaSettingInfoEditor, meta_type)); + G_STATIC_ASSERT (G_STRUCT_OFFSET (NMMetaAbstractInfo, meta_type) == G_STRUCT_OFFSET (NMMetaPropertyInfo, meta_type)); + + for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) { + const NMMetaSettingInfo *info = &nm_meta_setting_infos[m]; + GType gtype; + + g_assert (info); + g_assert (info->meta_type == m); + g_assert (info->setting_name); + g_assert (info->get_setting_gtype); + + gtype = info->get_setting_gtype (); + g_assert (gtype != NM_TYPE_SETTING); + + { + nm_auto_unref_gtypeclass GTypeClass *gclass = g_type_class_ref (gtype); + + g_assert (G_TYPE_CHECK_CLASS_TYPE (gclass, gtype)); + } + { + gs_unref_object NMSetting *setting = g_object_new (gtype, NULL); + + g_assert (NM_IS_SETTING (setting)); + g_assert (G_TYPE_CHECK_INSTANCE_TYPE (setting, gtype)); + g_assert_cmpstr (nm_setting_get_name (setting), ==, info->setting_name); + } + } + + for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) { + const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m]; + + g_assert (info); + g_assert (info->meta_type == &nm_meta_type_setting_info_editor); + g_assert (info->general); + g_assert (info->general == &nm_meta_setting_infos[m]); + + g_assert_cmpstr (info->general->setting_name, ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, FALSE)); + g_assert_cmpstr ("name", ==, info->meta_type->get_name ((const NMMetaAbstractInfo *) info, TRUE)); + + g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties)); + + if (info->properties_num) { + gs_unref_hashtable GHashTable *property_names = g_hash_table_new (nm_str_hash, g_str_equal); + + g_assert (info->properties); + for (p = 0; p < info->properties_num; p++) { + const NMMetaPropertyInfo *pi = info->properties[p]; + + g_assert (pi); + g_assert (pi->meta_type == &nm_meta_type_property_info); + g_assert (pi->setting_info == info); + g_assert (pi->property_name); + + g_assert (nm_g_hash_table_add (property_names, (gpointer) pi->property_name)); + + g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE)); + g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE)); + + g_assert (pi->property_type); + g_assert (pi->property_type->get_fcn); + } + g_assert (!info->properties[info->properties_num]); + } else + g_assert (!info->properties); + + if (info->valid_parts) { + gsize i, l; + gs_unref_hashtable GHashTable *dup = g_hash_table_new (NULL, NULL); + + l = NM_PTRARRAY_LEN (info->valid_parts); + g_assert (l >= 2); + + for (i = 0; info->valid_parts[i]; i++) { + g_assert (info->valid_parts[i]->setting_info); + g_assert (nm_g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info)); + + if (i == 0) { + g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]); + g_assert (info->valid_parts[i]->mandatory); + } + if (i == 1) { + g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[m]); + g_assert (info->valid_parts[i]->mandatory); + } + } + g_assert (i == l); + } + } + + for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) { + const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m]; + + g_assert (nm_meta_setting_info_editor_find_by_name (info->general->setting_name, FALSE) == info); + g_assert (nm_meta_setting_info_editor_find_by_gtype (info->general->get_setting_gtype ()) == info); + + for (p = 0; p < info->properties_num; p++) { + const NMMetaPropertyInfo *pi = info->properties[p]; + + g_assert (nm_meta_setting_info_editor_get_property_info (info, pi->property_name) == pi); + g_assert (nm_meta_property_info_find_by_name (info->general->setting_name, pi->property_name) == pi); + } + } + + infos_p = nm_meta_setting_infos_editor_p (); + g_assert (infos_p); + for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) + g_assert (infos_p[m] == &nm_meta_setting_infos_editor[m]); + g_assert (!infos_p[m]); +} + +/*****************************************************************************/ + +NMTST_DEFINE (); + +int +main (int argc, char **argv) +{ + nmtst_init (&argc, &argv, TRUE); + + g_test_add_func ("/client/meta/check", test_client_meta_check); + + return g_test_run (); +} |