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

Rui Paulo rpaulo at FreeBSD.org
Wed Jul 8 16:08:45 UTC 2009


Author: rpaulo
Date: Wed Jul  8 16:08:44 2009
New Revision: 195464
URL: http://svn.freebsd.org/changeset/base/195464

Log:
  Fix meshconf IE creation.
  
  Sponsored by:	The FreeBSD Foundation

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

Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c	Wed Jul  8 16:04:15 2009	(r195463)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c	Wed Jul  8 16:08:44 2009	(r195464)
@@ -2084,10 +2084,9 @@ static int
 mesh_verify_meshconf(struct ieee80211vap *vap, const uint8_t *ie)
 {
 	static const uint8_t null[4] = IEEE80211_MESHCONF_NULL;
-	static const uint8_t hwmp[4] = IEEE80211_MESHCONF_HWMP;
-	static const uint8_t airtime[4] = IEEE80211_MESHCONF_AIRTIME;
 	const struct ieee80211_meshconf_ie *meshconf =
 	    (const struct ieee80211_meshconf_ie *) ie;
+	const struct ieee80211_mesh_state *ms = vap->iv_mesh;
 
 	if (meshconf == NULL)
 		return 1;
@@ -2096,14 +2095,14 @@ mesh_verify_meshconf(struct ieee80211vap
 		    "wrong mesh conf version: %d\n", meshconf->conf_ver);
 		return 1;
 	}
-	if (memcmp(meshconf->conf_pselid, hwmp, 4) != 0) {
+	if (memcmp(meshconf->conf_pselid, ms->ms_ppath->mpp_ie, 4) != 0) {
 		IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH,
 		    "unknown path selection algorithm: 0x%x%x%x%x\n",
 		    meshconf->conf_pselid[0], meshconf->conf_pselid[1],
 		    meshconf->conf_pselid[2], meshconf->conf_pselid[3]);
 		return 1;
 	}
-	if (memcmp(meshconf->conf_pmetid, airtime, 4) != 0) {
+	if (memcmp(meshconf->conf_pmetid, ms->ms_pmetric->mpm_ie, 4) != 0) {
 		IEEE80211_DPRINTF(vap, IEEE80211_MSG_MESH,
 		    "unknown path metric algorithm: 0x%x%x%x%x\n",
 		    meshconf->conf_pmetid[0], meshconf->conf_pmetid[1],
@@ -2178,23 +2177,25 @@ uint8_t *
 ieee80211_add_meshconf(uint8_t *frm, struct ieee80211vap *vap)
 {
 	uint8_t neighs = 0;
-	struct ieee80211_mesh_state *ms = vap->iv_mesh;
-	/* XXX needs to be changed for other protocols */
-	static const struct ieee80211_meshconf_ie ie = {
-		.conf_ie	= IEEE80211_ELEMID_MESHCONF,
-		.conf_len	= sizeof(struct ieee80211_meshconf_ie) - 2,
-		.conf_ver 	= IEEE80211_MESHCONF_VERSION,
-		.conf_pselid	= IEEE80211_MESHCONF_HWMP,
-		.conf_pmetid	= IEEE80211_MESHCONF_AIRTIME,
-		.conf_ccid	= IEEE80211_MESHCONF_NULL,
-		.conf_syncid	= IEEE80211_MESHCONF_NULL,
-		.conf_authid	= IEEE80211_MESHCONF_NULL,
-	};
+	const struct ieee80211_mesh_state *ms = vap->iv_mesh;
+	static const uint8_t null[4] = IEEE80211_MESHCONF_NULL;
 
 	KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a MBSS vap"));
 
-	memcpy(frm, &ie, sizeof(ie));
-	frm += __offsetof(struct ieee80211_meshconf_ie, conf_form);
+	*frm++ = IEEE80211_ELEMID_MESHCONF;
+	*frm++ = sizeof(struct ieee80211_meshconf_ie) - 2;
+	*frm++ = IEEE80211_MESHCONF_VERSION;
+	memcpy(frm, ms->ms_ppath->mpp_ie, 4);	/* path selection */
+	frm += 4;
+	memcpy(frm, ms->ms_pmetric->mpm_ie, 4);	/* link metric */
+	frm += 4;
+	/* XXX null for now */
+	memcpy(frm, null, 4);			/* congestion control */
+	frm += 4;
+	memcpy(frm, null, 4);			/* sync */
+	frm += 4;
+	memcpy(frm, null, 4);			/* auth */
+	frm += 4;
 	ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, meshconf_neighbors,
 	    &neighs);
 	/* NB: set the number of neighbors before the rest */


More information about the svn-src-projects mailing list