From bdd0e89b9a0a52b433e82c2df0604089d677cb4e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 6 May 2020 16:17:19 +0200 Subject: [PATCH] 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. --- src/devices/nm-device.c | 18 +++++++----------- 1 file 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; } }