svn commit: r194488 - projects/mesh11s/sys/net80211
Rui Paulo
rpaulo at FreeBSD.org
Fri Jun 19 12:47:14 UTC 2009
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)) {
More information about the svn-src-projects
mailing list