svn commit: r195315 - projects/mesh11s/sys/net80211
Rui Paulo
rpaulo at FreeBSD.org
Fri Jul 3 15:46:19 UTC 2009
Author: rpaulo
Date: Fri Jul 3 15:46:19 2009
New Revision: 195315
URL: http://svn.freebsd.org/changeset/base/195315
Log:
Parse HWMP frames correctly.
Sponsored by: The FreeBSD Foundation
Modified:
projects/mesh11s/sys/net80211/ieee80211_hwmp.c
Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Fri Jul 3 15:33:15 2009 (r195314)
+++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Fri Jul 3 15:46:19 2009 (r195315)
@@ -327,17 +327,22 @@ hwmp_recv_action_meshpath_preq(struct ie
struct ieee80211_meshpreq_ie preq;
/* XXX true for multi-hop action frames? */
const struct ieee80211_frame *wh = (const struct ieee80211_frame *)
- (frm - sizeof(struct ieee80211_frame));
+ (frm - sizeof(struct ieee80211_frame) -
+ sizeof(struct ieee80211_action));
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return 0);
if (*frm == IEEE80211_ELEMID_MESHPREQ) {
const struct ieee80211_meshpreq_ie *mpreq =
(const struct ieee80211_meshpreq_ie *) frm;
+ memcpy(&preq, mpreq, sizeof(preq));
preq.preq_id = LE_READ_4(&mpreq->preq_id);
preq.preq_origseq = LE_READ_4(&mpreq->preq_origseq);
preq.preq_lifetime = LE_READ_4(&mpreq->preq_lifetime);
preq.preq_metric = LE_READ_4(&mpreq->preq_metric);
+ /* XXX > 1 target */
+ preq.preq_targets[0].target_seq =
+ LE_READ_4(&mpreq->preq_targets[0].target_seq);
hwmp_recv_preq(vap, ni, wh, &preq);
return 0;
}
@@ -357,13 +362,15 @@ hwmp_recv_action_meshpath_prep(struct ie
struct ieee80211_meshprep_ie prep;
/* XXX true for multi-hop action frames? */
const struct ieee80211_frame *wh = (const struct ieee80211_frame *)
- (frm - sizeof(struct ieee80211_frame));
+ (frm - sizeof(struct ieee80211_frame) -
+ sizeof(struct ieee80211_action));
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return 0);
if (*frm == IEEE80211_ELEMID_MESHPREP) {
const struct ieee80211_meshprep_ie *mprep =
(const struct ieee80211_meshprep_ie *) frm;
+ memcpy(&prep, mprep, sizeof(prep));
prep.prep_targetseq = LE_READ_4(&mprep->prep_targetseq);
prep.prep_lifetime = LE_READ_4(&mprep->prep_lifetime);
prep.prep_metric = LE_READ_4(&mprep->prep_metric);
@@ -383,16 +390,23 @@ static int
hwmp_recv_action_meshpath_perr(struct ieee80211_node *ni,
const uint8_t *frm, const uint8_t *efrm)
{
+ struct ieee80211_meshperr_ie perr;
struct ieee80211vap *vap = ni->ni_vap;
/* XXX true for multi-hop action frames? */
const struct ieee80211_frame *wh = (const struct ieee80211_frame *)
- (frm - sizeof(struct ieee80211_frame));
+ (frm - sizeof(struct ieee80211_frame) -
+ sizeof(struct ieee80211_action));
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return 0);
if (*frm == IEEE80211_ELEMID_MESHPERR) {
- hwmp_recv_perr(vap, ni, wh,
- (const struct ieee80211_meshperr_ie *) frm);
+ const struct ieee80211_meshperr_ie *mperr =
+ (const struct ieee80211_meshperr_ie *) frm;
+ memcpy(&perr, mperr, sizeof(perr));
+ /* XXX > 1 target */
+ perr.perr_dests[0].dest_seq =
+ LE_READ_4(mperr->perr_dests[0].dest_seq);
+ hwmp_recv_perr(vap, ni, wh, &perr);
return 0;
}
frm += frm[1] + 2;
@@ -411,7 +425,8 @@ hwmp_recv_action_meshpath_rann(struct ie
struct ieee80211_meshrann_ie rann;
/* XXX true for multi-hop action frames? */
const struct ieee80211_frame *wh = (const struct ieee80211_frame *)
- (frm - sizeof(struct ieee80211_frame));
+ (frm - sizeof(struct ieee80211_frame) -
+ sizeof(struct ieee80211_action));
while (efrm - frm > 1) {
IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return 0);
More information about the svn-src-projects
mailing list