svn commit: r193470 - projects/mesh11s/sys/net80211

Rui Paulo rpaulo at FreeBSD.org
Thu Jun 4 22:33:13 UTC 2009


Author: rpaulo
Date: Thu Jun  4 22:33:12 2009
New Revision: 193470
URL: http://svn.freebsd.org/changeset/base/193470

Log:
  Initial handling of IEEE80211_IOC_HWMP_TABLE (getter).
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/mesh11s/sys/net80211/ieee80211_hwmp.c
  projects/mesh11s/sys/net80211/ieee80211_mesh.c
  projects/mesh11s/sys/net80211/ieee80211_output.c

Modified: projects/mesh11s/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_hwmp.c	Thu Jun  4 22:23:44 2009	(r193469)
+++ projects/mesh11s/sys/net80211/ieee80211_hwmp.c	Thu Jun  4 22:33:12 2009	(r193470)
@@ -951,12 +951,40 @@ static int
 hwmp_ioctl_get80211(struct ieee80211vap *vap, struct ieee80211req *ireq)
 {
 	int error;
+	size_t len, off;
+	struct ieee80211_hwmp_state *hs;
+	struct ieee80211_hwmp_fi *fi;
+	uint8_t *p;
 
 	error = 0;
 	switch (ireq->i_type) {
 	case IEEE80211_IOC_HWMP_TABLE:
 		if (vap->iv_opmode != IEEE80211_M_MBSS)
 			return EINVAL;
+		hs = vap->iv_hwmp;
+		len = 0;
+		mtx_lock(&hs->hs_lock);
+		TAILQ_FOREACH(fi, &hs->hs_head, fi_next) {
+			len += sizeof(*fi);
+		}
+		mtx_unlock(&hs->hs_lock);
+		if (len > ireq->i_len || ireq->i_len < sizeof(*fi))
+			return EFAULT;
+		p = malloc(len, M_TEMP, M_NOWAIT | M_ZERO);
+		if (p == NULL)
+			return ENOMEM;
+		off = 0;
+		mtx_lock(&hs->hs_lock);
+		TAILQ_FOREACH(fi, &hs->hs_head, fi_next) {
+			if (off >= len)
+				break;
+			memcpy(p + off, fi, sizeof(*fi));
+			off += sizeof(*fi);
+		}
+		mtx_unlock(&hs->hs_lock);
+		error = copyout(p, (uint8_t *) ireq->i_data, ireq->i_len);
+		free(p, M_TEMP);
+		break;
 	default:
 		return ENOSYS;
 	}

Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c	Thu Jun  4 22:23:44 2009	(r193469)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c	Thu Jun  4 22:33:12 2009	(r193470)
@@ -284,7 +284,7 @@ mesh_input(struct ieee80211_node *ni, st
 		}	
 		/* NB: not ieee80211_hdrspace, datapad is not honored */
 		hdrlen = ieee80211_hdrsize(wh)
-		    + sizeof(struct ieee80211_meshcntl);
+		    + sizeof(struct ieee80211_meshcntl) + 2;
 		if (m->m_len < hdrlen &&
 		    (m = m_pullup(m, hdrlen)) == NULL) {
 			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
@@ -652,6 +652,8 @@ mesh_recv_action(struct ieee80211_node *
 	 * XXX: wait for it to beacon or create ieee80211_node?
 	 */
 	if (ni == vap->iv_bss) {
+		IEEE80211_DISCARD(vap, IEEE80211_MSG_MESH,
+		    wh, NULL, "%s", "unknown node");
 		return;
 	}
 

Modified: projects/mesh11s/sys/net80211/ieee80211_output.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_output.c	Thu Jun  4 22:23:44 2009	(r193469)
+++ projects/mesh11s/sys/net80211/ieee80211_output.c	Thu Jun  4 22:33:12 2009	(r193470)
@@ -207,9 +207,12 @@ ieee80211_start(struct ifnet *ifp)
 				
 			}
 		}
+		ieee80211_hwmp_discover(vap, eh->ether_dhost);
+#if 0
 		if (vap->iv_opmode == IEEE80211_M_MBSS)
 			ni = ieee80211_hwmp_discover(vap, eh->ether_dhost);
 		else
+#endif
 			ni = ieee80211_find_txnode(vap, eh->ether_dhost);
 		if (ni == NULL) {
 			/* NB: ieee80211_find_txnode does stat+msg */


More information about the svn-src-projects mailing list