[PATCH] Provision discovery to be sent to GO operating freq Signed-off-by: root <root at neeraj-ubuntu64.(none)>

root none root
Thu Oct 20 23:03:52 PDT 2011

 src/p2p/p2p.c    |    4 +++-
 src/p2p/p2p_pd.c |    6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 src/p2p/p2p.c
 mode change 100644 => 100755 src/p2p/p2p_pd.c

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
old mode 100644
new mode 100755
index 259f854..36d69d3
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -574,8 +574,10 @@ int p2p_add_device(struct p2p_data *p2p, const u8
*addr, int freq, int level,
  freq, msg.ds_params ? *msg.ds_params : -1);
  dev->listen_freq = freq;
- if (msg.group_info)
+ if (msg.group_info) {
  dev->oper_freq = freq;
+ dev->go_state = REMOTE_GO;
+ }
  dev->info.level = level;

  p2p_copy_wps_info(dev, 0, &msg);
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
old mode 100644
new mode 100755
index f7ff06c..d8758c9
--- a/src/p2p/p2p_pd.c
+++ b/src/p2p/p2p_pd.c
@@ -283,8 +283,10 @@ int p2p_send_prov_disc_req(struct p2p_data *p2p, struct
p2p_device *dev,
  struct wpabuf *req;
  int freq;
- freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
+ if (dev->go_state == REMOTE_GO)
+ freq = dev->oper_freq;
+ else
+ freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
  if (freq <= 0) {
  wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
  "P2P: No Listen/Operating frequency known for the "

-Neeraj Garg

Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello,<div>In some occurrences, when listen_freq and the final operating fr=
equency of the GO are different, then the current supplicant code in p2p_pd=
.c ends up sending provision discovery request frame to the listen frequenc=
y. Since GO is no longer listening on listen_freq (it has moved to oper cha=
nnel), frame doesn't get received by GO.=A0</div>
<div>Supplicant code in p2p.c update the listen_freq and the operating freq=
uency both in the add_device context. But at the time of sending the provis=
ion discovery, it checks if listen_freq is 0 or not.</div><div>I have creat=
ed a patch for this problem. In the add_device context, we will update the =
go_state as REMOTE_GO.</div>
<div><br></div><div>Please see the patch and let me know if it is good to a=
pply.</div><div><br></div><div><div>From acb5cbe76b022b94077469ad9bf382ae31=
c10332 Mon Sep 17 00:00:00 2001</div><div>From: root <root at neeraj-ubuntu=
<div>Date: Fri, 21 Oct 2011 11:33:52 +0530</div><div>Subject: [PATCH] Provi=
sion discovery to be sent to GO operating freq</div><div>=A0Signed-off-by: =
root <root at neeraj-ubuntu64.(none)></div><div><br></div><div>---</div>
<div>=A0src/p2p/p2p.c =A0 =A0| =A0 =A04 +++-</div><div>=A0src/p2p/p2p_pd.c =
| =A0 =A06 ++++--</div><div>=A02 files changed, 7 insertions(+), 3 deletion=
s(-)</div><div>=A0mode change 100644 =3D> 100755 src/p2p/p2p.c</div><div=
>=A0mode change 100644 =3D> 100755 src/p2p/p2p_pd.c</div>
<div><br></div><div>diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c</div><div>ol=
d mode 100644</div><div>new mode 100755</div><div>index 259f854..36d69d3</d=
iv><div>--- a/src/p2p/p2p.c</div><div>+++ b/src/p2p/p2p.c</div><div>@@ -574=
,8 +574,10 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int =
freq, int level,</div>
<div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>=
freq, msg.ds_params ? *msg.ds_params : -1);</div><div>=A0<span class=3D"App=
le-tab-span" style=3D"white-space:pre">	</span>}</div><div>=A0<span class=
=3D"Apple-tab-span" style=3D"white-space:pre">	</span>dev->listen_freq =
=3D freq;</div>
<div>-<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>if (=
msg.group_info)</div><div>+<span class=3D"Apple-tab-span" style=3D"white-sp=
ace:pre">	</span>if (msg.group_info) {</div><div>=A0<span class=3D"Apple-ta=
b-span" style=3D"white-space:pre">		</span>dev->oper_freq =3D freq;</div=
<div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">		</span>dev=
->go_state =3D REMOTE_GO;</div><div>+<span class=3D"Apple-tab-span" styl=
e=3D"white-space:pre">	</span>}</div><div>=A0<span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span>dev->info.level =3D level;</div>
<div>=A0</div><div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:p=
re">	</span>p2p_copy_wps_info(dev, 0, &msg);</div><div>diff --git a/src=
/p2p/p2p_pd.c b/src/p2p/p2p_pd.c</div><div>old mode 100644</div><div>new mo=
de 100755</div>
<div>index f7ff06c..d8758c9</div><div>--- a/src/p2p/p2p_pd.c</div><div>+++ =
b/src/p2p/p2p_pd.c</div><div>@@ -283,8 +283,10 @@ int p2p_send_prov_disc_re=
q(struct p2p_data *p2p, struct p2p_device *dev,</div><div>=A0{</div><div>
=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>struct =
wpabuf *req;</div><div>=A0<span class=3D"Apple-tab-span" style=3D"white-spa=
ce:pre">	</span>int freq;</div><div>-</div><div>-<span class=3D"Apple-tab-s=
pan" style=3D"white-space:pre">	</span>freq =3D dev->listen_freq > 0 =
? dev->listen_freq : dev->oper_freq;</div>
<div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>if (=
dev->go_state =3D=3D REMOTE_GO)</div><div>+<span class=3D"Apple-tab-span=
" style=3D"white-space:pre">		</span>freq =3D dev->oper_freq;</div><div>=
+<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>else</div=
<div>+<span class=3D"Apple-tab-span" style=3D"white-space:pre">		</span>fre=
q =3D dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;=
</div><div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</s=
pan>if (freq <=3D 0) {</div>
<div>=A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">		</span>w=
pa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,</div><div>=A0<span class=3D"Appl=
e-tab-span" style=3D"white-space:pre">			</span>"P2P: No Listen/Operat=
ing frequency known for the "</div>
div>-Neeraj Garg</div>


More information about the Hostap mailing list