Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 May 2012 16:18:38 +0000 (UTC)
From:      Monthadar Al Jaberi <monthadar@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234896 - head/sys/net80211
Message-ID:  <201205011618.q41GIcsV034502@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: monthadar
Date: Tue May  1 16:18:38 2012
New Revision: 234896
URL: http://svn.freebsd.org/changeset/base/234896

Log:
  Update HWMP Proactive code and mesh route flags.
  
  * Modified hwmp_recv_preq:
      o cleaned up code, removed rootmac variable because preq->origaddr
        is the root when we recevie a Proactive PREQ;
      o Modified so that a PREP in response of a Proactive PREQ is unicast,
        a PREP is ALWAYS unicast;
  * Modified hwmp_recv_prep:
      o Before we mark a route to be valid we should remove the discovery
        flag and then mark it valid in such a way we wont lose the isgate flag;
  
  Approved by: adrian

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- head/sys/net80211/ieee80211_hwmp.c	Tue May  1 16:17:17 2012	(r234895)
+++ head/sys/net80211/ieee80211_hwmp.c	Tue May  1 16:18:38 2012	(r234896)
@@ -904,7 +904,6 @@ hwmp_recv_preq(struct ieee80211vap *vap,
     const struct ieee80211_frame *wh, const struct ieee80211_meshpreq_ie *preq)
 {
 	struct ieee80211_mesh_state *ms = vap->iv_mesh;
-	struct ieee80211_mesh_route *rt = NULL; /* pro-active code */
 	struct ieee80211_mesh_route *rtorig = NULL;
 	struct ieee80211_mesh_route *rtorig_ext = NULL;
 	struct ieee80211_mesh_route *rttarg = NULL;
@@ -1083,33 +1082,20 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 	 */
 	if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) &&
 	    (PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) {
-		uint8_t rootmac[IEEE80211_ADDR_LEN];
-
-		IEEE80211_ADDR_COPY(rootmac, preq->preq_origaddr);
-		rt = ieee80211_mesh_rt_find(vap, rootmac);
-		if (rt == NULL) {
-			rt = ieee80211_mesh_rt_add(vap, rootmac);
-			if (rt == NULL) {
-				IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-				    "unable to add root mesh path to %6D",
-				    rootmac, ":");
-				vap->iv_stats.is_mesh_rtaddfailed++;
-				return;
-			}
-		}
 		IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
-		    "root mesh station @ %6D", rootmac, ":");
+		    "root mesh station @ %6D", preq->preq_origaddr, ":");
 
 		/*
 		 * Reply with a PREP if we don't have a path to the root
 		 * or if the root sent us a proactive PREQ.
 		 */
-		if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 ||
+		if ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 ||
 		    (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_PP)) {
 			prep.prep_flags = 0;
 			prep.prep_hopcount = 0;
 			prep.prep_ttl = ms->ms_ttl;
-			IEEE80211_ADDR_COPY(prep.prep_origaddr, rootmac);
+			IEEE80211_ADDR_COPY(prep.prep_origaddr,
+			    preq->preq_origaddr);
 			prep.prep_origseq = preq->preq_origseq;
 			prep.prep_lifetime = preq->preq_lifetime;
 			prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
@@ -1117,7 +1103,7 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 			    vap->iv_myaddr);
 			prep.prep_targetseq = ++hs->hs_seq;
 			hwmp_send_prep(vap->iv_bss, vap->iv_myaddr,
-			    broadcastaddr, &prep);
+			    rtorig->rt_nexthop, &prep);
 		}
 	}
 
@@ -1319,7 +1305,11 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 	rt->rt_metric = metric;
 	rt->rt_nhops = prep->prep_hopcount + 1;
 	ieee80211_mesh_rt_update(rt, prep->prep_lifetime);
-	rt->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */
+	if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) {
+		/* discovery complete */
+		rt->rt_flags &= ~IEEE80211_MESHRT_FLAGS_DISCOVER;
+	}
+	rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */
 
 	/*
 	 * If it's NOT for us, propagate the PREP



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205011618.q41GIcsV034502>