From patchwork Thu Jun 30 09:03:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 642450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rgDBH1hYhz9sdQ for ; Thu, 30 Jun 2016 19:04:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=gcTeLuAZ; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIXt8-0003I2-Pa; Thu, 30 Jun 2016 09:03:58 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bIXt7-00033e-9q for hostap@lists.infradead.org; Thu, 30 Jun 2016 09:03:58 +0000 Received: by mail-pf0-x242.google.com with SMTP id i123so6857918pfg.3 for ; Thu, 30 Jun 2016 02:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Eg+sOfWCIzf4NFTrgjJPbQe/Gdz/ifMm30Nx1KCVjso=; b=gcTeLuAZDWGkm9PISuukgAeWH9uZM4exRtFPtQ1OYip6Be1cF0NRnCLtNar2QkCjUd T9/4hR1OHC7qfXOVVrhMvC5uIPrFeQymrvJ0U1CT3gMqjC1VVk2KO1IjfKQ5QKy7Ub+m QSI/BHy9scbi0LN+ppp94FkAlT7Ax6OLhXnoElfgV2JYMZb4pO/PWEHz2gfYtcM3asy5 x+PPpku1yMb0ikKw7ILhfHlNe+sXyR3p/vpNpPsopgPnn/hwgmdhwz2Y5DxovPp7XYxX Mj+HbZlSt0D6JRgtrg5PozKi1EjH5pW0X2AAD6zU0M5WOLFIDM3CSiyXEMscHnjd72Zz vCiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Eg+sOfWCIzf4NFTrgjJPbQe/Gdz/ifMm30Nx1KCVjso=; b=dRdPPuUrFU1mkmhiBxDojG3v8HGKzkdUaz9EH6JLdoEpxCv1mCFFhnSeaVIIY5Gs4C Sl3AzQjLGgk2ern9SnNWzO8t1gIc9p3PQZ2u8gSmt6+xAIm6n2LE5pFzd+V/ThQQTu38 pVBbUk9N5zfJbJoV/fYtlEMi88mAbOHM1/bbyKmatYWsXi0AfzTySguQMdOlGqVBqweE X6uV+auzGmhqG1fwQcksZ2MHpD207jf562fzaSG42YMs7crt+7XkHoQEhV85+aN21y9T Ba8a5Xln4fXaxSx0UCbCXtcIXT0DC2Oo4J5fOrWNfnx1Y+R2xCscLoHYQwDplvCoPMSf rBhw== X-Gm-Message-State: ALyK8tJ1fGllRmeG4DHv3iRPUMMsE5WDaub7HlOw7XA/J5YA4cLESt9LMKhXxQHr55WnoQ== X-Received: by 10.98.6.132 with SMTP id 126mr19382561pfg.109.1467277416127; Thu, 30 Jun 2016 02:03:36 -0700 (PDT) Received: from localhost.localdomain (pd28b854f.kngwnt01.ap.so-net.ne.jp. [210.139.133.79]) by smtp.gmail.com with ESMTPSA id t4sm3829841paf.39.2016.06.30.02.03.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jun 2016 02:03:35 -0700 (PDT) From: Masashi Honma To: hostap@lists.infradead.org Subject: [PATCH] mesh: Report mesh peer AID to kernel Date: Thu, 30 Jun 2016 18:03:24 +0900 Message-Id: <1467277404-2760-1-git-send-email-masashi.honma@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160630_020357_399050_A7FCD8E3 X-CRM114-Status: GOOD ( 14.61 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c00:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (masashi.honma[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j@w1.fi, johannes@sipsolutions.net, Masashi Honma , me@bobcopeland.com MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Previously, mesh peer AID is not reported to kernel when local mesh STA is created without iw command. The mesh peer AID is needed by mesh peer power management functionality to identify a AID in a TIM element. This patch reports mesh peer AID to kernel. Signed-off-by: Masashi Honma --- src/ap/sta_info.h | 1 + src/drivers/driver.h | 1 + src/drivers/driver_nl80211.c | 7 +++++++ src/drivers/nl80211_copy.h | 5 +++++ wpa_supplicant/mesh_mpm.c | 9 +++++++-- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h index 5d4d0c8..8b2a550 100644 --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -80,6 +80,7 @@ struct sta_info { enum mesh_plink_state plink_state; u16 peer_lid; u16 my_lid; + u16 mesh_aid; u16 mpm_close_reason; int mpm_retries; u8 my_nonce[WPA_NONCE_LEN]; diff --git a/src/drivers/driver.h b/src/drivers/driver.h index edb6978..a08857c 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1423,6 +1423,7 @@ struct hostapd_sta_add_params { u32 flags_mask; /* unset bits in flags */ #ifdef CONFIG_MESH enum mesh_plink_state plink_state; + u16 mesh_aid; #endif /* CONFIG_MESH */ int set; /* Set STA parameters instead of add */ u8 qosinfo; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index e7a818a..7f45f55 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4032,6 +4032,13 @@ static int wpa_driver_nl80211_sta_add(void *priv, if (!(params->flags & WPA_STA_ASSOCIATED)) upd.mask |= BIT(NL80211_STA_FLAG_ASSOCIATED); } +#ifdef CONFIG_MESH + } else { + if (params->plink_state == PLINK_ESTAB && params->mesh_aid && + nla_put_u16(msg, NL80211_ATTR_MESH_PEER_AID, + params->mesh_aid)) + goto fail; +#endif /* CONFIG_MESH */ } wpa_printf(MSG_DEBUG, " * flags set=0x%x mask=0x%x", diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h index 53c8278..f8c454e 100644 --- a/src/drivers/nl80211_copy.h +++ b/src/drivers/nl80211_copy.h @@ -1829,6 +1829,9 @@ enum nl80211_commands { * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per * interface type. * + * @NL80211_ATTR_MESH_PEER_AID: Association ID for the mesh peer (u16). This is + * used to pull the stored data for mesh peer in power save state. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -2213,6 +2216,8 @@ enum nl80211_attrs { NL80211_ATTR_IFTYPE_EXT_CAPA, + NL80211_ATTR_MESH_PEER_AID, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index 8f327d8..eb8659f 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -195,6 +195,7 @@ static void mesh_mpm_init_link(struct wpa_supplicant *wpa_s, sta->my_lid = llid; sta->peer_lid = 0; + sta->mesh_aid = 0; /* * We do not use wpa_mesh_set_plink_state() here because there is no @@ -394,6 +395,7 @@ void wpa_mesh_set_plink_state(struct wpa_supplicant *wpa_s, os_memset(¶ms, 0, sizeof(params)); params.addr = sta->addr; params.plink_state = state; + params.mesh_aid = sta->mesh_aid; params.set = 1; ret = wpa_drv_sta_add(wpa_s, ¶ms); @@ -700,6 +702,7 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, params.addr = addr; params.plink_state = sta->plink_state; params.aid = sta->aid; + params.mesh_aid = sta->mesh_aid; params.listen_interval = 100; params.ht_capabilities = sta->ht_capabilities; params.vht_capabilities = sta->vht_capabilities; @@ -1032,7 +1035,7 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s, struct hostapd_data *hapd = wpa_s->ifmsh->bss[0]; struct mesh_conf *mconf = wpa_s->ifmsh->mconf; struct sta_info *sta; - u16 plid = 0, llid = 0; + u16 plid = 0, llid = 0, aid = 0; enum plink_event event; struct ieee802_11_elems elems; struct mesh_peer_mgmt_ie peer_mgmt_ie; @@ -1069,7 +1072,8 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s, ie_len -= 2; } if (action_field == PLINK_CONFIRM) { - wpa_printf(MSG_DEBUG, "MPM: AID 0x%x", WPA_GET_LE16(ies)); + aid = WPA_GET_LE16(ies); + wpa_printf(MSG_DEBUG, "MPM: AID 0x%x", aid); ies += 2; /* aid */ ie_len -= 2; } @@ -1181,6 +1185,7 @@ void mesh_mpm_action_rx(struct wpa_supplicant *wpa_s, } else { if (!sta->peer_lid) sta->peer_lid = plid; + sta->mesh_aid = aid; event = CNF_ACPT; } break;