svn commit: r193450 - projects/mesh11s/sys/net80211

Rui Paulo rpaulo at FreeBSD.org
Thu Jun 4 18:27:18 UTC 2009


Author: rpaulo
Date: Thu Jun  4 18:27:17 2009
New Revision: 193450
URL: http://svn.freebsd.org/changeset/base/193450

Log:
  Add more allocation handling code.
  Remove 'Step XX' from the comments.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/mesh11s/sys/net80211/ieee80211_hwmp.c

Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_hwmp.c	Thu Jun  4 18:25:39 2009	(r193449)
+++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c	Thu Jun  4 18:27:17 2009	(r193450)
@@ -125,6 +125,8 @@ static const uint8_t	proactiveaddr[IEEE8
 	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 static const uint8_t	broadcastaddr[IEEE80211_ADDR_LEN] =
 	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+static const uint8_t	invalidaddr[IEEE80211_ADDR_LEN] =
+	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
 SYSCTL_NODE(_net_wlan, OID_AUTO, hwmp, CTLFLAG_RD, 0,
     "IEEE 802.11s HWMP parameters");
@@ -495,15 +497,24 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 	mtx_unlock(&hs->hs_lock);
 
 	/*
-	 * Step 1. Record the PREQ ID and the originator MAC address.
-	 */
-
-	/*
-	 * Step 2.
+	 * Record the PREQ ID and the originator MAC address.
 	 */
+	if (fi == NULL) {
+		fi = malloc(sizeof(struct ieee80211_hwmp_fi), M_80211_VAP,
+		    M_NOWAIT | M_ZERO);
+		memset(fi, 0, sizeof(*fi));
+		IEEE80211_ADDR_COPY(fi->fi_dest, preq->preq_origaddr);
+		fi->fi_seq = preq->preq_origseq;
+		fi->fi_metric = preq->preq_metric;
+		fi->fi_lifetime = preq->preq_lifetime;
+		mtx_lock(&hs->hs_lock);
+		TAILQ_INSERT_TAIL(&hs->hs_head, fi, fi_next);
+		mtx_unlock(&hs->hs_lock);
+	}
+	fi->fi_preqid = preq->preq_id;
 
 	/*
-	 * Step 3. Check if the PREQ is addressed to us.
+	 * Check if the PREQ is addressed to us.
 	 * XXX: check if this is part of a proxy address.
 	 */
 	if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) {
@@ -526,19 +537,26 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 		prep.prep_origseq = hs->hs_seq++;
 		/* XXX addr1 = next hop */
 		hwmp_send_prep(ni, vap->iv_myaddr, preq->preq_origaddr, &prep);
+		/*
+		 * Build the reverse path, if we don't have it already.
+		 */
+		if (fi == NULL ||
+		    memcmp(fi->fi_nexthop, invalidaddr, IEEE80211_ADDR_LEN)) {
+			ieee80211_hwmp_discover(vap, fi->fi_dest);
+		}
+
 		return;
 	}
 
-	/* XXX: Step 4. Check for AE bit and update proxy information */
+	/* XXX missing. Check for AE bit and update proxy information */
 
 	/*
-	 * Step 5. Intermediate reply for PREQs with 1 target.
+	 * Intermediate reply for PREQs with 1 target.
 	 */
 	if (preq->preq_ttl > 1 && preq->preq_tcount == 1 &&
 	    !(PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) {
 		struct ieee80211_meshpreq_ie ppreq; /* propagated PREQ */
 
-
 		memcpy(&ppreq, preq, sizeof(ppreq));
 		/*
 		 * Can we do an intermediate path reply?
@@ -597,14 +615,14 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 			    &ppreq);
 		}
 		/*
-		 * XXX: Step 6. Update the percursor table
+		 * XXX: Update the percursor table
 		 */
 		return;
 	}
 		
 
 	/*
-	 * XXX: Step 8. Proactive PREQ: reply with a proactive PREP to the
+	 * XXX: Proactive PREQ: reply with a proactive PREP to the
 	 * root STA if requested.
 	 */
 	if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), proactiveaddr) &&
@@ -658,12 +676,12 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 		return;
 
 	/*
-	 * Step 1: Update the Forwarding Information.
+	 * Update the Forwarding Information.
 	 */
 
 
 	/*
-	 * Step 2: If it's NOT for us, propagate the PREP if TTL is
+	 * If it's NOT for us, propagate the PREP if TTL is
 	 * greater than 1.
 	 */
 	if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, prep->prep_targetaddr) &&
@@ -677,18 +695,18 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 		IEEE80211_ADDR_COPY(pprep.prep_origaddr, vap->iv_myaddr);
 		hwmp_send_prep(ni, vap->iv_myaddr, broadcastaddr, &pprep);
 		/*
-		 * XXX: Step 5: update the precursor list.
+		 * XXX: update the precursor list.
 		 */
 		return;
 	}
 
 	/*
-	 * XXX: Step 3: If it's for us and the AE bit is set, update the
+	 * XXX: If it's for us and the AE bit is set, update the
 	 * proxy information table.
 	 */
 
 	/*
-	 * XXX: Step 4: If it's NOT for us and the AE bit is set,
+	 * XXX: If it's NOT for us and the AE bit is set,
 	 * update the proxy information table.
 	 */
 
@@ -917,7 +935,7 @@ ieee80211_hwmp_discover(struct ieee80211
 		hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr,
 		    &preq);
 	} else 
-		return ieee80211_find_txnode(vap, fi->fi_nexthop);
+		return vap->iv_bss; //ieee80211_find_txnode(vap, fi->fi_nexthop);
 
 	return vap->iv_bss;
 }


More information about the svn-src-projects mailing list