diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 4fcc64801..b8ee825d3 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 f7ab6fcc8..cff7b0ddd 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7801,6 +7801,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 bd80b297b..d3a8c86ff 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 2c3d6f5b6..b3f7eef73 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 - Maximum number of peer links + * + * Maximum number of mesh peering currently maintained by the STA. + */ + int max_peer_links; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index cc632b7c7..5c8b24b0e 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -1216,6 +1216,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) if (config->user_mpm != DEFAULT_USER_MPM) fprintf(f, "user_mpm=%d\n", config->user_mpm); + + if (config->max_peer_links != DEFAULT_MAX_PEER_LINKS) + fprintf(f, "max_peer_links=%d\n", config->max_peer_links); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 7adfa63b9..7a4f3de06 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 */ diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index 95a212df5..e78c0dd99 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -123,6 +123,10 @@ ap_scan=1 # 1: wpa_supplicant provides an MPM which handles peering (default) #user_mpm=1 +# Maximum number of peer links (0-255; default: 99) +# Maximum number of mesh peering currently maintained by the STA. +#max_peer_links=99 + # EAP fast re-authentication # By default, fast re-authentication is enabled for all EAP methods that # support it. This variable can be used to disable fast re-authentication.