OpenBSD Journal

OpenBSD gains Wi-Fi "auto-join"

Contributed by rueda on from the puffy-on-the-go dept.

In a change which is bound to be welcomed widely, -current has gained "auto-join" for Wi-Fi networks. Peter Hessler (phessler@) has been working on this for quite some time and he wrote about it in his p2k18 hackathon report. He has committed the work from the g2k18 hackathon in Ljubljana:

CVSROOT:	/cvs
Module name:	src
Changes by:	phessler@cvs.openbsd.org	2018/07/11 14:18:09

Modified files:
	sbin/ifconfig  : ifconfig.8 ifconfig.c 
	sys/net80211   : ieee80211_ioctl.c ieee80211_ioctl.h 
	                 ieee80211_node.c ieee80211_node.h 
	                 ieee80211_var.h 

Log message:
Introduce 'auto-join' to the wifi 802.11 stack.

This allows a system to remember which ESSIDs it wants to connect to, any
relevant security configuration, and switch to it when the network we are
currently connected to is no longer available.
Works when connecting and switching between WPA2/WPA1/WEP/clear encryptions.

example hostname.if:
join home wpakey password
join work wpakey mekmitasdigoat
join open-lounge
join cafe wpakey cafe2018
join "wepnetwork" nwkey "12345"
dhcp
inet6 autoconf
up

OK stsp@ reyk@
and enthusiasm from every hackroom I've been in for the last 3 years

The usage should be clear from the commit message, but basically you 'join' all the networks you want to auto-join as you would previously use 'nwid' to connect to one specific network. Then the kernel will join the network that's actually in range and do the rest automagically for you. When you move out of range of that network you lose connectivity until you come in range of the original (where things will continue to work as you've been used to) or one of the other networks (where you will associate and then get a new lease).

Thanks to Peter for working on this feature - something many a Wi-Fi using OpenBSD user will be able to benefit from.

(Comments are closed)


Comments
  1. By rjc (rjc) on

    Is there an easy way to have a number of Wi-Fi networks specified, like in the example, and add wpa_supplicant into the mix for eduroam - as in "all in a single hostname.if" file?

    Comments
    1. By phessler (phessler) spambox@theapt.org on http://www.openbsdfoundation.org/donations.html

      Yes, you can add dot1x configurations to hostname.if, and auto-join will connect to them when they are available.

      However, wpa_supplicant won't automatically connect to it. I've been told 'wpa_cli reassociate' will do the right thing, but I am not in a position to test that.

      Making dot1x easier to deal with is on my TODO list for a project for the future.

      Comments
      1. By rjc (rjc) on

        Thanks for a prompt reply Peter.

        It would be great if there was something along the lines of:

        join eduroam wpaakms 802.1x exec /path/to/script

        or whatever work :^)

  2. By Renaud Allard (renaud) renaud@allard.it on

    Nice work.
    If 2 listed networks are available, will it connect to the first listed one or randomly?

    Comments
    1. By phessler (phessler) spambox@theapt.org on http://www.openbsdfoundation.org/donations.html

      It basically uses the Apple algorithm that is used on iPhones. As long the signal strength is good enough: Strongest security, then 5GHz, then 11n vs not-n, then pure signal strength.

      You can also force it to choose a different one with "nwid foo". The auto-join algorithm will take the saved security settings for "foo" and apply them when it attempts to connect.

  3. By anexit (anexit) bannereddivpool@gmail.com on

    This will be so handy! Awesome work Peter.

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]