From 0018d1f3cf71d680d7b6bceda55a5717244d8b26 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Tue, 16 Aug 2022 18:24:19 +0200 Subject: New upstream version 1.39.90 --- src/libnm-core-impl/nm-setting-ip4-config.c | 115 +++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 4 deletions(-) (limited to 'src/libnm-core-impl/nm-setting-ip4-config.c') diff --git a/src/libnm-core-impl/nm-setting-ip4-config.c b/src/libnm-core-impl/nm-setting-ip4-config.c index bf555168..ff56834e 100644 --- a/src/libnm-core-impl/nm-setting-ip4-config.c +++ b/src/libnm-core-impl/nm-setting-ip4-config.c @@ -38,14 +38,16 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_DHCP_CLIENT_ID, PROP_DHCP_FQDN, - PROP_DHCP_VENDOR_CLASS_IDENTIFIER, ); + PROP_DHCP_VENDOR_CLASS_IDENTIFIER, + PROP_LINK_LOCAL, ); typedef struct { NMSettingIPConfigPrivate parent; - char *dhcp_client_id; - char *dhcp_fqdn; - char *dhcp_vendor_class_identifier; + char *dhcp_client_id; + char *dhcp_fqdn; + char *dhcp_vendor_class_identifier; + gint32 link_local; } NMSettingIP4ConfigPrivate; /** @@ -127,6 +129,25 @@ nm_setting_ip4_config_get_dhcp_vendor_class_identifier(NMSettingIP4Config *setti return NM_SETTING_IP4_CONFIG_GET_PRIVATE(setting)->dhcp_vendor_class_identifier; } +/** + * nm_setting_ip4_config_get_link_local: + * @setting: the #NMSettingIP4Config + * + * Returns the value contained in the #NMSettingIP4Config:link_local + * property. + * + * Returns: the link-local configuration + * + * Since: 1.40 + **/ +NMSettingIP4LinkLocal +nm_setting_ip4_config_get_link_local(NMSettingIP4Config *setting) +{ + g_return_val_if_fail(NM_IS_SETTING_IP4_CONFIG(setting), NM_SETTING_IP4_LL_DEFAULT); + + return NM_SETTING_IP4_CONFIG_GET_PRIVATE(setting)->link_local; +} + static gboolean verify(NMSetting *setting, NMConnection *connection, GError **error) { @@ -218,6 +239,46 @@ verify(NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } + if (!NM_IN_SET(priv->link_local, + NM_SETTING_IP4_LL_AUTO, + NM_SETTING_IP4_LL_DEFAULT, + NM_SETTING_IP4_LL_DISABLED, + NM_SETTING_IP4_LL_ENABLED)) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("property is invalid")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP4_CONFIG_SETTING_NAME, + NM_SETTING_IP4_CONFIG_LINK_LOCAL); + return FALSE; + } + if (priv->link_local == NM_SETTING_IP4_LL_ENABLED + && nm_streq(method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("cannot enable ipv4.link-local with ipv4.method=disabled")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP4_CONFIG_SETTING_NAME, + NM_SETTING_IP4_CONFIG_LINK_LOCAL); + return FALSE; + } + if (priv->link_local == NM_SETTING_IP4_LL_DISABLED + && nm_streq(method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) { + g_set_error_literal(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("cannot disable ipv4.link-local with ipv4.method=link-local")); + g_prefix_error(error, + "%s.%s: ", + NM_SETTING_IP4_CONFIG_SETTING_NAME, + NM_SETTING_IP4_CONFIG_LINK_LOCAL); + return FALSE; + } + if (priv->dhcp_client_id && !priv->dhcp_client_id[0]) { g_set_error_literal(error, NM_CONNECTION_ERROR, @@ -854,6 +915,39 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) NMSettingIP4ConfigPrivate, dhcp_vendor_class_identifier); + /** + * NMSettingIP4Config:link-local: + * + * Enable and disable the IPv4 link-local configuration independently of the + * ipv4.method configuration. This allows a link-local address (169.254.x.y/16) + * to be obtained in addition to other addresses, such as those manually + * configured or obtained from a DHCP server. + * + * When set to "auto", the value is dependent on "ipv4.method". + * When set to "default", it honors the global connection default, before + * falling back to "auto". Note that if "ipv4.method" is "disabled", then + * link local addressing is always disabled too. The default is "default". + * + * Since 1.40 + */ + /* ---ifcfg-rh--- + * property: link-local + * variable: IPV4_LINK_LOCAL(+) + * description: Configure link-local IP address in interaction with method + * example: IPV4_LINK_LOCAL=auto + * ---end--- + */ + _nm_setting_property_define_direct_int32(properties_override, + obj_properties, + NM_SETTING_IP4_CONFIG_LINK_LOCAL, + PROP_LINK_LOCAL, + G_MININT32, + G_MAXINT32, + NM_SETTING_IP4_LL_DEFAULT, + NM_SETTING_PARAM_NONE, + NMSettingIP4ConfigPrivate, + link_local); + /* IP4-specific property overrides */ /* ---dbus--- @@ -963,6 +1057,9 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) * Various attributes are supported: * * + * "advmss" - an unsigned 32 bit integer. + * + * * "cwnd" - an unsigned 32 bit integer. * * @@ -972,6 +1069,9 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) * "initrwnd" - an unsigned 32 bit integer. * * + * "lock-advmss" - a boolean value. + * + * * "lock-cwnd" - a boolean value. * * @@ -993,6 +1093,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) * "onlink" - a boolean value. * * + * "quickack" - a boolean value. + * + * + * "rto_min" - an unsigned 32 bit integer. + * The value is in milliseconds. + * + * * "scope" - an unsigned 8 bit integer. IPv4 only. * * -- cgit 1.3.0-6-gf8a5