From 7644b1844336e9de0282e2425dd83de9416c29a1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 17 Jul 2019 13:55:10 +0200 Subject: [PATCH] device: move check for config "no-auto-default" to NMDevice's new_default_connection() Only NMDeviceEthernet implements new_default_connection(). Anyway, it makes only sense to do this precheck by the caller first, and not by each implementation. --- src/devices/nm-device-ethernet.c | 3 --- src/devices/nm-device.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 9b2faf856f..0d45dfdeda 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -1435,9 +1435,6 @@ new_default_connection (NMDevice *self) gs_free char *uuid = NULL; guint i, n_connections; - if (nm_config_get_no_auto_default_for_device (nm_config_get (), self)) - return NULL; - perm_hw_addr = nm_device_get_permanent_hw_address (self); iface = nm_device_get_iface (self); diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 04a94db8a1..4a4fd13b36 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4796,6 +4796,9 @@ nm_device_new_default_connection (NMDevice *self) if (!NM_DEVICE_GET_CLASS (self)->new_default_connection) return NULL; + if (nm_config_get_no_auto_default_for_device (nm_config_get (), self)) + return NULL; + connection = NM_DEVICE_GET_CLASS (self)->new_default_connection (self); if (!connection) return NULL;