[PATCH] Prevent explicit scan command during scan or association

Janusz Dziedzic janusz.dziedzic at gmail.com
Tue Apr 12 02:37:02 EDT 2011


2011/4/12 Dmitry Shmidt <dimitrysh at google.com>:
> On Mon, Apr 11, 2011 at 11:44 AM, Jouni Malinen <j at w1.fi> wrote:
>> On Fri, Apr 08, 2011 at 03:45:12PM -0700, Dmitry Shmidt wrote:
>>> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
>>> index 4f3f7e0..c48d1a7 100644
>>> @@ -3181,8 +3181,14 @@ char * wpa_supplicant_ctrl_iface_process(struct
>>> wpa_supplicant *wpa_s,
>>>               if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
>>>                       reply_len = -1;
>>>               else {
>>> -                     wpa_s->scan_req = 2;
>>> -                     wpa_supplicant_req_scan(wpa_s, 0, 0);
>>> +                     if (!wpa_s->scanning &&
>>> +                         ((wpa_s->wpa_state <= WPA_SCANNING) ||
>>> +                          (wpa_s->wpa_state == WPA_COMPLETED))) {
>>> +                             wpa_s->scan_req = 2;
>>> +                             wpa_supplicant_req_scan(wpa_s, 0, 0);
>>> +                     } else {
>>> +                             wpa_printf(MSG_ERROR, "Ongoing Scan action");
>>> +                     }
>>
>> Hmm.. This would still indicate success to the program that requested
>> the scan. That does not sound reasonable. At minimum, this would need to
>> return something like FAIL-BUSY instead of OK in the case that the
>> request was not accepted. It should also be noted that scan request can
>> be made over the D-Bus interface and it would probably be a good idea to
>> handle these in the same way with the ctrl_interface command.
>
> You are right, different status makes sense. Patch is attached.
> About d-bus - I hope somebody that can test it can do this similar patch.
>
>>

Hello

I have question connected with wpa->scanning flag.
When we disable wlan interface and we are not connected to network (no
active connection):
Example:
- scan
- ifconfig wlan0 down (before scan_res)

If driver will not return scan_res (I am not sure if should or should
not after ifconfig wlan0 down).
Next after ifconfig wlan0 up we will have problems with scan command.
- scan - will be not work because of wpa->scanning.

So, maybe we should add:

	case EVENT_INTERFACE_DISABLED:
		wpa_dbg(wpa_s, MSG_DEBUG, "Interface was disabled");
		wpa_supplicant_mark_disassoc(wpa_s);
		wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
              +wpa_supplicant_notify_scanning(wpa_s, 0);
		break;

BR
Janusz


-- 
Janusz Dziedzic


More information about the HostAP mailing list