From patchwork Tue Feb 24 13:42:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 5872771 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CEC58BF440 for ; Tue, 24 Feb 2015 13:42:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE56620251 for ; Tue, 24 Feb 2015 13:42:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2F892024D for ; Tue, 24 Feb 2015 13:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752503AbbBXNm3 (ORCPT ); Tue, 24 Feb 2015 08:42:29 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:44392 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752403AbbBXNm2 (ORCPT ); Tue, 24 Feb 2015 08:42:28 -0500 Received: by padet14 with SMTP id et14so36040970pad.11 for ; Tue, 24 Feb 2015 05:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gwv4blc1wNpL2A9J/PvM3czIerTe+rTHydS0Utt2ZmY=; b=craPAaramTXcmyByMwsze+g2aUsMLi12uci6g435YKp3FxmmW4xJalxLjhKaWoEQ0F koLczQmiraqas7eZEx1K3Q++6ovxl7ENyYy19viSYBaU1cDtT1YFbDO7ePtJ4dq9FpJs /36tBw06JD97XoWDLAkUp6uYdBXJ5SsIBdu5egyFWv5nuQR89grQWfSWsGvt8ltmxYe0 JBkRitkqq/vlUxp+yI2HbIXT0+PfafuC70hpO9LLnk4fwVW+YiA3MpmXBGm7ldA8T6oK B9jYj+7EltTi06OQFpfjB/GXpc+rEpTOiSVfuZWi83oZxQyMxve0S14zMELoqqgYG6f0 uC7A== X-Received: by 10.68.69.110 with SMTP id d14mr3751583pbu.3.1424785347977; Tue, 24 Feb 2015 05:42:27 -0800 (PST) Received: from localhost.localdomain (pdd3699.kngwnt01.ap.so-net.ne.jp. [218.221.54.153]) by mx.google.com with ESMTPSA id zs8sm39392514pac.9.2015.02.24.05.42.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Feb 2015 05:42:27 -0800 (PST) From: Masashi Honma To: linux-wireless@vger.kernel.org Cc: me@bobcopeland.com, johannes@sipsolutions.net, Masashi Honma Subject: [PATCH v5] mac80211: Allow 0 for NL80211_MESHCONF_PLINK_TIMEOUT to disable STA expiration Date: Tue, 24 Feb 2015 22:42:16 +0900 Message-Id: <1424785336-3268-1-git-send-email-masashi.honma@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both wpa_supplicant and mac80211 has inactivity timer. By default wpa_supplicant will be timed out in 5 minutes and mac80211's it is 30 minutes. If wpa_supplicant uses more long timer than mac80211, wpa_supplicant will get unexpected disconnection by mac80211. This patch adds functionality of disabling mac80211 inactivity timer to avoid to prevent wpa_supplicant inactivity timer. I have thought setting 0xffffffff to NL80211_MESHCONF_PLINK_TIMEOUT will solve this problem without this patch. But the approach does not work on 32 bit system. To explain the reason, I will show STA expiration rule in kernel. This is the expression. (current jiffies) > (frame Rx jiffies + NL80211_MESHCONF_PLINK_TIMEOUT * 250) On 32bit system, right side could be over flow and be unexpected small value if NL80211_MESHCONF_PLINK_TIMEOUT is sufficiently large. STA expiration occurs by this reason. So I made this patch. Signed-off-by: Masashi Honma --- include/uapi/linux/nl80211.h | 3 ++- net/mac80211/mesh.c | 3 ++- net/wireless/nl80211.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 1cbc3aa..0c71180 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -3092,7 +3092,8 @@ enum nl80211_mesh_power_mode { * * @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've * established peering with for longer than this time (in seconds), then - * remove it from the STA's list of peers. Default is 30 minutes. + * remove it from the STA's list of peers. You may set this to 0 to disable + * the removal of the STA. Default is 30 minutes. * * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use */ diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 0c8b2a7..acf441f 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -574,7 +574,8 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata) struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; u32 changed; - ieee80211_sta_expire(sdata, ifmsh->mshcfg.plink_timeout * HZ); + if (ifmsh->mshcfg.plink_timeout > 0) + ieee80211_sta_expire(sdata, ifmsh->mshcfg.plink_timeout * HZ); mesh_path_expire(sdata); changed = mesh_accept_plinks_update(sdata); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index e9ad9d9..bef52af 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -5261,7 +5261,7 @@ do { \ FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshAwakeWindowDuration, 0, 65535, mask, NL80211_MESHCONF_AWAKE_WINDOW, nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, plink_timeout, 1, 0xffffffff, + FILL_IN_MESH_PARAM_IF_SET(tb, cfg, plink_timeout, 0, 0xffffffff, mask, NL80211_MESHCONF_PLINK_TIMEOUT, nla_get_u32); if (mask_out)