device: use permanent MAC address for creating default wired connection

This commit is contained in:
Thomas Haller 2016-06-15 17:19:41 +02:00
parent f578b91a5c
commit 1a6d6d56e6

View file

@ -1425,7 +1425,7 @@ new_default_connection (NMDevice *self)
NMConnection *connection;
NMSettingsConnection *const*connections;
NMSetting *setting;
const char *hw_address;
const char *perm_hw_addr;
gs_free char *defname = NULL;
gs_free char *uuid = NULL;
gs_free char *machine_id = NULL;
@ -1433,8 +1433,8 @@ new_default_connection (NMDevice *self)
if (nm_config_get_no_auto_default_for_device (nm_config_get (), self))
return NULL;
hw_address = nm_device_get_hw_address (self);
if (!hw_address)
perm_hw_addr = nm_device_get_permanent_hw_address (self, FALSE);
if (!perm_hw_addr)
return NULL;
connection = nm_simple_connection_new ();
@ -1453,7 +1453,7 @@ new_default_connection (NMDevice *self)
uuid = _nm_utils_uuid_generate_from_strings ("default-wired",
machine_id ?: "",
defname,
hw_address,
perm_hw_addr,
NULL);
g_object_set (setting,
@ -1467,7 +1467,7 @@ new_default_connection (NMDevice *self)
/* Lock the connection to the device */
setting = nm_setting_wired_new ();
g_object_set (setting, NM_SETTING_WIRED_MAC_ADDRESS, hw_address, NULL);
g_object_set (setting, NM_SETTING_WIRED_MAC_ADDRESS, perm_hw_addr, NULL);
nm_connection_add_setting (connection, setting);
return connection;