From patchwork Sat Mar 3 19:40:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 10256151 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5CA55602B5 for ; Sat, 3 Mar 2018 19:40:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CD492879E for ; Sat, 3 Mar 2018 19:40:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BB38287A5; Sat, 3 Mar 2018 19:40:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F6C12879E for ; Sat, 3 Mar 2018 19:40:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752180AbeCCTke (ORCPT ); Sat, 3 Mar 2018 14:40:34 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:48382 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752118AbeCCTkd (ORCPT ); Sat, 3 Mar 2018 14:40:33 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6B1D960767; Sat, 3 Mar 2018 19:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520106033; bh=zGAmMeTDtmdTX8oE13kV69M/5LGh2O8/QYGHBzNwf98=; h=From:To:Cc:Subject:Date:From; b=UQMMdxPAuOeDBazXppNm66B/3SipfYoF7rVCMvbwYEE/q595KH4GfM7w1ZJamrKdB 37EZPxHTh/b9RHXVE6i6TIcfy+L/EIhx1xRl3kmt0GY2UVqbqDYwcnZ+t4wiFAqIZD TTNIt/E75T6JBWnqOvjZMfp5Tq2d4LBehqZsFmTY= Received: from jouni.codeaurora.org (37-136-100-69.rev.dnainternet.fi [37.136.100.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jouni@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5020D60117; Sat, 3 Mar 2018 19:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520106032; bh=zGAmMeTDtmdTX8oE13kV69M/5LGh2O8/QYGHBzNwf98=; h=From:To:Cc:Subject:Date:From; b=Ya9q6vjD9Etzr13THwaZ1Kh470o26iod1W65PWLHDbHbzo+RHzw1YtVoTHIN+SzHV dFCB6le+AvbhKEStuoi4uqZILZa27Riho7lXyruDAadBBg1ftObIM82t79PPMHw8XK 08DQgmUZNv8L0hDcYnWPa9Avr72ZpqM7NV2N5d2s= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5020D60117 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jouni@codeaurora.org From: Jouni Malinen To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Amar Singhal , Kiran Kumar Lokere , Jouni Malinen Subject: [PATCH 1/2] cfg80211: Enhance semantics for self-managed hints Date: Sat, 3 Mar 2018 21:40:20 +0200 Message-Id: <1520106021-16836-1-git-send-email-jouni@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Amar Singhal Currently, kernel ignores regulatory_hint_user for a wiphy with flag REGULATORY_WIPHY_SELF_MANAGED set. Wiphy with REGULATORY_WIPHY_SELF_MANAGED set would ignore beacon hints and country IE hints and updates from other wiphys in the system, but it may want to know regulatory setting originating from user-space (NL80211_REGDOM_SET_BY_USER) that can be trusted (NL80211_USER_REG_HINT_CELL_BASE). Therefore, conditionally call the regulatory notifier for a self managed wiphy. Signed-off-by: Amar Singhal Signed-off-by: Kiran Kumar Lokere Signed-off-by: Jouni Malinen --- include/net/regulatory.h | 7 ++++--- net/wireless/reg.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/net/regulatory.h b/include/net/regulatory.h index f83cacc..25241c7 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h @@ -156,9 +156,10 @@ struct regulatory_request { * system. Conversely, a self-managed wiphy does not share its regulatory * hints with other devices in the system. If a system contains several * devices, one or more of which are self-managed, there might be - * contradictory regulatory settings between them. Usage of flag is - * generally discouraged. Only use it if the FW/driver is incompatible - * with non-locally originated hints. + * contradictory regulatory settings between them. Regulatory information + * from trusted user space sources can still be passed to self-managed + * wiphy. Usage of this flag is generally discouraged. Only use it if the + * FW/driver is incompatible with non-locally originated hints. * This flag is incompatible with the flags: %REGULATORY_CUSTOM_REG, * %REGULATORY_STRICT_REG, %REGULATORY_COUNTRY_IE_FOLLOW_POWER, * %REGULATORY_COUNTRY_IE_IGNORE and %REGULATORY_DISABLE_BEACON_HINTS. diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 7b42f0b..4f25a11b 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2580,7 +2580,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) reg_free_request(reg_request); } -static bool reg_only_self_managed_wiphys(void) +static bool reg_only_self_managed_wiphys(struct regulatory_request *reg_request) { struct cfg80211_registered_device *rdev; struct wiphy *wiphy; @@ -2590,10 +2590,16 @@ static bool reg_only_self_managed_wiphys(void) list_for_each_entry(rdev, &cfg80211_rdev_list, list) { wiphy = &rdev->wiphy; - if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { self_managed_found = true; - else + if (reg_request->initiator == + NL80211_REGDOM_SET_BY_USER && + reg_request->user_reg_hint_type == + NL80211_USER_REG_HINT_CELL_BASE) + reg_call_notifier(wiphy, reg_request); + } else { return false; + } } /* make sure at least one self-managed wiphy exists */ @@ -2631,7 +2637,7 @@ static void reg_process_pending_hints(void) spin_unlock(®_requests_lock); - if (reg_only_self_managed_wiphys()) { + if (reg_only_self_managed_wiphys(reg_request)) { reg_free_request(reg_request); return; }