diff options
Diffstat (limited to 'src/libnm-core-impl/nm-setting-ip4-config.c')
| -rw-r--r-- | src/libnm-core-impl/nm-setting-ip4-config.c | 115 |
1 files changed, 111 insertions, 4 deletions
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: * <itemizedlist> * <listitem> + * <para><literal>"advmss"</literal> - an unsigned 32 bit integer.</para> + * </listitem> + * <listitem> * <para><literal>"cwnd"</literal> - an unsigned 32 bit integer.</para> * </listitem> * <listitem> @@ -972,6 +1069,9 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) * <para><literal>"initrwnd"</literal> - an unsigned 32 bit integer.</para> * </listitem> * <listitem> + * <para><literal>"lock-advmss"</literal> - a boolean value.</para> + * </listitem> + * <listitem> * <para><literal>"lock-cwnd"</literal> - a boolean value.</para> * </listitem> * <listitem> @@ -993,6 +1093,13 @@ nm_setting_ip4_config_class_init(NMSettingIP4ConfigClass *klass) * <para><literal>"onlink"</literal> - a boolean value.</para> * </listitem> * <listitem> + * <para><literal>"quickack"</literal> - a boolean value.</para> + * </listitem> + * <listitem> + * <para><literal>"rto_min"</literal> - an unsigned 32 bit integer. + * The value is in milliseconds.</para> + * </listitem> + * <listitem> * <para><literal>"scope"</literal> - an unsigned 8 bit integer. IPv4 only.</para> * </listitem> * <listitem> |