[PATCH] WPS: make wps pin connection work with wpa_cli command

abdoulaye berthe berthe.ab
Thu Dec 18 11:27:44 PST 2014

Well, I am using the following command on android 5.0
wpa_cli -p /data/misc/wifi/sockets/ -i wlan0 wps_pbc any
wpa_cli -p /data/misc/wifi/sockets/ -i wlan0 wps_pin any 12345670

The device does not get connected.
wpa_s->scan_res_handler is set to scan_only_handler() that is why
network selection is not triggered.The handler is set to
scan_only_handler() in wpas_ctrl_scan by default.

The connection is not established unless
is executed
the link above is line 1377 in the same function: return
wpas_select_network_from_last_scan(wpa_s, 1, own_request);

The idea of the patch is to avoid calling the scan_only_handler() when
wps_searching is true.


On Sun, Dec 14, 2014 at 5:14 PM, Jouni Malinen <j at w1.fi> wrote:
> On Thu, Nov 27, 2014 at 05:28:35PM +0100, Abdoulaye Berthe wrote:
>> Network selection is not performed for all scan results
>> making wps pin fail for command line connection attempts.
>> This enables network selection if wpas_wps_searching is true.
> Could you please describe the exact sequence of wpa_cli commands that do
> not work? This cannot be in any way specific to wpa_cli, so I'd assume
> this is identifying some kind of issue with the wpa_supplicant control
> interface used for WPS PIN connection. However, such use cases work fine
> in my tests, so I'm not sure I understood what this is trying to fix.
>> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
>> @@ -1275,7 +1275,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
>> -     if (own_request && wpa_s->scan_res_handler &&
>> +     if (!wpas_wps_searching(wpa_s) && own_request && wpa_s->scan_res_handler &&
>>           (wpa_s->own_scan_running || !wpa_s->external_scan_running)) {
>>               void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
>>                                        struct wpa_scan_results *scan_res);
> This would skip use of the registered wpa_s->scan_res_handler during WPS
> operation. While that may be reasonable for most cases, I'd like to
> understand what wpa_s->scan_res_handler was set to in the case that you
> are addressing.
> --
> Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list