NIL=> https://bsd.network/@solenepercent/106704700824214413 Comment on Mastodon
This is a short text to introduce you about an OpenBSD feature arrived in 2018 and that may not be known by everyone. Wifi interfaces can have a list of network and their associated passphrase to automatically connect when network is known.
phessler@ hackathon report including wifi join feature
The relevant configuration information is in the ifconfig man page, look for "WIRELESS DEVICES" and check the "join" keyword.
OpenBSD ifconfig man page anchored on the join keyword
OpenBSD FAQ about wireless LAN
Basically, in your /etc/hostname.if file (if being replaced by the interface name like iwm0, athn0 etc...), list every access point you know and their according password.
join android_hotspot wpakey t00345Y4Y0U join my-home wpakey goodbyekitty join friends1 wpakey ilikeb33r5 join favorite-bar-hotspot
This will make the wifi interface to try to connect to the first declared network in the file if multiples access points are available. You can temporarily remove a hotspot from the list using "ifconfig iwm0 -join android_hotspot" if you don't want to connect to it.