parent
8aa7bd2b67
commit
65ec8d49d3
@ -0,0 +1,61 @@
|
||||
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
|
||||
index 16f8e1f261..036233e668 100644
|
||||
--- a/src/core/devices/nm-device.c
|
||||
+++ b/src/core/devices/nm-device.c
|
||||
@@ -1661,7 +1661,7 @@ _prop_get_ipv4_dad_timeout(NMDevice *self)
|
||||
self,
|
||||
0,
|
||||
NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX,
|
||||
- 200);
|
||||
+ 0);
|
||||
}
|
||||
|
||||
static guint32
|
||||
diff --git a/src/libnm-core-impl/nm-setting-ip-config.c b/src/libnm-core-impl/nm-setting-ip-config.c
|
||||
index bfebe7d13d..de56ed74ea 100644
|
||||
--- a/src/libnm-core-impl/nm-setting-ip-config.c
|
||||
+++ b/src/libnm-core-impl/nm-setting-ip-config.c
|
||||
@@ -6655,7 +6655,7 @@ nm_setting_ip_config_class_init(NMSettingIPConfigClass *klass)
|
||||
*
|
||||
* A zero value means that no duplicate address detection is performed, -1 means
|
||||
* the default value (either the value configured globally in NetworkManger.conf
|
||||
- * or 200ms). A value greater than zero is a timeout in milliseconds. Note that
|
||||
+ * or zero). A value greater than zero is a timeout in milliseconds. Note that
|
||||
* the time intervals are subject to randomization as per RFC 5227 and so the
|
||||
* actual duration can be between half and the full time specified in this
|
||||
* property.
|
||||
diff --git a/src/libnmc-setting/settings-docs.h.in b/src/libnmc-setting/settings-docs.h.in
|
||||
index 77cde6620e..e42cb74e7f 100644
|
||||
--- a/src/libnmc-setting/settings-docs.h.in
|
||||
+++ b/src/libnmc-setting/settings-docs.h.in
|
||||
@@ -162,7 +162,7 @@
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_TRANSPORT_MODE N_("The IP-over-InfiniBand transport mode. Either \"datagram\" or \"connected\".")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ADDRESSES N_("A list of IPv4 addresses and their prefix length. Multiple addresses can be separated by comma. For example \"192.168.1.5/24, 10.1.0.5/24\". The addresses are listed in decreasing priority, meaning the first address will be the primary address.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_AUTO_ROUTE_EXT_GW N_("VPN connections will default to add the route automatically unless this setting is set to FALSE. For other connection types, adding such an automatic route is currently not supported and setting this to TRUE has no effect.")
|
||||
-#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT N_("Maximum 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. The property is currently implemented only for IPv4. A zero value means that no duplicate address detection is performed, -1 means the default value (either the value configured globally in NetworkManger.conf or 200ms). A value greater than zero is a timeout in milliseconds. Note that the time intervals are subject to randomization as per RFC 5227 and so the actual duration can be between half and the full time specified in this property.")
|
||||
+#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DAD_TIMEOUT N_("Maximum 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. The property is currently implemented only for IPv4. A zero value means that no duplicate address detection is performed, -1 means the default value (either the value configured globally in NetworkManger.conf or zero). A value greater than zero is a timeout in milliseconds. Note that the time intervals are subject to randomization as per RFC 5227 and so the actual duration can be between half and the full time specified in this property.")
|
||||
#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. The special values \"mac\" and \"perm-mac\" are supported, which use the current or permanent MAC address of the device to generate a client identifier with type ethernet (01). Currently, these options only work for ethernet type of links. The special value \"ipv6-duid\" uses the DUID from \"ipv6.dhcp-duid\" property as an RFC4361-compliant client identifier. As IAID it uses \"ipv4.dhcp-iaid\" and falls back to \"ipv6.dhcp-iaid\" if unset. The special value \"duid\" generates a RFC4361-compliant client identifier based on \"ipv4.dhcp-iaid\" and uses a DUID generated by hashing /etc/machine-id. The special value \"stable\" is supported to generate a type 0 client identifier based on the stable-id (see connection.stable-id) and a per-host key. If you set the stable-id, you may want to include the \"${DEVICE}\" or \"${MAC}\" specifier to get a per-device key. The special value \"none\" prevents any client identifier from being sent. Note that this is normally not recommended. If unset, a globally configured default from NetworkManager.conf is used. If still unset, the default depends on the DHCP plugin. The internal dhcp client will default to \"mac\" and the dhclient plugin will try to use one from its config file if present, or won't sent any client-id otherwise.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_DHCP_DSCP N_("Specifies the value for the DSCP field (traffic class) of the IP header. When empty, the global default value is used; if no global default is specified, it is assumed to be \"CS0\". Allowed values are: \"CS0\", \"CS4\" and \"CS6\". The property is currently valid only for IPv4, and it is supported only by the \"internal\" DHCP plugin.")
|
||||
#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.")
|
||||
@@ -192,7 +192,7 @@
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the IPv6 interface identifer of addresses with RFC4862 IPv6 Stateless Address Autoconfiguration and Link Local addresses. The permitted values are: \"eui64\" (0), \"stable-privacy\" (1), \"default\" (3) or \"default-or-eui64\" (2). If the property is set to \"eui64\", the addresses will be generated using the interface token derived from hardware address. This makes the host part of the address to stay constant, making it possible to track the host's presence when it changes networks. The address changes when the interface hardware is replaced. If a duplicate address is detected, there is also no fallback to generate another address. When configured, the \"ipv6.token\" is used instead of the MAC address to generate addresses for stateless autoconfiguration. If the property is set to \"stable-privacy\", the interface identifier is generated as specified by RFC7217. This works by hashing a host specific key (see NetworkManager(8) manual), the interface name, the connection's \"connection.stable-id\" property and the address prefix. This improves privacy by making it harder to use the address to track the host's presence and the address is stable when the network interface hardware is replaced. The special values \"default\" and \"default-or-eui64\" will fallback to the global connection default as documented in the NetworkManager.conf(5) manual. If the global default is not specified, the fallback value is \"stable-privacy\" or \"eui64\", respectively. If not specified, when creating a new profile the default is \"default\". 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_("A list of IPv6 addresses and their prefix length. Multiple addresses can be separated by comma. For example \"2001:db8:85a3::8a2e:370:7334/64, 2001:db8:85a3::5/64\". The addresses are listed in decreasing priority, meaning the first address will be the primary address. This can make a difference with IPv6 source address selection (RFC 6724, section 5).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_AUTO_ROUTE_EXT_GW N_("VPN connections will default to add the route automatically unless this setting is set to FALSE. For other connection types, adding such an automatic route is currently not supported and setting this to TRUE has no effect.")
|
||||
-#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Maximum 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. The property is currently implemented only for IPv4. A zero value means that no duplicate address detection is performed, -1 means the default value (either the value configured globally in NetworkManger.conf or 200ms). A value greater than zero is a timeout in milliseconds. Note that the time intervals are subject to randomization as per RFC 5227 and so the actual duration can be between half and the full time specified in this property.")
|
||||
+#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Maximum 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. The property is currently implemented only for IPv4. A zero value means that no duplicate address detection is performed, -1 means the default value (either the value configured globally in NetworkManger.conf or zero). A value greater than zero is a timeout in milliseconds. Note that the time intervals are subject to randomization as per RFC 5227 and so the actual duration can be between half and the full time specified in this property.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_DSCP N_("Specifies the value for the DSCP field (traffic class) of the IP header. When empty, the global default value is used; if no global default is specified, it is assumed to be \"CS0\". Allowed values are: \"CS0\", \"CS4\" and \"CS6\". The property is currently valid only for IPv4, and it is supported only by the \"internal\" DHCP plugin.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_DUID N_("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.")
|
||||
#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.")
|
||||
diff --git a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in
|
||||
index 8806bf2550..09648f3ff8 100644
|
||||
--- a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in
|
||||
+++ b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in
|
||||
@@ -1337,7 +1337,7 @@
|
||||
values="-1 - 2147483647"
|
||||
special-values="default (-1), infinity (2147483647)" />
|
||||
<property name="dad-timeout"
|
||||
- nmcli-description="Maximum 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. The property is currently implemented only for IPv4. A zero value means that no duplicate address detection is performed, -1 means the default value (either the value configured globally in NetworkManger.conf or 200ms). A value greater than zero is a timeout in milliseconds. Note that the time intervals are subject to randomization as per RFC 5227 and so the actual duration can be between half and the full time specified in this property."
|
||||
+ nmcli-description="Maximum 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. The property is currently implemented only for IPv4. A zero value means that no duplicate address detection is performed, -1 means the default value (either the value configured globally in NetworkManger.conf or zero). A value greater than zero is a timeout in milliseconds. Note that the time intervals are subject to randomization as per RFC 5227 and so the actual duration can be between half and the full time specified in this property."
|
||||
format="integer"
|
||||
values="-1 - 30000"
|
||||
special-values="default (-1), off (0)" />
|
@ -1,54 +0,0 @@
|
||||
From 6302c2ea52c6c28d36b6006b29823c469e171e2a Mon Sep 17 00:00:00 2001
|
||||
From: Wen Liang <liangwen12year@gmail.com>
|
||||
Date: Thu, 3 Aug 2023 10:16:42 -0400
|
||||
Subject: [PATCH] nm-manager: ensure device is exported on D-Bus in
|
||||
authentication request
|
||||
|
||||
The device authentication request is an async process, it can not know
|
||||
the answer right away, it is not guarantee that device is still
|
||||
exported on D-Bus when authentication finishes. Thus, do not return
|
||||
SUCCESS and abort the authentication request when device is not alive.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=2210271
|
||||
(cherry picked from commit b341161e2a4988403ae4a6ef7653e01567da36a0)
|
||||
(cherry picked from commit 0e27e84247ed824b27d105292d7bf42dc0341cbb)
|
||||
---
|
||||
src/core/nm-manager.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
|
||||
index 9c7212202b..937acbba1e 100644
|
||||
--- a/src/core/nm-manager.c
|
||||
+++ b/src/core/nm-manager.c
|
||||
@@ -3222,6 +3222,13 @@ device_auth_done_cb(NMAuthChain *chain, GDBusMethodInvocation *context, gpointer
|
||||
nm_assert(error || (result == NM_AUTH_CALL_RESULT_YES));
|
||||
}
|
||||
|
||||
+ if (!error && !nm_dbus_object_is_exported(NM_DBUS_OBJECT(device))) {
|
||||
+ g_set_error(&error,
|
||||
+ NM_MANAGER_ERROR,
|
||||
+ NM_MANAGER_ERROR_UNKNOWN_DEVICE,
|
||||
+ "device no longer exists");
|
||||
+ }
|
||||
+
|
||||
callback(device, context, subject, error, nm_auth_chain_get_data(chain, "user-data"));
|
||||
}
|
||||
|
||||
@@ -3287,6 +3294,14 @@ nm_manager_device_auth_request(NMManager *self,
|
||||
&error))
|
||||
goto fail_on_idle;
|
||||
|
||||
+ if (!nm_dbus_object_is_exported(NM_DBUS_OBJECT(device))) {
|
||||
+ g_set_error(&error,
|
||||
+ NM_MANAGER_ERROR,
|
||||
+ NM_MANAGER_ERROR_UNKNOWN_DEVICE,
|
||||
+ "device no longer exists");
|
||||
+ goto fail_on_idle;
|
||||
+ }
|
||||
+
|
||||
chain = nm_auth_chain_new_subject(subject, context, device_auth_done_cb, self);
|
||||
if (cancellable)
|
||||
nm_auth_chain_set_cancellable(chain, cancellable);
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,67 +0,0 @@
|
||||
From d9b3114b6ef8e0f4d50a8d56d750a698d85fa984 Mon Sep 17 00:00:00 2001
|
||||
From: Gris Ge <fge@redhat.com>
|
||||
Date: Tue, 29 Aug 2023 08:25:23 +0800
|
||||
Subject: [PATCH] checkpoint: Fix segfault crash when rollback
|
||||
|
||||
When rolling back a checkpoint, NM will crash due to dereference a NULL
|
||||
pointer of `priv->removed_devices->len`.
|
||||
|
||||
To fix it, we just place a NULL check before that code block.
|
||||
|
||||
Fixes: 1f1b71ad9f8a ('checkpoint: preserve devices that were removed and
|
||||
readded')
|
||||
|
||||
Reference: https://issues.redhat.com/browse/RHEL-1526
|
||||
|
||||
Signed-off-by: Gris Ge <fge@redhat.com>
|
||||
(cherry picked from commit 3162507d6ca381cfbe02ceba2d80ba0f3ba3e5f7)
|
||||
(cherry picked from commit e5600d4c5a33749939b984184f27fbe4159a2b65)
|
||||
---
|
||||
src/core/nm-checkpoint.c | 23 +++++++++++++----------
|
||||
1 file changed, 13 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/core/nm-checkpoint.c b/src/core/nm-checkpoint.c
|
||||
index 5c4d4e53d6..74adf48477 100644
|
||||
--- a/src/core/nm-checkpoint.c
|
||||
+++ b/src/core/nm-checkpoint.c
|
||||
@@ -460,24 +460,27 @@ next_dev:
|
||||
NMDeviceState state;
|
||||
|
||||
nm_manager_for_each_device (priv->manager, device, tmp_lst) {
|
||||
- gboolean found = FALSE;
|
||||
-
|
||||
if (g_hash_table_contains(priv->devices, device))
|
||||
continue;
|
||||
|
||||
/* Also ignore devices that were in the checkpoint initially and
|
||||
* were moved to 'removed_devices' because they got removed from
|
||||
* the system. */
|
||||
- for (i = 0; i < priv->removed_devices->len; i++) {
|
||||
- dev_checkpoint = priv->removed_devices->pdata[i];
|
||||
- if (dev_checkpoint->dev_type == nm_device_get_device_type(device)
|
||||
- && nm_streq0(dev_checkpoint->original_dev_name, nm_device_get_iface(device))) {
|
||||
- found = TRUE;
|
||||
- break;
|
||||
+ if (priv->removed_devices) {
|
||||
+ gboolean found = FALSE;
|
||||
+
|
||||
+ for (i = 0; i < priv->removed_devices->len; i++) {
|
||||
+ dev_checkpoint = priv->removed_devices->pdata[i];
|
||||
+ if (dev_checkpoint->dev_type == nm_device_get_device_type(device)
|
||||
+ && nm_streq0(dev_checkpoint->original_dev_name,
|
||||
+ nm_device_get_iface(device))) {
|
||||
+ found = TRUE;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
+ if (found)
|
||||
+ continue;
|
||||
}
|
||||
- if (found)
|
||||
- continue;
|
||||
|
||||
state = nm_device_get_state(device);
|
||||
if (state > NM_DEVICE_STATE_DISCONNECTED && state < NM_DEVICE_STATE_DEACTIVATING) {
|
||||
--
|
||||
2.41.0
|
||||
|
@ -1,310 +0,0 @@
|
||||
From a3e39a3bf9667bb69fb2f37b605caffbd969889a Mon Sep 17 00:00:00 2001
|
||||
From: Gris Ge <fge@redhat.com>
|
||||
Date: Tue, 26 Sep 2023 15:00:32 +0800
|
||||
Subject: [PATCH 1/2] emit DNS CONFIG_CHANGED signal even dns=none
|
||||
|
||||
Instruct the `NMDnsManager` to emit `CONFIG_CHANGED` signal even
|
||||
`dns=none` or failed to modify `/etc/resolv.conf`.
|
||||
|
||||
The `NMPolicy` will only update hostname when DNS is managed.
|
||||
|
||||
Signed-off-by: Gris Ge <fge@redhat.com>
|
||||
(cherry picked from commit a847ba807572c3ef3682e833432f2f93e9d519a0)
|
||||
(cherry picked from commit d10f20fd01a7bb3225c7e38ed80449e19156344b)
|
||||
---
|
||||
src/core/dns/nm-dns-manager.c | 12 +++++++++++-
|
||||
src/core/dns/nm-dns-manager.h | 2 ++
|
||||
src/core/nm-policy.c | 10 ++++++----
|
||||
3 files changed, 19 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/core/dns/nm-dns-manager.c b/src/core/dns/nm-dns-manager.c
|
||||
index 535646930c..231ef72f49 100644
|
||||
--- a/src/core/dns/nm-dns-manager.c
|
||||
+++ b/src/core/dns/nm-dns-manager.c
|
||||
@@ -1948,7 +1948,7 @@ plugin_skip:;
|
||||
}
|
||||
|
||||
/* signal that DNS resolution configs were changed */
|
||||
- if ((do_update || caching || force_emit) && result == SR_SUCCESS)
|
||||
+ if ((caching || force_emit) && result == SR_SUCCESS)
|
||||
g_signal_emit(self, signals[CONFIG_CHANGED], 0);
|
||||
|
||||
nm_clear_pointer(&priv->config_variant, g_variant_unref);
|
||||
@@ -1964,6 +1964,16 @@ plugin_skip:;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+gboolean
|
||||
+nm_dns_manager_is_unmanaged(NMDnsManager *self)
|
||||
+{
|
||||
+ NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE(self);
|
||||
+
|
||||
+ return NM_IN_SET(priv->rc_manager,
|
||||
+ NM_DNS_MANAGER_RESOLV_CONF_MAN_UNMANAGED,
|
||||
+ NM_DNS_MANAGER_RESOLV_CONF_MAN_IMMUTABLE);
|
||||
+}
|
||||
+
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
diff --git a/src/core/dns/nm-dns-manager.h b/src/core/dns/nm-dns-manager.h
|
||||
index 42f9dec588..9b8c2972b4 100644
|
||||
--- a/src/core/dns/nm-dns-manager.h
|
||||
+++ b/src/core/dns/nm-dns-manager.h
|
||||
@@ -148,4 +148,6 @@ char *nmtst_dns_create_resolv_conf(const char *const *searches,
|
||||
const char *const *nameservers,
|
||||
const char *const *options);
|
||||
|
||||
+gboolean nm_dns_manager_is_unmanaged(NMDnsManager *self);
|
||||
+
|
||||
#endif /* __NETWORKMANAGER_DNS_MANAGER_H__ */
|
||||
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
|
||||
index efdb06360f..1cf6b3398d 100644
|
||||
--- a/src/core/nm-policy.c
|
||||
+++ b/src/core/nm-policy.c
|
||||
@@ -2635,11 +2635,13 @@ dns_config_changed(NMDnsManager *dns_manager, gpointer user_data)
|
||||
if (priv->updating_dns)
|
||||
return;
|
||||
|
||||
- nm_manager_for_each_device (priv->manager, device, tmp_lst) {
|
||||
- nm_device_clear_dns_lookup_data(device, "DNS configuration changed");
|
||||
- }
|
||||
+ if (!nm_dns_manager_is_unmanaged(dns_manager)) {
|
||||
+ nm_manager_for_each_device (priv->manager, device, tmp_lst) {
|
||||
+ nm_device_clear_dns_lookup_data(device, "DNS configuration changed");
|
||||
+ }
|
||||
|
||||
- update_system_hostname(self, "DNS configuration changed");
|
||||
+ update_system_hostname(self, "DNS configuration changed");
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
--
|
||||
2.41.0
|
||||
|
||||
|
||||
From de4c05300e25b49bf077ac7929622f2721815b29 Mon Sep 17 00:00:00 2001
|
||||
From: Gris Ge <fge@redhat.com>
|
||||
Date: Tue, 26 Sep 2023 17:14:58 +0800
|
||||
Subject: [PATCH 2/2] dispatch `dns-change` dispatcher event
|
||||
|
||||
Introducing new dispatcher event -- `dns-change` which will be emitted when
|
||||
DNS configuration changed(even in `dns=none` mode). This is to solve two
|
||||
use cases:
|
||||
* Invoke dispatch script for DNS changes triggered by the global DNS
|
||||
API.
|
||||
|
||||
* Do not invoke [OpenShift resolv-prepender][1] for non-DNS changes.
|
||||
|
||||
Bug reference: https://issues.redhat.com/browse/RHEL-1671
|
||||
|
||||
[1]: https://github.com/openshift/machine-config-operator/blob/master/templates/common/on-prem/files/resolv-prepender.yaml
|
||||
|
||||
Signed-off-by: Gris Ge <fge@redhat.com>
|
||||
(cherry picked from commit a1db61ebc9712d1faf2ef8f1b2cb14cd819346d3)
|
||||
(cherry picked from commit 3cdce71b95cea11bf409d9353c35a4dea6f33984)
|
||||
---
|
||||
man/NetworkManager-dispatcher.xml | 15 +++++-
|
||||
src/core/nm-dispatcher.c | 51 ++++++++++++++++---
|
||||
src/core/nm-dispatcher.h | 3 ++
|
||||
src/core/nm-policy.c | 2 +
|
||||
src/libnm-core-aux-extern/nm-dispatcher-api.h | 1 +
|
||||
src/nm-dispatcher/nm-dispatcher-utils.c | 8 ++-
|
||||
6 files changed, 69 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/man/NetworkManager-dispatcher.xml b/man/NetworkManager-dispatcher.xml
|
||||
index 036b3c8dcc..e87226d05e 100644
|
||||
--- a/man/NetworkManager-dispatcher.xml
|
||||
+++ b/man/NetworkManager-dispatcher.xml
|
||||
@@ -68,8 +68,9 @@
|
||||
device an operation just happened on, and second the action. For device actions,
|
||||
the interface is the name of the kernel interface suitable for IP configuration.
|
||||
Thus it is either VPN_IP_IFACE, DEVICE_IP_IFACE, or DEVICE_IFACE, as applicable.
|
||||
- For the <varname>hostname</varname> action the device name is always <literal>"none"</literal>
|
||||
- and for <varname>connectivity-change</varname> it is empty.
|
||||
+ For the <varname>hostname</varname> action the device name is always <literal>"none"</literal>.
|
||||
+ For <varname>connectivity-change</varname> it is empty.
|
||||
+ For <varname>dns-change</varname> it is empty.
|
||||
</para>
|
||||
<para>The actions are:</para>
|
||||
<variablelist class="dispatcher-options">
|
||||
@@ -170,6 +171,16 @@
|
||||
The connection was reapplied on the device.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
+ <varlistentry>
|
||||
+ <term><varname>dns-change</varname></term>
|
||||
+ <listitem><para>
|
||||
+ The DNS configuration has changed. This action is raised even if
|
||||
+ NetworkManager is configured to not manage resolv.conf (for example,
|
||||
+ via dns=none). In such case, the dispatch script can discover the
|
||||
+ DNS configuration provided by currently active connections by
|
||||
+ looking at file /run/NetworkManager/resolv.conf
|
||||
+ </para></listitem>
|
||||
+ </varlistentry>
|
||||
</variablelist>
|
||||
<para>
|
||||
The environment contains more information about the interface and the connection.
|
||||
diff --git a/src/core/nm-dispatcher.c b/src/core/nm-dispatcher.c
|
||||
index cdc07dd60e..9aa4194e83 100644
|
||||
--- a/src/core/nm-dispatcher.c
|
||||
+++ b/src/core/nm-dispatcher.c
|
||||
@@ -50,6 +50,8 @@
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
+static gboolean nm_dispatcher_need_device(NMDispatcherAction action);
|
||||
+
|
||||
/*****************************************************************************/
|
||||
|
||||
struct NMDispatcherCallId {
|
||||
@@ -469,7 +471,8 @@ static const char *action_table[] = {[NM_DISPATCHER_ACTION_HOSTNAME] = NMD_
|
||||
[NM_DISPATCHER_ACTION_DHCP_CHANGE_6] = NMD_ACTION_DHCP6_CHANGE,
|
||||
[NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE] =
|
||||
NMD_ACTION_CONNECTIVITY_CHANGE,
|
||||
- [NM_DISPATCHER_ACTION_REAPPLY] = NMD_ACTION_REAPPLY};
|
||||
+ [NM_DISPATCHER_ACTION_REAPPLY] = NMD_ACTION_REAPPLY,
|
||||
+ [NM_DISPATCHER_ACTION_DNS_CHANGE] = NMD_ACTION_DNS_CHANGE};
|
||||
|
||||
static const char *
|
||||
action_to_string(NMDispatcherAction action)
|
||||
@@ -530,9 +533,7 @@ _dispatcher_call(NMDispatcherAction action,
|
||||
if (G_UNLIKELY(!request_id))
|
||||
request_id = ++gl.request_id_counter;
|
||||
|
||||
- /* All actions except 'hostname' and 'connectivity-change' require a device */
|
||||
- if (action == NM_DISPATCHER_ACTION_HOSTNAME
|
||||
- || action == NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE) {
|
||||
+ if (!nm_dispatcher_need_device(action)) {
|
||||
_LOG2D(request_id,
|
||||
log_ifname,
|
||||
log_con_uuid,
|
||||
@@ -592,9 +593,8 @@ _dispatcher_call(NMDispatcherAction action,
|
||||
g_variant_builder_init(&vpn_ip4_props, G_VARIANT_TYPE_VARDICT);
|
||||
g_variant_builder_init(&vpn_ip6_props, G_VARIANT_TYPE_VARDICT);
|
||||
|
||||
- /* hostname and connectivity-change actions don't send device data */
|
||||
- if (action != NM_DISPATCHER_ACTION_HOSTNAME
|
||||
- && action != NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE) {
|
||||
+ /* hostname, DNS and connectivity-change actions don't send device data */
|
||||
+ if (nm_dispatcher_need_device(action)) {
|
||||
fill_device_props(device,
|
||||
&device_props,
|
||||
&device_proxy_props,
|
||||
@@ -925,6 +925,30 @@ nm_dispatcher_call_connectivity(NMConnectivityState connectivity_state,
|
||||
out_call_id);
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * nm_dispatcher_call_dns_change():
|
||||
+ *
|
||||
+ * This method does not block the caller.
|
||||
+ *
|
||||
+ * Returns: %TRUE if the action was dispatched, %FALSE on failure
|
||||
+ */
|
||||
+gboolean
|
||||
+nm_dispatcher_call_dns_change(void)
|
||||
+{
|
||||
+ return _dispatcher_call(NM_DISPATCHER_ACTION_DNS_CHANGE,
|
||||
+ FALSE,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ FALSE,
|
||||
+ NM_CONNECTIVITY_UNKNOWN,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL);
|
||||
+}
|
||||
+
|
||||
void
|
||||
nm_dispatcher_call_cancel(NMDispatcherCallId *call_id)
|
||||
{
|
||||
@@ -937,3 +961,16 @@ nm_dispatcher_call_cancel(NMDispatcherCallId *call_id)
|
||||
_LOG3D(call_id, "cancelling dispatcher callback action");
|
||||
call_id->callback = NULL;
|
||||
}
|
||||
+
|
||||
+/* All actions except 'hostname', 'connectivity-change' and 'dns-change' require
|
||||
+ * a device */
|
||||
+static gboolean
|
||||
+nm_dispatcher_need_device(NMDispatcherAction action)
|
||||
+{
|
||||
+ if (action == NM_DISPATCHER_ACTION_HOSTNAME
|
||||
+ || action == NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE
|
||||
+ || action == NM_DISPATCHER_ACTION_DNS_CHANGE) {
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ return TRUE;
|
||||
+}
|
||||
diff --git a/src/core/nm-dispatcher.h b/src/core/nm-dispatcher.h
|
||||
index 3071639922..a1cb96b798 100644
|
||||
--- a/src/core/nm-dispatcher.h
|
||||
+++ b/src/core/nm-dispatcher.h
|
||||
@@ -23,6 +23,7 @@ typedef enum {
|
||||
NM_DISPATCHER_ACTION_DHCP_CHANGE_6,
|
||||
NM_DISPATCHER_ACTION_CONNECTIVITY_CHANGE,
|
||||
NM_DISPATCHER_ACTION_REAPPLY,
|
||||
+ NM_DISPATCHER_ACTION_DNS_CHANGE,
|
||||
} NMDispatcherAction;
|
||||
|
||||
#define NM_DISPATCHER_ACTION_DHCP_CHANGE_X(IS_IPv4) \
|
||||
@@ -69,6 +70,8 @@ gboolean nm_dispatcher_call_connectivity(NMConnectivityState state,
|
||||
gpointer user_data,
|
||||
NMDispatcherCallId **out_call_id);
|
||||
|
||||
+gboolean nm_dispatcher_call_dns_change(void);
|
||||
+
|
||||
void nm_dispatcher_call_cancel(NMDispatcherCallId *call_id);
|
||||
|
||||
#endif /* __NM_DISPATCHER_H__ */
|
||||
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
|
||||
index 1cf6b3398d..2873847df3 100644
|
||||
--- a/src/core/nm-policy.c
|
||||
+++ b/src/core/nm-policy.c
|
||||
@@ -2642,6 +2642,8 @@ dns_config_changed(NMDnsManager *dns_manager, gpointer user_data)
|
||||
|
||||
update_system_hostname(self, "DNS configuration changed");
|
||||
}
|
||||
+
|
||||
+ nm_dispatcher_call_dns_change();
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/src/libnm-core-aux-extern/nm-dispatcher-api.h b/src/libnm-core-aux-extern/nm-dispatcher-api.h
|
||||
index 56da5fba7a..7cb370a92e 100644
|
||||
--- a/src/libnm-core-aux-extern/nm-dispatcher-api.h
|
||||
+++ b/src/libnm-core-aux-extern/nm-dispatcher-api.h
|
||||
@@ -34,6 +34,7 @@
|
||||
#define NMD_ACTION_DHCP6_CHANGE "dhcp6-change"
|
||||
#define NMD_ACTION_CONNECTIVITY_CHANGE "connectivity-change"
|
||||
#define NMD_ACTION_REAPPLY "reapply"
|
||||
+#define NMD_ACTION_DNS_CHANGE "dns-change"
|
||||
|
||||
typedef enum {
|
||||
DISPATCH_RESULT_UNKNOWN = 0,
|
||||
diff --git a/src/nm-dispatcher/nm-dispatcher-utils.c b/src/nm-dispatcher/nm-dispatcher-utils.c
|
||||
index 74ea4e4001..f8a4c28000 100644
|
||||
--- a/src/nm-dispatcher/nm-dispatcher-utils.c
|
||||
+++ b/src/nm-dispatcher/nm-dispatcher-utils.c
|
||||
@@ -453,8 +453,12 @@ nm_dispatcher_utils_construct_envp(const char *action,
|
||||
|
||||
items = g_ptr_array_new_with_free_func(g_free);
|
||||
|
||||
- /* Hostname and connectivity changes don't require a device nor contain a connection */
|
||||
- if (NM_IN_STRSET(action, NMD_ACTION_HOSTNAME, NMD_ACTION_CONNECTIVITY_CHANGE))
|
||||
+ /* Hostname, dns and connectivity changes don't require a device nor contain
|
||||
+ * a connection */
|
||||
+ if (NM_IN_STRSET(action,
|
||||
+ NMD_ACTION_HOSTNAME,
|
||||
+ NMD_ACTION_CONNECTIVITY_CHANGE,
|
||||
+ NMD_ACTION_DNS_CHANGE))
|
||||
goto done;
|
||||
|
||||
/* Connection properties */
|
||||
--
|
||||
2.41.0
|
||||
|
@ -0,0 +1,31 @@
|
||||
# This sets defaults for Wi-Fi profiles to set a generated, stable MAC address.
|
||||
#
|
||||
# Do not modify this file. You can hide/overwrite this file by placing a file
|
||||
# to "/etc/NetworkManager/conf.d/22-wifi-mac-addr.conf". You can also add
|
||||
# configuration snippets with higher priority that override this setting (see
|
||||
# `man 5 NetworkManager.conf`). Most importantly, this snippet only sets
|
||||
# default values for the profile. You can explicitly set the value for each
|
||||
# profile, so that this default value is not used.
|
||||
#
|
||||
# For example, on a particular profile/network set
|
||||
#
|
||||
# $ nmcli connection modify "$PROFILE" wifi.cloned-mac-address permanent
|
||||
#
|
||||
# to use the hardware MAC address. This prevents the default from this file
|
||||
# to take effect.
|
||||
#
|
||||
# Or
|
||||
#
|
||||
# $ nmcli connection modify "$PROFILE" wifi.cloned-mac-address stable connection.stable-id '${NETWORK_SSID}/${BOOT}'
|
||||
#
|
||||
# to get a generated MAC address that changes on each boot. Note how setting
|
||||
# "connection.stable-id" also affects other aspects of the profile.
|
||||
#
|
||||
# See `man 5 nm-settings` for "wifi.cloned-mac-address" and "connection.stable-id".
|
||||
|
||||
[connection.22-wifi-mac-addr]
|
||||
match-device=type:wifi
|
||||
wifi.cloned-mac-address=stable-ssid
|
||||
|
||||
[.config]
|
||||
enable=nm-version-min:1.45
|
@ -0,0 +1,84 @@
|
||||
NetworkManager was built to automatically migrate connection profiles in
|
||||
this directory to equivalent ones in keyfile format in directory
|
||||
/etc/NetworkManager/system-connections.
|
||||
|
||||
You can check whether the migration is enabled via:
|
||||
|
||||
$ NetworkManager --print-config | grep migrate-ifcfg-rh
|
||||
|
||||
In case it is enabled, all files in this directory are migrated at startup.
|
||||
|
||||
To inspect where your connection files are currently stored use:
|
||||
|
||||
$ nmcli -f name,uuid,filename connection
|
||||
|
||||
Background
|
||||
==========
|
||||
|
||||
The ifcfg format is deprecated and will be removed in future releases. For
|
||||
more information see:
|
||||
|
||||
https://lists.freedesktop.org/archives/networkmanager/2023-May/000103.html
|
||||
|
||||
Connection profiles in keyfile format have many benefits. For example, this
|
||||
format is INI file-based and can easily be parsed and generated.
|
||||
|
||||
Each section in NetworkManager keyfiles corresponds to a NetworkManager
|
||||
setting name as described in the nm-settings(5) and nm-settings-keyfile(5)
|
||||
man pages. Each key-value pair in a section is one of the properties listed
|
||||
in the settings specification of the man page.
|
||||
|
||||
How to keep using ifcfg
|
||||
=======================
|
||||
|
||||
If you want to keep using connection profiles in ifcfg format, you need to:
|
||||
|
||||
- disable the automatic migration to keyfile by setting
|
||||
"migrate-ifcfg-rh=false" in the [main] section of NetworkManager
|
||||
configuration;
|
||||
|
||||
- optionally, set "plugins=ifcfg-rh" in the [main] section of
|
||||
NetworkManager configuration so that new profiles are created in ifcfg
|
||||
format.
|
||||
|
||||
At this point, you can migrate all your files back via
|
||||
|
||||
nmcli connection migrate --plugin ifcfg-rh
|
||||
|
||||
Or, if you prefer to migrate only specific connections:
|
||||
|
||||
nmcli connection migrate --plugin ifcfg-rh <profile_name|UUID>
|
||||
|
||||
Note that some connection types are not supported by the ifcfg plugin.
|
||||
|
||||
Interface renaming
|
||||
==================
|
||||
|
||||
Connection profiles stored in ifcfg-rh format support the renaming of
|
||||
interfaces via udev. This is done via a helper tool
|
||||
/usr/lib/udev/rename_device that is invoked by udev to parse the files
|
||||
in /etc/sysconfig/network-scripts; when the HWADDR and DEVICE
|
||||
variables are set, the interface that matches the MAC address in
|
||||
HWADDR is renamed to the name specified in DEVICE.
|
||||
|
||||
Connections in keyfile format don't provide the same integration with
|
||||
udev. The renaming of interfaces must be configured directly in udev,
|
||||
for example by creating a file:
|
||||
|
||||
/etc/systemd/network/70-rename.link
|
||||
|
||||
with content:
|
||||
|
||||
[Match]
|
||||
MACAddress=00:11:22:33:44:56
|
||||
|
||||
[Link]
|
||||
Name=ethernet1
|
||||
|
||||
Alternatively, a udev rule can also be used, such as:
|
||||
|
||||
/etc/udev/rules.d/70-interface-names.rules
|
||||
|
||||
with content:
|
||||
|
||||
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="00:11:22:33:44:56",ATTR{type}=="1",NAME="ethernet1"
|
Loading…
Reference in new issue