mesh: Make plink params configurable

This patch makes four MIB variables for plink configurable and sets the
correct default values based on IEEE Std 802.11s-2011.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
Masashi Honma 2014-11-15 10:35:32 +09:00 committed by Jouni Malinen
parent 0c6099f31b
commit e609679984
6 changed files with 66 additions and 23 deletions

View file

@ -37,6 +37,10 @@ struct mesh_conf {
#define MESH_CONF_SEC_AUTH BIT(1) #define MESH_CONF_SEC_AUTH BIT(1)
#define MESH_CONF_SEC_AMPE BIT(2) #define MESH_CONF_SEC_AMPE BIT(2)
unsigned int security; unsigned int security;
int dot11MeshMaxRetries;
int dot11MeshRetryTimeout; /* msec */
int dot11MeshConfirmTimeout; /* msec */
int dot11MeshHoldingTimeout; /* msec */
}; };
#define MAX_STA_COUNT 2007 #define MAX_STA_COUNT 2007

View file

@ -1851,6 +1851,10 @@ static const struct parse_data ssid_fields[] = {
#ifdef CONFIG_MESH #ifdef CONFIG_MESH
{ FUNC(mesh_ht_mode) }, { FUNC(mesh_ht_mode) },
{ FUNC(mesh_basic_rates) }, { FUNC(mesh_basic_rates) },
{ INT(dot11MeshMaxRetries) },
{ INT(dot11MeshRetryTimeout) },
{ INT(dot11MeshConfirmTimeout) },
{ INT(dot11MeshHoldingTimeout) },
#endif /* CONFIG_MESH */ #endif /* CONFIG_MESH */
{ INT(wpa_ptk_rekey) }, { INT(wpa_ptk_rekey) },
{ STR(bgscan) }, { STR(bgscan) },
@ -2335,6 +2339,10 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid)
#endif /* IEEE8021X_EAPOL */ #endif /* IEEE8021X_EAPOL */
#ifdef CONFIG_MESH #ifdef CONFIG_MESH
ssid->mesh_ht_mode = DEFAULT_MESH_HT_MODE; ssid->mesh_ht_mode = DEFAULT_MESH_HT_MODE;
ssid->dot11MeshMaxRetries = DEFAULT_MESH_MAX_RETRIES;
ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT;
ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT;
ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT;
#endif /* CONFIG_MESH */ #endif /* CONFIG_MESH */
#ifdef CONFIG_HT_OVERRIDES #ifdef CONFIG_HT_OVERRIDES
ssid->disable_ht = DEFAULT_DISABLE_HT; ssid->disable_ht = DEFAULT_DISABLE_HT;

View file

@ -755,6 +755,10 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
#ifdef CONFIG_MESH #ifdef CONFIG_MESH
STR(mesh_ht_mode); STR(mesh_ht_mode);
STR(mesh_basic_rates); STR(mesh_basic_rates);
INT_DEF(dot11MeshMaxRetries, DEFAULT_MESH_MAX_RETRIES);
INT_DEF(dot11MeshRetryTimeout, DEFAULT_MESH_RETRY_TIMEOUT);
INT_DEF(dot11MeshConfirmTimeout, DEFAULT_MESH_CONFIRM_TIMEOUT);
INT_DEF(dot11MeshHoldingTimeout, DEFAULT_MESH_HOLDING_TIMEOUT);
#endif /* CONFIG_MESH */ #endif /* CONFIG_MESH */
#undef STR #undef STR

View file

@ -28,6 +28,10 @@
#define DEFAULT_BG_SCAN_PERIOD -1 #define DEFAULT_BG_SCAN_PERIOD -1
#define DEFAULT_MESH_HT_MODE CHAN_UNDEFINED /* undefined */ #define DEFAULT_MESH_HT_MODE CHAN_UNDEFINED /* undefined */
#define DEFAULT_MESH_MAX_RETRIES 2
#define DEFAULT_MESH_RETRY_TIMEOUT 40
#define DEFAULT_MESH_CONFIRM_TIMEOUT 40
#define DEFAULT_MESH_HOLDING_TIMEOUT 40
#define DEFAULT_DISABLE_HT 0 #define DEFAULT_DISABLE_HT 0
#define DEFAULT_DISABLE_HT40 0 #define DEFAULT_DISABLE_HT40 0
#define DEFAULT_DISABLE_SGI 0 #define DEFAULT_DISABLE_SGI 0
@ -419,6 +423,14 @@ struct wpa_ssid {
*/ */
int *mesh_basic_rates; int *mesh_basic_rates;
/**
* Mesh network plink parameters
*/
int dot11MeshMaxRetries;
int dot11MeshRetryTimeout; /* msec */
int dot11MeshConfirmTimeout; /* msec */
int dot11MeshHoldingTimeout; /* msec */
int ht40; int ht40;
int vht; int vht;

View file

@ -89,6 +89,10 @@ static struct mesh_conf * mesh_config_create(struct wpa_ssid *ssid)
conf->mesh_cc_id = 0; conf->mesh_cc_id = 0;
conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET;
conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0;
conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries;
conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout;
conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout;
conf->dot11MeshHoldingTimeout = ssid->dot11MeshHoldingTimeout;
return conf; return conf;
} }

View file

@ -19,12 +19,6 @@
#include "mesh_mpm.h" #include "mesh_mpm.h"
#include "mesh_rsn.h" #include "mesh_rsn.h"
/* TODO make configurable */
#define dot11MeshMaxRetries 10
#define dot11MeshRetryTimeout 1
#define dot11MeshConfirmTimeout 1
#define dot11MeshHoldingTimeout 1
struct mesh_peer_mgmt_ie { struct mesh_peer_mgmt_ie {
const u8 *proto_id; const u8 *proto_id;
const u8 *llid; const u8 *llid;
@ -395,13 +389,16 @@ static void plink_timer(void *eloop_ctx, void *user_data)
struct wpa_supplicant *wpa_s = eloop_ctx; struct wpa_supplicant *wpa_s = eloop_ctx;
struct sta_info *sta = user_data; struct sta_info *sta = user_data;
u16 reason = 0; u16 reason = 0;
struct mesh_conf *conf = wpa_s->ifmsh->mconf;
switch (sta->plink_state) { switch (sta->plink_state) {
case PLINK_OPEN_RCVD: case PLINK_OPEN_RCVD:
case PLINK_OPEN_SENT: case PLINK_OPEN_SENT:
/* retry timer */ /* retry timer */
if (sta->mpm_retries < dot11MeshMaxRetries) { if (sta->mpm_retries < conf->dot11MeshMaxRetries) {
eloop_register_timeout(dot11MeshRetryTimeout, 0, eloop_register_timeout(
conf->dot11MeshRetryTimeout / 1000,
(conf->dot11MeshRetryTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0); mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0);
sta->mpm_retries++; sta->mpm_retries++;
@ -415,7 +412,8 @@ static void plink_timer(void *eloop_ctx, void *user_data)
if (!reason) if (!reason)
reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT; reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT;
sta->plink_state = PLINK_HOLDING; sta->plink_state = PLINK_HOLDING;
eloop_register_timeout(dot11MeshHoldingTimeout, 0, eloop_register_timeout(conf->dot11MeshHoldingTimeout / 1000,
(conf->dot11MeshHoldingTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason); mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason);
break; break;
@ -434,9 +432,12 @@ static void
mesh_mpm_plink_open(struct wpa_supplicant *wpa_s, struct sta_info *sta, mesh_mpm_plink_open(struct wpa_supplicant *wpa_s, struct sta_info *sta,
enum mesh_plink_state next_state) enum mesh_plink_state next_state)
{ {
struct mesh_conf *conf = wpa_s->ifmsh->mconf;
eloop_cancel_timeout(plink_timer, wpa_s, sta); eloop_cancel_timeout(plink_timer, wpa_s, sta);
eloop_register_timeout(dot11MeshRetryTimeout, 0, plink_timer, eloop_register_timeout(conf->dot11MeshRetryTimeout / 1000,
wpa_s, sta); (conf->dot11MeshRetryTimeout % 1000) * 1000,
plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0); mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0);
wpa_mesh_set_plink_state(wpa_s, sta, next_state); wpa_mesh_set_plink_state(wpa_s, sta, next_state);
} }
@ -670,7 +671,9 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING); wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
if (!reason) if (!reason)
reason = WLAN_REASON_MESH_CLOSE_RCVD; reason = WLAN_REASON_MESH_CLOSE_RCVD;
eloop_register_timeout(dot11MeshHoldingTimeout, 0, eloop_register_timeout(
conf->dot11MeshHoldingTimeout / 1000,
(conf->dot11MeshHoldingTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, mesh_mpm_send_plink_action(wpa_s, sta,
PLINK_CLOSE, reason); PLINK_CLOSE, reason);
@ -683,7 +686,9 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
break; break;
case CNF_ACPT: case CNF_ACPT:
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_CNF_RCVD); wpa_mesh_set_plink_state(wpa_s, sta, PLINK_CNF_RCVD);
eloop_register_timeout(dot11MeshConfirmTimeout, 0, eloop_register_timeout(
conf->dot11MeshConfirmTimeout / 1000,
(conf->dot11MeshConfirmTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
break; break;
default: default:
@ -700,7 +705,9 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING); wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
if (!reason) if (!reason)
reason = WLAN_REASON_MESH_CLOSE_RCVD; reason = WLAN_REASON_MESH_CLOSE_RCVD;
eloop_register_timeout(dot11MeshHoldingTimeout, 0, eloop_register_timeout(
conf->dot11MeshHoldingTimeout / 1000,
(conf->dot11MeshHoldingTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
sta->mpm_close_reason = reason; sta->mpm_close_reason = reason;
mesh_mpm_send_plink_action(wpa_s, sta, mesh_mpm_send_plink_action(wpa_s, sta,
@ -729,7 +736,9 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING); wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
if (!reason) if (!reason)
reason = WLAN_REASON_MESH_CLOSE_RCVD; reason = WLAN_REASON_MESH_CLOSE_RCVD;
eloop_register_timeout(dot11MeshHoldingTimeout, 0, eloop_register_timeout(
conf->dot11MeshHoldingTimeout / 1000,
(conf->dot11MeshHoldingTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
sta->mpm_close_reason = reason; sta->mpm_close_reason = reason;
mesh_mpm_send_plink_action(wpa_s, sta, mesh_mpm_send_plink_action(wpa_s, sta,
@ -750,7 +759,9 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING); wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
reason = WLAN_REASON_MESH_CLOSE_RCVD; reason = WLAN_REASON_MESH_CLOSE_RCVD;
eloop_register_timeout(dot11MeshHoldingTimeout, 0, eloop_register_timeout(
conf->dot11MeshHoldingTimeout / 1000,
(conf->dot11MeshHoldingTimeout % 1000) * 1000,
plink_timer, wpa_s, sta); plink_timer, wpa_s, sta);
sta->mpm_close_reason = reason; sta->mpm_close_reason = reason;