Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 May 2009 22:13:17 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r192126 - projects/mesh11s/sys/net80211
Message-ID:  <200905142213.n4EMDH7o004111@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Thu May 14 22:13:17 2009
New Revision: 192126
URL: http://svn.freebsd.org/changeset/base/192126

Log:
  * Really send the mesh path reply, don't just pretend.
  * Fix a bug in calculating the location of the IEs on mesh_recv_action().
  
  Sponsored by:	The FreeBSD Foundation

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

Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c	Thu May 14 22:01:32 2009	(r192125)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c	Thu May 14 22:13:17 2009	(r192126)
@@ -3,7 +3,7 @@
  * Copyright (c) 2009 The FreeBSD Foundation 
  * All rights reserved. 
  * 
- * This software was developed by Rui Paulo under sponsorship from the                 
+ * This software was developed by Rui Paulo under sponsorship from the
  * FreeBSD Foundation. 
  *  
  * Redistribution and use in source and binary forms, with or without 
@@ -635,8 +635,7 @@ mesh_recv_action(struct ieee80211_node *
 		
 	wh = mtod(m0, struct ieee80211_frame *);
 	ia = (struct ieee80211_action *) &wh[1];
-	frm = (uint8_t *)&wh[1];
-	frm += sizeof(ia);
+	frm = (uint8_t *)&wh[1] + sizeof(struct ieee80211_action);
 	efrm = mtod(m0, uint8_t *) + m0->m_len;
 
 	/*
@@ -646,8 +645,6 @@ mesh_recv_action(struct ieee80211_node *
 	if (ni == vap->iv_bss) {
 		return;
 	}
-		
-
 	meshid = NULL;
 	meshpeer = NULL;
 	meshconf = NULL;
@@ -684,10 +681,10 @@ mesh_recv_action(struct ieee80211_node *
 		frm += frm[1] + 2;
 	}
 
+	switch (ia->ia_category) {
 	/*
 	 * Mesh Peer Link Management Finite State Machine handling.
 	 */
-	switch (ia->ia_category) {
 	case IEEE80211_ACTION_CAT_MESHPEERING:
 		/*
 		 * Check if we agree on the required fields.

Modified: projects/mesh11s/sys/net80211/ieee80211_output.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_output.c	Thu May 14 22:01:32 2009	(r192125)
+++ projects/mesh11s/sys/net80211/ieee80211_output.c	Thu May 14 22:13:17 2009	(r192126)
@@ -546,6 +546,13 @@ ieee80211_send_action(struct ieee80211_n
 	frm[1] = (v) >> 8;			\
 	frm += 2;				\
 } while (0)
+#define	ADDWORD(frm, v) do {			\
+	frm[0] = (v) & 0xff;			\
+	frm[1] = ((v) >> 8) & 0xff;		\
+	frm[2] = ((v) >> 16) & 0xff;		\
+	frm[3] = ((v) >> 24) & 0xff;		\
+	frm += 4;				\
+} while (0)
 #define	MS(_v, _f)	(((_v) & _f) >> _f##_S)
 #define	SM(_v, _f)	(((_v) << _f##_S) & _f)
 	struct ieee80211vap *vap = ni->ni_vap;
@@ -765,25 +772,44 @@ ieee80211_send_action(struct ieee80211_n
 		 * mesh path request action frame format:
 		 *   [1] action
 		 *   [1] category
-		 *   [tlv] mesh preq
+		 *   [tlv] mesh path request
 		 */
 		case IEEE80211_ACTION_MESHPATH_REQ:
 			break;
 		/*
-		 * mesh path request action frame format:
+		 * mesh path reply action frame format:
 		 *   [1] action
 		 *   [1] category
-		 *   [tlv] mesh preq
+		 *   [tlv] mesh path reply
 		 */
 		case IEEE80211_ACTION_MESHPATH_REP:
+		{
+			struct ieee80211_meshprep_ie *prep;
+
+			prep = vargs.ptrarg;
 			IEEE80211_NOTE(vap,
 			    IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni,
 			    "send PATH REPLY action: flags 0x%x, "
-			    "hopcount 0x%x", vargs.fixedarg[0],
-			    vargs.fixedarg[1]);
-				
+			    "hopcount 0x%x, ttl 0x%x, "
+			    "seq 0x%x, lifetime 0x%x", prep->prep_flags,
+			    prep->prep_hopcount, prep->prep_ttl,
+			    prep->prep_targetseq, prep->prep_lifetime);
+			*frm++ = IEEE80211_ELEMID_MESHPREP;
+			*frm++ = sizeof(struct ieee80211_meshprep_ie) - 2;
+			*frm++ = prep->prep_flags;
+			*frm++ = prep->prep_hopcount;
+			*frm++ = prep->prep_ttl;
+			IEEE80211_ADDR_COPY(frm, prep->prep_targetaddr);
+			frm += 6;
+			ADDWORD(frm, prep->prep_targetseq);
+			ADDWORD(frm, prep->prep_lifetime);
+			ADDWORD(frm, prep->prep_metric);
+			IEEE80211_ADDR_COPY(frm, prep->prep_origaddr);
+			frm += 6;
+			ADDWORD(frm, prep->prep_origseq);
 			break;	
 		}
+		}
 		break;
 	default:
 	badaction:



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