]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Send CTRL-RSP command response before processing EAPOL update
authorJouni Malinen <j@w1.fi>
Sat, 19 Oct 2013 13:26:01 +0000 (16:26 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 19 Oct 2013 13:26:01 +0000 (16:26 +0300)
This is what the original implementation did years ago, but the move to
using separate control interface backends re-ordered the implementation
to process EAPOL notification first. Use a registered timeout to allow
the ctrl_iface response to be sent out first to get somewhat faster
response time and to avoid pending operations that could result in
ctrl_iface response and unsolicited event messages from getting mixed
up.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/ctrl_iface.c

index 7b3af28d0ce2f1312e7ebafbb63a3c9a7e8f58be..2dc64dda51f58fdb4620519c6cbd8bba3bb347f9 100644 (file)
@@ -5197,12 +5197,18 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
 }
 
 
+static void wpas_ctrl_eapol_response(void *eloop_ctx, void *timeout_ctx)
+{
+       struct wpa_supplicant *wpa_s = eloop_ctx;
+       eapol_sm_notify_ctrl_response(wpa_s->eapol);
+}
+
+
 char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                                         char *buf, size_t *resp_len)
 {
        char *reply;
        const int reply_size = 4096;
-       int ctrl_rsp = 0;
        int reply_len;
 
        if (os_strncmp(buf, WPA_CTRL_RSP, os_strlen(WPA_CTRL_RSP)) == 0 ||
@@ -5541,8 +5547,14 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                if (wpa_supplicant_ctrl_iface_ctrl_rsp(
                            wpa_s, buf + os_strlen(WPA_CTRL_RSP)))
                        reply_len = -1;
-               else
-                       ctrl_rsp = 1;
+               else {
+                       /*
+                        * Notify response from timeout to allow the control
+                        * interface response to be sent first.
+                        */
+                       eloop_register_timeout(0, 0, wpas_ctrl_eapol_response,
+                                              wpa_s, NULL);
+               }
        } else if (os_strcmp(buf, "RECONFIGURE") == 0) {
                if (wpa_supplicant_reload_configuration(wpa_s))
                        reply_len = -1;
@@ -5740,9 +5752,6 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                reply_len = 5;
        }
 
-       if (ctrl_rsp)
-               eapol_sm_notify_ctrl_response(wpa_s->eapol);
-
        *resp_len = reply_len;
        return reply;
 }