From owner-svn-src-projects@FreeBSD.ORG Fri Jun 19 12:47:13 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 EEFD01065672; Fri, 19 Jun 2009 12:47:13 +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 C33CF8FC0C; Fri, 19 Jun 2009 12:47:13 +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 n5JClDZw043924; Fri, 19 Jun 2009 12:47:13 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5JClDv6043922; Fri, 19 Jun 2009 12:47:13 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906191247.n5JClDv6043922@svn.freebsd.org> From: Rui Paulo Date: Fri, 19 Jun 2009 12:47:13 +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: r194488 - 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: Fri, 19 Jun 2009 12:47:14 -0000 Author: rpaulo Date: Fri Jun 19 12:47:13 2009 New Revision: 194488 URL: http://svn.freebsd.org/changeset/base/194488 Log: Broadcast multicast frames across the mesh. XXX still crashes. 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 12:46:08 2009 (r194487) +++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Fri Jun 19 12:47:13 2009 (r194488) @@ -374,10 +374,8 @@ 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. */ @@ -388,6 +386,55 @@ mesh_input(struct ieee80211_node *ni, st } 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; + + mcopy = m_copypacket(m, M_DONTWAIT); + if (mcopy == NULL) { + ifp->if_oerrors++; + goto deliver; + } + mcopy = m_pullup(mcopy, ieee80211_hdrspace(ic, wh) + + sizeof(struct ieee80211_meshcntl)); + if (mcopy == NULL) { + ifp->if_oerrors++; + goto deliver; + } + whcopy = mtod(m, struct ieee80211_frame *); + mccopy = (struct ieee80211_meshcntl *)(mtod(mcopy, uint8_t *) + + ieee80211_hdrspace(ic, wh)); + IEEE80211_ADDR_COPY(wh->i_addr2, vap->iv_myaddr); + mccopy->mc_ttl--; + /* calculate priority so drivers can find the tx queue */ + if (ieee80211_classify(vap->iv_bss, mcopy)) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_OUTPUT | IEEE80211_MSG_MESH, + wh->i_addr2, NULL, "%s", + "classification failed"); + vap->iv_stats.is_tx_classify++; + ifp->if_oerrors++; + m_freem(mcopy); + ieee80211_free_node(vap->iv_bss); + goto deliver; + } + mcopy->m_flags |= M_MCAST; + mcopy->m_pkthdr.rcvif = (void *) vap->iv_bss; + if (parent->if_transmit(parent, mcopy)) { + /* NB: IFQ_HANDOFF reclaims mbuf */ + ifp->if_oerrors++; + ieee80211_free_node(vap->iv_bss); + } else + ifp->if_opackets++; + } +deliver: + /* * Next up, any fragmentation. */ if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {