Re: [PATCH] allow setting wiphy.perm_addr after driver probe

From: Marcel Holtmann
Date: Tue Aug 12 2014 - 03:58:48 EST


Hi Daniel,

>> the way I read the nl80211 code is that the NL80211_CMD_NEW_INTERFACE
>> requires a wiphy device to be specified. And that is actually just a
>> number. So I have no idea what the MAC has to here.
>>
> OpenWrt finds a wiphy by its MAC.

maybe that is the first problem right there. I see that over sysfs you get phy80211/macaddress. However if you do a dump via NL80211_CMD_GET_WIPHY then you do not have the MAC address there.

>> Why does the wiphy need to know the MAC if it is always specified from
>> userspace when actually creating the new netdev interface. Works for
>> P2P devices, so why wouldn't it work for access point and station
>> mode?
>>
> A MAC can be specified for the netdev, but it is assigned to a wiphy
> identified by its MAC.

That you find the wiphy device by its MAC address seems to be your problem. As I said, on nl80211 you are using the wiphy unique number and not a MAC address.

If you want to use some sort of device discovery via sysfs, then use phy80211/index and other attributes to uniquely identify the device. Basing this on the MAC address seems dangerous. Especially since it might be not valid or an identical default for all cards.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/