> Synopsis: The channel remains the same (switching between 802.11 networks)
> Category: Networking sys/net80211 sbin/ifconfig
> Environment:
System : OpenBSD 6.4
> Description:
When switching between 802.11 networks the channel (if set) remains the same.
Tested on iwn*, but not other drivers
> How-To-Repeat:
Consider an /etc/hostname.if
join Net1 chan 1
join Net2 chan 2
When the switch occurs from Net2 to Net1, the nwid is set to Net1 but the
channel remains set to 2. Therefore the system cannot connect to Net1.
> Fix:
I imagine best practice is to not to set a channel if using join in
/etc/hostname.if. However, I have a use case where I wanted to join a
particular AP by its channel.
If you want to address this, one idea is that in ieee80211_node.c's function
ieee80211_set_ess() could set the channel to the channel obtained and scored in
the ieee80211_???_scan(). Or, it could set the channel to IEEE80211_CHAN_ANY.
Or perhaps it could call some of the clever channel logic already in the code
to determine what the channel ought be set considering band, mode, etc.
For consideration, perhaps there are other settings (e.g. -autoconf ) which
could be set in /etc/hostname.if which maybe should be auto-unset in
ieee80211_set_ess()?
Another consideration, by design ifconfig(8) retains settings unless explicitly
unset, for example:
ifconfig if0 nwid Net1 chan 1
ifconfig if0 nwid Net2
At the second command the channel will remain chan 1. Perhaps unsetting the
channel when the nwid changes would be desired. Or are there good reasons for
'-chan' to be explicit and required?