diff mbox

[1/1] P2P: Prevent pending_action_tx from truncating extended listen

Message ID CAGCGobA5UPQhPQVHE4ObSfDGH+nZhhPAVoq4sSwJqk=5C67c5w@mail.gmail.com
State Accepted
Headers show

Commit Message

Jithu Jance Aug. 20, 2014, 4:46 p.m. UTC
Hi Jouni,

I overlooked a compilation failure for the previous patch after
merging to the local repo (compiled without enabling CONFIG_P2P).
Please find the corrected patch attached inline as well as attached. I
am facing white space issue in copy-pasting the patch in-line. Is
there any work around for the white space issue? I am using gmail in
plain-text mode.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
---
 wpa_supplicant/offchannel.c     | 7 +++++++
 wpa_supplicant/p2p_supplicant.c | 6 +++---
 wpa_supplicant/p2p_supplicant.h | 2 ++
 3 files changed, 12 insertions(+), 3 deletions(-)

 void wpas_p2p_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ies);

Comments

Jouni Malinen Dec. 18, 2014, 2:46 p.m. UTC | #1
On Wed, Aug 20, 2014 at 10:16:49PM +0530, Jithu Jance wrote:
> I overlooked a compilation failure for the previous patch after
> merging to the local repo (compiled without enabling CONFIG_P2P).
> Please find the corrected patch attached inline as well as attached. I
> am facing white space issue in copy-pasting the patch in-line. Is
> there any work around for the white space issue? I am using gmail in
> plain-text mode.

The version here was still having issues with CONFIG_P2P disabled. I
fixed that by adding #ifdef CONFIG_P2P around the offchannel.c addition.

This change brought up some issues with a hwsim regression test case as
well, but that turned out to be an issue with the test case and not
really an issue with the changes here. I applied this now.
Jithu Jance Dec. 18, 2014, 3:17 p.m. UTC | #2
> The version here was still having issues with CONFIG_P2P disabled. I
> fixed that by adding #ifdef CONFIG_P2P around the offchannel.c addition.
>
> This change brought up some issues with a hwsim regression test case as
> well, but that turned out to be an issue with the test case and not
> really an issue with the changes here. I applied this now.
>
Thanks Jouni!
diff mbox

Patch

diff --git a/wpa_supplicant/offchannel.c b/wpa_supplicant/offchannel.c
index 77683b6..17689c5 100644
--- a/wpa_supplicant/offchannel.c
+++ b/wpa_supplicant/offchannel.c
@@ -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"

@@ -188,6 +189,12 @@  void offchannel_send_action_tx_status(
  wpa_s->pending_action_bssid,
  data, data_len, result);
  }
+
+ 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);
+ }
 }


diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index d91877c..3a30b1c 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4925,7 +4925,7 @@  void wpas_p2p_remain_on_channel_cb(struct
wpa_supplicant *wpa_s,
 }


-static int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s,
+int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s,
  unsigned int timeout)
 {
  /* Limit maximum Listen state time based on driver limitation. */
@@ -4954,12 +4954,12 @@  void
wpas_p2p_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
  wpas_p2p_listen_work_done(wpa_s);
  if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
  return;
+ if (wpa_s->p2p_long_listen > 0)
+ wpa_s->p2p_long_listen -= wpa_s->max_remain_on_chan;
  if (p2p_listen_end(wpa_s->global->p2p, freq) > 0)
  return; /* P2P module started a new operation */
  if (offchannel_pending_action_tx(wpa_s))
  return;
- if (wpa_s->p2p_long_listen > 0)
- wpa_s->p2p_long_listen -= wpa_s->max_remain_on_chan;
  if (wpa_s->p2p_long_listen > 0) {
  wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
  wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h
index 841d6df..a75c467 100644
--- a/wpa_supplicant/p2p_supplicant.h
+++ b/wpa_supplicant/p2p_supplicant.h
@@ -58,6 +58,8 @@  int wpas_p2p_find(struct wpa_supplicant *wpa_s,
unsigned int timeout,
   const u8 *dev_id, unsigned int search_delay);
 void wpas_p2p_stop_find(struct wpa_supplicant *wpa_s);
 int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout);
+int wpas_p2p_listen_start(struct wpa_supplicant *wpa_s,
+ unsigned int timeout);
 int wpas_p2p_assoc_req_ie(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
   u8 *buf, size_t len, int p2p_group);