Hi Bruno That behaviour has been fixed in -current, so should be in the upcoming 6.5 release.
As a workaround for 6.4, you can set a network with "nwid" at the top of the file, then the join commands. That won't be necessary with 6.5, of course. -peter On 2019 Mar 01 (Fri) at 12:13:06 -0500 (-0500), Bruno Dantas wrote: :>Synopsis: after booting, laptop connects to neighbor's open wifi :hotspot, which is not listed in my /etc/hostname.if : :>Category: not sure, sorry (networking?) : :>Environment: : System : OpenBSD 6.4 : Details : OpenBSD 6.4 (GENERIC.MP) #6: Sat Jan 26 20:37:44 CET 2019 : :[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP : : Architecture: OpenBSD.amd64 : Machine : amd64 : :>Description: : I use /etc/hostname.if to automatically connect to wifi when I boot :my Thinkpad laptop. When at home, I'm within range of several neighbors' :hotspots, one of which does not have a password. My laptop sometimes :joins that neighbor's hotspot during boot, even though his ssid is not :in my /etc/hostname.athn0. : : Here are the contents of my /etc/hostname.athn0: : :!sh /home/bruno/bin/mac-generator :!ifconfig \$if lladdr $(cat /home/bruno/.fakemac) :!ifconfig \$if mode 11g : :join bibliotheca_alexandrina wpakey somePassWorD :join AndroidAP-bd wpakey soMepaSSwoRd :join ARMCVisitor :dhcp : : Here is the output of 'ifconfig athn0 joinlist': : :bruno@thinkpad:~391$ ifconfig athn0 joinlist :athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 : lladdr 00:26:b6:eb:9d:23 : index 2 priority 4 llprio 3 : groups: wlan egress : media: IEEE802.11 autoselect mode 11g (OFDM18 mode 11g) : status: active : ieee80211: join ARMCVisitor chan 1 bssid 00:e1:6d:63:57:45 -40dBm : join: bibliotheca_alexandrina : AndroidAP-bd : ARMCVisitor : inet 10.1.72.144 netmask 0xffffe000 broadcast 10.1.95.255 : : Neighbor's hotspot is named "xfinity". When I find that I'm :connected to his network after booting, I get this (yes, it shows "nwid"): : :bruno@thinkpad:~391$ ifconfig athn0 joinlist :athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 : ... : ieee80211: nwid xfinity ... : :>How-To-Repeat: :Reboot several times until the problem recurs. : :>Fix: :If I find that I'm connected to neighbor's wifi after a reboot, running :# sh /etc/netstart athn0 fixes the problem (i.e., after the command, :output of ifconfig athn0 shows "ieee80211: join bibliotheca_alexandrina" :as expected). -- The best book on programming for the layman is "Alice in Wonderland"; but that's because it's the best book on anything for the layman.
