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.
This commit is contained in:
Thomas Haller 2019-07-17 13:55:10 +02:00
parent da72f276cd
commit 7644b18443
2 changed files with 3 additions and 3 deletions

View file

@ -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);

View file

@ -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;