[PATCH v2 10/10] mesh: Make plink params configurable
Masashi Honma
masashi.honma
Fri Nov 14 17:35:32 PST 2014
This patch makes four MIBs for plink configurable and sets correct default
value based on IEEE Std 802.11s-2011.
Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
src/ap/ap_config.h | 4 ++++
wpa_supplicant/config.c | 8 +++++++
wpa_supplicant/config_file.c | 4 ++++
wpa_supplicant/config_ssid.h | 12 ++++++++++
wpa_supplicant/mesh.c | 4 ++++
wpa_supplicant/mesh_mpm.c | 57 ++++++++++++++++++++++++++------------------
6 files changed, 66 insertions(+), 23 deletions(-)
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 18538c9..593dd99 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 5cefbf1..33cf53c 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1839,6 +1839,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) },
@@ -2323,6 +2327,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 664745b..99a852a 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -754,6 +754,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(dot11MeshMaxRetries);
+ INT(dot11MeshRetryTimeout);
+ INT(dot11MeshConfirmTimeout);
+ INT(dot11MeshHoldingTimeout);
#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 8d99de9..ee07b97 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..81f92ca 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
--
1.9.1
More information about the Hostap
mailing list