diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-07 10:21:04 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-05-28 15:03:20 +0200 |
commit | dbdc34b99cae5203cf372f507b946262804cf9a9 (patch) | |
tree | a88745dccd2cb8d05c3338ec735dcdce41b9f69c /src | |
parent | e9c6b55b163a35e57077f6a00d71adcd7e8b7503 (diff) | |
download | NetworkManager-dbdc34b99cae5203cf372f507b946262804cf9a9.tar.gz |
ethernet: complete an interface name in complete_connection()
If the AddAndActivate() caller didn't explicitely a MAC address, default
to pinpointing the connection to the device by the means of an interface
name. This makes more sense than a MAC address with stable device names.
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/nm-device-ethernet.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index ad7066113e..619fd5a01e 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -1390,8 +1390,6 @@ complete_connection (NMDevice *device, { NMSettingWired *s_wired; NMSettingPppoe *s_pppoe; - const char *perm_hw_addr; - gboolean perm_hw_addr_is_fake; s_pppoe = nm_connection_get_setting_pppoe (connection); @@ -1401,6 +1399,12 @@ complete_connection (NMDevice *device, if (s_pppoe && !nm_setting_verify (NM_SETTING (s_pppoe), NULL, error)) return FALSE; + s_wired = nm_connection_get_setting_wired (connection); + if (!s_wired) { + s_wired = (NMSettingWired *) nm_setting_wired_new (); + nm_connection_add_setting (connection, NM_SETTING (s_wired)); + } + /* Default to an ethernet-only connection, but if a PPPoE setting was given * then PPPoE should be our connection type. */ @@ -1411,22 +1415,9 @@ complete_connection (NMDevice *device, NULL, s_pppoe ? _("PPPoE connection") : _("Wired connection"), NULL, - NULL, + nm_setting_wired_get_mac_address (s_wired) ? NULL : nm_device_get_iface (device), s_pppoe ? FALSE : TRUE); /* No IPv6 by default yet for PPPoE */ - s_wired = nm_connection_get_setting_wired (connection); - if (!s_wired) { - s_wired = (NMSettingWired *) nm_setting_wired_new (); - nm_connection_add_setting (connection, NM_SETTING (s_wired)); - } - - perm_hw_addr = nm_device_get_permanent_hw_address_full (device, TRUE, &perm_hw_addr_is_fake); - if (perm_hw_addr && !perm_hw_addr_is_fake && !nm_setting_wired_get_mac_address (s_wired)) { - g_object_set (G_OBJECT (s_wired), - NM_SETTING_WIRED_MAC_ADDRESS, perm_hw_addr, - NULL); - } - return TRUE; } |