Message ID | 1371558554-367-1-git-send-email-ordex@autistici.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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,
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)