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)
This commit is contained in:
Monthadar Al Jaberi 2013-02-07 21:21:40 +00:00
parent 71766338b2
commit cd47d75c70
2 changed files with 11 additions and 14 deletions

View File

@ -228,6 +228,7 @@ ieee80211_recv_action(struct ieee80211_node *ni,
{
#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_node *ni,
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;

View File

@ -914,9 +914,6 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni,
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, struct ieee80211_node *ni,
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_node *ni,
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_node *ni,
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);