diff mbox

[2/3] mac80211: generate mesh probe requests

Message ID 1359853341-29237-3-git-send-email-thomas@cozybit.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Thomas Pedersen Feb. 3, 2013, 1:02 a.m. UTC
A mesh probe request must include the mesh ID IE and a
wildcard SSID IE. Add this and transpose the SSID scan
list into mesh IDs for mesh interfaces.

Also allow the user to specify a mesh ID IE in the user
scan IEs, since additional SSID IEs seem to be allowed.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
---
 net/mac80211/tx.c   |   15 +++++++++++----
 net/mac80211/util.c |    1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

Comments

Johannes Berg Feb. 4, 2013, 5:38 p.m. UTC | #1
On Sat, 2013-02-02 at 17:02 -0800, Thomas Pedersen wrote:

> -	pos = skb_put(skb, ie_ssid_len);
> -	*pos++ = WLAN_EID_SSID;
> +	if (ieee80211_vif_is_mesh(vif)) {
> +		pos = skb_put(skb, 2 + 2 + ssid_len);
> +		*pos++ = WLAN_EID_SSID;
> +		*pos++ = 0;
> +		/* NOTE: mesh ID will be out of order */

Why put it out of order?

Also I'm not convinced that it's a good idea to translate "SSID" from
the userspace API to "mesh ID" silently? Might make more sense to have
those separately maybe? I mean, it seems reasonable to even think you
might scan for a mesh network when you're not a mesh interface, for
example?

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
Thomas Pedersen Feb. 4, 2013, 5:57 p.m. UTC | #2
On Mon, Feb 4, 2013 at 9:38 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Sat, 2013-02-02 at 17:02 -0800, Thomas Pedersen wrote:
>
>> -     pos = skb_put(skb, ie_ssid_len);
>> -     *pos++ = WLAN_EID_SSID;
>> +     if (ieee80211_vif_is_mesh(vif)) {
>> +             pos = skb_put(skb, 2 + 2 + ssid_len);
>> +             *pos++ = WLAN_EID_SSID;
>> +             *pos++ = 0;
>> +             /* NOTE: mesh ID will be out of order */
>
> Why put it out of order?
>
> Also I'm not convinced that it's a good idea to translate "SSID" from
> the userspace API to "mesh ID" silently? Might make more sense to have
> those separately maybe? I mean, it seems reasonable to even think you
> might scan for a mesh network when you're not a mesh interface, for
> example?

Yeah that makes more sense,  but will obviously require more work.
I'll just drop this for now.
Thomas Pedersen Feb. 4, 2013, 5:58 p.m. UTC | #3
On Mon, Feb 4, 2013 at 9:38 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Sat, 2013-02-02 at 17:02 -0800, Thomas Pedersen wrote:
>
>> -     pos = skb_put(skb, ie_ssid_len);
>> -     *pos++ = WLAN_EID_SSID;
>> +     if (ieee80211_vif_is_mesh(vif)) {
>> +             pos = skb_put(skb, 2 + 2 + ssid_len);
>> +             *pos++ = WLAN_EID_SSID;
>> +             *pos++ = 0;
>> +             /* NOTE: mesh ID will be out of order */
>
> Why put it out of order?
>
> Also I'm not convinced that it's a good idea to translate "SSID" from
> the userspace API to "mesh ID" silently? Might make more sense to have
> those separately maybe? I mean, it seems reasonable to even think you
> might scan for a mesh network when you're not a mesh interface, for
> example?

Yeah that makes more sense,  but will obviously require more work.
I'll just drop this for now.
Johannes Berg Feb. 4, 2013, 6:03 p.m. UTC | #4
On Mon, 2013-02-04 at 09:58 -0800, Thomas Pedersen wrote:
> On Mon, Feb 4, 2013 at 9:38 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Sat, 2013-02-02 at 17:02 -0800, Thomas Pedersen wrote:
> >
> >> -     pos = skb_put(skb, ie_ssid_len);
> >> -     *pos++ = WLAN_EID_SSID;
> >> +     if (ieee80211_vif_is_mesh(vif)) {
> >> +             pos = skb_put(skb, 2 + 2 + ssid_len);
> >> +             *pos++ = WLAN_EID_SSID;
> >> +             *pos++ = 0;
> >> +             /* NOTE: mesh ID will be out of order */
> >
> > Why put it out of order?
> >
> > Also I'm not convinced that it's a good idea to translate "SSID" from
> > the userspace API to "mesh ID" silently? Might make more sense to have
> > those separately maybe? I mean, it seems reasonable to even think you
> > might scan for a mesh network when you're not a mesh interface, for
> > example?
> 
> Yeah that makes more sense,  but will obviously require more work.
> I'll just drop this for now.

I guess the other question is if you actually want this at all. I mean,
if you just do patch 1 and 3, then unless you want to actively scan for
multiple networks you can just include the mesh ID in the IE parameter.
Seems for many purposes that could be acceptable already. Now I'm not
saying that you shouldn't put it into the kernel, there certainly could
be value in that, just saying that in terms of effort that might be
easier?

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
Thomas Pedersen Feb. 4, 2013, 6:16 p.m. UTC | #5
On Mon, Feb 4, 2013 at 10:03 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2013-02-04 at 09:58 -0800, Thomas Pedersen wrote:
>> On Mon, Feb 4, 2013 at 9:38 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
>> > On Sat, 2013-02-02 at 17:02 -0800, Thomas Pedersen wrote:
>> >
>> >> -     pos = skb_put(skb, ie_ssid_len);
>> >> -     *pos++ = WLAN_EID_SSID;
>> >> +     if (ieee80211_vif_is_mesh(vif)) {
>> >> +             pos = skb_put(skb, 2 + 2 + ssid_len);
>> >> +             *pos++ = WLAN_EID_SSID;
>> >> +             *pos++ = 0;
>> >> +             /* NOTE: mesh ID will be out of order */
>> >
>> > Why put it out of order?
>> >
>> > Also I'm not convinced that it's a good idea to translate "SSID" from
>> > the userspace API to "mesh ID" silently? Might make more sense to have
>> > those separately maybe? I mean, it seems reasonable to even think you
>> > might scan for a mesh network when you're not a mesh interface, for
>> > example?
>>
>> Yeah that makes more sense,  but will obviously require more work.
>> I'll just drop this for now.
>
> I guess the other question is if you actually want this at all. I mean,
> if you just do patch 1 and 3, then unless you want to actively scan for
> multiple networks you can just include the mesh ID in the IE parameter.
> Seems for many purposes that could be acceptable already. Now I'm not
> saying that you shouldn't put it into the kernel, there certainly could
> be value in that, just saying that in terms of effort that might be
> easier?

Yeah, allowing userspace to specify the mesh ID IEs would be easy for now.

Thanks,
diff mbox

Patch

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 01dc001..9f3e9ba 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2622,11 +2622,18 @@  struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
 	memcpy(hdr->addr2, vif->addr, ETH_ALEN);
 	eth_broadcast_addr(hdr->addr3);
 
-	pos = skb_put(skb, ie_ssid_len);
-	*pos++ = WLAN_EID_SSID;
+	if (ieee80211_vif_is_mesh(vif)) {
+		pos = skb_put(skb, 2 + 2 + ssid_len);
+		*pos++ = WLAN_EID_SSID;
+		*pos++ = 0;
+		/* NOTE: mesh ID will be out of order */
+		*pos++ = WLAN_EID_MESH_ID;
+	} else {
+		pos = skb_put(skb, 2 + ssid_len);
+		*pos++ = WLAN_EID_SSID;
+	}
 	*pos++ = ssid_len;
-	if (ssid_len)
-		memcpy(pos, ssid, ssid_len);
+	memcpy(pos, ssid, ssid_len);
 	pos += ssid_len;
 
 	return skb;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 139ad9b..aeb0f88 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1181,6 +1181,7 @@  int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
 	if (ie && ie_len) {
 		static const u8 before_ht[] = {
 			WLAN_EID_SSID,
+			WLAN_EID_MESH_ID,
 			WLAN_EID_SUPP_RATES,
 			WLAN_EID_REQUEST,
 			WLAN_EID_EXT_SUPP_RATES,