Hi Dan, Thank you very much for your answer. The best solution for me would be not to select any specific network and let the supplicant auto-select one for me. I tried a few approaches but did not observe auto-select so far. - If I don't select any network (not calling SelectNetwork) then networks Enabled property is false and no connection is performed. - I tried to call SelectNetwork with passing null as parameters (I use GDbusProxy) and got GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs - I tried to specify empty string as object (o), but GDbusProxy did not allow for that - I tried to specify "/" as object but got InvalidArgs error. >From code analysis it seems to me function wpas_dbus_handler_select_network do not allow empty network: if (iface == NULL || net_id == NULL || !wpa_s->dbus_new_path || os_strcmp(iface, wpa_s->dbus_new_path) != 0) { reply = wpas_dbus_error_invalid_args(message, op); goto out; } So far I implemented the following solution: - Create a few networks (addNetwork) with priority - Select a network with the highest priority (selectNetwork) - Enable all other networks by changing Enabled property of fi.w1.wpa_supplicant1.Network to true. Handling "priority" property works fine. In above solution I am a bit worried because function wpa_supplicant_select_network has a comment "Mark all other networks disabled or mark all networks enabled if no network specified", so I guess there might be some racing conditions. BR, Radek On Wed, Jun 21, 2017 at 5:40 PM, Dan Williams <dcbw@xxxxxxxxxx> wrote: > On Mon, 2017-06-12 at 23:14 +0200, Radoslaw Martyniszyn wrote: >> Hello, >> >> In my application I would like to connect to a predefined AP 1 >> (BSSID+SSID) or select any AP 2 with the same SSID in case default AP >> 1 >> disappears or I cannot connect to it. I believe that could be >> achieved >> by the following config: >> >> network={ >> ssid="theSameSSID" >> bssid=00:11:22:33:44:55 >> psk="theSamePSK" >> priority=1 >> } >> >> network={ >> ssid="theSameSSID" >> psk="theSamePSK" >> priority=0 >> } >> >> Could I use wpa_supplicant d-bus API to achieve above functionality? >> >> I think I could achieve above functionality creating two instances of >> network fi.w1.wpa_supplicant1.Interface.AddNetwork. Network1 would >> contain SSID, BSSID, priority=1 while Network2 would >> contain SSID, priority=0. Next I would call >> fi.w1.wpa_supplicant1.Interface.SelectNetwork on Network1. Does my >> plan make any sense? Should wpa_supplicant connect to Network2 >> automatically if there is no AP1? My initial test showed that >> wpa_supplicant do not connect to AP2 in case I turn off AP1, but I >> need to check that more deeply. > > Yes, this is how it works. You call AddNetwork and in response you > will get a unique D-Bus Object Path that represents the network. The > Object Path is what you pass to the SelectNetwork and that allows you > to uniquely specify the network even if they have the same SSID. > > If you do not select a specific network, the supplicant will auto- > select one for you. It should respect the "priority" property. But if > it's not, getting the "-dddt" output from the supplicant would be > useful. > > Dan _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap