From: Gokul Sivakumar Date: Fri, 10 Sep 2021 14:16:15 +0000 (+0530) Subject: iw: nl80211: add NLA_F_NESTED to nla_nest_start() with older libnl versions X-Git-Tag: v5.16~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50918cbb8e52ecae014f62617c8c342be960351b;p=thirdparty%2Fiw.git iw: nl80211: add NLA_F_NESTED to nla_nest_start() with older libnl versions It is noticed in Kernel version 5.14.0-rc4+, that when sending the NL cmd NL80211_CMD_SET_TID_CONFIG with nested attrs under NL80211_ATTR_TID_CONFIG, kernel returnes a response with the error "NLA_F_NESTED is missing". $ sudo ./iw dev wlan0 set tidconf tids 0x1 ampdu on kernel reports: NLA_F_NESTED is missing command failed: Invalid argument (-22)) Fix this by setting NLA_F_NESTED flag everytime when using nla_nest_start() library function. This is needed to make cfg80211 allow the nl80211 command NL80211_ATTR_TID_CONFIG in the new kernel versions that enforce netlink attribute policy validation. Signed-off-by: Gokul Sivakumar Link: https://lore.kernel.org/r/20210910141618.1594617-1-gokulkumar792@gmail.com Signed-off-by: Johannes Berg --- diff --git a/iw.h b/iw.h index a118f5b..545fd0e 100644 --- a/iw.h +++ b/iw.h @@ -11,6 +11,11 @@ #include "nl80211.h" #include "ieee80211.h" +#ifndef NL_CAPABILITY_VERSION_3_5_0 +#define nla_nest_start(msg, attrtype) \ + nla_nest_start(msg, NLA_F_NESTED | (attrtype)) +#endif + /* support for extack if compilation headers are too old */ #ifndef NETLINK_EXT_ACK #define NETLINK_EXT_ACK 11