From owner-svn-src-projects@FreeBSD.ORG Wed Jul 1 23:14:22 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 299E9106566C; Wed, 1 Jul 2009 23:14:22 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 182D68FC16; Wed, 1 Jul 2009 23:14:22 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n61NELqe026882; Wed, 1 Jul 2009 23:14:21 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n61NELwa026879; Wed, 1 Jul 2009 23:14:21 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200907012314.n61NELwa026879@svn.freebsd.org> From: Rui Paulo Date: Wed, 1 Jul 2009 23:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195270 - projects/mesh11s/sys/net80211 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 23:14:22 -0000 Author: rpaulo Date: Wed Jul 1 23:14:21 2009 New Revision: 195270 URL: http://svn.freebsd.org/changeset/base/195270 Log: First try at implementing HWMP proactive routing. Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c projects/mesh11s/sys/net80211/ieee80211_mesh.h Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jul 1 23:13:19 2009 (r195269) +++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c Wed Jul 1 23:14:21 2009 (r195270) @@ -553,6 +553,44 @@ hwmp_add_meshrann(uint8_t *frm, const st return frm; } +#ifdef notyet +/* + * Send a broadcast Path Request to find all nodes on the mesh. We are + * called when the vap is configured as a HWMP root node. + */ +#define PREQ_TFLAGS(n) preq.preq_targets[n].target_flags +#define PREQ_TADDR(n) preq.preq_targets[n].target_addr +#define PREQ_TSEQ(n) preq.preq_targets[n].target_seq +static void +hwmp_rootmode_cb(struct ieee80211vap *vap) +{ + struct ieee80211_hwmp_state *hs = vap->iv_hwmp; + struct ieee80211_meshpreq_ie preq; + + /* XXX check portal role */ + preq.preq_flags = 0; + preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_AM; + if (hs->hs_rootmode == IEEE80211_HWMP_ROOTMODE_PROACTIVE) + preq.preq_flags |= IEEE80211_MESHPREQ_FLAGS_PP; + preq.preq_hopcount = 0; + preq.preq_ttl = hs->hs_ttl; + preq.preq_id = ++hs->hs_preqid; + IEEE80211_ADDR_COPY(preq.preq_origaddr, vap->iv_myaddr); + preq.preq_origseq = ++hs->hs_seq; + preq.preq_lifetime = timeval2msecs(ieee80211_hwmp_roottimeout); + preq.preq_metric = IEEE80211_MESHLMETRIC_INITIALVAL; + preq.preq_tcount = 1; + IEEE80211_ADDR_COPY(PREQ_TADDR(0), broadcastaddr); + PREQ_TFLAGS(0) = IEEE80211_MESHPREQ_TFLAGS_TO | + IEEE80211_MESHPREQ_TFLAGS_RF; + PREQ_TSEQ(0) = 0; + hwmp_send_preq(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &preq); +} +#undef PREQ_TFLAGS +#undef PREQ_TADDR +#undef PREQ_TSEQ +#endif + #define PREQ_TFLAGS(n) preq->preq_targets[n].target_flags #define PREQ_TADDR(n) preq->preq_targets[n].target_addr #define PREQ_TSEQ(n) preq->preq_targets[n].target_seq @@ -563,6 +601,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ieee80211_hwmp_state *hs = vap->iv_hwmp; struct ieee80211_hwmp_route *rt = NULL; + struct ieee80211_meshprep_ie prep; /* * Ignore PREQs from us. Could happen because someone forward it @@ -589,8 +628,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, * XXX: check if this is part of a proxy address. */ if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0))) { - struct ieee80211_meshprep_ie prep; - IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "replying to %s", ether_sprintf(preq->preq_origaddr)); /* @@ -706,25 +743,38 @@ hwmp_recv_preq(struct ieee80211vap *vap, hwmp_send_preq(ni, vap->iv_myaddr, broadcastaddr, &ppreq); } - /* - * XXX: Update the percursor table - */ - return; } /* - * XXX: Proactive PREQ: reply with a proactive PREP to the + * Proactive PREQ: reply with a proactive PREP to the * root STA if requested. */ if (IEEE80211_ADDR_EQ(PREQ_TADDR(0), broadcastaddr) && (PREQ_TFLAGS(0) & ((IEEE80211_MESHPREQ_TFLAGS_TO|IEEE80211_MESHPREQ_TFLAGS_RF) == (IEEE80211_MESHPREQ_TFLAGS_TO|IEEE80211_MESHPREQ_TFLAGS_RF)))) { + rt = hwmp_rt_find(vap, preq->preq_origaddr); + if (rt == NULL) + rt = hwmp_rt_add(vap, preq->preq_origaddr); /* - * Does the root want a proactive PREP ? + * Reply with a PREP if we don't have a path to the root + * or if the root sent us a proactive PREQ. */ - if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_PP) { - + if (IEEE80211_ADDR_EQ(rt->rt_nexthop, invalidaddr) || + (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_PP)) { + prep.prep_flags = 0; + prep.prep_hopcount = 0; + prep.prep_ttl = hs->hs_ttl; + IEEE80211_ADDR_COPY(prep.prep_targetaddr, + vap->iv_myaddr); + prep.prep_targetseq = ++hs->hs_seq; + prep.prep_lifetime = preq->preq_lifetime; + prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL; + IEEE80211_ADDR_COPY(prep.prep_origaddr, + preq->preq_origaddr); + prep.prep_origseq = preq->preq_origseq; + hwmp_send_prep(vap->iv_bss, vap->iv_myaddr, + broadcastaddr, &prep); } } } Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.h ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_mesh.h Wed Jul 1 23:13:19 2009 (r195269) +++ projects/mesh11s/sys/net80211/ieee80211_mesh.h Wed Jul 1 23:14:21 2009 (r195270) @@ -211,8 +211,9 @@ struct ieee80211_meshpreq_ie { uint8_t preq_len; uint8_t preq_flags; #define IEEE80211_MESHPREQ_FLAGS_PR 0x01 /* Portal Role */ -#define IEEE80211_MESHPREQ_FLAGS_AE 0x02 /* Address Extension */ +#define IEEE80211_MESHPREQ_FLAGS_AM 0x02 /* 0 = ucast / 1 = bcast */ #define IEEE80211_MESHPREQ_FLAGS_PP 0x04 /* Proactive PREP */ +#define IEEE80211_MESHPREQ_FLAGS_AE 0x40 /* Address Extension */ uint8_t preq_hopcount; uint8_t preq_ttl; uint32_t preq_id;