aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasashi Honma <masashi.honma@gmail.com>2014-11-15 01:35:32 (GMT)
committerJouni Malinen <j@w1.fi>2014-11-16 17:43:11 (GMT)
commite609679984288eb9a0a3f59c0a069ee7e4d4638f (patch)
tree76d93ce265c24ec08f3712ca8eb099603ca8cf09
parent0c6099f31bb736cc875ae15f9e6d34eb6309be94 (diff)
downloadhostap-e609679984288eb9a0a3f59c0a069ee7e4d4638f.zip
hostap-e609679984288eb9a0a3f59c0a069ee7e4d4638f.tar.gz
hostap-e609679984288eb9a0a3f59c0a069ee7e4d4638f.tar.bz2
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>
-rw-r--r--src/ap/ap_config.h4
-rw-r--r--wpa_supplicant/config.c8
-rw-r--r--wpa_supplicant/config_file.c4
-rw-r--r--wpa_supplicant/config_ssid.h12
-rw-r--r--wpa_supplicant/mesh.c4
-rw-r--r--wpa_supplicant/mesh_mpm.c57
6 files changed, 66 insertions, 23 deletions
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 3441b90..6d57a73 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -37,6 +37,10 @@ struct mesh_conf {
#define MESH_CONF_SEC_AUTH BIT(1)
#define MESH_CONF_SEC_AMPE BIT(2)
unsigned int security;
+ int dot11MeshMaxRetries;
+ int dot11MeshRetryTimeout; /* msec */
+ int dot11MeshConfirmTimeout; /* msec */
+ int dot11MeshHoldingTimeout; /* msec */
};
#define MAX_STA_COUNT 2007
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index c948c5f..30566f8 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1851,6 +1851,10 @@ static const struct parse_data ssid_fields[] = {
#ifdef CONFIG_MESH
{ FUNC(mesh_ht_mode) },
{ FUNC(mesh_basic_rates) },
+ { INT(dot11MeshMaxRetries) },
+ { INT(dot11MeshRetryTimeout) },
+ { INT(dot11MeshConfirmTimeout) },
+ { INT(dot11MeshHoldingTimeout) },
#endif /* CONFIG_MESH */
{ INT(wpa_ptk_rekey) },
{ STR(bgscan) },
@@ -2335,6 +2339,10 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid)
#endif /* IEEE8021X_EAPOL */
#ifdef CONFIG_MESH
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 */
#ifdef CONFIG_HT_OVERRIDES
ssid->disable_ht = DEFAULT_DISABLE_HT;
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 246db0d..4f2b146 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -755,6 +755,10 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
#ifdef CONFIG_MESH
STR(mesh_ht_mode);
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 */
#undef STR
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index b1c2fd8..c5cd6e7 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -28,6 +28,10 @@
#define DEFAULT_BG_SCAN_PERIOD -1
#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_HT40 0
#define DEFAULT_DISABLE_SGI 0
@@ -419,6 +423,14 @@ struct wpa_ssid {
*/
int *mesh_basic_rates;
+ /**
+ * Mesh network plink parameters
+ */
+ int dot11MeshMaxRetries;
+ int dot11MeshRetryTimeout; /* msec */
+ int dot11MeshConfirmTimeout; /* msec */
+ int dot11MeshHoldingTimeout; /* msec */
+
int ht40;
int vht;
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 23108ba..8cdf189 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -89,6 +89,10 @@ static struct mesh_conf * mesh_config_create(struct wpa_ssid *ssid)
conf->mesh_cc_id = 0;
conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET;
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;
}
diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c
index 99dbf52..88a0adf 100644
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -19,12 +19,6 @@
#include "mesh_mpm.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 {
const u8 *proto_id;
const u8 *llid;
@@ -395,14 +389,17 @@ static void plink_timer(void *eloop_ctx, void *user_data)
struct wpa_supplicant *wpa_s = eloop_ctx;
struct sta_info *sta = user_data;
u16 reason = 0;
+ struct mesh_conf *conf = wpa_s->ifmsh->mconf;
switch (sta->plink_state) {
case PLINK_OPEN_RCVD:
case PLINK_OPEN_SENT:
/* retry timer */
- if (sta->mpm_retries < dot11MeshMaxRetries) {
- eloop_register_timeout(dot11MeshRetryTimeout, 0,
- plink_timer, wpa_s, sta);
+ if (sta->mpm_retries < conf->dot11MeshMaxRetries) {
+ eloop_register_timeout(
+ conf->dot11MeshRetryTimeout / 1000,
+ (conf->dot11MeshRetryTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0);
sta->mpm_retries++;
break;
@@ -415,8 +412,9 @@ static void plink_timer(void *eloop_ctx, void *user_data)
if (!reason)
reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT;
sta->plink_state = PLINK_HOLDING;
- eloop_register_timeout(dot11MeshHoldingTimeout, 0,
- plink_timer, wpa_s, sta);
+ eloop_register_timeout(conf->dot11MeshHoldingTimeout / 1000,
+ (conf->dot11MeshHoldingTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason);
break;
case PLINK_HOLDING:
@@ -434,9 +432,12 @@ static void
mesh_mpm_plink_open(struct wpa_supplicant *wpa_s, struct sta_info *sta,
enum mesh_plink_state next_state)
{
+ struct mesh_conf *conf = wpa_s->ifmsh->mconf;
+
eloop_cancel_timeout(plink_timer, wpa_s, sta);
- eloop_register_timeout(dot11MeshRetryTimeout, 0, plink_timer,
- wpa_s, sta);
+ eloop_register_timeout(conf->dot11MeshRetryTimeout / 1000,
+ (conf->dot11MeshRetryTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta, PLINK_OPEN, 0);
wpa_mesh_set_plink_state(wpa_s, sta, next_state);
}
@@ -670,8 +671,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
if (!reason)
reason = WLAN_REASON_MESH_CLOSE_RCVD;
- eloop_register_timeout(dot11MeshHoldingTimeout, 0,
- plink_timer, wpa_s, sta);
+ eloop_register_timeout(
+ conf->dot11MeshHoldingTimeout / 1000,
+ (conf->dot11MeshHoldingTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
mesh_mpm_send_plink_action(wpa_s, sta,
PLINK_CLOSE, reason);
break;
@@ -683,8 +686,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
break;
case CNF_ACPT:
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_CNF_RCVD);
- eloop_register_timeout(dot11MeshConfirmTimeout, 0,
- plink_timer, wpa_s, sta);
+ eloop_register_timeout(
+ conf->dot11MeshConfirmTimeout / 1000,
+ (conf->dot11MeshConfirmTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
break;
default:
break;
@@ -700,8 +705,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
if (!reason)
reason = WLAN_REASON_MESH_CLOSE_RCVD;
- eloop_register_timeout(dot11MeshHoldingTimeout, 0,
- plink_timer, wpa_s, sta);
+ eloop_register_timeout(
+ conf->dot11MeshHoldingTimeout / 1000,
+ (conf->dot11MeshHoldingTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
sta->mpm_close_reason = reason;
mesh_mpm_send_plink_action(wpa_s, sta,
PLINK_CLOSE, reason);
@@ -729,8 +736,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
if (!reason)
reason = WLAN_REASON_MESH_CLOSE_RCVD;
- eloop_register_timeout(dot11MeshHoldingTimeout, 0,
- plink_timer, wpa_s, sta);
+ eloop_register_timeout(
+ conf->dot11MeshHoldingTimeout / 1000,
+ (conf->dot11MeshHoldingTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
sta->mpm_close_reason = reason;
mesh_mpm_send_plink_action(wpa_s, sta,
PLINK_CLOSE, reason);
@@ -750,8 +759,10 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
reason = WLAN_REASON_MESH_CLOSE_RCVD;
- eloop_register_timeout(dot11MeshHoldingTimeout, 0,
- plink_timer, wpa_s, sta);
+ eloop_register_timeout(
+ conf->dot11MeshHoldingTimeout / 1000,
+ (conf->dot11MeshHoldingTimeout % 1000) * 1000,
+ plink_timer, wpa_s, sta);
sta->mpm_close_reason = reason;
wpa_msg(wpa_s, MSG_INFO, "mesh plink with " MACSTR