public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Fabian Herb <fabian.herb@xtonomy.ai>
Cc: "iwd@lists.linux.dev" <iwd@lists.linux.dev>
Subject: Re: How to Autoconnect Two WiFi Cards?
Date: Wed, 24 Jan 2024 09:21:09 -0600	[thread overview]
Message-ID: <d3ccf10a-72a8-43b8-8f1c-b5e2a76214ac@gmail.com> (raw)
In-Reply-To: <FAC36784-F498-481A-BD35-D3F24269EBD5@xtonomy.ai>

Hi Fabian,

On 1/24/24 06:34, Fabian Herb wrote:
> Hello Denis,
> 
>>
>>> I’m starting to think that it might be easier to add a feature to iwd that does what I want :). But I’m still a bit lost in the source code.
>>
>> Can you elaborate on what you're trying to accomplish?
>>
>> Do you want iwd to connect to two SSIDs?  Two different BSSes within the same SSID?  Something else?
> 
> I want each WiFi card to connect to a different SSID (each consisting of multiple BSSIDs). Ideally I want to add an entry to each network file to limit it to a certain interface. Maybe even better, but less general: If I could limit the frequency band of each interface, I could save a bit of time during channel scans.

The first part should be fairly easy actually.  A very rough approach would be 
to add some logic inside src/station.c station_autoconnect_next():
   - When considering a network, first check whether a network with the same 
SSID/security type is being connected to by other stations managed by iwd
   - This should be easy to do by looping of the station_list and checking 
connected_network / connected_bss members of struct station.
   - If the networks match, just skip it and continue on to the next autoconnect 
target.
   - This should result in each station object connecting to a different SSID. 
Once latched onto the SSID, station will try to roam only within that network.

If you want to make it more fancy like adding additional scanning policies it 
would take a bit more effort and probably require a policy file format of some sort.

> 
> But I couldn’t find the spot in the code where such a decision would be made. So instead, I added a command line option for the D-Bus name iwd registers as, so I could run two instances of iwd, each handling a different phy. WIP is here: https://github.com/cmdrf/iwd/tree/dbus-name-option. It’s not finished, and I’m not even sure it would work in the end or if there are more clashes between two iwd instances.

Well, it could work, but you'd be running multiple dbus instances and there 
wouldn't be any coordination between iwds.  Also, you'd have to make sure each 
iwd instance runs with a different state directory and probably different config 
file (for band preferences).  See 'man 8 iwd' for details on how to do that. 
Another hint, ell already honors DBUS_SYSTEM_BUS_ADDRESS environment variable. 
So you can start multiple dbus instances, record the address and point each iwd 
to the dbus instance via DBUS_SYSTEM_BUS_ADDRESS environment variable.  No need 
to change any code inside iwd.

> 
>> MLO only works to the same AP though, just different band.  You mentioned using a different SSID earlier?
> 
> Using multiple SSIDs and doing the redundancy on application level is only done out of necessity. I’d happily use MLO if it does what I need instead. But yes, after reading a bit further, I also noticed that it only works on a single AP. Waiting for WiFi 8 then…

Fair enough.

Please report back your findings.  I'm curious since I can foresee a similar 
setup (but on the same SSID / different band / different AP) being useful in the 
future.

Regards,
-Denis

  reply	other threads:[~2024-01-24 15:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 16:48 How to Autoconnect Two WiFi Cards? Fabian Herb
2024-01-16 17:15 ` James Prestwood
2024-01-18 11:51   ` Fabian Herb
2024-01-18 12:18     ` James Prestwood
2024-01-23 13:36       ` Fabian Herb
2024-01-23 14:15         ` James Prestwood
2024-01-23 16:15         ` Denis Kenzior
2024-01-24 12:34           ` Fabian Herb
2024-01-24 15:21             ` Denis Kenzior [this message]
2024-01-24 16:07               ` Fabian Herb
2024-01-24 16:18                 ` Denis Kenzior

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=d3ccf10a-72a8-43b8-8f1c-b5e2a76214ac@gmail.com \
    --to=denkenz@gmail.com \
    --cc=fabian.herb@xtonomy.ai \
    --cc=iwd@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox