diff mbox

[1/2] mesh: Ignore crowded peer

Message ID 1465875076-2622-1-git-send-email-masashi.honma@gmail.com
State Accepted
Headers show

Commit Message

Masashi Honma June 14, 2016, 3:31 a.m. UTC
The "Accepting Additional Mesh Peerings bit == 0" means the peer can not accept
any more peer. So suppress to open the connection to the peer.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 src/common/ieee802_11_defs.h | 8 ++++++++
 wpa_supplicant/mesh_mpm.c    | 7 +++++++
 2 files changed, 15 insertions(+)

Comments

Jouni Malinen June 19, 2016, 9:59 p.m. UTC | #1
On Tue, Jun 14, 2016 at 12:31:15PM +0900, Masashi Honma wrote:
> The "Accepting Additional Mesh Peerings bit == 0" means the peer can not accept
> any more peer. So suppress to open the connection to the peer.

Thanks, both patches applied.
diff mbox

Patch

diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 5be747b..8570100 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -1332,6 +1332,14 @@  enum wifi_display_subelem {
 #define MESH_PATH_PROTOCOL_VENDOR	255
 #define MESH_PATH_METRIC_AIRTIME	1
 #define MESH_PATH_METRIC_VENDOR		255
+/* IEEE 802.11s - Mesh Capability */
+#define MESH_CAP_ACCEPT_ADDITIONAL_PEER	BIT(0)
+#define MESH_CAP_MCCA_SUPPORTED		BIT(1)
+#define MESH_CAP_MCCA_ENABLED		BIT(2)
+#define MESH_CAP_FORWARDING		BIT(3)
+#define MESH_CAP_MBCA_ENABLED		BIT(4)
+#define MESH_CAP_TBTT_ADJUSTING		BIT(5)
+#define MESH_CAP_MESH_PS_LEVEL		BIT(6)
 
 enum plink_action_field {
 	PLINK_OPEN = 1,
diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c
index a0b7174..30e8de9 100644
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -649,6 +649,13 @@  static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s,
 	struct sta_info *sta;
 	int ret;
 
+	if (elems->mesh_config_len >= 7 &&
+	    !(elems->mesh_config[6] & MESH_CAP_ACCEPT_ADDITIONAL_PEER)) {
+		wpa_msg(wpa_s, MSG_DEBUG, "Ignore the crowded peer " MACSTR,
+			MAC2STR(addr));
+		return NULL;
+	}
+
 	sta = ap_get_sta(data, addr);
 	if (!sta) {
 		sta = ap_sta_add(data, addr);