Add cfg80211_mgmt_reg_match to cfg80211 to check for userspace
application registrations for management frames rx'd from a specific
interface. This function will be used by IBSS code to determine whether
or not to send out "open" authentication frames.
Update documentation for cfg80211_rx_mgmt to note that "query" frames
are sent to matching userspace applications.
Signed-off-by: Will Hawkins <[email protected]>
---
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7319f25..fd84880 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3238,6 +3238,18 @@ void cfg80211_new_sta(struct net_device *dev,
const u8 *mac_addr,
void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t
gfp);
/**
+ * cfg80211_mgmt_reg_match - check for userspace mgmt frame registrations
+ *
+ * @dev: the netdev
+ * @frame_type: mgmt frame type to match against. Should be or'd
+ * with IEEE80211_FTYPE_MGMT before being passed.
+ *
+ * Returns %true if a user space application has registered for this
+ * frame type. Returns %false otherwise.
+ */
+int cfg80211_mgmt_reg_match(struct net_device *dev, u16 frame_type);
+
+/**
* cfg80211_rx_mgmt - notification of received, unprocessed management
frame
* @dev: network device
* @freq: Frequency on which the frame was received in MHz
@@ -3247,6 +3259,7 @@ void cfg80211_del_sta(struct net_device *dev,
const u8 *mac_addr, gfp_t gfp);
* @gfp: context flags
*
* Returns %true if a user space application has registered for this frame.
+ * When a user space application is registered for this frame, it is
notified.
* For action frames, that makes it responsible for rejecting unrecognized
* action frames; %false otherwise, in which case for action frames the
* driver is responsible for rejecting the frame.
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index da4406f..2d5e6dd 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -609,6 +609,41 @@ struct cfg80211_mgmt_registration {
u8 match[];
};
+int cfg80211_mgmt_reg_match(struct net_device *dev, u16 frame_type)
+{
+ struct wireless_dev *wdev = dev->ieee80211_ptr;
+ struct cfg80211_mgmt_registration *reg;
+ int matched = 0;
+ u16 mgmt_type;
+
+ if (!wdev->wiphy->mgmt_stypes)
+ return 0;
+
+ if ((frame_type & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT)
+ return 0;
+
+ if (frame_type & ~(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE))
+ return 0;
+
+ mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4;
+ if (!(wdev->wiphy->mgmt_stypes[wdev->iftype].rx & BIT(mgmt_type)))
+ return 0;
+
+ spin_lock_bh(&wdev->mgmt_registrations_lock);
+
+ list_for_each_entry(reg, &wdev->mgmt_registrations, list) {
+ if (frame_type == le16_to_cpu(reg->frame_type)) {
+ matched = 1;
+ break;
+ }
+ }
+
+ spin_unlock_bh(&wdev->mgmt_registrations_lock);
+
+ return matched;
+}
+EXPORT_SYMBOL(cfg80211_mgmt_reg_match);
+
int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
u16 frame_type, const u8 *match_data,
int match_len)
On 06/19/2012 03:01 AM, Kalle Valo wrote:
> Will Hawkins <[email protected]> writes:
>
>> Add cfg80211_mgmt_reg_match to cfg80211 to check for userspace
>> application registrations for management frames rx'd from a specific
>> interface. This function will be used by IBSS code to determine whether
>> or not to send out "open" authentication frames.
>>
>> Update documentation for cfg80211_rx_mgmt to note that "query" frames
>> are sent to matching userspace applications.
>>
>>
>> Signed-off-by: Will Hawkins <[email protected]>
>
> What's the user visible benefit from this? Does it add new features or
> something? You could document that in the commit log.
>
Thank you for your feedback Kalle. I have to make some changes to this
patch set so I will definitely include a better description in my next
attempt.
Will
Will Hawkins <[email protected]> writes:
> Add cfg80211_mgmt_reg_match to cfg80211 to check for userspace
> application registrations for management frames rx'd from a specific
> interface. This function will be used by IBSS code to determine whether
> or not to send out "open" authentication frames.
>
> Update documentation for cfg80211_rx_mgmt to note that "query" frames
> are sent to matching userspace applications.
>
>
> Signed-off-by: Will Hawkins <[email protected]>
What's the user visible benefit from this? Does it add new features or
something? You could document that in the commit log.
--
Kalle Valo