svn commit: r246509 - head/sys/net80211

Monthadar Al Jaberi monthadar at FreeBSD.org
Thu Feb 7 21:24:53 UTC 2013


Author: monthadar
Date: Thu Feb  7 21:24:52 2013
New Revision: 246509
URL: http://svnweb.freebsd.org/changeset/base/246509

Log:
  Mark root mesh as gate when mesh gate flag set.
  
  * Add function ieee80211_mesh_mark_gate in ieee80211_mesh.h;
  * When received a proactive PREQ or RANN with corresponding mesh gate
    flag set, create a new entry in the known mesh gate list;
  
  Approved by:	adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- head/sys/net80211/ieee80211_hwmp.c	Thu Feb  7 21:24:20 2013	(r246508)
+++ head/sys/net80211/ieee80211_hwmp.c	Thu Feb  7 21:24:52 2013	(r246509)
@@ -1092,6 +1092,16 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 		IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 		    "root mesh station @ %6D", preq->preq_origaddr, ":");
 
+		/* Check if root is a mesh gate, mark it */
+		if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_GATE) {
+			struct ieee80211_mesh_gate_route *gr;
+
+			rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE;
+			gr = ieee80211_mesh_mark_gate(vap, preq->preq_origaddr,
+			    rtorig);
+			gr->gr_lastseq = 0; /* NOT GANN */
+		}
+
 		/*
 		 * Reply with a PREP if we don't have a path to the root
 		 * or if the root sent us a proactive PREQ.
@@ -1745,6 +1755,15 @@ hwmp_recv_rann(struct ieee80211vap *vap,
 		}
 	}
 	hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
+	/* Check if root is a mesh gate, mark it */
+	if (rann->rann_flags & IEEE80211_MESHRANN_FLAGS_GATE) {
+		struct ieee80211_mesh_gate_route *gr;
+
+		rt->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE;
+		gr = ieee80211_mesh_mark_gate(vap, rann->rann_addr,
+			rt);
+		gr->gr_lastseq = 0; /* NOT GANN */
+	}
 	/* discovery timeout */
 	ieee80211_mesh_rt_update(rt,
 	    ticks_to_msecs(ieee80211_hwmp_roottimeout));

Modified: head/sys/net80211/ieee80211_mesh.c
==============================================================================
--- head/sys/net80211/ieee80211_mesh.c	Thu Feb  7 21:24:20 2013	(r246508)
+++ head/sys/net80211/ieee80211_mesh.c	Thu Feb  7 21:24:52 2013	(r246509)
@@ -854,6 +854,43 @@ mesh_rt_cleanup_cb(void *arg)
 	    mesh_rt_cleanup_cb, vap);
 }
 
+/*
+ * Mark a mesh STA as gate and return a pointer to it.
+ * If this is first time, we create a new gate route.
+ * Always update the path route to this mesh gate.
+ */
+struct ieee80211_mesh_gate_route *
+ieee80211_mesh_mark_gate(struct ieee80211vap *vap, const uint8_t *addr,
+    struct ieee80211_mesh_route *rt)
+{
+	struct ieee80211_mesh_state *ms = vap->iv_mesh;
+	struct ieee80211_mesh_gate_route *gr = NULL, *next;
+	int found = 0;
+
+	MESH_RT_LOCK(ms);
+	TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) {
+		if (IEEE80211_ADDR_EQ(gr->gr_addr, addr)) {
+			found = 1;
+			break;
+		}
+	}
+
+	if (!found) {
+		/* New mesh gate add it to known table. */
+		IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, addr,
+		    "%s", "stored new gate information from pro-PREQ.");
+		gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)),
+		    M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO);
+		IEEE80211_ADDR_COPY(gr->gr_addr, addr);
+		TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next);
+	}
+	gr->gr_route = rt;
+	/* TODO: link from path route to gate route */
+	MESH_RT_UNLOCK(ms);
+
+	return gr;
+}
+
 
 /*
  * Helper function to note the Mesh Peer Link FSM change.

Modified: head/sys/net80211/ieee80211_mesh.h
==============================================================================
--- head/sys/net80211/ieee80211_mesh.h	Thu Feb  7 21:24:20 2013	(r246508)
+++ head/sys/net80211/ieee80211_mesh.h	Thu Feb  7 21:24:52 2013	(r246509)
@@ -566,6 +566,9 @@ void		ieee80211_mesh_init_neighbor(struc
 		   const struct ieee80211_scanparams *);
 void		ieee80211_mesh_update_beacon(struct ieee80211vap *,
 		    struct ieee80211_beacon_offsets *);
+struct ieee80211_mesh_gate_route *
+		ieee80211_mesh_mark_gate(struct ieee80211vap *,
+		    const uint8_t *, struct ieee80211_mesh_route *);
 
 /*
  * Return non-zero if proxy operation is enabled.


More information about the svn-src-head mailing list