device: make device incompatible with profiles by default

Currently, NMDeviceWireguard does neither set connection_type_check_compatible
nor implement check_connection_compatible. That means, it appears to be compatible
with every connection profile, which is obviously wrong.

Allow devices not to implement check_connection_compatible() and avoid the issue
by rejecting profiles by default.
This commit is contained in:
Thomas Haller 2018-09-10 10:21:14 +02:00
parent 57cfc6f19d
commit baa0008313

View file

@ -5596,6 +5596,14 @@ check_connection_compatible (NMDevice *self, NMConnection *connection, GError **
klass->connection_type_check_compatible,
error))
return FALSE;
} else if (klass->check_connection_compatible == check_connection_compatible) {
/* the device class does not implement check_connection_compatible nor set
* connection_type_check_compatible. That means, it is by default not compatible
* with any connection type. */
nm_utils_error_set_literal (error,
NM_UTILS_ERROR_CONNECTION_AVAILABLE_INCOMPATIBLE,
"device does not support any connections");
return FALSE;
}
conn_iface = nm_manager_get_connection_iface (nm_manager_get (),