diff options
| author | Michael Biebl <biebl@debian.org> | 2018-06-04 00:07:45 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-06-04 00:07:45 +0200 |
| commit | 04bc9e1cd3544445d883ad29ea108c1645c8e7b7 (patch) | |
| tree | d10c354b1b980ca8a7b9e48ec9019e8ed88bde2b /libnm-core/nm-setting-connection.c | |
| parent | ee9c73a923909e23a649407be77e25235d769e25 (diff) | |
New upstream version 1.11.4 upstream/1.11.4
Diffstat (limited to 'libnm-core/nm-setting-connection.c')
| -rw-r--r-- | libnm-core/nm-setting-connection.c | 119 |
1 files changed, 101 insertions, 18 deletions
diff --git a/libnm-core/nm-setting-connection.c b/libnm-core/nm-setting-connection.c index 24c65e7c..f8f1b017 100644 --- a/libnm-core/nm-setting-connection.c +++ b/libnm-core/nm-setting-connection.c @@ -81,6 +81,7 @@ typedef struct { NMMetered metered; NMSettingConnectionLldp lldp; gint auth_retries; + int mdns; } NMSettingConnectionPrivate; enum { @@ -103,6 +104,7 @@ enum { PROP_GATEWAY_PING_TIMEOUT, PROP_METERED, PROP_LLDP, + PROP_MDNS, PROP_STABLE_ID, PROP_AUTH_RETRIES, @@ -286,7 +288,6 @@ nm_setting_connection_get_connection_type (NMSettingConnection *setting) return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->type; } - /** * nm_setting_connection_get_num_permissions: * @setting: the #NMSettingConnection @@ -862,6 +863,23 @@ nm_setting_connection_get_lldp (NMSettingConnection *setting) return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->lldp; } +/** + * nm_setting_connection_get_mdns: + * @setting: the #NMSettingConnection + * + * Returns: the #NMSettingConnection:mdns property of the setting. + * + * Since: 1.12 + **/ +NMSettingConnectionMdns +nm_setting_connection_get_mdns (NMSettingConnection *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_CONNECTION (setting), + NM_SETTING_CONNECTION_MDNS_DEFAULT); + + return NM_SETTING_CONNECTION_GET_PRIVATE (setting)->mdns; +} + static void _set_error_missing_base_setting (GError **error, const char *type) { @@ -1057,6 +1075,17 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } + if ( priv->mdns < NM_SETTING_CONNECTION_MDNS_DEFAULT + || priv->mdns > NM_SETTING_CONNECTION_MDNS_YES) { + g_set_error (error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("mdns value %d is not valid"), priv->mdns); + g_prefix_error (error, "%s.%s: ", NM_SETTING_CONNECTION_SETTING_NAME, + NM_SETTING_CONNECTION_MDNS); + return FALSE; + } + /* *** errors above here should be always fatal, below NORMALIZABLE_ERROR *** */ if (!priv->uuid) { @@ -1214,6 +1243,9 @@ compare_property (NMSetting *setting, static void nm_setting_connection_init (NMSettingConnection *setting) { + NMSettingConnectionPrivate *priv = NM_SETTING_CONNECTION_GET_PRIVATE (setting); + + priv->mdns = NM_SETTING_CONNECTION_MDNS_DEFAULT; } static void @@ -1332,6 +1364,9 @@ set_property (GObject *object, guint prop_id, case PROP_AUTH_RETRIES: priv->auth_retries = g_value_get_int (value); break; + case PROP_MDNS: + priv->mdns = g_value_get_int (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1420,6 +1455,9 @@ get_property (GObject *object, guint prop_id, case PROP_AUTH_RETRIES: g_value_set_int (value, priv->auth_retries); break; + case PROP_MDNS: + g_value_set_int (value, priv->mdns); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1497,32 +1535,39 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) /** * NMSettingConnection:stable-id: * - * Token to generate stable IDs for the connection. + * This represents the identity of the connection used for various purposes. + * It allows to configure multiple profiles to share the identity. Also, + * the stable-id can contain placeholders that are substituted dynamically and + * deterministically depending on the context. * * 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. + * and wifi.cloned-mac-address=stable. It is also used as DHCP client + * identifier with ipv4.dhcp-client-id=stable. * - * 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. + * Note that depending on the context where it is used, other parameters are + * also seeded into the generation algorithm. For example, a per-host key + * is commonly also included, so that different systems end up generating + * different IDs. Or with ipv6.addr-gen-mode=stable-privacy, also the device's + * name is included, so that different interfaces yield different addresses. * * 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. + * at runtime. Currently supported are "${CONNECTION}", "${DEVICE}", + * "${BOOT}", "${RANDOM}". + * These effectively create unique IDs per-connection, per-device, per-boot, + * or every time. Note that "${DEVICE}" corresponds the the interface name of the + * device. * 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. + * For example, set it to "${CONNECTION}-${BOOT}-${DEVICE}" to create a unique id for + * this connection that changes with every reboot and differs depending on the + * interface where the profile activates. * - * Note that two connections only use the same effective id if - * their stable-id is also identical before performing dynamic substitutions. + * If the value is unset, a global connection default is consulted. If the + * value is still unset, the default is similar to "${CONNECTION}" and uses + * a unique, fixed ID for the connection. * * Since: 1.4 **/ @@ -1641,6 +1686,10 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) * NetworkManager when the resources for the connection are available. * %TRUE to automatically activate the connection, %FALSE to require manual * intervention to activate the connection. + * + * Note that autoconnect is not implemented for VPN profiles. See + * #NMSettingConnection:secondaries as an alternative to automatically + * connect VPN profiles. **/ /* ---ifcfg-rh--- * property: autoconnect @@ -1686,7 +1735,6 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS)); - /** * NMSettingConnection:autoconnect-retries: * @@ -1833,7 +1881,9 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) * * 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. + * for master connections. The properties #NMSettingConnection:autoconnect, + * #NMSettingConnection:autoconnect-priority and #NMSettingConnection:autoconnect-retries + * are unrelated to this setting. * 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 @@ -1982,4 +2032,37 @@ nm_setting_connection_class_init (NMSettingConnectionClass *setting_class) G_PARAM_CONSTRUCT | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS)); + + /** + * NMSettingConnection:mdns: + * + * Whether mDNS is enabled for the connection. + * + * The permitted values are: yes: register hostname and resolving + * for the connection, no: disable mDNS for the interface, resolve: + * do not register hostname but allow resolving of mDNS host names. + * When updating this property on a currently activated connection, + * the change takes effect immediately. + * + * This feature requires a plugin which supports mDNS. One such + * plugin is dns-systemd-resolved. + * + * Since: 1.12 + **/ + /* ---ifcfg-rh--- + * property: mdns + * variable: CONNECTION_MDNS(+) + * values: yes,no,resolve + * default: missing variable means global default + * description: Whether or not mDNS is enabled for the connection + * example: CONNECTION_MDNS=yes + * ---end--- + */ + g_object_class_install_property + (object_class, PROP_MDNS, + g_param_spec_int (NM_SETTING_CONNECTION_MDNS, "", "", + G_MININT32, G_MAXINT32, + NM_SETTING_CONNECTION_MDNS_DEFAULT, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); } |