Bug 257229 - net-mgmt/wifimgr with multiple Wi-Fi interfaces
Summary: net-mgmt/wifimgr with multiple Wi-Fi interfaces
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Alexey Dokuchaev
URL:
Keywords:
Depends on:
Blocks: 259569
  Show dependency treegraph
 
Reported: 2021-07-17 10:14 UTC by Graham Perrin
Modified: 2021-12-08 18:07 UTC (History)
3 users (show)

See Also:
fbsd: maintainer-feedback+


Attachments
Screenshot: Internet connectivity with wlan1 but no sign of connectivity in wifimgr (93.65 KB, image/png)
2021-07-17 10:14 UTC, Graham Perrin
no flags Details
wifimgr showing all networks (127.75 KB, image/png)
2021-07-17 10:15 UTC, Graham Perrin
no flags Details
Screenshot: long after clicking the 'WiFi Up/Down' button (178.22 KB, image/png)
2021-08-15 13:16 UTC, Graham Perrin
no flags Details
Screenshot: ambiguity for one interface's view of an SSID with multiple BSSIDs (244.84 KB, image/png)
2021-08-15 13:33 UTC, Graham Perrin
no flags Details
wlan0 and wlan1 both associated with SSID piano (66.27 KB, image/png)
2021-08-17 07:06 UTC, Graham Perrin
no flags Details
Screenshot: after successfully bringing things up (59.00 KB, image/png)
2021-08-17 07:24 UTC, Graham Perrin
no flags Details
patch to update port from 1.17 to 1.18 (3.79 KB, patch)
2021-09-06 09:27 UTC, J.R. Oldroyd
fbsd: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin freebsd_committer freebsd_triage 2021-07-17 10:14:21 UTC
Created attachment 226511 [details]
Screenshot: Internet connectivity with wlan1 but no sign of connectivity in wifimgr

Please: is support for multiple interfaces out of scope? 

The attached screenshot shows wlan1 in use – after 
service netif stop wlan0 
– but the connectivity is not shown when wifimgr is run.
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2021-07-17 10:15:27 UTC
Created attachment 226512 [details]
wifimgr showing all networks

wlan1 is connected to SSID 'piano' but there's no sign of connectivity in wifimgr.
Comment 2 J.R. Oldroyd 2021-07-17 12:16:36 UTC
wifimgr looks for the first interface configured in /etc/rc.conf as either:
    ifconfig_XYZN="... WPA ..."
or
    wpa_supplicant_flags="... -i XYZN ..."

If you re-order your config in /etc/rc.conf so that your desired interface is first, wifimgr will work on that interface.

As for your actual question - supporting multiple interfaces - this would require some reworking of the code which currently only handles one interface.  I can put that on a todo list, but it isn't something that I anticipate doing soon.
Comment 3 Graham Perrin freebsd_committer freebsd_triage 2021-07-17 13:33:40 UTC
(In reply to J.R. Oldroyd from comment #2)

Thanks! 

I guess, I can: 

netif_nic_seq="wlan1 wlan0"
Comment 4 J.R. Oldroyd 2021-07-18 19:58:21 UTC
A development version 1.17.2 with, among other things, has initial support for multiple wifi interfaces, has been made available to the OP for testing and feedback.
Comment 5 J.R. Oldroyd 2021-08-02 11:19:34 UTC
No feedback has yet been received from the OP.

The current development version, wifimgr-1.17.7, is available for download from the project web site:
    https://opal.com/src/wifimgr/

Since adding support for multiple WiFi interfaces involved a major recode of the configuration parser for detecting the wlanN interfaces and the code that finds aggregate interfaces (e.g., laggN interfaces that use wlanN) as well as changes to many of wifimgr's functions that handle these interfaces, we are requesting feedback that nothing got broken before publishing a FreeBSD port update.

Anyone wishing to test the development version is requested to download it from the project web site.  Please then send feedback.  Thanks.
Comment 6 Graham Perrin freebsd_committer freebsd_triage 2021-08-03 18:13:32 UTC
(In reply to J.R. Oldroyd from comment #5)

My apologies; I have been busy with what might be a permanent move of my boot disk from one notebook to another (with some complications) ...
Comment 7 Graham Perrin freebsd_committer freebsd_triage 2021-08-15 13:16:29 UTC
Created attachment 227216 [details]
Screenshot: long after clicking the 'WiFi Up/Down' button

(In reply to J.R. Oldroyd from comment #5)

After a single click on the 'WiFi Up/Down' button, the button appears to remain in its pressed state – endlessly (long after completing the required action). 

A subsequent click on the (apparently already clicked) button results in no change to the apparent state, but the required action is performed.
Comment 8 Graham Perrin freebsd_committer freebsd_triage 2021-08-15 13:33:10 UTC
Created attachment 227222 [details]
Screenshot: ambiguity for one interface's view of an SSID with multiple BSSIDs

My initial connection to SSID 'piano' was with wifimgr-1.17 – probably with wlan0 and without enabling wlan1 in rc.conf – and I enabled: 

☑ Any BSSID

----

With 1.17.7 and wlan1 enabled, after _disabling_ 
☐ Any BSSID 
there's the green icon of connectivity for wlan1 for same SSID, however it's not enabled, and (half-expected) there's no hint that an encryption key has been entered. 

From the manual page for wifimgr(8): 

> … When the "Save" button is clicked, the enabled networks are 
> written back out to the wpa_supplicant.conf(5) file and the network 
> interface is restarted. …

In this case, it's unclear what will be the effect of 
☑ Enabled 
for the upper of the two listings (the BSSID that's currently at channel 1) because if I understand correctly, the Konsole window in the background shows an _already enabled_ connection to channel 1.
Comment 9 J.R. Oldroyd 2021-08-16 08:18:26 UTC
(In reply to Graham Perrin from comment #7)

I am unable to reproduce the stuck "WiFi Up/Down" button behavior that you're describing.  For me it is working as expected.

For you, does it get stuck going from WiFi On->Off or from Off->On?

And, are you on a system with multiple wlanN interfaces?
Comment 10 J.R. Oldroyd 2021-08-16 09:10:07 UTC
(In reply to Graham Perrin from comment #8)

The ambiguity for the active bssid when clearing the Any BSSID checkbox is fixed in 1.17.8 which is now on the web site.

Thanks for pointing this out.
Comment 11 Graham Perrin freebsd_committer freebsd_triage 2021-08-17 07:06:02 UTC
Created attachment 227268 [details]
wlan0 and wlan1 both associated with SSID piano

Thanks for all of this, 

(In reply to J.R. Oldroyd from comment #10)

With 1.17.8 and (according to ifconfig) wlan0 and wlan0 both associated with 'piano': there's a green icon of connectivity alongside just one listing, the one that's apparently not enabled.
Comment 12 Graham Perrin freebsd_committer freebsd_triage 2021-08-17 07:23:15 UTC
(In reply to J.R. Oldroyd from comment #9)

> … For you, does it get stuck going from WiFi On->Off or from Off->On?

This might vary from one computer to another. 

I'm accustomed to a short wait. In the past I never gave it much thought, but guessed that the wait related to the length of time taken for the interface to either (a) connect to the network; or (b) connect _and_ gain a network address. 

On 15th August with 1.17.1, waiting periods seemed to be endless. 

Today with 1.17.8 with a different computer (see below), things are not endless. Instead: 

1. with neither interface connected when the application starts

2. a first click on the button is followed by a short wait, then the button reverts to its normal (non-pressed) state, and ifconfig shows both interfaces _up_ however the application appears as if things are still down

3. a second click on the button is immediately followed by presentation of the list of networks etc., and ifconfig shows that the click did not take things down.

HTH


----

> And, are you on a system with multiple wlanN interfaces?

Yes. Screenshots on 15th August with 1.17.7 were whilst using an HP ZBook 17 G2 with the following USB adapter: 

D-Link System – AirPlus G DWL-G122 Wireless Adapter(rev.C1) [Ralink RT2571W]

Screenshots today with 1.17.8 are whilst using the same adapter <https://bsd-hardware.info/?probe=71092e78e2#d36> with an HP EliteBook 8570p.
Comment 13 Graham Perrin freebsd_committer freebsd_triage 2021-08-17 07:24:40 UTC
Created attachment 227270 [details]
Screenshot: after successfully bringing things up

(In reply to Graham Perrin from comment #12)

> 2. a first click on the button is followed by a short wait, 
> then the button reverts to its normal (non-pressed) state, and 
> ifconfig shows both interfaces _up_ however the application appears 
> as if things are still down
Comment 14 J.R. Oldroyd 2021-08-17 12:13:05 UTC
I have made a change to the code that handles the interface up/down toggle.  Hopefully this will help.

Please could you try 1.17.10.

If that still doesn't help, perhaps you could send me the relevant lines from your rc.conf... the wlans_intX and ifconfig_wlanX lines?  You can email them directly if you prefer not to post them here.  I may have to send you a version with additional debug in it so that I can see what's going on there.
Comment 15 Graham Perrin freebsd_committer freebsd_triage 2021-08-17 17:10:48 UTC
(In reply to J.R. Oldroyd from comment #14)

Thank you, still two clicks before the list of networks appears. The first click brings things up, the second immediately presents the list. 

Various lines from rc.conf below. 

----

netif_nic_seq="em0 wlan0"

rtsold_enable="YES"
ipv6_activate_all_interfaces="NO"
ipv6_defaultrouter="⋯::1"

cloned_interfaces="gif0"
create_args_gif0="tunnel 192.168.1.10 ⋯.⋯.⋯.⋯ mtu 1480"
ifconfig_gif0_ipv6="inet6 ⋯::2 ⋯::1 prefixlen 128 NOAUTO"

create_args_wlan0="country GB regdomain etsi"
wlans_iwn0="wlan0"
# ifconfig_wlan0="WPA DHCP"
ifconfig_wlan0="WPA DHCP NOAUTO"
# ifconfig_wlan0="WPA SYNCDHCP"
# ifconfig_wlan0="WPA SYNCDHCP NOAUTO"

create_args_wlan1="country GB regdomain etsi"
wlans_rum0="wlan1"
# ifconfig_wlan1="WPA DHCP"
ifconfig_wlan1="WPA DHCP NOAUTO"
# ifconfig_wlan1="WPA SYNCDHCP"

----

(192.168.1.10 is tied, by my local router, to a wired interface.)
Comment 16 J.R. Oldroyd 2021-08-17 19:15:11 UTC
Okay, I think it is the use of NOAUTO in the ifconfig_wlanN lines that was confusing wifimgr.  It was looking for an associated network and, when none was found, it was setting the GUI status to down, even though the interfaces were actually up.

I have now added code to not look for associated networks, but to simply look at the interfaces' statuses when determining the GUI up/down status.

New version is 1.17.11.


By the way, I didn't answer your point about the delay before.  The delay is due to waiting for the interface up command to complete.  You can run "/etc/rc.d/netif start wlanN" and you will see the same delay.

Once that command completes wifimgr does loop for up to 10s more waiting for an associated network.  However, in practice, this isn't needed as the interface will have associated before the "netif start" command returned.
Comment 17 Graham Perrin freebsd_committer freebsd_triage 2021-08-19 04:26:07 UTC
Thanks. 

Tested: 1.17.13 (a little higher than the wifimgr-1.17.12.tar.xz that's currently listed at <https://opal.com/src/wifimgr/>). 

Not fixed, sorry. 

If it helps, running 
tail -f -n 0 /var/log/messages 
before clicks on the 'WiFi Up/Down' button, I saw these lines 
_after_ the click that resulted in presentation of the list of networks: 


Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8008]: New IP Address (wlan0): 192.168.1.7
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8012]: New Subnet Mask (wlan0): 255.255.255.0
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8016]: New Broadcast Address (wlan0): 192.168.1.255
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8020]: New Routers (wlan0): 192.168.1.1
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8045]: New IP Address (wlan1): 192.168.1.5
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8049]: New Subnet Mask (wlan1): 255.255.255.0
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8053]: New Broadcast Address (wlan1): 192.168.1.255
Aug 19 05:21:27 mowa219-gjp4-8570p-freebsd dhclient[8057]: New Routers (wlan1): 192.168.1.1
Comment 18 Graham Perrin freebsd_committer freebsd_triage 2021-08-19 04:32:25 UTC
Incidentally, I was slightly surprised to find a connection when I first started 1.17.13 (before I touched any part of the interface). 


% grep wlan1 /etc/rc.conf | grep -v \#
create_args_wlan1="country GB regdomain etsi"
wlans_rum0="wlan1"
ifconfig_wlan1="WPA DHCP NOAUTO"
% ifconfig wlan1 | grep status
        status: associated
% 


I had done nothing more than plug in the adapter. Slightly surprised to find an automated connection where there's NOAUTO for the interface. 

Does this smell like a bug in FreeBSD base?
Comment 19 J.R. Oldroyd 2021-08-19 08:53:47 UTC
From what you've posted, when you run wifimgr, I have understood that it needs two clicks of the WiFi Up/Down button before you see the list of networks and, I guess, you expect one click?  Or no clicks?

Could you be ending up with a situation where the system configures interfaces as up (but not associated) when wifimgr is started and no network scan is yet available?

You could check that by running:
	ifconfig wlanN list scan
before starting wifimgr.  wifimgr runs that same command on all interfaces that are up when it starts.  If no interface has yet done a scan and so "ifconfig list scan" shows nothing, wifimgr will also show nothing when it starts.  If at least one interface is up (even if not associated) wifimgr will show the blue icon.  It will then take two clicks of the Up/Down button to (1) turn off the interfaces then (2) turn them back on and read their scans.

Similarly, if one interface does have scan results but the other doesn't yet (e.g., because it hasn't scanned or because it is down), it will also take two clicks to turn everything off then to turn everything on again in order to get both interfaces' scans.

If you're seeing something else happening and I haven't got it right, at this stage, what might be useful for me is a repeat-by, possibly starting from boot, along the lines of:

	system with N built-in wlan if's, N plugin-able if's
	grep wlan /etc/rc.conf | grep -v \#
	boot
	saw that xyz happened
	expected that pqr happened instead
	inserted plugin interface
	saw that xyz happened
	expected that pqr happened instead
	ran wifimgr	
	saw that xyz happened
	expected that pqr happened instead

adjusted, of course, for whatever sequence is appropriate.
Comment 20 J.R. Oldroyd 2021-09-02 19:27:15 UTC
Any further feedback on this?

If not, this weekend, I shall roll the current development version 1.17.13 into release 1.18 and ask that it be committed.
Comment 21 Graham Perrin freebsd_committer freebsd_triage 2021-09-05 13:51:04 UTC
I haven't had the headspace recently (sorry) with work commitments and so on. 

Holiday next week, then there'll be a few more days of unusually heavy work commitments so please, don't let me hold you up. Go ahead and release, if you like :-) 

Thanks and kind regards
Graham
Comment 22 J.R. Oldroyd 2021-09-06 09:27:34 UTC
Created attachment 227705 [details]
patch to update port from 1.17 to 1.18

wifimgr-1.18.tar.xz 2021 Sep 06

        Change distribution format from .tar.bz2 to .tar.xz.
        When scanning networks, use greatest bars value for any_bssid networks (avoids associated network getting 0 bars and so not being included in default display).
        Limit length of ssid in display and truncate if needed using an ellipsis.
        Add support for multiple wlan interfaces:
            This involved significant recoding of several functions to loop through all active interfaces, or to take interface argument.
            Code to detect associated network also changed as there could be multiple associated networks.
            When added cloaked network, need to initialize associated flag. 
        Rework parser for /etc/rc.conf files to allow one pass through all files and also due to new support of multiple wlan interfaces.
        For gtk3, don't attach multiple widgets in one grid space. Use a box to add multiple widgets.
        Updated all .po files due to addition of new message.
        Rework Makefiles to have one Makefile per directory.
        Remove icons-wm dir and the icons in it:
            Replace with one icon in wifimgr icons dir.
            Update .desktop file to use icon from wifimgr icons dir.
            Remove calls to gtk-update-icon-cache(1) as no longer needed. 
        Add support for wlanN interfaces configured using NOAUTO in /etc/rc.conf.
Comment 23 Graham Perrin freebsd_committer freebsd_triage 2021-10-31 11:02:52 UTC
(In reply to Graham Perrin from comment #21)

> … a few more days of unusually heavy work commitments …

Those days became _weeks_ … sorry for not getting to this in good time.
Comment 24 commit-hook freebsd_committer freebsd_triage 2021-12-08 17:55:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e56ef1dfd2b3c08f00acb342e26019ebe0e3ab70

commit e56ef1dfd2b3c08f00acb342e26019ebe0e3ab70
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2021-12-08 17:54:32 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2021-12-08 17:54:32 +0000

    net-mgmt/wifimgr: the port had been updated to version 1.19

    PR:     257229, 259569

 net-mgmt/wifimgr/Makefile                 |  7 +++----
 net-mgmt/wifimgr/distinfo                 |  6 +++---
 net-mgmt/wifimgr/files/patch-src_Makefile | 16 ++--------------
 net-mgmt/wifimgr/pkg-descr                |  2 +-
 net-mgmt/wifimgr/pkg-plist                |  8 +-------
 5 files changed, 10 insertions(+), 29 deletions(-)