From patchwork Sat Sep 29 00:13:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Peter_Gro=C3=9Fe?= X-Patchwork-Id: 10620567 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-2.web.codeaurora.org (Postfix) with ESMTP id E9615174A for ; Sat, 29 Sep 2018 00:20:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D88032BB6B for ; Sat, 29 Sep 2018 00:20:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA6642BD7F; Sat, 29 Sep 2018 00:20:17 +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.9 required=2.0 tests=BAYES_00,FROM_EXCESS_BASE64, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 86E312BB6B for ; Sat, 29 Sep 2018 00:20:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbeI2GqW (ORCPT ); Sat, 29 Sep 2018 02:46:22 -0400 Received: from james.theweblords.de ([217.11.55.87]:57088 "EHLO james.theweblords.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbeI2GqV (ORCPT ); Sat, 29 Sep 2018 02:46:21 -0400 X-Greylist: delayed 401 seconds by postgrey-1.27 at vger.kernel.org; Sat, 29 Sep 2018 02:46:21 EDT Received: (qmail 24862 invoked by uid 210); 29 Sep 2018 00:13:28 -0000 X-Qmail-Scanner-Diagnostics: from wl-r3-2.rz.tu-ilmenau.de (petronios@theweblords.de@wl-r3-2.rz.tu-ilmenau.de) by james (envelope-from , uid 201) with qmail-scanner-2.10st (mhr: 1.0. spamassassin: 3.4.1. perlscan: 2.10st. Clear:RC:1(141.24.16.2):. Processed in 0.087777 secs); 29 Sep 2018 00:13:28 -0000 Received: from wl-r3-2.rz.tu-ilmenau.de (HELO localhost) (petronios@theweblords.de@141.24.16.2) by james.theweblords.de with ESMTPA; 29 Sep 2018 00:13:28 -0000 Date: Sat, 29 Sep 2018 02:13:21 +0200 From: Peter =?utf-8?b?R3Jvw59l?= To: linux-wireless@vger.kernel.org Subject: Handling user regdom hints while having intersected world regdom Message-ID: <20180929021321.1e1b6c3e@fem-net.de> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 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 Hi. When a setup has multiple wifi cards anounncing different regdoms, the regularitory subsystem stores an intersected world regdom using aplha2 "98". I wonder what the correct result should be, when I call "iw reg set 00" or with any other country code? Because in my system with multiple cards nothing happened. I added a lot of debug messages and I found the request is rejected with REG_REQ_IGNORE in __reg_process_hint_user (in net/wireless/reg.c:2371). In this check, last_request is considered (the request before my user request), which in my case was the driver request for the second card leading to the intersected regdom. But since "98" doesn't match the regdom provided by the driver, the check returns true and the request gets rejected. The comment above the check mentions not yet processed requests, but I doubt that checking the current regdom against the last_request regdom helps in my case. But from reading the code I got there is a "processed" flag for each requst. So maybe a patch like below is enough? Or are there more things to consider? Or maybe I'm wrong and the current behavior is intended?! Regards Peter diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 4fc66a117b7d..ed4543c7b255 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2428,15 +2428,15 @@ __reg_process_hint_user(struct regulatory_request *user_request) /* * Process user requests only after previous user/driver/core * requests have been processed */ if ((lr->initiator == NL80211_REGDOM_SET_BY_CORE || lr->initiator == NL80211_REGDOM_SET_BY_DRIVER || lr->initiator == NL80211_REGDOM_SET_BY_USER) && - regdom_changes(lr->alpha2)) + !lr->processed) return REG_REQ_IGNORE; if (!regdom_changes(user_request->alpha2)) return REG_REQ_ALREADY_SET; return REG_REQ_OK; }