From 2db6295b424d9da96dd3e6d5d52d300ffcfb985c Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 10 Nov 2011 14:47:19 -0600 Subject: [PATCH] wifi: only lock connection to device for non-locally-administered addresses If the device's permanent MAC address is 'locally administered' (ie, first byte | 0x02 != 0) then we don't want to lock the connection to the device because it's likely a device that changes it's MAC every hotplug due to driver bugs or the fact that some devices don't store their MAC in EEPROM anyway. --- src/nm-device-wifi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c index a2230f3da9..a133c8316f 100644 --- a/src/nm-device-wifi.c +++ b/src/nm-device-wifi.c @@ -1211,8 +1211,11 @@ real_complete_connection (NMDevice *device, GByteArray *mac; const guint8 null_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 }; - /* Lock the connection to this device by default */ - if (memcmp (priv->perm_hw_addr, null_mac, ETH_ALEN)) { + /* Lock the connection to this device by default if it uses a + * permanent MAC address (ie not a 'locally administered' one) + */ + if ( !(priv->perm_hw_addr[0] & 0x02) + && memcmp (priv->perm_hw_addr, null_mac, ETH_ALEN)) { mac = g_byte_array_sized_new (ETH_ALEN); g_byte_array_append (mac, priv->perm_hw_addr, ETH_ALEN); g_object_set (G_OBJECT (s_wifi), NM_SETTING_WIRELESS_MAC_ADDRESS, mac, NULL);