summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-06-10 16:33:30 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2020-06-11 17:36:22 +0200
commit4f63f227cae818866f6966a1c4104622edae4842 (patch)
tree86fd1e3c7e388dbf7e715f50a3957356586d9174
parentf6a2eee8d9c09963bd4b73685170a1339249d3f8 (diff)
downloadNetworkManager-bg/match-path-rh1673321.tar.gz
device: honor the match.path propertybg/match-path-rh1673321
-rw-r--r--src/devices/nm-device.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 5ed122bbb3..cf25012d0f 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6294,6 +6294,7 @@ nm_device_match_parent_hwaddr (NMDevice *device,
static gboolean
check_connection_compatible (NMDevice *self, NMConnection *connection, GError **error)
{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
const char *device_iface = nm_device_get_iface (self);
gs_free_error GError *local = NULL;
gs_free char *conn_iface = NULL;
@@ -6438,6 +6439,13 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
"device does not satisfy match.driver property");
return FALSE;
}
+
+ patterns = nm_setting_match_get_paths (s_match, &num_patterns);
+ if (!nm_wildcard_match_check (priv->path, patterns, num_patterns)) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE,
+ "device does not satisfy match.path property");
+ return FALSE;
+ }
}
return TRUE;