Linux wireless drivers development
 help / color / mirror / Atom feed
From: Thomas Pedersen <thomas@cozybit.com>
To: linux-wireless@vger.kernel.org
Cc: Thomas Pedersen <thomas@cozybit.com>,
	johannes@sipsolutions.net, linville@tuxdriver.com
Subject: [PATCH 2/3] mac80211: find correct IE offset in mesh beacons
Date: Wed, 19 Oct 2011 17:23:22 -0700	[thread overview]
Message-ID: <1319070203-22097-2-git-send-email-thomas@cozybit.com> (raw)
In-Reply-To: <1319070203-22097-1-git-send-email-thomas@cozybit.com>

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
---
 net/mac80211/mesh.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index a7078fd..19ec8bd 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -569,6 +569,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
 	u32 supp_rates = 0;
 	size_t baselen;
 	int freq;
+	u8 *ies;
 	enum ieee80211_band band = rx_status->band;
 
 	/* ignore ProbeResp to foreign address */
@@ -576,12 +577,22 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
 	    compare_ether_addr(mgmt->da, sdata->vif.addr))
 		return;
 
-	baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
+	switch (stype) {
+	case IEEE80211_STYPE_PROBE_RESP:
+		ies = (u8 *) mgmt->u.probe_resp.variable;
+		break;
+	case IEEE80211_STYPE_BEACON:
+		ies = (u8 *) mgmt->u.beacon.variable;
+		break;
+	default:
+		return;
+	}
+
+	baselen = ies - (u8 *) mgmt;
 	if (baselen > len)
 		return;
 
-	ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
-			       &elems);
+	ieee802_11_parse_elems(ies, len - baselen, &elems);
 
 	/* ignore beacons from secure mesh peers if our security is off */
 	if (elems.rsn_len && sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE)
-- 
1.7.5.4


  reply	other threads:[~2011-10-20  0:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20  0:23 [PATCH 1/3] mac80211: comment allocation of mesh frames Thomas Pedersen
2011-10-20  0:23 ` Thomas Pedersen [this message]
2011-10-20 11:13   ` [PATCH 2/3] mac80211: find correct IE offset in mesh beacons Johannes Berg
2011-10-20 17:48     ` Thomas Pedersen
2011-10-20 17:51       ` Johannes Berg
2011-10-20 17:53         ` Thomas Pedersen
2011-10-20  0:23 ` [PATCH 3/3] mac80211: select queue for fwded mesh frames Thomas Pedersen
2011-10-20  7:26 ` [PATCH v2 " Thomas Pedersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1319070203-22097-2-git-send-email-thomas@cozybit.com \
    --to=thomas@cozybit.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox