Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jun 2009 18:56:05 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r194504 - projects/mesh11s/sys/net80211
Message-ID:  <200906191856.n5JIu5sO052513@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Fri Jun 19 18:56:05 2009
New Revision: 194504
URL: http://svn.freebsd.org/changeset/base/194504

Log:
  Fix problems in previous incarnation of mcast forwarding.
  XXX not finished yet
  
  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	Fri Jun 19 18:42:13 2009	(r194503)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c	Fri Jun 19 18:56:05 2009	(r194504)
@@ -350,6 +350,7 @@ mesh_input(struct ieee80211_node *ni, st
 			    ni->ni_macaddr, NULL,
 			    "peer link not yet established (%d)",
 			    ni->ni_mlstate);
+			goto out;
 		}	
 		if (dir != IEEE80211_FC1_DIR_FROMDS &&
 		    dir != IEEE80211_FC1_DIR_DSTODS) {
@@ -374,8 +375,10 @@ mesh_input(struct ieee80211_node *ni, st
 		 * ieee80211_decap will pull up anything we didn't get
 		 * above when it strips the 802.11 headers.
 		 */
-		mc = (const struct ieee80211_meshcntl *)(mtod(m, const uint8_t *) + hdrspace);
-		hdrspace += sizeof(struct ieee80211_meshcntl) + (mc->mc_flags & 3) * IEEE80211_ADDR_LEN;
+		mc = (const struct ieee80211_meshcntl *)
+		    (mtod(m, const uint8_t *) + hdrspace);
+		hdrspace += sizeof(struct ieee80211_meshcntl) +
+		    (mc->mc_flags & 3) * IEEE80211_ADDR_LEN;
 		/*
 		 * Save QoS bits for use below--before we strip the header.
 		 */
@@ -385,18 +388,25 @@ mesh_input(struct ieee80211_node *ni, st
 			    ((struct ieee80211_qosframe *)wh)->i_qos[0];
 		} else
 			qos = 0;
+
 		/*
 		 * Broadcast multicast packets. We just decrement the TTL and
 		 * set addr2 to our MAC address.
 		 */
 		if (IEEE80211_IS_MULTICAST(wh->i_addr1) && mc->mc_ttl > 0 &&
 		    (vap->iv_meshflags & IEEE80211_MFLAGS_FWRD)) {
-			struct ifnet *parent = ic->ic_ifp;
 			struct mbuf *mcopy;
 			struct ieee80211_meshcntl *mccopy;
 			struct ieee80211_frame *whcopy;
+			const struct ieee80211_txparam *tp;
+			struct ieee80211_bpf_params params;
+			int err;
 
-			mcopy = m_copypacket(m, M_DONTWAIT);
+			IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, ni,
+			    "forwarding mcast frame from %s ttl %d",
+			    ether_sprintf(wh->i_addr3), mc->mc_ttl);
+
+			mcopy = m_dup(m, M_DONTWAIT);
 			if (mcopy == NULL) {
 				ifp->if_oerrors++;
 				goto deliver;
@@ -405,17 +415,27 @@ mesh_input(struct ieee80211_node *ni, st
 			    sizeof(struct ieee80211_meshcntl));
 			if (mcopy == NULL) {
 				ifp->if_oerrors++;
+				m_freem(mcopy);
 				goto deliver;
 			}
 			whcopy = mtod(mcopy, struct ieee80211_frame *);
-			mccopy = (struct ieee80211_meshcntl *)(mtod(mcopy, uint8_t *) +
-			    ieee80211_hdrspace(ic, wh));
+			mccopy = (struct ieee80211_meshcntl *)
+			    (mtod(mcopy, uint8_t *) +
+				ieee80211_hdrspace(ic, wh));
 			IEEE80211_ADDR_COPY(whcopy->i_addr2, vap->iv_myaddr);
 			mccopy->mc_ttl--;
 			/* XXX calculate priority so drivers can find the tx queue */
 			mcopy->m_flags |= M_MCAST;
-			mcopy->m_pkthdr.rcvif = (void *) vap->iv_bss;
-			if (parent->if_transmit(parent, mcopy)) {
+			M_WME_SETAC(mcopy, WME_AC_BE);
+			memset(&params, 0, sizeof(params));
+			params.ibp_pri = M_WME_GETAC(mcopy);
+			params.ibp_power = vap->iv_bss->ni_txpower;
+			tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
+			params.ibp_rate0 = tp->mgmtrate;
+			params.ibp_flags |= IEEE80211_BPF_NOACK;
+			params.ibp_try0 = 1;
+			err = ic->ic_raw_xmit(vap->iv_bss, mcopy, &params);
+			if (err) {
 				/* NB: IFQ_HANDOFF reclaims mbuf */
 				ifp->if_oerrors++;
 				ieee80211_free_node(vap->iv_bss);
@@ -437,6 +457,7 @@ deliver:
 		if (bpf_peers_present(vap->iv_rawbpf))
 			bpf_mtap(vap->iv_rawbpf, m);
 		need_tap = 0;
+
 		/*
 		 * Finally, strip the 802.11 header.
 		 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906191856.n5JIu5sO052513>