Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Feb 2013 21:21:41 +0000 (UTC)
From:      Monthadar Al Jaberi <monthadar@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246503 - head/sys/net80211
Message-ID:  <201302072121.r17LLfOk010703@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: monthadar
Date: Thu Feb  7 21:21:40 2013
New Revision: 246503
URL: http://svnweb.freebsd.org/changeset/base/246503

Log:
  Mesh: management mesh action frames are to be discarded
   when not peered.
  
  * Modified ieee80211_recv_action to check if neighbour is peered for
    IEEE80211_ACTION_CAT_MESH frames, if not frame is discarded. This is
    according to IEEE802.11 2012 standard;
  * Removed duplicate checks in each hwmp_recv_* handlers because HWMP
    is a subtype of mesh action;
  
  Approved by:	adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_action.c
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_action.c
==============================================================================
--- head/sys/net80211/ieee80211_action.c	Thu Feb  7 21:21:05 2013	(r246502)
+++ head/sys/net80211/ieee80211_action.c	Thu Feb  7 21:21:40 2013	(r246503)
@@ -228,6 +228,7 @@ ieee80211_recv_action(struct ieee80211_n
 {
 #define	N(a)	(sizeof(a) / sizeof(a[0]))
 	ieee80211_recv_action_func *f = recv_inval;
+	struct ieee80211vap *vap = ni->ni_vap;
 	const struct ieee80211_action *ia =
 	    (const struct ieee80211_action *) frm;
 
@@ -245,6 +246,15 @@ ieee80211_recv_action(struct ieee80211_n
 			f = meshpl_recv_action[ia->ia_action];
 		break;
 	case IEEE80211_ACTION_CAT_MESH:
+		if (ni == vap->iv_bss ||
+		    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) {
+			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH,
+			    ni->ni_macaddr, NULL,
+			    "peer link not yet established (%d), cat %s act %u",
+			    ni->ni_mlstate, "mesh action", ia->ia_action);
+			vap->iv_stats.is_mesh_nolink++;
+			break;
+		}
 		if (ia->ia_action < N(meshaction_recv_action))
 			f = meshaction_recv_action[ia->ia_action];
 		break;

Modified: head/sys/net80211/ieee80211_hwmp.c
==============================================================================
--- head/sys/net80211/ieee80211_hwmp.c	Thu Feb  7 21:21:05 2013	(r246502)
+++ head/sys/net80211/ieee80211_hwmp.c	Thu Feb  7 21:21:40 2013	(r246503)
@@ -914,9 +914,6 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 	ieee80211_hwmp_seq preqid;	/* last seen preqid for orig */
 	uint32_t metric = 0;
 
-	if (ni == vap->iv_bss ||
-	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
-		return;
 	/*
 	 * Ignore PREQs from us. Could happen because someone forward it
 	 * back to us.
@@ -1233,10 +1230,6 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 	int is_encap;
 	struct ieee80211_node *ni_encap;
 
-	if (ni == vap->iv_bss ||
-	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
-		return;
-
 	IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 	    "received PREP, orig %6D, targ %6D", prep->prep_origaddr, ":",
 	    prep->prep_targetaddr, ":");
@@ -1505,10 +1498,6 @@ hwmp_recv_perr(struct ieee80211vap *vap,
 	struct ieee80211_meshperr_ie *pperr = NULL;
 	int i, j = 0, forward = 0;
 
-	if (ni == vap->iv_bss ||
-	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
-		return;
-
 	IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
 	    "received PERR from %6D", wh->i_addr2, ":");
 
@@ -1712,9 +1701,7 @@ hwmp_recv_rann(struct ieee80211vap *vap,
 	struct ieee80211_meshrann_ie prann;
 	uint32_t metric = 0;
 
-	if (ni == vap->iv_bss ||
-	    ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED ||
-	    IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr))
+	if (IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr))
 		return;
 
 	rt = ieee80211_mesh_rt_find(vap, rann->rann_addr);



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