diff options
author | monthadar <monthadar@FreeBSD.org> | 2012-07-31 07:36:27 +0000 |
---|---|---|
committer | monthadar <monthadar@FreeBSD.org> | 2012-07-31 07:36:27 +0000 |
commit | 7d32606c1b2f138b862c7cfa8a335ce3b5cf922b (patch) | |
tree | 4cacf6f67ea098255843c0db532e685b2a42d66c | |
parent | c2d63929b4d15f46059d3e3aba0ccd0861217eb1 (diff) | |
download | FreeBSD-src-7d32606c1b2f138b862c7cfa8a335ce3b5cf922b.zip FreeBSD-src-7d32606c1b2f138b862c7cfa8a335ce3b5cf922b.tar.gz |
Fix a PREQ comparison error in 11s HWMP.
* Earlier we compared two not equal metrics, one was what we recevied
in the 'new PREQ' while the other was what we already have saved which
was 'old PREQ' + link metric for the last hop;
* Fixed by adding 'new PREQ' + link metric for the last hop in a
temporary variable;
-rw-r--r-- | sys/net80211/ieee80211_hwmp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index f658156..7189794 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -912,6 +912,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_meshprep_ie prep; ieee80211_hwmp_seq preqid; /* last seen preqid for orig */ + uint32_t metric = 0; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -985,13 +986,13 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, /* Data creation and update of forwarding information * according to Table 11C-8 for originator mesh STA. */ + metric = preq->preq_metric + ms->ms_pmetric->mpm_metric(ni); if (HWMP_SEQ_GT(preq->preq_origseq, hrorig->hr_seq) || (HWMP_SEQ_EQ(preq->preq_origseq, hrorig->hr_seq) && - preq->preq_metric < rtorig->rt_metric)) { + metric < rtorig->rt_metric)) { hrorig->hr_seq = preq->preq_origseq; IEEE80211_ADDR_COPY(rtorig->rt_nexthop, wh->i_addr2); - rtorig->rt_metric = preq->preq_metric + - ms->ms_pmetric->mpm_metric(ni); + rtorig->rt_metric = metric; rtorig->rt_nhops = preq->preq_hopcount + 1; ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime); /* path to orig is valid now */ |