[PATCH 1/3] mesh: Make max peer links configurable
Masashi Honma
masashi.honma
Thu Dec 18 21:59:52 PST 2014
Max peer links is max number of connecting mesh peers at the same time.
Max peer links is greater than 0 and smaller than 255.
Because dot11MeshNumberOfPeerings is in the range.
Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
src/drivers/driver.h | 1 +
src/drivers/driver_nl80211.c | 4 ++++
wpa_supplicant/config.c | 2 ++
wpa_supplicant/config.h | 8 ++++++++
wpa_supplicant/mesh.c | 3 ++-
5 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 4fcc648..b8ee825 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -953,6 +953,7 @@ struct wpa_driver_mesh_join_params {
int ie_len;
int freq;
int beacon_int;
+ int max_peer_links;
enum ht_mode ht_mode;
struct wpa_driver_mesh_bss_params conf;
#define WPA_DRIVER_MESH_FLAG_USER_MPM 0x00000001
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index f6d5507..cfd3b70 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7809,6 +7809,10 @@ wpa_driver_nl80211_join_mesh(void *priv,
if (!(params->conf.flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) &&
nla_put_u32(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, 0))
goto fail;
+ if ((params->conf.flags & WPA_DRIVER_MESH_FLAG_DRIVER_MPM) &&
+ nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS,
+ params->max_peer_links))
+ goto fail;
nla_nest_end(msg, container);
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index bd80b29..d3a8c86 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -3450,6 +3450,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
config->eapol_version = DEFAULT_EAPOL_VERSION;
config->ap_scan = DEFAULT_AP_SCAN;
config->user_mpm = DEFAULT_USER_MPM;
+ config->max_peer_links = DEFAULT_MAX_PEER_LINKS;
config->fast_reauth = DEFAULT_FAST_REAUTH;
config->p2p_go_intent = DEFAULT_P2P_GO_INTENT;
config->p2p_intra_bss = DEFAULT_P2P_INTRA_BSS;
@@ -3998,6 +3999,7 @@ static const struct global_parse_data global_fields[] = {
{ FUNC(bgscan), 0 },
#ifdef CONFIG_MESH
{ INT(user_mpm), 0 },
+ { INT_RANGE(max_peer_links, 0, 255), 0 },
#endif /* CONFIG_MESH */
{ INT(disable_scan_offload), 0 },
{ INT(fast_reauth), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 2c3d6f5..c8cdca2 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -16,6 +16,7 @@
#define DEFAULT_AP_SCAN 1
#endif /* CONFIG_NO_SCAN_PROCESSING */
#define DEFAULT_USER_MPM 1
+#define DEFAULT_MAX_PEER_LINKS 99
#define DEFAULT_FAST_REAUTH 1
#define DEFAULT_P2P_GO_INTENT 7
#define DEFAULT_P2P_INTRA_BSS 1
@@ -1111,6 +1112,13 @@ struct wpa_config {
* If AMPE or SAE is enabled, the MPM is always in userspace.
*/
int user_mpm;
+
+ /**
+ * max_peer_links - Max peer links
+ *
+ * Max number of mesh peering currently maintained by the STA.
+ */
+ int max_peer_links;
};
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 7adfa63..7a4f3de 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -169,7 +169,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
bss->iconf = conf;
ifmsh->conf = conf;
- ifmsh->bss[0]->max_plinks = 99;
+ ifmsh->bss[0]->max_plinks = wpa_s->conf->max_peer_links;
os_strlcpy(bss->conf->iface, wpa_s->ifname, sizeof(bss->conf->iface));
mconf = mesh_config_create(ssid);
@@ -323,6 +323,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
params.beacon_int = ssid->beacon_int;
else if (wpa_s->conf->beacon_int > 0)
params.beacon_int = wpa_s->conf->beacon_int;
+ params.max_peer_links = wpa_s->conf->max_peer_links;
#ifdef CONFIG_IEEE80211N
params.ht_mode = ssid->mesh_ht_mode;
#endif /* CONFIG_IEEE80211N */
--
1.9.1
More information about the Hostap
mailing list