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)
This commit is contained in:
parent
4cc361aa03
commit
a21c6123ed
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246509
@ -1092,6 +1092,16 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni,
|
||||
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, struct ieee80211_node *ni,
|
||||
}
|
||||
}
|
||||
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));
|
||||
|
@ -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.
|
||||
|
@ -566,6 +566,9 @@ void ieee80211_mesh_init_neighbor(struct ieee80211_node *,
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user