summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-05-06 16:17:19 +0200
committerThomas Haller <thaller@redhat.com>2020-05-06 16:20:11 +0200
commitbdd0e89b9a0a52b433e82c2df0604089d677cb4e (patch)
tree2bcd71b9cb82db3bd3ba5e88fa30fd656b635716 /src
parent623cf7c9a3ee41c109e8b8710b8391adc2cc5c9a (diff)
downloadNetworkManager-bdd0e89b9a0a52b433e82c2df0604089d677cb4e.tar.gz
device: handle match.driver also with unknown device driver
If the driver is unknown, that doesn't necessarily mean that the match passes. Instead, the match passes if there is no positive match that asks for the driver name.
Diffstat (limited to 'src')
-rw-r--r--src/devices/nm-device.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e4661a7dc4..2430a52f14 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6042,6 +6042,7 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
NM_TYPE_SETTING_MATCH);
if (s_match) {
const char *const *patterns;
+ const char *device_driver;
guint num_patterns = 0;
/* interface_names */
@@ -6104,17 +6105,12 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
}
}
- { /* driver */
- const char *device_driver = nm_device_get_driver (self);
-
- if (device_driver) {
- patterns = nm_setting_match_get_drivers (s_match, &num_patterns);
- if (!nm_wildcard_match_check (device_driver, patterns, num_patterns)) {
- nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
- "device does not satisfy match.driver property");
- return FALSE;
- }
- }
+ device_driver = nm_device_get_driver (self);
+ patterns = nm_setting_match_get_drivers (s_match, &num_patterns);
+ if (!nm_wildcard_match_check (device_driver, patterns, num_patterns)) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_CONNECTION_AVAILABLE_TEMPORARY,
+ "device does not satisfy match.driver property");
+ return FALSE;
}
}