On Wed, Jul 12, 2023 at 10:44 AM Johannes Berg johannes@sipsolutions.net wrote:
On Wed, 2023-07-12 at 10:38 +0200, Koen Vandeputte wrote:
Executing command NL80211_CMD_GET_WIPHY and parsing it's output natively without libnl shows following attributes as part of the nl80211 generated netlink message (part 16):
GetWiphy: Type: 1 GetWiphy: Type: 2 GetWiphy: Type: 46 GetWiphy: Type: 33074 <-- wrong enum value, above MAX also ..
That's not wrong, that's just NLA_F_NESTED | NL80211_ATTR_MBSSID_CONFIG, since it *is* in fact a nested attribute.
ahha! so one should check on each received attribute if this flag is set?
Switching to nla_nest_start_noflag() which ommits the NLA_F_NESTED flag (like most other similar functions do) fixes this:
GetWiphy: Type: 1 GetWiphy: Type: 2 GetWiphy: Type: 46 GetWiphy: Type: 306 <-- correct enum value GetWiphy: Type: 316
Let's say it _changes_ it, but it doesn't _fix_ it, since it's not broken.
noted
Using nla_nest_start_noflag() is a legacy thing, it shouldn't be done any more. You need to update your userspace, I'm not applying this patch.
Sure, no problem. I guess all the ones with the noflag so far are using it to avoid breaking legacy stuff?
johannes
Thanks for the quick review. Highly appreciated!