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.
This commit is contained in:
Dan Williams 2011-11-10 14:47:19 -06:00
parent e630b638a8
commit 2db6295b42

View file

@ -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);