Page 1 of 1

Add support for the "priority=" field in wpa_supplicant.conf

Posted: Wed May 05, 2021 12:28 pm
by ke8dpf
The pi-star web interface presently does not support the wpa_supplicant.conf "priority" field, and it really should.

Many users configure both their mobile phone, and their home wifi router, as wifi access points, in the wpa_supplicant file. A few of us (such as myself) have even more entries than that.

The problem comes when multiple configured access points are within range. According to the man page for the wpa_supplicant.conf file, when multiple configured access points are available at the same time and are equally weighted in the context of the file, factors other than simply the order in which they appear in the file (such as signal strength and security characteristics) will determine which one the hotspot latches on to, making any advanced "knowing" of where you'll end up connected, a crap-shoot.

Additionally, it is difficult to manually add the "priority=" field to a stanza in the web GUI's "expert - wifi" text editor, as a "TAB" key does not insert a tab character, it merely moves the browser's "focus" out of the text entry area of the page, and down to the "Apply changes" button at the bottom of the screen. This leaves either an SSH client (such as PuTTY), or the "ShellInABox" SSH client, as the only means of directly editing the file (both of which require you to remount the rootfs as RW before you can actually edit the file manually, and then remounting it RO again (or rebooting.)

It would be far better, easier, safer, and less error prone, for the GUI to add support for the "priority=" field in each wpa_supplicant.conf stanza. Connecting to one of multiple configured and available networks should not be a crap-shoot based on characteristics outside of the user's control. If I'm in a place where multiple such networks are present, configured, and available, I want to *know* where my unit will connect. Not leave it to chance or other factors I can't control.

Re: Add support for the "priority=" field in wpa_supplicant.conf

Posted: Thu May 06, 2021 3:05 pm
by ke8dpf
The problems are these:

If no "priority" field is listed, simple order of stanzas within the file is no guarantee that the correct/desired/intended network will be the one actually chosen by the selection algorithm (which is not controllable via pistar). Other factors outside of the user's control (and outside of simple order in the file) can come into play. Signal strength, security mechanisms, and so on, can, at times, override mere order in the file.

The "priority=" field allows the user to dictate, with concrete predictability, which network the system will select, when in the presence of multiple, otherwise equally (non)-prioritized networks, regardless of their order in the file.

Those who oppose the use of the priority feature and declare it unnecessary tend to be folks who have never encountered the need, in their own specific use case. But to assume that such functionality isn't needed simply because they themselves don't need it, is naive.

Re: Add support for the "priority=" field in wpa_supplicant.conf

Posted: Thu May 06, 2021 3:21 pm
by ke8dpf
Consider the following snippets from the man pages...

This first is what everyone thinks of when they assert that order in the file is the be-all/end-all solution...

NETWORK BLOCKS
Each potential network/access point should have a "network block" that
describes how to identify it and how to set up security. When multiple
network blocks are listed in a configuration file, the highest priority
one is selected for use or, if multiple networks with the same priority
are identified, the first one listed in the configuration file is used.


But no one seems to be aware of, consider valid, or chooses to ignore, the assertion immediately preceding that...

NETWORK BLOCKS
Each potential network/access point should have a "network block" that
describes how to identify it and how to set up security. When multiple
network blocks are listed in a configuration file, the highest priority
one is selected for use or
,
if multiple networks with the same priority
are identified, the first one listed in the configuration file is used.

And then there's (from the same documentation)...

priority
The priority of a network when selecting among multiple networks;
a higher value means a network is more desirable. By default
networks have priority 0. When multiple networks with the same
priority are considered for selection, other information such as
security policy and signal strength are used to select one
.