From 2128e4542e2a668dd4fcce0f94d3e5b4fbc5b0f8 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 15 Jul 2022 10:43:53 +0200 Subject: [PATCH] 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) --- 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 a79f45c09d..929ef6aa63 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -11636,7 +11636,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) { @@ -11900,7 +11900,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 80def12511..d59aecb266 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 6b9d3d7ed4..1f531a6f84 100644 --- a/src/core/devices/ovs/nm-device-ovs-interface.c +++ b/src/core/devices/ovs/nm-device-ovs-interface.c @@ -198,7 +198,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 77ba1b248f..8c00a6d3f9 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