summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-05-07 10:21:04 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-05-07 18:30:06 +0200
commita2450ddde00100e0c3fd3c3d005d49fa9a571a37 (patch)
tree3a9072328ff968ade3717954802ac49315b3762e
parentb1cc3beb7976887779c2aa9b079588df195c794e (diff)
downloadNetworkManager-a2450ddde00100e0c3fd3c3d005d49fa9a571a37.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.
-rw-r--r--src/devices/nm-device-ethernet.c23
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;
}