diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-07 11:03:19 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-07 11:09:20 +0200 |
commit | 853527b6e82b4d668809ff1a23261964d8bbd4ed (patch) | |
tree | 73c9a56b928db7b17011bfbca4760e53ed01956c | |
parent | 63796462db1611987b5d500c4238f1cc00b847fe (diff) | |
download | NetworkManager-lr/device-id-apn.tar.gz |
ethernet: don't set a hw address in a default connectionlr/device-id-apn
Use an ifname instead.
This also fixes creation of default wired connections for cheapo USB
ethernet adapters that come with the EEPROM footprint unpopulated.
-rw-r--r-- | src/devices/nm-device-ethernet.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index c747f79d51..9c060fd123 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -1430,6 +1430,7 @@ new_default_connection (NMDevice *self) gs_unref_hashtable GHashTable *existing_ids = NULL; struct udev_device *dev; const char *perm_hw_addr; + const char *iface; const char *uprop = "0"; gs_free char *defname = NULL; gs_free char *uuid = NULL; @@ -1439,8 +1440,7 @@ new_default_connection (NMDevice *self) return NULL; perm_hw_addr = nm_device_get_permanent_hw_address (self); - if (!perm_hw_addr) - return NULL; + iface = nm_device_get_iface (self); connection = nm_simple_connection_new (); setting = nm_setting_connection_new (); @@ -1461,7 +1461,7 @@ new_default_connection (NMDevice *self) uuid = _nm_utils_uuid_generate_from_strings ("default-wired", nm_utils_machine_id_str (), defname, - perm_hw_addr, + perm_hw_addr ?: iface, NULL); g_object_set (setting, @@ -1471,13 +1471,9 @@ new_default_connection (NMDevice *self) NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY, NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN, NM_SETTING_CONNECTION_UUID, uuid, NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL), + NM_SETTING_CONNECTION_INTERFACE_NAME, iface, NULL); - /* Lock the connection to the device */ - setting = nm_setting_wired_new (); - g_object_set (setting, NM_SETTING_WIRED_MAC_ADDRESS, perm_hw_addr, NULL); - nm_connection_add_setting (connection, setting); - /* Check if we should create a Link-Local only connection */ dev = nm_platform_link_get_udev_device (nm_device_get_platform (NM_DEVICE (self)), nm_device_get_ip_ifindex (self)); if (dev) |