linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, javier@cozybit.com,
	linville@tuxdriver.com, devel@lists.open80211s.org,
	Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
Subject: [PATCH 3/4] mac80211: implement the proactive PREP generation
Date: Wed,  6 Jun 2012 18:20:38 +0800	[thread overview]
Message-ID: <1338978039-4269-4-git-send-email-yeohchunyeow@gmail.com> (raw)
In-Reply-To: <1338978039-4269-1-git-send-email-yeohchunyeow@gmail.com>

Generate the proactive PREP element in Proactive PREQ mode as defined in
Sec. 13.10.10.3 (Case D) of IEEE Std. 802.11-2012

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
---
 net/mac80211/mesh_hwmp.c |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index b1e4399..d038767 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -529,10 +529,11 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
 	struct mesh_path *mpath = NULL;
 	u8 *target_addr, *orig_addr;
 	const u8 *da;
-	u8 target_flags, ttl;
+	u8 target_flags, ttl, flags;
 	u32 orig_sn, target_sn, lifetime;
 	bool reply = false;
 	bool forward = true;
+	bool root_is_gate;
 
 	/* Update target SN, if present */
 	target_addr = PREQ_IE_TARGET_ADDR(preq_elem);
@@ -540,6 +541,9 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
 	target_sn = PREQ_IE_TARGET_SN(preq_elem);
 	orig_sn = PREQ_IE_ORIG_SN(preq_elem);
 	target_flags = PREQ_IE_TARGET_F(preq_elem);
+	/* Proactive PREQ gate announcements */
+	flags = PREQ_IE_FLAGS(preq_elem);
+	root_is_gate = !!(flags & RANN_FLAG_IS_GATE);
 
 	mhwmp_dbg("received PREQ from %pM", orig_addr);
 
@@ -554,6 +558,15 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
 			target_sn = ++ifmsh->sn;
 			ifmsh->last_sn_update = jiffies;
 		}
+	} else if (is_broadcast_ether_addr(target_addr) &&
+			(target_flags & MP_F_DO)) {
+		mpath = mesh_path_lookup(orig_addr, sdata);
+		if (mpath) {
+			if (flags & PREQ_F_PREP)
+				reply = true;
+			if (root_is_gate)
+				mesh_path_add_gate(mpath);
+		}
 	} else {
 		rcu_read_lock();
 		mpath = mesh_path_lookup(target_addr, sdata);
@@ -581,11 +594,20 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
 		ttl = ifmsh->mshcfg.element_ttl;
 		if (ttl != 0) {
 			mhwmp_dbg("replying to the PREQ");
-			mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr,
-				cpu_to_le32(orig_sn), 0, target_addr,
-				cpu_to_le32(target_sn), mgmt->sa, 0, ttl,
-				cpu_to_le32(lifetime), cpu_to_le32(metric),
-				0, sdata);
+			if (!is_broadcast_ether_addr(target_addr))
+				mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr,
+				    cpu_to_le32(orig_sn), 0, target_addr,
+				    cpu_to_le32(target_sn), mgmt->sa, 0, ttl,
+				    cpu_to_le32(lifetime), cpu_to_le32(metric),
+				    0, sdata);
+			else {
+				mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr,
+				    cpu_to_le32(orig_sn), 0, sdata->vif.addr,
+				    cpu_to_le32(++ifmsh->sn), mgmt->sa, 0, ttl,
+				    cpu_to_le32(lifetime), 0,
+				    0, sdata);
+				ifmsh->last_sn_update = jiffies;
+			}
 		} else
 			ifmsh->mshstats.dropped_frames_ttl++;
 	}
-- 
1.7.0.4


  parent reply	other threads:[~2012-06-06 10:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06 10:20 [PATCH 0/4] Support proactive PREQ mechanism in Mesh Chun-Yeow Yeoh
2012-06-06 10:20 ` [PATCH 1/4] {nl,cfg,mac}80211: implement dot11MeshHWMProotInterval and dot11MeshHWMPactivePathToRootTimeout Chun-Yeow Yeoh
2012-06-06 10:23   ` Johannes Berg
2012-06-06 10:20 ` [PATCH 2/4] mac80211: implement the proactive PREQ generation Chun-Yeow Yeoh
2012-06-06 10:24   ` Johannes Berg
2012-06-06 10:25   ` Johannes Berg
2012-06-06 10:20 ` Chun-Yeow Yeoh [this message]
2012-06-06 10:25   ` [PATCH 3/4] mac80211: implement the proactive PREP generation Johannes Berg
2012-06-06 10:20 ` [PATCH 4/4] mac80211: invoke the timer only with correct dot11MeshHWMPRootMode value Chun-Yeow Yeoh
2012-06-06 10:26   ` Johannes Berg

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=1338978039-4269-4-git-send-email-yeohchunyeow@gmail.com \
    --to=yeohchunyeow@gmail.com \
    --cc=devel@lists.open80211s.org \
    --cc=javier@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;
as well as URLs for NNTP newsgroup(s).