]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: nl80211: add NLA_F_NESTED to nla_nest_start() with older libnl versions
authorGokul Sivakumar <gokulkumar792@gmail.com>
Fri, 10 Sep 2021 14:16:15 +0000 (19:46 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 24 Sep 2021 11:11:05 +0000 (13:11 +0200)
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 <gokulkumar792@gmail.com>
Link: https://lore.kernel.org/r/20210910141618.1594617-1-gokulkumar792@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
iw.h

diff --git a/iw.h b/iw.h
index a118f5bc7f6443d3ee2ad401fc9a1b74f57e969b..545fd0e71ec320c111e70e3119138e9462c2e126 100644 (file)
--- a/iw.h
+++ b/iw.h
 #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