From baa0008313e9bdfd469274e91ccf5b13d991884a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 10 Sep 2018 10:21:14 +0200 Subject: [PATCH] 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. --- src/devices/nm-device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 515e6334a2..4160b8af2f 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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 (),