All of lore.kernel.org
 help / color / mirror / Atom feed
From: HENRIET Vivien <vivien.henriet@overkiz.com>
To: "wagi@monom.org" <wagi@monom.org>
Cc: "connman@lists.linux.dev" <connman@lists.linux.dev>
Subject: Re: [PATCH] wifi: Choose a random channel when opening an ap
Date: Wed, 29 Sep 2021 08:57:25 +0000	[thread overview]
Message-ID: <bd9eda8f-02c8-7ae0-7fa7-5bf8b2127db8@overkiz.com> (raw)
In-Reply-To: <20210923124429.1123-1-v.henriet@overkiz.com>

Hi Daniel,

Could you have a look to this patch?

I would like to be able to open the WiFi AP on different channel.
The simplest way to do it, is to select a random channel, which fit my need.
Do you think its acceptable to integrate this way?

I've got also other ideas to achieve the same goal:
- Add an optional channel parameter when opening the AP
- Add a global config to set the channel
- ...

What do you think?

Best regards,
Vivien

Le 23/09/2021 à 14:44, Vivien Henriet a écrit :
> When the tethering mode is started, a WiFi ap is created using the fixed
> channel 1 (2412 MHz). There is no way to configure this channel.
>
> This patch make connman choose a random channel every time the ap is created.
> ---
>   plugins/wifi.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/plugins/wifi.c b/plugins/wifi.c
> index 578b4be7..936f1750 100644
> --- a/plugins/wifi.c
> +++ b/plugins/wifi.c
> @@ -3344,11 +3344,19 @@ static GSupplicantSSID *ssid_ap_init(const char *ssid, const char *passphrase)
>       if (!ap)
>               return NULL;
>
> +     /**
> +      * Choose a random channel in the range 1-11. Channels 12-14 are not
> +      * available worlwide.
> +      * Channels within this range are spaced 5 MHz apart from each other.
> +      */
> +     int channel = (rand() % 11) + 1;
> +     int freq = 2407 + channel * 5;
> +
>       ap->mode = G_SUPPLICANT_MODE_MASTER;
>       ap->ssid = ssid;
>       ap->ssid_len = strlen(ssid);
>       ap->scan_ssid = 0;
> -     ap->freq = 2412;
> +     ap->freq = freq;
>
>       if (!passphrase || strlen(passphrase) == 0) {
>               ap->security = G_SUPPLICANT_SECURITY_NONE;


------------------ Internet Email Confidentiality Footer ------------------
The information  transmitted in this document  is  intended  only  for  the
person  or  entity to whom it is addressed  and  may  contain  confidential
and/or privileged material. Any review,  retransmission,  dissemination  or
other use of,  or taking of any action in reliance upon this information by
persons or entities other than the intended recipient is prohibited. If you
received this in error,  please contact the sender and delete all copies of
the material.

  reply	other threads:[~2021-09-29  8:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 12:44 [PATCH] wifi: Choose a random channel when opening an ap Vivien Henriet
2021-09-29  8:57 ` HENRIET Vivien [this message]
2021-09-29  9:16   ` Daniel Wagner
2021-10-04  6:45     ` Michael Nazzareno Trimarchi
2021-10-04  7:09       ` Daniel Wagner
2021-10-04  7:34         ` Michael Nazzareno Trimarchi
2021-10-04  7:46           ` Daniel Wagner
2021-10-04 21:21             ` Michael Nazzareno Trimarchi

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=bd9eda8f-02c8-7ae0-7fa7-5bf8b2127db8@overkiz.com \
    --to=vivien.henriet@overkiz.com \
    --cc=connman@lists.linux.dev \
    --cc=wagi@monom.org \
    /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.