All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nl80211: allow to register for mgmt frames without a matching pattern
@ 2013-06-18 12:29 Antonio Quartulli
  2013-06-18 12:32 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-06-18 12:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli

From: Antonio Quartulli <antonio@open-mesh.com>

It may be the case that a user wants to register for any
frame of a particular type.

Allow this operation by passing null as matching pattern and
0 as pattern len when registering for the frame.

This is useful to wpa_supplicant when it wants to receive
any AUTH frame.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 net/wireless/nl80211.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e402819..878d346 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7099,9 +7099,11 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
 	struct wireless_dev *wdev = info->user_ptr[1];
 	u16 frame_type = IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION;
+	void *data = nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]);
+	int len = 0;
 
-	if (!info->attrs[NL80211_ATTR_FRAME_MATCH])
-		return -EINVAL;
+	if (data)
+		len = nla_len(data);
 
 	if (info->attrs[NL80211_ATTR_FRAME_TYPE])
 		frame_type = nla_get_u16(info->attrs[NL80211_ATTR_FRAME_TYPE]);
@@ -7125,8 +7127,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
 		return -EOPNOTSUPP;
 
 	return cfg80211_mlme_register_mgmt(wdev, info->snd_portid, frame_type,
-			nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]),
-			nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]));
+					   data, len);
 }
 
 static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
-- 
1.8.1.5


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

* Re: [PATCH] nl80211: allow to register for mgmt frames without a matching pattern
  2013-06-18 12:29 [PATCH] nl80211: allow to register for mgmt frames without a matching pattern Antonio Quartulli
@ 2013-06-18 12:32 ` Johannes Berg
  2013-06-18 12:42   ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2013-06-18 12:32 UTC (permalink / raw)
  To: Antonio Quartulli; +Cc: linux-wireless, Antonio Quartulli

On Tue, 2013-06-18 at 14:29 +0200, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
> 
> It may be the case that a user wants to register for any
> frame of a particular type.
> 
> Allow this operation by passing null as matching pattern and
> 0 as pattern len when registering for the frame.
> 
> This is useful to wpa_supplicant when it wants to receive
> any AUTH frame.

We can (and do) pass a 0-length pattern, any problem with that?

johannes


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

* Re: [PATCH] nl80211: allow to register for mgmt frames without a matching pattern
  2013-06-18 12:32 ` Johannes Berg
@ 2013-06-18 12:42   ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2013-06-18 12:42 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli

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

On Tue, Jun 18, 2013 at 02:32:52PM +0200, Johannes Berg wrote:
> On Tue, 2013-06-18 at 14:29 +0200, Antonio Quartulli wrote:
> > From: Antonio Quartulli <antonio@open-mesh.com>
> > 
> > It may be the case that a user wants to register for any
> > frame of a particular type.
> > 
> > Allow this operation by passing null as matching pattern and
> > 0 as pattern len when registering for the frame.
> > 
> > This is useful to wpa_supplicant when it wants to receive
> > any AUTH frame.
> 
> We can (and do) pass a 0-length pattern, any problem with that?

Hello Johannes,

I did not know that netlink supports 0-length attribute.
Thanks for the hint. At this point this patch can be dropped.

Regards,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-06-18 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-18 12:29 [PATCH] nl80211: allow to register for mgmt frames without a matching pattern Antonio Quartulli
2013-06-18 12:32 ` Johannes Berg
2013-06-18 12:42   ` Antonio Quartulli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.