diff options
author | monthadar <monthadar@FreeBSD.org> | 2013-02-07 21:24:52 +0000 |
---|---|---|
committer | monthadar <monthadar@FreeBSD.org> | 2013-02-07 21:24:52 +0000 |
commit | 4ef618069cca4eaa62cd2dc2529e8fc7ca2db7d9 (patch) | |
tree | dab8efd5f1cc51c7780544d18143b8df9202a5de /sys/net80211/ieee80211_mesh.c | |
parent | 81a1f6861c46b58a16eff6195b4bb1b937dbcbaa (diff) | |
download | FreeBSD-src-4ef618069cca4eaa62cd2dc2529e8fc7ca2db7d9.zip FreeBSD-src-4ef618069cca4eaa62cd2dc2529e8fc7ca2db7d9.tar.gz |
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)
Diffstat (limited to 'sys/net80211/ieee80211_mesh.c')
-rw-r--r-- | sys/net80211/ieee80211_mesh.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211_mesh.c b/sys/net80211/ieee80211_mesh.c index 0c3d77d..9449c62 100644 --- a/sys/net80211/ieee80211_mesh.c +++ b/sys/net80211/ieee80211_mesh.c @@ -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. |