From 8388f67d3da69c8c86ea801220cdb284495f8a07 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 15 Jul 2022 10:43:53 +0200 Subject: [PATCH 1/3] device: add "is_manual" argument to ready_for_ip_config() device method Some device types might want to run manual ip configuration while skipping other methods. (cherry picked from commit 2ae8433520be69b95dccefba416c19d28fb38a85) (cherry picked from commit 2128e4542e2a668dd4fcce0f94d3e5b4fbc5b0f8) --- src/core/devices/nm-device.c | 4 ++-- src/core/devices/nm-device.h | 2 +- src/core/devices/ovs/nm-device-ovs-bridge.c | 2 +- src/core/devices/ovs/nm-device-ovs-interface.c | 2 +- src/core/devices/ovs/nm-device-ovs-port.c | 2 +- src/core/devices/wwan/nm-device-modem.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 0a5d826d34..6417882eb2 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -11628,7 +11628,7 @@ activate_stage3_ip_config_for_addr_family(NMDevice *self, int addr_family, const priv->ip_data_x[IS_IPv4].wait_for_ports = FALSE; } - if (klass->ready_for_ip_config && !klass->ready_for_ip_config(self)) + if (klass->ready_for_ip_config && !klass->ready_for_ip_config(self, FALSE)) goto out_devip; if (IS_IPv4) { @@ -11892,7 +11892,7 @@ activate_stage3_ip_config(NMDevice *self) } if (!nm_device_sys_iface_state_is_external(self) - && (!klass->ready_for_ip_config || klass->ready_for_ip_config(self))) { + && (!klass->ready_for_ip_config || klass->ready_for_ip_config(self, TRUE))) { if (priv->ipmanual_data.state_6 == NM_DEVICE_IP_STATE_NONE && !NM_IN_STRSET(ipv6_method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED, diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h index a7badb8610..90d03478a9 100644 --- a/src/core/devices/nm-device.h +++ b/src/core/devices/nm-device.h @@ -346,7 +346,7 @@ typedef struct _NMDeviceClass { NMActStageReturn (*act_stage1_prepare)(NMDevice *self, NMDeviceStateReason *out_failure_reason); NMActStageReturn (*act_stage2_config)(NMDevice *self, NMDeviceStateReason *out_failure_reason); void (*act_stage3_ip_config)(NMDevice *self, int addr_family); - gboolean (*ready_for_ip_config)(NMDevice *self); + gboolean (*ready_for_ip_config)(NMDevice *self, gboolean is_manual); const char *(*get_ip_method_auto)(NMDevice *self, int addr_family); diff --git a/src/core/devices/ovs/nm-device-ovs-bridge.c b/src/core/devices/ovs/nm-device-ovs-bridge.c index 683ada1339..ea77dd189e 100644 --- a/src/core/devices/ovs/nm-device-ovs-bridge.c +++ b/src/core/devices/ovs/nm-device-ovs-bridge.c @@ -67,7 +67,7 @@ get_generic_capabilities(NMDevice *device) } static gboolean -ready_for_ip_config(NMDevice *device) +ready_for_ip_config(NMDevice *device, gboolean is_manual) { return FALSE; } diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c index 74707d2482..61fac6f81c 100644 --- a/src/core/devices/ovs/nm-device-ovs-interface.c +++ b/src/core/devices/ovs/nm-device-ovs-interface.c @@ -194,7 +194,7 @@ set_platform_mtu(NMDevice *device, guint32 mtu) } static gboolean -ready_for_ip_config(NMDevice *device) +ready_for_ip_config(NMDevice *device, gboolean is_manual) { return nm_device_get_ip_ifindex(device) > 0; } diff --git a/src/core/devices/ovs/nm-device-ovs-port.c b/src/core/devices/ovs/nm-device-ovs-port.c index 116f58c43a..6ba52f406b 100644 --- a/src/core/devices/ovs/nm-device-ovs-port.c +++ b/src/core/devices/ovs/nm-device-ovs-port.c @@ -61,7 +61,7 @@ get_generic_capabilities(NMDevice *device) } static gboolean -ready_for_ip_config(NMDevice *device) +ready_for_ip_config(NMDevice *device, gboolean is_manual) { return FALSE; } diff --git a/src/core/devices/wwan/nm-device-modem.c b/src/core/devices/wwan/nm-device-modem.c index 11a994ea74..aee59cd59f 100644 --- a/src/core/devices/wwan/nm-device-modem.c +++ b/src/core/devices/wwan/nm-device-modem.c @@ -621,7 +621,7 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags) } static gboolean -ready_for_ip_config(NMDevice *device) +ready_for_ip_config(NMDevice *device, gboolean is_manual) { /* Tell NMDevice to only run device-specific IP * configuration (devip) and skip other methods From 2c919477c64469e1ba82b891cef754fb366191ce Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 15 Jul 2022 10:52:11 +0200 Subject: [PATCH 2/3] wwan: enable manual IP configuration Before 1.36, manual addresses from the profile were assigned to the interface; restore that behavior. The manual IP configuration also contains the DNS priority from the profile; so this change ensures that the merged l3cd has a DNS priority and that dynamically discovered DNS servers are not ignored by the DNS manager. Fixes: 58287cbcc0c8 ('core: rework IP configuration in NetworkManager using layer 3 configuration') (cherry picked from commit 0717589972324bc06b9b5324134a45a543c80aa4) (cherry picked from commit 2ddb64331905dd0aad31e048f8ec6cfebd42e4e6) --- src/core/devices/wwan/nm-device-modem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/devices/wwan/nm-device-modem.c b/src/core/devices/wwan/nm-device-modem.c index aee59cd59f..63ee803474 100644 --- a/src/core/devices/wwan/nm-device-modem.c +++ b/src/core/devices/wwan/nm-device-modem.c @@ -623,11 +623,11 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags) static gboolean ready_for_ip_config(NMDevice *device, gboolean is_manual) { - /* Tell NMDevice to only run device-specific IP + /* Tell NMDevice to only run manual and device-specific IP * configuration (devip) and skip other methods - * (manual, dhcp, etc). + * (dhcp, link-local, shared, etc). */ - return FALSE; + return is_manual; } /*****************************************************************************/ From 36f2cfc4341ffe6507566dc25026b72ddadaabac Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 14 Jul 2022 11:45:27 +0200 Subject: [PATCH 3/3] ppp,wwan: remove explicit initialization of DNS priority It's no longer necessary, as modem devices get the priority from the ipmanual configuration created from the profile. (cherry picked from commit 8c17760f62f5dc34f459c5b6e6d791f3f0e220d6) (cherry picked from commit 6a83fad831ac0eb77ef309ff85885d0689e5dc90) --- src/core/devices/wwan/nm-modem-broadband.c | 5 +---- src/core/ppp/nm-ppp-manager.c | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/core/devices/wwan/nm-modem-broadband.c b/src/core/devices/wwan/nm-modem-broadband.c index cbf30f565c..997fe72729 100644 --- a/src/core/devices/wwan/nm-modem-broadband.c +++ b/src/core/devices/wwan/nm-modem-broadband.c @@ -1032,7 +1032,6 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho l3cd = nm_l3_config_data_new(nm_platform_get_multi_idx(NM_PLATFORM_GET), ifindex, NM_IP_CONFIG_SOURCE_WWAN); - nm_l3_config_data_set_dns_priority(l3cd, AF_INET, 0); address = (NMPlatformIP4Address){ .address = address_network, @@ -1116,11 +1115,9 @@ stage3_ip_config_start(NMModem *modem, int addr_family, NMModemIPMethod ip_metho _LOGI("IPv6 base configuration:"); - l3cd = nm_l3_config_data_new(nm_platform_get_multi_idx(NM_PLATFORM_GET), + l3cd = nm_l3_config_data_new(nm_platform_get_multi_idx(NM_PLATFORM_GET), ifindex, NM_IP_CONFIG_SOURCE_WWAN); - nm_l3_config_data_set_dns_priority(l3cd, AF_INET6, 0); - do_auto = TRUE; address.plen = mm_bearer_ip_config_get_prefix(self->_priv.ipv6_config); diff --git a/src/core/ppp/nm-ppp-manager.c b/src/core/ppp/nm-ppp-manager.c index ea00844e1e..abbae92d59 100644 --- a/src/core/ppp/nm-ppp-manager.c +++ b/src/core/ppp/nm-ppp-manager.c @@ -545,7 +545,6 @@ impl_ppp_manager_set_ip4_config(NMDBusObject *obj, NM_IP_CONFIG_SOURCE_PPP); nm_l3_config_data_set_mtu(l3cd, mtu); - nm_l3_config_data_set_dns_priority(l3cd, AF_INET, 0); address = (NMPlatformIP4Address){ .plen = 32, @@ -661,7 +660,6 @@ impl_ppp_manager_set_ip6_config(NMDBusObject *obj, NM_IP_CONFIG_SOURCE_PPP); nm_l3_config_data_set_mtu(l3cd, mtu); - nm_l3_config_data_set_dns_priority(l3cd, AF_INET6, 0); address = (NMPlatformIP6Address){ .plen = 64,