diff options
author | monthadar <monthadar@FreeBSD.org> | 2012-05-01 16:18:38 +0000 |
---|---|---|
committer | monthadar <monthadar@FreeBSD.org> | 2012-05-01 16:18:38 +0000 |
commit | 3ea2b961af99db834ee57da40b9beb7558b0baf4 (patch) | |
tree | 0ef83c06c8fc92ea82943e8a620c4fa7943cff8d | |
parent | c076b717b7b905b393ab1c9e3dfce2cbd81a2281 (diff) | |
download | FreeBSD-src-3ea2b961af99db834ee57da40b9beb7558b0baf4.zip FreeBSD-src-3ea2b961af99db834ee57da40b9beb7558b0baf4.tar.gz |
Update HWMP Proactive code and mesh route flags.
* Modified hwmp_recv_preq:
o cleaned up code, removed rootmac variable because preq->origaddr
is the root when we recevie a Proactive PREQ;
o Modified so that a PREP in response of a Proactive PREQ is unicast,
a PREP is ALWAYS unicast;
* Modified hwmp_recv_prep:
o Before we mark a route to be valid we should remove the discovery
flag and then mark it valid in such a way we wont lose the isgate flag;
Approved by: adrian
-rw-r--r-- | sys/net80211/ieee80211_hwmp.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 412efc1..3a7b94f 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -904,7 +904,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshpreq_ie *preq) { struct ieee80211_mesh_state *ms = vap->iv_mesh; - struct ieee80211_mesh_route *rt = NULL; /* pro-active code */ struct ieee80211_mesh_route *rtorig = NULL; struct ieee80211_mesh_route *rtorig_ext = NULL; struct ieee80211_mesh_route *rttarg = NULL; @@ -1083,33 +1082,20 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, */ if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) && (PREQ_TFLAGS(0) & IEEE80211_MESHPREQ_TFLAGS_TO)) { - uint8_t rootmac[IEEE80211_ADDR_LEN]; - - IEEE80211_ADDR_COPY(rootmac, preq->preq_origaddr); - rt = ieee80211_mesh_rt_find(vap, rootmac); - if (rt == NULL) { - rt = ieee80211_mesh_rt_add(vap, rootmac); - if (rt == NULL) { - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "unable to add root mesh path to %6D", - rootmac, ":"); - vap->iv_stats.is_mesh_rtaddfailed++; - return; - } - } IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, - "root mesh station @ %6D", rootmac, ":"); + "root mesh station @ %6D", preq->preq_origaddr, ":"); /* * Reply with a PREP if we don't have a path to the root * or if the root sent us a proactive PREQ. */ - if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || + if ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 || (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_PP)) { prep.prep_flags = 0; prep.prep_hopcount = 0; prep.prep_ttl = ms->ms_ttl; - IEEE80211_ADDR_COPY(prep.prep_origaddr, rootmac); + IEEE80211_ADDR_COPY(prep.prep_origaddr, + preq->preq_origaddr); prep.prep_origseq = preq->preq_origseq; prep.prep_lifetime = preq->preq_lifetime; prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; @@ -1117,7 +1103,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, vap->iv_myaddr); prep.prep_targetseq = ++hs->hs_seq; hwmp_send_prep(vap->iv_bss, vap->iv_myaddr, - broadcastaddr, &prep); + rtorig->rt_nexthop, &prep); } } @@ -1319,7 +1305,11 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, rt->rt_metric = metric; rt->rt_nhops = prep->prep_hopcount + 1; ieee80211_mesh_rt_update(rt, prep->prep_lifetime); - rt->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) { + /* discovery complete */ + rt->rt_flags &= ~IEEE80211_MESHRT_FLAGS_DISCOVER; + } + rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ /* * If it's NOT for us, propagate the PREP |