Skip to contentSkip to conversation

nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS

PATCH In review Zhu Yi 2 participants 4 messages Aug 5, 2009 – Aug 6, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Zhu Yi

author
#0 lore raw

PATCH 1/1 nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS

The patch fixes the misuse between attrtype and value for the CMD list nested in NL80211_ATTR_SUPPORTED_COMMANDS attribute.

---
 net/wireless/nl80211.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
net/wireless/nl80211.c +4 -4
index 0cd5482..086d3fb 100644
@@ -520,7 +520,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 	 do {							\
 		if (dev->ops->op) {				\
 			i++;					\
-			NLA_PUT_U32(msg, i, NL80211_CMD_ ## n);	\
+			NLA_PUT_U32(msg, NL80211_CMD_ ## n, i);	\
 		}						\
 	} while (0)
 
@@ -539,19 +539,19 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 	CMD(join_ibss, JOIN_IBSS);
 	if (dev->wiphy.netnsok) {
 		i++;
-		NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS);
+		NLA_PUT_U32(msg, NL80211_CMD_SET_WIPHY_NETNS, i);
 	}
 
 #undef CMD
 
 	if (dev->ops->connect || dev->ops->auth) {
 		i++;
-		NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT);
+		NLA_PUT_U32(msg, NL80211_CMD_CONNECT, i);
 	}
 
 	if (dev->ops->disconnect || dev->ops->deauth) {
 		i++;
-		NLA_PUT_U32(msg, i, NL80211_CMD_DISCONNECT);
+		NLA_PUT_U32(msg, NL80211_CMD_DISCONNECT, i);
 	}
 
 	nla_nest_end(msg, nl_cmds);
Signature · 1 line
1.6.0.4
maintainer
#1 lore raw
Quoted 2 lines · Zhu Yi

The patch fixes the misuse between attrtype and value for the CMD list nested in NL80211_ATTR_SUPPORTED_COMMANDS attribute.

No? It was this way intentionally.

net/wireless/nl80211.c static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, · line 523

Quoted 8 lines
net/wireless/nl80211.c +1 -1
@@ -520,7 +520,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 	 do {							\
 		if (dev->ops->op) {				\
 			i++;					\
-			NLA_PUT_U32(msg, i, NL80211_CMD_ ## n);	\
+			NLA_PUT_U32(msg, NL80211_CMD_ ## n, i);	\

This is an array, the index doesn't matter, and the value is the supported command. You parse it with nla_for_each_nested()

johannes

author
#2 lore raw
Quoted 6 lines · Johannes Berg
Quoted 2 lines · Zhu Yi

The patch fixes the misuse between attrtype and value for the CMD list nested in NL80211_ATTR_SUPPORTED_COMMANDS attribute.

No? It was this way intentionally.

Quoted 11 lines

net/wireless/nl80211.c static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, · line 523

Quoted 8 lines
net/wireless/nl80211.c +1 -1
@@ -520,7 +520,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 	 do {							\
 		if (dev->ops->op) {				\
 			i++;					\
-			NLA_PUT_U32(msg, i, NL80211_CMD_ ## n);	\
+			NLA_PUT_U32(msg, NL80211_CMD_ ## n, i);	\

This is an array, the index doesn't matter, and the value is the supported command. You parse it with nla_for_each_nested()

I'm trying to find if a command (i.e. NL80211_CMD_CONNECT) is supported or not. I think I can use nla_find_nested() if the command is an attribute. But I can also do the find myself if it is an array like now. So, never mind.

Thanks,
-yi

maintainer
#3 lore raw
Quoted 3 lines · Zhu Yi

I'm trying to find if a command (i.e. NL80211_CMD_CONNECT) is supported or not. I think I can use nla_find_nested() if the command is an attribute. But I can also do the find myself if it is an array like now.

Ok, that would have worked too, but I'm pretty sure I documented it the way I also implemented it.

johannes