Date: Tue, 30 Jun 2009 19:38:33 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r195207 - projects/mesh11s/sys/net80211 Message-ID: <200906301938.n5UJcXEf090417@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rpaulo Date: Tue Jun 30 19:38:33 2009 New Revision: 195207 URL: http://svn.freebsd.org/changeset/base/195207 Log: Move some code from mesh_input() to mesh_forward() and add stats. Sponsored by: The FreeBSD Foundation Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c ============================================================================== --- projects/mesh11s/sys/net80211/ieee80211_mesh.c Tue Jun 30 19:35:50 2009 (r195206) +++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Tue Jun 30 19:38:33 2009 (r195207) @@ -321,9 +321,11 @@ mesh_generateid(struct ieee80211vap *vap * Decrement the TTL and set TA to our MAC address. */ static void -mesh_forward(struct ieee80211vap *vap, struct mbuf *m) +mesh_forward(struct ieee80211vap *vap, struct mbuf *m, + const struct ieee80211_meshcntl *mc) { struct ieee80211com *ic = vap->iv_ic; + struct ieee80211_mesh_state *ms = vap->iv_mesh; struct ifnet *ifp = vap->iv_ifp; const struct ieee80211_frame *wh = mtod(m, const struct ieee80211_frame *); @@ -335,6 +337,18 @@ mesh_forward(struct ieee80211vap *vap, s struct ieee80211_node *ni; int err; + if (mc->mc_ttl == 0) { + IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_MESH, wh, + "%s", "frame not fwd'd, ttl 0"); + vap->iv_stats.is_mesh_fwd_ttl++; + return; + } + if (!(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) { + IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_MESH, wh, + "%s", "frame not fwd'd, fwding disabled"); + vap->iv_stats.is_mesh_fwd_disabled++; + return; + } mcopy = m_dup(m, M_DONTWAIT); if (mcopy == NULL) { /* XXX stat+msg? */ @@ -531,16 +545,10 @@ mesh_input(struct ieee80211_node *ni, st if (ieee80211_hwmp_checkpseq(vap, addr, seq)) goto out; /* - * Check if we can forward the packet. - */ - if (mc->mc_ttl == 0 || - !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD)) - goto deliver; - /* * Forward and deliver multicast packets */ if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { - mesh_forward(vap, m); + mesh_forward(vap, m, mc); goto deliver; } /* @@ -548,7 +556,7 @@ mesh_input(struct ieee80211_node *ni, st */ if (!IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr3) && IEEE80211_ADDR_EQ(vap->iv_myaddr, wh->i_addr1)) { - mesh_forward(vap, m); + mesh_forward(vap, m, mc); /* NB: don't deliver */ goto out; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906301938.n5UJcXEf090417>