summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2023-03-16 12:01:13 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2023-03-16 12:01:13 +0100
commitb3583ec69cf7d8588b13932d841c238f84ce60c4 (patch)
treef01346cff07be9684cf2266a862979446da43875
parenta6802cfa74a0208ffd3d7ce684431ae9bebff484 (diff)
parent7b9a9352c2bc530eba39e8a00631454dfec4d878 (diff)
merge: branch 'bg/device-check-compatible'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1522
-rw-r--r--src/core/devices/adsl/nm-device-adsl.c7
-rw-r--r--src/core/devices/bluetooth/nm-device-bt.c7
-rw-r--r--src/core/devices/nm-device-bridge.c7
-rw-r--r--src/core/devices/nm-device-ethernet.c7
-rw-r--r--src/core/devices/nm-device-generic.c7
-rw-r--r--src/core/devices/nm-device-infiniband.c9
-rw-r--r--src/core/devices/nm-device-ip-tunnel.c9
-rw-r--r--src/core/devices/nm-device-macvlan.c9
-rw-r--r--src/core/devices/nm-device-ppp.c7
-rw-r--r--src/core/devices/nm-device-tun.c9
-rw-r--r--src/core/devices/nm-device-vlan.c9
-rw-r--r--src/core/devices/nm-device-vrf.c9
-rw-r--r--src/core/devices/nm-device-vxlan.c9
-rw-r--r--src/core/devices/nm-device-wpan.c7
-rw-r--r--src/core/devices/nm-device.c25
-rw-r--r--src/core/devices/nm-device.h7
-rw-r--r--src/core/devices/ovs/nm-device-ovs-interface.c7
-rw-r--r--src/core/devices/wifi/nm-device-iwd-p2p.c7
-rw-r--r--src/core/devices/wifi/nm-device-iwd.c7
-rw-r--r--src/core/devices/wifi/nm-device-wifi-p2p.c7
-rw-r--r--src/core/devices/wifi/nm-device-wifi.c7
-rw-r--r--src/core/devices/wwan/nm-device-modem.c7
-rw-r--r--src/core/nm-manager.c11
-rw-r--r--src/core/nm-policy.c1
-rw-r--r--src/core/settings/nm-settings.c4
25 files changed, 141 insertions, 61 deletions
diff --git a/src/core/devices/adsl/nm-device-adsl.c b/src/core/devices/adsl/nm-device-adsl.c
index fcd16b1ce8..89bc84d870 100644
--- a/src/core/devices/adsl/nm-device-adsl.c
+++ b/src/core/devices/adsl/nm-device-adsl.c
@@ -67,13 +67,16 @@ get_generic_capabilities(NMDevice *dev)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingAdsl *s_adsl;
const char *protocol;
if (!NM_DEVICE_CLASS(nm_device_adsl_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_adsl = nm_connection_get_setting_adsl(connection);
diff --git a/src/core/devices/bluetooth/nm-device-bt.c b/src/core/devices/bluetooth/nm-device-bt.c
index a8258123f9..8b13e97d8f 100644
--- a/src/core/devices/bluetooth/nm-device-bt.c
+++ b/src/core/devices/bluetooth/nm-device-bt.c
@@ -192,7 +192,10 @@ can_auto_connect(NMDevice *device, NMSettingsConnection *sett_conn, char **speci
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceBt *self = NM_DEVICE_BT(device);
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE(self);
@@ -200,7 +203,7 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
const char *bdaddr;
if (!NM_DEVICE_CLASS(nm_device_bt_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
if (!get_connection_bt_type_check(self, connection, NULL, error))
diff --git a/src/core/devices/nm-device-bridge.c b/src/core/devices/nm-device-bridge.c
index ca201eb877..a2d0db6192 100644
--- a/src/core/devices/nm-device-bridge.c
+++ b/src/core/devices/nm-device-bridge.c
@@ -101,13 +101,16 @@ check_connection_available(NMDevice *device,
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingBridge *s_bridge;
const char *mac_address;
if (!NM_DEVICE_CLASS(nm_device_bridge_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
if (nm_connection_is_type(connection, NM_SETTING_BLUETOOTH_SETTING_NAME)
diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c
index 97cf84a1b6..aedacc248b 100644
--- a/src/core/devices/nm-device-ethernet.c
+++ b/src/core/devices/nm-device-ethernet.c
@@ -344,13 +344,16 @@ match_subchans(NMDeviceEthernet *self, NMSettingWired *s_wired, gboolean *try_ma
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceEthernet *self = NM_DEVICE_ETHERNET(device);
NMSettingWired *s_wired;
if (!NM_DEVICE_CLASS(nm_device_ethernet_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
if (nm_connection_is_type(connection, NM_SETTING_PPPOE_SETTING_NAME)
diff --git a/src/core/devices/nm-device-generic.c b/src/core/devices/nm-device-generic.c
index 9f85925bbe..c62c7ba11b 100644
--- a/src/core/devices/nm-device-generic.c
+++ b/src/core/devices/nm-device-generic.c
@@ -72,12 +72,15 @@ realize_start_notify(NMDevice *device, const NMPlatformLink *plink)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingConnection *s_con;
if (!NM_DEVICE_CLASS(nm_device_generic_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_con = nm_connection_get_setting_connection(connection);
diff --git a/src/core/devices/nm-device-infiniband.c b/src/core/devices/nm-device-infiniband.c
index d025931eab..c420b9d7cb 100644
--- a/src/core/devices/nm-device-infiniband.c
+++ b/src/core/devices/nm-device-infiniband.c
@@ -108,15 +108,18 @@ get_configured_mtu(NMDevice *device, NMDeviceMtuSource *out_source, gboolean *ou
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingInfiniband *s_infiniband;
if (!NM_DEVICE_CLASS(nm_device_infiniband_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
const char *mac;
const char *hw_addr;
diff --git a/src/core/devices/nm-device-ip-tunnel.c b/src/core/devices/nm-device-ip-tunnel.c
index a5760bf40e..cc62180e40 100644
--- a/src/core/devices/nm-device-ip-tunnel.c
+++ b/src/core/devices/nm-device-ip-tunnel.c
@@ -498,7 +498,10 @@ update_connection(NMDevice *device, NMConnection *connection)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceIPTunnel *self = NM_DEVICE_IP_TUNNEL(device);
NMDeviceIPTunnelPrivate *priv = NM_DEVICE_IP_TUNNEL_GET_PRIVATE(self);
@@ -507,7 +510,7 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
const char *parent;
if (!NM_DEVICE_CLASS(nm_device_ip_tunnel_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_ip_tunnel = nm_connection_get_setting_ip_tunnel(connection);
@@ -520,7 +523,7 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
return FALSE;
}
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
/* Check parent interface; could be an interface name or a UUID */
parent = nm_setting_ip_tunnel_get_parent(s_ip_tunnel);
if (parent && !nm_device_match_parent(device, parent)) {
diff --git a/src/core/devices/nm-device-macvlan.c b/src/core/devices/nm-device-macvlan.c
index 06c0df07e9..8cdef0cfe2 100644
--- a/src/core/devices/nm-device-macvlan.c
+++ b/src/core/devices/nm-device-macvlan.c
@@ -282,14 +282,17 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
/*****************************************************************************/
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE(device);
NMSettingMacvlan *s_macvlan;
const char *parent = NULL;
if (!NM_DEVICE_CLASS(nm_device_macvlan_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_macvlan = nm_connection_get_setting_macvlan(connection);
@@ -308,7 +311,7 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
}
/* Before the device is realized some properties will not be set */
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
if (setting_mode_to_platform(nm_setting_macvlan_get_mode(s_macvlan)) != priv->props.mode) {
nm_utils_error_set_literal(error,
NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
diff --git a/src/core/devices/nm-device-ppp.c b/src/core/devices/nm-device-ppp.c
index 1860df3cf7..275666071b 100644
--- a/src/core/devices/nm-device-ppp.c
+++ b/src/core/devices/nm-device-ppp.c
@@ -149,12 +149,15 @@ _ppp_mgr_callback(NMPppMgr *ppp_mgr, const NMPppMgrCallbackData *callback_data,
/*****************************************************************************/
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingPppoe *s_pppoe;
if (!NM_DEVICE_CLASS(nm_device_ppp_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_pppoe = nm_connection_get_setting_pppoe(connection);
diff --git a/src/core/devices/nm-device-tun.c b/src/core/devices/nm-device-tun.c
index cbea7d7d4d..430e62aa0e 100644
--- a/src/core/devices/nm-device-tun.c
+++ b/src/core/devices/nm-device-tun.c
@@ -284,7 +284,10 @@ _same_og(const char *str, gboolean og_valid, guint32 og_num)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceTun *self = NM_DEVICE_TUN(device);
NMDeviceTunPrivate *priv = NM_DEVICE_TUN_GET_PRIVATE(self);
@@ -292,10 +295,10 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
NMSettingTun *s_tun;
if (!NM_DEVICE_CLASS(nm_device_tun_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
switch (priv->props.type) {
case IFF_TUN:
mode = NM_SETTING_TUN_MODE_TUN;
diff --git a/src/core/devices/nm-device-vlan.c b/src/core/devices/nm-device-vlan.c
index feb011dbe4..7849e7247b 100644
--- a/src/core/devices/nm-device-vlan.c
+++ b/src/core/devices/nm-device-vlan.c
@@ -303,17 +303,20 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
/*****************************************************************************/
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE(device);
NMSettingVlan *s_vlan;
const char *parent;
if (!NM_DEVICE_CLASS(nm_device_vlan_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
s_vlan = nm_connection_get_setting_vlan(connection);
if (nm_setting_vlan_get_id(s_vlan) != priv->vlan_id) {
diff --git a/src/core/devices/nm-device-vrf.c b/src/core/devices/nm-device-vrf.c
index ad31f3a219..b037e8e2a6 100644
--- a/src/core/devices/nm-device-vrf.c
+++ b/src/core/devices/nm-device-vrf.c
@@ -142,16 +142,19 @@ create_and_realize(NMDevice *device,
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceVrfPrivate *priv = NM_DEVICE_VRF_GET_PRIVATE(device);
NMSettingVrf *s_vrf;
if (!NM_DEVICE_CLASS(nm_device_vrf_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
s_vrf = _nm_connection_get_setting(connection, NM_TYPE_SETTING_VRF);
if (priv->props.table != nm_setting_vrf_get_table(s_vrf)) {
diff --git a/src/core/devices/nm-device-vxlan.c b/src/core/devices/nm-device-vxlan.c
index 44a7be3330..061ee3f2ef 100644
--- a/src/core/devices/nm-device-vxlan.c
+++ b/src/core/devices/nm-device-vxlan.c
@@ -238,17 +238,20 @@ address_matches(const char *candidate, in_addr_t addr4, struct in6_addr *addr6)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceVxlanPrivate *priv = NM_DEVICE_VXLAN_GET_PRIVATE(device);
NMSettingVxlan *s_vxlan;
const char *parent;
if (!NM_DEVICE_CLASS(nm_device_vxlan_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
- if (nm_device_is_real(device)) {
+ if (check_properties && nm_device_is_real(device)) {
s_vxlan = nm_connection_get_setting_vxlan(connection);
parent = nm_setting_vxlan_get_parent(s_vxlan);
diff --git a/src/core/devices/nm-device-wpan.c b/src/core/devices/nm-device-wpan.c
index 98356ccfbd..282eea87df 100644
--- a/src/core/devices/nm-device-wpan.c
+++ b/src/core/devices/nm-device-wpan.c
@@ -75,13 +75,16 @@ update_connection(NMDevice *device, NMConnection *connection)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingWpan *s_wpan;
const char *mac, *hw_addr;
if (!NM_DEVICE_CLASS(nm_device_wpan_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_wpan = NM_SETTING_WPAN(nm_connection_get_setting(connection, NM_TYPE_SETTING_WPAN));
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index 11f9001395..939a9b2995 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -4887,6 +4887,7 @@ nm_device_parent_find_for_connection(NMDevice *self, const char *current_setting
&& nm_device_check_connection_compatible(
parent_device,
nm_settings_connection_get_connection(parent_connection),
+ TRUE,
NULL))
return current_setting_parent;
}
@@ -8860,7 +8861,7 @@ nm_device_complete_connection(NMDevice *self,
if (!nm_connection_normalize(connection, NULL, NULL, error))
return FALSE;
- return nm_device_check_connection_compatible(self, connection, error);
+ return nm_device_check_connection_compatible(self, connection, TRUE, error);
}
gboolean
@@ -8920,7 +8921,10 @@ nm_device_match_parent_hwaddr(NMDevice *device,
}
static gboolean
-check_connection_compatible(NMDevice *self, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *self,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
const char *device_iface = nm_device_get_iface(self);
@@ -9047,12 +9051,18 @@ check_connection_compatible(NMDevice *self, NMConnection *connection, GError **e
* @self.
*/
gboolean
-nm_device_check_connection_compatible(NMDevice *self, NMConnection *connection, GError **error)
+nm_device_check_connection_compatible(NMDevice *self,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
g_return_val_if_fail(NM_IS_DEVICE(self), FALSE);
g_return_val_if_fail(NM_IS_CONNECTION(connection), FALSE);
- return NM_DEVICE_GET_CLASS(self)->check_connection_compatible(self, connection, error);
+ return NM_DEVICE_GET_CLASS(self)->check_connection_compatible(self,
+ connection,
+ check_properties,
+ error);
}
gboolean
@@ -15051,7 +15061,10 @@ _nm_device_check_connection_available(NMDevice *self,
/* an unrealized software device is always available, hardware devices never. */
if (!nm_device_is_real(self)) {
if (nm_device_is_software(self)) {
- if (!nm_device_check_connection_compatible(self, connection, error ? &local : NULL)) {
+ if (!nm_device_check_connection_compatible(self,
+ connection,
+ TRUE,
+ error ? &local : NULL)) {
if (error) {
g_return_val_if_fail(local, FALSE);
nm_utils_error_set(error,
@@ -15115,7 +15128,7 @@ _nm_device_check_connection_available(NMDevice *self,
}
}
- if (!nm_device_check_connection_compatible(self, connection, error ? &local : NULL)) {
+ if (!nm_device_check_connection_compatible(self, connection, TRUE, error ? &local : NULL)) {
if (error) {
nm_utils_error_set(error,
local->domain == NM_UTILS_ERROR ? local->code
diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h
index 435a6f82aa..581df9a358 100644
--- a/src/core/devices/nm-device.h
+++ b/src/core/devices/nm-device.h
@@ -322,6 +322,7 @@ typedef struct _NMDeviceClass {
*/
gboolean (*check_connection_compatible)(NMDevice *self,
NMConnection *connection,
+ gboolean check_properties,
GError **error);
/* Checks whether the connection is likely available to be activated,
@@ -531,8 +532,10 @@ gboolean nm_device_complete_connection(NMDevice *device,
NMConnection *const *existing_connections,
GError **error);
-gboolean
-nm_device_check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error);
+gboolean nm_device_check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error);
gboolean nm_device_check_slave_connection_compatible(NMDevice *device, NMConnection *connection);
diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c
index 3ff52c4645..41bcffa16d 100644
--- a/src/core/devices/ovs/nm-device-ovs-interface.c
+++ b/src/core/devices/ovs/nm-device-ovs-interface.c
@@ -91,12 +91,15 @@ can_auto_connect(NMDevice *device, NMSettingsConnection *sett_conn, char **speci
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingOvsInterface *s_ovs_iface;
if (!NM_DEVICE_CLASS(nm_device_ovs_interface_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_ovs_iface = nm_connection_get_setting_ovs_interface(connection);
diff --git a/src/core/devices/wifi/nm-device-iwd-p2p.c b/src/core/devices/wifi/nm-device-iwd-p2p.c
index 40e38321bf..73fd4716f5 100644
--- a/src/core/devices/wifi/nm-device-iwd-p2p.c
+++ b/src/core/devices/wifi/nm-device-iwd-p2p.c
@@ -126,14 +126,17 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMSettingWifiP2P *s_wifi_p2p;
GBytes *wfd_ies;
NMSettingIPConfig *s_ip;
if (!NM_DEVICE_CLASS(nm_device_iwd_p2p_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_wifi_p2p =
diff --git a/src/core/devices/wifi/nm-device-iwd.c b/src/core/devices/wifi/nm-device-iwd.c
index abfbd1a54b..74e75f7216 100644
--- a/src/core/devices/wifi/nm-device-iwd.c
+++ b/src/core/devices/wifi/nm-device-iwd.c
@@ -723,7 +723,10 @@ is_ap_known_network(NMIwdManager *manager, NMWifiAP *ap)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceIwd *self = NM_DEVICE_IWD(device);
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE(self);
@@ -739,7 +742,7 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
gsize ssid_len;
if (!NM_DEVICE_CLASS(nm_device_iwd_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_wireless = nm_connection_get_setting_wireless(connection);
diff --git a/src/core/devices/wifi/nm-device-wifi-p2p.c b/src/core/devices/wifi/nm-device-wifi-p2p.c
index 6c0a4d5e8d..cad6dd0f4e 100644
--- a/src/core/devices/wifi/nm-device-wifi-p2p.c
+++ b/src/core/devices/wifi/nm-device-wifi-p2p.c
@@ -233,10 +233,13 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
if (!NM_DEVICE_CLASS(nm_device_wifi_p2p_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
/* TODO: Allow limitting the interface using the HW-address? */
diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c
index 171743d075..b598cde2b5 100644
--- a/src/core/devices/wifi/nm-device-wifi.c
+++ b/src/core/devices/wifi/nm-device-wifi.c
@@ -981,7 +981,10 @@ deactivate_reset_hw_addr(NMDevice *device)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
NMDeviceWifi *self = NM_DEVICE_WIFI(device);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE(self);
@@ -995,7 +998,7 @@ check_connection_compatible(NMDevice *device, NMConnection *connection, GError *
const char *key_mgmt;
if (!NM_DEVICE_CLASS(nm_device_wifi_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
s_wireless = nm_connection_get_setting_wireless(connection);
diff --git a/src/core/devices/wwan/nm-device-modem.c b/src/core/devices/wwan/nm-device-modem.c
index b83120f947..a1050c3f47 100644
--- a/src/core/devices/wwan/nm-device-modem.c
+++ b/src/core/devices/wwan/nm-device-modem.c
@@ -383,12 +383,15 @@ get_type_description(NMDevice *device)
}
static gboolean
-check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
+check_connection_compatible(NMDevice *device,
+ NMConnection *connection,
+ gboolean check_properties,
+ GError **error)
{
GError *local = NULL;
if (!NM_DEVICE_CLASS(nm_device_modem_parent_class)
- ->check_connection_compatible(device, connection, error))
+ ->check_connection_compatible(device, connection, check_properties, error))
return FALSE;
if (!nm_modem_check_connection_compatible(NM_DEVICE_MODEM_GET_PRIVATE(device)->modem,
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index b58079b59b..d04aa18b25 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -1865,7 +1865,7 @@ find_device_by_iface(NMManager *self,
c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) {
if (!nm_streq(nm_device_get_iface(candidate), iface))
continue;
- if (connection && !nm_device_check_connection_compatible(candidate, connection, NULL))
+ if (connection && !nm_device_check_connection_compatible(candidate, connection, TRUE, NULL))
continue;
if (slave) {
if (!nm_device_is_master(candidate))
@@ -2369,6 +2369,7 @@ find_parent_device_for_connection(NMManager *self,
&& nm_device_check_connection_compatible(
candidate,
nm_settings_connection_get_connection(parent_connection),
+ TRUE,
NULL))
first_compatible = candidate;
}
@@ -2548,7 +2549,7 @@ system_create_virtual_device(NMManager *self, NMConnection *connection)
/* See if there's a device that is already compatible with this connection */
c_list_for_each_entry (dev_candidate, &priv->devices_lst_head, devices_lst) {
- if (nm_device_check_connection_compatible(dev_candidate, connection, NULL)) {
+ if (nm_device_check_connection_compatible(dev_candidate, connection, FALSE, NULL)) {
if (nm_device_is_real(dev_candidate)) {
_LOG3D(LOGD_DEVICE, connection, "already created virtual interface name %s", iface);
return NULL;
@@ -2617,7 +2618,7 @@ system_create_virtual_device(NMManager *self, NMConnection *connection)
NMConnection *candidate = nm_settings_connection_get_connection(connections[i]);
NMSettingConnection *s_con;
- if (!nm_device_check_connection_compatible(device, candidate, NULL))
+ if (!nm_device_check_connection_compatible(device, candidate, TRUE, NULL))
continue;
s_con = nm_connection_get_setting_connection(candidate);
@@ -3376,6 +3377,7 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat
&& nm_device_check_connection_compatible(
device,
nm_settings_connection_get_connection(connection_checked),
+ TRUE,
NULL)) {
if (connection) {
NMConnection *con = nm_settings_connection_get_connection(connection_checked);
@@ -3414,6 +3416,7 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat
&& nm_device_check_connection_compatible(
device,
nm_settings_connection_get_connection(sett_conn),
+ TRUE,
NULL))
sett_conns[j++] = sett_conn;
}
@@ -4259,7 +4262,7 @@ _check_remove_dev_on_link_deleted(NMManager *self, NMDevice *device)
NM_SETTINGS_CONNECTION_INT_FLAGS_NM_GENERATED))
continue;
- if (!nm_device_check_connection_compatible(device, con, NULL))
+ if (!nm_device_check_connection_compatible(device, con, TRUE, NULL))
continue;
/* Found a virtual connection compatible, the device must
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
index 014bed256f..8d5054c824 100644
--- a/src/core/nm-policy.c
+++ b/src/core/nm-policy.c
@@ -1640,6 +1640,7 @@ reset_autoconnect_all(
&& !nm_device_check_connection_compatible(
device,
nm_settings_connection_get_connection(sett_conn),
+ TRUE,
NULL))
continue;
diff --git a/src/core/settings/nm-settings.c b/src/core/settings/nm-settings.c
index e6ac5d0941..d5edb7cd8b 100644
--- a/src/core/settings/nm-settings.c
+++ b/src/core/settings/nm-settings.c
@@ -535,7 +535,7 @@ _startup_complete_check_is_ready(NMSettings *self,
/* Check that device is compatible with the device. We are also happy
* with a device compatible but for which the connection is disallowed
* by NM configuration. */
- if (!nm_device_check_connection_compatible(device, conn, &error)
+ if (!nm_device_check_connection_compatible(device, conn, TRUE, &error)
&& !g_error_matches(error,
NM_UTILS_ERROR,
NM_UTILS_ERROR_CONNECTION_AVAILABLE_DISALLOWED))
@@ -3641,7 +3641,7 @@ have_connection_for_device(NMSettings *self, NMDevice *device)
c_list_for_each_entry (sett_conn, &priv->connections_lst_head, _connections_lst) {
NMConnection *connection = nm_settings_connection_get_connection(sett_conn);
- if (!nm_device_check_connection_compatible(device, connection, NULL))
+ if (!nm_device_check_connection_compatible(device, connection, TRUE, NULL))
continue;
if (nm_settings_connection_default_wired_get_device(sett_conn))