All of lore.kernel.org
 help / color / mirror / Atom feed
From: Orr Mazor <orr.mazor@tandemg.com>
To: Tom Psyborg <pozega.tomislav@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH] cfg80211: Fix regulatory data is reset in case all phys have disconnected
Date: Thu, 16 Jan 2020 12:23:55 +0000	[thread overview]
Message-ID: <AM0PR02MB3620B9D7A4F68BA601B0445FEF360@AM0PR02MB3620.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <CAKR_QVJkVSCuzZWgOxxmkffTYG3pgX4ZX_vvw-6Th5=tvs7ovg@mail.gmail.com>

>On 15/01/2020, Orr Mazor <orr.mazor@tandemg.com> wrote:
>> In case no one is occupying a wiphy, all past regulatory data will be
>> lost as a result of reset to world reg domain.
>>
>> This includes any channel that is currently in NOP time as well as in
>> AVAILABLE state.
>>
>> This means that after detecting a radar on a channel the user might be
>> able to simply reset hostapd and get back to that channel, this is a
>> major issue.
>>
>> To solve this I have added a check before doing any resets.
>>
>> If the user (for example: hostapd) asks for a regdomain and we are
>> already in that regdomain, than we shouldn't reset that regdomain in
>> case of wiphy disconnection (for example: hostapd reset or killed).
>>
>> That way the regulatory data will be saved as long as we are in the
>> same regdomain.
>>
>> Since in that case we will anyway get back to the same regdomain the
>> only difference is we will now save the regulatory data, won't lose
>> it, and as a result won't get back to a channel that a radar was
>> detected on until NOP will be finished, as should be.
>>
>> Signed-off-by: Orr Mazor <Orr.Mazor@tandemg.com>
>> ---
>>  net/wireless/reg.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/net/wireless/reg.c b/net/wireless/reg.c index
>> d18cc05061a0..5049c487950b 100644
>> --- a/net/wireless/reg.c
>> +++ b/net/wireless/reg.c
>> @@ -3180,6 +3180,16 @@ static void restore_regulatory_settings(bool
>> reset_user, bool cached)
>>  	}
>>  	spin_unlock(&reg_indoor_lock);
>>
>> +	/* If the user asks for a regdomain and we are
>> +	 * already in that regdomain, than we shouldn't reset
>> +	 * the regdomain in the case of wiphy disconnection.
>> +	 */
>> +	if (cached && !reset_user &&
>> +	    (!IS_ERR_OR_NULL(cfg80211_user_regdom)) &&
>> +	    (!regdom_changes(cfg80211_user_regdom->alpha2))) {
>> +		return;
>> +	}
>> +
>>  	reset_regdomains(true, &world_regdom);
>>  	restore_alpha2(alpha2, reset_user);
>>
>> --
>> 2.17.1
>>
>>
>
>Which device have you tested this on?

Hi Tom,

I have tested this on mac80211_hwsim and on a intel proprietary device.
The issue (before the patch) is seen in both, and the patch solves it in both.

BR,
Orr

  reply	other threads:[~2020-01-16 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 15:02 [PATCH] cfg80211: Fix regulatory data is reset in case all phys have disconnected Orr Mazor
2020-01-15 16:04 ` Tom Psyborg
2020-01-16 12:23   ` Orr Mazor [this message]
2020-02-07 10:43     ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR02MB3620B9D7A4F68BA601B0445FEF360@AM0PR02MB3620.eurprd02.prod.outlook.com \
    --to=orr.mazor@tandemg.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pozega.tomislav@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.