linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS
@ 2009-08-05  9:28 Zhu Yi
  2009-08-05 15:41 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yi @ 2009-08-05  9:28 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, Zhu Yi

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

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 net/wireless/nl80211.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0cd5482..086d3fb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS
  2009-08-05  9:28 [PATCH] nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS Zhu Yi
@ 2009-08-05 15:41 ` Johannes Berg
  2009-08-06  1:46   ` Zhu Yi
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2009-08-05 15:41 UTC (permalink / raw)
  To: Zhu Yi; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

On Wed, 2009-08-05 at 17:28 +0800, Zhu Yi wrote:
> 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.

> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS
  2009-08-05 15:41 ` Johannes Berg
@ 2009-08-06  1:46   ` Zhu Yi
  2009-08-06  7:28     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Yi @ 2009-08-06  1:46 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Wed, 2009-08-05 at 23:41 +0800, Johannes Berg wrote: 
> On Wed, 2009-08-05 at 17:28 +0800, Zhu Yi wrote:
> > 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.
> 
> > --- a/net/wireless/nl80211.c
> > +++ b/net/wireless/nl80211.c
> > @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS
  2009-08-06  1:46   ` Zhu Yi
@ 2009-08-06  7:28     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2009-08-06  7:28 UTC (permalink / raw)
  To: Zhu Yi; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

On Thu, 2009-08-06 at 09:46 +0800, Zhu Yi wrote:

> 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-06  7:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-05  9:28 [PATCH] nl80211: fix attrtype and value for NL80211_ATTR_SUPPORTED_COMMANDS Zhu Yi
2009-08-05 15:41 ` Johannes Berg
2009-08-06  1:46   ` Zhu Yi
2009-08-06  7:28     ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).