All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2 v3] mac80211/cfg80211: add support for userspace to handle auth frames on adhoc ifaces
@ 2012-06-19  0:20 Will Hawkins
  2012-06-19  7:01 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Will Hawkins @ 2012-06-19  0:20 UTC (permalink / raw)
  To: Johannes Berg, linux-wireless, linville

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 <hawkinsw@opentechinstitute.org>
---
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)

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

* Re: [PATCH 1/2 v3] mac80211/cfg80211: add support for userspace to handle auth frames on adhoc ifaces
  2012-06-19  0:20 [PATCH 1/2 v3] mac80211/cfg80211: add support for userspace to handle auth frames on adhoc ifaces Will Hawkins
@ 2012-06-19  7:01 ` Kalle Valo
  2012-06-19 16:12   ` Will Hawkins
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2012-06-19  7:01 UTC (permalink / raw)
  To: Will Hawkins; +Cc: Johannes Berg, linux-wireless, linville

Will Hawkins <hawkinsw@opentechinstitute.org> 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 <hawkinsw@opentechinstitute.org>

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

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

* Re: [PATCH 1/2 v3] mac80211/cfg80211: add support for userspace to handle auth frames on adhoc ifaces
  2012-06-19  7:01 ` Kalle Valo
@ 2012-06-19 16:12   ` Will Hawkins
  0 siblings, 0 replies; 3+ messages in thread
From: Will Hawkins @ 2012-06-19 16:12 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Johannes Berg, linux-wireless, linville



On 06/19/2012 03:01 AM, Kalle Valo wrote:
> Will Hawkins <hawkinsw@opentechinstitute.org> 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 <hawkinsw@opentechinstitute.org>
> 
> 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

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

end of thread, other threads:[~2012-06-19 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19  0:20 [PATCH 1/2 v3] mac80211/cfg80211: add support for userspace to handle auth frames on adhoc ifaces Will Hawkins
2012-06-19  7:01 ` Kalle Valo
2012-06-19 16:12   ` Will Hawkins

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.