提交 3491707a 编写于 作者: R Rui Paulo 提交者: John W. Linville

mac80211: update meshconf IE

This updates the Mesh Configuration IE according to the latest
draft (3.03).
Notable changes include the simplified protocol IDs.
Signed-off-by: NRui Paulo <rpaulo@gmail.com>
Signed-off-by: NJavier Cardona <javier@cozybit.com>
Reviewed-by: NAndrey Yurovsky <andrey@cozybit.com>
Tested-by: NBrian Cavagnolo <brian@cozybit.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 ac9d1a7b
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
#define IEEE80211_MAX_SSID_LEN 32 #define IEEE80211_MAX_SSID_LEN 32
#define IEEE80211_MAX_MESH_ID_LEN 32 #define IEEE80211_MAX_MESH_ID_LEN 32
#define IEEE80211_MESH_CONFIG_LEN 24 #define IEEE80211_MESH_CONFIG_LEN 7
#define IEEE80211_QOS_CTL_LEN 2 #define IEEE80211_QOS_CTL_LEN 2
#define IEEE80211_QOS_CTL_TID_MASK 0x000F #define IEEE80211_QOS_CTL_TID_MASK 0x000F
......
...@@ -361,15 +361,15 @@ struct ieee80211_if_mesh { ...@@ -361,15 +361,15 @@ struct ieee80211_if_mesh {
u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
size_t mesh_id_len; size_t mesh_id_len;
/* Active Path Selection Protocol Identifier */ /* Active Path Selection Protocol Identifier */
u8 mesh_pp_id[4]; u8 mesh_pp_id;
/* Active Path Selection Metric Identifier */ /* Active Path Selection Metric Identifier */
u8 mesh_pm_id[4]; u8 mesh_pm_id;
/* Congestion Control Mode Identifier */ /* Congestion Control Mode Identifier */
u8 mesh_cc_id[4]; u8 mesh_cc_id;
/* Synchronization Protocol Identifier */ /* Synchronization Protocol Identifier */
u8 mesh_sp_id[4]; u8 mesh_sp_id;
/* Authentication Protocol Identifier */ /* Authentication Protocol Identifier */
u8 mesh_auth_id[4]; u8 mesh_auth_id;
/* Local mesh Destination Sequence Number */ /* Local mesh Destination Sequence Number */
u32 dsn; u32 dsn;
/* Last used PREQ ID */ /* Last used PREQ ID */
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) #define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ)
#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) #define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ)
#define PP_OFFSET 1 /* Path Selection Protocol */ #define MESHCONF_PP_OFFSET 0 /* Path Selection Protocol */
#define PM_OFFSET 5 /* Path Selection Metric */ #define MESHCONF_PM_OFFSET 1 /* Path Selection Metric */
#define CC_OFFSET 9 /* Congestion Control Mode */ #define MESHCONF_CC_OFFSET 2 /* Congestion Control Mode */
#define SP_OFFSET 13 /* Synchronization Protocol */ #define MESHCONF_SP_OFFSET 3 /* Synchronization Protocol */
#define AUTH_OFFSET 17 /* Authentication Protocol */ #define MESHCONF_AUTH_OFFSET 4 /* Authentication Protocol */
#define CAPAB_OFFSET 22 #define MESHCONF_CAPAB_OFFSET 6
#define CAPAB_ACCEPT_PLINKS 0x80 #define MESHCONF_CAPAB_ACCEPT_PLINKS 0x01
#define CAPAB_FORWARDING 0x10 #define MESHCONF_CAPAB_FORWARDING 0x08
#define TMR_RUNNING_HK 0 #define TMR_RUNNING_HK 0
#define TMR_RUNNING_MP 1 #define TMR_RUNNING_MP 1
...@@ -85,11 +85,12 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat ...@@ -85,11 +85,12 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat
*/ */
if (ifmsh->mesh_id_len == ie->mesh_id_len && if (ifmsh->mesh_id_len == ie->mesh_id_len &&
memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
memcmp(ifmsh->mesh_pp_id, ie->mesh_config + PP_OFFSET, 4) == 0 && (ifmsh->mesh_pp_id == *(ie->mesh_config + MESHCONF_PP_OFFSET))&&
memcmp(ifmsh->mesh_pm_id, ie->mesh_config + PM_OFFSET, 4) == 0 && (ifmsh->mesh_pm_id == *(ie->mesh_config + MESHCONF_PM_OFFSET))&&
memcmp(ifmsh->mesh_cc_id, ie->mesh_config + CC_OFFSET, 4) == 0 && (ifmsh->mesh_cc_id == *(ie->mesh_config + MESHCONF_CC_OFFSET))&&
memcmp(ifmsh->mesh_sp_id, ie->mesh_config + SP_OFFSET, 4) == 0 && (ifmsh->mesh_sp_id == *(ie->mesh_config + MESHCONF_SP_OFFSET))&&
memcmp(ifmsh->mesh_auth_id, ie->mesh_config + AUTH_OFFSET, 4) == 0) (ifmsh->mesh_auth_id == *(ie->mesh_config +
MESHCONF_AUTH_OFFSET)))
return true; return true;
return false; return false;
...@@ -102,7 +103,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat ...@@ -102,7 +103,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_dat
*/ */
bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
{ {
return (*(ie->mesh_config + CAPAB_OFFSET) & CAPAB_ACCEPT_PLINKS) != 0; return (*(ie->mesh_config + MESHCONF_CAPAB_OFFSET) &
MESHCONF_CAPAB_ACCEPT_PLINKS) != 0;
} }
/** /**
...@@ -128,18 +130,11 @@ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) ...@@ -128,18 +130,11 @@ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
void mesh_ids_set_default(struct ieee80211_if_mesh *sta) void mesh_ids_set_default(struct ieee80211_if_mesh *sta)
{ {
u8 oui[3] = {0x00, 0x0F, 0xAC}; sta->mesh_pp_id = 0; /* HWMP */
sta->mesh_pm_id = 0; /* Airtime */
memcpy(sta->mesh_pp_id, oui, sizeof(oui)); sta->mesh_cc_id = 0; /* Disabled */
memcpy(sta->mesh_pm_id, oui, sizeof(oui)); sta->mesh_sp_id = 0; /* Neighbor Offset */
memcpy(sta->mesh_cc_id, oui, sizeof(oui)); sta->mesh_auth_id = 0; /* Disabled */
memcpy(sta->mesh_sp_id, oui, sizeof(oui));
memcpy(sta->mesh_auth_id, oui, sizeof(oui));
sta->mesh_pp_id[sizeof(oui)] = 0;
sta->mesh_pm_id[sizeof(oui)] = 0;
sta->mesh_cc_id[sizeof(oui)] = 0xff;
sta->mesh_sp_id[sizeof(oui)] = 0xff;
sta->mesh_auth_id[sizeof(oui)] = 0x0;
} }
int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
...@@ -260,28 +255,21 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) ...@@ -260,28 +255,21 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
pos = skb_put(skb, 2 + IEEE80211_MESH_CONFIG_LEN); pos = skb_put(skb, 2 + IEEE80211_MESH_CONFIG_LEN);
*pos++ = WLAN_EID_MESH_CONFIG; *pos++ = WLAN_EID_MESH_CONFIG;
*pos++ = IEEE80211_MESH_CONFIG_LEN; *pos++ = IEEE80211_MESH_CONFIG_LEN;
/* Version */
*pos++ = 1;
/* Active path selection protocol ID */ /* Active path selection protocol ID */
memcpy(pos, sdata->u.mesh.mesh_pp_id, 4); *pos++ = sdata->u.mesh.mesh_pp_id;
pos += 4;
/* Active path selection metric ID */ /* Active path selection metric ID */
memcpy(pos, sdata->u.mesh.mesh_pm_id, 4); *pos++ = sdata->u.mesh.mesh_pm_id;
pos += 4;
/* Congestion control mode identifier */ /* Congestion control mode identifier */
memcpy(pos, sdata->u.mesh.mesh_cc_id, 4); *pos++ = sdata->u.mesh.mesh_cc_id;
pos += 4;
/* Synchronization protocol identifier */ /* Synchronization protocol identifier */
memcpy(pos, sdata->u.mesh.mesh_sp_id, 4); *pos++ = sdata->u.mesh.mesh_sp_id;
pos += 4;
/* Authentication Protocol identifier */ /* Authentication Protocol identifier */
memcpy(pos, sdata->u.mesh.mesh_auth_id, 4); *pos++ = sdata->u.mesh.mesh_auth_id;
pos += 4;
/* Mesh Formation Info */ /* Mesh Formation Info */
memset(pos, 0x00, 1); memset(pos, 0x00, 1);
...@@ -289,8 +277,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) ...@@ -289,8 +277,9 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
/* Mesh capability */ /* Mesh capability */
sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata); sdata->u.mesh.accepting_plinks = mesh_plink_availables(sdata);
*pos = CAPAB_FORWARDING; *pos = MESHCONF_CAPAB_FORWARDING;
*pos++ |= sdata->u.mesh.accepting_plinks ? CAPAB_ACCEPT_PLINKS : 0x00; *pos++ |= sdata->u.mesh.accepting_plinks ?
MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
*pos++ = 0x00; *pos++ = 0x00;
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册