Skip to contentSkip to conversation

nl80211: allow to register for mgmt frames without a matching pattern

PATCH In review Antonio Quartulli 2 participants 3 messages Jun 18, 2013 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: allow to register for mgmt frames without a matching pattern

From: Antonio Quartulli <[email protected]>

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.

---
 net/wireless/nl80211.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
net/wireless/nl80211.c +5 -4
index e402819..878d346 100644
@@ -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)
Signature · 1 line
1.8.1.5
maintainer
#1 lore raw
Quoted 10 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

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

#2 lore raw
Quoted 6 lines · Johannes Berg
Quoted 5 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]>

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

Quoted 7 lines
Quoted 5 lines

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,

Signature · 4 lines
Antonio Quartulli

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