P2P: Avoid truncation of long listen operation due to offchan tx
[mech_eap.git] / wpa_supplicant / offchannel.c
index f4515e9..7a86347 100644 (file)
@@ -12,6 +12,7 @@
 #include "common.h"
 #include "utils/eloop.h"
 #include "wpa_supplicant_i.h"
+#include "p2p_supplicant.h"
 #include "driver_i.h"
 #include "offchannel.h"
 
@@ -30,8 +31,7 @@ wpas_get_tx_interface(struct wpa_supplicant *wpa_s, const u8 *src)
         */
        iface = wpa_s->global->ifaces;
        while (iface) {
-               if (os_memcmp(wpa_s->pending_action_src,
-                             iface->own_addr, ETH_ALEN) == 0)
+               if (os_memcmp(src, iface->own_addr, ETH_ALEN) == 0)
                        break;
                iface = iface->next;
        }
@@ -198,6 +198,14 @@ void offchannel_send_action_tx_status(
                        wpa_s->pending_action_bssid,
                        data, data_len, result);
        }
+
+#ifdef CONFIG_P2P
+       if (wpa_s->p2p_long_listen > 0) {
+               /* Continue the listen */
+               wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
+               wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
+       }
+#endif /* CONFIG_P2P */
 }
 
 
@@ -265,8 +273,7 @@ int offchannel_send_action(struct wpa_supplicant *wpa_s, unsigned int freq,
                struct wpa_supplicant *iface;
                int ret;
 
-               iface = wpas_get_tx_interface(wpa_s,
-                                             wpa_s->pending_action_src);
+               iface = wpas_get_tx_interface(wpa_s, src);
                wpa_s->action_tx_wait_time = wait_time;
 
                ret = wpa_drv_send_action(