svn commit: r192932 - projects/mesh11s/sys/net80211
Rui Paulo
rpaulo at FreeBSD.org
Wed May 27 20:03:10 UTC 2009
Author: rpaulo
Date: Wed May 27 20:03:09 2009
New Revision: 192932
URL: http://svn.freebsd.org/changeset/base/192932
Log:
Fix a bug on peering managent parsing that was only visible on 11a.
Add notyet code for future usage.
Sponsored by: The FreeBSD Foundation
Modified:
projects/mesh11s/sys/net80211/ieee80211_mesh.c
projects/mesh11s/sys/net80211/ieee80211_node.h
Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c Wed May 27 20:01:44 2009 (r192931)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c Wed May 27 20:03:09 2009 (r192932)
@@ -652,36 +652,49 @@ mesh_recv_action(struct ieee80211_node *
return;
}
- while (efrm - frm > 1) {
- IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return);
- switch (*frm) {
- case IEEE80211_ELEMID_MESHID:
- meshid = (struct ieee80211_meshid_ie *) frm;
- break;
- case IEEE80211_ELEMID_MESHCONF:
- meshconf = (struct ieee80211_meshconf_ie *) frm;
- break;
- case IEEE80211_ELEMID_MESHPEER:
- meshpeer = (struct ieee80211_meshpeer_ie *) frm;
- meshpeer->peer_llinkid =
- LE_READ_2(&meshpeer->peer_llinkid);
- meshpeer->peer_linkid =
- LE_READ_2(&meshpeer->peer_linkid);
- meshpeer->peer_rcode =
- LE_READ_2(&meshpeer->peer_rcode);
- break;
- }
- frm += frm[1] + 2;
- }
-
switch (ia->ia_category) {
/*
* Mesh Peer Link Management Finite State Machine handling.
*/
case IEEE80211_ACTION_CAT_MESHPEERING:
/*
- * Check if we agree on the required fields.
+ * Compute the start of fixed/tagged parameters.
+ */
+ switch (ia->ia_action) {
+ case IEEE80211_ACTION_MESHPEERING_OPEN:
+ frm += 2; /* capabilites */
+ break;
+ case IEEE80211_ACTION_MESHPEERING_CONFIRM:
+ frm += 2 + 2 + 2; /* capabilites + status code + AID */
+ break;
+ case IEEE80211_ACTION_MESHPEERING_CLOSE:
+ break;
+ }
+ /*
+ * And parse them.
*/
+ while (efrm - frm > 1) {
+ IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return);
+ switch (*frm) {
+ case IEEE80211_ELEMID_MESHID:
+ meshid = (struct ieee80211_meshid_ie *) frm;
+ break;
+ case IEEE80211_ELEMID_MESHCONF:
+ meshconf = (struct ieee80211_meshconf_ie *) frm;
+ break;
+ case IEEE80211_ELEMID_MESHPEER:
+ meshpeer = (struct ieee80211_meshpeer_ie *) frm;
+ meshpeer->peer_llinkid =
+ LE_READ_2(&meshpeer->peer_llinkid);
+ meshpeer->peer_linkid =
+ LE_READ_2(&meshpeer->peer_linkid);
+ meshpeer->peer_rcode =
+ LE_READ_2(&meshpeer->peer_rcode);
+ break;
+ }
+ frm += frm[1] + 2;
+ }
+
if (mesh_verify_meshid(vap, meshid) ||
mesh_verify_meshconf(vap, meshconf) ||
!meshpeer) {
@@ -691,6 +704,13 @@ mesh_recv_action(struct ieee80211_node *
vap->iv_stats.is_rx_mgtdiscard++;
return;
}
+#ifdef notyet
+ if (!(meshconf->conf_cap & IEEE80211_MESHCONF_CAP_AP)) {
+ IEEE80211_DISCARD(vap,
+ IEEE80211_MSG_MESH,
+ wh, NULL, "%s", "neighbor not accepting peers");
+ }
+#endif
switch (ia->ia_action) {
case IEEE80211_ACTION_MESHPEERING_OPEN:
IEEE80211_NOTE(vap,
@@ -1004,14 +1024,32 @@ mesh_verify_meshid(struct ieee80211vap *
return memcmp(vap->iv_meshid, (uint8_t *)&meshid[1], vap->iv_meshidlen);
}
-static __inline int
+static int
mesh_verify_meshconf(struct ieee80211vap *vap,
struct ieee80211_meshconf_ie *meshconf)
{
+#ifdef notyet
+ static const uint8_t null[4] = IEEE80211_MESHCONF_NULL;
+ static const uint8_t hwmp[4] = IEEE80211_MESHCONF_HWMP;
+ static const uint8_t airtime[4] = IEEE80211_MESHCONF_AIRTIME;
+#endif
if (meshconf == NULL)
return 1;
- /* XXX TBD */
+#ifdef notyet
+ if (meshconf->conf_ver != IEEE80211_MESHCONF_VERSION)
+ return 1;
+ if (memcmp(meshconf->conf_pselid, hwmp, 4) != 0)
+ return 1;
+ if (memcmp(meshconf->conf_pmetid, airtime, 4) != 0)
+ return 1;
+ if (memcmp(meshconf->conf_ccid, null, 4) != 0)
+ return 1;
+ if (memcmp(meshconf->conf_syncid, null, 4) != 0)
+ return 1;
+ if (memcmp(meshconf->conf_authid, null, 4) != 0)
+ return 1;
+#endif
return 0;
}
Modified: projects/mesh11s/sys/net80211/ieee80211_node.h
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_node.h Wed May 27 20:01:44 2009 (r192931)
+++ projects/mesh11s/sys/net80211/ieee80211_node.h Wed May 27 20:03:09 2009 (r192932)
@@ -88,6 +88,9 @@ struct ieee80211_ies {
int len; /* data size in bytes */
};
+/*
+ * 802.11s (Mesh) Peer Link FSM state.
+ */
enum ieee80211_mesh_mlstate {
IEEE80211_NODE_MESH_IDLE = 0,
IEEE80211_NODE_MESH_OPENSNT = 1, /* open frame received */
More information about the svn-src-projects
mailing list