From owner-svn-src-head@FreeBSD.ORG Tue May 1 16:12:40 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 712B11065672; Tue, 1 May 2012 16:12:40 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C0F38FC17; Tue, 1 May 2012 16:12:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q41GCexx034050; Tue, 1 May 2012 16:12:40 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q41GCeM0034046; Tue, 1 May 2012 16:12:40 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201205011612.q41GCeM0034046@svn.freebsd.org> From: Monthadar Al Jaberi Date: Tue, 1 May 2012 16:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234890 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2012 16:12:40 -0000 Author: monthadar Date: Tue May 1 16:12:39 2012 New Revision: 234890 URL: http://svn.freebsd.org/changeset/base/234890 Log: PERR update to be called from mesh code. * Added mpp_senderror for Mesh Path Selection protocol; * Added hwmp_senderror that will send an HWMP PERR according to the supplied reason code; * Call mpp_senderror when deleting a route with correct reason code for whether the route is marked proxy or not; * Call mpp_senderror when trying to forward an individually addressed frame and there is no forwarding information; Approved by: adrian Modified: head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_mesh.h Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:11:47 2012 (r234889) +++ head/sys/net80211/ieee80211_hwmp.c Tue May 1 16:12:39 2012 (r234890) @@ -105,6 +105,9 @@ static int hwmp_send_perr(struct ieee802 const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN], struct ieee80211_meshperr_ie *); +static void hwmp_senderror(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN], + struct ieee80211_mesh_route *, int); static void hwmp_recv_rann(struct ieee80211vap *, struct ieee80211_node *, const struct ieee80211_frame *, const struct ieee80211_meshrann_ie *); @@ -206,6 +209,7 @@ static struct ieee80211_mesh_proto_path .mpp_ie = IEEE80211_MESHCONF_PATH_HWMP, .mpp_discover = hwmp_discover, .mpp_peerdown = hwmp_peerdown, + .mpp_senderror = hwmp_senderror, .mpp_vattach = hwmp_vattach, .mpp_vdetach = hwmp_vdetach, .mpp_newstate = hwmp_newstate, @@ -1569,7 +1573,7 @@ done: free(pperr, M_80211_MESH_PERR); } #undef PERR_DFLAGS -#undef PEER_DADDR +#undef PERR_DADDR #undef PERR_DSEQ #undef PERR_DEXTADDR #undef PERR_DRCODE @@ -1614,6 +1618,64 @@ hwmp_send_perr(struct ieee80211_node *ni return hwmp_send_action(ni, sa, da, (uint8_t *)perr, perr->perr_len+2); } +/* + * Called from the rest of the net80211 code (mesh code for example). + * NB: IEEE80211_REASON_MESH_PERR_DEST_UNREACH can be trigger by the fact that + * a mesh STA is unable to forward an MSDU/MMPDU to a next-hop mesh STA. + */ +#define PERR_DFLAGS(n) perr.perr_dests[n].dest_flags +#define PERR_DADDR(n) perr.perr_dests[n].dest_addr +#define PERR_DSEQ(n) perr.perr_dests[n].dest_seq +#define PERR_DEXTADDR(n) perr.perr_dests[n].dest_ext_addr +#define PERR_DRCODE(n) perr.perr_dests[n].dest_rcode +static void +hwmp_senderror(struct ieee80211vap *vap, + const uint8_t addr[IEEE80211_ADDR_LEN], + struct ieee80211_mesh_route *rt, int rcode) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_hwmp_route *hr = NULL; + struct ieee80211_meshperr_ie perr; + + if (rt != NULL) + hr = IEEE80211_MESH_ROUTE_PRIV(rt, + struct ieee80211_hwmp_route); + + perr.perr_ndests = 1; + perr.perr_ttl = ms->ms_ttl; + PERR_DFLAGS(0) = 0; + PERR_DRCODE(0) = rcode; + + switch (rcode) { + case IEEE80211_REASON_MESH_PERR_NO_FI: + IEEE80211_ADDR_COPY(PERR_DADDR(0), addr); + PERR_DSEQ(0) = 0; /* reserved */ + break; + case IEEE80211_REASON_MESH_PERR_NO_PROXY: + KASSERT(rt != NULL, ("no proxy info for sending PERR")); + KASSERT(rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY, + ("route is not marked proxy")); + PERR_DFLAGS(0) |= IEEE80211_MESHPERR_FLAGS_AE; + IEEE80211_ADDR_COPY(PERR_DADDR(0), vap->iv_myaddr); + PERR_DSEQ(0) = rt->rt_ext_seq; + IEEE80211_ADDR_COPY(PERR_DEXTADDR(0), addr); + break; + case IEEE80211_REASON_MESH_PERR_DEST_UNREACH: + KASSERT(rt != NULL, ("no route info for sending PERR")); + IEEE80211_ADDR_COPY(PERR_DADDR(0), addr); + PERR_DSEQ(0) = hr->hr_seq; + break; + default: + KASSERT(0, ("unknown reason code for HWMP PERR (%u)", rcode)); + } + hwmp_send_perr(vap->iv_bss, vap->iv_myaddr, broadcastaddr, &perr); +} +#undef PERR_DFLAGS +#undef PEER_DADDR +#undef PERR_DSEQ +#undef PERR_DEXTADDR +#undef PERR_DRCODE + static void hwmp_recv_rann(struct ieee80211vap *vap, struct ieee80211_node *ni, const struct ieee80211_frame *wh, const struct ieee80211_meshrann_ie *rann) Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Tue May 1 16:11:47 2012 (r234889) +++ head/sys/net80211/ieee80211_mesh.c Tue May 1 16:12:39 2012 (r234890) @@ -344,6 +344,13 @@ ieee80211_mesh_rt_del(struct ieee80211va MESH_RT_LOCK(ms); TAILQ_FOREACH_SAFE(rt, &ms->ms_routes, rt_next, next) { if (IEEE80211_ADDR_EQ(rt->rt_dest, dest)) { + if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) { + ms->ms_ppath->mpp_senderror(vap, dest, rt, + IEEE80211_REASON_MESH_PERR_NO_PROXY); + } else { + ms->ms_ppath->mpp_senderror(vap, dest, rt, + IEEE80211_REASON_MESH_PERR_DEST_UNREACH); + } mesh_rt_del(ms, rt); MESH_RT_UNLOCK(ms); return; @@ -972,10 +979,12 @@ mesh_forward(struct ieee80211vap *vap, s * [Optional] any of the following three actions: * o silently discard * o trigger a path discovery - * o inform TA that meshDA is unreachable. + * o inform TA that meshDA is unknown. */ IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_MESH, wh, "%s", "frame not fwd'd, no path"); + ms->ms_ppath->mpp_senderror(vap, whcopy->i_addr3, NULL, + IEEE80211_REASON_MESH_PERR_NO_FI); vap->iv_stats.is_mesh_fwd_nopath++; m_freem(mcopy); return; Modified: head/sys/net80211/ieee80211_mesh.h ============================================================================== --- head/sys/net80211/ieee80211_mesh.h Tue May 1 16:11:47 2012 (r234889) +++ head/sys/net80211/ieee80211_mesh.h Tue May 1 16:12:39 2012 (r234890) @@ -449,6 +449,9 @@ struct ieee80211_mesh_proto_path { const uint8_t [IEEE80211_ADDR_LEN], struct mbuf *); void (*mpp_peerdown)(struct ieee80211_node *); + void (*mpp_senderror)(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN], + struct ieee80211_mesh_route *, int); void (*mpp_vattach)(struct ieee80211vap *); void (*mpp_vdetach)(struct ieee80211vap *); int (*mpp_newstate)(struct ieee80211vap *,