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:17:44 +0200 |
commit | 512ec7e3effe40408ac4a9838b38bcaeed4d760a (patch) | |
tree | 5e8674e0c4b80376552cb309bee0321b4a87d795 | |
parent | 4ed72fa658c03790700ba9084e9328fe38afdee9 (diff) | |
download | NetworkManager-lr/default-ethernet-ifname.tar.gz |
ethernet: don't set a hw address in a default connectionlr/default-ethernet-ifname
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 ff1c482f47..9ab78ddc61 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -1452,6 +1452,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; @@ -1461,8 +1462,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 (); @@ -1483,7 +1483,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, @@ -1493,13 +1493,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) |