mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-21 14:30:43 +01:00
device: introduce ipv6.mtu property
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1003 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1231
This commit is contained in:
parent
850d6550fc
commit
0004a408ae
9 changed files with 748 additions and 549 deletions
|
|
@ -10972,9 +10972,10 @@ _commit_mtu(NMDevice *self)
|
|||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
NMDeviceMtuSource source = NM_DEVICE_MTU_SOURCE_NONE;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
const NML3ConfigData *l3cd;
|
||||
guint32 ip6_mtu_orig;
|
||||
guint32 ip6_mtu;
|
||||
guint32 ip6_mtu = 0;
|
||||
guint32 mtu_desired_orig;
|
||||
guint32 mtu_desired;
|
||||
guint32 mtu_plat;
|
||||
|
|
@ -11059,10 +11060,9 @@ _commit_mtu(NMDevice *self)
|
|||
}
|
||||
}
|
||||
|
||||
if (mtu_desired && mtu_desired < 1280) {
|
||||
NMSettingIPConfig *s_ip6;
|
||||
s_ip6 = nm_device_get_applied_setting(self, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
|
||||
s_ip6 = nm_device_get_applied_setting(self, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
if (mtu_desired && mtu_desired < 1280) {
|
||||
if (s_ip6
|
||||
&& !NM_IN_STRSET(nm_setting_ip_config_get_method(s_ip6),
|
||||
NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
|
||||
|
|
@ -11077,7 +11077,12 @@ _commit_mtu(NMDevice *self)
|
|||
}
|
||||
}
|
||||
|
||||
ip6_mtu = priv->ip6_mtu;
|
||||
if (s_ip6)
|
||||
ip6_mtu = nm_setting_ip6_config_get_mtu(NM_SETTING_IP6_CONFIG(s_ip6));
|
||||
|
||||
if (!ip6_mtu)
|
||||
ip6_mtu = priv->ip6_mtu;
|
||||
|
||||
if (!ip6_mtu && priv->mtu_source == NM_DEVICE_MTU_SOURCE_NONE) {
|
||||
/* initially, if the IPv6 MTU is not specified, grow it as large as the
|
||||
* link MTU @mtu_desired. Only exception is, if @mtu_desired is so small
|
||||
|
|
|
|||
|
|
@ -1831,4 +1831,5 @@ global:
|
|||
libnm_1_40_0 {
|
||||
global:
|
||||
nm_setting_ip4_link_local_get_type;
|
||||
nm_setting_ip6_config_get_mtu;
|
||||
} libnm_1_38_0;
|
||||
|
|
|
|||
|
|
@ -43,16 +43,18 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_IP6_PRIVACY,
|
|||
PROP_ADDR_GEN_MODE,
|
||||
PROP_TOKEN,
|
||||
PROP_DHCP_DUID,
|
||||
PROP_RA_TIMEOUT, );
|
||||
PROP_RA_TIMEOUT,
|
||||
PROP_MTU, );
|
||||
|
||||
typedef struct {
|
||||
NMSettingIPConfigPrivate parent;
|
||||
|
||||
char *token;
|
||||
char *dhcp_duid;
|
||||
int ip6_privacy;
|
||||
gint32 addr_gen_mode;
|
||||
gint32 ra_timeout;
|
||||
char *token;
|
||||
char *dhcp_duid;
|
||||
int ip6_privacy;
|
||||
gint32 addr_gen_mode;
|
||||
gint32 ra_timeout;
|
||||
guint32 mtu;
|
||||
} NMSettingIP6ConfigPrivate;
|
||||
|
||||
/**
|
||||
|
|
@ -171,6 +173,23 @@ nm_setting_ip6_config_get_ra_timeout(NMSettingIP6Config *setting)
|
|||
return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->ra_timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_ip6_config_get_mtu:
|
||||
* @setting: the #NMSettingIP6Config
|
||||
*
|
||||
* Returns: The configured %NM_SETTING_IP6_CONFIG_MTU value for the maximum
|
||||
* transmission unit.
|
||||
*
|
||||
* Since: 1.40
|
||||
**/
|
||||
guint32
|
||||
nm_setting_ip6_config_get_mtu(NMSettingIP6Config *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting), 0);
|
||||
|
||||
return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->mtu;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify(NMSetting *setting, NMConnection *connection, GError **error)
|
||||
{
|
||||
|
|
@ -856,6 +875,27 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
|
|||
NMSettingIP6ConfigPrivate,
|
||||
ra_timeout);
|
||||
|
||||
/**
|
||||
* NMSettingIP6Config:mtu:
|
||||
*
|
||||
* Maximum transmission unit size, in bytes. If zero (the default), the MTU
|
||||
* is set automatically from router advertisements or is left equal to the
|
||||
* link-layer MTU. If greater than the link-layer MTU, or greater than zero
|
||||
* but less than the minimum IPv6 MTU of 1280, this value has no effect.
|
||||
*
|
||||
* Since: 1.40
|
||||
**/
|
||||
_nm_setting_property_define_direct_uint32(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_IP6_CONFIG_MTU,
|
||||
PROP_MTU,
|
||||
0,
|
||||
G_MAXUINT32,
|
||||
0,
|
||||
NM_SETTING_PARAM_FUZZY_IGNORE,
|
||||
NMSettingIP6ConfigPrivate,
|
||||
mtu);
|
||||
|
||||
/**
|
||||
* NMSettingIP6Config:dhcp-duid:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_IP6_CONFIG_RA_TIMEOUT "ra-timeout"
|
||||
|
||||
#define NM_SETTING_IP6_CONFIG_MTU "mtu"
|
||||
|
||||
/**
|
||||
* NM_SETTING_IP6_CONFIG_METHOD_IGNORE:
|
||||
*
|
||||
|
|
@ -154,6 +156,8 @@ NM_AVAILABLE_IN_1_12
|
|||
const char *nm_setting_ip6_config_get_dhcp_duid(NMSettingIP6Config *setting);
|
||||
NM_AVAILABLE_IN_1_24
|
||||
gint32 nm_setting_ip6_config_get_ra_timeout(NMSettingIP6Config *setting);
|
||||
NM_AVAILABLE_IN_1_40
|
||||
guint32 nm_setting_ip6_config_get_mtu(NMSettingIP6Config *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -6370,6 +6370,12 @@ static const NMMetaPropertyInfo *const property_infos_IP6_CONFIG[] = {
|
|||
.property_type = &_pt_gobject_int,
|
||||
.property_typ_data = &_ptd_gobject_int_timeout,
|
||||
),
|
||||
PROPERTY_INFO (NM_SETTING_IP6_CONFIG_MTU, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MTU,
|
||||
.property_type = &_pt_gobject_mtu,
|
||||
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mtu,
|
||||
.get_fcn = MTU_GET_FCN (NMSettingIP6Config, nm_setting_ip6_config_get_mtu),
|
||||
),
|
||||
),
|
||||
PROPERTY_INFO (NM_SETTING_IP6_CONFIG_DHCP_DUID, DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_DUID,
|
||||
.property_type = &_pt_gobject_string,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@
|
|||
#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 \"disabled\", \"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. Note that the shared method must be configured on the interface which shares the internet to a subnet, not on the uplink which is shared.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_MTU N_("Maximum transmission unit size, in bytes. If zero (the default), the MTU is set automatically from router advertisements or is left equal to the link-layer MTU. If greater than the link-layer MTU, or greater than zero but less than the minimum IPv6 MTU of 1280, this value has no effect.")
|
||||
#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_RA_TIMEOUT N_("A timeout for waiting Router Advertisements in seconds. If zero (the default), a globally configured default is used. If still unspecified, the timeout depends on the sysctl settings of the device. Set to 2147483647 (MAXINT32) for infinity.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_REQUIRED_TIMEOUT N_("The minimum time interval in milliseconds for which dynamic IP configuration should be tried before the connection succeeds. This property is useful for example if both IPv4 and IPv6 are enabled and are allowed to fail. Normally the connection succeeds as soon as one of the two address families completes; by setting a required timeout for e.g. IPv4, one can ensure that even if IP6 succeeds earlier than IPv4, NetworkManager waits some time for IPv4 before the connection becomes active. Note that if \"may-fail\" is FALSE for the same address family, this property has no effect as NetworkManager needs to wait for the full DHCP timeout. A zero value means that no required timeout is present, -1 means the default value (either configuration ipvx.required-timeout override or zero).")
|
||||
|
|
|
|||
|
|
@ -741,6 +741,8 @@
|
|||
description="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." />
|
||||
<property name="ra-timeout"
|
||||
description="A timeout for waiting Router Advertisements in seconds. If zero (the default), a globally configured default is used. If still unspecified, the timeout depends on the sysctl settings of the device. Set to 2147483647 (MAXINT32) for infinity." />
|
||||
<property name="mtu"
|
||||
description="Maximum transmission unit size, in bytes. If zero (the default), the MTU is set automatically from router advertisements or is left equal to the link-layer MTU. If greater than the link-layer MTU, or greater than zero but less than the minimum IPv6 MTU of 1280, this value has no effect." />
|
||||
<property name="dhcp-duid"
|
||||
description="A string containing the DHCPv6 Unique Identifier (DUID) used by the dhcp client to identify itself to DHCPv6 servers (RFC 3315). The DUID is carried in the Client Identifier option. If the property is a hex string ('aa:bb:cc') it is interpreted as a binary DUID and filled as an opaque value in the Client Identifier option. The special value "lease" will retrieve the DUID previously used from the lease file belonging to the connection. If no DUID is found and "dhclient" is the configured dhcp client, the DUID is searched in the system-wide dhclient lease file. If still no DUID is found, or another dhcp client is used, a global and permanent DUID-UUID (RFC 6355) will be generated based on the machine-id. The special values "llt" and "ll" will generate a DUID of type LLT or LL (see RFC 3315) based on the current MAC address of the device. In order to try providing a stable DUID-LLT, the time field will contain a constant timestamp that is used globally (for all profiles) and persisted to disk. The special values "stable-llt", "stable-ll" and "stable-uuid" will generate a DUID of the corresponding type, derived from the connection's stable-id and a per-host unique key. You may want to include the "${DEVICE}" or "${MAC}" specifier in the stable-id, in case this profile gets activated on multiple devices. So, the link-layer address of "stable-ll" and "stable-llt" will be a generated address derived from the stable id. The DUID-LLT time value in the "stable-llt" option will be picked among a static timespan of three years (the upper bound of the interval is the same constant timestamp used in "llt"). When the property is unset, the global value provided for "ipv6.dhcp-duid" is used. If no global value is provided, the default "lease" value is assumed." />
|
||||
<property name="dhcp-iaid"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue