All of lore.kernel.org
 help / color / mirror / Atom feed
* iwctl force autoconnect
@ 2021-03-26 21:28 Yuri D'Elia
  2021-03-29 16:12 ` Denis Kenzior
  0 siblings, 1 reply; 8+ messages in thread
From: Yuri D'Elia @ 2021-03-26 21:28 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

Is it possible to force iwd to connect to a known network without
explicitly giving a network name? That is, to force attempting to
autoconnect?

Currently "station <net> connect" requires a ssid. It would be nice if
that would be made optional, causing iwd to go through the automatic
connect logic.

I assumed that issuing a "station <net> scan" *would* attempt to
autoconnect if a known network is seen and we're currently disconnected,
but it's not always the case. If we disconnected from a known network
due to AP disappearing and reappearing sometime later, "scan" will the
network, but connection is still performed after some longer timeout.

I want to bind an action to force a scan+connect without having to wait,
and without having to hardcode a network name. When I'm moving a laptop
between offices and go through some blind spots (elevator) I end-up in a
situation where I'm disconnected, and I want to force a connection right
away.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-26 21:28 iwctl force autoconnect Yuri D'Elia
@ 2021-03-29 16:12 ` Denis Kenzior
  2021-03-29 16:29   ` Mauro Condarelli
  0 siblings, 1 reply; 8+ messages in thread
From: Denis Kenzior @ 2021-03-29 16:12 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

Hi Yuri,

On 3/26/21 4:28 PM, Yuri D'Elia wrote:
> Is it possible to force iwd to connect to a known network without
> explicitly giving a network name? That is, to force attempting to
> autoconnect?
> 
> Currently "station <net> connect" requires a ssid. It would be nice if
> that would be made optional, causing iwd to go through the automatic
> connect logic.
> 
> I assumed that issuing a "station <net> scan" *would* attempt to
> autoconnect if a known network is seen and we're currently disconnected,
> but it's not always the case. If we disconnected from a known network
> due to AP disappearing and reappearing sometime later, "scan" will the
> network, but connection is still performed after some longer timeout.

So in theory this should always be happening.  Once iwd is in 'autoconnect' 
state (starting state, or when we lose a connection) then any scan results 
triggered (either internal scanning logic or scans triggered via dbus/iwctl) 
should then be considered for autoconnect purposes.  You say that 'it's not 
always the case'.  So this works for you sometimes and not other times?  Can you 
capture some logs for us?  Also, are you running any other network managers on 
top of iwd or just iwd standalone?

> 
> I want to bind an action to force a scan+connect without having to wait,
> and without having to hardcode a network name. When I'm moving a laptop
> between offices and go through some blind spots (elevator) I end-up in a
> situation where I'm disconnected, and I want to force a connection right
> away.

We set some very conservative scan timeouts, perhaps you can play with more 
aggressive settings to see if iwd's autoconnect logic will work in your case? 
See 'man 5 iwd.config', InitialPeriodicScanInterval and MaximumPeriodicScanInterval.

I think our default for MaximumPeriodicScanInterval is way too high actually.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-29 16:12 ` Denis Kenzior
@ 2021-03-29 16:29   ` Mauro Condarelli
  2021-03-29 16:32     ` Yuri D'Elia
  2021-03-29 16:37     ` Denis Kenzior
  0 siblings, 2 replies; 8+ messages in thread
From: Mauro Condarelli @ 2021-03-29 16:29 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2475 bytes --]


Il 29/03/2021 18:12, Denis Kenzior ha scritto:
> Hi Yuri,
>
> On 3/26/21 4:28 PM, Yuri D'Elia wrote:
>> Is it possible to force iwd to connect to a known network without
>> explicitly giving a network name? That is, to force attempting to
>> autoconnect?
>>
>> Currently "station <net> connect" requires a ssid. It would be nice if
>> that would be made optional, causing iwd to go through the automatic
>> connect logic.
>>
>> I assumed that issuing a "station <net> scan" *would* attempt to
>> autoconnect if a known network is seen and we're currently disconnected,
>> but it's not always the case. If we disconnected from a known network
>> due to AP disappearing and reappearing sometime later, "scan" will the
>> network, but connection is still performed after some longer timeout.
>
> So in theory this should always be happening.  Once iwd is in 
> 'autoconnect' state (starting state, or when we lose a connection) 
> then any scan results triggered (either internal scanning logic or 
> scans triggered via dbus/iwctl) should then be considered for 
> autoconnect purposes.  You say that 'it's not always the case'. So 
> this works for you sometimes and not other times?  Can you capture 
> some logs for us?  Also, are you running any other network managers on 
> top of iwd or just iwd standalone?

I am guessing he needs to re-enter 'autoconnect' state after an explicit 
disconnect.

Use case for this would be to disconnect from the currently connected 
net and try to connect to some other, if available.

What would be command sequence for this?

>
>>
>> I want to bind an action to force a scan+connect without having to wait,
>> and without having to hardcode a network name. When I'm moving a laptop
>> between offices and go through some blind spots (elevator) I end-up in a
>> situation where I'm disconnected, and I want to force a connection right
>> away.
>
> We set some very conservative scan timeouts, perhaps you can play with 
> more aggressive settings to see if iwd's autoconnect logic will work 
> in your case? See 'man 5 iwd.config', InitialPeriodicScanInterval and 
> MaximumPeriodicScanInterval.
>
> I think our default for MaximumPeriodicScanInterval is way too high 
> actually.
>
> Regards,
> -Denis
> _______________________________________________
> iwd mailing list -- iwd(a)lists.01.org
> To unsubscribe send an email to iwd-leave(a)lists.01.org
>
Regards

Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-29 16:29   ` Mauro Condarelli
@ 2021-03-29 16:32     ` Yuri D'Elia
  2021-03-29 16:37     ` Denis Kenzior
  1 sibling, 0 replies; 8+ messages in thread
From: Yuri D'Elia @ 2021-03-29 16:32 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]

> Il 29/03/2021 18:12, Denis Kenzior ha scritto:
>> So in theory this should always be happening.  Once iwd is in
>> 'autoconnect' state (starting state, or when we lose a connection)
>> then any scan results triggered (either internal scanning logic or
>> scans triggered via dbus/iwctl) should then be considered for
>> autoconnect purposes.  You say that 'it's not always the case'.

Indeed. AP disappears. Some time passes. I issue a 'station <net> scan'.
In some cases, iwd immediately connects to a known network. In some
other cases, I can see it with 'station <net> get-networks', but nothing
happens. Issuing a manual 'connect' will bring the network up
immediately.

>> Also, are you running any other network managers on top of iwd or
>> just iwd standalone?

I'm using iwd standalone.

On Mon, Mar 29 2021, Mauro Condarelli wrote:
> I am guessing he needs to re-enter 'autoconnect' state after an explicit
> disconnect.

I didn't explicitly disconnect in this case, but this makes me wonder if
iwd can exit the 'autoconnect' state by itself for some other reason.

> Use case for this would be to disconnect from the currently connected
> net and try to connect to some other, if available.
>
> What would be command sequence for this?

Would be curious about that too.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-29 16:29   ` Mauro Condarelli
  2021-03-29 16:32     ` Yuri D'Elia
@ 2021-03-29 16:37     ` Denis Kenzior
  2021-03-29 17:09       ` Mauro Condarelli
  1 sibling, 1 reply; 8+ messages in thread
From: Denis Kenzior @ 2021-03-29 16:37 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1292 bytes --]

Hi Mauro,

On 3/29/21 11:29 AM, Mauro Condarelli wrote:
>> So in theory this should always be happening.  Once iwd is in
>> 'autoconnect' state (starting state, or when we lose a connection)
>> then any scan results triggered (either internal scanning logic or
>> scans triggered via dbus/iwctl) should then be considered for
>> autoconnect purposes.  You say that 'it's not always the case'. So
>> this works for you sometimes and not other times?  Can you capture
>> some logs for us?  Also, are you running any other network managers on
>> top of iwd or just iwd standalone?
> 
> I am guessing he needs to re-enter 'autoconnect' state after an explicit
> disconnect.
> 

'explicit disconnect' as in 'station wlan0 disconnect'?  That should really 
never be necessary, and in fact it has the side-effect of disabling autoconnect. 
  We probably should have never enabled this command in iwctl.

> Use case for this would be to disconnect from the currently connected
> net and try to connect to some other, if available.
> 
> What would be command sequence for this?

So while connected, it should just be 'station wlan0 connect <some other 
network>'.  iwd will gracefully switch networks  (disconnect from old + connect 
to new) for you.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-29 16:37     ` Denis Kenzior
@ 2021-03-29 17:09       ` Mauro Condarelli
  2021-03-29 18:11         ` Denis Kenzior
  0 siblings, 1 reply; 8+ messages in thread
From: Mauro Condarelli @ 2021-03-29 17:09 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2081 bytes --]



On 3/29/21 6:37 PM, Denis Kenzior wrote:
> Hi Mauro,
>
> On 3/29/21 11:29 AM, Mauro Condarelli wrote:
>>> So in theory this should always be happening.  Once iwd is in
>>> 'autoconnect' state (starting state, or when we lose a connection)
>>> then any scan results triggered (either internal scanning logic or
>>> scans triggered via dbus/iwctl) should then be considered for
>>> autoconnect purposes.  You say that 'it's not always the case'. So
>>> this works for you sometimes and not other times?  Can you capture
>>> some logs for us?  Also, are you running any other network managers on
>>> top of iwd or just iwd standalone?
>>
>> I am guessing he needs to re-enter 'autoconnect' state after an explicit
>> disconnect.
>>
>
> 'explicit disconnect' as in 'station wlan0 disconnect'?  That should really never be necessary, and in fact it has the side-effect of disabling autoconnect.  We probably should have never enabled this command in iwctl.
>
>> Use case for this would be to disconnect from the currently connected
>> net and try to connect to some other, if available.
>>
>> What would be command sequence for this?
>
> So while connected, it should just be 'station wlan0 connect <some other network>'.  iwd will gracefully switch networks  (disconnect from old + connect to new) for you.
That is not exactly what I asked.
This is for use case "I want to connect to a specific network".

I asked for the "negated": "please connect to *any* net  *but* the current one".

There are also cases where you want to temporarily disconnect and later reconnect to the same or other net, without necessarily having preferences.

This would be particularly useful for "unattended servers" where there's nobody to actually chose.

I think a "enter autoconnect state" command could be useful, at the very least for testing/fallback.

>
> Regards,
> -Denis
> _______________________________________________
> iwd mailing list -- iwd(a)lists.01.org
> To unsubscribe send an email to iwd-leave(a)lists.01.org
>
Regards
Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-29 17:09       ` Mauro Condarelli
@ 2021-03-29 18:11         ` Denis Kenzior
  2021-03-29 19:44           ` Mauro Condarelli
  0 siblings, 1 reply; 8+ messages in thread
From: Denis Kenzior @ 2021-03-29 18:11 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]

Hi Mauro,

>> So while connected, it should just be 'station wlan0 connect <some other network>'.  iwd will gracefully switch networks  (disconnect from old + connect to new) for you.
> That is not exactly what I asked.
> This is for use case "I want to connect to a specific network".
> 
> I asked for the "negated": "please connect to *any* net  *but* the current one".
> 

That is not a usecase we support and I'm not sure I understand why that would 
even be wanted.  Patches are always welcome of course.

> There are also cases where you want to temporarily disconnect and later reconnect to the same or other net, without necessarily having preferences.

That is what rfkill is for.

> 
> This would be particularly useful for "unattended servers" where there's nobody to actually chose.
> 
> I think a "enter autoconnect state" command could be useful, at the very least for testing/fallback.

Perhaps.  We've been contemplating doing this and are quite open to the idea. 
But no one has yet formulated a concrete and compelling use case for us to do so.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: iwctl force autoconnect
  2021-03-29 18:11         ` Denis Kenzior
@ 2021-03-29 19:44           ` Mauro Condarelli
  0 siblings, 0 replies; 8+ messages in thread
From: Mauro Condarelli @ 2021-03-29 19:44 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2287 bytes --]



On 3/29/21 8:11 PM, Denis Kenzior wrote:
> Hi Mauro,
>
>>> So while connected, it should just be 'station wlan0 connect <some other network>'.  iwd will gracefully switch networks  (disconnect from old + connect to new) for you.
>> That is not exactly what I asked.
>> This is for use case "I want to connect to a specific network".
>>
>> I asked for the "negated": "please connect to *any* net  *but* the current one".
>>
>
> That is not a usecase we support and I'm not sure I understand why that would even be wanted.  Patches are always welcome of course.
My "real use case" (I don't know how "compelling" it may be since workarounds are available) is:
- I am maintaining a small headless device that's sold through a net of "installers".
- Installer gets a bunch of devices and preconfigures them "at home", often using his cellphone hotspot as A.P.
- Preconfigured devices are then taken to customer where the customer network is set-up.
- A physical pushbutton switches device in "production mode" (switching from cellphone HS to whatever else).
- if something goes wrong same PB can revert in "programming mode" (should go back to installer HS).

Currently switching involves powering down either cellphone HS (easy) or customer AP (a nuisance).

Having a way to "cycle through available" without actually having the names would be handy.

>
>> There are also cases where you want to temporarily disconnect and later reconnect to the same or other net, without necessarily having preferences.
>
> That is what rfkill is for.
I'm unsure if it could be made available on our target; I'll check. Thanks for the hint.

>
>>
>> This would be particularly useful for "unattended servers" where there's nobody to actually chose.
>>
>> I think a "enter autoconnect state" command could be useful, at the very least for testing/fallback.
>
> Perhaps.  We've been contemplating doing this and are quite open to the idea. But no one has yet formulated a concrete and compelling use case for us to do so.
Please see above.
That is my real use-case.

>
> Regards,
> -Denis
> _______________________________________________
> iwd mailing list -- iwd(a)lists.01.org
> To unsubscribe send an email to iwd-leave(a)lists.01.org
Regards
Mauro

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-29 19:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 21:28 iwctl force autoconnect Yuri D'Elia
2021-03-29 16:12 ` Denis Kenzior
2021-03-29 16:29   ` Mauro Condarelli
2021-03-29 16:32     ` Yuri D'Elia
2021-03-29 16:37     ` Denis Kenzior
2021-03-29 17:09       ` Mauro Condarelli
2021-03-29 18:11         ` Denis Kenzior
2021-03-29 19:44           ` Mauro Condarelli

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.