From helmut.schaa  Thu Sep  1 00:00:00 2011
From: helmut.schaa (Helmut Schaa)
Date: Thu, 1 Sep 2011 09:00:00 +0200
Subject: Michael MIC Failure Report with CCMP?
Message-ID: <CAGXE3d_2xYFN4GVawkRbe0tbYRJEc2v+PmdFL+7xfQX9fkH0dg@mail.gmail.com>

On Fri, Aug 26, 2011 at 5:27 PM, Helmut Schaa
<helmut.schaa at googlemail.com> wrote:
> I've got a client connected to hostapd that is sending a Michael MIC
> Failure Report to a CCMP-only AP after the group key handshake:

JFI the client in question is an Axis 207MW webcam [1].
Helmut

[1] http://www.axis.com/de/products/cam_207mw/


From janusz.dziedzic  Thu Sep  1 01:00:34 2011
From: janusz.dziedzic (Janusz Dziedzic)
Date: Thu, 1 Sep 2011 10:00:34 +0200
Subject: [RFC] p2p: disable 11b rates on p2p interface creation
In-Reply-To: <20110829175601.GA6012@vmraj-lnx.users.atheros.com>
References: <1313522960-11775-1-git-send-email-rmanohar@qca.qualcomm.com>
	<20110829175601.GA6012@vmraj-lnx.users.atheros.com>
Message-ID: <CAFED-jk_F92XEdt1yzrox_eg6aOvDV5BvgLpLna1vNZxYMRPoA@mail.gmail.com>

2011/8/29 Rajkumar Manoharan <rmanohar at qca.qualcomm.com>:
> On Wed, Aug 17, 2011 at 12:59:20AM +0530, Rajkumar Manoharan wrote:
>> 11b rates are disabled blindly during p2p init based on driver
>> capability. This prevents use of CCK rates when no p2p vif
>> is present. This patch disables 11b rates while creating p2p
>> interface.
>>
>> Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
>> ---
>> ?src/drivers/driver.h ? ? ? ? ? ?| ? ?4 ++--
>> ?src/drivers/driver_nl80211.c ? ?| ? 17 ++++++++++++-----
>> ?wpa_supplicant/driver_i.h ? ? ? | ? ?6 ++----
>> ?wpa_supplicant/p2p_supplicant.c | ? ?5 +----
>> ?4 files changed, 17 insertions(+), 15 deletions(-)
>>
> Any comments are welcome.
>

Hello,
What with p2p_find - we should not use B-rates there - before connection.
Does you patch cover this case also?

BR
Janusz


From johannes  Thu Sep  1 05:15:38 2011
From: johannes (Johannes Berg)
Date: Thu, 01 Sep 2011 14:15:38 +0200
Subject: [RFC] p2p: disable 11b rates on p2p interface creation
In-Reply-To: <CAFED-jk_F92XEdt1yzrox_eg6aOvDV5BvgLpLna1vNZxYMRPoA@mail.gmail.com>
References: <1313522960-11775-1-git-send-email-rmanohar@qca.qualcomm.com>
	<20110829175601.GA6012@vmraj-lnx.users.atheros.com>
	<CAFED-jk_F92XEdt1yzrox_eg6aOvDV5BvgLpLna1vNZxYMRPoA@mail.gmail.com>
Message-ID: <1314879338.4022.0.camel@jlt3.sipsolutions.net>

On Thu, 2011-09-01 at 10:00 +0200, Janusz Dziedzic wrote:
> 2011/8/29 Rajkumar Manoharan <rmanohar at qca.qualcomm.com>:
> > On Wed, Aug 17, 2011 at 12:59:20AM +0530, Rajkumar Manoharan wrote:
> >> 11b rates are disabled blindly during p2p init based on driver
> >> capability. This prevents use of CCK rates when no p2p vif
> >> is present. This patch disables 11b rates while creating p2p
> >> interface.
> >>
> >> Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
> >> ---
> >>  src/drivers/driver.h            |    4 ++--
> >>  src/drivers/driver_nl80211.c    |   17 ++++++++++++-----
> >>  wpa_supplicant/driver_i.h       |    6 ++----
> >>  wpa_supplicant/p2p_supplicant.c |    5 +----
> >>  4 files changed, 17 insertions(+), 15 deletions(-)
> >>
> > Any comments are welcome.
> >
> 
> Hello,
> What with p2p_find - we should not use B-rates there - before connection.
> Does you patch cover this case also?

No, that still needs work on the scanning settings stuff.

johannes



From matt.causey  Thu Sep  1 05:40:13 2011
From: matt.causey (Matt Causey)
Date: Thu, 1 Sep 2011 08:40:13 -0400
Subject: wpa_supplicant roaming question
In-Reply-To: <CAFED-j=L+n=U46qF=_C9PzNfAGp6C-XkCc5By0mRDQrEdzt-=Q@mail.gmail.com>
References: <CAGnc4p_ARaE0Fd9uSjg2O8Ni+1CWoUhtYxz4BEMdb9dqO3u3EQ@mail.gmail.com>
	<CAFED-jk6AFE3bo0O3M5b96=ppSPYMNGVGLVyPJyqX+Y5Y8uwKw@mail.gmail.com>
	<CAGnc4p-VJPYHkFnWkDPZ4sQ32HXTT8-dxMfMeDLLPfM4P9-ujw@mail.gmail.com>
	<CAFED-j=L+n=U46qF=_C9PzNfAGp6C-XkCc5By0mRDQrEdzt-=Q@mail.gmail.com>
Message-ID: <CAGnc4p88THHdGBX58G_8PNM1ZJ7jNs-+5kQpfEBw26ebaGpuyg@mail.gmail.com>

On Thu, Sep 1, 2011 at 1:17 AM, Janusz Dziedzic
<janusz.dziedzic at gmail.com> wrote:
> 2011/8/31 Matt Causey <matt.causey at gmail.com>:
>> Ha! ?Yeah that's pretty lame on my part. ?I was convinced that I'd
>> configured the supplicant properly at compile time, but alas I was
>> wrong. ?I went back and re-compiled and now it works as expected. ?:-)
>>
>> I have another question now...I notice that if the supplicant
>> processes a disassociation or deauth, we call
>> wpa_supplicant_event_disassoc() (in blacklist.c), which then adds that
>> BSSID to a blacklist. ?Then, the supplicant can no longer roam to that
>> BSSID, even if it is a better choice.
>>
>> In our use case, we have a large number of access points and they can
>> drop offline for maintenance periodically. ?What would folks recommend
>> we do to keep these BSSID's from becoming permanently blacklisted just
>> because they needed to reboot?
>>
>
> Seems this is true. Blacklist will be cleared if "No APs found".
>
> In case of our implementation we don't hit this problem. We have
> additional CQM signal - beacon_miss - from our driver (nl80211). Count
> of beacon_miss is configurable from supplicant when bgscan starts. Our
> firmware support this beacon_miss detection - so, it is usefull - we
> can roam before deauthenitcation in case someone will switch off AP or
> we loose connection.
> I think we will push this CQM cfg80211/nl80211 compat-wireless +
> hostap implementation soon.
>
> So, in case someone will switch off AP, before we will get
> deauthentication we get this beacon_miss event and we have chance to
> roam to another APs. If there isn't another APs blacklist will be
> cleared because of "No APs found".
>

Interesting.  So you have events that get processed before a deauth
happens.  Even with that, it is only a matter of time before your
client receives a deauth for some other reason that does not correlate
with a missed beacon, and then you will be vulnerable to the same
issue.

This functionality as it stands is a show-stopper for us so I've
commented out the call to wpa_blacklist_add()
(http://hostap.epitest.fi/wpa_supplicant/devel/blacklist_8c.html#af59c8fe6b0bef5b49f433bd06b29e9ab).
 I kind of wish that we could at least configure this behavior because
it's pretty broken currently.  I can see the rationale...the idea is
that if a BSSID is impaired in some way, but is the strongest BSSID
for a network, then clients will go there and have a bad experience.
Unfortunately I think that the heuristic needs more work.

Now, it may be that I can get ath9k to produce similar events that
prevent the supplicant from processing the deauth, thus preventing the
bug in the same way you are.  Where in the driver would one typically
look to see what, if any, 80211 events are supported?

Cheers,

--
Matt


>
> BR
> Janusz
>


From johannes  Thu Sep  1 06:10:27 2011
From: johannes (Johannes Berg)
Date: Thu, 01 Sep 2011 15:10:27 +0200
Subject: future wpa_s/hostapd release plans
Message-ID: <1314882627.4022.17.camel@jlt3.sipsolutions.net>

Hi all,

For those who were at the summit -- this is mostly an announcement for
what we discussed there. I may have gotten things wrong, so please
comment and let's hammer this out, then later when we've agreed on "the
plan" I suggest things end up on the website.

For those who weren't at the summit -- in a nutshell: a lot more people
are starting to rely on upstream releases so we need to have more
predictability in the releases. Also, Jouni's overloaded as is, and
really needs help :-)


So the plan is roughly this:

Every 6 months, the current hostap.git repository forks into a new
hostap-x.y.git repository. This repository will be maintained by
different community members, we've volunteered for the first one and TI
indicated they'd be willing to help with the second one.

The hostap-x.y.git repository will be on w1.fi (for all intents and
purposes, the technical implementation may require whoever maintains it
to have their own version somewhere and git synchronising things).

After the fork, a stabilisation period begins, concluding with the
release of "x.y.0" after about 4-8 weeks. This may involve multiple RCs,
e.g. "x.y.0-rc1" per the discretion of the maintainer.

Each one of these stable releases will be maintained for at least a
year, so whoever commits to maintenance will commit to maintaining that
tree for a year from the .0 release.

As far as patch flow goes, for the first 6 months the current stable
tree ("x.y") will have fixes flowing from the development tree into it,
this may require re-writing fixes of course. After 6 months, this
becomes "oldstable" and then only picks up patches from the new "stable"
tree (x.y+1), after another 6 months it is either abandoned or maybe
continues to be maintained for really critical fixes. This patch flow
ensures that fixes are vetted appropriately and the stable trees never
have anything that isn't in the development tree.

Oh, and because this is a change, Jouni proposed calling the first one
that will come out of this "1.0" (first release 1.0.0), followed by
"1.1". (or did you mean 1.0 being the first release, followed by 2.0,
and fixes as 1.1, 1.2, ...?)

That's all. Essentially, the maintenance of the stable and oldstable
branches will be taken off Jouni's shoulder and be more predictable.



Now -- the bad parts:

First of all, when will the first branch happen? I'm not sure -- we need
to put infrastructure in place on our side to make it happen and
familiarise ourselves with the release scripts etc., so that might take
a little while. I'm thinking maybe some time in November, and then the
next ones can be in May 2012, November 2012 etc.

Secondly, we don't have a fully functional test bed, so when/how do we
call what branched as 1.0 actually release-worthy? Jouni -- what's your
process there? Just "generally I'm happy"?

That's all, please comment :-)

johannes



From janusz.dziedzic  Thu Sep  1 12:53:39 2011
From: janusz.dziedzic (Janusz Dziedzic)
Date: Thu, 1 Sep 2011 21:53:39 +0200
Subject: wpa_supplicant roaming question
In-Reply-To: <CAGnc4p88THHdGBX58G_8PNM1ZJ7jNs-+5kQpfEBw26ebaGpuyg@mail.gmail.com>
References: <CAGnc4p_ARaE0Fd9uSjg2O8Ni+1CWoUhtYxz4BEMdb9dqO3u3EQ@mail.gmail.com>
	<CAFED-jk6AFE3bo0O3M5b96=ppSPYMNGVGLVyPJyqX+Y5Y8uwKw@mail.gmail.com>
	<CAGnc4p-VJPYHkFnWkDPZ4sQ32HXTT8-dxMfMeDLLPfM4P9-ujw@mail.gmail.com>
	<CAFED-j=L+n=U46qF=_C9PzNfAGp6C-XkCc5By0mRDQrEdzt-=Q@mail.gmail.com>
	<CAGnc4p88THHdGBX58G_8PNM1ZJ7jNs-+5kQpfEBw26ebaGpuyg@mail.gmail.com>
Message-ID: <CAFED-jmD6r_c5rNvq1ugwV3Qr=CtQYeOROnvEdY3C2oEq83k7g@mail.gmail.com>

2011/9/1 Matt Causey <matt.causey at gmail.com>:
> On Thu, Sep 1, 2011 at 1:17 AM, Janusz Dziedzic
> <janusz.dziedzic at gmail.com> wrote:
>> 2011/8/31 Matt Causey <matt.causey at gmail.com>:
>>> Ha! ?Yeah that's pretty lame on my part. ?I was convinced that I'd
>>> configured the supplicant properly at compile time, but alas I was
>>> wrong. ?I went back and re-compiled and now it works as expected. ?:-)
>>>
>>> I have another question now...I notice that if the supplicant
>>> processes a disassociation or deauth, we call
>>> wpa_supplicant_event_disassoc() (in blacklist.c), which then adds that
>>> BSSID to a blacklist. ?Then, the supplicant can no longer roam to that
>>> BSSID, even if it is a better choice.
>>>
>>> In our use case, we have a large number of access points and they can
>>> drop offline for maintenance periodically. ?What would folks recommend
>>> we do to keep these BSSID's from becoming permanently blacklisted just
>>> because they needed to reboot?
>>>
>>
>> Seems this is true. Blacklist will be cleared if "No APs found".
>>
>> In case of our implementation we don't hit this problem. We have
>> additional CQM signal - beacon_miss - from our driver (nl80211). Count
>> of beacon_miss is configurable from supplicant when bgscan starts. Our
>> firmware support this beacon_miss detection - so, it is usefull - we
>> can roam before deauthenitcation in case someone will switch off AP or
>> we loose connection.
>> I think we will push this CQM cfg80211/nl80211 compat-wireless +
>> hostap implementation soon.
>>
>> So, in case someone will switch off AP, before we will get
>> deauthentication we get this beacon_miss event and we have chance to
>> roam to another APs. If there isn't another APs blacklist will be
>> cleared because of "No APs found".
>>
>
> Interesting. ?So you have events that get processed before a deauth
> happens. ?Even with that, it is only a matter of time before your
> client receives a deauth for some other reason that does not correlate
> with a missed beacon, and then you will be vulnerable to the same
> issue.
>
> This functionality as it stands is a show-stopper for us so I've
> commented out the call to wpa_blacklist_add()
> (http://hostap.epitest.fi/wpa_supplicant/devel/blacklist_8c.html#af59c8fe6b0bef5b49f433bd06b29e9ab).
> ?I kind of wish that we could at least configure this behavior because
> it's pretty broken currently. ?I can see the rationale...the idea is
> that if a BSSID is impaired in some way, but is the strongest BSSID
> for a network, then clients will go there and have a bad experience.
> Unfortunately I think that the heuristic needs more work.
>
> Now, it may be that I can get ath9k to produce similar events that
> prevent the supplicant from processing the deauth, thus preventing the
> bug in the same way you are. ?Where in the driver would one typically
> look to see what, if any, 80211 events are supported?
>

In case of black_list  - maybe good idea is to add time parameter for
each blacklisted AP.
In such case we could add APs to blacklist for specyfic amount of time
period. After this time APs will be removed from blacklist.

BR
Janusz


From matt.causey  Thu Sep  1 13:18:47 2011
From: matt.causey (Matt Causey)
Date: Thu, 1 Sep 2011 16:18:47 -0400
Subject: wpa_supplicant roaming question
In-Reply-To: <CAFED-jmD6r_c5rNvq1ugwV3Qr=CtQYeOROnvEdY3C2oEq83k7g@mail.gmail.com>
References: <CAGnc4p_ARaE0Fd9uSjg2O8Ni+1CWoUhtYxz4BEMdb9dqO3u3EQ@mail.gmail.com>
	<CAFED-jk6AFE3bo0O3M5b96=ppSPYMNGVGLVyPJyqX+Y5Y8uwKw@mail.gmail.com>
	<CAGnc4p-VJPYHkFnWkDPZ4sQ32HXTT8-dxMfMeDLLPfM4P9-ujw@mail.gmail.com>
	<CAFED-j=L+n=U46qF=_C9PzNfAGp6C-XkCc5By0mRDQrEdzt-=Q@mail.gmail.com>
	<CAGnc4p88THHdGBX58G_8PNM1ZJ7jNs-+5kQpfEBw26ebaGpuyg@mail.gmail.com>
	<CAFED-jmD6r_c5rNvq1ugwV3Qr=CtQYeOROnvEdY3C2oEq83k7g@mail.gmail.com>
Message-ID: <CAGnc4p_h+2ioMsoruLpSaySuynXpyODAboEP2qaAg+k9m75C-g@mail.gmail.com>

On Thu, Sep 1, 2011 at 3:53 PM, Janusz Dziedzic
<janusz.dziedzic at gmail.com> wrote:
> 2011/9/1 Matt Causey <matt.causey at gmail.com>:
>> On Thu, Sep 1, 2011 at 1:17 AM, Janusz Dziedzic
>> <janusz.dziedzic at gmail.com> wrote:
>>> 2011/8/31 Matt Causey <matt.causey at gmail.com>:
>>>> Ha! ?Yeah that's pretty lame on my part. ?I was convinced that I'd
>>>> configured the supplicant properly at compile time, but alas I was
>>>> wrong. ?I went back and re-compiled and now it works as expected. ?:-)
>>>>
>>>> I have another question now...I notice that if the supplicant
>>>> processes a disassociation or deauth, we call
>>>> wpa_supplicant_event_disassoc() (in blacklist.c), which then adds that
>>>> BSSID to a blacklist. ?Then, the supplicant can no longer roam to that
>>>> BSSID, even if it is a better choice.
>>>>
>>>> In our use case, we have a large number of access points and they can
>>>> drop offline for maintenance periodically. ?What would folks recommend
>>>> we do to keep these BSSID's from becoming permanently blacklisted just
>>>> because they needed to reboot?
>>>>
>>>
>>> Seems this is true. Blacklist will be cleared if "No APs found".
>>>
>>> In case of our implementation we don't hit this problem. We have
>>> additional CQM signal - beacon_miss - from our driver (nl80211). Count
>>> of beacon_miss is configurable from supplicant when bgscan starts. Our
>>> firmware support this beacon_miss detection - so, it is usefull - we
>>> can roam before deauthenitcation in case someone will switch off AP or
>>> we loose connection.
>>> I think we will push this CQM cfg80211/nl80211 compat-wireless +
>>> hostap implementation soon.
>>>
>>> So, in case someone will switch off AP, before we will get
>>> deauthentication we get this beacon_miss event and we have chance to
>>> roam to another APs. If there isn't another APs blacklist will be
>>> cleared because of "No APs found".
>>>
>>
>> Interesting. ?So you have events that get processed before a deauth
>> happens. ?Even with that, it is only a matter of time before your
>> client receives a deauth for some other reason that does not correlate
>> with a missed beacon, and then you will be vulnerable to the same
>> issue.
>>
>> This functionality as it stands is a show-stopper for us so I've
>> commented out the call to wpa_blacklist_add()
>> (http://hostap.epitest.fi/wpa_supplicant/devel/blacklist_8c.html#af59c8fe6b0bef5b49f433bd06b29e9ab).
>> ?I kind of wish that we could at least configure this behavior because
>> it's pretty broken currently. ?I can see the rationale...the idea is
>> that if a BSSID is impaired in some way, but is the strongest BSSID
>> for a network, then clients will go there and have a bad experience.
>> Unfortunately I think that the heuristic needs more work.
>>
>> Now, it may be that I can get ath9k to produce similar events that
>> prevent the supplicant from processing the deauth, thus preventing the
>> bug in the same way you are. ?Where in the driver would one typically
>> look to see what, if any, 80211 events are supported?
>>
>
> In case of black_list ?- maybe good idea is to add time parameter for
> each blacklisted AP.
> In such case we could add APs to blacklist for specyfic amount of time
> period. After this time APs will be removed from blacklist.
>

I would agree with that.  It might also be useful to make that
configurable rather than a compile-time option.

Even with a time value, though, I'm thinking that there will be some
edge cases that we'll discover.  I am not sure that it's the
supplicant's job, actually, to blacklist BSSIDs at all.  I would
submit that if we have an ESSID with multiple BSSIDs in the first
place, we're talking about an enterprise network or at the very least
a network that should have some robust management in place.  And if a
network like that has BSSID's out there that are broken, it isn't the
client's job to work around that.  Roaming to another (uh, weaker)
access point isn't really a solution.

I'm just curious...what was the failure mode that precipitated the
blacklist feature enhancement to wpa_supplicant?

Thanks!

--
Matt


From johannes  Fri Sep  2 01:50:58 2011
From: johannes (Johannes Berg)
Date: Fri, 02 Sep 2011 10:50:58 +0200
Subject: driver_nl80211: cancel not yet started r-o-c
Message-ID: <1314953458.3927.2.camel@jlt3.sipsolutions.net>

From: Johannes Berg <johannes.berg at intel.com>

Currently, the following can happen:

1) P2P state machine requests R-O-C
2) user changes their mind and aborts
3) P2P state machine aborts R-O-C
4) driver_nl80211 rejects abort since there
   was no notification about the start yet
5) R-O-C period start notification from kernel
6) P2P state machine requests new R-O-C
7) this overlaps with old R-O-C -- iwlwifi driver
   can't handle that and returns -EBUSY
8) state machine stops dead in its tracks

The reason is that the abort isn't going through
properly. Instead of tracking whether a R-O-C is
active in driver_nl80211, track whether one was
requested to avoid this scenario.

Reported-by: Reinette Chatre <reinette.chatre at intel.com>
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
Reinette, this is from the logs you sent me. Unfortunately, it isn't
even the problem I was interested in -- I was interested in the one
where the soon-to-be P2P-client eventually gets -EBUSY, not when it
happens right away :-) Hopefully with this patch we get rid of one
possible scenario though ...


 src/drivers/driver_nl80211.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 233cdb2..d28f852 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1089,7 +1089,8 @@ static void mlme_event_remain_on_channel(struct wpa_driver_nl80211_data *drv,
 	if (cookie != drv->remain_on_chan_cookie)
 		return; /* not for us */
 
-	drv->pending_remain_on_chan = !cancel_event;
+	if (cancel_event)
+		drv->pending_remain_on_chan = 0;
 
 	os_memset(&data, 0, sizeof(data));
 	data.remain_on_channel.freq = freq;
@@ -6466,6 +6467,7 @@ static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
 			   "0x%llx for freq=%u MHz duration=%u",
 			   (long long unsigned int) cookie, freq, duration);
 		drv->remain_on_chan_cookie = cookie;
+		drv->pending_remain_on_chan = 1;
 		return 0;
 	}
 	wpa_printf(MSG_DEBUG, "nl80211: Failed to request remain-on-channel "
-- 
1.7.5.4





From yogeshp  Fri Sep  2 04:12:42 2011
From: yogeshp (Yogesh Ashok Powar)
Date: Fri, 2 Sep 2011 16:42:42 +0530
Subject: Could not set station flag for kernel driver
Message-ID: <20110902103217.GA3330@hertz.marvell.com>

Hi Jouni,

 We have seen following errors when station dissassociates & deauths.

>wlan0: AP-STA-DISCONNECTED 0c:74:c2:9a:4c:59
>wlan0: STA 0c:74:c2:9a:4c:59 IEEE 802.11: disassociated
>wlan0: AP-STA-DISCONNECTED 0c:74:c2:9a:4c:59
>Could not set station 0c:74:c2:9a:4c:59 flags for kernel driver (errno=97).

It seems like hostapd tries to set station flags even after the station
deletion. Following is the patch which avoid removing station entries
from disassoc handler; this will defer station removal to deauth
handler through 'ap_free_sta' call.

Let us know your opinion on this.

Thanks
Yogesh

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index e5a0a85..0b36577 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1176,7 +1176,6 @@ static void handle_disassoc(struct hostapd_data *hapd,
 	 * authenticated. */
 	accounting_sta_stop(hapd, sta);
 	ieee802_1x_free_station(sta);
-	hostapd_drv_sta_remove(hapd, sta->addr);
 
 	if (sta->timeout_next == STA_NULLFUNC ||
 	    sta->timeout_next == STA_DISASSOC) {
--


From rmanohar  Sat Sep  3 09:51:50 2011
From: rmanohar (Rajkumar Manoharan)
Date: Sat, 3 Sep 2011 22:21:50 +0530
Subject: [PATCH 1/2] p2p: disable 11b rates only on p2p interface creation
Message-ID: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>

11b rates are disabled blindly during p2p init based on driver
capability. This prevents use of CCK rates where p2p is not in
use. This patch disables 11b rates during the p2p interface
setup and also removes the disable_11b from global.

Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
 src/drivers/driver.h            |   13 -------------
 src/drivers/driver_nl80211.c    |   28 ++++++++++++----------------
 wpa_supplicant/driver_i.h       |    9 ---------
 wpa_supplicant/p2p_supplicant.c |    5 -----
 4 files changed, 12 insertions(+), 43 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 67c5631..822dc21 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1972,19 +1972,6 @@ struct wpa_driver_ops {
 	int (*probe_req_report)(void *priv, int report);
 
 	/**
-	 * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX
-	 * @priv: Private driver interface data
-	 * @disabled: Whether IEEE 802.11b rates are disabled
-	 * Returns: 0 on success, -1 on failure (or if not supported)
-	 *
-	 * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and
-	 * 11 Mbps) as TX rates for data and management frames. This can be
-	 * used to optimize channel use when there is no need to support IEEE
-	 * 802.11b-only devices.
-	 */
-	int (*disable_11b_rates)(void *priv, int disabled);
-
-	/**
 	 * deinit_ap - Deinitialize AP mode
 	 * @priv: Private driver interface data
 	 * Returns: 0 on success, -1 on failure (or if not supported)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 233cdb2..19dcc85 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -161,7 +161,6 @@ struct wpa_driver_nl80211_data {
 	int monitor_sock;
 	int monitor_ifidx;
 	int no_monitor_iface_capab;
-	int disable_11b_rates;
 
 	unsigned int pending_remain_on_chan:1;
 
@@ -2298,8 +2297,7 @@ static void wpa_driver_nl80211_deinit(void *priv)
 		os_free(drv->if_indices);
 #endif /* HOSTAPD */
 
-	if (drv->disable_11b_rates)
-		nl80211_disable_11b_rates(drv, drv->ifindex, 0);
+	nl80211_disable_11b_rates(drv, drv->ifindex, 0);
 
 	netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
 	netlink_deinit(drv->netlink);
@@ -4233,7 +4231,9 @@ static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
 						wds);
 	}
 
-	if (ret >= 0 && drv->disable_11b_rates)
+	if (ret >= 0 &&
+	    (iftype == NL80211_IFTYPE_P2P_CLIENT ||
+	     iftype == NL80211_IFTYPE_P2P_GO))
 		nl80211_disable_11b_rates(drv, ret, 1);
 
 	return ret;
@@ -5208,7 +5208,10 @@ static int nl80211_set_mode(struct wpa_driver_nl80211_data *drv,
 	NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, mode);
 
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
-	if (!ret)
+	if (!ret &&
+	    (mode == NL80211_IFTYPE_P2P_CLIENT ||
+	     mode == NL80211_IFTYPE_P2P_GO))
+		nl80211_disable_11b_rates(drv, ifindex, 1);
 		return 0;
 nla_put_failure:
 	wpa_printf(MSG_DEBUG, "nl80211: Failed to set interface %d to mode %d:"
@@ -6603,6 +6606,9 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
 		    NL80211_CMD_SET_TX_BITRATE_MASK, 0);
 	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
 
+	if (!disabled)
+		goto nla_send;
+
 	bands = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
 	if (!bands)
 		goto nla_put_failure;
@@ -6620,7 +6626,7 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
 	nla_nest_end(msg, band);
 
 	nla_nest_end(msg, bands);
-
+nla_send:
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	msg = NULL;
 	if (ret) {
@@ -6636,15 +6642,6 @@ nla_put_failure:
 }
 
 
-static int wpa_driver_nl80211_disable_11b_rates(void *priv, int disabled)
-{
-	struct i802_bss *bss = priv;
-	struct wpa_driver_nl80211_data *drv = bss->drv;
-	drv->disable_11b_rates = disabled;
-	return nl80211_disable_11b_rates(drv, drv->ifindex, disabled);
-}
-
-
 static int wpa_driver_nl80211_deinit_ap(void *priv)
 {
 	struct i802_bss *bss = priv;
@@ -7000,7 +6997,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.cancel_remain_on_channel =
 	wpa_driver_nl80211_cancel_remain_on_channel,
 	.probe_req_report = wpa_driver_nl80211_probe_req_report,
-	.disable_11b_rates = wpa_driver_nl80211_disable_11b_rates,
 	.deinit_ap = wpa_driver_nl80211_deinit_ap,
 	.resume = wpa_driver_nl80211_resume,
 	.send_ft_action = nl80211_send_ft_action,
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 79fdddd..fd4d8d5 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -463,15 +463,6 @@ static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
 	return -1;
 }
 
-static inline int wpa_drv_disable_11b_rates(struct wpa_supplicant *wpa_s,
-					    int disabled)
-{
-	if (wpa_s->driver->disable_11b_rates)
-		return wpa_s->driver->disable_11b_rates(wpa_s->drv_priv,
-							disabled);
-	return -1;
-}
-
 static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
 {
 	if (wpa_s->driver->deinit_ap)
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 400b6cc..cf4900c 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2364,11 +2364,6 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
 	}
 #endif /* CONFIG_CLIENT_MLME */
 
-	if (wpa_drv_disable_11b_rates(wpa_s, 1) < 0) {
-		wpa_printf(MSG_DEBUG, "P2P: Failed to disable 11b rates");
-		/* Continue anyway; this is not really a fatal error */
-	}
-
 	if (global->p2p)
 		return 0;
 
-- 
1.7.6.1



From rmanohar  Sat Sep  3 09:51:51 2011
From: rmanohar (Rajkumar Manoharan)
Date: Sat, 3 Sep 2011 22:21:51 +0530
Subject: [PATCH 2/2] p2p: Use scan supported rate attr for p2p probing
In-Reply-To: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>

This patch ensures that p2p probing does not use
11b rates by setting supported rates in the scan
attributes.

Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
 src/drivers/driver.h            |    4 ++++
 src/drivers/driver_nl80211.c    |   17 +++++++++++++++--
 wpa_supplicant/mlme.c           |    4 ++--
 wpa_supplicant/p2p_supplicant.c |    2 ++
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 822dc21..1c16228 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -242,6 +242,10 @@ struct wpa_driver_scan_params {
 	int *freqs;
 
 	/**
+	 * p2p_probe - Used to disables 11b rates for P2P probes
+	 */
+	u8 p2p_probe;
+	/**
 	 * filter_ssids - Filter for reporting SSIDs
 	 *
 	 * This optional parameter can be used to request the driver wrapper to
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 19dcc85..06f7709 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2361,16 +2361,18 @@ static int wpa_driver_nl80211_scan(void *priv,
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	int ret = 0, timeout;
-	struct nl_msg *msg, *ssids, *freqs;
+	struct nl_msg *msg, *ssids, *freqs, *rates;
 	size_t i;
 
 	msg = nlmsg_alloc();
 	ssids = nlmsg_alloc();
 	freqs = nlmsg_alloc();
-	if (!msg || !ssids || !freqs) {
+	rates = nlmsg_alloc();
+	if (!msg || !ssids || !freqs || !rates) {
 		nlmsg_free(msg);
 		nlmsg_free(ssids);
 		nlmsg_free(freqs);
+		nlmsg_free(rates);
 		return -1;
 	}
 
@@ -2410,6 +2412,16 @@ static int wpa_driver_nl80211_scan(void *priv,
 		nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
 	}
 
+	if (params->p2p_probe) {
+		/*
+		 * Disable 2 GHz rates 1, 2, 5.5, 11 Mbps by masking out
+		 * everything else apart from 6, 9, 12, 18, 24, 36, 48, 54 Mbps
+		 * from non-MCS rates. All 5 GHz rates are left enabled.
+		 */
+		NLA_PUT(rates, NL80211_BAND_2GHZ, 8,
+				"\x0c\x12\x18\x24\x30\x48\x60\x6c");
+		nla_put_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES, rates);
+	}
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	msg = NULL;
 	if (ret) {
@@ -2461,6 +2473,7 @@ nla_put_failure:
 	nlmsg_free(ssids);
 	nlmsg_free(msg);
 	nlmsg_free(freqs);
+	nlmsg_free(rates);
 	return ret;
 }
 
diff --git a/wpa_supplicant/mlme.c b/wpa_supplicant/mlme.c
index 49713f5..9a221a8 100644
--- a/wpa_supplicant/mlme.c
+++ b/wpa_supplicant/mlme.c
@@ -2864,8 +2864,8 @@ int ieee80211_sta_req_scan(struct wpa_supplicant *wpa_s,
 		os_memcpy(wpa_s->mlme.scan_ssid, ssid, ssid_len);
 	} else
 		wpa_s->mlme.scan_ssid_len = 0;
-	wpa_s->mlme.scan_skip_11b = 1; /* FIX: clear this is 11g is not
-					* supported */
+	if (params->p2p_probe)
+		wpa_s->mlme.scan_skip_11b = 1;
 	wpa_s->mlme.scan_state = SCAN_SET_CHANNEL;
 	wpa_s->mlme.scan_hw_mode_idx = 0;
 	wpa_s->mlme.scan_channel_idx = 0;
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index cf4900c..c1a31fd 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -120,6 +120,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 
 	p2p_scan_ie(wpa_s->global->p2p, ies);
 
+	params.p2p_probe = 1;
 	params.extra_ies = wpabuf_head(ies);
 	params.extra_ies_len = wpabuf_len(ies);
 
@@ -2785,6 +2786,7 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
 
 	p2p_scan_ie(wpa_s->global->p2p, ies);
 
+	params.p2p_probe = 1;
 	params.extra_ies = wpabuf_head(ies);
 	params.extra_ies_len = wpabuf_len(ies);
 
-- 
1.7.6.1



From mctiew  Sat Sep  3 16:34:43 2011
From: mctiew (Ming-Ching Tiew)
Date: Sat, 3 Sep 2011 16:34:43 -0700 (PDT)
Subject: EAP-SIM testing
Message-ID: <1315092883.63783.YahooMailClassic@web161425.mail.bf1.yahoo.com>

Try to do some tests with EAP-SIM authentication. Assuming that I have a sim card reader and a SIM ( which the Ki I do not know ), is it possible to compute the GSM triplet needed so that these can be transferred to the radius server for the purpose of doing end-to-end EAP-SIM testing ?

Is there any utility which I can use for this purpose ?

Regards.



From rmanohar  Sat Sep  3 23:14:18 2011
From: rmanohar (Rajkumar Manoharan)
Date: Sun, 4 Sep 2011 11:44:18 +0530
Subject: [RFC] p2p: disable 11b rates on p2p interface creation
In-Reply-To: <1314879338.4022.0.camel@jlt3.sipsolutions.net>
References: <1313522960-11775-1-git-send-email-rmanohar@qca.qualcomm.com>
	<20110829175601.GA6012@vmraj-lnx.users.atheros.com>
	<CAFED-jk_F92XEdt1yzrox_eg6aOvDV5BvgLpLna1vNZxYMRPoA@mail.gmail.com>
	<1314879338.4022.0.camel@jlt3.sipsolutions.net>
Message-ID: <20110904061417.GA8649@vmraj-lnx.users.atheros.com>

On Thu, Sep 01, 2011 at 02:15:38PM +0200, Johannes Berg wrote:
> On Thu, 2011-09-01 at 10:00 +0200, Janusz Dziedzic wrote:
> > 2011/8/29 Rajkumar Manoharan <rmanohar at qca.qualcomm.com>:
> > > On Wed, Aug 17, 2011 at 12:59:20AM +0530, Rajkumar Manoharan wrote:
> > >> 11b rates are disabled blindly during p2p init based on driver
> > >> capability. This prevents use of CCK rates when no p2p vif
> > >> is present. This patch disables 11b rates while creating p2p
> > >> interface.
> > >>
> > >> Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
> > >> ---
> > >>  src/drivers/driver.h            |    4 ++--
> > >>  src/drivers/driver_nl80211.c    |   17 ++++++++++++-----
> > >>  wpa_supplicant/driver_i.h       |    6 ++----
> > >>  wpa_supplicant/p2p_supplicant.c |    5 +----
> > >>  4 files changed, 17 insertions(+), 15 deletions(-)
> > >>
> > > Any comments are welcome.
> > >
> > 
> > Hello,
> > What with p2p_find - we should not use B-rates there - before connection.
> > Does you patch cover this case also?
> 
> No, that still needs work on the scanning settings stuff.
>
I have sent a couple of patches that handles 11b rates on both p2p probing and
interface creation.

--
Rajkumar


From johannes  Sun Sep  4 10:40:18 2011
From: johannes (Johannes Berg)
Date: Sun, 04 Sep 2011 19:40:18 +0200
Subject: [PATCH 2/2] p2p: Use scan supported rate attr for p2p probing
In-Reply-To: <1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
	<1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <1315158019.5671.1.camel@jlt3.sipsolutions.net>

On Sat, 2011-09-03 at 22:21 +0530, Rajkumar Manoharan wrote:

> +	if (params->p2p_probe) {
> +		/*
> +		 * Disable 2 GHz rates 1, 2, 5.5, 11 Mbps by masking out
> +		 * everything else apart from 6, 9, 12, 18, 24, 36, 48, 54 Mbps
> +		 * from non-MCS rates. All 5 GHz rates are left enabled.
> +		 */
> +		NLA_PUT(rates, NL80211_BAND_2GHZ, 8,
> +				"\x0c\x12\x18\x24\x30\x48\x60\x6c");
> +		nla_put_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES, rates);

I think that should take info from the capabilities to use the rates we
have, not blindly using the OFDM rates, although in practice that will
probably be sufficient.

johannes



From johannes  Sun Sep  4 10:41:32 2011
From: johannes (Johannes Berg)
Date: Sun, 04 Sep 2011 19:41:32 +0200
Subject: [PATCH 1/2] p2p: disable 11b rates only on p2p interface creation
In-Reply-To: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <1315158092.5671.2.camel@jlt3.sipsolutions.net>

On Sat, 2011-09-03 at 22:21 +0530, Rajkumar Manoharan wrote:
> 11b rates are disabled blindly during p2p init based on driver
> capability. This prevents use of CCK rates where p2p is not in
> use. This patch disables 11b rates during the p2p interface
> setup and also removes the disable_11b from global.

This looks OK to me, but I have no idea if it breaks anything for other,
non-open-source, driver wrappers... :-)

Also I guess there will be a philosophical question as to whether or not
the 11b disabling should be implicit (in driver_nl80211.c) or explicit
(as it was before).

johannes



From yingang.fu  Wed Sep  7 03:04:49 2011
From: yingang.fu (Fu Yingang)
Date: Wed, 07 Sep 2011 18:04:49 +0800
Subject: Has the supplicant supported P2P(station-station?) yet?
Message-ID: <4E6741C1.7030709@borqs.com>

hi, all

I am a newer to wpa_supplicant and is responsible for the wifi related 
defects of our company.

I heard that a new technology named WiFi-Direct which lets two station 
talk to each other directly without an AP.  It is cool!

So my question is what's the relation between the WiFi-Direct and the 
P2P which implemented in our tree? Could the function of P2P been used 
right now?

Thanks in advance.

Thanks
Yingang



From patrik.martinsson  Wed Sep  7 10:40:50 2011
From: patrik.martinsson (Martinsson Patrik)
Date: Wed, 7 Sep 2011 17:40:50 +0000
Subject: wpa_supplicant, pkcs11, pmksa
Message-ID: <FE20F28599789F41A422C6098507C98429384B@WINSERV302.ad.smhi.se>

Hi !

First, my knowledge in this area is rather limited so therefore the questions might be "a bit weird" or "way off", forgive me for that.

I'm trying to get wireless working with "smartcard-auth" and roaming. I can successfully connect and authenticate to our network, but there seems to be two problems, which may have a reasonable explanation, I don't know, hence this mail.

- Roaming, cant get it to work satisfying.
When moving from one ap to another, wpa_supplicant first disconnects and then makes a scan, and then tries to connect to the next ap, *but* this takes some time, from ~5 sec, to 1 minute, as of now, this is not a desirable since you can't roam without noticing it significant. I looked into the option bgscan (which is very hard to find btw), and as I understand it, that is the way to go when you want to roam, correct ?
And bgscan uses signal_monitoring, which is implemented in kernel >2.6.35, which in turn means that I'm out of luck since I'm on 2.6.32-131(rhel 6.1), correct ?

- Re-authentication, works but reads from smartcard.
When I move from one ap to another, wpa_supplicant reauthenticates using pmksa, correct ?
The re-authentication is partially working, it re-authenticates without asking for pin, but reads something from the smartcard (reauth won't work without smartcard, and pcscd-logs shows alot of activity at reauth), is this the way it should work ? I thought I could reauth without smartcard ?

My wpa_supplicant.conf looks like this,

===
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
pkcs11_engine_path=/usr/lib64/openssl/engines/engine_pkcs11.so
pkcs11_module_path=/usr/lib/libiidp11.so # our smartcard vendor

network={
    ssid="xxx"
    engine=1
    engine_id="pkcs11"
    key_mgmt=WPA-EAP
    eap=TLS
    identity="xxx"
    key_id="1:xxx"
    cert_id="1:xxx"
}
===

I'm greatful for any hints or tips that I can get,

Best regards,
Patrik Martinsson, Sweden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110907/37ab6ca4/attachment.htm 


From johannes  Wed Sep  7 12:50:43 2011
From: johannes (Johannes Berg)
Date: Wed, 07 Sep 2011 21:50:43 +0200
Subject: [RFC/RFT] driver_nl80211: automatically use concurrent P2P if possible
Message-ID: <1315425043.4002.23.camel@jlt3.sipsolutions.net>

From: Johannes Berg <johannes.berg at intel.com>

Since the kernel can now advertise P2P concurrent
support by advertising interface combinations, we
can take advantage of that and automatically use
P2P_CONCURRENT / P2P_MGMT_AND_NON_P2P for drivers
that advertise support.

Keep driver_param=use_p2p_group_interface=1 for
anyone not advertising interface combinations in
their drivers yet.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 src/drivers/driver_nl80211.c |   75 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

--- a/src/drivers/driver_nl80211.c	2011-09-06 08:10:45.000000000 +0200
+++ b/src/drivers/driver_nl80211.c	2011-09-07 21:48:13.000000000 +0200
@@ -1636,6 +1636,7 @@ struct wiphy_info_data {
 	int max_scan_ssids;
 	int ap_supported;
 	int p2p_supported;
+	int p2p_concurrent;
 	int auth_supported;
 	int connect_supported;
 	int offchan_tx_supported;
@@ -1649,6 +1650,17 @@ static int wiphy_info_handler(struct nl_
 	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
 	struct wiphy_info_data *info = arg;
 	int p2p_go_supported = 0, p2p_client_supported = 0;
+	static struct nla_policy
+	iface_combination_policy[NUM_NL80211_IFACE_COMB] = {
+		[NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED },
+		[NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 },
+		[NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG },
+		[NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 },
+	},
+	iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
+		[NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED },
+		[NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 },
+	};
 
 	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
 		  genlmsg_attrlen(gnlh, 0), NULL);
@@ -1676,6 +1688,63 @@ static int wiphy_info_handler(struct nl_
 		}
 	}
 
+	if (tb[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
+		struct nlattr *nl_combi;
+		int rem_combi;
+
+		nla_for_each_nested(nl_combi,
+				    tb[NL80211_ATTR_INTERFACE_COMBINATIONS],
+				    rem_combi) {
+			struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB];
+			struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT];
+			struct nlattr *nl_limit, *nl_mode;
+			int err, rem_limit, rem_mode;
+			int combination_has_p2p = 0, combination_has_mgd = 0;
+
+			err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB,
+					       nl_combi,
+					       iface_combination_policy);
+			if (err || !tb_comb[NL80211_IFACE_COMB_LIMITS] ||
+			    !tb_comb[NL80211_IFACE_COMB_MAXNUM] ||
+			    !tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS])
+				goto broken_combination;
+
+			nla_for_each_nested(nl_limit,
+					    tb_comb[NL80211_IFACE_COMB_LIMITS],
+					    rem_limit) {
+				err = nla_parse_nested(tb_limit,
+						       MAX_NL80211_IFACE_LIMIT,
+						       nl_limit,
+						       iface_limit_policy);
+				if (err ||
+				    !tb_limit[NL80211_IFACE_LIMIT_TYPES])
+					goto broken_combination;
+
+				nla_for_each_nested(nl_mode,
+						    tb_limit[NL80211_IFACE_LIMIT_TYPES],
+						    rem_mode) {
+					int ift = nla_type(nl_mode);
+					if (ift == NL80211_IFTYPE_P2P_GO ||
+					    ift == NL80211_IFTYPE_P2P_CLIENT)
+						combination_has_p2p = 1;
+					if (ift == NL80211_IFTYPE_STATION)
+						combination_has_mgd = 1;
+				}
+				if (combination_has_p2p && combination_has_mgd)
+					break;
+			}
+
+			if (combination_has_p2p && combination_has_mgd) {
+				info->p2p_concurrent = 1;
+				break;
+			}
+
+broken_combination:
+			;
+		}
+	}
+
+
 	info->p2p_supported = p2p_go_supported && p2p_client_supported;
 
 	if (tb[NL80211_ATTR_SUPPORTED_COMMANDS]) {
@@ -1772,6 +1841,12 @@ static int wpa_driver_nl80211_capa(struc
 	drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
 	if (info.p2p_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
+	if (info.p2p_concurrent) {
+		wpa_printf(MSG_DEBUG, "nl80211: Use separate P2P group "
+			   "interface (driver advertised support)");
+		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
+		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
+	}
 	drv->capa.flags |= WPA_DRIVER_FLAGS_EAPOL_TX_STATUS;
 	drv->capa.flags |= WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS;
 	drv->capa.max_remain_on_chan = info.max_remain_on_chan;




From matt.causey  Wed Sep  7 16:20:47 2011
From: matt.causey (Matt Causey)
Date: Wed, 7 Sep 2011 19:20:47 -0400
Subject: wpa_supplicant, pkcs11, pmksa
In-Reply-To: <FE20F28599789F41A422C6098507C98429384B@WINSERV302.ad.smhi.se>
References: <FE20F28599789F41A422C6098507C98429384B@WINSERV302.ad.smhi.se>
Message-ID: <CAGnc4p-LxUeWN-h8eovSA-xNQ7ctw8gxxEWBT7hxq6r_EV0f+Q@mail.gmail.com>

So I think that bgscan will work on the older kernels, it just won't
get the signal change events from the driver IIRC...so the timers will
be the only prompt for a roam.  Though IMO it is worth the time to
upgrade the kernel, and use wpa_supplicant with the -on80211 flag,
because the roaming performance is far better that way.  I know it's a
pain, but just package your custom kernel as an RPM and slide it in
there... :-)  And yeah there is a lot of source-code reading involved
understanding how bgscan works.  I"m sure that there is some
opportunity for us to contribute our hard-won knowledge into some wiki
some place to prevent the next wandering engineer having to do the
same.  I digress...

PMKSA key caching is disabled in the supplicant by default:

http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf

You might try enabling that, and then give us the output of running
your supplicant during a roam event with the -dd flag.

--
Matt



On Wed, Sep 7, 2011 at 1:40 PM, Martinsson Patrik
<patrik.martinsson at smhi.se> wrote:
> Hi !
>
> First, my knowledge in this area is rather limited so therefore the
> questions might be "a bit weird" or "way off", forgive me for that.
>
> I'm trying to get wireless working with "smartcard-auth" and roaming. I can
> successfully connect and authenticate to our network, but there seems to be
> two problems, which may have a reasonable explanation, I don't know, hence
> this mail.
>
> - Roaming, cant get it to work satisfying.
> When moving from one ap to another, wpa_supplicant first disconnects and
> then makes a scan, and then tries to connect to the next ap, *but* this
> takes some time, from ~5 sec, to 1 minute, as of now, this is not a
> desirable since you can't roam without noticing it significant. I looked
> into the option bgscan (which is very hard to find btw), and as I understand
> it, that is the way to go when you want to roam, correct ?
> And bgscan uses signal_monitoring, which is implemented in kernel >2.6.35,
> which in turn means that I'm out of luck since I'm on 2.6.32-131(rhel 6.1),
> correct ?
>
> - Re-authentication, works but reads from smartcard.
> When I move from one ap to another, wpa_supplicant reauthenticates using
> pmksa, correct ?
> The re-authentication is partially working, it re-authenticates without
> asking for pin, but reads something from the smartcard (reauth won't work
> without smartcard, and pcscd-logs shows alot of activity at reauth), is this
> the way it should work ? I thought I could reauth without smartcard ?
>
> My wpa_supplicant.conf looks like this,
>
> ===
> ctrl_interface=/var/run/wpa_supplicant
> ctrl_interface_group=wheel
> pkcs11_engine_path=/usr/lib64/openssl/engines/engine_pkcs11.so
> pkcs11_module_path=/usr/lib/libiidp11.so # our smartcard vendor
>
> network={
> ??? ssid="xxx"
> ??? engine=1
> ??? engine_id="pkcs11"
> ??? key_mgmt=WPA-EAP
> ??? eap=TLS
> ??? identity="xxx"
> ??? key_id="1:xxx"
> ??? cert_id="1:xxx"
> }
> ===
>
> I'm greatful for any hints or tips that I can get,
>
> Best regards,
> Patrik Martinsson, Sweden
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>
>


From andrei.emeltchenko.news  Thu Sep  8 06:36:44 2011
From: andrei.emeltchenko.news (Andrei Emeltchenko)
Date: Thu, 8 Sep 2011 16:36:44 +0300
Subject: wpa_supplicant compilation failed
Message-ID: <CAMXE1-rj0_dyNi3CjX3p4ryPoXHYE_yh35jZxyb_JrTbLy0U6A@mail.gmail.com>

Hi,

I've got the latest version of wpa_supplicant but compilation is failing:

../src/crypto/crypto_openssl.c:16:30: fatal error: openssl/opensslv.h:
compilation terminated.
make: *** [../src/crypto/crypto_openssl.o] Error 1

My config is:
_________________________
CONFIG_DRIVER_NL80211=y
CONFIG_CTRL_IFACE=y
CONFIG_P2P=y
CONFIG_AP=y
CONFIG_WPS=y


Regards,
Andrei


From kaniki.uday  Fri Sep  9 01:06:16 2011
From: kaniki.uday (uday kiran)
Date: Fri, 9 Sep 2011 13:36:16 +0530
Subject: Question on "IEEE 802.11 n" mode
Message-ID: <CAOeh9MvsFK-DwFM=TfHxFQrgEHPm4rACx9EdAXd6xVjiRAfDKA@mail.gmail.com>

Hi All

hw_mode can be set to only a,b,g. why mode 'n' is seperated out .

If I have the following config

hw_mode = g
ieee80211n = 1

Does it mean that device is operating in mode 'g' with additional 'n'
capabilities ? I am confused . Please clarify ?

-Uday
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110909/17ea49a7/attachment.htm 


From patrik.martinsson  Fri Sep  9 02:07:07 2011
From: patrik.martinsson (Martinsson Patrik)
Date: Fri, 9 Sep 2011 09:07:07 +0000
Subject: wpa_supplicant, pkcs11, pmksa
In-Reply-To: <CAGnc4p-LxUeWN-h8eovSA-xNQ7ctw8gxxEWBT7hxq6r_EV0f+Q@mail.gmail.com>
References: <FE20F28599789F41A422C6098507C98429384B@WINSERV302.ad.smhi.se>,
	<CAGnc4p-LxUeWN-h8eovSA-xNQ7ctw8gxxEWBT7hxq6r_EV0f+Q@mail.gmail.com>
Message-ID: <FE20F28599789F41A422C6098507C9842940F5@WINSERV302.ad.smhi.se>

Hi Matt, 

Thanks for straightening things out for me. 

Yes, as I understood it (and verified with some testing) bgscan only works with a timer as a trigger on my current kernel. 
Upgrading a kernel in my case is not an option, however i appreciate the suggestion. 

I've compiled a newer version of wpa_supplicant with the nl80211 driver included and that's what I'm using atm, *and* after adding "proactive_key_caching=1;" to my config (don't know how i missed that from the config file), the reauth part when switching AP works flawless. It actually works pretty fast (couple of secs) so the "roaming" is good enough for me. 

My remaining questions though, 
- the length of the cache-time of the pmk is set by the server, correct ?
I see the option "dot11RSNAConfigPMKLifetime" in the config file, and i tried it out with an enormous value, and when i do the command "pmksa" from the wpa_cli I see the that the value I've set through the config is the one that's in use. Does that mean that I override the setting sent by the server, or is the PMK cache time-length actually set by the client ? 

- when the PMK-cache-time has reached the "PMKReauthThreshold" wpa_supplicant reauthenticates, correct ? 
Does that mean a "full-reauthentication" ? When my "pmk-trehshold" is reached and I don't have my smartcard inserted the reauth part fails, however if the smartcard is present the reauth works, even without asking for my pin. 

As always, I'm greatful for any hints or tips that I can get,

Best regards,
Patrik Martinsson, Sweden. 

________________________________________
From: Matt Causey [matt.causey at gmail.com]
Sent: Thursday, September 08, 2011 1:20
To: Martinsson Patrik
Cc: hostap at lists.shmoo.com
Subject: Re: wpa_supplicant, pkcs11, pmksa

So I think that bgscan will work on the older kernels, it just won't
get the signal change events from the driver IIRC...so the timers will
be the only prompt for a roam.  Though IMO it is worth the time to
upgrade the kernel, and use wpa_supplicant with the -on80211 flag,
because the roaming performance is far better that way.  I know it's a
pain, but just package your custom kernel as an RPM and slide it in
there... :-)  And yeah there is a lot of source-code reading involved
understanding how bgscan works.  I"m sure that there is some
opportunity for us to contribute our hard-won knowledge into some wiki
some place to prevent the next wandering engineer having to do the
same.  I digress...

PMKSA key caching is disabled in the supplicant by default:

http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf

You might try enabling that, and then give us the output of running
your supplicant during a roam event with the -dd flag.

--
Matt



On Wed, Sep 7, 2011 at 1:40 PM, Martinsson Patrik
<patrik.martinsson at smhi.se> wrote:
> Hi !
>
> First, my knowledge in this area is rather limited so therefore the
> questions might be "a bit weird" or "way off", forgive me for that.
>
> I'm trying to get wireless working with "smartcard-auth" and roaming. I can
> successfully connect and authenticate to our network, but there seems to be
> two problems, which may have a reasonable explanation, I don't know, hence
> this mail.
>
> - Roaming, cant get it to work satisfying.
> When moving from one ap to another, wpa_supplicant first disconnects and
> then makes a scan, and then tries to connect to the next ap, *but* this
> takes some time, from ~5 sec, to 1 minute, as of now, this is not a
> desirable since you can't roam without noticing it significant. I looked
> into the option bgscan (which is very hard to find btw), and as I understand
> it, that is the way to go when you want to roam, correct ?
> And bgscan uses signal_monitoring, which is implemented in kernel >2.6.35,
> which in turn means that I'm out of luck since I'm on 2.6.32-131(rhel 6.1),
> correct ?
>
> - Re-authentication, works but reads from smartcard.
> When I move from one ap to another, wpa_supplicant reauthenticates using
> pmksa, correct ?
> The re-authentication is partially working, it re-authenticates without
> asking for pin, but reads something from the smartcard (reauth won't work
> without smartcard, and pcscd-logs shows alot of activity at reauth), is this
> the way it should work ? I thought I could reauth without smartcard ?
>
> My wpa_supplicant.conf looks like this,
>
> ===
> ctrl_interface=/var/run/wpa_supplicant
> ctrl_interface_group=wheel
> pkcs11_engine_path=/usr/lib64/openssl/engines/engine_pkcs11.so
> pkcs11_module_path=/usr/lib/libiidp11.so # our smartcard vendor
>
> network={
>     ssid="xxx"
>     engine=1
>     engine_id="pkcs11"
>     key_mgmt=WPA-EAP
>     eap=TLS
>     identity="xxx"
>     key_id="1:xxx"
>     cert_id="1:xxx"
> }
> ===
>
> I'm greatful for any hints or tips that I can get,
>
> Best regards,
> Patrik Martinsson, Sweden
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>
>


From matt.causey  Fri Sep  9 08:10:12 2011
From: matt.causey (Matt Causey)
Date: Fri, 9 Sep 2011 11:10:12 -0400
Subject: wpa_supplicant compilation failed
In-Reply-To: <CAMXE1-rj0_dyNi3CjX3p4ryPoXHYE_yh35jZxyb_JrTbLy0U6A@mail.gmail.com>
References: <CAMXE1-rj0_dyNi3CjX3p4ryPoXHYE_yh35jZxyb_JrTbLy0U6A@mail.gmail.com>
Message-ID: <CAGnc4p8A_K1MNyaSG_3J4hxz=b_HkZXDuY+TTxmOMQ2smMCNaQ@mail.gmail.com>

On Thu, Sep 8, 2011 at 9:36 AM, Andrei Emeltchenko
<andrei.emeltchenko.news at gmail.com> wrote:
> Hi,
>
> I've got the latest version of wpa_supplicant but compilation is failing:
>
> ../src/crypto/crypto_openssl.c:16:30: fatal error: openssl/opensslv.h:
> compilation terminated.
> make: *** [../src/crypto/crypto_openssl.o] Error 1

Uh, is that the only error?  It looks like something killed your
compiler mid-stream.  Can you try again and give us a little more
context from the compile?

--
Matt


>
> My config is:
> _________________________
> CONFIG_DRIVER_NL80211=y
> CONFIG_CTRL_IFACE=y
> CONFIG_P2P=y
> CONFIG_AP=y
> CONFIG_WPS=y
>
>
> Regards,
> Andrei
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>


From j  Sat Sep 10 11:47:00 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 21:47:00 +0300
Subject: wpa_supplicant, pkcs11, pmksa
In-Reply-To: <FE20F28599789F41A422C6098507C9842940F5@WINSERV302.ad.smhi.se>
References: <FE20F28599789F41A422C6098507C98429384B@WINSERV302.ad.smhi.se>
	<CAGnc4p-LxUeWN-h8eovSA-xNQ7ctw8gxxEWBT7hxq6r_EV0f+Q@mail.gmail.com>
	<FE20F28599789F41A422C6098507C9842940F5@WINSERV302.ad.smhi.se>
Message-ID: <20110910184700.GA8976@jm.kir.nu>

On Fri, Sep 09, 2011 at 09:07:07AM +0000, Martinsson Patrik wrote:
> - the length of the cache-time of the pmk is set by the server, correct ?

In theory, yes. However, IEEE 802.11i did not provide a mechanism for
the AP to notify the station on how long the key is valid..

> I see the option "dot11RSNAConfigPMKLifetime" in the config file, and i tried it out with an enormous value, and when i do the command "pmksa" from the wpa_cli I see the that the value I've set through the config is the one that's in use. Does that mean that I override the setting sent by the server, or is the PMK cache time-length actually set by the client ? 

It is just a value that wpa_supplicant uses since it does not know the
PMK lifetime on the authentication server/AP.

> - when the PMK-cache-time has reached the "PMKReauthThreshold" wpa_supplicant reauthenticates, correct ? 
> Does that mean a "full-reauthentication" ? When my "pmk-trehshold" is reached and I don't have my smartcard inserted the reauth part fails, however if the smartcard is present the reauth works, even without asking for my pin. 

Yes, this would be a full EAP re-authentication. Though, based on the
EAP configuration that could actually allow session resumption which
could potentially work without requiring the smartcard. The server would
need to allow this, though, so the exact behavior is not fully
controlled by wpa_supplicant (nor can it really know what the server
will do before trying).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 11:56:02 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 21:56:02 +0300
Subject: [RFC/RFT] driver_nl80211: automatically use concurrent P2P if
	possible
In-Reply-To: <1315425043.4002.23.camel@jlt3.sipsolutions.net>
References: <1315425043.4002.23.camel@jlt3.sipsolutions.net>
Message-ID: <20110910185602.GB8976@jm.kir.nu>

On Wed, Sep 07, 2011 at 09:50:43PM +0200, Johannes Berg wrote:
> Since the kernel can now advertise P2P concurrent
> support by advertising interface combinations, we
> can take advantage of that and automatically use
> P2P_CONCURRENT / P2P_MGMT_AND_NON_P2P for drivers
> that advertise support.

Hey, it builds.. Was that enough testing? ;-) I applied this. Let's see
how that goes.

> Keep driver_param=use_p2p_group_interface=1 for
> anyone not advertising interface combinations in
> their drivers yet.

Yeah, probably good to leave that for now.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 11:59:04 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 21:59:04 +0300
Subject: EAP-SIM testing
In-Reply-To: <1315092883.63783.YahooMailClassic@web161425.mail.bf1.yahoo.com>
References: <1315092883.63783.YahooMailClassic@web161425.mail.bf1.yahoo.com>
Message-ID: <20110910185904.GC8976@jm.kir.nu>

On Sat, Sep 03, 2011 at 04:34:43PM -0700, Ming-Ching Tiew wrote:
> Try to do some tests with EAP-SIM authentication. Assuming that I have a sim card reader and a SIM ( which the Ki I do not know ), is it possible to compute the GSM triplet needed so that these can be transferred to the radius server for the purpose of doing end-to-end EAP-SIM testing ?

Yes, you can extract GSM authentication triplets from the SIM and then
use them to test EAP-SIM (but only for limited testing purposes).

> Is there any utility which I can use for this purpose ?

Yes, you can use eapol_test for this (cd wpa_supplicant; make
eapol_test): eapol_test sim <PIN> <num triplets>

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 12:09:12 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 22:09:12 +0300
Subject: [PATCH 1/2] p2p: disable 11b rates only on p2p interface creation
In-Reply-To: <1315158092.5671.2.camel@jlt3.sipsolutions.net>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
	<1315158092.5671.2.camel@jlt3.sipsolutions.net>
Message-ID: <20110910190912.GD8976@jm.kir.nu>

On Sun, Sep 04, 2011 at 07:41:32PM +0200, Johannes Berg wrote:
> On Sat, 2011-09-03 at 22:21 +0530, Rajkumar Manoharan wrote:
> > 11b rates are disabled blindly during p2p init based on driver
> > capability. This prevents use of CCK rates where p2p is not in
> > use. This patch disables 11b rates during the p2p interface
> > setup and also removes the disable_11b from global.
> 
> This looks OK to me, but I have no idea if it breaks anything for other,
> non-open-source, driver wrappers... :-)

Well, it does break compilation (trivial to fix), but driver_nl80211.c
is actually the only driver wrapper that I've heard of using this. Many
drivers handle P2P TX rate rules internally without any configuration
needed.

> Also I guess there will be a philosophical question as to whether or not
> the 11b disabling should be implicit (in driver_nl80211.c) or explicit
> (as it was before).

I think I'm fine with making this implicit for the default rule and
assume that driver wrappers handle that based on what the driver needs
(or doesn't, as may be the case). It can still be explicit in some
operations like scan.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 12:21:38 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 22:21:38 +0300
Subject: [PATCH 2/2] p2p: Use scan supported rate attr for p2p probing
In-Reply-To: <1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
	<1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <20110910192138.GE8976@jm.kir.nu>

On Sat, Sep 03, 2011 at 10:21:51PM +0530, Rajkumar Manoharan wrote:
> This patch ensures that p2p probing does not use
> 11b rates by setting supported rates in the scan
> attributes.

No it does not - it only change the supported rates element inside the
frame; it does not control the TX rate used to actually transmit the
Probe Request frame. While the supported rates element needs to be
modified there would also need to be something to enforce TX rate
selection.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 12:26:11 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 22:26:11 +0300
Subject: [PATCH 1/2] p2p: disable 11b rates only on p2p interface creation
In-Reply-To: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <20110910192611.GF8976@jm.kir.nu>

On Sat, Sep 03, 2011 at 10:21:50PM +0530, Rajkumar Manoharan wrote:
> 11b rates are disabled blindly during p2p init based on driver
> capability. This prevents use of CCK rates where p2p is not in
> use. This patch disables 11b rates during the p2p interface
> setup and also removes the disable_11b from global.

Unfortunately, this does not resolve the problem when the initial
interface is used for any P2P operations (which is the case almost
always). The Probe Request and Probe Response frames can be sent at CCK
rates if this patch were applied. In addition, the Action frames sent
with NL80211_CMD_FRAME could go out at CCK rates.

I would assume that NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_FRAME could
be addressed by adding a new attribute to describe limitation for TX
rate selection. For Probe Response frames, this could potentially be
done with NL80211_CMD_REMAIN_ON_CHANNEL since the issue shows up only in
P2P Listen state (GO would be running with P2P iftype, so it would still
get the full 11b disabling with this patch).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 12:45:07 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 22:45:07 +0300
Subject: [PATCH 2/2] p2p: Use scan supported rate attr for p2p probing
In-Reply-To: <1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
	<1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <20110910194507.GA12113@jm.kir.nu>

On Sat, Sep 03, 2011 at 10:21:51PM +0530, Rajkumar Manoharan wrote:
> This patch ensures that p2p probing does not use
> 11b rates by setting supported rates in the scan
> attributes.

Even though I did not apply the first patch, I ended up applying this
since it is a step towards better design for disabling 802.11b rates for
P2P use cases.

> diff --git a/wpa_supplicant/mlme.c b/wpa_supplicant/mlme.c
> @@ -2864,8 +2864,8 @@ int ieee80211_sta_req_scan(struct wpa_supplicant *wpa_s,
> -	wpa_s->mlme.scan_skip_11b = 1; /* FIX: clear this is 11g is not
> -					* supported */
> +	if (params->p2p_probe)
> +		wpa_s->mlme.scan_skip_11b = 1;

Though, I dropped this part since it has nothing to do with P2P and is
still needed.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 12:56:13 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 22:56:13 +0300
Subject: Could not set station flag for kernel driver
In-Reply-To: <20110902103217.GA3330@hertz.marvell.com>
References: <20110902103217.GA3330@hertz.marvell.com>
Message-ID: <20110910195613.GB12113@jm.kir.nu>

On Fri, Sep 02, 2011 at 04:42:42PM +0530, Yogesh Ashok Powar wrote:
>  We have seen following errors when station dissassociates & deauths.
> 
> >wlan0: AP-STA-DISCONNECTED 0c:74:c2:9a:4c:59
> >wlan0: STA 0c:74:c2:9a:4c:59 IEEE 802.11: disassociated
> >wlan0: AP-STA-DISCONNECTED 0c:74:c2:9a:4c:59
> >Could not set station 0c:74:c2:9a:4c:59 flags for kernel driver (errno=97).

Does this cause any noticeable misbehavior apart from that message in
hostapd output?

> It seems like hostapd tries to set station flags even after the station
> deletion. Following is the patch which avoid removing station entries
> from disassoc handler; this will defer station removal to deauth
> handler through 'ap_free_sta' call.

This could potentially cause some problems unless the station entry in
kernel is move to disassociated state. Since the assumption is more or
less that the kernel driver maintains a STA entry only when the STA is
associated, this could leave a window open to enable some frames to be
accepted when they should not be.

It looks like the encryption keys get removed, so the STA entry in
kernel could potentially even accept unencrypted frames. At minimum, the
STA entry needs to be unauthorized with ap_sta_set_authorized(hapd, sta,
0). This is actually pretty similar to what I did recently to allow
Deauthentication/Disassociation frames to be PS buffered:
http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=4dc03726de072b127ba4f219cdf50df8f9b7c9be

Doing this type of changes comes with a risk and I would rather not do
this unless there is a real issue that gets fixed by leaving the STA
entry in kernel for longer time (like there was in the case of
transmitting Deauth/Disassoc; but I do not see similar reason in the
receiving Deauth/Disassoc case).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 12:58:47 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 22:58:47 +0300
Subject: driver_nl80211: cancel not yet started r-o-c
In-Reply-To: <1314953458.3927.2.camel@jlt3.sipsolutions.net>
References: <1314953458.3927.2.camel@jlt3.sipsolutions.net>
Message-ID: <20110910195847.GC12113@jm.kir.nu>

On Fri, Sep 02, 2011 at 10:50:58AM +0200, Johannes Berg wrote:

> The reason is that the abort isn't going through
> properly. Instead of tracking whether a R-O-C is
> active in driver_nl80211, track whether one was
> requested to avoid this scenario.

Thanks! Applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 13:08:07 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 23:08:07 +0300
Subject: What's the reason for "OpenSSL: openssl_handshake - SSL_connect
	error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher"
In-Reply-To: <CANokWkj_ZXjOyW3u=-uArskKDf=iL7edo70Rv+wTc7YWROnfdA@mail.gmail.com>
References: <CANokWkj_ZXjOyW3u=-uArskKDf=iL7edo70Rv+wTc7YWROnfdA@mail.gmail.com>
Message-ID: <20110910200807.GD12113@jm.kir.nu>

On Thu, Sep 01, 2011 at 09:52:48AM +0800, 2008 vpn wrote:

>    SSL: SSL3 alert: write (local SSL3 detected an error):fatal:handshake
>    failure
>    SSL: (where=0x2002 ret=0xffffffff)
>    SSL: SSL_accept:error in SSLv3 read client hello C
>    OpenSSL: openssl_handshake - SSL_connect error:1408A0C1:SSL
>    routines:SSL3_GET_CLIENT_
> HELLO:no shared cipher

Sounds like the supplicant trying to use only ciphers that were not
allowed at this point. I would need to see more context in the debug
log (i.e., including the previous EAP messages that started EAP-FAST)
and ideally, also a packet capture log showing that exact ClientHello
message to see what exactly the supplicant was trying to do.

>    Config for wpa_supplicant is:

>    eap=FAST
>    identity="user"
>    password="password"
>    anonymous_identity="FAST-000102030405"
>            phase1="fast_provisioning=1"
>            pac_file="/etc/wpa_supplicant.eap-fast-pac"

OK, so this is for anonymous provisioning.. Could you please also send
debug log from wpa_supplicant showing what it is doing when this failure
shows up?

>    I noticed we should config certificate file for EAP-TLS/PEAP/TTLS.
>    But do we need config certificate file for EAP-FAST?

Depends a bit on how you handle provisioning. Anonymous provisioning
(like the configuration above) is not that secure, so verifying server
certificate during the provisioning step would be advised if you cannot
guarantee a safe location to do the initial setup. Once the PAC has been
provisioned, there is less need for certificate validation.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 13:32:04 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 23:32:04 +0300
Subject: future wpa_s/hostapd release plans
In-Reply-To: <1314882627.4022.17.camel@jlt3.sipsolutions.net>
References: <1314882627.4022.17.camel@jlt3.sipsolutions.net>
Message-ID: <20110910203204.GE12113@jm.kir.nu>

On Thu, Sep 01, 2011 at 03:10:27PM +0200, Johannes Berg wrote:
> Oh, and because this is a change, Jouni proposed calling the first one
> that will come out of this "1.0" (first release 1.0.0), followed by
> "1.1". (or did you mean 1.0 being the first release, followed by 2.0,
> and fixes as 1.1, 1.2, ...?)

I think we could as well drop the extra value.. We've survived almost
ten years without changing the "0." prefix in the version number, so
clearly there has not been much need for it. In other words, we could
fork hostap-1.git and release 1.0, 1.1, and so on from there and the
next fork would be hostap-2.git with 2.0, 2.1, ...

And just to be clear on what the version numbers mean here, the 1.0
version would actually map to the first stable release in the past
(e.g., 0.7.3 in the case of 0.7.x branch). In other words, the
development release concepts goes away (or well, the possible 1.0-rc1
style releases could obviously be similar, but still, x.0 is the first
"stable release").

> First of all, when will the first branch happen? I'm not sure -- we need
> to put infrastructure in place on our side to make it happen and
> familiarise ourselves with the release scripts etc., so that might take
> a little while. I'm thinking maybe some time in November, and then the
> next ones can be in May 2012, November 2012 etc.

That sounds fine to me. Usually I have tried to create the stable branch
before starting some larger cleanup or new features in the development
branch. Though, it is always possible to pick an older commit from the
tree for the fork, so we can do that after the fact if something larger
starts showing up in hostap.git.

> Secondly, we don't have a fully functional test bed, so when/how do we
> call what branched as 1.0 actually release-worthy? Jouni -- what's your
> process there? Just "generally I'm happy"?

This has been pretty informal in the past, but things have been calming
down in the stable branch for longer time before making the first stable
release. I have usually tried to verify basic functionality for both AP
(hostapd) and station (wpa_supplicant) functionality, but there has not
really been extensive testing just for the purpose of being able to make
a new release. I've also tried to run the source code through couple of
static analysis tools before each release and address whatever issues
show up. I should be able to do that with 1.0, too, once we get closer
to the release time.

I have wanted to build an automated test setup for a long time, but
haven't really ever found enough time to complete that.. In practice,
there are number of projects that track hostap.git changes and run
automated tests, so some testing gets done there. However, the separate
release branch may actually get quite a bit less testing "by default"
unless someone changes from tracking hostap.git to that branch.

For this particular 1.0 case, it would be nice to run through some P2P
certification tests taken into account that P2P support is one of the
largest changes between 0.7 and 1.0. In theory, I have a fully automated
test setup for it, but it is not dedicated for this purpose, so I might
as well call it manual.

I'm not sure whether I would actually be using the stable branch for
projects that I'm involved with since I've already gotten very used to
picking builds directly from hostap.git.. As such, the question of
testing the release branch may fall more for those who are planning on
using it until we have a fully automated testbed in place.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 13:40:19 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 23:40:19 +0300
Subject: Logging unsolicited events in hostapd_cli
In-Reply-To: <5EFC33E018C9694BB56C6EF5F871F97C040048@CAM-BLA-211.paconsulting.com>
References: <5EFC33E018C9694BB56C6EF5F871F97C040048@CAM-BLA-211.paconsulting.com>
Message-ID: <20110910204019.GF12113@jm.kir.nu>

On Wed, Aug 31, 2011 at 03:37:12PM +0000, Fabio Tignanelli wrote:
> I am using HostAPD v0.6.9 available on Fedora 12 distribution.
> 
> I am looking at the use of hostapd_cli and how unsolicited events can be captured.
> 
> I was expecting to see the print out of an unsolicited message on the hostapd_cli prompt saying something like "authenticated" when a station would authenticate.

hostapd has been quite a bit behind on the unsolicited event side
compared to wpa_supplicant and this is only a recent functionality (your
0.6.9 is too old to support it).

> 1) Is there anything I need to configure in the hostapd or hostapd_cli to get a notification of events like "authenticated" or "connected" in the hostapd_cli?

No, but you would need to update to a newer version.

> 2) Is there a way I can update HostAPD v0.6.9 to the latest version v0.7.3 on my Fedora 12 without incurring in any compatibility trouble (I have tried to update the rpm package with yum but it seems v0.6.9 is as far as Fedora 12 can go)?

I guess that depends on "compatibility trouble".. If Fedora 12 does not
support newer releases, you would need to get it from a newer release or
build from source. While I would not generally expect issues in moving
to newer versions, there are no guarantees on that.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 10 13:58:21 2011
From: j (Jouni Malinen)
Date: Sat, 10 Sep 2011 23:58:21 +0300
Subject: wpa_supplicant roaming question
In-Reply-To: <CAGnc4p_h+2ioMsoruLpSaySuynXpyODAboEP2qaAg+k9m75C-g@mail.gmail.com>
References: <CAGnc4p_ARaE0Fd9uSjg2O8Ni+1CWoUhtYxz4BEMdb9dqO3u3EQ@mail.gmail.com>
	<CAFED-jk6AFE3bo0O3M5b96=ppSPYMNGVGLVyPJyqX+Y5Y8uwKw@mail.gmail.com>
	<CAGnc4p-VJPYHkFnWkDPZ4sQ32HXTT8-dxMfMeDLLPfM4P9-ujw@mail.gmail.com>
	<CAFED-j=L+n=U46qF=_C9PzNfAGp6C-XkCc5By0mRDQrEdzt-=Q@mail.gmail.com>
	<CAGnc4p88THHdGBX58G_8PNM1ZJ7jNs-+5kQpfEBw26ebaGpuyg@mail.gmail.com>
	<CAFED-jmD6r_c5rNvq1ugwV3Qr=CtQYeOROnvEdY3C2oEq83k7g@mail.gmail.com>
	<CAGnc4p_h+2ioMsoruLpSaySuynXpyODAboEP2qaAg+k9m75C-g@mail.gmail.com>
Message-ID: <20110910205821.GG12113@jm.kir.nu>

On Thu, Sep 01, 2011 at 04:18:47PM -0400, Matt Causey wrote:
> On Thu, Sep 1, 2011 at 3:53 PM, Janusz Dziedzic
> <janusz.dziedzic at gmail.com> wrote:
> > 2011/9/1 Matt Causey <matt.causey at gmail.com>:
> >> On Thu, Sep 1, 2011 at 1:17 AM, Janusz Dziedzic
> >> <janusz.dziedzic at gmail.com> wrote:
> >>> 2011/8/31 Matt Causey <matt.causey at gmail.com>:

> >>>> In our use case, we have a large number of access points and they can
> >>>> drop offline for maintenance periodically. ?What would folks recommend
> >>>> we do to keep these BSSID's from becoming permanently blacklisted just
> >>>> because they needed to reboot?

The blacklisting mechanism in wpa_supplicant is not "permanent". It is
only used to allow other APs to be used if an AP does not work (or much
more likely, is trying to use some proprietary load balancing
mechanism).

The problem that you are likely seeing is in the blacklist clearing
trigger not getting hit since there are other APs that are good enough
to work, but not really ideal for the particular station.

> >> This functionality as it stands is a show-stopper for us so I've
> >> commented out the call to wpa_blacklist_add()

Please be aware that disabling blacklisting and make the station not
behave in the way that some managed APs handle load balancing..

> >> ?I kind of wish that we could at least configure this behavior because
> >> it's pretty broken currently. ?I can see the rationale...the idea is
> >> that if a BSSID is impaired in some way, but is the strongest BSSID
> >> for a network, then clients will go there and have a bad experience.
> >> Unfortunately I think that the heuristic needs more work.

The BSS with the strongest signal strength may not to want to service
the specific station for load balancing reasons.. This was getting very
painful in some networks where wpa_supplicant continued to pick the
"best" AP and the AP just rejected association.. It could take ages to
get any kind of connectivity in such network.

> > In case of black_list ?- maybe good idea is to add time parameter for
> > each blacklisted AP.
> > In such case we could add APs to blacklist for specyfic amount of time
> > period. After this time APs will be removed from blacklist.

> I would agree with that.  It might also be useful to make that
> configurable rather than a compile-time option.

It sounds reasonable to clear the blacklist entry after some time at
least in the case the station gets connected to another AP (if it
doesn't, running out of options will clear the blacklist anyway).

> Even with a time value, though, I'm thinking that there will be some
> edge cases that we'll discover.  I am not sure that it's the
> supplicant's job, actually, to blacklist BSSIDs at all.  I would
> submit that if we have an ESSID with multiple BSSIDs in the first
> place, we're talking about an enterprise network or at the very least
> a network that should have some robust management in place.  And if a
> network like that has BSSID's out there that are broken, it isn't the
> client's job to work around that.  Roaming to another (uh, weaker)
> access point isn't really a solution.

Unfortunately those enterprise networks with "robust management" are
very unreliable from the view point of what a station sees as far as
IEEE 802.11 standard is concerned. Since there has not been a standard
mechanism for load balancing, many odd hacks have been developed to do
that. And yes, those BSSs look very much broken from the station
view point and many of these load balancing mechanisms result in the BSS
getting blacklisted (by design). I would disagree with the blacklisting
not believing in wpa_supplicant. It is very much part of the BSS
selection process that is within wpa_supplicant in the case of
mac80211-based drivers.

Roaming to a weaker AP is very much a solution in many cases when load
balancing is used. Sure, this should not break connectivity, so some
additional consideration is needed, but the station will have hard time
in many networks if it insist on only using the AP with strongest signal
strength.

> I'm just curious...what was the failure mode that precipitated the
> blacklist feature enhancement to wpa_supplicant?

There are two main reasons for it: load balancing in enterprise networks
and AP selection for WPS.

-- 
Jouni Malinen                                            PGP id EFC895FA


From 715546252  Sat Sep 10 15:27:19 2011
From: 715546252 (=?ISO-8859-1?B?d2h5?=)
Date: Sun, 11 Sep 2011 06:27:19 +0800
Subject: About "non WPA network not allowed"
Message-ID: <tencent_366E09340099A67A5F60F30B@qq.com>

Hello, I'm new to hostapd and wpa_supplicant. I have a few question to ask about EAP-SIM and the "non WPA network not allowed".

1.My hostapd.conf is:
interface=wlan0
bridge=br0
driver=nl80211
ssid=eap-sim
hw_mode=g
channel=1
auth_algs=3
ieee8021x=1
eapol_version=1
eap_server=1
eap_user_file=./hostapd.eap_user
eap_sim_db=unix:/tmp/hlr_auc_gw.sock
radius_server_clients=./hostapd.radius_clients
radius_server_auth_port=1812
2.My hostapd.eap_user is:
# Wildcard for all other identities
*        SIM    #PEAP,TTLS,TLS,SIM,AKA
"0"*        SIM    [2]
"1"*        SIM    [2]
"2"*        SIM    [2]
"3"*        SIM    [2]
"4"*        SIM    [2]
"5"*        SIM    [2]
3.I run the hlr_auc_gw and use the original hostapd_sim.db
4.My hostapd/.config is:
CONFIG_DRIVER_NL80211=y
CONFIG_EAP=y
CONFIG_PKCS12=y
CONFIG_RADIUS_SERVER=y
CONFIG_EAP_SIM=y
5.My wpa_supplicant/.config is:
CONFIG_DRIVER_HOSTAP=y
CONFIG_DRIVER_ATMEL=y
CONFIG_DRIVER_WEXT=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_WIRED=y
CONFIG_IEEE8021X_EAPOL=y
CONFIG_EAP_MD5=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_TLS=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TTLS=y
CONFIG_EAP_GTC=y
CONFIG_EAP_OTP=y
CONFIG_EAP_SIM=y
CONFIG_EAP_LEAP=y
CONFIG_PCSC=y
CONFIG_CTRL_IFACE=y
CONFIG_BACKEND=file
CONFIG_PEERKEY=y
6.My wpa_sim.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
ap_scan=0
eapol_version=1
# EAP-SIM with a GSM SIM or USIM
network={
ssid="epa-sim"
key_mgmt=WPA-EAP
eap=SIM
pin="1234"
pcsc=""
eapol_flags=0
}
7. I run "sudo ./wpa_supplicant -dd -D nl80211 -i wlan0 -c wpa_sim.conf"
8.The output is:

  Setting scan request: 0 sec 100000 usec
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
Added interface wlan1
RTM_NEWLINK: operstate=0 ifi_flags=0x1043 ([UP][RUNNING])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan1' added
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan1' added
State: DISCONNECTED -&gt; SCANNING
Starting AP scan for wildcard SSID
nl80211: Scan SSID - hexdump_ascii(len=0): [NULL]
Scan requested (ret=0) - scan timeout 10 seconds
nl80211: Event message available
nl80211: Scan trigger
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
nl80211: Event message available
nl80211: New scan results available
Received scan results (4 BSSes)
BSS: Start scan result update 1
BSS: Add new id 0 BSSID 00:1a:1e:d2:6d:90 SSID 'NCRL'
BSS: Add new id 1 BSSID c8:3a:35:10:2f:d8 SSID 'Tenda'
BSS: Add new id 2 BSSID 00:0b:86:20:cc:20 SSID 'rcls-wlan'
BSS: Add new id 3 BSSID 00:14:78:71:42:67 SSID 'eap-sim'
New scan results available
Selecting BSS from priority group 0
Try to find WPA-enabled AP
0: 00:1a:1e:d2:6d:90 ssid='NCRL' wpa_ie_len=22 rsn_ie_len=0 caps=0x431
   skip - SSID mismatch
1: c8:3a:35:10:2f:d8 ssid='Tenda' wpa_ie_len=22 rsn_ie_len=20 caps=0x11
   skip - SSID mismatch
2: 00:0b:86:20:cc:20 ssid='rcls-wlan' wpa_ie_len=0 rsn_ie_len=0 caps=0x431
   skip - no WPA/RSN IE
3: 00:14:78:71:42:67 ssid='eap-sim' wpa_ie_len=0 rsn_ie_len=0 caps=0x401
   skip - no WPA/RSN IE
Try to find non-WPA AP
0: 00:1a:1e:d2:6d:90 ssid='NCRL' wpa_ie_len=22 rsn_ie_len=0 caps=0x431
   skip - SSID mismatch
1: c8:3a:35:10:2f:d8 ssid='Tenda' wpa_ie_len=22 rsn_ie_len=20 caps=0x11
   skip - SSID mismatch
2: 00:0b:86:20:cc:20 ssid='rcls-wlan' wpa_ie_len=0 rsn_ie_len=0 caps=0x431
   skip - SSID mismatch
3: 00:14:78:71:42:67 ssid='eap-sim' wpa_ie_len=0 rsn_ie_len=0 caps=0x401
   skip - non-WPA network not allowed
No suitable network found
9.Where is wrong? How should I correct? Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110911/07d77719/attachment-0001.htm 


From kel  Sat Sep 10 16:32:41 2011
From: kel (Kel Modderman)
Date: Sun, 11 Sep 2011 09:32:41 +1000
Subject: [PATCH] wpa_gui-qt4: improve scan results signal display
Message-ID: <201109110932.42006.kel@otaku42.de>

Display signal strength in dBm with visual indicator in the form
of a bar for scan results displayed by wpa_gui-qt4. Any signal > -35dBm is
treated as full signal bar, signals between range of -95<->-35dBm are
displayed linearly. Convert WEXT signal level value to scale that nl80211
typically reports in dBm. The condition which differentiates 8-bit WEXT dBm
and regular dBm is probably fragile, but there is currently no way to know
what the driver is going to report for signal strength.

This patch is tested with 0.7.3 and also applies to hostapd.git

See also:
 http://mail.gnome.org/archives/networkmanager-list/2009-November/msg00003.html
 http://lists.shmoo.com/pipermail/hostap/2009-April/019682.html

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
@@ -15,6 +15,7 @@
 #include <cstdio>
 
 #include "scanresults.h"
+#include "signalbar.h"
 #include "wpagui.h"
 #include "networkconfig.h"
 
@@ -33,6 +34,7 @@ ScanResults::ScanResults(QWidget *parent
 	wpagui = NULL;
 	scanResultsWidget->setItemsExpandable(FALSE);
 	scanResultsWidget->setRootIsDecorated(FALSE);
+	scanResultsWidget->setItemDelegate(new SignalBar(scanResultsWidget));
 }
 
 
@@ -91,7 +93,7 @@ void ScanResults::updateResults()
 				bssid = (*it).mid(pos);
 			else if ((*it).startsWith("freq="))
 				freq = (*it).mid(pos);
-			else if ((*it).startsWith("qual="))
+			else if ((*it).startsWith("level="))
 				signal = (*it).mid(pos);
 			else if ((*it).startsWith("flags="))
 				flags = (*it).mid(pos);
--- /dev/null
+++ b/wpa_supplicant/wpa_gui-qt4/signalbar.h
@@ -0,0 +1,34 @@
+/*
+ * wpa_gui - SignalBar class
+ * Copyright (c) 2011, Kel Modderman <kel at otaku42.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef SIGNALBAR_H
+#define SIGNALBAR_H
+
+#include <QObject>
+#include <QStyledItemDelegate>
+
+class SignalBar : public QStyledItemDelegate
+{
+	Q_OBJECT
+
+public:
+	SignalBar(QObject *parent = 0);
+	~SignalBar();
+
+	virtual void paint(QPainter *painter,
+			   const QStyleOptionViewItem &option,
+			   const QModelIndex &index) const ;
+};
+
+#endif /* SIGNALBAR_H */
--- /dev/null
+++ b/wpa_supplicant/wpa_gui-qt4/signalbar.cpp
@@ -0,0 +1,64 @@
+/*
+ * wpa_gui - SignalBar class
+ * Copyright (c) 2011, Kel Modderman <kel at otaku42.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include <cstdio>
+#include <qapplication.h>
+
+#include "signalbar.h"
+
+
+SignalBar::SignalBar(QObject *parent)
+	: QStyledItemDelegate(parent)
+{
+}
+
+
+SignalBar::~SignalBar()
+{
+}
+
+
+void SignalBar::paint(QPainter *painter,
+		      const QStyleOptionViewItem &option,
+		      const QModelIndex &index) const
+{
+	QStyleOptionProgressBar opts;
+	int signal;
+
+	if (index.column() != 3) {
+		QStyledItemDelegate::paint(painter, option, index);
+		return;
+	}
+
+	if (index.data().toInt() > 0)
+		signal = 0 - (256 - index.data().toInt());
+	else
+		signal = index.data().toInt();
+
+	opts.minimum = -95;
+	opts.maximum = -35;
+	if (signal < opts.minimum)
+		opts.progress = opts.minimum;
+	else if (signal > opts.maximum)
+		opts.progress = opts.maximum;
+	else
+		opts.progress = signal;
+
+	opts.text = QString::number(signal) + " dBm";
+	opts.textVisible = true;
+	opts.rect = option.rect;
+
+	QApplication::style()->drawControl(QStyle::CE_ProgressBar,
+					   &opts, painter);
+}
--- a/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
+++ b/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
@@ -34,6 +34,7 @@ HEADERS	+= wpamsg.h \
 	wpagui.h \
 	eventhistory.h \
 	scanresults.h \
+	signalbar.h \
 	userdatarequest.h \
 	networkconfig.h \
 	addinterface.h \
@@ -44,6 +45,7 @@ SOURCES	+= main.cpp \
 	wpagui.cpp \
 	eventhistory.cpp \
 	scanresults.cpp \
+	signalbar.cpp \
 	userdatarequest.cpp \
 	networkconfig.cpp \
 	addinterface.cpp \


From mctiew  Sat Sep 10 17:15:47 2011
From: mctiew (Ming-Ching Tiew)
Date: Sat, 10 Sep 2011 17:15:47 -0700 (PDT)
Subject: hostapd 0.7.3 can't read private key generated by openssl ?
Message-ID: <1315700147.70396.YahooMailClassic@web161426.mail.bf1.yahoo.com>

I used  the openssl generated private key with hostapd 0.7.3 ( actually libeap.so ). But when I configure tls private_key to use openssl generated server.key or server.pem, it says :-

PKCS #5: unsupported  algorithm 1.2.840.113549.1.5.13

The server.key is generated using a bootstrap shell script from freeradius. If I can't tweak hostapd to read this, can I tweak the bootstrap shell script to use other algorithms supported by hostapd 0.7.3 ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server.cnf
Type: application/octet-stream
Size: 1123 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110910/33c9ba8e/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bootstrap
Type: application/octet-stream
Size: 2693 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110910/33c9ba8e/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server.key
Type: application/pgp-keys
Size: 1834 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110910/33c9ba8e/attachment.key 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server.pem
Type: application/octet-stream
Size: 3586 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110910/33c9ba8e/attachment-0002.obj 


From mctiew  Sat Sep 10 21:13:28 2011
From: mctiew (Ming-Ching Tiew)
Date: Sat, 10 Sep 2011 21:13:28 -0700 (PDT)
Subject: hostapd 0.7.3 can't read private key generated by openssl ?
In-Reply-To: <1315700147.70396.YahooMailClassic@web161426.mail.bf1.yahoo.com>
Message-ID: <1315714408.77673.YahooMailClassic@web161424.mail.bf1.yahoo.com>



--- On Sun, 9/11/11, Ming-Ching Tiew <mctiew at yahoo.com> wrote:

> If I can't tweak hostapd to read this, can
> I tweak the bootstrap shell script to use other algorithms
> supported by hostapd 0.7.3 ?

Ignore this as I have tweaked hostapd (libeap.so ) to use CONFIG_TLS=openssl, and that fixed the problem. 


From 715546252  Sat Sep 10 21:37:58 2011
From: 715546252 (=?ISO-8859-1?B?d2h5?=)
Date: Sun, 11 Sep 2011 12:37:58 +0800
Subject: [SPAM] About "SIM triplets"
Message-ID: <tencent_76EDA84C3D4F89521FDB0ED3@qq.com>

Hello, I want to use eapol_test to test the EAP-SIM and have some questions.
1.Does the  "<num  triplets>" mean rand, kc and sers and what's format(rand Kc sers)? Now I only know the IMSI and Ki, how can i get the "triplets"?
2.I use a SIM card reader and install the pcsc-lite. How should i use the pcscd in the wpa_supplicant(The PCSC dir is in /usr/local/include)?
Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110911/7f8a2270/attachment-0001.htm 


From j  Sun Sep 11 03:22:41 2011
From: j (Jouni Malinen)
Date: Sun, 11 Sep 2011 13:22:41 +0300
Subject: About "non WPA network not allowed"
In-Reply-To: <tencent_366E09340099A67A5F60F30B@qq.com>
References: <tencent_366E09340099A67A5F60F30B@qq.com>
Message-ID: <20110911102241.GA3036@jm.kir.nu>

On Sun, Sep 11, 2011 at 06:27:19AM +0800, why wrote:
> Hello, I'm new to hostapd and wpa_supplicant. I have a few question to ask about EAP-SIM and the "non WPA network not allowed".

> 1.My hostapd.conf is:
> auth_algs=3
> ieee8021x=1
> eapol_version=1
> eap_server=1

You seem to have configured hostapd for IEEE 802.1X without any kind of
encryption.

> 6.My wpa_sim.conf
> key_mgmt=WPA-EAP

While wpa_supplicant is configured to require WPA-Enterprise.

> 7. I run "sudo ./wpa_supplicant -dd -D nl80211 -i wlan0 -c wpa_sim.conf"

> 3: 00:14:78:71:42:67 ssid='eap-sim' wpa_ie_len=0 rsn_ie_len=0 caps=0x401
>    skip - non-WPA network not allowed
> No suitable network found

And because of the configuration mismatch, wpa_supplicant does not
accept the network.

> 9.Where is wrong? How should I correct? Thank you very much!

Assuming you were trying to use WPA on the AP, you would need to add
wpa_key_mgmt=WPA-EAP into hostapd.conf.

-- 
Jouni Malinen                                            PGP id EFC895FA


From aland  Sun Sep 11 03:32:33 2011
From: aland (Alan DeKok)
Date: Sun, 11 Sep 2011 12:32:33 +0200
Subject: Build errors with eapol_test
Message-ID: <4E6C8E41.9020505@deployingradius.com>

  I'm trying to build eapol_test on a system without -lnl.  By default,
LIBS includes DRV_BOTH_LIBS, which aren't needed for eapol_test.

  I've added a LIBS_t which includes only the relevant libraries, and
used it for eapol_test.

  Alan DeKok.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Create-and-use-LIBS_t-for-eapol_test.patch
Url: http://lists.shmoo.com/pipermail/hostap/attachments/20110911/c8133b2d/attachment.txt 


From aland  Sun Sep 11 03:28:05 2011
From: aland (Alan T. DeKok)
Date: Sun, 11 Sep 2011 12:28:05 +0200
Subject: [PATCH] Create and use LIBS_t for eapol_test
Message-ID: <mailman.45.1315737162.8029.hostap@lists.shmoo.com>

So that the various hardware drivers are not included.
---
 wpa_supplicant/Makefile |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index de4d6ad..6686848 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -83,6 +83,20 @@ OBJS += ../src/utils/os_$(CONFIG_OS).o
 OBJS_p += ../src/utils/os_$(CONFIG_OS).o
 OBJS_c += ../src/utils/os_$(CONFIG_OS).o
 
+ifdef CONFIG_IEEE8021X_EAPOL
+# IEEE 802.1X/EAPOL state machines (e.g., for RADIUS authentication)
+CFLAGS += -DIEEE8021X_EAPOL
+OBJS += ../src/eapol_supp/eapol_supp_sm.o
+OBJS += ../src/eap_peer/eap.o ../src/eap_peer/eap_methods.o
+NEED_EAP_COMMON=y
+ifdef CONFIG_DYNAMIC_EAP_METHODS
+CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
+LIBS += -ldl -rdynamic
+endif
+endif
+
+LIBS_t := $(LIBS)
+
 ifdef CONFIG_WPA_TRACE
 CFLAGS += -DWPA_TRACE
 OBJS += ../src/utils/trace.o
@@ -637,18 +651,6 @@ endif
 endif
 endif
 
-ifdef CONFIG_IEEE8021X_EAPOL
-# IEEE 802.1X/EAPOL state machines (e.g., for RADIUS authentication)
-CFLAGS += -DIEEE8021X_EAPOL
-OBJS += ../src/eapol_supp/eapol_supp_sm.o
-OBJS += ../src/eap_peer/eap.o ../src/eap_peer/eap_methods.o
-NEED_EAP_COMMON=y
-ifdef CONFIG_DYNAMIC_EAP_METHODS
-CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
-LIBS += -ldl -rdynamic
-endif
-endif
-
 ifdef CONFIG_AP
 NEED_80211_COMMON=y
 NEED_EAP_COMMON=y
@@ -811,6 +813,7 @@ ifdef TLS_FUNCS
 CFLAGS += -DEAP_TLS_OPENSSL
 OBJS += ../src/crypto/tls_openssl.o
 LIBS += -lssl
+LIBS_t += -lssl
 endif
 OBJS += ../src/crypto/crypto_openssl.o
 OBJS_p += ../src/crypto/crypto_openssl.o
@@ -819,6 +822,7 @@ OBJS += ../src/crypto/fips_prf_openssl.o
 endif
 LIBS += -lcrypto
 LIBS_p += -lcrypto
+LIBS_t += -lcrypto
 endif
 
 ifeq ($(CONFIG_TLS), gnutls)
@@ -828,6 +832,7 @@ LIBS += -lgnutls -lgpg-error
 ifdef CONFIG_GNUTLS_EXTRA
 CFLAGS += -DCONFIG_GNUTLS_EXTRA
 LIBS += -lgnutls-extra
+LIBS_t += -lgnutls-extra
 endif
 endif
 OBJS += ../src/crypto/crypto_gnutls.o
@@ -837,6 +842,7 @@ OBJS += ../src/crypto/fips_prf_gnutls.o
 endif
 LIBS += -lgcrypt
 LIBS_p += -lgcrypt
+LIBS_t += -lgcrypt
 CONFIG_INTERNAL_SHA256=y
 CONFIG_INTERNAL_RC4=y
 CONFIG_INTERNAL_DH_GROUP5=y
@@ -860,6 +866,7 @@ ifeq ($(CONFIG_TLS), nss)
 ifdef TLS_FUNCS
 OBJS += ../src/crypto/tls_nss.o
 LIBS += -lssl3
+LIBS_t += -lssl3
 endif
 OBJS += ../src/crypto/crypto_nss.o
 OBJS_p += ../src/crypto/crypto_nss.o
@@ -868,6 +875,7 @@ OBJS += ../src/crypto/fips_prf_nss.o
 endif
 LIBS += -lnss3
 LIBS_p += -lnss3
+LIBS_t += -lnss3
 CONFIG_INTERNAL_MD4=y
 CONFIG_INTERNAL_DH_GROUP5=y
 endif
@@ -911,6 +919,7 @@ OBJS += ../src/crypto/crypto_libtomcrypt.o
 OBJS_p += ../src/crypto/crypto_libtomcrypt.o
 LIBS += -ltomcrypt -ltfm
 LIBS_p += -ltomcrypt -ltfm
+LIBS_t += -ltomcrypt -ltfm
 CONFIG_INTERNAL_SHA256=y
 CONFIG_INTERNAL_RC4=y
 CONFIG_INTERNAL_DH_GROUP5=y
@@ -928,6 +937,7 @@ endif
 else
 LIBS += -ltommath
 LIBS_p += -ltommath
+LIBS_t += -ltommath
 endif
 CONFIG_INTERNAL_AES=y
 CONFIG_INTERNAL_DES=y
@@ -966,6 +976,7 @@ ifdef CONFIG_SMARTCARD
 ifndef CONFIG_NATIVE_WINDOWS
 ifneq ($(CONFIG_L2_PACKET), freebsd)
 LIBS += -ldl
+LIBS_t += -ldl
 endif
 endif
 endif
@@ -1197,8 +1208,10 @@ CFLAGS += -DCONFIG_NATIVE_WINDOWS
 LIBS += -lws2_32 -lgdi32 -lcrypt32
 LIBS_c += -lws2_32
 LIBS_p += -lws2_32 -lgdi32
+LIBS_t += -lws2_32 -lgdi32
 ifeq ($(CONFIG_CRYPTO), cryptoapi)
 LIBS_p += -lcrypt32
+LIBS_t += -lcrypt32
 endif
 endif
 
@@ -1376,7 +1389,7 @@ wpa_supplicant: .config $(BCHECK) $(OBJS) $(EXTRA_progs)
 	@$(E) "  LD " $@
 
 eapol_test: .config $(OBJS_t)
-	$(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS)
+	$(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS_t)
 	@$(E) "  LD " $@
 
 preauth_test: .config $(OBJS_t2) 
-- 
1.7.4.1


--------------040803010209060801080004--


From johannes  Sun Sep 11 07:15:13 2011
From: johannes (Johannes Berg)
Date: Sun, 11 Sep 2011 16:15:13 +0200
Subject: [RFC/RFT] driver_nl80211: automatically use concurrent P2P if
	possible
In-Reply-To: <20110910185602.GB8976@jm.kir.nu>
References: <1315425043.4002.23.camel@jlt3.sipsolutions.net>
	<20110910185602.GB8976@jm.kir.nu>
Message-ID: <1315750513.7711.0.camel@jlt3.sipsolutions.net>

On Sat, 2011-09-10 at 21:56 +0300, Jouni Malinen wrote:
> On Wed, Sep 07, 2011 at 09:50:43PM +0200, Johannes Berg wrote:
> > Since the kernel can now advertise P2P concurrent
> > support by advertising interface combinations, we
> > can take advantage of that and automatically use
> > P2P_CONCURRENT / P2P_MGMT_AND_NON_P2P for drivers
> > that advertise support.
> 
> Hey, it builds.. Was that enough testing? ;-) I applied this. Let's see
> how that goes.

Maybe. I did actually test it too, but only the positive case where this
enables P2P -- I guess it doesn't really have a negative case though :)

johannes



From rmanohar  Sun Sep 11 07:41:11 2011
From: rmanohar (Rajkumar Manoharan)
Date: Sun, 11 Sep 2011 20:11:11 +0530
Subject: [PATCH 2/2] p2p: Use scan supported rate attr for p2p probing
In-Reply-To: <20110910194507.GA12113@jm.kir.nu>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
	<1315068711-8515-2-git-send-email-rmanohar@qca.qualcomm.com>
	<20110910194507.GA12113@jm.kir.nu>
Message-ID: <20110911144110.GA6938@vmraj-lnx.users.atheros.com>

On Sat, Sep 10, 2011 at 10:45:07PM +0300, Jouni Malinen wrote:
> On Sat, Sep 03, 2011 at 10:21:51PM +0530, Rajkumar Manoharan wrote:
> > This patch ensures that p2p probing does not use
> > 11b rates by setting supported rates in the scan
> > attributes.
> 
> Even though I did not apply the first patch, I ended up applying this
> since it is a step towards better design for disabling 802.11b rates for
> P2P use cases.
>
Thanks.
> > diff --git a/wpa_supplicant/mlme.c b/wpa_supplicant/mlme.c
> > @@ -2864,8 +2864,8 @@ int ieee80211_sta_req_scan(struct wpa_supplicant *wpa_s,
> > -	wpa_s->mlme.scan_skip_11b = 1; /* FIX: clear this is 11g is not
> > -					* supported */
> > +	if (params->p2p_probe)
> > +		wpa_s->mlme.scan_skip_11b = 1;
> 
> Though, I dropped this part since it has nothing to do with P2P and is
> still needed.
No. It can be dropped.

--
Rajkumar


From 715546252  Sun Sep 11 19:13:10 2011
From: 715546252 (=?ISO-8859-1?B?d2h5?=)
Date: Mon, 12 Sep 2011 10:13:10 +0800
Subject: [SPAM] About "SIM triplets"
Message-ID: <tencent_58E950BF6F845A766351E29F@qq.com>

Hello, I want to use eapol_test to test the EAP-SIM and have some questions.
1.Does the  "<num  triplets>" mean rand, kc and sers and what's format(rand Kc sers)? Now I only know the IMSI and Ki, how can i get the "triplets" by hostapd?
2.I use a SIM card reader and install the pcsc-lite. How should i use the pcscd in the wpa_supplicant(The PCSC dir is in /usr/local/include)?
Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110912/0f2ac8ca/attachment.htm 


From lists  Sun Sep 11 19:16:54 2011
From: lists (Christ Schlacta)
Date: Sun, 11 Sep 2011 19:16:54 -0700
Subject: [SPAM] About "SIM triplets"
In-Reply-To: <tencent_58E950BF6F845A766351E29F@qq.com>
References: <tencent_58E950BF6F845A766351E29F@qq.com>
Message-ID: <4E6D6B96.4050703@aarcane.org>

Please don't post multiple times.  Someone will eventually have the 
answer to your question, but as you've posted on the weekend, it's 
highly unlikely to be today.  Give it a week or two as you have a highly 
specialized question.  SOmeone will know.
On 9/11/2011 19:13, why wrote:
> Hello, I want to use eapol_test to test the EAP-SIM and have some 
> questions.
> 1.Does the  "<num  triplets>" mean rand, kc and sers and what's 
> format(rand Kc sers)? Now I only know the IMSI and Ki, how can i get 
> the "triplets" by hostapd?
> 2.I use a SIM card reader and install the pcsc-lite. How should i use 
> the pcscd in the wpa_supplicant(The PCSC dir is in /usr/local/include)?
> Thank you very much!
>
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110911/5d4a0339/attachment.htm 


From mctiew  Sun Sep 11 20:10:48 2011
From: mctiew (Ming-Ching Tiew)
Date: Sun, 11 Sep 2011 20:10:48 -0700 (PDT)
Subject: [SPAM] About "SIM triplets"
Message-ID: <1315797048.46315.YahooMailClassic@web161424.mail.bf1.yahoo.com>


--- On Mon, 9/12/11, why <715546252 at qq.com> wrote:

> Hello, I want to use eapol_test to test the EAP-SIM and have some questions.
> 1.Does the? "<num? triplets>" mean rand, kc and sers and what's format(rand Kc sers)? Now I only know the IMSI and Ki, how can i get the "triplets" by hostapd?

Just run it, it's very simple. 

example :-

$ eapol_test sim '' 5


If your SIM card is lock with PIN, you supply it in the commandline 
second parameter. 'num triplets' means how many times you want to triplets to be generated.

>
> 2.I use a SIM card reader and install the pcsc-lite. How should i use the > pcscd in the wpa_supplicant(The PCSC dir is in /usr/local/include)?
> Thank you very much!

Just run pcscd in /etc/init.d or /etc/rc.local to start it up.




From stefan.bauer  Mon Sep 12 00:35:03 2011
From: stefan.bauer (Stefan Bauer)
Date: Mon, 12 Sep 2011 09:35:03 +0200
Subject: hostapd + 802.1X + ath9k - random disconnects
Message-ID: <91f028bf586ab490051e6f59919f7067@plzk.de>

Dear Folks,

we're using openwrt Backfire (kernel 2.6.32.27) 10.03.1-RC5, r27608 on
atheros hardware with ath9k and discovering random wireless disconnects in
our 802.1x (win server 2008 - NDS/Radius) environment.
Please see the log attached - client (00:21:6a:78:d5:9e) just lost
wireless connectivity.

http://www.cubewerk.de/dl/hostapd.conf
http://www.cubewerk.de/dl/wlan.txt

Client is Windows 7  -64bit - Intel 5300 AGN hardware.

Any help is greatly appreciated.

Best regards

Stefan


From johannes  Mon Sep 12 01:58:26 2011
From: johannes (Johannes Berg)
Date: Mon, 12 Sep 2011 10:58:26 +0200
Subject: future wpa_s/hostapd release plans
In-Reply-To: <20110910203204.GE12113@jm.kir.nu>
References: <1314882627.4022.17.camel@jlt3.sipsolutions.net>
	<20110910203204.GE12113@jm.kir.nu>
Message-ID: <1315817906.3963.14.camel@jlt3.sipsolutions.net>

On Sat, 2011-09-10 at 23:32 +0300, Jouni Malinen wrote:
> On Thu, Sep 01, 2011 at 03:10:27PM +0200, Johannes Berg wrote:
> > Oh, and because this is a change, Jouni proposed calling the first one
> > that will come out of this "1.0" (first release 1.0.0), followed by
> > "1.1". (or did you mean 1.0 being the first release, followed by 2.0,
> > and fixes as 1.1, 1.2, ...?)
> 
> I think we could as well drop the extra value.. We've survived almost
> ten years without changing the "0." prefix in the version number, so
> clearly there has not been much need for it. In other words, we could
> fork hostap-1.git and release 1.0, 1.1, and so on from there and the
> next fork would be hostap-2.git with 2.0, 2.1, ...
> 
> And just to be clear on what the version numbers mean here, the 1.0
> version would actually map to the first stable release in the past
> (e.g., 0.7.3 in the case of 0.7.x branch). In other words, the
> development release concepts goes away (or well, the possible 1.0-rc1
> style releases could obviously be similar, but still, x.0 is the first
> "stable release").

That makes sense. -rc1 is certainly more intuitive than 0.7.1 :-)


> > Secondly, we don't have a fully functional test bed, so when/how do we
> > call what branched as 1.0 actually release-worthy? Jouni -- what's your
> > process there? Just "generally I'm happy"?
> 
> This has been pretty informal in the past, but things have been calming
> down in the stable branch for longer time before making the first stable
> release. I have usually tried to verify basic functionality for both AP
> (hostapd) and station (wpa_supplicant) functionality, but there has not
> really been extensive testing just for the purpose of being able to make
> a new release. I've also tried to run the source code through couple of
> static analysis tools before each release and address whatever issues
> show up. I should be able to do that with 1.0, too, once we get closer
> to the release time.
> 
> I have wanted to build an automated test setup for a long time, but
> haven't really ever found enough time to complete that.. In practice,
> there are number of projects that track hostap.git changes and run
> automated tests, so some testing gets done there. However, the separate
> release branch may actually get quite a bit less testing "by default"
> unless someone changes from tracking hostap.git to that branch.

Do you know who tracks hostap.git, and why? It would be interesting to
see if those projects would be interested in tracking hostap-N.git
instead or in addition. So far, I haven't seen anybody speak up here on
the list :-)

> For this particular 1.0 case, it would be nice to run through some P2P
> certification tests taken into account that P2P support is one of the
> largest changes between 0.7 and 1.0. In theory, I have a fully automated
> test setup for it, but it is not dedicated for this purpose, so I might
> as well call it manual.

That would be interesting, but I'm not sure I'd expect it to happen
before 1.0 is actually branched off. It could be part of the release
criteria for 1.0 in this case, but even there I'm not sure. I think we
might rather release 1.0 with P2P, get people started using that, and
then release 1.1 after fixing some bugs in certification? I don't really
know which approach is better though.

> I'm not sure whether I would actually be using the stable branch for
> projects that I'm involved with since I've already gotten very used to
> picking builds directly from hostap.git.. As such, the question of
> testing the release branch may fall more for those who are planning on
> using it until we have a fully automated testbed in place.

That's perfectly valid. I think at minimum we'd run some (more) P2P
tests and we do have basic functionality tests for our devices using
wpa_supplicant that we should be able to plug in a new version to.

johannems



From pek  Mon Sep 12 07:33:11 2011
From: pek (Per Ekman)
Date: Mon, 12 Sep 2011 16:33:11 +0200
Subject: [PATCH] Remove references to time_t/time()
Message-ID: <8739g1sue0.fsf@hd-wireless.se>

I encountered some more calls to time(). Would you consider removing the
<time.h> include from utils/includes.h? That would catch these
calls. With a vanilla build only os_unix.c complains and perhaps it
should include time.h directly.

As an aside, trunk does not seem to build without WPS enabled
because drv_callbacks.c:hostapd_notif_assoc() calls wps_is_20()
which is not compiled when WPS is disabled.

Sincerely
Per Ekman
H&D Wireless AB

---
 src/ap/accounting.c           |    5 +++--
 src/ap/ieee802_11_auth.c      |    9 ++++++---
 src/ap/ieee802_1x.c           |    4 +++-
 src/ap/tkip_countermeasures.c |    8 ++++----
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/ap/accounting.c b/src/ap/accounting.c
index 34079c1..bb4566b 100644
--- a/src/ap/accounting.c
+++ b/src/ap/accounting.c
@@ -236,6 +236,7 @@ static void accounting_interim_update(void *eloop_ctx, void *timeout_ctx)
 void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta)
 {
 	struct radius_msg *msg;
+	struct os_time t;
 	int interval;
 
 	if (sta->acct_session_started)
@@ -246,8 +247,8 @@ void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta)
 		       HOSTAPD_LEVEL_INFO,
 		       "starting accounting session %08X-%08X",
 		       sta->acct_session_id_hi, sta->acct_session_id_lo);
-
-	time(&sta->acct_session_start);
+	os_get_time(&t);
+	sta->acct_session_start = t.sec;
 	sta->last_rx_bytes = sta->last_tx_bytes = 0;
 	sta->acct_input_gigawords = sta->acct_output_gigawords = 0;
 	hostapd_drv_sta_clear_stats(hapd, sta->addr);
diff --git a/src/ap/ieee802_11_auth.c b/src/ap/ieee802_11_auth.c
index b863b60..15e7c5e 100644
--- a/src/ap/ieee802_11_auth.c
+++ b/src/ap/ieee802_11_auth.c
@@ -241,7 +241,7 @@ int hostapd_allowed_address(struct hostapd_data *hapd, const u8 *addr,
 		return HOSTAPD_ACL_REJECT;
 #else /* CONFIG_NO_RADIUS */
 		struct hostapd_acl_query_data *query;
-
+		struct os_time t;
 		/* Check whether ACL cache has an entry for this station */
 		int res = hostapd_acl_cache_get(hapd, addr, session_timeout,
 						acct_interim_interval,
@@ -271,7 +271,8 @@ int hostapd_allowed_address(struct hostapd_data *hapd, const u8 *addr,
 			wpa_printf(MSG_ERROR, "malloc for query data failed");
 			return HOSTAPD_ACL_REJECT;
 		}
-		time(&query->timestamp);
+		os_get_time(&t);
+		query->timestamp = t.sec;
 		os_memcpy(query->addr, addr, ETH_ALEN);
 		if (hostapd_radius_acl_query(hapd, addr, query)) {
 			wpa_printf(MSG_DEBUG, "Failed to send Access-Request "
@@ -396,6 +397,7 @@ hostapd_acl_recv_radius(struct radius_msg *msg, struct radius_msg *req,
 	struct hostapd_acl_query_data *query, *prev;
 	struct hostapd_cached_radius_acl *cache;
 	struct radius_hdr *hdr = radius_msg_get_hdr(msg);
+	struct os_time t;
 
 	query = hapd->acl_queries;
 	prev = NULL;
@@ -430,7 +432,8 @@ hostapd_acl_recv_radius(struct radius_msg *msg, struct radius_msg *req,
 		wpa_printf(MSG_DEBUG, "Failed to add ACL cache entry");
 		goto done;
 	}
-	time(&cache->timestamp);
+	os_get_time(&t);
+	cache->timestamp = t.sec;
 	os_memcpy(cache->addr, query->addr, sizeof(cache->addr));
 	if (hdr->code == RADIUS_CODE_ACCESS_ACCEPT) {
 		if (radius_msg_get_attr_int32(msg, RADIUS_ATTR_SESSION_TIMEOUT,
diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index ea8ca11..e4ca2eb 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1923,6 +1923,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
 {
 	int len = 0, ret;
 	struct eapol_state_machine *sm = sta->eapol_sm;
+	struct os_time t;;
 
 	if (sm == NULL)
 		return 0;
@@ -2037,6 +2038,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
 	len += ret;
 
 	/* dot1xAuthSessionStatsTable */
+	os_get_time(&t);
 	ret = os_snprintf(buf + len, buflen - len,
 			  /* TODO: dot1xAuthSessionOctetsRx */
 			  /* TODO: dot1xAuthSessionOctetsTx */
@@ -2051,7 +2053,7 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
 			  (wpa_key_mgmt_wpa_ieee8021x(
 				   wpa_auth_sta_key_mgmt(sta->wpa_sm))) ?
 			  1 : 2,
-			  (unsigned int) (time(NULL) -
+			  (unsigned int) (t.sec -
 					  sta->acct_session_start),
 			  sm->identity);
 	if (ret < 0 || (size_t) ret >= buflen - len)
diff --git a/src/ap/tkip_countermeasures.c b/src/ap/tkip_countermeasures.c
index 1925217..38e0b2b 100644
--- a/src/ap/tkip_countermeasures.c
+++ b/src/ap/tkip_countermeasures.c
@@ -62,7 +62,7 @@ static void ieee80211_tkip_countermeasures_start(struct hostapd_data *hapd)
 
 void michael_mic_failure(struct hostapd_data *hapd, const u8 *addr, int local)
 {
-	time_t now;
+	struct os_time now;
 
 	if (addr && local) {
 		struct sta_info *sta = ap_get_sta(hapd, addr);
@@ -82,13 +82,13 @@ void michael_mic_failure(struct hostapd_data *hapd, const u8 *addr, int local)
 		}
 	}
 
-	time(&now);
-	if (now > hapd->michael_mic_failure + 60) {
+	os_get_time(&now);
+	if (now.sec > hapd->michael_mic_failure + 60) {
 		hapd->michael_mic_failures = 1;
 	} else {
 		hapd->michael_mic_failures++;
 		if (hapd->michael_mic_failures > 1)
 			ieee80211_tkip_countermeasures_start(hapd);
 	}
-	hapd->michael_mic_failure = now;
+	hapd->michael_mic_failure = now.sec;
 }
-- 
1.7.0.4


From sjscott007  Mon Sep 12 08:27:51 2011
From: sjscott007 (Steve Scott)
Date: Mon, 12 Sep 2011 08:27:51 -0700 (PDT)
Subject: RSI
Message-ID: <1315841271.42979.YahooMailClassic@web65912.mail.ac4.yahoo.com>

Does anyone know why a query on for signal strength always returns zero?  It happens in my own code the the wpa GUI.

Thanks,

Steve


From greearb  Mon Sep 12 09:14:55 2011
From: greearb (Ben Greear)
Date: Mon, 12 Sep 2011 09:14:55 -0700
Subject: future wpa_s/hostapd release plans
In-Reply-To: <1315817906.3963.14.camel@jlt3.sipsolutions.net>
References: <1314882627.4022.17.camel@jlt3.sipsolutions.net>
	<20110910203204.GE12113@jm.kir.nu>
	<1315817906.3963.14.camel@jlt3.sipsolutions.net>
Message-ID: <4E6E2FFF.6090001@candelatech.com>

On 09/12/2011 01:58 AM, Johannes Berg wrote:
> On Sat, 2011-09-10 at 23:32 +0300, Jouni Malinen wrote:
>> On Thu, Sep 01, 2011 at 03:10:27PM +0200, Johannes Berg wrote:
>>> Oh, and because this is a change, Jouni proposed calling the first one
>>> that will come out of this "1.0" (first release 1.0.0), followed by
>>> "1.1". (or did you mean 1.0 being the first release, followed by 2.0,
>>> and fixes as 1.1, 1.2, ...?)
>>
>> I think we could as well drop the extra value.. We've survived almost
>> ten years without changing the "0." prefix in the version number, so
>> clearly there has not been much need for it. In other words, we could
>> fork hostap-1.git and release 1.0, 1.1, and so on from there and the
>> next fork would be hostap-2.git with 2.0, 2.1, ...
>>
>> And just to be clear on what the version numbers mean here, the 1.0
>> version would actually map to the first stable release in the past
>> (e.g., 0.7.3 in the case of 0.7.x branch). In other words, the
>> development release concepts goes away (or well, the possible 1.0-rc1
>> style releases could obviously be similar, but still, x.0 is the first
>> "stable release").
>
> That makes sense. -rc1 is certainly more intuitive than 0.7.1 :-)
>
>
>>> Secondly, we don't have a fully functional test bed, so when/how do we
>>> call what branched as 1.0 actually release-worthy? Jouni -- what's your
>>> process there? Just "generally I'm happy"?
>>
>> This has been pretty informal in the past, but things have been calming
>> down in the stable branch for longer time before making the first stable
>> release. I have usually tried to verify basic functionality for both AP
>> (hostapd) and station (wpa_supplicant) functionality, but there has not
>> really been extensive testing just for the purpose of being able to make
>> a new release. I've also tried to run the source code through couple of
>> static analysis tools before each release and address whatever issues
>> show up. I should be able to do that with 1.0, too, once we get closer
>> to the release time.
>>
>> I have wanted to build an automated test setup for a long time, but
>> haven't really ever found enough time to complete that.. In practice,
>> there are number of projects that track hostap.git changes and run
>> automated tests, so some testing gets done there. However, the separate
>> release branch may actually get quite a bit less testing "by default"
>> unless someone changes from tracking hostap.git to that branch.
>
> Do you know who tracks hostap.git, and why? It would be interesting to
> see if those projects would be interested in tracking hostap-N.git
> instead or in addition. So far, I haven't seen anybody speak up here on
> the list :-)

I track it, and carry the patches I've previously posted.  Primarily optimizations
that help with lots of virtual interfaces.

I'll probably keep tracking the upstream development tree in hopes that one day
I can get my patches merged....

Thanks,
Ben

-- 
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


From j  Mon Sep 12 11:42:51 2011
From: j (Jouni Malinen)
Date: Mon, 12 Sep 2011 21:42:51 +0300
Subject: future wpa_s/hostapd release plans
In-Reply-To: <1315817906.3963.14.camel@jlt3.sipsolutions.net>
References: <1314882627.4022.17.camel@jlt3.sipsolutions.net>
	<20110910203204.GE12113@jm.kir.nu>
	<1315817906.3963.14.camel@jlt3.sipsolutions.net>
Message-ID: <20110912184251.GA30467@jm.kir.nu>

On Mon, Sep 12, 2011 at 10:58:26AM +0200, Johannes Berg wrote:
> Do you know who tracks hostap.git, and why? It would be interesting to
> see if those projects would be interested in tracking hostap-N.git
> instead or in addition. So far, I haven't seen anybody speak up here on
> the list :-)

Well, I know that I do in most projects ;-). There are others, but I'm
not sure how much of that is public, so I leave that for others to
comment.

> That would be interesting, but I'm not sure I'd expect it to happen
> before 1.0 is actually branched off. It could be part of the release
> criteria for 1.0 in this case, but even there I'm not sure. I think we
> might rather release 1.0 with P2P, get people started using that, and
> then release 1.1 after fixing some bugs in certification? I don't really
> know which approach is better though.

I was indeed thinking of P2P testing for the actual release, not as a
criterion for the branch. Anyway, I don't have any strong reason to
require 1.0 to pass any specific set of tests.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Sep 12 11:50:00 2011
From: j (Jouni Malinen)
Date: Mon, 12 Sep 2011 21:50:00 +0300
Subject: Build errors with eapol_test
In-Reply-To: <4E6C8E41.9020505@deployingradius.com>
References: <4E6C8E41.9020505@deployingradius.com>
Message-ID: <20110912185000.GB30467@jm.kir.nu>

On Sun, Sep 11, 2011 at 12:32:33PM +0200, Alan DeKok wrote:
>   I'm trying to build eapol_test on a system without -lnl.  By default,
> LIBS includes DRV_BOTH_LIBS, which aren't needed for eapol_test.
> 
>   I've added a LIBS_t which includes only the relevant libraries, and
> used it for eapol_test.

How did you configure the build? While in theory this LIBS_t mechanism
could be more accurate on eapol_test library needs, it is extra
complexity in already way too complex Makefile.. All you need to do is
remove CONFIG_DRIVER_NL80211=y in wpa_supplicant/.config if you want to
build without libnl.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Sep 12 11:53:23 2011
From: j (Jouni Malinen)
Date: Mon, 12 Sep 2011 21:53:23 +0300
Subject: hostapd + 802.1X + ath9k - random disconnects
In-Reply-To: <91f028bf586ab490051e6f59919f7067@plzk.de>
References: <91f028bf586ab490051e6f59919f7067@plzk.de>
Message-ID: <20110912185323.GC30467@jm.kir.nu>

On Mon, Sep 12, 2011 at 09:35:03AM +0200, Stefan Bauer wrote:
> we're using openwrt Backfire (kernel 2.6.32.27) 10.03.1-RC5, r27608 on
> atheros hardware with ath9k and discovering random wireless disconnects in
> our 802.1x (win server 2008 - NDS/Radius) environment.
> Please see the log attached - client (00:21:6a:78:d5:9e) just lost
> wireless connectivity.
> 
> http://www.cubewerk.de/dl/hostapd.conf
> http://www.cubewerk.de/dl/wlan.txt
> 
> Client is Windows 7  -64bit - Intel 5300 AGN hardware.

For hostapd, everything looks fine.. The station completes
authentication (on each attempt) and just decides to re-connect for some
reason. You would need to debug the station to figure out why it decides
to reauthenticate..

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Sep 12 12:00:14 2011
From: j (Jouni Malinen)
Date: Mon, 12 Sep 2011 22:00:14 +0300
Subject: Accounting responce User-Name attribute
In-Reply-To: <191841d07f2e3e636d7349f020ae6316b084817b@mail.qip.ru>
References: <191841d07f2e3e636d7349f020ae6316b084817b@mail.qip.ru>
Message-ID: <20110912190014.GD30467@jm.kir.nu>

On Sun, Aug 28, 2011 at 02:37:17AM +0400, newuse at qip.ru wrote:
> Hi all, I am new to PEAP, RADIUS and hostapd, but is it normal, if in supplicant anonymous_identity is set to "anonymous at myisp.com", in accounting packets  "anonymous at myisp.com"  is use as User-Name attribute instead of real User-Name?

Yes, that is expected. The AP/Authenticator does not even know the real
identity since it is sent within the encrypted tunnel.

> Is there any possibility to disable this?

What are you trying to achieve? Many RADIUS servers can internally
resolve the inner identity and use that in accounting records without
having to expose that information to the APs, e.g., with RADIUS Class
attribute. If you really want to expose the real User-Name to the AP and
in the unencrypted Accounting-Request messages, you can configure the
RADIUS authentication server to return the real identity in
Access-Accept message to make hostapd copy it into the accounting
messages.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Sep 12 12:27:19 2011
From: j (Jouni Malinen)
Date: Mon, 12 Sep 2011 22:27:19 +0300
Subject: [PATCH] Remove references to time_t/time()
In-Reply-To: <8739g1sue0.fsf@hd-wireless.se>
References: <8739g1sue0.fsf@hd-wireless.se>
Message-ID: <20110912192719.GE30467@jm.kir.nu>

On Mon, Sep 12, 2011 at 04:33:11PM +0200, Per Ekman wrote:
> I encountered some more calls to time().

Thanks, applied.

> Would you consider removing the
> <time.h> include from utils/includes.h? That would catch these
> calls. With a vanilla build only os_unix.c complains and perhaps it
> should include time.h directly.

There are couple of other files that need time.h for functions that do
not have os_*() wrappers. Anyway, those can include time.h directly, so
yes, I did remove time.h from includes.h. It should be noted that
sys/time.h is also getting included there, but that had some more ifdef
processing around it, so I did not want to move that to os_unix.c.

> As an aside, trunk does not seem to build without WPS enabled
> because drv_callbacks.c:hostapd_notif_assoc() calls wps_is_20()
> which is not compiled when WPS is disabled.

Thanks! Fixed.

-- 
Jouni Malinen                                            PGP id EFC895FA


From gokulnatha  Mon Sep 12 13:22:41 2011
From: gokulnatha (gokulnath A)
Date: Tue, 13 Sep 2011 01:52:41 +0530 (IST)
Subject: No subject
Message-ID: <1315858961.91927.YahooMailMobile@web94813.mail.in2.yahoo.com>

http://www.jasonvana.com/wp-content/uploads/img.php?html45
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110913/08bbdec5/attachment.htm 


From mctiew  Tue Sep 13 08:01:07 2011
From: mctiew (Ming-Ching Tiew)
Date: Tue, 13 Sep 2011 08:01:07 -0700 (PDT)
Subject: eap_sim_db not configured
Message-ID: <1315926067.15925.YahooMailClassic@web161424.mail.bf1.yahoo.com>

While trying to use hostapd ( libeap.so ) as a library, I encountered this error :-

? ? EAP-SIM: eap_sim_db not configured

Basically there is a variable inside one of the structure is found to be NULL. But I am not sure how it should be initialized and what is the significance.

Regards.



From angie.v.chinchilla  Tue Sep 13 09:27:29 2011
From: angie.v.chinchilla (Angie Chinchilla)
Date: Tue, 13 Sep 2011 09:27:29 -0700
Subject: [PATCH] D-Bus/P2P: treat PIN as string
Message-ID: <1315931249-1528-1-git-send-email-angie.v.chinchilla@intel.com>

From: Reinette Chatre <reinette.chatre at intel.com>

supplicant returns the PIN in reply to the connect method. Treating this
value as an integer runs the risk of not returning the correct value if the
first digit(s) happens to be a zero(es). To return the correct PIN it needs to be
returned as a string.

Signed-off-by: Reinette Chatre <reinette.chatre at intel.com>
Signed-off-by: Angie Chinchilla <angie.v.chinchilla at intel.com>
---
 wpa_supplicant/dbus/dbus_new.c              |    2 +-
 wpa_supplicant/dbus/dbus_new_handlers_p2p.c |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index e488937..4b7ae0d 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -2204,7 +2204,7 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 	  (WPADBusMethodHandler)wpas_dbus_handler_p2p_connect,
 	  {
 		  { "args", "a{sv}", ARG_IN },
-		  { "generated_pin", "i", ARG_OUT },
+		  { "generated_pin", "s", ARG_OUT },
 		  END_ARGS
 	  }
 	},
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 06e653e..3c1b414 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -501,9 +501,13 @@ DBusMessage * wpas_dbus_handler_p2p_connect(DBusMessage *message,
 				   go_intent, freq);
 
 	if (new_pin >= 0) {
+		char npin[9];
+		char *generated_pin;
+		os_snprintf(npin, sizeof(npin), "%08d", new_pin);
+		generated_pin = npin;
 		reply = dbus_message_new_method_return(message);
-		dbus_message_append_args(reply, DBUS_TYPE_INT32,
-					 &new_pin, DBUS_TYPE_INVALID);
+		dbus_message_append_args(reply, DBUS_TYPE_STRING,
+					 &generated_pin, DBUS_TYPE_INVALID);
 	} else {
 		switch (new_pin) {
 		case -2:
-- 
1.7.0.4



From mctiew  Tue Sep 13 19:00:26 2011
From: mctiew (Ming-Ching Tiew)
Date: Tue, 13 Sep 2011 19:00:26 -0700 (PDT)
Subject: eap_sim_db not configured
In-Reply-To: <1315926067.15925.YahooMailClassic@web161424.mail.bf1.yahoo.com>
Message-ID: <1315965626.45357.YahooMailClassic@web161426.mail.bf1.yahoo.com>



--- On Tue, 9/13/11, Ming-Ching Tiew <mctiew at yahoo.com> wrote:

> From: Ming-Ching Tiew <mctiew at yahoo.com>
> Subject: eap_sim_db not configured
> To: hostap at lists.shmoo.com
> Date: Tuesday, September 13, 2011, 3:01 PM
> While trying to use hostapd (
> libeap.so ) as a library, I encountered this error :-
> 
> ? ? EAP-SIM: eap_sim_db not configured
> 

I fixed this my making a call to eap_sim_db_init().
I have a new question which I will make a separate post.

Regards.


From mctiew  Tue Sep 13 20:51:14 2011
From: mctiew (Ming-Ching Tiew)
Date: Tue, 13 Sep 2011 20:51:14 -0700 (PDT)
Subject: eap_sim_db_receive is not called
Message-ID: <1315972274.10662.YahooMailClassic@web161422.mail.bf1.yahoo.com>


I have used the hlr_auc_gw to receive and send data to hostapd ( libeap.so ), and I can see that the request for gsm triplets comes in and hlr_auc_gw has replied, and the messages appeared in the terminal window. But I don't see that eap_sim_db_receive() is called.

Likely eloop is not initialized correctly but I have called eloop_init() and eloop_run() in the initialization, but yet eloop mechanism inside eap_sim_db does not seem to be working.

Is there any other functions which I must also call to startup the eloop properly ?

Regards. 


From kaniki.uday  Wed Sep 14 02:16:39 2011
From: kaniki.uday (uday kiran)
Date: Wed, 14 Sep 2011 14:46:39 +0530
Subject: Does hostapd's ctrl_iface supports all configurations ?
Message-ID: <CAOeh9Ms5uqJq=Ji_cBzparO3B4AKbWSbD5ef2eE7Lcmxae-GcQ@mail.gmail.com>

Hi all

Does the ctrl_iface has support for all configurations ?

For example, i want to set the beacon_int from my program.
Do I need to only worry about posting it to ctrl_iface or i need to add
support for the same in ctrl_iface too ?

I have done code walk on ctrl_iface code in hostapd , I feel that it does
not have the complete support for all the configurations.

Could some one please help ?

-Uday
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110914/77ae3d1f/attachment.htm 


From yingang.fu  Wed Sep 14 03:11:57 2011
From: yingang.fu (Fu Yingang)
Date: Wed, 14 Sep 2011 18:11:57 +0800
Subject: p2p_find failed
Message-ID: <4E707DED.7030700@borqs.com>

hi, all

I've built out the latest wpa_supplicant with P2P support.
It returns FAIL When i use the wpa_cli to issue p2p_find command:

1.  start wpa_supplicant as daemon:

/system/bin/wpa_supplicant -B -Dwext -ieth0 
-c/data/misc/wifi/wpa_supplicant.conf

wpa_supplicant.conf:

ctrl_interface=/data/misc/wifi/server
device_name=My P2P Device
device_type=1-0050F204-1

2. Run wpa_cli:

/ # wpa_cli
wpa_cli v0.8.x
Copyright (c) 2004-2011, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'eth0'

Interactive mode

 > p2p_find
FAIL

When i traced the call process, I found that the p2p_find returned by:

  wpa_s->global->p2p == NULL

which at:
         if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
                 return -1;

Does anyone tell me what's wrong with my steps or what should i setup 
before following above steps?

Thanks
Yingang

Other information:

1. My .config file as:(Just list the key configurations)

CONFIG_DRIVER_WEXT=y
CONFIG_WPS=y
CONFIG_P2P=y
CONFIG_AP=y

2. The chip is mrvl8787 and the kernel driver is provided by vendor. The 
kernel version is 2.6.32.



Thanks
Yingang



From mailinglistmember  Wed Sep 14 06:17:37 2011
From: mailinglistmember (Martes G Wigglesworth)
Date: Wed, 14 Sep 2011 09:17:37 -0400
Subject: Is it possible to force greater than 128-bit strength when using
	AES-CCM mode?
Message-ID: <4E70A971.4050900@mgwigglesworth.net>

Greetings list.

I was wondering why there is no switch or parameter to increase the 
"bit-strength" of the encryption algorithm under AES above 128-bit.

I also would like to know if I am simply misunderstanding the 
implementation.  The man page has always indicated that a "256-bit" hex 
key can be used in place of a passkey, however, I am a bit confused as 
to why the interface information always will indicate 128-bit AES-CCM.

Please reference the following:

wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
         inet 192.168.200.1 netmask 0xffff0000 broadcast 192.168.255.255
         media: IEEE 802.11 Wireless Ethernet autoselect mode 11g *<hostap>*
         status: running
         ssid wireless-2 channel 1 (2412 MHz 11g) bssid 00:1b:2f:37:02:46
         country US ecm *authmode WPA privacy MIXED deftxkey 2*
*AES-CCM 2:128-bit* txpower 23 scanvalid 60 protmode CTS wme burst
         dtimperiod 1 -dfs

Does hostapd implement anything higher than a 128-bit encryption 
strength, or am I simply confused as to what I am using for reference?

I am running hostapd version 0.7.3 on a FreeBSD-8.2 router.

-- 
Respectfully,


Martes G Wigglesworth
M. G. Wigglesworth Holdings, LLC
www.mgwigglesworth.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110914/35d2ba27/attachment.htm 


From ghjkevin  Wed Sep 14 06:46:48 2011
From: ghjkevin (Huijun Gan)
Date: Wed, 14 Sep 2011 21:46:48 +0800
Subject: p2p_find failed
References: <4E707DED.7030700@borqs.com>
Message-ID: <201109142145319111028@gmail.com>

Hi, 
  

I think P2P functionality is only supported by the interface wrapper nl80211, 
wext doesn't support P2P.
Besides, you should use the newer kernel. 



------------------				 
Thanks,
Kevin
2011-09-14

-------------------------------------------------------------
????Fu Yingang
?????2011-09-14 18:11:35
????hostap; Fu Yingang
???
???p2p_find failed

hi, all

I've built out the latest wpa_supplicant with P2P support.
It returns FAIL When i use the wpa_cli to issue p2p_find command:

1.  start wpa_supplicant as daemon:

/system/bin/wpa_supplicant -B -Dwext -ieth0 
-c/data/misc/wifi/wpa_supplicant.conf

wpa_supplicant.conf:

ctrl_interface=/data/misc/wifi/server
device_name=My P2P Device
device_type=1-0050F204-1

2. Run wpa_cli:

/ # wpa_cli
wpa_cli v0.8.x
Copyright (c) 2004-2011, Jouni Malinen <j at w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'eth0'

Interactive mode

 > p2p_find
FAIL

When i traced the call process, I found that the p2p_find returned by:

  wpa_s->global->p2p == NULL

which at:
         if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
                 return -1;

Does anyone tell me what's wrong with my steps or what should i setup 
before following above steps?

Thanks
Yingang

Other information:

1. My .config file as:(Just list the key configurations)

CONFIG_DRIVER_WEXT=y
CONFIG_WPS=y
CONFIG_P2P=y
CONFIG_AP=y

2. The chip is mrvl8787 and the kernel driver is provided by vendor. The 
kernel version is 2.6.32.



Thanks
Yingang

_______________________________________________
HostAP mailing list
HostAP at lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap


From j  Wed Sep 14 08:28:11 2011
From: j (Jouni Malinen)
Date: Wed, 14 Sep 2011 18:28:11 +0300
Subject: Is it possible to force greater than 128-bit strength when using
	AES-CCM mode?
In-Reply-To: <4E70A971.4050900@mgwigglesworth.net>
References: <4E70A971.4050900@mgwigglesworth.net>
Message-ID: <20110914152811.GA12912@jm.kir.nu>

On Wed, Sep 14, 2011 at 09:17:37AM -0400, Martes G Wigglesworth wrote:
> I was wondering why there is no switch or parameter to increase the
> "bit-strength" of the encryption algorithm under AES above 128-bit.

I'm assuming you are talking about CCMP here which is based on AES-CCM.
CCMP is defined to use 128-bit key and block size in the IEEE 802.11
standard ("All AES processing used within CCMP uses AES with a 128-bit
key and a 128-bit block size"). As such, there is not much point in
hostapd or wpa_supplicant to provide parameters for trying to do
something that has not even been defined.

> I also would like to know if I am simply misunderstanding the
> implementation.  The man page has always indicated that a "256-bit"
> hex key can be used in place of a passkey, however, I am a bit
> confused as to why the interface information always will indicate
> 128-bit AES-CCM.

That key is not the key used in CCMP; it is the key used during 4-way
handshake to derive keys (including the 128-bit TK that is used with
CCMP).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 14 08:30:07 2011
From: j (Jouni Malinen)
Date: Wed, 14 Sep 2011 18:30:07 +0300
Subject: Does hostapd's ctrl_iface supports all configurations ?
In-Reply-To: <CAOeh9Ms5uqJq=Ji_cBzparO3B4AKbWSbD5ef2eE7Lcmxae-GcQ@mail.gmail.com>
References: <CAOeh9Ms5uqJq=Ji_cBzparO3B4AKbWSbD5ef2eE7Lcmxae-GcQ@mail.gmail.com>
Message-ID: <20110914153007.GB12912@jm.kir.nu>

On Wed, Sep 14, 2011 at 02:46:39PM +0530, uday kiran wrote:
> Does the ctrl_iface has support for all configurations ?
> 
> For example, i want to set the beacon_int from my program.
> Do I need to only worry about posting it to ctrl_iface or i need to add
> support for the same in ctrl_iface too ?

If you are asking whether you can dynamically change any parameter in
hostapd.conf through the control interface, then no, that is not
supported for most parameters.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 14 08:37:42 2011
From: j (Jouni Malinen)
Date: Wed, 14 Sep 2011 18:37:42 +0300
Subject: eap_sim_db_receive is not called
In-Reply-To: <1315972274.10662.YahooMailClassic@web161422.mail.bf1.yahoo.com>
References: <1315972274.10662.YahooMailClassic@web161422.mail.bf1.yahoo.com>
Message-ID: <20110914153742.GC12912@jm.kir.nu>

On Tue, Sep 13, 2011 at 08:51:14PM -0700, Ming-Ching Tiew wrote:
> I have used the hlr_auc_gw to receive and send data to hostapd ( libeap.so ), and I can see that the request for gsm triplets comes in and hlr_auc_gw has replied, and the messages appeared in the terminal window. But I don't see that eap_sim_db_receive() is called.

This works just fine when using hostapd as the EAP/RADIUS server, so I'm
assuming you are talking about using libeap.so in some other context.

> Likely eloop is not initialized correctly but I have called eloop_init() and eloop_run() in the initialization, but yet eloop mechanism inside eap_sim_db does not seem to be working.
> 
> Is there any other functions which I must also call to startup the eloop properly ?

eloop_init() and eloop_run() are the key functions. In addition,
eap_sim_db.c needs to register the read socket with
eloop_register_read_sock().

Are you sure that eloop_run() is running? How is eloop integrated with
whatever program you are using to run libeap.so?

-- 
Jouni Malinen                                            PGP id EFC895FA


From kaniki.uday  Wed Sep 14 10:44:37 2011
From: kaniki.uday (uday kiran)
Date: Wed, 14 Sep 2011 23:14:37 +0530
Subject: Does hostapd's ctrl_iface supports all configurations ?
Message-ID: <CAOeh9MuK1iNyKbf_T=HkZWx7FzXwuityC5k5172=R-HcgZ1yMw@mail.gmail.com>

Thanks for the reply Jouni.

No , not in hostapd.conf. I want to change the AP configurations dynamically
from
my program through the ctrl_iface of hostapd.I did walkthrough on ctrl_iface
code
in hostapd and i didnot see any handles for setting some config params like
changing ssid , beacon_int ect.

So , If i my program want to do those configs dynamically, Do i need to add
support in  ctrl_iface code too ? Or did I overlooked it in the code ?
Please clarify ?

On Wed, Sep 14, 2011 at 02:46:39PM +0530, uday kiran wrote:
> > Does the ctrl_iface has support for all configurations ?
> >
> > For example, i want to set the beacon_int from my program.
> > Do I need to only worry about posting it to ctrl_iface or i need to add
> > support for the same in ctrl_iface too ?
>
> If you are asking whether you can dynamically change any parameter in
> hostapd.conf through the control interface, then no, that is not
> supported for most parameters.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110914/5a4bc157/attachment.htm 


From mctiew  Wed Sep 14 15:44:30 2011
From: mctiew (Ming-Ching Tiew)
Date: Wed, 14 Sep 2011 15:44:30 -0700 (PDT)
Subject: eap_sim_db_receive is not called
In-Reply-To: <20110914153742.GC12912@jm.kir.nu>
Message-ID: <1316040270.16675.YahooMailClassic@web161426.mail.bf1.yahoo.com>



--- On Wed, 9/14/11, Jouni Malinen <j at w1.fi> wrote:

> 
> This works just fine when using hostapd as the EAP/RADIUS
> server, so I'm
> assuming you are talking about using libeap.so in some
> other context.
> 
> > Likely eloop is not initialized correctly but I have
> called eloop_init() and eloop_run() in the initialization,
> but yet eloop mechanism inside eap_sim_db does not seem to
> be working.
> > 
> > Is there any other functions which I must also call to
> startup the eloop properly ?
> 
> eloop_init() and eloop_run() are the key functions. In
> addition,
> eap_sim_db.c needs to register the read socket with
> eloop_register_read_sock().
> 
> Are you sure that eloop_run() is running? How is eloop
> integrated with
> whatever program you are using to run libeap.so?

OK I have found out why. Two points :-

1. Basically if one calls eloop_run() early, when there is 
   nothing registered, then the function runs to completion 
   and exited. So it was as good as not called.

2. eloop_run() is a blocking function when something is registered,
   so in the hostapd code it daemonized everything else and keep
   its main thread to  service eloop_run(). Which means when I
   used it in libeap.so I also have to provide a thread to service
   eloop_run().

After realizing the above I created a thread to service eloop_run()
AFTER eap_sim_db_receive() has been registered and now 
eap_sim_db_receive() called when there is data incoming. 

But I still failed to get the radius client to authenticate properly 
due to the PENDING reply behaviour - as I posted in freeradius maillist.

What I am not sure now is the purpose of the callback function in 
the context of using libeap.so for realtime radius client-server
authentication. Maybe I did not do this correctly and the caused 
the failed radius authentication.

I suspect because freeradius does not like the pending behaviour - so I
probably will look inside libeap.so to change the pending behaviour 
of eap_sim_db to a blocking one.

Regards.


From mctiew  Wed Sep 14 23:36:17 2011
From: mctiew (Ming-Ching Tiew)
Date: Wed, 14 Sep 2011 23:36:17 -0700 (PDT)
Subject: PENDING behaviour in eap_sim_db
Message-ID: <1316068577.40762.YahooMailClassic@web161423.mail.bf1.yahoo.com>

OK I did another test, this time I took out the libeap.so and freeradius from the equation, meaning I compiled hostapd, and run it as a radius server.

Inside the configuration file, I specified :-

eap_sim_db=unix:/tmp/hlr_auc_gw.sock

Then I run eapol_test -c eap-sim.conf -s testing123,

The authentication also failed. So now maybe some other configurations I did not do right .......

I have the output from hostapd and eapol_test. Because of size problem, I now only include the hostapd portion in this post.

In will include the eapol_test portion in the next post.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hostapd.log
Type: text/x-log
Size: 13264 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110914/61cb5946/attachment-0001.bin 


From mctiew  Wed Sep 14 23:39:42 2011
From: mctiew (Ming-Ching Tiew)
Date: Wed, 14 Sep 2011 23:39:42 -0700 (PDT)
Subject: PENDING behaviour in eap_sim_db (part2)
Message-ID: <1316068782.19425.YahooMailClassic@web161425.mail.bf1.yahoo.com>

The eapol_test portion of the log as attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eapol_test.log
Type: text/x-log
Size: 14464 bytes
Desc: not available
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110914/05c336ce/attachment.bin 


From yingang.fu  Thu Sep 15 02:49:51 2011
From: yingang.fu (Fu Yingang)
Date: Thu, 15 Sep 2011 17:49:51 +0800
Subject: p2p_find failed
In-Reply-To: <201109142145319111028@gmail.com>
References: <4E707DED.7030700@borqs.com> <201109142145319111028@gmail.com>
Message-ID: <4E71CA3F.3010808@borqs.com>

hi, Kevin

Thanks for your reply!

I'm trying run p2p on a Android phone.
I've tried built wpa_supplicant with nl80211 driver support. But I
failed at missing libnl_2 dynamic library ...
The kernel upgrade is acceptable for me .... So it seems i should give
up the p2p connection between two android phone right now.

Thanks
Yingang

On 09/14/2011 09:46 PM, Huijun Gan wrote:
> Hi, 
>   
>
> I think P2P functionality is only supported by the interface wrapper nl80211, 
> wext doesn't support P2P.
> Besides, you should use the newer kernel. 
>
>
>
> ------------------				 
> Thanks,
> Kevin
> 2011-09-14
>
> -------------------------------------------------------------
> ????Fu Yingang
> ?????2011-09-14 18:11:35
> ????hostap; Fu Yingang
> ???
> ???p2p_find failed
>
> hi, all
>
> I've built out the latest wpa_supplicant with P2P support.
> It returns FAIL When i use the wpa_cli to issue p2p_find command:
>
> 1.  start wpa_supplicant as daemon:
>
> /system/bin/wpa_supplicant -B -Dwext -ieth0 
> -c/data/misc/wifi/wpa_supplicant.conf
>
> wpa_supplicant.conf:
>
> ctrl_interface=/data/misc/wifi/server
> device_name=My P2P Device
> device_type=1-0050F204-1
>
> 2. Run wpa_cli:
>
> / # wpa_cli
> wpa_cli v0.8.x
> Copyright (c) 2004-2011, Jouni Malinen <j at w1.fi> and contributors
>
> This program is free software. You can distribute it and/or modify it
> under the terms of the GNU General Public License version 2.
>
> Alternatively, this software may be distributed under the terms of the
> BSD license. See README and COPYING for more details.
>
>
> Selected interface 'eth0'
>
> Interactive mode
>
>  > p2p_find
> FAIL
>
> When i traced the call process, I found that the p2p_find returned by:
>
>   wpa_s->global->p2p == NULL
>
> which at:
>          if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
>                  return -1;
>
> Does anyone tell me what's wrong with my steps or what should i setup 
> before following above steps?
>
> Thanks
> Yingang
>
> Other information:
>
> 1. My .config file as:(Just list the key configurations)
>
> CONFIG_DRIVER_WEXT=y
> CONFIG_WPS=y
> CONFIG_P2P=y
> CONFIG_AP=y
>
> 2. The chip is mrvl8787 and the kernel driver is provided by vendor. The 
> kernel version is 2.6.32.
>
>
>
> Thanks
> Yingang
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap


From arik  Thu Sep 15 03:22:18 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:18 +0300
Subject: [RFC 00/13] TDLS support for nl80211 drivers
Message-ID: <1316082151-7328-1-git-send-email-arik@wizery.com>

This series adds basic TDLS support for nl80211 based drivers.
It is based in part on patches by Kalyan C. Gaddam, cc-ed here.

Support is added for peer discovery and data path setup/teardown. More
advanced features are not implemented. These include QoS/HT, peer PSM,
peer U-APSD and channel switching.

Kernel-mode support is added in a companion series.

Tested with wl12xx hardware, with a nl80211/mac80211 based driver.

Comments/reviews are welcome.

Arik

Cc: Kalyan C Gaddam <chakkal at iit.edu>

Arik Nemtsov (13):
  TDLS: support setting CONFIG_TDLS_TESTING in .config
  nl80211: update nl80211_copy.h to kernel version with TDLS support
  nl80211: implement wpa TDLS callback functions
  TDLS: process discovery requests and send discovery responses
  TDLS/nl80211: support receiving TDLS discovery response frames
  TDLS: support sending a teardown frame from usermode
  TDLS: support sending TDLS discovery requests
  TDLS: implement low-ack event for lost TDLS peers
  TDLS: collect peer capabilities and supp-rates during link setup
  TDLS: add peer as new STA when enabling TDLS link
  TDLS: support mgmt-frame Tx fallback for ctrl-iface operations
  TDLS: make use of wpa_tdls_add_peer to avoid code duplication
  TDLS: use a valid dialog-token in a setup request

 src/common/ieee802_11_defs.h |    1 +
 src/drivers/driver.h         |    1 +
 src/drivers/driver_nl80211.c |  103 +++++++++++++++
 src/drivers/nl80211_copy.h   |   40 ++++++
 src/rsn_supp/tdls.c          |  291 +++++++++++++++++++++++++++++++++++-------
 src/rsn_supp/wpa.h           |    8 +-
 src/rsn_supp/wpa_i.h         |   10 ++
 src/rsn_supp/wpa_ie.c        |   11 ++
 src/rsn_supp/wpa_ie.h        |    4 +
 wpa_supplicant/Android.mk    |    4 +
 wpa_supplicant/Makefile      |    4 +
 wpa_supplicant/ctrl_iface.c  |   13 ++-
 wpa_supplicant/events.c      |   18 ++-
 wpa_supplicant/wpas_glue.c   |   21 +++
 14 files changed, 478 insertions(+), 51 deletions(-)

-- 
1.7.4.1



From arik  Thu Sep 15 03:22:19 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:19 +0300
Subject: [RFC 01/13] TDLS: support setting CONFIG_TDLS_TESTING in .config
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-2-git-send-email-arik@wizery.com>

Fix the regular and android makefiles.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
---
 wpa_supplicant/Android.mk |    4 ++++
 wpa_supplicant/Makefile   |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 8ce24ad..05a7998 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -179,6 +179,10 @@ NEED_SHA256=y
 NEED_AES_OMAC1=y
 endif
 
+ifdef CONFIG_TDLS_TESTING
+L_CFLAGS += -DCONFIG_TDLS_TESTING
+endif
+
 ifdef CONFIG_PEERKEY
 L_CFLAGS += -DCONFIG_PEERKEY
 endif
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index e59f8f7..ad3d8ae 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -161,6 +161,10 @@ NEED_SHA256=y
 NEED_AES_OMAC1=y
 endif
 
+ifdef CONFIG_TDLS_TESTING
+CFLAGS += -DCONFIG_TDLS_TESTING
+endif
+
 ifdef CONFIG_PEERKEY
 CFLAGS += -DCONFIG_PEERKEY
 endif
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:20 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:20 +0300
Subject: [RFC 02/13] nl80211: update nl80211_copy.h to kernel version with
	TDLS support
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-3-git-send-email-arik@wizery.com>

This copy of the nl80211.h header introduces new TDLS commands and
constants.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
---
 src/drivers/nl80211_copy.h |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index 3769303..34415e8 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -499,6 +499,9 @@
  *	this command may also be sent by the driver as an MLME event to
  *	inform userspace of the new replay counter.
  *
+ * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
+ * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -623,6 +626,9 @@ enum nl80211_commands {
 
 	NL80211_CMD_SET_REKEY_OFFLOAD,
 
+	NL80211_CMD_TDLS_OPER,
+	NL80211_CMD_TDLS_MGMT,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -1042,6 +1048,14 @@ enum nl80211_commands {
  *	(Re)Association Response frames when the driver (or firmware) replies to
  *	(Re)Association Request frames.
  *
+ * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup
+ *	request, link setup confirm, link teardown, etc.). Values are
+ *	described in the TDLS (802.11z) specification.
+ * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a
+ *	TDLS conversation between two devices.
+ * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see
+ *	&enum nl80211_tdls_operation, represented as a u8.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1252,6 +1266,10 @@ enum nl80211_attrs {
 	NL80211_ATTR_IE_PROBE_RESP,
 	NL80211_ATTR_IE_ASSOC_RESP,
 
+	NL80211_ATTR_TDLS_ACTION,
+	NL80211_ATTR_TDLS_DIALOG_TOKEN,
+	NL80211_ATTR_TDLS_OPERATION,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -1349,6 +1367,7 @@ enum nl80211_iftype {
  * @NL80211_STA_FLAG_WME: station is WME/QoS capable
  * @NL80211_STA_FLAG_MFP: station uses management frame protection
  * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
+ * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer
  * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
  * @__NL80211_STA_FLAG_AFTER_LAST: internal use
  */
@@ -1359,6 +1378,7 @@ enum nl80211_sta_flags {
 	NL80211_STA_FLAG_WME,
 	NL80211_STA_FLAG_MFP,
 	NL80211_STA_FLAG_AUTHENTICATED,
+	NL80211_STA_FLAG_TDLS_PEER,
 
 	/* keep last */
 	__NL80211_STA_FLAG_AFTER_LAST,
@@ -2482,4 +2502,24 @@ enum nl80211_hidden_ssid {
 	NL80211_HIDDEN_SSID_ZERO_CONTENTS
 };
 
+/**
+ * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION
+ * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request
+ * @NL80211_TDLS_SETUP: Setup TDLS link
+ * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established
+ * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link
+ * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link
+ * @NL80211_TDLS_ENABLE: (Re-)Enable TDLS operation
+ * @NL80211_TDLS_DISABLE: Disable TDLS operation
+ */
+enum nl80211_tdls_operation {
+	NL80211_TDLS_DISCOVERY_REQ,
+	NL80211_TDLS_SETUP,
+	NL80211_TDLS_TEARDOWN,
+	NL80211_TDLS_ENABLE_LINK,
+	NL80211_TDLS_DISABLE_LINK,
+	NL80211_TDLS_ENABLE,
+	NL80211_TDLS_DISABLE
+};
+
 #endif /* __LINUX_NL80211_H */
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:21 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:21 +0300
Subject: [RFC 03/13] nl80211: implement wpa TDLS callback functions
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-4-git-send-email-arik@wizery.com>

Allow passing high-level TDLS commands and TDLS frames to kernel
via new nl80211 commands.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver_nl80211.c |   93 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1989325..a46f2bc 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7032,6 +7032,95 @@ static void nl80211_set_rekey_info(void *priv, const u8 *kek, const u8 *kck,
 }
 
 
+#ifdef CONFIG_TDLS
+static enum nl80211_tdls_operation nl80211_tdls_get_oper(enum tdls_oper oper)
+{
+	switch (oper) {
+	case TDLS_DISCOVERY_REQ:
+		return NL80211_TDLS_DISCOVERY_REQ;
+	case TDLS_SETUP:
+		return NL80211_TDLS_SETUP;
+	case TDLS_TEARDOWN:
+		return NL80211_TDLS_TEARDOWN;
+	case TDLS_ENABLE_LINK:
+		return NL80211_TDLS_ENABLE_LINK;
+	case TDLS_DISABLE_LINK:
+		return NL80211_TDLS_DISABLE_LINK;
+	case TDLS_ENABLE:
+		return NL80211_TDLS_ENABLE;
+	case TDLS_DISABLE:
+		return NL80211_TDLS_DISABLE;
+	}
+
+	return -1;
+}
+
+
+static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
+				  u8 dialog_token, u16 status_code,
+				  const u8 *buf, size_t len)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+
+	if (!dst)
+		return -EINVAL;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_TDLS_MGMT, 0);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_ACTION, action_code);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_DIALOG_TOKEN, dialog_token);
+	NLA_PUT_U16(msg, NL80211_ATTR_STATUS_CODE, status_code);
+	NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf);
+
+	return send_and_recv_msgs(drv, msg, NULL, NULL);
+
+ nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+
+
+static int nl80211_tdls_oper(void *priv, enum tdls_oper oper, const u8 *peer)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+	enum nl80211_tdls_operation nl80211_oper;
+
+	nl80211_oper = nl80211_tdls_get_oper(oper);
+	if (nl80211_oper == -1) {
+		wpa_printf(MSG_DEBUG, "nl80211: Invalid TDLS oper: %d",
+			   oper);
+		return -1;
+	}
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -1;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_TDLS_OPER, 0);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_OPERATION, nl80211_oper);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer);
+
+	return send_and_recv_msgs(drv, msg, NULL, NULL);
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+#endif /* CONFIG TDLS */
+
+
 const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.name = "nl80211",
 	.desc = "Linux nl80211/cfg80211",
@@ -7105,4 +7194,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.remove_pmkid = nl80211_remove_pmkid,
 	.flush_pmkid = nl80211_flush_pmkid,
 	.set_rekey_info = nl80211_set_rekey_info,
+#ifdef CONFIG_TDLS
+	.send_tdls_mgmt = nl80211_send_tdls_mgmt,
+	.tdls_oper = nl80211_tdls_oper,
+#endif /* CONFIG_TDLS */
 };
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:22 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:22 +0300
Subject: [RFC 04/13] TDLS: process discovery requests and send discovery
	responses
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-5-git-send-email-arik@wizery.com>

When a discovery request is received, add the peer to the TDLS peer
cache and send a response containing minimal data. Mandatory IEs in
the discovery response frame will be filled out by the driver.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/common/ieee802_11_defs.h |    1 +
 src/rsn_supp/tdls.c          |   89 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 89 insertions(+), 1 deletions(-)

diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 86868c0..7db14f3 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -249,6 +249,7 @@
 #define WLAN_PA_GAS_INITIAL_RESP 11
 #define WLAN_PA_GAS_COMEBACK_REQ 12
 #define WLAN_PA_GAS_COMEBACK_RESP 13
+#define WLAN_TDLS_DISCOVERY_RESPONSE 14
 
 /* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
 #define WLAN_SA_QUERY_REQUEST 0
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index e751867..49c4c4c 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -214,7 +214,9 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 	}
 
 	if (action_code == WLAN_TDLS_SETUP_CONFIRM ||
-	    action_code == WLAN_TDLS_TEARDOWN)
+	    action_code == WLAN_TDLS_TEARDOWN ||
+	    action_code == WLAN_TDLS_DISCOVERY_REQUEST ||
+	    action_code == WLAN_TDLS_DISCOVERY_RESPONSE)
 		return 0; /* No retries */
 
 	for (peer = sm->tdls; peer; peer = peer->next) {
@@ -802,6 +804,27 @@ static int wpa_tdls_send_error(struct wpa_sm *sm, const u8 *dst,
 }
 
 
+static struct wpa_tdls_peer *
+wpa_tdls_add_peer(struct wpa_sm *sm, const u8* addr)
+{
+	struct wpa_tdls_peer *peer;
+
+	wpa_printf(MSG_INFO, "TDLS: creating peer entry for " MACSTR,
+		   MAC2STR(addr));
+
+	peer = os_malloc(sizeof(*peer));
+	if (peer == NULL)
+		return NULL;
+
+	os_memset(peer, 0, sizeof(*peer));
+	os_memcpy(peer->addr, addr, ETH_ALEN);
+	peer->next = sm->tdls;
+	sm->tdls = peer;
+
+	return peer;
+}
+
+
 static int wpa_tdls_send_tpk_m1(struct wpa_sm *sm,
 				struct wpa_tdls_peer *peer)
 {
@@ -1143,6 +1166,67 @@ skip_ies:
 	return 0;
 }
 
+static int wpa_tdls_send_discovery_response(
+	struct wpa_sm *sm, struct wpa_tdls_peer *peer, u8 dialog_token)
+{
+	wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Discovery Response "
+			"(peer " MACSTR ")",  MAC2STR(peer->addr));
+
+	return wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_DISCOVERY_RESPONSE,
+				 dialog_token, 0, NULL, 0);
+}
+
+
+static int
+wpa_tdls_process_discovery_request(struct wpa_sm *sm, const u8 *addr,
+				   const u8 *buf, size_t len)
+{
+	struct wpa_eapol_ie_parse kde;
+	struct wpa_tdls_lnkid *lnkid;
+	struct wpa_tdls_peer *peer;
+	size_t min_req_len = sizeof(struct wpa_tdls_frame) +
+			     1 + /* dialog token */
+			     sizeof(struct wpa_tdls_lnkid);
+	u8 dialog_token;
+
+	wpa_printf(MSG_DEBUG, "TDLS discovery req from " MACSTR,
+		   MAC2STR(addr));
+
+	if (len < min_req_len) {
+		wpa_printf(MSG_DEBUG, "TDLS Discovery req is too short: %d",
+			   len);
+		return -1;
+	}
+
+	dialog_token = buf[sizeof(struct wpa_tdls_frame)];
+
+	if (wpa_supplicant_parse_ies(buf + sizeof(struct wpa_tdls_frame) + 1,
+				     len - (sizeof(struct wpa_tdls_frame) + 1),
+				     &kde) < 0)
+		return -1;
+
+	if (!kde.lnkid) {
+		wpa_printf(MSG_DEBUG, "TDLS: link ID not found in discovery "
+			   "request");
+		return -1;
+	}
+
+	lnkid = (void *)kde.lnkid;
+
+	if (os_memcmp(sm->bssid, lnkid->bssid, ETH_ALEN) != 0) {
+		wpa_printf(MSG_DEBUG, "TDLS: Discovery request from different "
+			   " BSS " MACSTR, MAC2STR(lnkid->bssid));
+		return -1;
+	}
+
+	peer = wpa_tdls_add_peer(sm, addr);
+	if (peer == NULL)
+		return -1;
+
+	return wpa_tdls_send_discovery_response(sm, peer, dialog_token);
+}
+
+
 
 static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 				   const u8 *buf, size_t len)
@@ -1937,6 +2021,9 @@ static void wpa_supplicant_rx_tdls(void *ctx, const u8 *src_addr,
 	case WLAN_TDLS_TEARDOWN:
 		wpa_tdls_recv_teardown(sm, src_addr, buf, len);
 		break;
+	case WLAN_TDLS_DISCOVERY_REQUEST:
+		wpa_tdls_process_discovery_request(sm, src_addr, buf, len);
+		break;
 	default:
 		/* Kernel code will process remaining frames */
 		wpa_printf(MSG_DEBUG, "TDLS: Ignore TDLS frame action code %u",
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:23 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:23 +0300
Subject: [RFC 05/13] TDLS/nl80211: support receiving TDLS discovery response
	frames
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-6-git-send-email-arik@wizery.com>

Register for the TDLS discovery response public action frame in nl80211.
Print out a debug message when a discovery-resp frame is received and
validated.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver_nl80211.c |    5 +++++
 wpa_supplicant/events.c      |    9 +++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index a46f2bc..5e8abde 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2217,6 +2217,11 @@ static int nl80211_register_action_frames(struct wpa_driver_nl80211_data *drv)
 	if (nl80211_register_action_frame(drv, (u8 *) "\x08\x01", 2) < 0)
 		return -1;
 #endif /* CONFIG_IEEE80211W */
+#ifdef CONFIG_TDLS
+	/* TDLS Discovery Response */
+	if (nl80211_register_action_frame(drv, (u8 *) "\x04\x0e", 2) < 0)
+		return -1;
+#endif
 
 	/* FT Action frames */
 	if (nl80211_register_action_frame(drv, (u8 *) "\x06", 1) < 0)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a307eda..1856a63 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2030,6 +2030,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 				   data->rx_action.data,
 				   data->rx_action.len, data->rx_action.freq);
 #endif /* CONFIG_P2P */
+#ifdef CONFIG_TDLS
+		if (data->rx_action.category == WLAN_ACTION_PUBLIC &&
+		    data->rx_action.len >= 4 &&
+		    data->rx_action.data[0] == WLAN_TDLS_DISCOVERY_RESPONSE) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "Received TDLS discovery "
+				"response from " MACSTR,
+				MAC2STR(data->rx_action.sa));
+		}
+#endif /* CONFIG_TDLS */
 		break;
 	case EVENT_RX_PROBE_REQ:
 		if (data->rx_probe_req.sa == NULL ||
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:24 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:24 +0300
Subject: [RFC 06/13] TDLS: support sending a teardown frame from usermode
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-7-git-send-email-arik@wizery.com>

When a driver does not implement the TDLS_TEARDOWN operation internally,
send an explicit TDLS link teardown frame to the driver.

Change all teardown calls to use this fallback mechanism.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c     |   62 +++++++++++++++++++++++++++++++++++++++-------
 src/rsn_supp/wpa.h      |    4 +-
 wpa_supplicant/events.c |    5 +--
 3 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 49c4c4c..b4f17db 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -255,6 +255,27 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 }
 
 
+static int wpa_tdls_do_teardown(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
+				u16 reason_code)
+{
+	/* try asking the driver to teardown the link */
+	int ret = wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
+
+	/* it it doesn't work - send an explicit teardown message */
+	if (ret) {
+		ret = wpa_tdls_send_teardown(sm, peer->addr, reason_code);
+
+		/* disable the link after teardown was sent */
+		wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, peer->addr);
+	}
+
+	/* clear the Peerkey statemachine */
+	wpa_tdls_peer_free(sm, peer);
+
+	return ret;
+}
+
+
 static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 {
 
@@ -293,15 +314,11 @@ static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 		eloop_register_timeout(peer->sm_tmr.timer / 1000, 0,
 				       wpa_tdls_tpk_retry_timeout, sm, peer);
 	} else {
-		wpa_printf(MSG_INFO, "Sending Tear_Down Request");
-		wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
-
-		wpa_printf(MSG_INFO, "Clearing SM: Peerkey(" MACSTR ")",
-			   MAC2STR(peer->addr));
 		eloop_cancel_timeout(wpa_tdls_tpk_retry_timeout, sm, peer);
 
-		/* clear the Peerkey statemachine */
-		wpa_tdls_peer_free(sm, peer);
+		wpa_printf(MSG_INFO, "Sending Tear_Down Request");
+		wpa_tdls_do_teardown(sm, peer,
+				     WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 	}
 }
 
@@ -578,7 +595,8 @@ static void wpa_tdls_tpk_timeout(void *eloop_ctx, void *timeout_ctx)
 	} else {
 		wpa_printf(MSG_DEBUG, "TDLS: TPK lifetime expired for " MACSTR
 			   " - tear down", MAC2STR(peer->addr));
-		wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
+		wpa_tdls_do_teardown(sm, peer,
+				     WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 	}
 }
 
@@ -617,8 +635,7 @@ static void wpa_tdls_linkid(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
 }
 
 
-int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
-				  u16 reason_code)
+int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
 {
 	struct wpa_tdls_peer *peer;
 	struct wpa_tdls_ftie *ftie;
@@ -707,6 +724,31 @@ skip_ies:
 }
 
 
+int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
+{
+	struct wpa_tdls_peer *peer;
+
+	for (peer = sm->tdls; peer; peer = peer->next) {
+		if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
+			break;
+	}
+
+	if (peer == NULL) {
+		wpa_printf(MSG_DEBUG, "TDLS: Could not find peer " MACSTR
+		   " for link Teardown", MAC2STR(addr));
+		return -1;
+	}
+
+	if (!peer->tpk_success) {
+		wpa_printf(MSG_DEBUG, "TDLS: Peer " MACSTR
+		   " not connected - cannot Teardown link", MAC2STR(addr));
+		return -1;
+	}
+
+	return wpa_tdls_do_teardown(sm, peer, reason_code);
+}
+
+
 static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
 				  const u8 *buf, size_t len)
 {
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index a01baf9..e814d33 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -358,8 +358,8 @@ void wpa_tdls_ap_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
 void wpa_tdls_assoc_resp_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
 int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr);
-int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
-				  u16 reason_code);
+int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
+int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
 int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 1856a63..d552484 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1631,9 +1631,8 @@ static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s,
 		wpa_tdls_start(wpa_s->wpa, data->tdls.peer);
 		break;
 	case TDLS_REQUEST_TEARDOWN:
-		/* request from driver to add FTIE */
-		wpa_tdls_recv_teardown_notify(wpa_s->wpa, data->tdls.peer,
-					      data->tdls.reason_code);
+		wpa_tdls_send_teardown(wpa_s->wpa, data->tdls.peer,
+				       data->tdls.reason_code);
 		break;
 	}
 }
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:25 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:25 +0300
Subject: [RFC 07/13] TDLS: support sending TDLS discovery requests
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-8-git-send-email-arik@wizery.com>

Allow sending a TDLS discovery request as a frame through the driver.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c |    8 ++++++++
 src/rsn_supp/wpa.h  |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index b4f17db..8da15bb 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1269,6 +1269,14 @@ wpa_tdls_process_discovery_request(struct wpa_sm *sm, const u8 *addr,
 }
 
 
+int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr)
+{
+	wpa_printf(MSG_DEBUG, "TDLS Discovery Req: Peer:" MACSTR,
+		   MAC2STR(addr));
+	return wpa_tdls_tpk_send(sm, addr, WLAN_TDLS_DISCOVERY_REQUEST,
+				 1, 0, NULL, 0);
+}
+
 
 static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 				   const u8 *buf, size_t len)
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index e814d33..3c37ea6 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -360,6 +360,7 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
 int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
+int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:26 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:26 +0300
Subject: [RFC 08/13] TDLS: implement low-ack event for lost TDLS peers
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-9-git-send-email-arik@wizery.com>

Disable the direct connection when a TDLS peer stops responding
to packets, as indicated by the "LOW ACK" event coming from a driver.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c     |   17 +++++++++++++++++
 src/rsn_supp/wpa.h      |    1 +
 wpa_supplicant/events.c |    4 ++++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 8da15bb..71b43ea 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -749,6 +749,23 @@ int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
 }
 
 
+void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr)
+{
+	struct wpa_tdls_peer *peer;
+
+	for (peer = sm->tdls; peer; peer = peer->next) {
+		if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
+			break;
+	}
+
+	if (peer)
+		wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, addr);
+
+	/* clear the Peerkey statemachine */
+	wpa_tdls_peer_free(sm, peer);
+}
+
+
 static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
 				  const u8 *buf, size_t len)
 {
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 3c37ea6..f2a4704 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -364,5 +364,6 @@ int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
+void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr);
 
 #endif /* WPA_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index d552484..9054c18 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2221,6 +2221,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 			hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0],
 						  data->low_ack.addr);
 #endif /* CONFIG_AP */
+#ifdef CONFIG_TDLS
+		if (data)
+			wpa_tdls_disable_link(wpa_s->wpa, data->low_ack.addr);
+#endif /* CONFIG_TDLS */
 		break;
 	case EVENT_IBSS_PEER_LOST:
 #ifdef CONFIG_IBSS_RSN
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:27 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:27 +0300
Subject: [RFC 09/13] TDLS: collect peer capabilities and supp-rates during
	link setup
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-10-git-send-email-arik@wizery.com>

Record the capabilities and supported rates of the TDLS peer during
link setup. These are given in the IEs passed in SETUP_REQUEST and
SETUP_RESPONSE frames.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c   |   97 ++++++++++++++++++++++++++++++++++++++-----------
 src/rsn_supp/wpa_ie.c |   11 ++++++
 src/rsn_supp/wpa_ie.h |    4 ++
 3 files changed, 91 insertions(+), 21 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 71b43ea..a438a53 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -119,6 +119,12 @@ struct wpa_tdls_peer {
 		int buf_len;    /* length of TPK message for retransmission */
 		u8 *buf;        /* buffer for TPK message */
 	} sm_tmr;
+
+	u16 capability;
+
+#define IEEE80211_MAX_SUPP_RATES 32
+	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
+	size_t supp_rates_len;
 };
 
 
@@ -1317,6 +1323,7 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 	u16 ielen;
 	u16 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
 	int tdls_prohibited = sm->tdls_prohibited;
+	int existing_peer = 0;
 
 	if (len < 3 + 3)
 		return -1;
@@ -1329,7 +1336,22 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 
 	wpa_printf(MSG_INFO, "TDLS: Dialog Token in TPK M1 %d", dtoken);
 
-	cpos += 2; /* capability information */
+	for (peer = sm->tdls; peer; peer = peer->next) {
+		if (os_memcmp(peer->addr, src_addr, ETH_ALEN) == 0) {
+			existing_peer = 1;
+			break;
+		}
+	}
+
+	if (peer == NULL) {
+		peer = wpa_tdls_add_peer(sm, src_addr);
+		if (peer == NULL)
+			goto error;
+	}
+
+	/* capability information */
+	peer->capability = WPA_GET_LE16(cpos);
+	cpos += 2;
 
 	ielen = len - (cpos - buf); /* start of IE in buf */
 	if (wpa_supplicant_parse_ies(cpos, ielen, &kde) < 0) {
@@ -1354,6 +1376,29 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 	wpa_printf(MSG_DEBUG, "TDLS: TPK M1 - TPK initiator " MACSTR,
 		   MAC2STR(src_addr));
 
+	if (!kde.supp_rates) {
+		wpa_printf(MSG_DEBUG, "TDLS: No supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	if (kde.supp_rates_len - 2 + kde.ext_supp_rates_len - 2 >
+	    IEEE80211_MAX_SUPP_RATES) {
+		wpa_printf(MSG_DEBUG, "TDLS: Too much supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	peer->supp_rates_len = kde.supp_rates_len - 2;
+	os_memcpy(peer->supp_rates, kde.supp_rates + 2,
+		  kde.supp_rates_len - 2);
+
+	if (kde.ext_supp_rates) {
+		os_memcpy(peer->supp_rates + peer->supp_rates_len,
+			  kde.ext_supp_rates + 2, kde.ext_supp_rates_len - 2);
+		peer->supp_rates_len += kde.ext_supp_rates_len - 2;
+	}
+
 #ifdef CONFIG_TDLS_TESTING
 	if (tdls_testing & TDLS_TESTING_CONCURRENT_INIT) {
 		for (peer = sm->tdls; peer; peer = peer->next) {
@@ -1453,26 +1498,10 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 	}
 
 skip_rsn:
-	/* Find existing entry and if found, use that instead of adding
-	 * a new one; how to handle the case where both ends initiate at the
+	/* If found, use existing entry instead of adding a new one;
+	 * how to handle the case where both ends initiate at the
 	 * same time? */
-	for (peer = sm->tdls; peer; peer = peer->next) {
-		if (os_memcmp(peer->addr, src_addr, ETH_ALEN) == 0)
-			break;
-	}
-
-	if (peer == NULL) {
-		wpa_printf(MSG_INFO, "TDLS: No matching entry found for "
-			   "peer, creating one for " MACSTR,
-			   MAC2STR(src_addr));
-		peer = os_malloc(sizeof(*peer));
-		if (peer == NULL)
-			goto error;
-		os_memset(peer, 0, sizeof(*peer));
-		os_memcpy(peer->addr, src_addr, ETH_ALEN);
-		peer->next = sm->tdls;
-		sm->tdls = peer;
-	} else {
+	if (existing_peer) {
 		if (peer->tpk_success) {
 			wpa_printf(MSG_DEBUG, "TDLS: TDLS Setup Request while "
 				   "direct link is enabled - tear down the "
@@ -1673,7 +1702,10 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
 
 	if (len < 3 + 2 + 1 + 2)
 		return -1;
-	pos += 2; /* capability information */
+
+	/* capability information */
+	peer->capability = WPA_GET_LE16(pos);
+	pos += 2;
 
 	ielen = len - (pos - buf); /* start of IE in buf */
 	if (wpa_supplicant_parse_ies(pos, ielen, &kde) < 0) {
@@ -1704,6 +1736,29 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
 		goto error;
 	}
 
+	if (!kde.supp_rates) {
+		wpa_printf(MSG_DEBUG, "TDLS: No supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	if (kde.supp_rates_len - 2 + kde.ext_supp_rates_len - 2 >
+	    IEEE80211_MAX_SUPP_RATES) {
+		wpa_printf(MSG_DEBUG, "TDLS: Too much supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	peer->supp_rates_len = kde.supp_rates_len - 2;
+	os_memcpy(peer->supp_rates, kde.supp_rates + 2,
+		  kde.supp_rates_len - 2);
+
+	if (kde.ext_supp_rates) {
+		os_memcpy(peer->supp_rates + peer->supp_rates_len,
+			  kde.ext_supp_rates + 2, kde.ext_supp_rates_len - 2);
+		peer->supp_rates_len += kde.ext_supp_rates_len - 2;
+	}
+
 	if (!wpa_tdls_get_privacy(sm)) {
 		peer->rsnie_p_len = 0;
 		peer->cipher = WPA_CIPHER_NONE;
diff --git a/src/rsn_supp/wpa_ie.c b/src/rsn_supp/wpa_ie.c
index 654cc1f..0f89623 100644
--- a/src/rsn_supp/wpa_ie.c
+++ b/src/rsn_supp/wpa_ie.c
@@ -426,9 +426,20 @@ int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
 		} else if (*pos == WLAN_EID_LINK_ID) {
 			ie->lnkid = pos;
 			ie->lnkid_len = pos[1] + 2;
+
+			if (ie->lnkid_len < 18 + 2) {
+				ie->lnkid = 0;
+				ie->lnkid_len = 0;
+			}
 		} else if (*pos == WLAN_EID_EXT_CAPAB) {
 			ie->ext_capab = pos;
 			ie->ext_capab_len = pos[1] + 2;
+		} else if (*pos == WLAN_EID_SUPP_RATES) {
+			ie->supp_rates = pos;
+			ie->supp_rates_len = pos[1] + 2;
+		} else if (*pos == WLAN_EID_EXT_SUPP_RATES) {
+			ie->ext_supp_rates = pos;
+			ie->ext_supp_rates_len = pos[1] + 2;
 		} else if (*pos == WLAN_EID_VENDOR_SPECIFIC) {
 			ret = wpa_parse_generic(pos, end, ie);
 			if (ret < 0)
diff --git a/src/rsn_supp/wpa_ie.h b/src/rsn_supp/wpa_ie.h
index f939b13..c13d94c 100644
--- a/src/rsn_supp/wpa_ie.h
+++ b/src/rsn_supp/wpa_ie.h
@@ -51,6 +51,10 @@ struct wpa_eapol_ie_parse {
 	size_t lnkid_len;
 	const u8 *ext_capab;
 	size_t ext_capab_len;
+	const u8 *supp_rates;
+	size_t supp_rates_len;
+	const u8 *ext_supp_rates;
+	size_t ext_supp_rates_len;
 };
 
 int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:28 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:28 +0300
Subject: [RFC 10/13] TDLS: add peer as new STA when enabling TDLS link
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-11-git-send-email-arik@wizery.com>

Before enabling a TDLS link, add the remote peer as a new STA.
Mark the new STA with a flag to indicate it is a TDLS peer.

Translate the flag to an appropriate nl80211 STA flag in driver_nl80211.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver.h         |    1 +
 src/drivers/driver_nl80211.c |    5 +++++
 src/rsn_supp/tdls.c          |    3 +++
 src/rsn_supp/wpa.h           |    2 ++
 src/rsn_supp/wpa_i.h         |   10 ++++++++++
 wpa_supplicant/wpas_glue.c   |   21 +++++++++++++++++++++
 6 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3e9c132..6b2e3ce 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -812,6 +812,7 @@ struct wpa_bss_params {
 #define WPA_STA_WMM BIT(1)
 #define WPA_STA_SHORT_PREAMBLE BIT(2)
 #define WPA_STA_MFP BIT(3)
+#define WPA_STA_TDLS_PEER BIT(4)
 
 /**
  * struct p2p_params - P2P parameters for driver-based P2P management
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 5e8abde..03ffa13 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4113,6 +4113,8 @@ static u32 sta_flags_nl80211(int flags)
 		f |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
 	if (flags & WPA_STA_MFP)
 		f |= BIT(NL80211_STA_FLAG_MFP);
+	if (flags & WPA_STA_TDLS_PEER)
+		f |= BIT(NL80211_STA_FLAG_TDLS_PEER);
 
 	return f;
 }
@@ -4829,6 +4831,9 @@ static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
 	if (total_flags & WPA_STA_MFP)
 		NLA_PUT_FLAG(flags, NL80211_STA_FLAG_MFP);
 
+	if (total_flags & WPA_STA_TDLS_PEER)
+		NLA_PUT_FLAG(flags, NL80211_STA_FLAG_TDLS_PEER);
+
 	if (nla_put_nested(msg, NL80211_ATTR_STA_FLAGS, flags))
 		goto nla_put_failure;
 
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index a438a53..853a387 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1647,6 +1647,9 @@ static void wpa_tdls_enable_link(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
 	}
 #endif /* CONFIG_TDLS_TESTING */
 	}
+
+	wpa_sm_tdls_sta_add(sm, peer->addr, peer->capability, peer->supp_rates,
+			    peer->supp_rates_len);
 	wpa_sm_tdls_oper(sm, TDLS_ENABLE_LINK, peer->addr);
 }
 
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index f2a4704..3f309ec 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -60,6 +60,8 @@ struct wpa_sm_ctx {
 			      u8 action_code, u8 dialog_token,
 			      u16 status_code, const u8 *buf, size_t len);
 	int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
+	int (*tdls_sta_add)(void *ctx, const u8 *addr, u16 capability,
+			    const u8 *supp_rates, size_t supp_rates_len);
 #endif /* CONFIG_TDLS */
 	void (*set_rekey_offload)(void *ctx, const u8 *kek, const u8 *kck,
 				  const u8 *replay_ctr);
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index ebe73ca..f46f2ee 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -272,6 +272,16 @@ static inline int wpa_sm_tdls_oper(struct wpa_sm *sm, int oper,
 		return sm->ctx->tdls_oper(sm->ctx->ctx, oper, peer);
 	return -1;
 }
+
+static inline int wpa_sm_tdls_sta_add(struct wpa_sm *sm, const u8 *addr,
+				      u16 capability, const u8 *supp_rates,
+				      size_t supp_rates_len)
+{
+	if (sm->ctx->tdls_sta_add)
+		return sm->ctx->tdls_sta_add(sm->ctx->ctx, addr, capability,
+					     supp_rates, supp_rates_len);
+	return -1;
+}
 #endif /* CONFIG_TDLS */
 
 void wpa_eapol_key_send(struct wpa_sm *sm, const u8 *kck,
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 98b082c..74e2272 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -555,6 +555,26 @@ static int wpa_supplicant_tdls_oper(void *ctx, int oper, const u8 *peer)
 	return wpa_drv_tdls_oper(wpa_s, oper, peer);
 }
 
+
+static int wpa_supplicant_tdls_sta_add(void *ctx, const u8 *peer,
+				       u16 capability, const u8 *supp_rates,
+				       size_t supp_rates_len)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	struct hostapd_sta_add_params params;
+
+	params.addr = peer;
+	params.aid = 1;
+	params.capability = capability;
+	params.flags = WPA_STA_TDLS_PEER;
+	params.ht_capabilities = NULL;
+	params.listen_interval = 0;
+	params.supp_rates = supp_rates;
+	params.supp_rates_len = supp_rates_len;
+
+	return wpa_drv_sta_add(wpa_s, &params);
+}
+
 #endif /* CONFIG_TDLS */
 
 
@@ -715,6 +735,7 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s)
 #ifdef CONFIG_TDLS
 	ctx->send_tdls_mgmt = wpa_supplicant_send_tdls_mgmt;
 	ctx->tdls_oper = wpa_supplicant_tdls_oper;
+	ctx->tdls_sta_add = wpa_supplicant_tdls_sta_add;
 #endif /* CONFIG_TDLS */
 	ctx->set_rekey_offload = wpa_supplicant_set_rekey_offload;
 
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:29 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:29 +0300
Subject: [RFC 11/13] TDLS: support mgmt-frame Tx fallback for ctrl-iface
	operations
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-12-git-send-email-arik@wizery.com>

When the driver does not implement a given operation internally
(discovery request, link setup/teardown), fallback to sending explicit
TDLS mgmt frames to accomplish the same goal.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 wpa_supplicant/ctrl_iface.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index a55a528..c975ed8 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -204,6 +204,7 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
 	struct wpa_supplicant *wpa_s, char *addr)
 {
 	u8 peer[ETH_ALEN];
+	int ret;
 
 	if (hwaddr_aton(addr, peer)) {
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER: invalid "
@@ -214,7 +215,11 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER " MACSTR,
 		   MAC2STR(peer));
 
-	return wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
+	ret = wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
+	if (ret)
+		ret = wpa_tdls_send_discovery_request(wpa_s->wpa, peer);
+
+	return ret;
 }
 
 
@@ -236,6 +241,9 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
 	ret = wpa_tdls_reneg(wpa_s->wpa, peer);
 	if (ret)
 		ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
+	if (ret)
+		ret = wpa_tdls_start(wpa_s->wpa, peer);
+
 	return ret;
 }
 
@@ -254,7 +262,8 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown(
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN " MACSTR,
 		   MAC2STR(peer));
 
-	return wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer);
+	return wpa_tdls_teardown_link(wpa_s->wpa, peer,
+				      WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 }
 
 #endif /* CONFIG_TDLS */
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:30 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:30 +0300
Subject: [RFC 12/13] TDLS: make use of wpa_tdls_add_peer to avoid code
	duplication
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-13-git-send-email-arik@wizery.com>

Use the wpa_tdls_add_peer function to allocate TDLS peer structures.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 853a387..9e339aa 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1406,12 +1406,9 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 				break;
 		}
 		if (peer == NULL) {
-			peer = os_zalloc(sizeof(*peer));
+			peer = wpa_tdls_add_peer(sm, src_addr);
 			if (peer == NULL)
 				goto error;
-			os_memcpy(peer->addr, src_addr, ETH_ALEN);
-			peer->next = sm->tdls;
-			sm->tdls = peer;
 		}
 		wpa_printf(MSG_DEBUG, "TDLS: Testing concurrent initiation of "
 			   "TDLS setup - send own request");
@@ -2058,15 +2055,9 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
 	}
 
 	if (peer == NULL) {
-		wpa_printf(MSG_INFO, "TDLS: No matching entry found for "
-			   "peer, creating one for " MACSTR, MAC2STR(addr));
-		peer = os_malloc(sizeof(*peer));
+		peer = wpa_tdls_add_peer(sm, addr);
 		if (peer == NULL)
 			return -1;
-		os_memset(peer, 0, sizeof(*peer));
-		os_memcpy(peer->addr, addr, ETH_ALEN);
-		peer->next = sm->tdls;
-		sm->tdls = peer;
 	}
 
 	peer->initiator = 1;
-- 
1.7.4.1



From arik  Thu Sep 15 03:22:31 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 13:22:31 +0300
Subject: [RFC 13/13] TDLS: use a valid dialog-token in a setup request
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316082151-7328-14-git-send-email-arik@wizery.com>

A zero dialog-token is considered invalid by the TDLS specification.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 9e339aa..4c943a4 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1060,7 +1060,7 @@ skip_ies:
 		   "Handshake Message 1 (peer " MACSTR ")",
 		   MAC2STR(peer->addr));
 
-	wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_SETUP_REQUEST, 0, 0,
+	wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_SETUP_REQUEST, 1, 0,
 			  rbuf, pos - rbuf);
 	os_free(rbuf);
 
-- 
1.7.4.1



From johannes  Thu Sep 15 04:15:44 2011
From: johannes (Johannes Berg)
Date: Thu, 15 Sep 2011 13:15:44 +0200
Subject: [RFC 06/13] TDLS: support sending a teardown frame from usermode
In-Reply-To: <1316082151-7328-7-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
	<1316082151-7328-7-git-send-email-arik@wizery.com>
Message-ID: <1316085344.3992.8.camel@jlt3.sipsolutions.net>

On Thu, 2011-09-15 at 13:22 +0300, Arik Nemtsov wrote:
> When a driver does not implement the TDLS_TEARDOWN operation internally,
> send an explicit TDLS link teardown frame to the driver.
> 
> Change all teardown calls to use this fallback mechanism.
> 
> Signed-off-by: Arik Nemtsov <arik at wizery.com>
> Cc: Kalyan C Gaddam <chakkal at iit.edu>
> ---
>  src/rsn_supp/tdls.c     |   62 +++++++++++++++++++++++++++++++++++++++-------
>  src/rsn_supp/wpa.h      |    4 +-
>  wpa_supplicant/events.c |    5 +--
>  3 files changed, 56 insertions(+), 15 deletions(-)
> 
> diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
> index 49c4c4c..b4f17db 100644
> --- a/src/rsn_supp/tdls.c
> +++ b/src/rsn_supp/tdls.c
> @@ -255,6 +255,27 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
>  }
>  
> 
> +static int wpa_tdls_do_teardown(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
> +				u16 reason_code)
> +{
> +	/* try asking the driver to teardown the link */
> +	int ret = wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
> +
> +	/* it it doesn't work - send an explicit teardown message */
> +	if (ret) {

I think that should be a feature flag rather than always trying &
falling back.

johannes



From johannes  Thu Sep 15 04:17:24 2011
From: johannes (Johannes Berg)
Date: Thu, 15 Sep 2011 13:17:24 +0200
Subject: [RFC 00/13] TDLS support for nl80211 drivers
In-Reply-To: <1316082151-7328-1-git-send-email-arik@wizery.com>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
Message-ID: <1316085444.3992.9.camel@jlt3.sipsolutions.net>

So this doesn't make the decision whether to use TDLS or not -- is that
going to be outside the supplicant? If so, shouldn't that be able to
figure out whether or not TDLS is supported at all?

johannes



From erich.titl  Thu Sep 15 05:06:07 2011
From: erich.titl (Erich Titl)
Date: Thu, 15 Sep 2011 14:06:07 +0200
Subject: No user traffic through wlan0
Message-ID: <4E71EA2F.1010807@think.ch>

Hi

New to this list, so please let me know if this is the right place.

I have an embedded distro http://leaf.sourceforge.net with a Wistron 9CM
Atheros based card and ath5k driver installed. I want to use this set up
to connect to a WRK54GH for testing purposes. The final goal is to
develop a web based tool to configure the Wifi client instance to
connect to basically any available AP to have an uplink to the net.

After lots of sweat and tears I finally understood the necessity to have
wpa_supplicant to get an association with WPA2-PSK.

My wpa_supplicant.conf file is very simple

>>>>>>
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
        ssid="scoobly"
        psk="XXXXXXXX"
}
>>>>>>

Now here is the catch....

- I can associate fine with the AP
- DHCP assigns an address to wlan0 and installs a default route

but...

If I try to ping the WRT54GH I see arp requests going out which are
never replied to, therefore the packets will never be sent.

If I try the same with a laptop under Windoze 7 everything works as
expected.

Any ideas

Thanks

Erich

- DHCP assigns an address and

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2182 bytes
Desc: S/MIME Kryptografische Unterschrift
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110915/9c72e63e/attachment.bin 


From matt.causey  Thu Sep 15 06:46:15 2011
From: matt.causey (Matt Causey)
Date: Thu, 15 Sep 2011 09:46:15 -0400
Subject: No user traffic through wlan0
In-Reply-To: <4E71EA2F.1010807@think.ch>
References: <4E71EA2F.1010807@think.ch>
Message-ID: <CAGnc4p8xrgGXj5W1+wmb6rmziN_MGKn0Q15=h4uEBEJs_kL8aQ@mail.gmail.com>

On Thu, Sep 15, 2011 at 8:06 AM, Erich Titl <erich.titl at think.ch> wrote:
> Hi
>
> New to this list, so please let me know if this is the right place.
>
> I have an embedded distro http://leaf.sourceforge.net with a Wistron 9CM
> Atheros based card and ath5k driver installed. I want to use this set up
> to connect to a WRK54GH for testing purposes. The final goal is to
> develop a web based tool to configure the Wifi client instance to
> connect to basically any available AP to have an uplink to the net.
>
> After lots of sweat and tears I finally understood the necessity to have
> wpa_supplicant to get an association with WPA2-PSK.
>
> My wpa_supplicant.conf file is very simple
>
>>>>>>>
> ctrl_interface=/var/run/wpa_supplicant
> update_config=1
>
> network={
> ? ? ? ?ssid="scoobly"
> ? ? ? ?psk="XXXXXXXX"
> }
>>>>>>>
>
> Now here is the catch....
>
> - I can associate fine with the AP
> - DHCP assigns an address to wlan0 and installs a default route

I'm happy to be wrong about this, but if you are getting an IP address
from your DHCP server then you have certainly established layer 2
connectivity, which means that the suppliant is working.  Take a look
at the wpa_supplicant debug logs to verify.

What happens when you ping the gateway, forcing ping to use wlan0
(sudo ping -I wlan0 <gw_ip>).

--
Matt


>
> but...
>
> If I try to ping the WRT54GH I see arp requests going out which are
> never replied to, therefore the packets will never be sent.
>
> If I try the same with a laptop under Windoze 7 everything works as
> expected.
>
> Any ideas
>
> Thanks
>
> Erich
>
> - DHCP assigns an address and
>
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>
>


From erich.titl  Thu Sep 15 10:57:23 2011
From: erich.titl (Erich Titl)
Date: Thu, 15 Sep 2011 19:57:23 +0200
Subject: No user traffic through wlan0
In-Reply-To: <CAGnc4p8xrgGXj5W1+wmb6rmziN_MGKn0Q15=h4uEBEJs_kL8aQ@mail.gmail.com>
References: <4E71EA2F.1010807@think.ch>
	<CAGnc4p8xrgGXj5W1+wmb6rmziN_MGKn0Q15=h4uEBEJs_kL8aQ@mail.gmail.com>
Message-ID: <4E723C83.3060606@think.ch>

Hi Matt

at 15.09.2011 15:46, Matt Causey wrote:
> On Thu, Sep 15, 2011 at 8:06 AM, Erich Titl <erich.titl at think.ch> wrote:
>> Hi
>>
>> New to this list, so please let me know if this is the right place.
>>
>> I have an embedded distro http://leaf.sourceforge.net with a Wistron 9CM
>> Atheros based card and ath5k driver installed. I want to use this set up
>> to connect to a WRK54GH for testing purposes. The final goal is to
>> develop a web based tool to configure the Wifi client instance to
>> connect to basically any available AP to have an uplink to the net.
>>
>> After lots of sweat and tears I finally understood the necessity to have
>> wpa_supplicant to get an association with WPA2-PSK.
>>
>> My wpa_supplicant.conf file is very simple
>>
>>>>>>>>
>> ctrl_interface=/var/run/wpa_supplicant
>> update_config=1
>>
>> network={
>>        ssid="scoobly"
>>        psk="XXXXXXXX"
>> }
>>>>>>>>
>>
>> Now here is the catch....
>>
>> - I can associate fine with the AP
>> - DHCP assigns an address to wlan0 and installs a default route
> 
> I'm happy to be wrong about this, but if you are getting an IP address
> from your DHCP server then you have certainly established layer 2
> connectivity, which means that the suppliant is working.  Take a look
> at the wpa_supplicant debug logs to verify.

I agree, there must be some layer 2 connectivity, else ther would be no
address.

> 
> What happens when you ping the gateway, forcing ping to use wlan0
> (sudo ping -I wlan0 <gw_ip>).

Actually, see below.... , only arp requests for the gateway's address
can be seen on wlan0, no arp replies.

I cannot think of a reason why these arp requests are not honored unless
they are crippled. If I set the IP address in the arp table manually, I
can see outgoing ICMP request packets.

...

>>
>> If I try to ping the WRT54GH I see arp requests going out which are
>> never replied to, therefore the packets will never be sent.
>>
>> If I try the same with a laptop under Windoze 7 everything works as
>> expected.
>>

Erich

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2182 bytes
Desc: S/MIME Kryptografische Unterschrift
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110915/9319b10f/attachment.bin 


From arik  Thu Sep 15 13:02:02 2011
From: arik (Arik Nemtsov)
Date: Thu, 15 Sep 2011 23:02:02 +0300
Subject: [RFC 00/13] TDLS support for nl80211 drivers
In-Reply-To: <1316085444.3992.9.camel@jlt3.sipsolutions.net>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
	<1316085444.3992.9.camel@jlt3.sipsolutions.net>
Message-ID: <CA+XVXfe=P6JnDyXxLRAKcFE6D2qPHu1KJJHiLBb8U2KCcYFPSw@mail.gmail.com>

On Thu, Sep 15, 2011 at 14:17, Johannes Berg <johannes at sipsolutions.net> wrote:
> So this doesn't make the decision whether to use TDLS or not -- is that
> going to be outside the supplicant? If so, shouldn't that be able to
> figure out whether or not TDLS is supported at all?
>

Just as Kalyan said - these details are not finalized yet. For now
wpa_supplicant can setup/teardown TDLS links, and there are some
supporting mechanisms to to prevent connections from getting stuck
(notably, the "low ack" feature).

Once such a controlling agent is in place, advertisement shouldn't be
a big deal. We would probably expose capability flags from the kernel
driver (similar to AP U-APSD) and wpa_supplicant could advertise
support through dbus or something similar.

Arik


From arik  Thu Sep 15 23:08:34 2011
From: arik (Arik Nemtsov)
Date: Fri, 16 Sep 2011 09:08:34 +0300
Subject: [RFC 06/13] TDLS: support sending a teardown frame from usermode
In-Reply-To: <1316085344.3992.8.camel@jlt3.sipsolutions.net>
References: <1316082151-7328-1-git-send-email-arik@wizery.com>
	<1316082151-7328-7-git-send-email-arik@wizery.com>
	<1316085344.3992.8.camel@jlt3.sipsolutions.net>
Message-ID: <CA+XVXfdmM=SaW3ss4LQYUz7-ba=Oe=DpNasAM-8y-qBhR-YeqA@mail.gmail.com>

On Thu, Sep 15, 2011 at 14:15, Johannes Berg <johannes at sipsolutions.net> wrote:
> On Thu, 2011-09-15 at 13:22 +0300, Arik Nemtsov wrote:

>> +static int wpa_tdls_do_teardown(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? u16 reason_code)
>> +{
>> + ? ? /* try asking the driver to teardown the link */
>> + ? ? int ret = wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
>> +
>> + ? ? /* it it doesn't work - send an explicit teardown message */
>> + ? ? if (ret) {
>
> I think that should be a feature flag rather than always trying &
> falling back.
>
> johannes
>

That's a good idea. I'll add separate wiphy capability flags for
external discovery/setup/teardown. This will have to come all the way
from kernel, to accommodate full-mac nl80211 based drivers that want
this internally.

I'm queuing this up for v2.

Arik


From kaniki.uday  Fri Sep 16 01:12:27 2011
From: kaniki.uday (uday kiran)
Date: Fri, 16 Sep 2011 13:42:27 +0530
Subject: Possibility of bypassing hostapd's "Radius Client"
Message-ID: <CAOeh9MuQdwbwafN4MN4t1oHS-53T2RfLeqWvs0c4kVG11Je_bQ@mail.gmail.com>

Hi

I am running a radius client on my machine.

I have few queries

1) Can I use the radius client running in my machine instead of hostapd's
radius client ?
2) Is that possbile to do it through hostapd.config ?

One question specific to radisu clients. Can i run more than one radius
clients in my machine ?

-Uday
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110916/2f3f29dc/attachment.htm 


From ubuntuv  Fri Sep 16 08:37:04 2011
From: ubuntuv (yuva raj)
Date: Fri, 16 Sep 2011 21:07:04 +0530
Subject: wpa_supplicant not supporting nl80211
Message-ID: <CABDFkGg0bk9URpWqBNZQtK6CFVpy3zhLBw7cqiB5uhQJHMhiqQ@mail.gmail.com>

hi,

I am using Fedora 14-64bit laptop.  It has wpa_supplicant version 0.6.8.  I
have installed wireless driver also.  I am able to connect to wireless
networks from Network Manager.  But when I issue the command 'wpa_supplicant
-h', it doesnt display 'nl80211' under drivers section.

  wext = Linux wireless extensions (generic)
  atmel = ATMEL AT76C5XXx (USB, PCMCIA)
  ndiswrapper = Linux ndiswrapper
  wired = wpa_supplicant wired Ethernet driver


I want to know if this version  support nl80211.

Thanks in advance
uv.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110916/4e0dec4e/attachment.htm 


From matt.causey  Fri Sep 16 19:52:57 2011
From: matt.causey (Matt Causey)
Date: Fri, 16 Sep 2011 22:52:57 -0400
Subject: wpa_supplicant not supporting nl80211
In-Reply-To: <CABDFkGg0bk9URpWqBNZQtK6CFVpy3zhLBw7cqiB5uhQJHMhiqQ@mail.gmail.com>
References: <CABDFkGg0bk9URpWqBNZQtK6CFVpy3zhLBw7cqiB5uhQJHMhiqQ@mail.gmail.com>
Message-ID: <CAGnc4p9e11nmLxePwidhihg5t8m8eZRDDo4i5RixCoy-wz6R3w@mail.gmail.com>

Looking at the source, it appears to be there:

http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap-06.git;a=blob;f=hostapd/drivers.c#l21

You can verify if it has been configured by your distro's maintainer
at compile time by running the supplicant manually with -onl80211

--
Matt


On Fri, Sep 16, 2011 at 11:37 AM, yuva raj <ubuntuv at gmail.com> wrote:
> hi,
>
> I am using Fedora 14-64bit laptop.? It has wpa_supplicant version 0.6.8.? I
> have installed wireless driver also.? I am able to connect to wireless
> networks from Network Manager.? But when I issue the command 'wpa_supplicant
> -h', it doesnt display 'nl80211' under drivers section.
>
> ? wext = Linux wireless extensions (generic)
> ? atmel = ATMEL AT76C5XXx (USB, PCMCIA)
> ? ndiswrapper = Linux ndiswrapper
> ? wired = wpa_supplicant wired Ethernet driver
>
>
> I want to know if this version? support nl80211.
>
> Thanks in advance
> uv.
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>
>


From evan  Fri Sep 16 19:57:35 2011
From: evan (Evan Broder)
Date: Fri, 16 Sep 2011 19:57:35 -0700
Subject: [PATCH] For MS-CHAP, convert the password from UTF-8 to UCS-2.
Message-ID: <1316228255-24978-1-git-send-email-evan@ebroder.net>

The MS-CHAPv1 and MS-CHAPv2 RFCs specify that the password is a string
of "Unicode characters", which for Windows means UCS-2; thus the
password could be any even-length string of up to 512 bytes.

Instead of making the incompatible change of requiring the incoming
password to be UCS-2 encoded, assume the password is UTF-8 encoded and
convert it before using it in NtPasswordHash and
EncryptPwBlockWithPasswordHash

Signed-off-by: Evan Broder <evan at ebroder.net>
---
 src/crypto/ms_funcs.c |  107 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 79 insertions(+), 28 deletions(-)

diff --git a/src/crypto/ms_funcs.c b/src/crypto/ms_funcs.c
index dae15ab..29b0c99 100644
--- a/src/crypto/ms_funcs.c
+++ b/src/crypto/ms_funcs.c
@@ -19,6 +19,52 @@
 #include "ms_funcs.h"
 #include "crypto.h"
 
+/**
+ * utf8_to_ucs2
+ * @utf8_string: UTF-8 string (IN)
+ * @utf8_string_len: Length of utf8_string (IN)
+ * @ucs2_buffer: UCS-2 buffer (OUT)
+ * @ucs2_buffer_size: Length of UCS-2 buffer (in 2-byte words) (IN)
+ * @ucs2_string_size: Number of 2-byte words in the resulting UCS-2 string
+ * Returns: 0 on success, -1 on failure
+ */
+static int utf8_to_ucs2(const u8 *utf8_string, size_t utf8_string_len,
+                        u16 *ucs2_buffer, size_t ucs2_buffer_size,
+                        size_t *ucs2_string_size)
+{
+	size_t i, j;
+
+	for (i = 0, j = 0; i < utf8_string_len; i++) {
+		u8 c = utf8_string[i];
+		if (j == ucs2_buffer_size) {
+			/* input too long */
+			return -1;
+		}
+		if (c <= 0x7F) {
+			ucs2_buffer[j++] = host_to_le16(c);
+		} else if (i == utf8_string_len - 1 || j == ucs2_buffer_size - 1) {
+			/* incomplete surrogate */
+			return -1;
+		} else {
+			u8 c2 = utf8_string[++i];
+			if ((c & 0xE0) == 0xC0) {
+				/* two-byte encoding */
+				ucs2_buffer[j++] = host_to_le16(((c & 0x1F) << 6) | (c2 & 0x3F));
+			} else if (i == utf8_string_len || j == ucs2_buffer_size - 1) {
+				/* incomplete surrogate */
+				return -1;
+			} else {
+				/* three-byte encoding */
+				u8 c3 = utf8_string[++i];
+				ucs2_buffer[j++] = host_to_le16(((c & 0xF) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
+			}
+		}
+	}
+
+	if (ucs2_string_size)
+		*ucs2_string_size = j;
+	return 0;
+}
 
 /**
  * challenge_hash - ChallengeHash() - RFC 2759, Sect. 8.2
@@ -53,7 +99,7 @@ static int challenge_hash(const u8 *peer_challenge, const u8 *auth_challenge,
 
 /**
  * nt_password_hash - NtPasswordHash() - RFC 2759, Sect. 8.3
- * @password: 0-to-256-unicode-char Password (IN; ASCII)
+ * @password: 0-to-256-unicode-char Password (IN; UTF-8)
  * @password_len: Length of password
  * @password_hash: 16-octet PasswordHash (OUT)
  * Returns: 0 on success, -1 on failure
@@ -61,20 +107,18 @@ static int challenge_hash(const u8 *peer_challenge, const u8 *auth_challenge,
 int nt_password_hash(const u8 *password, size_t password_len,
 		      u8 *password_hash)
 {
-	u8 buf[512], *pos;
-	size_t i, len;
-
-	if (password_len > 256)
-		password_len = 256;
+	u16 buf[256];
+	u8 *pos;
+	size_t len, max_len;
 
-	/* Convert password into unicode */
-	for (i = 0; i < password_len; i++) {
-		buf[2 * i] = password[i];
-		buf[2 * i + 1] = 0;
-	}
+	max_len = sizeof(buf) / sizeof(buf[0]);
+	if (-1 == utf8_to_ucs2(password, password_len,
+			       buf, max_len,
+			       &len))
+		return -1;
 
-	len = password_len * 2;
-	pos = buf;
+	len *= 2;
+	pos = (u8 *)buf;
 	return md4_vector(1, (const u8 **) &pos, &len, password_hash);
 }
 
@@ -117,7 +161,7 @@ void challenge_response(const u8 *challenge, const u8 *password_hash,
  * @peer_challenge: 16-octet PeerChallenge (IN)
  * @username: 0-to-256-char UserName (IN)
  * @username_len: Length of username
- * @password: 0-to-256-unicode-char Password (IN; ASCII)
+ * @password: 0-to-256-unicode-char Password (IN; UTF-8)
  * @password_len: Length of password
  * @response: 24-octet Response (OUT)
  * Returns: 0 on success, -1 on failure
@@ -225,7 +269,7 @@ int generate_authenticator_response_pwhash(
 
 /**
  * generate_authenticator_response - GenerateAuthenticatorResponse() - RFC 2759, Sect. 8.7
- * @password: 0-to-256-unicode-char Password (IN; ASCII)
+ * @password: 0-to-256-unicode-char Password (IN; UTF-8)
  * @password_len: Length of password
  * @nt_response: 24-octet NT-Response (IN)
  * @peer_challenge: 16-octet PeerChallenge (IN)
@@ -254,7 +298,7 @@ int generate_authenticator_response(const u8 *password, size_t password_len,
 /**
  * nt_challenge_response - NtChallengeResponse() - RFC 2433, Sect. A.5
  * @challenge: 8-octet Challenge (IN)
- * @password: 0-to-256-unicode-char Password (IN; ASCII)
+ * @password: 0-to-256-unicode-char Password (IN; UTF-8)
  * @password_len: Length of password
  * @response: 24-octet Response (OUT)
  * Returns: 0 on success, -1 on failure
@@ -375,7 +419,7 @@ int get_asymetric_start_key(const u8 *master_key, u8 *session_key,
 
 /**
  * encrypt_pw_block_with_password_hash - EncryptPwBlockWithPasswordHash() - RFC 2759, Sect. 8.10
- * @password: 0-to-256-unicode-char Password (IN; ASCII)
+ * @password: 0-to-256-unicode-char Password (IN; UTF-8)
  * @password_len: Length of password
  * @password_hash: 16-octet PasswordHash (IN)
  * @pw_block: 516-byte PwBlock (OUT)
@@ -385,18 +429,25 @@ int encrypt_pw_block_with_password_hash(
 	const u8 *password, size_t password_len,
 	const u8 *password_hash, u8 *pw_block)
 {
-	size_t i, offset;
+	size_t ucs2_len, offset;
 	u8 *pos;
 
-	if (password_len > 256)
+	os_memset(pw_block, 0, PWBLOCK_LEN);
+
+	if (-1 == utf8_to_ucs2(password, password_len,
+			       (u16 *)pw_block, 256,
+			       &ucs2_len))
 		return -1;
 
-	os_memset(pw_block, 0, PWBLOCK_LEN);
-	offset = (256 - password_len) * 2;
-	if (os_get_random(pw_block, offset) < 0)
+	if (ucs2_len > 256)
 		return -1;
-	for (i = 0; i < password_len; i++)
-		pw_block[offset + i * 2] = password[i];
+
+	offset = (256 - ucs2_len) * 2;
+	if (offset != 0) {
+		os_memmove(pw_block + offset, pw_block, ucs2_len * 2);
+		if (os_get_random(pw_block, offset) < 0)
+			return -1;
+	}
 	/*
 	 * PasswordLength is 4 octets, but since the maximum password length is
 	 * 256, only first two (in little endian byte order) can be non-zero.
@@ -410,9 +461,9 @@ int encrypt_pw_block_with_password_hash(
 
 /**
  * new_password_encrypted_with_old_nt_password_hash - NewPasswordEncryptedWithOldNtPasswordHash() - RFC 2759, Sect. 8.9
- * @new_password: 0-to-256-unicode-char NewPassword (IN; ASCII)
+ * @new_password: 0-to-256-unicode-char NewPassword (IN; UTF-8)
  * @new_password_len: Length of new_password
- * @old_password: 0-to-256-unicode-char OldPassword (IN; ASCII)
+ * @old_password: 0-to-256-unicode-char OldPassword (IN; UTF-8)
  * @old_password_len: Length of old_password
  * @encrypted_pw_block: 516-octet EncryptedPwBlock (OUT)
  * Returns: 0 on success, -1 on failure
@@ -450,9 +501,9 @@ void nt_password_hash_encrypted_with_block(const u8 *password_hash,
 
 /**
  * old_nt_password_hash_encrypted_with_new_nt_password_hash - OldNtPasswordHashEncryptedWithNewNtPasswordHash() - RFC 2759, Sect. 8.12
- * @new_password: 0-to-256-unicode-char NewPassword (IN; ASCII)
+ * @new_password: 0-to-256-unicode-char NewPassword (IN; UTF-8)
  * @new_password_len: Length of new_password
- * @old_password: 0-to-256-unicode-char OldPassword (IN; ASCII)
+ * @old_password: 0-to-256-unicode-char OldPassword (IN; UTF-8)
  * @old_password_len: Length of old_password
  * @encrypted_password_hash: 16-octet EncryptedPasswordHash (OUT)
  * Returns: 0 on success, -1 on failure
-- 
1.7.4.1



From mctiew  Fri Sep 16 21:01:56 2011
From: mctiew (Ming-Ching Tiew)
Date: Fri, 16 Sep 2011 21:01:56 -0700 (PDT)
Subject: PENDING behaviour in eap_sim_db
In-Reply-To: <1316068577.40762.YahooMailClassic@web161423.mail.bf1.yahoo.com>
Message-ID: <1316232116.52922.YahooMailClassic@web161421.mail.bf1.yahoo.com>



--- On Thu, 9/15/11, Ming-Ching Tiew <mctiew at yahoo.com> wrote:

> OK I did another test, this time I
> took out the libeap.so and freeradius from the equation,
> meaning I compiled hostapd, and run it as a radius server.
> 
> Inside the configuration file, I specified :-
> 
> eap_sim_db=unix:/tmp/hlr_auc_gw.sock
> 
> Then I run eapol_test -c eap-sim.conf -s testing123,
> 
> The authentication also failed. So now maybe some other
> configurations I did not do right .......
> 

OK I have identified the configuration error. It seems in my set up I got the triplet configuration in the reverse order ( eg RAND1 on client becomes RAND3 on the server vice vesa ). After fixing that hostapd/eapol_test are able to work even if the eap_sim_db is giving the pending behaviour. 

Now the question is how to plug this PENDING behaviour into freeradius.


From kaniki.uday  Sat Sep 17 02:55:57 2011
From: kaniki.uday (uday kiran)
Date: Sat, 17 Sep 2011 15:25:57 +0530
Subject: Possibility of bypassing hostapd's "Radius Client"
In-Reply-To: <CAOeh9MuQdwbwafN4MN4t1oHS-53T2RfLeqWvs0c4kVG11Je_bQ@mail.gmail.com>
References: <CAOeh9MuQdwbwafN4MN4t1oHS-53T2RfLeqWvs0c4kVG11Je_bQ@mail.gmail.com>
Message-ID: <CAOeh9Mvm33AhM9aoG7eGcxfrVsC_U2k5BD-csunxn4cUTWEfBA@mail.gmail.com>

Can some one help me on this ?

On Fri, Sep 16, 2011 at 1:42 PM, uday kiran <kaniki.uday at gmail.com> wrote:

> Hi
>
> I am running a radius client on my machine.
>
> I have few queries
>
> 1) Can I use the radius client running in my machine instead of hostapd's
> radius client ?
> 2) Is that possbile to do it through hostapd.config ?
>
> One question specific to radisu clients. Can i run more than one radius
> clients in my machine ?
>
> -Uday
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110917/ab96c36f/attachment.htm 


From kinoyatov  Sat Sep 17 09:22:57 2011
From: kinoyatov (Khamidulla Inoyatov)
Date: Sun, 18 Sep 2011 01:22:57 +0900
Subject: Hostapd as remote authenticator
Message-ID: <CAGqDgf7G5oDWRHbOOJzDn+eES1-mPqb3QTFsOOQXh971n65a_w@mail.gmail.com>

Dear hostapd mailing list memebers,

I want to know following things about hostapd in topology below:

MN <---wireless link----> AP < ---- wired link -----> PC with two eth
interface where hostapd installed <----wired link---->AAA Server

- Can hostapd be installed in PC with two eth interfaces and control
remotely AP for authentication in above topology?
- what dose it mean "driver=wired" in hostapd configuration file? dose it
mean remote control of AP or control just wired mac?
- Can hostapd installed in AP with limited functionality like station
management entity while authenticator functionality will be in PC with two
eth interface where hostapd installed?
- Is there some documentation about how to configure IAPP?
- Is there some documents about how to configure IEEE 802.11r?
- Is IEEE 802.11r current implementation compatible with EAP-TLS?

Currently i want to configure IEEE 802.11r in Access Point while
Authenticator capabilities will be in other PC in network. And
authentication will be using EAP-TLS. Is this kind of scenario is possible?

Thank you in advance for your replay.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110918/9c544a5c/attachment.htm 


From j  Sat Sep 17 11:03:33 2011
From: j (Jouni Malinen)
Date: Sat, 17 Sep 2011 21:03:33 +0300
Subject: Hostapd as remote authenticator
In-Reply-To: <CAGqDgf7G5oDWRHbOOJzDn+eES1-mPqb3QTFsOOQXh971n65a_w@mail.gmail.com>
References: <CAGqDgf7G5oDWRHbOOJzDn+eES1-mPqb3QTFsOOQXh971n65a_w@mail.gmail.com>
Message-ID: <20110917180333.GA8111@jm.kir.nu>

On Sun, Sep 18, 2011 at 01:22:57AM +0900, Khamidulla Inoyatov wrote:
> I want to know following things about hostapd in topology below:
> 
> MN <---wireless link----> AP < ---- wired link -----> PC with two eth
> interface where hostapd installed <----wired link---->AAA Server
> 
> - Can hostapd be installed in PC with two eth interfaces and control
> remotely AP for authentication in above topology?

No, that is not supported.

> - what dose it mean "driver=wired" in hostapd configuration file? dose it
> mean remote control of AP or control just wired mac?

It is for controlling a wired network interface.

> - Can hostapd installed in AP with limited functionality like station
> management entity while authenticator functionality will be in PC with two
> eth interface where hostapd installed?

No

> - Is there some documentation about how to configure IAPP?

Not really; IAPP is pretty much dead at this point.

> - Is there some documents about how to configure IEEE 802.11r?

I'm not aware of proper documentation, but some notes describing
how it can be configured has been posted on this mailing list.

> - Is IEEE 802.11r current implementation compatible with EAP-TLS?

Yes

> Currently i want to configure IEEE 802.11r in Access Point while
> Authenticator capabilities will be in other PC in network. And
> authentication will be using EAP-TLS. Is this kind of scenario is possible?

Not supported currently.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sat Sep 17 11:08:53 2011
From: j (Jouni Malinen)
Date: Sat, 17 Sep 2011 21:08:53 +0300
Subject: Possibility of bypassing hostapd's "Radius Client"
In-Reply-To: <CAOeh9MuQdwbwafN4MN4t1oHS-53T2RfLeqWvs0c4kVG11Je_bQ@mail.gmail.com>
References: <CAOeh9MuQdwbwafN4MN4t1oHS-53T2RfLeqWvs0c4kVG11Je_bQ@mail.gmail.com>
Message-ID: <20110917180853.GB8111@jm.kir.nu>

On Fri, Sep 16, 2011 at 01:42:27PM +0530, uday kiran wrote:
> 1) Can I use the radius client running in my machine instead of hostapd's
> radius client ?

Could you please provide more detailed description of what you are
trying to do? The IEEE 802.1X EAPOL authenticator in hostapd is pretty
tightly coupled with the internal RADIUS client implementation, so there
may be need for considerable number of changes to be able to use another
RADIUS client implementation.

> One question specific to radisu clients. Can i run more than one radius
> clients in my machine ?

Yes, the RADIUS protocol does not place limitations on this.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sun Sep 18 01:07:04 2011
From: j (Jouni Malinen)
Date: Sun, 18 Sep 2011 11:07:04 +0300
Subject: eap_sim_db_receive is not called
In-Reply-To: <1316040270.16675.YahooMailClassic@web161426.mail.bf1.yahoo.com>
References: <20110914153742.GC12912@jm.kir.nu>
	<1316040270.16675.YahooMailClassic@web161426.mail.bf1.yahoo.com>
Message-ID: <20110918080704.GA3454@jm.kir.nu>

On Wed, Sep 14, 2011 at 03:44:30PM -0700, Ming-Ching Tiew wrote:
> 1. Basically if one calls eloop_run() early, when there is 
>    nothing registered, then the function runs to completion 
>    and exited. So it was as good as not called.

Yes, that is expected behavior.

> 2. eloop_run() is a blocking function when something is registered,
>    so in the hostapd code it daemonized everything else and keep
>    its main thread to  service eloop_run(). Which means when I
>    used it in libeap.so I also have to provide a thread to service
>    eloop_run().

I'm not sure whether running a separate thread for this is the best way
of integrating with other programs, but it is one option. The other
approach would be to implement the eloop API using whatever mechanism
the parent program is using.

> But I still failed to get the radius client to authenticate properly 
> due to the PENDING reply behaviour - as I posted in freeradius maillist.

hostapd uses this to handle EAP authentication that depends on some
external data to avoid blocking the process.

> What I am not sure now is the purpose of the callback function in 
> the context of using libeap.so for realtime radius client-server
> authentication. Maybe I did not do this correctly and the caused 
> the failed radius authentication.
> 
> I suspect because freeradius does not like the pending behaviour - so I
> probably will look inside libeap.so to change the pending behaviour 
> of eap_sim_db to a blocking one.

Unless you are planning on creating a new thread for every EAP-SIM
authentication, that may not be very good idea..

What exactly are you trying to achieve here? It would likely be easier
to just run hostapd as an external process for the authentication and
proxy the queries through FreeRADIUS. Blocking the thread while waiting
for SIM parameters does not sound like a good solution and getting the
re-process-previous-EAP-message mechanism working may require
considerable amount of design changes within FreeRADIUS.

-- 
Jouni Malinen                                            PGP id EFC895FA


From fracting  Sun Sep 18 04:37:45 2011
From: fracting (Qian Hong)
Date: Sun, 18 Sep 2011 19:37:45 +0800
Subject: Need help with off-standard 802.1x authentication on Linux
Message-ID: <CALd+sZQT0aYO57NoMTu+gjksq3Q_4Y3VjY247C+_TuVbTUwM8A@mail.gmail.com>

Hi all, I'm new to here, so please let me know if get to the wrong list.

I'm a Linux user from China, lot's of Linux users especially student
users like me have great trouble while using Linux, that's the
Internet connection. Many universities here use all kinds of private
off-standard 802.1x authentication for network connection,
unfortunately , those off-standard 802.1x authentication are usually
not supported on Linux. The good news is, some of them now have open
source implement by black-box analysis and disassemble on their close
source Windows client.

The actually questions I would like to get answers here are below:
1. If there is a private off-standard 802.1x authentication protocol
,which is supported by some third party open source client, then will
wpa_supplicant project support it in the future to?
Integrate those off-standard 802.1x protocal in wpa_supplicant will
bring enormous benefits to end users :(1) users can use
network-manager gui to connect to Internet gracefully without command
line skills; (2) A new operating system without 802.1x client in
college campus network is really painful for user, she should connect
to internet to download a 802.1x client first -- if you want to
connect to internet, you must connect to internet first... What a f**k
loop, isn't it? If a Linux distribution ship those off-standard 802.1x
client by default, then there will be more convenience.

If yes, how can we getting involved (maybe as an end user, not a
developer right now)
If no, how does it depend on legal issues and how does it depend on
technical reasons ?

2. If some of private off-standard 802.1x authentication is still
mystery, will  wpa_supplicant developer hack on them?

Here are some examples of private off-standard 802.1x authentication
client (and there open source implement)

H3C INode
Official Website(Chinese) :
http://www.h3c.cn/Service/Document_Center/IP_Management/H3C_iNode/
Third party open source implement: git://github.com/liuqun/njit8021xclient

Ruijie
Official Website: http://www.ruijienetworks.com/
Third party open source implement: http://code.google.com/p/mentohust/

Dr.com
Official Website: http://www.doctorcom.com/en/index.php
Third party open source implement: http://sourceforge.net/projects/drcom-client/

and so on...

Thanks for any suggestions!


-- 
Regards,
Qian Hong
-
Sent from Ubuntu
http://www.ubuntu.com/


From mctiew  Sun Sep 18 06:29:33 2011
From: mctiew (Ming-Ching Tiew)
Date: Sun, 18 Sep 2011 06:29:33 -0700 (PDT)
Subject: eap_sim_db_receive is not called
In-Reply-To: <20110918080704.GA3454@jm.kir.nu>
Message-ID: <1316352573.7094.YahooMailClassic@web161421.mail.bf1.yahoo.com>


--- On Sun, 9/18/11, Jouni Malinen <j at w1.fi> wrote:

> > 
> > I suspect because freeradius does not like the pending
> behaviour - so I
> > probably will look inside libeap.so to change the
> pending behaviour 
> > of eap_sim_db to a blocking one.
> 
> Unless you are planning on creating a new thread for every
> EAP-SIM
> authentication, that may not be very good idea..
>

I believe that's exactly the achitecture of freeradius.
I will have to ask the comments of the freeradius experts, 
as I have limited knowledge about freeradius but based
on what I understand, freeradius keeps a configurable pool 
of threads to service each radius client request. There is 
no pending, each thread is destined to service one particular 
request till completion, success or failure.
 
> What exactly are you trying to achieve here? It would
> likely be easier
> to just run hostapd as an external process for the
> authentication and
> proxy the queries through FreeRADIUS. Blocking the thread
> while waiting
> for SIM parameters does not sound like a good solution and
> getting the
> re-process-previous-EAP-message mechanism working may
> require
> considerable amount of design changes within FreeRADIUS.
> 

That's certainly one other possibility - perhaps the easier one.:)

But in terms of scalability, I would need some input here. 
Correctly me if I am wrong, but it appears to me that hostapd 
depends on event loop architecture to achieve concurrency, 
which fundamentally it is single threaded. Would this able to 
fully capitalize on the availability and abundance of 
multi-core multi-CPU machine to service as many requests as possible ? 


From j  Sun Sep 18 07:58:07 2011
From: j (Jouni Malinen)
Date: Sun, 18 Sep 2011 17:58:07 +0300
Subject: eap_sim_db_receive is not called
In-Reply-To: <1316352573.7094.YahooMailClassic@web161421.mail.bf1.yahoo.com>
References: <20110918080704.GA3454@jm.kir.nu>
	<1316352573.7094.YahooMailClassic@web161421.mail.bf1.yahoo.com>
Message-ID: <20110918145807.GA4941@jm.kir.nu>

On Sun, Sep 18, 2011 at 06:29:33AM -0700, Ming-Ching Tiew wrote:
> But in terms of scalability, I would need some input here. 
> Correctly me if I am wrong, but it appears to me that hostapd 
> depends on event loop architecture to achieve concurrency, 
> which fundamentally it is single threaded. Would this able to 
> fully capitalize on the availability and abundance of 
> multi-core multi-CPU machine to service as many requests as possible ? 

No, hostapd is running in a single thread and it will not benefit from
multiple cores/CPUs. The common use cases for hostapd have not really
been targeting multi-core setups. I guess this will change eventually
since many platforms are moving to using multiple cores.

Anyway, as far as EAP-SIM and EAP-AKA are concerned, they are not really
that CPU intensive. Do you have reason to believe that the use case you
are thinking of would have problems surviving with a single core running
the authentications? You would need to have seriously large network to
hit that.. And at that point, you could as well run a frontend RADIUS
proxy to do load balancing between multiple hostapd processes if you
want to take advantage of multi-core setups.

-- 
Jouni Malinen                                            PGP id EFC895FA


From aland  Sun Sep 18 08:35:27 2011
From: aland (Alan DeKok)
Date: Sun, 18 Sep 2011 17:35:27 +0200
Subject: eap_sim_db_receive is not called
In-Reply-To: <1316352573.7094.YahooMailClassic@web161421.mail.bf1.yahoo.com>
References: <1316352573.7094.YahooMailClassic@web161421.mail.bf1.yahoo.com>
Message-ID: <4E760FBF.2070001@deployingradius.com>

Ming-Ching Tiew wrote:
> I believe that's exactly the achitecture of freeradius.
> I will have to ask the comments of the freeradius experts, 
> as I have limited knowledge about freeradius but based
> on what I understand, freeradius keeps a configurable pool 
> of threads to service each radius client request. There is 
> no pending, each thread is destined to service one particular 
> request till completion, success or failure.

  No.  The pool of threads handles requests pretty much at random.  Each
thread handles one request, and does not maintain any state.

  However, each thread ends up calling the EAP module.  That module
*does* keep state for an EAP session.

> But in terms of scalability, I would need some input here. 
> Correctly me if I am wrong, but it appears to me that hostapd 
> depends on event loop architecture to achieve concurrency, 
> which fundamentally it is single threaded. Would this able to 
> fully capitalize on the availability and abundance of 
> multi-core multi-CPU machine to service as many requests as possible ? 

  IMHO, no.  The event architecture likely works best only for one CPU.

  Alan DeKok.





From aland  Sun Sep 18 08:38:04 2011
From: aland (Alan DeKok)
Date: Sun, 18 Sep 2011 17:38:04 +0200
Subject: eap_sim_db_receive is not called
In-Reply-To: <20110918080704.GA3454@jm.kir.nu>
References: <20110914153742.GC12912@jm.kir.nu>	<1316040270.16675.YahooMailClassic@web161426.mail.bf1.yahoo.com>
	<20110918080704.GA3454@jm.kir.nu>
Message-ID: <4E76105C.3050602@deployingradius.com>

Jouni Malinen wrote:
> What exactly are you trying to achieve here? It would likely be easier
> to just run hostapd as an external process for the authentication and
> proxy the queries through FreeRADIUS. Blocking the thread while waiting
> for SIM parameters does not sound like a good solution

  Blocking RADIUS servers is never a good idea.

> and getting the
> re-process-previous-EAP-message mechanism working may require
> considerable amount of design changes within FreeRADIUS.

  It won't happen...

  Allowing the EAP module to wait for an external process *without*
blocking the server would also require major changes.

  Alan DeKok.


From j  Sun Sep 18 09:17:54 2011
From: j (Jouni Malinen)
Date: Sun, 18 Sep 2011 19:17:54 +0300
Subject: Need help with off-standard 802.1x authentication on Linux
In-Reply-To: <CALd+sZQT0aYO57NoMTu+gjksq3Q_4Y3VjY247C+_TuVbTUwM8A@mail.gmail.com>
References: <CALd+sZQT0aYO57NoMTu+gjksq3Q_4Y3VjY247C+_TuVbTUwM8A@mail.gmail.com>
Message-ID: <20110918161754.GB4941@jm.kir.nu>

On Sun, Sep 18, 2011 at 07:37:45PM +0800, Qian Hong wrote:
> I'm a Linux user from China, lot's of Linux users especially student
> users like me have great trouble while using Linux, that's the
> Internet connection. Many universities here use all kinds of private
> off-standard 802.1x authentication for network connection,
> unfortunately , those off-standard 802.1x authentication are usually
> not supported on Linux. The good news is, some of them now have open
> source implement by black-box analysis and disassemble on their close
> source Windows client.

> The actually questions I would like to get answers here are below:
> 1. If there is a private off-standard 802.1x authentication protocol
> ,which is supported by some third party open source client, then will
> wpa_supplicant project support it in the future to?

It depends.. In general, I like to promote use of standard-based
solutions and protocols that have open standard. That said, if there are
are authentication mechanisms that are in common use, it sounds
reasonable to consider adding support for them.

> Integrate those off-standard 802.1x protocal in wpa_supplicant will
> bring enormous benefits to end users :(1) users can use
> network-manager gui to connect to Internet gracefully without command
> line skills; (2) A new operating system without 802.1x client in
> college campus network is really painful for user, she should connect
> to internet to download a 802.1x client first -- if you want to
> connect to internet, you must connect to internet first... What a f**k
> loop, isn't it? If a Linux distribution ship those off-standard 802.1x
> client by default, then there will be more convenience.

I agree that it would be desirable for Linux distributions to work
out-of-box on networks that are widely deployed.

> If yes, how can we getting involved (maybe as an end user, not a
> developer right now)
> If no, how does it depend on legal issues and how does it depend on
> technical reasons ?

Sending a feature request to this mailing list and reporting which
protocols are being used is a good start. I've never even heard of many
of the examples you mentioned. Unfortunately, there is still quite a bit
of language barrier that can explain that and while some of the
automated translation services are making it easier to get the needed
information, it can still slow down efforts getting these implemented.
It can certainly if people familiar with the custom authentication
mechanisms (or at least familiar with the language used in their
specification and/or implementations) can participate in the effort.

As far as legal issues are concerned, there can be potential problems in
using proprietary solutions. It is difficult to give generic comments on
this as this will mostly need to be handled on case by case basis.
Ideally there would be a publicly available description of the used
protocol, but if not, 3rd party reverse engineered implementations could
be considered as documentation.

> 2. If some of private off-standard 802.1x authentication is still
> mystery, will  wpa_supplicant developer hack on them?

I'm not completely sure what you ask here. In general, it will be
difficult to work on custom protocols without having access to a test
setup that can be used to verify protocol and implementation behavior,
so many cases can be too time consuming to justify the effort.

> Here are some examples of private off-standard 802.1x authentication
> client (and there open source implement)
> 
> H3C INode
> Official Website(Chinese) :
> http://www.h3c.cn/Service/Document_Center/IP_Management/H3C_iNode/
> Third party open source implement: git://github.com/liuqun/njit8021xclient

This looks like some kind of design based in wired IEEE 802.1X
authentication and the 802.1X part itself could even be standard
compliant (didn't really review it in detail). There is some kind of
custom EAP method (EAP type 20 which is unassigned). There seem to be
even university-based differences in how exactly those messages are
processed based on the comments. In addition, EAP notification may be
used in some custom way. The client seems to include support for
EAP-MD5, so that may be used, too.

I don't really like the concept of picking an unassigned EAP type and
using it for some custom purpose taken into account that this can easily
conflict with other uses should the specific EAP type actually get
assigned in the future. Anyway, it sounds possible to add support for
this in wpa_supplicant.

Would you happen to know how widely this is deployed? The comments in
njit8021xclient seemed to point to at least some university use. I would
assume this is a wired network using something from H3C (Huawei-3Com?).
Any idea whether the technology is still being developed and supported
(as part of HP now?)?

Do you know whether there is any documentation of the custom EAP method
or changes to EAP? H3C seemed to have some related documentation in
English available at
http://www.h3c.com/portal/Technical_Support___Documents/Technical_Documents/Switches/H3C_S12500_Series_Switches/Configuration/Operation_Manual/H3C_S12500_CG-Release1335-5W130/11/201108/722596_1285_0.htm

> Ruijie
> Official Website: http://www.ruijienetworks.com/
> Third party open source implement: http://code.google.com/p/mentohust/

This seemed to include some functionality that would be outside the
scope of wpa_supplicant. I'm not completely sure what exactly is in
scope, but there were some references on 8021x.exe (but that was not
really used for more than extracting something from the binary) and the
group MAC address for Ruijie (01:d0:f8:00:00:03) was used similarly to
the IEEE 802.1X EAPOL group address, so there is some connection, but it
would take more time to figure out what exactly is being done here.

> Dr.com
> Official Website: http://www.doctorcom.com/en/index.php
> Third party open source implement: http://sourceforge.net/projects/drcom-client/

This seems to be out of scope for wpa_supplicant functionality, so it
looks like the project could be integrated on its own to network
management functionality in a distro.

-- 
Jouni Malinen                                            PGP id EFC895FA


From erich.titl  Sun Sep 18 13:13:57 2011
From: erich.titl (Erich Titl)
Date: Sun, 18 Sep 2011 22:13:57 +0200
Subject: problems with wpa2-psk (was No user traffic through wlan0)
In-Reply-To: <CAGnc4p8xrgGXj5W1+wmb6rmziN_MGKn0Q15=h4uEBEJs_kL8aQ@mail.gmail.com>
References: <4E71EA2F.1010807@think.ch>
	<CAGnc4p8xrgGXj5W1+wmb6rmziN_MGKn0Q15=h4uEBEJs_kL8aQ@mail.gmail.com>
Message-ID: <4E765105.7090402@think.ch>

Hi Folks

here an update to my problem
...

>>
>> Now here is the catch....
>>
>> - I can associate fine with the AP
>> - DHCP assigns an address to wlan0 and installs a default route
> 
>> but...
>>
>> If I try to ping the WRT54GH I see arp requests going out which are
>> never replied to, therefore the packets will never be sent.
>>

If I set the AP to mode WPA-personal (meaning PSK :-( ) instead of
WPA2-personal, then the connection works fine.

> status
bssid=00:25:9c:09:aa:12
ssid=scoobly
id=0
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.217.100

STYX# ping 192.168.217.1
PING 192.168.217.1 (192.168.217.1): 56 data bytes
64 bytes from 192.168.217.1: seq=0 ttl=64 time=5.052 ms
64 bytes from 192.168.217.1: seq=1 ttl=64 time=2.396 ms
64 bytes from 192.168.217.1: seq=2 ttl=64 time=2.424 ms

there must be a glitch somewhere in either the AP's or wpasupplicants
WPA2 code. I can see in WPA2 that the association is renegotiated often.

cheers

Erich


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2182 bytes
Desc: S/MIME Kryptografische Unterschrift
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110918/7b8aa948/attachment.bin 


From twb-hostapd  Thu Sep 15 19:57:44 2011
From: twb-hostapd (Trent W. Buck)
Date: Fri, 16 Sep 2011 12:57:44 +1000
Subject: hostapd EAP-TLS CRL not working
Message-ID: <87ty89tijp.fsf@gmail.com>

[Please CC me if possible; I am not subscribed to this list.]

I'm having trouble blacklisting client certificates in my otherwise-
working hostapd WPA2 EAP-TLS setup, using hostapd's internal RADIUS
implementation.  Specifically, hostapd seems to be ignoring the CRL.

I'm really hoping someone can tell me what I'm doing wrong here, because
if I can't blacklist compromised client certificates, I'm gonna have to
pick PSK or some other EAP.

I have already asked the OpenWRT community for help, but I seem to be
the only OpenWRT user using EAP-TLS at all, let alone with a CRL.  I
also checked this list's archive, but could only see a couple of
CRL-related emails.

The AP runs OpenWRT 10.03.1-rc4 (ARM), running hostapd "20100705-1":

    root at widow:~# opkg update
    Downloading http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/Packages.gz.
    Inflating http://downloads.openwrt.org/backfire/10.03.1-rc4/ar71xx/packages/Packages.gz.
    Updated list of available packages in /var/opkg-lists/packages.
    root at widow:~# opkg list hostapd
    hostapd - 20100705-1 - This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
     Authenticator.
    root at widow:~# hostapd -v
    hostapd v0.8.x
    User space daemon for IEEE 802.11 AP management,
    IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
    Copyright (c) 2002-2010, Jouni Malinen <j at w1.fi> and contributors

You can find its source here.  I don't know if this includes the
OpenWRT-specific patches (if any):

    http://downloads.openwrt.org/sources/hostapd-20100705.tar.bz2

The client is Debian Unstable (x86-64), running wpa_supplicant 0.7.3-3:

    root at dali:~# wpa_supplicant -v
    wpa_supplicant v0.7.3
    Copyright (c) 2003-2010, Jouni Malinen <j at w1.fi> and contributors

Here is the hostapd config file:

    ctrl_interface=/var/run/hostapd-phy0
    driver=nl80211
    wmm_ac_bk_cwmin=4
    wmm_ac_bk_cwmax=10
    wmm_ac_bk_aifs=7
    wmm_ac_bk_txop_limit=0
    wmm_ac_bk_acm=0
    wmm_ac_be_aifs=3
    wmm_ac_be_cwmin=4
    wmm_ac_be_cwmax=10
    wmm_ac_be_txop_limit=0
    wmm_ac_be_acm=0
    wmm_ac_vi_aifs=2
    wmm_ac_vi_cwmin=3
    wmm_ac_vi_cwmax=4
    wmm_ac_vi_txop_limit=94
    wmm_ac_vi_acm=0
    wmm_ac_vo_aifs=2
    wmm_ac_vo_cwmin=2
    wmm_ac_vo_cwmax=3
    wmm_ac_vo_txop_limit=47
    wmm_ac_vo_acm=0
    tx_queue_data3_aifs=7
    tx_queue_data3_cwmin=15
    tx_queue_data3_cwmax=1023
    tx_queue_data3_burst=0
    tx_queue_data2_aifs=3
    tx_queue_data2_cwmin=15
    tx_queue_data2_cwmax=63
    tx_queue_data2_burst=0
    tx_queue_data1_aifs=1
    tx_queue_data1_cwmin=7
    tx_queue_data1_cwmax=15
    tx_queue_data1_burst=3.0
    tx_queue_data0_aifs=1
    tx_queue_data0_cwmin=3
    tx_queue_data0_cwmax=7
    tx_queue_data0_burst=1.5
    hw_mode=g
    channel=11

    ieee80211n=1
    ht_capab=[HT20][SHORT-GI-40][DSSS_CCK-40]
    interface=wlan0
    eap_server=1
    eap_user_file=/etc/hostapd/users
    server_cert=/etc/hostapd/hostapd.crt
    private_key=/etc/hostapd/hostapd.key
    ieee8021x=1
    wpa_key_mgmt=WPA-EAP
    wpa_group_rekey=300
    wpa_gmk_rekey=640
    auth_algs=1
    wpa=2
    wpa_pairwise=CCMP
    ssid=cyber
    bridge=br-lan
    wmm_enabled=1
    bssid=54:e6:fc:dc:d4:dc
    ignore_broadcast_ssid=0

    ca_cert=/etc/hostapd/cacrl.crt
    check_crl=1

Here is the cacrl.crt file, it revokes client cert 4dcb9cf5:

    -----BEGIN CERTIFICATE-----
    MIIDlzCCAoGgAwIBAgIETZGIaDALBgkqhkiG9w0BAQUwWjELMAkGA1UEBhMCQVUx
    GzAZBgNVBAoTEkN5YmVyIElUIFNvbHV0aW9uczERMA8GA1UECBMIVmljdG9yaWEx
    GzAZBgNVBAMTEkN5YmVyIElUIFNvbHV0aW9uczAeFw0xMTAzMjkwNzIxMTJaFw0x
    NjAzMjcwNzIxMTJaMFoxCzAJBgNVBAYTAkFVMRswGQYDVQQKExJDeWJlciBJVCBT
    b2x1dGlvbnMxETAPBgNVBAgTCFZpY3RvcmlhMRswGQYDVQQDExJDeWJlciBJVCBT
    b2x1dGlvbnMwggEfMAsGCSqGSIb3DQEBAQOCAQ4AMIIBCQKCAQDle4EzfINgMf7b
    v/edD19gArdKw/01CQ4vLf/HsO1wOmpMa6XMO/t0Raprtjeizz58Gw6lU+mjeAU2
    q7tJT4nPDHc3D5a0eYdUIpbL2d3LHNY9q+dXwx0DH1+bwLPSeiLgTedO/vsIQI14
    GNymRFDoQT7R5yn3QXi+Nl4hHQxMMEp4Gvk7V1xPrenRoyvhmnswfNAX1G6AU9p8
    AgusjoFrIlahIHKWQMJlJ6unewFV0gC/bjvB9o10X0RKTCd42P4IjnzHG/ybKDBT
    70QqZpqCgnW9UEKXF4M3k561YjwU96wAIxJv0MtKurmO1XX5TRGZODCLsupdXcDG
    47vzkmjNAgMBAAGjbDBqMA8GA1UdEwEB/wQFMAMBAf8wJwYDVR0lBCAwHgYIKwYB
    BQUHAwMGCCsGAQUFBwMJBggrBgEFBQcDCDAPBgNVHQ8BAf8EBQMDBwYAMB0GA1Ud
    DgQWBBR3cRKQZhquqw6uZpycxMUlN4HJhzALBgkqhkiG9w0BAQUDggEBANdeu/Qy
    poJE4R1z4tBZyky2ATVtdMVHVIhw2sEml+UBLpRlvTvc3zC4c7kcDpvJl8eHilKZ
    rmyypoCofIfUW3OyOt8B20PRbcZjC4bbo5ZZAXiJAwEZdgu4JRcOQIDKEY5A/Idt
    jNFMDUqqTe3tN+u/SEFHSB1XUjVxJ+NU2f5KZA3JH3K0HKpuwdq9w9fCRETc1TWY
    zFI5VUI5rm98179BfP9TYaFWxJE7Ps5VIHzO47BCVPZzAE/V/L/NC78FUylAm7hX
    Up60BufNCcO6UIJtiTYBJ20TF1J9OVm/84/A4ef5lfxrDVVNqBcwDwMmG1FxZ2w0
    hjHXwBGqbvatSOQ=
    -----END CERTIFICATE-----
    -----BEGIN X509 CRL-----
    MIIB6TCB1AIBATALBgkqhkiG9w0BAQUwWjELMAkGA1UEBhMCQVUxGzAZBgNVBAoT
    EkN5YmVyIElUIFNvbHV0aW9uczERMA8GA1UECBMIVmljdG9yaWExGzAZBgNVBAMT
    EkN5YmVyIElUIFNvbHV0aW9ucxcNMTEwOTE1MDkwMDA3WhcNMjEwOTEyMDkwMDA3
    WjAXMBUCBE3LnPUXDTExMDkxNTA5MDAwN1qgLzAtMB8GA1UdIwQYMBaAFHdxEpBm
    Gq6rDq5mnJzExSU3gcmHMAoGA1UdFAQDAgEAMAsGCSqGSIb3DQEBBQOCAQEAJC+F
    5CatLrp7WBr2siXIKkACy5L9/79hcU/XI/PcLYZYy88IdGms+z3j1c7KA+zwsTTd
    wSXzc2RSnKMPou55goqRzrbRjBT692uGQPDxqlw3cn51N3B7q5Lf3t1jhf9QZpnb
    CElyjUPTZ6yAxJMMgV7BmQ9KWyoHGZU48lEhIYbxjAmPtgOpYReUbIyPZ6IZTeT4
    6nkdCdYL7cRLxNHqgkQVLh9NosD+69cdYVZ5g9Yc5zb59uQo6Ro5RHL3nbpqbZgY
    uMRDXYGdoAL5YpMwrcs9Qs0WAbDIDfYHJr6PkNAfphmBN9XOyPAq4nSyn5FcgB1A
    FuYIfgNr2Jr2H712MA==
    -----END X509 CRL-----

That serial (4dcb9cf5) corresponds to the one used on the Debian client
(sorry, I won't attach that cert):

    root at dali:~# certtool -i </etc/wpa_supplicant/dali.crt | grep 4dcb9cf5
            Serial Number (hex): 4dcb9cf5

Here is the output of hostapd without -d's, showing the client
successfully connecting despite the CRL:

    root at widow:~# hostapd /var/run/hostapd-phy0.conf
    Configuration file: /var/run/hostapd-phy0.conf
    Using interface wlan0 with hwaddr 54:e6:fc:dc:d4:dc and ssid 'cyber'
    wlan0: STA 1c:4b:d6:81:b6:18 IEEE 802.11: authenticated
    wlan0: STA 1c:4b:d6:81:b6:18 IEEE 802.11: associated (aid 1)
    CTRL-EVENT-EAP-STARTED 1c:4b:d6:81:b6:18
    CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
    CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=13
    CTRL-EVENT-EAP-SUCCESS 1c:4b:d6:81:b6:18
    wlan0: STA 1c:4b:d6:81:b6:18 WPA: pairwise key handshake completed (RSN)
    AP-STA-CONNECTED 1c:4b:d6:81:b6:18
    wlan0: STA 1c:4b:d6:81:b6:18 RADIUS: starting accounting session 4E71C3D6-00000000
    wlan0: STA 1c:4b:d6:81:b6:18 IEEE 802.1X: authenticated - EAP type: 0 ((null))

Attached are hostapd transcripts of more successful connections, with
debugging turned on, with check_crl=1 (as above), and with that line
commented out of the .conf file.  As you can see, they look to be
identical -- as if hostapd isn't even parsing the CRL.

<elided so mailman won't hold for moderation for being too big>

Here is what the client sees:

    root at dali:~# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
    ioctl[SIOCSIWENCODEEXT]: Invalid argument
    ioctl[SIOCSIWENCODEEXT]: Invalid argument
    Trying to associate with 54:e6:fc:dc:d4:dc (SSID='cyber' freq=2462 MHz)
    Associated with 54:e6:fc:dc:d4:dc
    CTRL-EVENT-EAP-STARTED EAP authentication started
    CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=13
    OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
    OpenSSL: pending error: error:140C800D:SSL routines:SSL_use_certificate_file:ASN1 lib
    OpenSSL: pending error: error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error
    OpenSSL: pending error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
    OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
    OpenSSL: pending error: error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib
    OpenSSL: pending error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
    OpenSSL: pending error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
    OpenSSL: pending error: error:140CB00D:SSL routines:SSL_use_PrivateKey_file:ASN1 lib
    CTRL-EVENT-EAP-METHOD EAP vendor 0 method 13 (TLS) selected
    CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/C=AU/O=Cyber IT Solutions/ST=Victoria/CN=Cyber IT Solutions'
    CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/C=AU/O=Cyber IT Solutions/ST=Victoria/CN=cyber'
    CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
    WPA: Key negotiation completed with 54:e6:fc:dc:d4:dc [PTK=CCMP GTK=CCMP]
    CTRL-EVENT-CONNECTED - Connection to 54:e6:fc:dc:d4:dc completed (auth) [id=0 id_str=]
    CTRL-EVENT-DISCONNECTED bssid=54:e6:fc:dc:d4:dc reason=0
    ioctl[SIOCSIWENCODEEXT]: Invalid argument
    ioctl[SIOCSIWENCODEEXT]: Invalid argument
    Trying to associate with 54:e6:fc:dc:d4:dc (SSID='cyber' freq=2462 MHz)
    ^CCTRL-EVENT-TERMINATING - signal 2 received

PS: from past experience with with SSL issues (OpenLDAP), my first guess
is that OpenWRT's hostapd is compiled against GnuTLS (unconfirmed), and
it will Just Work after recompiling against OpenSSL.



From mctiew  Sun Sep 18 20:17:43 2011
From: mctiew (Ming-Ching Tiew)
Date: Sun, 18 Sep 2011 20:17:43 -0700 (PDT)
Subject: eap_sim_db_receive is not called
In-Reply-To: <4E76105C.3050602@deployingradius.com>
Message-ID: <1316402263.13838.YahooMailClassic@web161424.mail.bf1.yahoo.com>



--- On Sun, 9/18/11, Alan DeKok <aland at deployingradius.com> wrote:

> > Blocking the thread while waiting
> > for SIM parameters does not sound like a good solution
> 
> ? Blocking RADIUS servers is never a good idea.
> 

On the freeradius architecture, what do you think is the best way out ?
There is a dependency on external data, if the data comes back fast,
everything is alright. But we can't really guarantee this. It might
be a slow external network, it might be a failed network as well, it 
might also be a slow external database ( a slow HLR ? ) beyond our
control. 

I would imagine that a blocking behaviour with a timeout capability
will be the best compromise to fit the freeradius architecture ?

Best regards.





From kinoyatov  Mon Sep 19 01:04:15 2011
From: kinoyatov (Khamidulla Inoyatov)
Date: Mon, 19 Sep 2011 17:04:15 +0900
Subject: HostAP Digest, Vol 101, Issue 24
In-Reply-To: <mailman.45442.1316360135.8032.hostap@lists.shmoo.com>
References: <mailman.45442.1316360135.8032.hostap@lists.shmoo.com>
Message-ID: <CAGqDgf7w5Htq1gMON2Z_RCyNK1VKq5DzH7si86kcKbW0FeZtdg@mail.gmail.com>

Dear Jouni Malinen,

Tank you for your quick replay. I appreciate your time and consideration.
However i have some question regarding separation of Authentication
functionalists of hostapd. In your replay you wrote:


> Currently i want to configure IEEE 802.11r in Access Point while
> > Authenticator capabilities will be in other PC in network. And
> > authentication will be using EAP-TLS. Is this kind of scenario is
> possible?
>
> Not supported currently.



Can SME and Access Controller functionalists of hostapd spited using CAPWAP?
if CAPWAP will implemented in hostapd as one separate functional block.

Sincerely yours,
Khamidulla Inoyatov


> Message: 2
> Date: Sat, 17 Sep 2011 21:03:33 +0300
> From: Jouni Malinen <j at w1.fi>
> Subject: Re: Hostapd as remote authenticator
> To: hostap at lists.shmoo.com
> Message-ID: <20110917180333.GA8111 at jm.kir.nu>
> Content-Type: text/plain; charset=us-ascii
>
> On Sun, Sep 18, 2011 at 01:22:57AM +0900, Khamidulla Inoyatov wrote:
> > I want to know following things about hostapd in topology below:
> >
> > MN <---wireless link----> AP < ---- wired link -----> PC with two eth
> > interface where hostapd installed <----wired link---->AAA Server
> >
> > - Can hostapd be installed in PC with two eth interfaces and control
> > remotely AP for authentication in above topology?
>
> No, that is not supported.
>
> > - what dose it mean "driver=wired" in hostapd configuration file? dose it
> > mean remote control of AP or control just wired mac?
>
> It is for controlling a wired network interface.
>
> > - Can hostapd installed in AP with limited functionality like station
> > management entity while authenticator functionality will be in PC with
> two
> > eth interface where hostapd installed?
>
> No
>
> > - Is there some documentation about how to configure IAPP?
>
> Not really; IAPP is pretty much dead at this point.
>
> > - Is there some documents about how to configure IEEE 802.11r?
>
> I'm not aware of proper documentation, but some notes describing
> how it can be configured has been posted on this mailing list.
>
> > - Is IEEE 802.11r current implementation compatible with EAP-TLS?
>
> Yes
>
> > Currently i want to configure IEEE 802.11r in Access Point while
> > Authenticator capabilities will be in other PC in network. And
> > authentication will be using EAP-TLS. Is this kind of scenario is
> possible?
>
> Not supported currently.
>
> --
> Jouni Malinen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110919/9792dd6d/attachment.htm 


From kaniki.uday  Mon Sep 19 06:48:23 2011
From: kaniki.uday (uday kiran)
Date: Mon, 19 Sep 2011 19:18:23 +0530
Subject: Possibility of bypassing hostapd's "Radius Client"
Message-ID: <CAOeh9MsqNgMe1JNyysdCBtgwx_u=SbyyCjG46P+HDJPW_KZdPg@mail.gmail.com>

>> Could you please provide more detailed description of what you are
>> trying to do?

I am using one application which runs RADIUS client and IEEE 802.1x EAPOL
authenticator. I am using this application to authenticate the "wired" users
connected to ethernet ports . At the same time , i want to run hostapd to
authenticate the "wi-fi" users too ( I have wired and wi-fi ports on my
machine).

I want to avoid the redundency of running two RADIUS clients and two EAPOL
authenticators ( Just came to know that my application also got one EAPOL
authenticator).

Hence I want to detach that part of hostapd , so that I can use my
application's RADIUS client and EAPOL code  for authenticating both wired
and wireless users.

Is that a good approach ? Awaiting your comments ?

Thanks
Uday
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110919/b5a0d27a/attachment.htm 


From yegor_sub1  Mon Sep 19 07:28:35 2011
From: yegor_sub1 (Yegor Yefremov)
Date: Mon, 19 Sep 2011 16:28:35 +0200
Subject: libnl-3.1/3.2 compilation issue
Message-ID: <4E775193.60503@visionsystems.de>

Hello,

I was trying to compile wpa_supplicant against libnl-3.2.0 (Buildroot) and my build failed with following error message:

../src/drivers/driver_nl80211.c:22:31: fatal error: netlink/genl/genl.h: No such file or directory

the cause is, since libnl-3.1 header files will be installed to ../include/libnl3/netlink and not direct to ../include/netlink. See this commit message for explanations:
http://git.infradead.org/users/tgr/libnl.git/commitdiff/d3bb7c9cf16587c71fc01311fe6d8ae5a0280246?hp=1c9b175a47530f7ce38d934856a08df284c9cb8f

How can libnl version be automatically detected? One way were to call pkg-config in drivers.mak and set CFLAGS and LDFLAGS properly. See iw->Makefile for how they manage this (though this process must corrected to catch up with recent libnl changes):

http://git.sipsolutions.net/?p=iw.git;a=blob;f=Makefile;h=8443ee69f26fdabf603356c1895e6b036fc3a35e;hb=HEAD

What do you think about it? 

Yegor


From raghunathan.kailasanathan  Mon Sep 19 08:28:42 2011
From: raghunathan.kailasanathan (raghunathan.kailasanathan at wipro.com)
Date: Mon, 19 Sep 2011 15:28:42 +0000
Subject: Enterprise implementation for RTOS
In-Reply-To: <4E765105.7090402@think.ch>
References: <4E71EA2F.1010807@think.ch>
	<CAGnc4p8xrgGXj5W1+wmb6rmziN_MGKn0Q15=h4uEBEJs_kL8aQ@mail.gmail.com>
	<4E765105.7090402@think.ch>
Message-ID: <F099D0EF3989304DBA09D2E81781FF0B049DC3DC@BLR-SJP-MBX4.wipro.com>

Hi all,
For adding EAP support to my embedded device (wifi client), which runs a RTOS,  I am going through the enterprise implementation in hostapd. 

By inspecting the code it looks like eap_peer and eap_common modules are all that would need to be ported. Is that correct ? 

Since the wifi chipset on my device has support for WPA/WPA2, do I still require the tls and crypto modules from hostapd ? 

Are there any other modules that I need apart from the ones mentioned above ?

Regards
Raghu

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com


From j  Mon Sep 19 09:46:51 2011
From: j (Jouni Malinen)
Date: Mon, 19 Sep 2011 19:46:51 +0300
Subject: Possibility of bypassing hostapd's "Radius Client"
In-Reply-To: <CAOeh9MsqNgMe1JNyysdCBtgwx_u=SbyyCjG46P+HDJPW_KZdPg@mail.gmail.com>
References: <CAOeh9MsqNgMe1JNyysdCBtgwx_u=SbyyCjG46P+HDJPW_KZdPg@mail.gmail.com>
Message-ID: <20110919164651.GA10722@jm.kir.nu>

On Mon, Sep 19, 2011 at 07:18:23PM +0530, uday kiran wrote:
> I am using one application which runs RADIUS client and IEEE 802.1x EAPOL
> authenticator. I am using this application to authenticate the "wired" users
> connected to ethernet ports . At the same time , i want to run hostapd to
> authenticate the "wi-fi" users too ( I have wired and wi-fi ports on my
> machine).
> 
> I want to avoid the redundency of running two RADIUS clients and two EAPOL
> authenticators ( Just came to know that my application also got one EAPOL
> authenticator).

How much do you want to avoid that redundancy? Like I mentioned, there
should be no problems in running two RADIUS clients on the same host and
as such, you should be able to already use the design as-is..

> Hence I want to detach that part of hostapd , so that I can use my
> application's RADIUS client and EAPOL code  for authenticating both wired
> and wireless users.
> 
> Is that a good approach ? Awaiting your comments ?

Depends on how much you are interested in doing additional work in
hostapd to make it possible to use another RADIUS client. I don't see
enough justification for doing that, but you are obviously free to go
through that exercise if you think it is needed.

-- 
Jouni Malinen                                            PGP id EFC895FA


From kinoyatov  Mon Sep 19 11:51:00 2011
From: kinoyatov (Khamidulla Inoyatov)
Date: Tue, 20 Sep 2011 03:51:00 +0900
Subject: Hostapd as remote authenticator
In-Reply-To: <CAGqDgf7G5oDWRHbOOJzDn+eES1-mPqb3QTFsOOQXh971n65a_w@mail.gmail.com>
References: <CAGqDgf7G5oDWRHbOOJzDn+eES1-mPqb3QTFsOOQXh971n65a_w@mail.gmail.com>
Message-ID: <CAGqDgf6S5G=QqqhB9tLJDxn=Pcu-no=svYysdOe70bVkL-SP2w@mail.gmail.com>

Dear Jouni Malinen,

Tank you for your quick replay. I appreciate your time and consideration.
However i have some question regarding separation of Authentication
functionalists of hostapd. In your replay you wrote:


>* Currently i want to configure IEEE 802.11r in Access Point while*>* > Authenticator capabilities will be in other PC in network. And*>* > authentication will be using EAP-TLS. Is this kind of scenario is*>* possible?*>**>* Not supported currently.*


Can SME and Access Controller functionalists of hostapd spited using CAPWAP?
if CAPWAP will implemented in hostapd as one separate functional block.

P.S. How can I download hostapd_devel.pdf?

Sincerely yours,
Khamidulla Inoyatov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110920/ff1cd0cc/attachment.htm 


From Hong.Wu  Mon Sep 19 23:11:07 2011
From: Hong.Wu (Hong Wu)
Date: Tue, 20 Sep 2011 09:11:07 +0300
Subject: Does wpa_supplicant support static WEP + IEEE802.1x authentication?
Message-ID: <5EFF534737810441B0F97C2792E49C2DBF354D@ILMAIL01.dspg.com>

Hi,

 

Some of old APs support static WEP + IEEE802.1x EAP authentication to
raise security level. My question is: does wpa_supplicant support static
WEP + IEEE802.1x EAP-MD5 authentication? If it does, how to configure
wpa_supplicant for static WEP + EAP authentication? 

 

Thanks,

Hong


______________________________________________________________________
DSP Group, Inc. automatically scans all emails and attachments using MessageLabs Email Security System.
_____________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110920/bab27801/attachment.htm 


From yogeshp  Tue Sep 20 00:08:08 2011
From: yogeshp (Yogesh Ashok Powar)
Date: Tue, 20 Sep 2011 12:38:08 +0530
Subject: [RFC] hostapd: Make inactivity polling configurable
Message-ID: <20110920070802.GA2404@hertz.marvell.com>

Hostapd uses the poll method to check if the station is alive
after the station has been inactive for ap_max_inactivity seconds.
Make the poll mechanism  configurable so that user can choose
disconnect idle clients.

This can be especially useful when some devices/firmwares have
restrictions on the number of clients that can connect to the AP
and in practical scenario's this limit can be much lesser than
the current limit in the hostpad which is 255.

Signed-off-by: Yogesh Ashok Powar <yogeshp at marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants at marvell.com>
---
 hostapd/config_file.c |    2 ++
 hostapd/hostapd.conf  |    7 +++++++
 src/ap/ap_config.h    |    1 +
 src/ap/sta_info.c     |    6 +++++-
 4 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 6ffa981..5a3c9f7 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2041,6 +2041,8 @@ struct hostapd_config * hostapd_config_read(const char *fname)
 #endif /* CONFIG_P2P_MANAGER */
 		} else if (os_strcmp(buf, "disassoc_low_ack") == 0) {
 			bss->disassoc_low_ack = atoi(pos);
+		} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
+			bss->skip_inactivity_poll = atoi(pos);
 		} else if (os_strcmp(buf, "tdls_prohibit") == 0) {
 			int val = atoi(pos);
 			if (val)
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 3e145ae..ae16f0d 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -339,6 +339,13 @@ wmm_ac_vo_acm=0
 # the STA with a data frame.
 # default: 300 (i.e., 5 minutes)
 #ap_max_inactivity=300
+#
+#
+# The polling is configurable for users. Users who wish to skip the
+# polling method and only use the station inactivity values to decide
+# to deauthenticate and disconnect stations can set skip_inactivity_poll
+# to 1 (default 0)
+#skip_inactivity_poll=0
 
 # Disassociate stations based on excessive transmission failures or other
 # indications of connection loss. This depends on the driver capabilities and
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 09eed5a..96b07ff 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -329,6 +329,7 @@ struct hostapd_bss_config {
 	int p2p;
 
 	int disassoc_low_ack;
+	int skip_inactivity_poll;
 
 #define TDLS_PROHIBIT BIT(0)
 #define TDLS_PROHIBIT_CHAN_SWITCH BIT(1)
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index ef90bf9..330a564 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -297,12 +297,16 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
 				"inactive too long: %d sec, max allowed: %d",
 				MAC2STR(sta->addr), inactive_sec,
 				hapd->conf->ap_max_inactivity);
+
+			if (hapd->conf->skip_inactivity_poll)
+				sta->timeout_next = STA_DISASSOC;
 		}
 	}
 
 	if ((sta->flags & WLAN_STA_ASSOC) &&
 	    sta->timeout_next == STA_DISASSOC &&
-	    !(sta->flags & WLAN_STA_PENDING_POLL)) {
+	    !((sta->flags & WLAN_STA_PENDING_POLL)
+		    || hapd->conf->skip_inactivity_poll)) {
 		wpa_msg(hapd, MSG_DEBUG, "Station " MACSTR " has ACKed data "
 			"poll", MAC2STR(sta->addr));
 		/* data nullfunc frame poll did not produce TX errors; assume
-- 
1.7.0.4



From johannes  Tue Sep 20 02:59:09 2011
From: johannes (Johannes Berg)
Date: Tue, 20 Sep 2011 11:59:09 +0200
Subject: [PATCH] P2P: fix action done handling
Message-ID: <1316512749.3953.6.camel@jlt3.sipsolutions.net>

From: Johannes Berg <johannes.berg at intel.com>

The action done handling needs to abort an off-channel
period since one might have been used for example for
GO negotiation and after action done the code assumes
it can start a new off-channel period.

This fixes a bug I introduced when adding support for
in-kernel off-channel transmissions.

Reported-by: Reinette Chatre <reinette.chatre at intel.com>
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
Resend with correct sender who is subscribed to the list ...

 wpa_supplicant/p2p_supplicant.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/wpa_supplicant/p2p_supplicant.c	2011-09-20 11:53:08.000000000 +0200
+++ b/wpa_supplicant/p2p_supplicant.c	2011-09-20 11:53:31.000000000 +0200
@@ -816,11 +816,11 @@ static void wpas_send_action_done(void *
 	wpa_printf(MSG_DEBUG, "P2P: Action frame sequence done notification");
 	wpabuf_free(wpa_s->pending_action_tx);
 	wpa_s->pending_action_tx = NULL;
-	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) {
-		if (wpa_s->action_tx_wait_time)
-			wpa_drv_send_action_cancel_wait(wpa_s);
-		wpa_s->off_channel_freq = 0;
-	} else if (wpa_s->off_channel_freq || wpa_s->roc_waiting_drv_freq) {
+	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX &&
+	    wpa_s->action_tx_wait_time)
+		wpa_drv_send_action_cancel_wait(wpa_s);
+
+	if (wpa_s->off_channel_freq || wpa_s->roc_waiting_drv_freq) {
 		wpa_drv_cancel_remain_on_channel(wpa_s);
 		wpa_s->off_channel_freq = 0;
 		wpa_s->roc_waiting_drv_freq = 0;





From dcbw  Tue Sep 20 08:25:10 2011
From: dcbw (Dan Williams)
Date: Tue, 20 Sep 2011 10:25:10 -0500
Subject: wpa_supplicant not supporting nl80211
In-Reply-To: <CABDFkGg0bk9URpWqBNZQtK6CFVpy3zhLBw7cqiB5uhQJHMhiqQ@mail.gmail.com>
References: <CABDFkGg0bk9URpWqBNZQtK6CFVpy3zhLBw7cqiB5uhQJHMhiqQ@mail.gmail.com>
Message-ID: <1316532311.1783.14.camel@dcbw.foobar.com>

On Fri, 2011-09-16 at 21:07 +0530, yuva raj wrote:
> hi,
> 
> I am using Fedora 14-64bit laptop.  It has wpa_supplicant version
> 0.6.8.  I have installed wireless driver also.  I am able to connect
> to wireless networks from Network Manager.  But when I issue the
> command 'wpa_supplicant -h', it doesnt display 'nl80211' under drivers
> section.

wpa_supplicant on F14 is not built with nl80211 enabled because it was
pretty old at the time that F14 was released, and I wasn't sure how well
it would work with the kernels at release time and later, given that
Fedora upgrades kernel versions periodically.  Fixes and enhancements
for wpa_supplicant's nl80211 driver were almost exclusively added to
wpa_supplicant 0.7.x and 0.8.x.  F15 and later moved to wpa_supplicant
0.7.x which has better nl80211 support; I'd suggest using F15 instead
there, or building the F15 wpa_supplicant on your F14 install and using
that instead (it works, I've done it, but it does mess up the kernel's
iwl3945 driver somewhat badly; other hardware works fine).

Dan

>   wext = Linux wireless extensions (generic)
>   atmel = ATMEL AT76C5XXx (USB, PCMCIA)
>   ndiswrapper = Linux ndiswrapper
>   wired = wpa_supplicant wired Ethernet driver
> 
> 
> I want to know if this version  support nl80211. 
> 
> Thanks in advance
> uv.
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap




From craigdo  Tue Sep 20 10:12:58 2011
From: craigdo (Craig Dowell)
Date: Tue, 20 Sep 2011 10:12:58 -0700
Subject: DBus P2PDevice API
Message-ID: <1316538779.11747.3.camel@jethro>

Hi All,

I?ve been playing with the 0.8 suppliant code trying to get it
responding over the DBus protocol.  I?m a bit confused by the DBus
version of p2p_find.

D-Feet says the P2PDevice Find method takes an ?a{sv}? as a parameter.
I can set the ?Timeout? key and value and watch it get sent to the
supplicant just fine.  I looked at the ?RequestedDeviceTypes? key
handling, and its variant value is supposed to be an array of
WPAS_DBUS_TYPE_BINARRAY.  WPAS_DBUS_TYPE_BINARRAY is defined as
DBUS_NUMBER_OF_TYPES + 100 which turns out to be 116, which is ascii
?t?.  This tells me I should send an array of uint64_t (?at?) in the
variant value.  I don?t understand why this is not just defined to be
?t? instead of being based on the number of DBus types by the way (or
?y? which I would actually more expect to see there given what it
apparently does).

If I do send an array of uint64_t, however, the
wpa_dbus_dict_get_entry() in the while loop of
wpas_dbus_handler_p2p_find() balks.  This seems to be because
_wpa_dbus_dict_fill_value_from_variant() notices a DBUS_TYPE_ARRAY and
calls _wpa_dbus_dict_entry_get_array() which does not handle arrays of
uint64_t.  I don?t see how this can work.  Is this a bug or am I missing
something fundamental here?

This is an optional key, that seems to filter down into the requested
device type described in the Wi-Fi P2p Spec Annex B so I think I can
ignore it, but WPAS_DBUS_TYPE_BINARRAY is used in several places so I
thought it would be good to understand what is going on.  What is the
purpose of the BINARRAY type?  Am I missing something obvious?

Also, from what I can make out from the README-P2P, I would expect Find
to also take a ?type? key with the variant value being a string value
containing either ?social? or ?progressive?, but this seems to be
hardcoded to P2P_FIND_ONLY_SOCIAL in the DBus method handler.  Are there
many differences between the wpa_cli interface and the DBus P2PDevice
Interface?  Why would they be there?

Thanks in advance,

-- Craig




From johannes  Tue Sep 20 10:53:15 2011
From: johannes (Johannes Berg)
Date: Tue, 20 Sep 2011 19:53:15 +0200
Subject: DBus P2PDevice API
In-Reply-To: <1316538779.11747.3.camel@jethro>
References: <1316538779.11747.3.camel@jethro>
Message-ID: <1316541195.3953.49.camel@jlt3.sipsolutions.net>

On Tue, 2011-09-20 at 10:12 -0700, Craig Dowell wrote:
> I looked at the ?RequestedDeviceTypes? key
> handling, and its variant value is supposed to be an array of
> WPAS_DBUS_TYPE_BINARRAY.  WPAS_DBUS_TYPE_BINARRAY is defined as
> DBUS_NUMBER_OF_TYPES + 100 which turns out to be 116, which is ascii
> ?t?.  This tells me I should send an array of uint64_t (?at?) in the
> variant value.  I don?t understand why this is not just defined to be
> ?t? instead of being based on the number of DBus types by the way (or
> ?y? which I would actually more expect to see there given what it
> apparently does).

No, this is actually supposed to be "aay". The binarray thing is just an
internal thing to make the code simpler.

> Also, from what I can make out from the README-P2P, I would expect Find
> to also take a ?type? key with the variant value being a string value
> containing either ?social? or ?progressive?, but this seems to be
> hardcoded to P2P_FIND_ONLY_SOCIAL in the DBus method handler.  

There's a patch floating around to fix that.

johannes




From reinette.chatre  Tue Sep 20 11:01:26 2011
From: reinette.chatre (Reinette Chatre)
Date: Tue, 20 Sep 2011 11:01:26 -0700
Subject: DBus P2PDevice API
In-Reply-To: <1316541195.3953.49.camel@jlt3.sipsolutions.net>
References: <1316538779.11747.3.camel@jethro>
	<1316541195.3953.49.camel@jlt3.sipsolutions.net>
Message-ID: <1316541686.2456.49.camel@splap.jf.intel.com>

On Tue, 2011-09-20 at 19:53 +0200, Johannes Berg wrote:
> On Tue, 2011-09-20 at 10:12 -0700, Craig Dowell wrote:
> > Also, from what I can make out from the README-P2P, I would expect Find
> > to also take a ?type? key with the variant value being a string value
> > containing either ?social? or ?progressive?, but this seems to be
> > hardcoded to P2P_FIND_ONLY_SOCIAL in the DBus method handler.  
> 
> There's a patch floating around to fix that.

http://lists.shmoo.com/pipermail/hostap/2011-August/023830.html

Reinette



From guy  Tue Sep 20 22:26:51 2011
From: guy (Guy Eilam)
Date: Wed, 21 Sep 2011 08:26:51 +0300
Subject: [PATCH 1/2] p2p: disable 11b rates only on p2p interface creation
In-Reply-To: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <CAA03847jCTi3jDZbSF2Eq4p3q1Gmya0C-CmPzumKnAAK0DQb8Q@mail.gmail.com>

Hi,
You have a small bug in your patch.

On Sat, Sep 3, 2011 at 7:51 PM, Rajkumar Manoharan
<rmanohar at qca.qualcomm.com> wrote:
> 11b rates are disabled blindly during p2p init based on driver
> capability. This prevents use of CCK rates where p2p is not in
> use. This patch disables 11b rates during the p2p interface
> setup and also removes the disable_11b from global.
>
> Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
> ---
> ?src/drivers/driver.h ? ? ? ? ? ?| ? 13 -------------
> ?src/drivers/driver_nl80211.c ? ?| ? 28 ++++++++++++----------------
> ?wpa_supplicant/driver_i.h ? ? ? | ? ?9 ---------
> ?wpa_supplicant/p2p_supplicant.c | ? ?5 -----
> ?4 files changed, 12 insertions(+), 43 deletions(-)
>
> diff --git a/src/drivers/driver.h b/src/drivers/driver.h
> index 67c5631..822dc21 100644
> --- a/src/drivers/driver.h
> +++ b/src/drivers/driver.h
> @@ -1972,19 +1972,6 @@ struct wpa_driver_ops {
> ? ? ? ?int (*probe_req_report)(void *priv, int report);
>
> ? ? ? ?/**
> - ? ? ? ?* disable_11b_rates - Set whether IEEE 802.11b rates are used for TX
> - ? ? ? ?* @priv: Private driver interface data
> - ? ? ? ?* @disabled: Whether IEEE 802.11b rates are disabled
> - ? ? ? ?* Returns: 0 on success, -1 on failure (or if not supported)
> - ? ? ? ?*
> - ? ? ? ?* This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and
> - ? ? ? ?* 11 Mbps) as TX rates for data and management frames. This can be
> - ? ? ? ?* used to optimize channel use when there is no need to support IEEE
> - ? ? ? ?* 802.11b-only devices.
> - ? ? ? ?*/
> - ? ? ? int (*disable_11b_rates)(void *priv, int disabled);
> -
> - ? ? ? /**
> ? ? ? ? * deinit_ap - Deinitialize AP mode
> ? ? ? ? * @priv: Private driver interface data
> ? ? ? ? * Returns: 0 on success, -1 on failure (or if not supported)
> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> index 233cdb2..19dcc85 100644
> --- a/src/drivers/driver_nl80211.c
> +++ b/src/drivers/driver_nl80211.c
> @@ -161,7 +161,6 @@ struct wpa_driver_nl80211_data {
> ? ? ? ?int monitor_sock;
> ? ? ? ?int monitor_ifidx;
> ? ? ? ?int no_monitor_iface_capab;
> - ? ? ? int disable_11b_rates;
>
> ? ? ? ?unsigned int pending_remain_on_chan:1;
>
> @@ -2298,8 +2297,7 @@ static void wpa_driver_nl80211_deinit(void *priv)
> ? ? ? ? ? ? ? ?os_free(drv->if_indices);
> ?#endif /* HOSTAPD */
>
> - ? ? ? if (drv->disable_11b_rates)
> - ? ? ? ? ? ? ? nl80211_disable_11b_rates(drv, drv->ifindex, 0);
> + ? ? ? nl80211_disable_11b_rates(drv, drv->ifindex, 0);
>
> ? ? ? ?netlink_send_oper_ifla(drv->netlink, drv->ifindex, 0, IF_OPER_UP);
> ? ? ? ?netlink_deinit(drv->netlink);
> @@ -4233,7 +4231,9 @@ static int nl80211_create_iface(struct wpa_driver_nl80211_data *drv,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?wds);
> ? ? ? ?}
>
> - ? ? ? if (ret >= 0 && drv->disable_11b_rates)
> + ? ? ? if (ret >= 0 &&
> + ? ? ? ? ? (iftype == NL80211_IFTYPE_P2P_CLIENT ||
> + ? ? ? ? ? ?iftype == NL80211_IFTYPE_P2P_GO))
> ? ? ? ? ? ? ? ?nl80211_disable_11b_rates(drv, ret, 1);
>
> ? ? ? ?return ret;
> @@ -5208,7 +5208,10 @@ static int nl80211_set_mode(struct wpa_driver_nl80211_data *drv,
> ? ? ? ?NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, mode);
>
> ? ? ? ?ret = send_and_recv_msgs(drv, msg, NULL, NULL);
> - ? ? ? if (!ret)
> + ? ? ? if (!ret &&
> + ? ? ? ? ? (mode == NL80211_IFTYPE_P2P_CLIENT ||
> + ? ? ? ? ? ?mode == NL80211_IFTYPE_P2P_GO))
> + ? ? ? ? ? ? ? nl80211_disable_11b_rates(drv, ifindex, 1);
> ? ? ? ? ? ? ? ?return 0;

You are missing { } for the nl80211_disable_11b_rates() and return commands.

> ?nla_put_failure:
> ? ? ? ?wpa_printf(MSG_DEBUG, "nl80211: Failed to set interface %d to mode %d:"
> @@ -6603,6 +6606,9 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
> ? ? ? ? ? ? ? ? ? ?NL80211_CMD_SET_TX_BITRATE_MASK, 0);
> ? ? ? ?NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
>
> + ? ? ? if (!disabled)
> + ? ? ? ? ? ? ? goto nla_send;
> +
> ? ? ? ?bands = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
> ? ? ? ?if (!bands)
> ? ? ? ? ? ? ? ?goto nla_put_failure;
> @@ -6620,7 +6626,7 @@ static int nl80211_disable_11b_rates(struct wpa_driver_nl80211_data *drv,
> ? ? ? ?nla_nest_end(msg, band);
>
> ? ? ? ?nla_nest_end(msg, bands);
> -
> +nla_send:
> ? ? ? ?ret = send_and_recv_msgs(drv, msg, NULL, NULL);
> ? ? ? ?msg = NULL;
> ? ? ? ?if (ret) {
> @@ -6636,15 +6642,6 @@ nla_put_failure:
> ?}
>
>
> -static int wpa_driver_nl80211_disable_11b_rates(void *priv, int disabled)
> -{
> - ? ? ? struct i802_bss *bss = priv;
> - ? ? ? struct wpa_driver_nl80211_data *drv = bss->drv;
> - ? ? ? drv->disable_11b_rates = disabled;
> - ? ? ? return nl80211_disable_11b_rates(drv, drv->ifindex, disabled);
> -}
> -
> -
> ?static int wpa_driver_nl80211_deinit_ap(void *priv)
> ?{
> ? ? ? ?struct i802_bss *bss = priv;
> @@ -7000,7 +6997,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
> ? ? ? ?.cancel_remain_on_channel =
> ? ? ? ?wpa_driver_nl80211_cancel_remain_on_channel,
> ? ? ? ?.probe_req_report = wpa_driver_nl80211_probe_req_report,
> - ? ? ? .disable_11b_rates = wpa_driver_nl80211_disable_11b_rates,
> ? ? ? ?.deinit_ap = wpa_driver_nl80211_deinit_ap,
> ? ? ? ?.resume = wpa_driver_nl80211_resume,
> ? ? ? ?.send_ft_action = nl80211_send_ft_action,
> diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
> index 79fdddd..fd4d8d5 100644
> --- a/wpa_supplicant/driver_i.h
> +++ b/wpa_supplicant/driver_i.h
> @@ -463,15 +463,6 @@ static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
> ? ? ? ?return -1;
> ?}
>
> -static inline int wpa_drv_disable_11b_rates(struct wpa_supplicant *wpa_s,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int disabled)
> -{
> - ? ? ? if (wpa_s->driver->disable_11b_rates)
> - ? ? ? ? ? ? ? return wpa_s->driver->disable_11b_rates(wpa_s->drv_priv,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? disabled);
> - ? ? ? return -1;
> -}
> -
> ?static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
> ?{
> ? ? ? ?if (wpa_s->driver->deinit_ap)
> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> index 400b6cc..cf4900c 100644
> --- a/wpa_supplicant/p2p_supplicant.c
> +++ b/wpa_supplicant/p2p_supplicant.c
> @@ -2364,11 +2364,6 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
> ? ? ? ?}
> ?#endif /* CONFIG_CLIENT_MLME */
>
> - ? ? ? if (wpa_drv_disable_11b_rates(wpa_s, 1) < 0) {
> - ? ? ? ? ? ? ? wpa_printf(MSG_DEBUG, "P2P: Failed to disable 11b rates");
> - ? ? ? ? ? ? ? /* Continue anyway; this is not really a fatal error */
> - ? ? ? }
> -
> ? ? ? ?if (global->p2p)
> ? ? ? ? ? ? ? ?return 0;
>
> --
> 1.7.6.1
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>

Guy


From kinoyatov  Tue Sep 20 23:33:39 2011
From: kinoyatov (Khamidulla Inoyatov)
Date: Wed, 21 Sep 2011 15:33:39 +0900
Subject: Hostapd developer documentation
Message-ID: <CAGqDgf4jZaXcLDB3hHAo_6DfHzuRSjWbqUS=_9sroaMv5x3-Vw@mail.gmail.com>

Dear all members,

How can I download hostapd_devel.pdf?
When I try to download it shows 404 file not find. :(

Sincerely yours,
Khamidulla Inoyatov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110921/09f2ad03/attachment.htm 


From Janusz.Dziedzic  Wed Sep 21 00:33:23 2011
From: Janusz.Dziedzic (Janusz.Dziedzic at tieto.com)
Date: Wed, 21 Sep 2011 10:33:23 +0300
Subject: [PATCH] wpa_supplicant: AP mode, set drv_flags
Message-ID: <3078A9B976EF864C8DDD0C499FFD07911E3B14CED1@EXMB01.eu.tieto.com>

In AP/P2P_GO mode we should have correct hostapd drv_flags.
 
---
 wpa_supplicant/ap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index ebac3b6..882cac4 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -448,6 +448,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
        if (hapd_iface == NULL)
                return -1;
        hapd_iface->owner = wpa_s;
+       hapd_iface->drv_flags = wpa_s->drv_flags;

        wpa_s->ap_iface->conf = conf = hostapd_config_defaults();
        if (conf == NULL) {
--
1.7.0.4


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-wpa_supplicant-AP-mode-set-drv_flags.patch
Type: application/octet-stream
Size: 787 bytes
Desc: 0001-wpa_supplicant-AP-mode-set-drv_flags.patch
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110921/cfd8597e/attachment.obj 


From rmanohar  Wed Sep 21 01:25:29 2011
From: rmanohar (Rajkumar Manoharan)
Date: Wed, 21 Sep 2011 13:55:29 +0530
Subject: [PATCH 1/2] p2p: disable 11b rates only on p2p interface creation
In-Reply-To: <CAA03847jCTi3jDZbSF2Eq4p3q1Gmya0C-CmPzumKnAAK0DQb8Q@mail.gmail.com>
References: <1315068711-8515-1-git-send-email-rmanohar@qca.qualcomm.com>
	<CAA03847jCTi3jDZbSF2Eq4p3q1Gmya0C-CmPzumKnAAK0DQb8Q@mail.gmail.com>
Message-ID: <20110921082528.GA11780@vmraj-lnx.users.atheros.com>

On Wed, Sep 21, 2011 at 08:26:51AM +0300, Guy Eilam wrote:
> Hi,
> You have a small bug in your patch.
> 
> On Sat, Sep 3, 2011 at 7:51 PM, Rajkumar Manoharan
> <rmanohar at qca.qualcomm.com> wrote:
> > 11b rates are disabled blindly during p2p init based on driver
> > capability. This prevents use of CCK rates where p2p is not in
> > use. This patch disables 11b rates during the p2p interface
> > setup and also removes the disable_11b from global.
> >
> > Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
> > ---
[...]
> >
> > ? ? ? ?ret = send_and_recv_msgs(drv, msg, NULL, NULL);
> > - ? ? ? if (!ret)
> > + ? ? ? if (!ret &&
> > + ? ? ? ? ? (mode == NL80211_IFTYPE_P2P_CLIENT ||
> > + ? ? ? ? ? ?mode == NL80211_IFTYPE_P2P_GO))
> > + ? ? ? ? ? ? ? nl80211_disable_11b_rates(drv, ifindex, 1);
> > ? ? ? ? ? ? ? ?return 0;
> 
> You are missing { } for the nl80211_disable_11b_rates() and return commands.
> 
Thanks for the review but this patch was dropped and 11b rates should not
be handled by this patch. Please refer Jouni's comments

http://lists.shmoo.com/pipermail/hostap/2011-September/023896.html

--
Rajkumar


From coelho  Wed Sep 21 04:07:19 2011
From: coelho (Luciano Coelho)
Date: Wed, 21 Sep 2011 14:07:19 +0300
Subject: [RFC 0/4] Initial sched_scan support in wpa_supplicant
Message-ID: <1316603243-2398-1-git-send-email-coelho@ti.com>

Hi,

This is my initial implementation of scheduled scan support in the
wpa_supplicant.  It is still very rough and there are probably lots of
corner cases and other things that may break.  That's why I'm sending
this RFC, so we can discuss this implementation before I spend too
much time on it.

I have not properly tested it, only tried out a few different
scenarios.

This still doesn't include the SSID filtering that I have recently
implemented in the kernel, so if you have more than the maximum
supported SSIDs to search for, it becomes pretty useless, since you'll
end up getting all the results all the time.  I'll add support for
filtering after we agree on the basics.

Known issues:
-------------

* I'm not checking whether the lower driver supports sched_scan or
  not.  This is not a problem, but can be optimized by checking
  whether the NL80211_ATTR_SUPPORTED_COMMANDS flag.

* I have implemented a rather simple algorithm that is used when we
  need to scan for more than the maximum SSIDs supported by the
  driver.  In this case, we need to eventually stop the sched_scan and
  start a new one with the remaining SSIDs.  In this implementation, I
  always start with a timeout of max_sched_scan_ssids * 2 seconds and
  an interval of 2 seconds.  After the timeout, I double the scan
  interval and halve the timeout.  This backing off algorithm is used
  because the SSIDs are supposedly sorted in order of importance, so
  we spend less time and with longer intervals when scanning lower
  priority SSIDs.  I need to figure out a better way to handle this.
  Suggestions are welcome!

* When we use a broadcast SSID (eg. when the network is using
  scan_ssid=0 or when we have more than 4 SSIDs to scan), we don't
  filter the results.  Every AP found will be reported to
  wpa_supplicant, so it will behave almost as a normal scan.  As I
  said, filtering has already been implemented in the kernel and I'll
  implement it here too in the near future.

* We don't support extra IEs (eg. used by WPS) nor P2P yet.  Adding
  support for it should be fairly simple, though.  This is obviously
  wrong and will be eventually fixed.

* We only perform sched_scans when the wpa_supplicant is starting and
  when a connection fails or we disconnect.  We don't perform
  scheduled scans yet when the SSID list is changed, an SSID is
  enabled or on other scan scenarios.  This should be fairly simple to
  add, but I want to maturize the current use-case first.

Please let me know what you think about this so I can be reassured
that I'm going in the right direction. ;)

Cheers,
Luca.

Luciano Coelho (4):
  wpa_s: add scheduled scan driver operations
  nl80211: add scheduled scan support
  wpa_s: use sched_scan in driver init
  wpa_s: Increase number of SSIDs per scan

 src/drivers/driver.h              |   38 +++++++-
 src/drivers/driver_nl80211.c      |  142 ++++++++++++++++++++++++++++
 wpa_supplicant/driver_i.h         |   17 ++++
 wpa_supplicant/events.c           |   19 ++++-
 wpa_supplicant/scan.c             |  185 ++++++++++++++++++++++++++++++++++++-
 wpa_supplicant/scan.h             |    2 +
 wpa_supplicant/sme.c              |    1 +
 wpa_supplicant/wpa_supplicant.c   |    8 ++-
 wpa_supplicant/wpa_supplicant_i.h |    8 ++
 9 files changed, 413 insertions(+), 7 deletions(-)



From coelho  Wed Sep 21 04:07:21 2011
From: coelho (Luciano Coelho)
Date: Wed, 21 Sep 2011 14:07:21 +0300
Subject: [RFC 2/4] nl80211: add scheduled scan support
In-Reply-To: <1316603243-2398-1-git-send-email-coelho@ti.com>
References: <1316603243-2398-1-git-send-email-coelho@ti.com>
Message-ID: <1316603243-2398-3-git-send-email-coelho@ti.com>

This commit adds scheduled scan support in the nl80211 driver.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver_nl80211.c |  142 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1989325..2e117c9 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1479,6 +1479,13 @@ static int process_event(struct nl_msg *msg, void *arg)
 	case NL80211_CMD_TRIGGER_SCAN:
 		wpa_printf(MSG_DEBUG, "nl80211: Scan trigger");
 		break;
+	case NL80211_CMD_START_SCHED_SCAN:
+		wpa_printf(MSG_DEBUG, "nl80211: Sched scan started");
+		break;
+	case NL80211_CMD_SCHED_SCAN_STOPPED:
+		wpa_printf(MSG_DEBUG, "nl80211: Sched scan stopped");
+		wpa_supplicant_event(drv->ctx, EVENT_SCHED_SCAN_STOPPED, NULL);
+		break;
 	case NL80211_CMD_NEW_SCAN_RESULTS:
 		wpa_printf(MSG_DEBUG, "nl80211: New scan results available");
 		drv->scan_complete_events = 1;
@@ -1486,6 +1493,10 @@ static int process_event(struct nl_msg *msg, void *arg)
 				     drv->ctx);
 		send_scan_event(drv, 0, tb);
 		break;
+	case NL80211_CMD_SCHED_SCAN_RESULTS:
+		wpa_printf(MSG_DEBUG, "nl80211: New sched scan results available");
+		send_scan_event(drv, 0, tb);
+		break;
 	case NL80211_CMD_SCAN_ABORTED:
 		wpa_printf(MSG_DEBUG, "nl80211: Scan aborted");
 		/*
@@ -1634,6 +1645,7 @@ nla_put_failure:
 
 struct wiphy_info_data {
 	int max_scan_ssids;
+	int max_sched_scan_ssids;
 	int ap_supported;
 	int p2p_supported;
 	int p2p_concurrent;
@@ -1669,6 +1681,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 		info->max_scan_ssids =
 			nla_get_u8(tb[NL80211_ATTR_MAX_NUM_SCAN_SSIDS]);
 
+	if (tb[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS])
+		info->max_sched_scan_ssids =
+			nla_get_u8(tb[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS]);
+
 	if (tb[NL80211_ATTR_SUPPORTED_IFTYPES]) {
 		struct nlattr *nl_mode;
 		int i;
@@ -1820,6 +1836,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 		WPA_DRIVER_AUTH_LEAP;
 
 	drv->capa.max_scan_ssids = info.max_scan_ssids;
+	drv->capa.max_sched_scan_ssids = info.max_sched_scan_ssids;
 	if (info.ap_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP;
 
@@ -2558,6 +2575,129 @@ nla_put_failure:
 }
 
 
+/**
+ * wpa_driver_nl80211_sched_scan - Initiate a scheduled scan
+ * @priv: Pointer to private driver data from wpa_driver_nl80211_init()
+ * @params: Scan parameters
+ * @interval: interval between scan cycles
+ * Returns: 0 on success, -1 on failure or if not supported
+ */
+static int wpa_driver_nl80211_sched_scan(void *priv,
+					 struct wpa_driver_scan_params *params,
+					 u32 interval)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	int ret = 0;
+	struct nl_msg *msg, *ssids, *freqs;
+	size_t i;
+
+	msg = nlmsg_alloc();
+	ssids = nlmsg_alloc();
+	freqs = nlmsg_alloc();
+	if (!msg || !ssids || !freqs) {
+		nlmsg_free(msg);
+		nlmsg_free(ssids);
+		nlmsg_free(freqs);
+		return -1;
+	}
+
+	os_free(drv->filter_ssids);
+	drv->filter_ssids = params->filter_ssids;
+	params->filter_ssids = NULL;
+	drv->num_filter_ssids = params->num_filter_ssids;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_START_SCHED_SCAN, 0);
+
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+
+	NLA_PUT_U32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, interval);
+
+	for (i = 0; i < params->num_ssids; i++) {
+		wpa_hexdump_ascii(MSG_MSGDUMP, "nl80211: Sched scan SSID",
+				  params->ssids[i].ssid,
+				  params->ssids[i].ssid_len);
+		NLA_PUT(ssids, i + 1, params->ssids[i].ssid_len,
+			params->ssids[i].ssid);
+	}
+	if (params->num_ssids)
+		nla_put_nested(msg, NL80211_ATTR_SCAN_SSIDS, ssids);
+
+	if (params->extra_ies) {
+		wpa_hexdump_ascii(MSG_MSGDUMP, "nl80211: Sched scan extra IEs",
+				  params->extra_ies, params->extra_ies_len);
+		NLA_PUT(msg, NL80211_ATTR_IE, params->extra_ies_len,
+			params->extra_ies);
+	}
+
+	if (params->freqs) {
+		for (i = 0; params->freqs[i]; i++) {
+			wpa_printf(MSG_MSGDUMP, "nl80211: Scan frequency %u "
+				   "MHz", params->freqs[i]);
+			NLA_PUT_U32(freqs, i + 1, params->freqs[i]);
+		}
+		nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
+	}
+
+	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+
+	/* TODO: if we get an error here, we should fall back to normal scan */
+
+	msg = NULL;
+	if (ret) {
+		wpa_printf(MSG_DEBUG, "nl80211: sched scan start failed: ret=%d "
+			   "(%s)", ret, strerror(-ret));
+		goto nla_put_failure;
+	}
+
+	wpa_printf(MSG_DEBUG, "nl80211: Sched scan requested (ret=%d) - scan interval %d "
+		   "msec", ret, interval);
+
+nla_put_failure:
+	nlmsg_free(ssids);
+	nlmsg_free(msg);
+	nlmsg_free(freqs);
+	return ret;
+}
+
+/**
+ * wpa_driver_nl80211_stop_sched_scan - Stop a scheduled scan
+ * @priv: Pointer to private driver data from wpa_driver_nl80211_init()
+ * Returns: 0 on success, -1 on failure or if not supported
+ */
+static int wpa_driver_nl80211_stop_sched_scan(void *priv)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	int ret = 0;
+	struct nl_msg *msg;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -1;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_STOP_SCHED_SCAN, 0);
+
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+
+	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+	msg = NULL;
+	if (ret) {
+		wpa_printf(MSG_DEBUG, "nl80211: sched scan stop failed: ret=%d "
+			   "(%s)", ret, strerror(-ret));
+		goto nla_put_failure;
+	}
+
+	wpa_printf(MSG_DEBUG, "nl80211: Sched scan stop sent (ret=%d)", ret);
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return ret;
+}
+
+
 static const u8 * nl80211_get_ie(const u8 *ies, size_t ies_len, u8 ie)
 {
 	const u8 *end, *pos;
@@ -7039,6 +7179,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.get_ssid = wpa_driver_nl80211_get_ssid,
 	.set_key = wpa_driver_nl80211_set_key,
 	.scan2 = wpa_driver_nl80211_scan,
+	.sched_scan = wpa_driver_nl80211_sched_scan,
+	.stop_sched_scan = wpa_driver_nl80211_stop_sched_scan,
 	.get_scan_results2 = wpa_driver_nl80211_get_scan_results,
 	.deauthenticate = wpa_driver_nl80211_deauthenticate,
 	.disassociate = wpa_driver_nl80211_disassociate,
-- 
1.7.1



From coelho  Wed Sep 21 04:07:22 2011
From: coelho (Luciano Coelho)
Date: Wed, 21 Sep 2011 14:07:22 +0300
Subject: [RFC 3/4] wpa_s: use sched_scan in driver init
In-Reply-To: <1316603243-2398-1-git-send-email-coelho@ti.com>
References: <1316603243-2398-1-git-send-email-coelho@ti.com>
Message-ID: <1316603243-2398-4-git-send-email-coelho@ti.com>

This patch uses sched_scan, if available, when the driver is
initialized.  It also adds a couple of cancel operations where
appropriate.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 wpa_supplicant/events.c         |    8 ++++++--
 wpa_supplicant/sme.c            |    1 +
 wpa_supplicant/wpa_supplicant.c |    6 +++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 4a95069..0787a00 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -986,10 +986,14 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 				 */
 				timeout_sec = 0;
 				timeout_usec = 250000;
+				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
+							    timeout_usec);
+				return 0;
 			}
 #endif /* CONFIG_P2P */
-			wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
-						    timeout_usec);
+			if(wpa_supplicant_req_sched_scan(wpa_s))
+				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
+							    timeout_usec);
 		}
 	}
 	return 0;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index dbf385e..4cb5062 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -237,6 +237,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 	}
 #endif /* CONFIG_P2P */
 
+	wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 1376498..d591758 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1152,6 +1152,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 			wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
 		os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
 	}
+	wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	/* Starting new association, so clear the possibly used WPA IE from the
@@ -2047,7 +2048,10 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 
 	wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
 	if (wpa_supplicant_enabled_networks(wpa_s->conf)) {
-		wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
+		int ret;
+		ret = wpa_supplicant_req_sched_scan(wpa_s);
+		if (ret)
+			wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
 		interface_count++;
 	} else
 		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
-- 
1.7.1



From coelho  Wed Sep 21 04:07:20 2011
From: coelho (Luciano Coelho)
Date: Wed, 21 Sep 2011 14:07:20 +0300
Subject: [RFC 1/4] wpa_s: add scheduled scan driver operations
In-Reply-To: <1316603243-2398-1-git-send-email-coelho@ti.com>
References: <1316603243-2398-1-git-send-email-coelho@ti.com>
Message-ID: <1316603243-2398-2-git-send-email-coelho@ti.com>

In new kernel versions (>=3.0), NL80211 adds scheduled scan
capability.  In order to use this feature to its full extent, we need
to support it in the wpa_supplicant core, so that it can also be used
by other drivers.

This commit adds initial scheduled scan support operations and events.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver.h              |   36 +++++++-
 wpa_supplicant/driver_i.h         |   17 ++++
 wpa_supplicant/events.c           |   11 ++
 wpa_supplicant/scan.c             |  185 ++++++++++++++++++++++++++++++++++++-
 wpa_supplicant/scan.h             |    2 +
 wpa_supplicant/wpa_supplicant.c   |    2 +
 wpa_supplicant/wpa_supplicant_i.h |    8 ++
 7 files changed, 258 insertions(+), 3 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3e9c132..aca595f 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -692,6 +692,7 @@ struct wpa_driver_capa {
 	unsigned int flags;
 
 	int max_scan_ssids;
+	int max_sched_scan_ssids;
 
 	/**
 	 * max_remain_on_chan - Maximum remain-on-channel duration in msec
@@ -1396,6 +1397,37 @@ struct wpa_driver_ops {
 	int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
 
 	/**
+	 * sched_scan - Request the driver to initiate scheduled scan
+	 * @priv: private driver interface data
+	 * @params: Scan parameters
+	 * @interval: interval between scan cycles
+	 *
+	 * Returns: 0 on success, -1 on failure
+	 *
+	 * This operation should be used for scheduled scan offload to
+	 * the hardware.  Every time scan results are available, the
+	 * driver should report scan results event for wpa_supplicant
+	 * which will eventually request the results with
+	 * wpa_driver_get_scan_results2().  This operation is optional
+	 * and if not provided or if it returns -1, we fall back to
+	 * normal host-scheduled scans.
+	 */
+	int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
+			  u32 interval);
+
+	/**
+	 * stop_sched_scan - Request the driver to stop a scheduled scan
+	 * @priv: private driver interface data
+	 *
+	 * Returns: 0 on success, -1 on failure
+	 *
+	 * This should cause the scheduled scan to be stopped and
+	 * results should stop being sent.  Must be supported if
+	 * sched_scan is supported.
+	 */
+	int (*stop_sched_scan)(void *priv);
+
+	/**
 	 * authenticate - Request driver to authenticate
 	 * @priv: private driver interface data
 	 * @params: authentication parameters
@@ -2807,7 +2839,9 @@ enum wpa_event_type {
 	 * completed Group Key Handshake while the host (including
 	 * wpa_supplicant was sleeping).
 	 */
-	EVENT_DRIVER_GTK_REKEY
+	EVENT_DRIVER_GTK_REKEY,
+
+	EVENT_SCHED_SCAN_STOPPED,
 };
 
 
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 79fdddd..2f439fc 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -79,6 +79,23 @@ static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
 	return -1;
 }
 
+static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
+				     struct wpa_driver_scan_params *params,
+				     u32 interval)
+{
+	if (wpa_s->driver->sched_scan)
+		return wpa_s->driver->sched_scan(wpa_s->drv_priv,
+						 params, interval);
+	return -1;
+}
+
+static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->stop_sched_scan)
+		return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
+	return -1;
+}
+
 static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
 	struct wpa_supplicant *wpa_s)
 {
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a307eda..4a95069 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2228,6 +2228,17 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		wpa_sm_update_replay_ctr(wpa_s->wpa,
 					 data->driver_gtk_rekey.replay_ctr);
 		break;
+	case EVENT_SCHED_SCAN_STOPPED:
+		wpa_s->sched_scanning = 0;
+		wpa_supplicant_notify_scanning(wpa_s, 0);
+
+		/* TODO: do we still have a race here? */
+
+		/* If we timed out, start a new sched scan to continue
+		 * searching for more SSIDs */
+		if (wpa_s->sched_scan_timed_out)
+			wpa_supplicant_req_sched_scan(wpa_s);
+		break;
 	default:
 		wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event);
 		break;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 7689ff6..619db91 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -207,6 +207,52 @@ int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
 }
 
 
+static void
+wpa_supplicant_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx)
+{
+	struct wpa_supplicant *wpa_s = eloop_ctx;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Sched scan timeout - stopping it");
+
+	wpa_s->sched_scan_timed_out = 1;
+	wpa_supplicant_cancel_sched_scan(wpa_s);
+}
+
+static int
+wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
+				struct wpa_driver_scan_params *params,
+				int interval)
+{
+	int ret;
+
+	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
+		return -EOPNOTSUPP;
+
+	wpa_supplicant_notify_scanning(wpa_s, 1);
+	ret = wpa_drv_sched_scan(wpa_s, params, interval * 1000);
+	if (ret)
+		wpa_supplicant_notify_scanning(wpa_s, 0);
+	else
+		wpa_s->sched_scanning = 1;
+
+	return ret;
+}
+
+
+static int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	int ret;
+
+	ret = wpa_drv_stop_sched_scan(wpa_s);
+	if (ret) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "stopping sched_scan failed!");
+		/* TODO: what to do if stopping fails? */
+		return -1;
+	}
+
+	return ret;
+}
+
 static struct wpa_driver_scan_filter *
 wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids)
 {
@@ -350,8 +396,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 			ssid = wpa_s->conf->ssid;
 		while (ssid) {
 			if (!ssid->disabled && ssid->scan_ssid) {
-				wpa_hexdump_ascii(MSG_DEBUG, "Scan SSID",
-						  ssid->ssid, ssid->ssid_len);
+				wpa_dbg(wpa_s, MSG_DEBUG, "Scan SSID '%s' len %d",
+					ssid->ssid, ssid->ssid_len);
 				params.ssids[params.num_ssids].ssid =
 					ssid->ssid;
 				params.ssids[params.num_ssids].ssid_len =
@@ -530,6 +576,124 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
 	eloop_register_timeout(sec, usec, wpa_supplicant_scan, wpa_s, NULL);
 }
 
+/**
+ * wpa_supplicant_req_sched_scan - Start a periodic scheduled scan
+ * @wpa_s: Pointer to wpa_supplicant data
+ *
+ * This function is used to schedule periodic scans for neighboring
+ * access points repeating the scan continuously.
+ */
+int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	struct wpa_driver_scan_params params;
+	enum wpa_states prev_state;
+	struct wpa_ssid *ssid;
+	int ret;
+	int use_wildcard = 0;
+	size_t max_sched_scan_ssids;
+
+	if (wpa_s->max_sched_scan_ssids > WPAS_MAX_SCAN_SSIDS)
+		max_sched_scan_ssids = WPAS_MAX_SCAN_SSIDS;
+	else
+		max_sched_scan_ssids = wpa_s->max_sched_scan_ssids;
+
+	/* TODO: Add WPS and P2P support */
+
+	if (wpa_s->sched_scanning)
+		return 0;
+
+	os_memset(&params, 0, sizeof(params));
+
+	prev_state = wpa_s->wpa_state;
+	if (wpa_s->wpa_state == WPA_DISCONNECTED ||
+	    wpa_s->wpa_state == WPA_INACTIVE)
+		wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
+
+	/* Find the starting point from which to continue scanning */
+	ssid = wpa_s->conf->ssid;
+	if (wpa_s->prev_sched_ssid) {
+		while (ssid) {
+			if (ssid == wpa_s->prev_sched_ssid) {
+				ssid = ssid->next;
+				break;
+			}
+			ssid = ssid->next;
+		}
+	}
+
+	if (!ssid || !wpa_s->prev_sched_ssid) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Beginning of SSID list");
+
+		wpa_s->sched_scan_interval = 2;
+		wpa_s->sched_scan_timeout = max_sched_scan_ssids * 2;
+		wpa_s->first_sched_scan = 1;
+		ssid = wpa_s->conf->ssid;
+		wpa_s->prev_sched_ssid = ssid;
+	}
+
+	while (ssid) {
+		if (ssid->disabled) {
+			wpa_s->prev_sched_ssid = ssid;
+			ssid = ssid->next;
+			continue;
+		}
+
+		if (!ssid->scan_ssid)
+			use_wildcard = 1;
+		else {
+			wpa_dbg(wpa_s, MSG_DEBUG, "Sched scan SSID '%s' len %d",
+				ssid->ssid, ssid->ssid_len);
+			params.ssids[params.num_ssids].ssid =
+				ssid->ssid;
+			params.ssids[params.num_ssids].ssid_len =
+				ssid->ssid_len;
+			params.num_ssids++;
+			if (params.num_ssids + 1 >= max_sched_scan_ssids) {
+				wpa_s->prev_sched_ssid = ssid;
+				break;
+			}
+		}
+		wpa_s->prev_sched_ssid = ssid;
+		ssid = ssid->next;
+	}
+
+	if (ssid || use_wildcard) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Include wildcard SSID in "
+			"the sched scan request");
+		params.num_ssids++;
+	} else {
+		wpa_dbg(wpa_s, MSG_DEBUG, "ssid %p - list ended", ssid);
+	}
+
+	if (!params.num_ssids)
+		return 0;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Starting sched scan: interval %d timeout %d",
+		wpa_s->sched_scan_interval, wpa_s->sched_scan_timeout);
+
+	ret = wpa_supplicant_start_sched_scan(wpa_s, &params,
+					      wpa_s->sched_scan_interval);
+	if (ret) {
+		wpa_msg(wpa_s, MSG_WARNING, "Failed to initiate sched scan");
+		if (prev_state != wpa_s->wpa_state)
+			wpa_supplicant_set_state(wpa_s, prev_state);
+		return ret;
+	}
+
+	/* If we have more SSIDs to scan, add a timeout so we scan them too */
+	if (ssid || !wpa_s->first_sched_scan) {
+		wpa_s->sched_scan_timed_out = 0;
+		eloop_register_timeout(wpa_s->sched_scan_timeout, 0,
+				       wpa_supplicant_sched_scan_timeout,
+				       wpa_s, NULL);
+		wpa_s->first_sched_scan = 0;
+		wpa_s->sched_scan_timeout /= 2;
+		wpa_s->sched_scan_interval *= 2;
+	}
+
+	return 0;
+}
+
 
 /**
  * wpa_supplicant_cancel_scan - Cancel a scheduled scan request
@@ -545,6 +709,23 @@ void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s)
 }
 
 
+/**
+ * wpa_supplicant_cancel_sched_scan - Stop running scheduled scans
+ * @wpa_s: Pointer to wpa_supplicant data
+ *
+ * This function is used to stop a periodic scheduled scan.
+ */
+void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	if (!wpa_s->sched_scanning)
+		return;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling sched scan");
+	eloop_cancel_timeout(wpa_supplicant_sched_scan_timeout, wpa_s, NULL);
+	wpa_supplicant_stop_sched_scan(wpa_s);
+}
+
+
 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
 				    int scanning)
 {
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index 025b815..f9d21b0 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -17,7 +17,9 @@
 
 int wpa_supplicant_enabled_networks(struct wpa_config *conf);
 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
+int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
+void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
 				    int scanning);
 struct wpa_driver_scan_params;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 646a926..1376498 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2074,6 +2074,7 @@ static struct wpa_supplicant * wpa_supplicant_alloc(void)
 	wpa_s->scan_interval = 5;
 	wpa_s->new_connection = 1;
 	wpa_s->parent = wpa_s;
+	wpa_s->sched_scanning = 0;
 
 	return wpa_s;
 }
@@ -2238,6 +2239,7 @@ next_driver:
 				return -1;
 		}
 		wpa_s->max_scan_ssids = capa.max_scan_ssids;
+		wpa_s->max_sched_scan_ssids = capa.max_sched_scan_ssids;
 		wpa_s->max_remain_on_chan = capa.max_remain_on_chan;
 		wpa_s->max_stations = capa.max_stations;
 	}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 89b0982..c4479d8 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -380,6 +380,12 @@ struct wpa_supplicant {
 					  */
 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
 
+	struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
+	int sched_scan_timeout;
+	int sched_scan_interval;
+	int first_sched_scan;
+	int sched_scan_timed_out;
+
 	void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
 				 struct wpa_scan_results *scan_res);
 	struct dl_list bss; /* struct wpa_bss::list */
@@ -398,6 +404,7 @@ struct wpa_supplicant {
 
 	enum wpa_states wpa_state;
 	int scanning;
+	int sched_scanning;
 	int new_connection;
 	int reassociated_connection;
 
@@ -421,6 +428,7 @@ struct wpa_supplicant {
 	struct wpa_client_mlme mlme;
 	unsigned int drv_flags;
 	int max_scan_ssids;
+	size_t max_sched_scan_ssids;
 	unsigned int max_remain_on_chan;
 	unsigned int max_stations;
 
-- 
1.7.1



From coelho  Wed Sep 21 04:07:23 2011
From: coelho (Luciano Coelho)
Date: Wed, 21 Sep 2011 14:07:23 +0300
Subject: [RFC 4/4] wpa_s: Increase number of SSIDs per scan
In-Reply-To: <1316603243-2398-1-git-send-email-coelho@ti.com>
References: <1316603243-2398-1-git-send-email-coelho@ti.com>
Message-ID: <1316603243-2398-5-git-send-email-coelho@ti.com>

With scheduled scan support, we may need to pass more than 10 SSIDs in
a single scan request.  Some drivers (eg. wl12xx) support up to 16
SSIDs at once.

Change WPAS_MAX_SCAN_SSIDS from 10 to 16.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index aca595f..a287b77 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -195,7 +195,7 @@ struct wpa_interface_info {
 	const char *drv_name;
 };
 
-#define WPAS_MAX_SCAN_SSIDS 10
+#define WPAS_MAX_SCAN_SSIDS 16
 
 /**
  * struct wpa_driver_scan_params - Scan parameters
-- 
1.7.1



From johannes  Wed Sep 21 05:09:59 2011
From: johannes (Johannes Berg)
Date: Wed, 21 Sep 2011 14:09:59 +0200
Subject: [RFC] wpa_supplicant: add fast reconnect support
In-Reply-To: <20110324012220.CE69C58107@lefflers.sfo.corp.google.com>
References: <20110324012220.CE69C58107@lefflers.sfo.corp.google.com>
Message-ID: <1316606999.3940.34.camel@jlt3.sipsolutions.net>

On Wed, 2011-03-23 at 18:07 -0700, Sam Leffler wrote:
> When dropped by an AP for inactivity or because the session has timed
> out, try to re-join directly before falling back to a full scan and the
> normal work.  This reduces the time to re-join a network from 5+ seconds
> to ~300ms (not counting any time to renew DHCP).

I looked at this in more detail since I want something like this too for
resume support, but I don't like the way you play with the internal
state machines -- not advancing it at all but still calling back into
the core code etc. I think that adds too much fragility to an already
pretty finicky system.

johannes




From proski  Wed Sep 21 07:59:07 2011
From: proski (Pavel Roskin)
Date: Wed, 21 Sep 2011 10:59:07 -0400
Subject: [PATCH 1/3] wext: remove write-only variable ap_num
Message-ID: <20110921145907.9326.83141.stgit@mj>

Signed-off-by: Pavel Roskin <proski at gnu.org>
---

 src/drivers/driver_wext.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index e731101..9fa356b 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -1387,7 +1387,7 @@ static void wpa_driver_wext_add_scan_entry(struct wpa_scan_results *res,
 struct wpa_scan_results * wpa_driver_wext_get_scan_results(void *priv)
 {
 	struct wpa_driver_wext_data *drv = priv;
-	size_t ap_num = 0, len;
+	size_t len;
 	int first;
 	u8 *res_buf;
 	struct iw_event iwe_buf, *iwe = &iwe_buf;
@@ -1399,7 +1399,6 @@ struct wpa_scan_results * wpa_driver_wext_get_scan_results(void *priv)
 	if (res_buf == NULL)
 		return NULL;
 
-	ap_num = 0;
 	first = 1;
 
 	res = os_zalloc(sizeof(*res));


From proski  Wed Sep 21 07:59:19 2011
From: proski (Pavel Roskin)
Date: Wed, 21 Sep 2011 10:59:19 -0400
Subject: [PATCH 2/3] doc: use correct path for kerneldoc2doxygen.pl
In-Reply-To: <20110921145907.9326.83141.stgit@mj>
References: <20110921145907.9326.83141.stgit@mj>
Message-ID: <20110921145919.9326.91728.stgit@mj>

Refer to kerneldoc2doxygen.pl as doc/kerneldoc2doxygen.pl since doxygen
is run in the top-level source directory.

Signed-off-by: Pavel Roskin <proski at gnu.org>
---

 doc/doxygen.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/doxygen.conf b/doc/doxygen.conf
index 20e6641..dfd6927 100644
--- a/doc/doxygen.conf
+++ b/doc/doxygen.conf
@@ -674,7 +674,7 @@ IMAGE_PATH             = doc
 # If FILTER_PATTERNS is specified, this tag will be
 # ignored.
 
-INPUT_FILTER           = kerneldoc2doxygen.pl
+INPUT_FILTER           = doc/kerneldoc2doxygen.pl
 
 # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
 # basis.


From proski  Wed Sep 21 08:29:57 2011
From: proski (Pavel Roskin)
Date: Wed, 21 Sep 2011 11:29:57 -0400
Subject: Hostapd developer documentation
In-Reply-To: <CAGqDgf4jZaXcLDB3hHAo_6DfHzuRSjWbqUS=_9sroaMv5x3-Vw@mail.gmail.com>
References: <CAGqDgf4jZaXcLDB3hHAo_6DfHzuRSjWbqUS=_9sroaMv5x3-Vw@mail.gmail.com>
Message-ID: <20110921112957.35ccb6f5@mj>

On Wed, 21 Sep 2011 15:33:39 +0900
Khamidulla Inoyatov <kinoyatov at gmail.com> wrote:

> Dear all members,
> 
> How can I download hostapd_devel.pdf?
> When I try to download it shows 404 file not find. :(

Yes, there is a broken link on
http://hostap.epitest.fi/hostapd/devel/

You probably want this document:
http://w1.fi/wpa_supplicant/wpa_supplicant-devel.pdf

It has a section about hostapd.  I believe it's the same document that
was meant to be linked as hostap-devel.pdf.

You can also try generating the documentation by running make in the
doc directory of the hostapd sources.  It didn't work for me (some tex
errors), but I didn't try hard.

-- 
Regards,
Pavel Roskin


From matt.causey  Wed Sep 21 10:24:07 2011
From: matt.causey (Matt Causey)
Date: Wed, 21 Sep 2011 13:24:07 -0400
Subject: Opportunistic Key Caching on wpa_supplicant
Message-ID: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>

Hello,

I'm running linux 2.38.2, and wpa_supplicant 0.7.3 with the following .config:

CONFIG_IEEE8021X_EAPOL=y
CONFIG_EAP_MD5=y
CONFIG_EAP_TLS=y
CONFIG_EAP_GTC=y
CONFIG_EAP_OTP=y
CONFIG_EAP_PSK=y
CONFIG_EAP_GPSK=y

CONFIG_DRIVER_WEXT=y
CONFIG_DRIVER_RALINK=y
CONFIG_DRIVER_IPW=y

CONFIG_BGSCAN_SIMPLE=y
CONFIG_CTRL_IFACE=y
CONFIG_DRIVER_NL80211=y
CONFIG_DEBUG_FILE=y
CONFIG_CTRL_IFACE_DBUS=y
CONFIG_READLINE=y

and the following wpa_supplicant.conf:

fast_reauth=0
ctrl_interface=/var/run/wpa_supplicant
network={
        proactive_key_caching=1
	ssid="wpa2"
        bgscan="simple:90:-65:300"
        freq_list=4915 4920 4925 4935 4940 4945 4960 4980 5035 5040
5045 5055 5060 5080 5170 5180 5190 5200 5210 5220 5230 5240 5260 5280
5300 5320 5500 5520 5540 5560 5580 5600 5620 5640 5660 5680 5700 5745
5765 5785 5805 5825
	identity="smeagol-prod"
	key_mgmt=WPA-EAP
	proto=WPA2
	pairwise=CCMP
	group=CCMP
	eap=TLS
	ca_cert="/etc/cert/root.pem"
	client_cert="/etc/cert/user_cert.pem"
	private_key="/etc/cert/user_key.pem"
	private_key_passwd="SECRET"
}

I have enabled opportunistic key caching on the infrastructure,
however it would appear that every time we roam, we re-auth against
RADIUS.

Here is what I see on the controller:

*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Reassociation
received from mobile on AP 04:fe:7f:48:db:20
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Changing ACL 'none' (ACL ID 255) ===> 'none' (ACL ID 255) ---
(caller apf_policy.c:1393)
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Applying
site-specific IPv6 override for station 1c:65:9d:e5:d3:46 - vapId 7,
site 'default-group', interface 'vlan9'
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Changing ACL 'none' (ACL ID 255) ===> 'none' (ACL ID 255) ---
(caller apf_policy.c:1393)
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Applying IPv6
Interface Policy for station 1c:65:9d:e5:d3:46 - vlan 9, interface id
13, interface 'vlan9'
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 STA - rates
(8): 12 18 24 36 48 72 96 108 0 0 0 0 0 0 0 0
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Processing
RSN IE type 48, length 38 for mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Received RSN
IE with 1 PMKIDs from mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 17:29:43.333: Received PMKID:  (16)
*apfMsConnTask_6: Sep 21 17:29:43.333:      [0000] 85 b6 41 19 53 e4
d9 64 50 06 5a 9d eb 81 46 41
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 No valid
PMKID found in the cache for mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 17:29:43.333: CCKM: Find PMK in cache: BSSID =  (6)
*apfMsConnTask_6: Sep 21 17:29:43.333:      [0000] 04 fe 7f 48 db 20
*apfMsConnTask_6: Sep 21 17:29:43.333: CCKM: Find PMK in cache: realAA =  (6)
*apfMsConnTask_6: Sep 21 17:29:43.333:      [0000] 04 fe 7f 48 db 29
*apfMsConnTask_6: Sep 21 17:29:43.333: CCKM: Find PMK in cache: PMKID =  (16)
*apfMsConnTask_6: Sep 21 17:29:43.333:      [0000] 85 b6 41 19 53 e4
d9 64 50 06 5a 9d eb 81 46 41
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Unable to
compute a valid PMKID from dot1x PMK cache for mobile
1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 17:29:43.333: 1c:65:9d:e5:d3:46 Found an
entry in the global PMK cache for station 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 17:29:43.333: CCKM: AA (6)
*apfMsConnTask_6: Sep 21 17:29:43.333:      [0000] 04 fe 7f 48 db 29
*apfMsConnTask_6: Sep 21 17:29:43.333: CCKM: SPA (6)
*apfMsConnTask_6: Sep 21 17:29:43.333:      [0000] 1c 65 9d e5 d3 46
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 Unable to
compute a valid PMKID from global PMK cache for mobile
1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Deleted mobile LWAPP rule on AP [00:24:14:ff:0c:10]
*pemReceiveTask: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90
Removed NPU entry.
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 Updated
location for station old AP 00:24:14:ff:0c:10-1, new AP
04:fe:7f:48:db:20-1
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 apfMsRunStateDec
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 apfMs1xStateDec
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Change state to START (0) last state RUN (20)
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90
START (0) Initializing policy
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90
START (0) Change state to AUTHCHECK (2) last state RUN (20)
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90
AUTHCHECK (2) Change state to 8021X_REQD (3) last state RUN (20)
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 10.9.9.90
8021X_REQD (3) Plumbed mobile LWAPP rule on AP 04:fe:7f:48:db:20 vapId
7 apVapId 7
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46
apfPemAddUser2 (apf_policy.c:222) Changing state for mobile
1c:65:9d:e5:d3:46 on AP 04:fe:7f:48:db:20 from Associated to
Associated
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 Stopping
deletion of Mobile Station: (callerId: 48)
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46 Sending Assoc
Response to station on BSSID 04:fe:7f:48:db:20 (status 0)
*apfMsConnTask_6: Sep 21 17:29:43.334: 1c:65:9d:e5:d3:46
apfProcessAssocReq (apf_80211.c:4587) Changing state for mobile
1c:65:9d:e5:d3:46 on AP 04:fe:7f:48:db:20 from Associated to
Associated
*dot1xMsgTask: Sep 21 17:29:43.335: 1c:65:9d:e5:d3:46 Disable re-auth,
use PMK lifetime.
*dot1xMsgTask: Sep 21 17:29:43.335: 1c:65:9d:e5:d3:46 dot1x - moving
mobile 1c:65:9d:e5:d3:46 into Connecting state

<next block of messages pertains to the actual authentication with the
RADIUS service>

What it looks like is that the supplicant is providing a key that does
not match what the controller is expecting, and so it fails and causes
re-auth.  What data do I need to collect to understand what this is
happening?  It is predictable, as I have a small test network with a
single controller with 2 access points.  Anytime I roam between them,
it re-auths.....and I'm not sure how to diagnose from here.

Thanks for any ideas!

--
Matt


From sleffler  Wed Sep 21 11:36:38 2011
From: sleffler (Sam Leffler)
Date: Wed, 21 Sep 2011 11:36:38 -0700
Subject: [RFC] wpa_supplicant: add fast reconnect support
In-Reply-To: <1316606999.3940.34.camel@jlt3.sipsolutions.net>
References: <20110324012220.CE69C58107@lefflers.sfo.corp.google.com>
	<1316606999.3940.34.camel@jlt3.sipsolutions.net>
Message-ID: <CA+yqC4ai9xtOt-uRwO3uVOvO0Ny37Qbs=fES8M9tJGRMraKXuQ@mail.gmail.com>

On Wed, Sep 21, 2011 at 5:09 AM, Johannes Berg
<johannes at sipsolutions.net> wrote:
> On Wed, 2011-03-23 at 18:07 -0700, Sam Leffler wrote:
>> When dropped by an AP for inactivity or because the session has timed
>> out, try to re-join directly before falling back to a full scan and the
>> normal work. ?This reduces the time to re-join a network from 5+ seconds
>> to ~300ms (not counting any time to renew DHCP).
>
> I looked at this in more detail since I want something like this too for
> resume support, but I don't like the way you play with the internal
> state machines -- not advancing it at all but still calling back into
> the core code etc. I think that adds too much fragility to an already
> pretty finicky system.

I totally agree.  Since that patch I had to fix some edge cases and
there may still be more.  I think to make this work right it needs to
be carefully tied to the SME pieces of supplicant or madness will
ensue.  OTOH all this could be dramatically simplified if one could
just re-auth w/o having to re-establish the BSS entry in the kernel by
doing the 1-channel scan...

-Sam


From j  Wed Sep 21 12:24:48 2011
From: j (Jouni Malinen)
Date: Wed, 21 Sep 2011 22:24:48 +0300
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
Message-ID: <20110921192448.GA5220@jm.kir.nu>

On Wed, Sep 21, 2011 at 01:24:07PM -0400, Matt Causey wrote:
> I'm running linux 2.38.2, and wpa_supplicant 0.7.3 with the following .config:

I would suggest running a quick test with the current development
snapshot from hostap.git (0.8.x). There has been some fixes in PMKSA
caching and OKC recently and I'm not sure whether they would affect
0.7.3.

> What it looks like is that the supplicant is providing a key that does
> not match what the controller is expecting, and so it fails and causes
> re-auth.  What data do I need to collect to understand what this is
> happening?  It is predictable, as I have a small test network with a
> single controller with 2 access points.  Anytime I roam between them,
> it re-auths.....and I'm not sure how to diagnose from here.

Which WLAN driver are you using? If the 0.8.x snapshot does not fix
this, please provide verbose debug log from wpa_supplicant (-ddt on
command line; or -ddKt if this is a test network and you don't care
about revealing passwords/keys etc. private information).
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From matt.causey  Wed Sep 21 14:05:59 2011
From: matt.causey (Matt Causey)
Date: Wed, 21 Sep 2011 17:05:59 -0400
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <20110921192448.GA5220@jm.kir.nu>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
	<20110921192448.GA5220@jm.kir.nu>
Message-ID: <CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>

Cheers for you response!

On Wed, Sep 21, 2011 at 3:24 PM, Jouni Malinen <j at w1.fi> wrote:
> On Wed, Sep 21, 2011 at 01:24:07PM -0400, Matt Causey wrote:
>> I'm running linux 2.38.2, and wpa_supplicant 0.7.3 with the following .config:
>
> I would suggest running a quick test with the current development
> snapshot from hostap.git (0.8.x). There has been some fixes in PMKSA
> caching and OKC recently and I'm not sure whether they would affect
> 0.7.3.
>
>> What it looks like is that the supplicant is providing a key that does
>> not match what the controller is expecting, and so it fails and causes
>> re-auth. ?What data do I need to collect to understand what this is
>> happening? ?It is predictable, as I have a small test network with a
>> single controller with 2 access points. ?Anytime I roam between them,
>> it re-auths.....and I'm not sure how to diagnose from here.
>
> Which WLAN driver are you using? If the 0.8.x snapshot does not fix
> this, please provide verbose debug log from wpa_supplicant (-ddt on
> command line; or -ddKt if this is a test network and you don't care
> about revealing passwords/keys etc. private information).
>

We're running with -onl80211, using the vanilla ath9k code in our
kernel version.

This version seems to roam flawlessly.   How much testing has this
version of code seen?

Just FYI, I've posted the output from out controller below, in case it
is helpful.

Cheers

(Cisco Controller) >*pemReceiveTask: Sep 21 21:58:43.393:
1c:65:9d:e5:d3:46 10.9.9.90 Added NPU entry of type 1, dtlFlags 0x0
*apfMsConnTask_6: Sep 21 22:00:59.966: 1c:65:9d:e5:d3:46 Reassociation
received from mobile on AP 04:fe:7f:48:db:20
*apfMsConnTask_6: Sep 21 22:00:59.966: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Changing ACL 'none' (ACL ID 255) ===> 'none' (ACL ID 255) ---
(caller apf_policy.c:1393)
*apfMsConnTask_6: Sep 21 22:00:59.966: 1c:65:9d:e5:d3:46 Applying
site-specific IPv6 override for station 1c:65:9d:e5:d3:46 - vapId 7,
site 'default-group', interface 'vlan9'
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Changing ACL 'none' (ACL ID 255) ===> 'none' (ACL ID 255) ---
(caller apf_policy.c:1393)
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Applying IPv6
Interface Policy for station 1c:65:9d:e5:d3:46 - vlan 9, interface id
13, interface 'vlan9'
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 STA - rates
(8): 12 18 24 36 48 72 96 108 0 0 0 0 0 0 0 0
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Processing
RSN IE type 48, length 38 for mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Received RSN
IE with 1 PMKIDs from mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: Received PMKID:  (16)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 27 32 98 c7 f9 cb
c8 87 d2 05 ed 9d 66 ff 9e 21
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 No valid
PMKID found in the cache for mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: CCKM: Find PMK in cache: BSSID =  (6)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 04 fe 7f 48 db 20
*apfMsConnTask_6: Sep 21 22:00:59.967: CCKM: Find PMK in cache: realAA =  (6)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 04 fe 7f 48 db 29
*apfMsConnTask_6: Sep 21 22:00:59.967: CCKM: Find PMK in cache: PMKID =  (16)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 27 32 98 c7 f9 cb
c8 87 d2 05 ed 9d 66 ff 9e 21
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Unable to
compute a valid PMKID from dot1x PMK cache for mobile
1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Found an
entry in the global PMK cache for station 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: CCKM: AA (6)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 04 fe 7f 48 db 29
*apfMsConnTask_6: Sep 21 22:00:59.967: CCKM: SPA (6)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 1c 65 9d e5 d3 46
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 computed a
valid PMKID from global PMK cache for mobile 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Creating a
PKC PMKID Cache entry for station 1c:65:9d:e5:d3:46 (RSN 0) on BSSID
04:fe:7f:48:db:29
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Adding BSSID
04:fe:7f:48:db:29 to PMKID cache for station 1c:65:9d:e5:d3:46
*apfMsConnTask_6: Sep 21 22:00:59.967: New PMKID: (16)
*apfMsConnTask_6: Sep 21 22:00:59.967:      [0000] 27 32 98 c7 f9 cb
c8 87 d2 05 ed 9d 66 ff 9e 21
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Deleted mobile LWAPP rule on AP [00:24:14:ff:0c:10]
*pemReceiveTask: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 10.9.9.90
Removed NPU entry.
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 Updated
location for station old AP 00:24:14:ff:0c:10-1, new AP
04:fe:7f:48:db:20-1
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 apfMsRunStateDec
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 apfMs1xStateDec
*apfMsConnTask_6: Sep 21 22:00:59.967: 1c:65:9d:e5:d3:46 10.9.9.90 RUN
(20) Change state to START (0) last state RUN (20)
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46 10.9.9.90
START (0) Initializing policy
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46 10.9.9.90
START (0) Change state to AUTHCHECK (2) last state RUN (20)
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46 10.9.9.90
AUTHCHECK (2) Change state to 8021X_REQD (3) last state RUN (20)
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46 10.9.9.90
8021X_REQD (3) Plumbed mobile LWAPP rule on AP 04:fe:7f:48:db:20 vapId
7 apVapId 7
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46
apfPemAddUser2 (apf_policy.c:222) Changing state for mobile
1c:65:9d:e5:d3:46 on AP 04:fe:7f:48:db:20 from Associated to
Associated
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46 Stopping
deletion of Mobile Station: (callerId: 48)
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46 Sending Assoc
Response to station on BSSID 04:fe:7f:48:db:20 (status 0)
*apfMsConnTask_6: Sep 21 22:00:59.968: 1c:65:9d:e5:d3:46
apfProcessAssocReq (apf_80211.c:4587) Changing state for mobile
1c:65:9d:e5:d3:46 on AP 04:fe:7f:48:db:20 from Associated to
Associated
*dot1xMsgTask: Sep 21 22:00:59.969: 1c:65:9d:e5:d3:46 Initiating RSN
with existing PMK to mobile 1c:65:9d:e5:d3:46
*dot1xMsgTask: Sep 21 22:00:59.969: 1c:65:9d:e5:d3:46 Disable re-auth,
use PMK lifetime.
*dot1xMsgTask: Sep 21 22:00:59.969: 1c:65:9d:e5:d3:46 dot1x - moving
mobile 1c:65:9d:e5:d3:46 into Force Auth state
*dot1xMsgTask: Sep 21 22:00:59.969: 1c:65:9d:e5:d3:46 Skipping
EAP-Success to mobile 1c:65:9d:e5:d3:46
*dot1xMsgTask: Sep 21 22:00:59.969: Including PMKID in M1  (16)
*dot1xMsgTask: Sep 21 22:00:59.969:      [0000] 27 32 98 c7 f9 cb c8
87 d2 05 ed 9d 66 ff 9e 21
*dot1xMsgTask: Sep 21 22:00:59.969: 1c:65:9d:e5:d3:46 Starting key
exchange to mobile 1c:65:9d:e5:d3:46, data packets will be dropped
*dot1xMsgTask: Sep 21 22:00:59.969: 1c:65:9d:e5:d3:46 Sending
EAPOL-Key Message to mobile 1c:65:9d:e5:d3:46

                                       state INITPMK (message 1),
replay counter 00.00.00.00.00.00.00.00
*Dot1x_NW_MsgTask_6: Sep 21 22:00:59.997: 1c:65:9d:e5:d3:46 Received
EAPOL-Key from mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:00:59.997: 1c:65:9d:e5:d3:46 Ignoring
invalid EAPOL version (1) in EAPOL-key message from mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:00:59.997: 1c:65:9d:e5:d3:46 Received
EAPOL-key in PTK_START state (message 2) from mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:00:59.997: 1c:65:9d:e5:d3:46 Stopping
retransmission timer for mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:00:59.997: 1c:65:9d:e5:d3:46 Sending
EAPOL-Key Message to mobile 1c:65:9d:e5:d3:46

                                             state PTKINITNEGOTIATING
(message 3), replay counter 00.00.00.00.00.00.00.01
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 Received
EAPOL-Key from mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 Ignoring
invalid EAPOL version (1) in EAPOL-key message from mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 Received
EAPOL-key in PTKINITNEGOTIATING state (message 4) from mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 apfMs1xStateInc
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 10.9.9.90
8021X_REQD (3) Change state to L2AUTHCOMPLETE (4) last state RUN (20)
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 10.9.9.90
L2AUTHCOMPLETE (4) Plumbed mobile LWAPP rule on AP 04:fe:7f:48:db:20
vapId 7 apVapId 7
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 apfMsRunStateInc
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 10.9.9.90
L2AUTHCOMPLETE (4) Change state to RUN (20) last state RUN (20)
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Reached PLUMBFASTPATH: from line 4604
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Adding Fast Path rule
  type = Airespace AP Client
  on AP 04:fe:7f:48:db:20, slot 1, interface = 13, QOS = 0
  ACL Id = 255, Jumbo Frames = NO
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.003: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Fast Path rule (contd...) 802.1P = 0, DSCP = 0, TokenID =
7006  IPv6 Vlan = 9, IPv6 intf id = 13
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.004: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Successfully plumbed mobile rule (ACL ID 255)
*Dot1x_NW_MsgTask_6: Sep 21 22:01:00.004: 1c:65:9d:e5:d3:46 Stopping
retransmission timer for mobile 1c:65:9d:e5:d3:46
*pemReceiveTask: Sep 21 22:01:00.004: 1c:65:9d:e5:d3:46 10.9.9.90
Added NPU entry of type 1, dtlFlags 0x0


Cheers again,

--
Matt


From j  Wed Sep 21 14:29:47 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 00:29:47 +0300
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
	<20110921192448.GA5220@jm.kir.nu>
	<CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>
Message-ID: <20110921212947.GA6184@jm.kir.nu>

On Wed, Sep 21, 2011 at 05:05:59PM -0400, Matt Causey wrote:
> > Which WLAN driver are you using? If the 0.8.x snapshot does not fix
> > this, please provide verbose debug log from wpa_supplicant (-ddt on
> > command line; or -ddKt if this is a test network and you don't care
> > about revealing passwords/keys etc. private information).

> We're running with -onl80211, using the vanilla ath9k code in our
> kernel version.
> 
> This version seems to roam flawlessly.   How much testing has this
> version of code seen?
> 
> Just FYI, I've posted the output from out controller below, in case it
> is helpful.

Interesting.. It is unclear from those logs what exactly was causing the
problem in 0.7.3. The fixes I've done in 0.8.x branch should have
addressed somewhat different issues.

As far as testing of the current snapshot of the development branch is
concerned, that specific version is unlikely to have received much
testing since there was a change there today ;-). In general, I would
expect 0.8.x branch to be in much better shape as far as use of nl80211
and roaming is concerned.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 14:41:42 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 00:41:42 +0300
Subject: [PATCH 1/3] wext: remove write-only variable ap_num
In-Reply-To: <20110921145907.9326.83141.stgit@mj>
References: <20110921145907.9326.83141.stgit@mj>
Message-ID: <20110921214142.GB6184@jm.kir.nu>

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 14:44:38 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 00:44:38 +0300
Subject: [PATCH 2/3] doc: use correct path for kerneldoc2doxygen.pl
In-Reply-To: <20110921145919.9326.91728.stgit@mj>
References: <20110921145907.9326.83141.stgit@mj>
	<20110921145919.9326.91728.stgit@mj>
Message-ID: <20110921214438.GC6184@jm.kir.nu>

On Wed, Sep 21, 2011 at 10:59:19AM -0400, Pavel Roskin wrote:
> Refer to kerneldoc2doxygen.pl as doc/kerneldoc2doxygen.pl since doxygen
> is run in the top-level source directory.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 14:54:15 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 00:54:15 +0300
Subject: [PATCH 3/3] Fix typos found by codespell
In-Reply-To: <20110921145930.9326.39390.stgit@mj>
References: <20110921145907.9326.83141.stgit@mj>
	<20110921145930.9326.39390.stgit@mj>
Message-ID: <20110921215415.GD6184@jm.kir.nu>

On Wed, Sep 21, 2011 at 10:59:30AM -0400, Pavel Roskin wrote:

> Signed-off-by: Pavel Roskin <proski at gnu.org>

Thanks, applied with couple of exceptions:

>  src/drivers/nl80211_copy.h                  |    6 +++---

This is an identical copy of linux/nl80211.h from the kernel tree, so
spelling fixes would be overwritten whenever a new update is made. If
you want to get this parts fixed, the patch will need to be against the
kernel tree (wireless-testing.git)..

>  wpa_supplicant/README-Windows.txt           |    2 +-

This changes spelling of a word in the SSLeay license. I do not find it
acceptable to change that. The particular sentence is actually even
explicitly disallowing changes to the license.. ;-)  (In addition,
"publically" seems to be acceptable spelling while "publicly" is much
more common.)


There were couple of other files that were from external sources and the
more appropriate location for spelling fixes would be in the upstream
projects. Anyway, I ended up taking these changes after some
consideration.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 14:58:22 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 00:58:22 +0300
Subject: [PATCH] P2P: fix action done handling
In-Reply-To: <1316512749.3953.6.camel@jlt3.sipsolutions.net>
References: <1316512749.3953.6.camel@jlt3.sipsolutions.net>
Message-ID: <20110921215822.GE6184@jm.kir.nu>

On Tue, Sep 20, 2011 at 11:59:09AM +0200, Johannes Berg wrote:
> The action done handling needs to abort an off-channel
> period since one might have been used for example for
> GO negotiation and after action done the code assumes
> it can start a new off-channel period.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 15:02:20 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 01:02:20 +0300
Subject: [PATCH] D-Bus: Fix memory leak when using array of array of bytes
In-Reply-To: <1314402929-32216-1-git-send-email-angie.v.chinchilla@intel.com>
References: <1314402929-32216-1-git-send-email-angie.v.chinchilla@intel.com>
Message-ID: <20110921220220.GF6184@jm.kir.nu>

On Fri, Aug 26, 2011 at 04:55:29PM -0700, Angie Chinchilla wrote:
> When parsing a dict entry which is an array of an array of bytes the entry
> representing the dict entry has DBUS_TYPE_ARRAY as its type and
> WPAS_DBUS_TYPE_ARRAY as its array_type. The function freeing this parsed
> data incorrectly tested the entry type for WPAS_DBUS_TYPE_ARRAY while doing
> no testing of this value for array_type. This results in a memory leak
> whenever a D-Bus message with this type of data is parsed.

> All of the above messages are parsed with the same function,
> wpa_dbus_dict_get_entry, so the assignment of the entry's type and
> array_type is consistent. The parsed data is also consistently freed with
> the same function, wpa_dbus_dict_entry_clear, so we can use the same checks
> to free the data correctly.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 15:02:41 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 01:02:41 +0300
Subject: [PATCH] D-Bus/P2P: Support all discovery types
In-Reply-To: <1314402958-32247-1-git-send-email-angie.v.chinchilla@intel.com>
References: <1314402958-32247-1-git-send-email-angie.v.chinchilla@intel.com>
Message-ID: <20110921220241.GG6184@jm.kir.nu>

On Fri, Aug 26, 2011 at 04:55:58PM -0700, Angie Chinchilla wrote:
> The default discovery type is to search for devices only on social
> channels. Expand this to also support an initial full scan followed by the
> scan of social channels as well as the progressive scan that scans through
> all the channels in the Search state rounds. This does not change the
> default of scanning only social channels although there is currently a
> discrepancy wrt the default used by wpa_cli, which is the full scan first.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 15:05:45 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 01:05:45 +0300
Subject: [PATCH] wpa_supplicant: AP mode, set drv_flags
In-Reply-To: <3078A9B976EF864C8DDD0C499FFD07911E3B14CED1@EXMB01.eu.tieto.com>
References: <3078A9B976EF864C8DDD0C499FFD07911E3B14CED1@EXMB01.eu.tieto.com>
Message-ID: <20110921220545.GH6184@jm.kir.nu>

On Wed, Sep 21, 2011 at 10:33:23AM +0300, Janusz.Dziedzic at tieto.com wrote:
> In AP/P2P_GO mode we should have correct hostapd drv_flags.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 15:11:09 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 01:11:09 +0300
Subject: Does wpa_supplicant support static WEP + IEEE802.1x
	authentication?
In-Reply-To: <5EFF534737810441B0F97C2792E49C2DBF354D@ILMAIL01.dspg.com>
References: <5EFF534737810441B0F97C2792E49C2DBF354D@ILMAIL01.dspg.com>
Message-ID: <20110921221109.GI6184@jm.kir.nu>

On Tue, Sep 20, 2011 at 09:11:07AM +0300, Hong Wu wrote:
> Some of old APs support static WEP + IEEE802.1x EAP authentication to
> raise security level. My question is: does wpa_supplicant support static
> WEP + IEEE802.1x EAP-MD5 authentication? If it does, how to configure
> wpa_supplicant for static WEP + EAP authentication? 

If I remember correctly, I added support for that at some point..
Though, I haven't really tested this in years (welcome to 21st
century... WEP should not really be used anymore and combining that with
EAP-MD5 really demonstrates total lack of security ;-).

The configuration for this would be combination of station WEP
configuration (i.e., wep_key# parameters) and EAP-MD5 with IEEE 802.1X.
In addition to that, eapol_flags will probably need to be set to 0.
Please let me know whether this works if you happen to test it.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 21 15:17:52 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 01:17:52 +0300
Subject: [PATCH] D-Bus/P2P: treat PIN as string
In-Reply-To: <1315931249-1528-1-git-send-email-angie.v.chinchilla@intel.com>
References: <1315931249-1528-1-git-send-email-angie.v.chinchilla@intel.com>
Message-ID: <20110921221752.GJ6184@jm.kir.nu>

On Tue, Sep 13, 2011 at 09:27:29AM -0700, Angie Chinchilla wrote:
> supplicant returns the PIN in reply to the connect method. Treating this
> value as an integer runs the risk of not returning the correct value if the
> first digit(s) happens to be a zero(es). To return the correct PIN it needs to be
> returned as a string.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From matt.causey  Wed Sep 21 16:50:27 2011
From: matt.causey (Matt Causey)
Date: Wed, 21 Sep 2011 16:50:27 -0700
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <20110921212947.GA6184@jm.kir.nu>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
	<20110921192448.GA5220@jm.kir.nu>
	<CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>
	<20110921212947.GA6184@jm.kir.nu>
Message-ID: <CAGnc4p9F11P26rzODTPd+aA3cSyDceNG9ZfmzJ82JVd7E0RBMw@mail.gmail.com>

On Wed, Sep 21, 2011 at 5:29 PM, Jouni Malinen <j at w1.fi> wrote:
> On Wed, Sep 21, 2011 at 05:05:59PM -0400, Matt Causey wrote:
>> > Which WLAN driver are you using? If the 0.8.x snapshot does not fix
>> > this, please provide verbose debug log from wpa_supplicant (-ddt on
>> > command line; or -ddKt if this is a test network and you don't care
>> > about revealing passwords/keys etc. private information).
>
>> We're running with -onl80211, using the vanilla ath9k code in our
>> kernel version.
>>
>> This version seems to roam flawlessly. ? How much testing has this
>> version of code seen?
>>
>> Just FYI, I've posted the output from out controller below, in case it
>> is helpful.
>
> Interesting.. It is unclear from those logs what exactly was causing the
> problem in 0.7.3. The fixes I've done in 0.8.x branch should have
> addressed somewhat different issues.
>

Hum.  Well since you said that, I decided to test _again_ with the
latest stable, and I cannot reproduce the problem.

So, to fill in some detail that I left out initially, I did have this
work on the latest stable, but something changed and fast roaming
stopped working.   Restarting the daemon and various other steps would
not cause it to work again.  And now that I've gone back to test, it's
working again...on the old code.  It makes me sad that it is
inconsistent and I don't know what variable is changing.  It's not
even clear if it is the controller failing or the supplicant.

In the middle of writing this I moved the client around to cause a
roam and it re-auth'd with RADIUS....so I'm seeing some sort of
inconsistent failure of fast roaming.  Here is what the supplicant
says:

Setting authentication timeout: 70 sec 0 usec
RSN: Authenticator did not accept PMKID, doing full EAP authentication
EAPOL: Supplicant port status: Unauthorized

Is it possible that the PTK sent by the supplicant and received by the
controller gets malformed somehow?  I'll keep running tests to see if
I can repro more failures, possibly getting some 802.11 captures.
I'll also re-try the new code, but will let it run longer this time
before proclaiming success this time.  :-)

> As far as testing of the current snapshot of the development branch is
> concerned, that specific version is unlikely to have received much
> testing since there was a change there today ;-). In general, I would
> expect 0.8.x branch to be in much better shape as far as use of nl80211
> and roaming is concerned.
>

Well, sure you're making a lot of changes in the current snapshot.
:-)  But more generally....what does the regression test procedure
look like for the supplicant?  I'm just curious...  :-)

--
Matt


From matt.causey  Wed Sep 21 18:26:45 2011
From: matt.causey (Matt Causey)
Date: Wed, 21 Sep 2011 21:26:45 -0400
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <CAGnc4p9F11P26rzODTPd+aA3cSyDceNG9ZfmzJ82JVd7E0RBMw@mail.gmail.com>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
	<20110921192448.GA5220@jm.kir.nu>
	<CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>
	<20110921212947.GA6184@jm.kir.nu>
	<CAGnc4p9F11P26rzODTPd+aA3cSyDceNG9ZfmzJ82JVd7E0RBMw@mail.gmail.com>
Message-ID: <CAGnc4p_aY=cEnmbDM=dLZtnT0+wbzoDZY3VO32=bTMpL=V5Fgg@mail.gmail.com>

>> On Wed, Sep 21, 2011 at 05:05:59PM -0400, Matt Causey wrote:
>>> > Which WLAN driver are you using? If the 0.8.x snapshot does not fix
>>> > this, please provide verbose debug log from wpa_supplicant (-ddt on
>>> > command line; or -ddKt if this is a test network and you don't care
>>> > about revealing passwords/keys etc. private information).
>>
>>> We're running with -onl80211, using the vanilla ath9k code in our
>>> kernel version.
>>>
>>> This version seems to roam flawlessly. ? How much testing has this
>>> version of code seen?
>>>
>>> Just FYI, I've posted the output from out controller below, in case it
>>> is helpful.
>>
>> Interesting.. It is unclear from those logs what exactly was causing the
>> problem in 0.7.3. The fixes I've done in 0.8.x branch should have
>> addressed somewhat different issues.
>>
>
> Hum. ?Well since you said that, I decided to test _again_ with the
> latest stable, and I cannot reproduce the problem.
>
> So, to fill in some detail that I left out initially, I did have this
> work on the latest stable, but something changed and fast roaming
> stopped working. ? Restarting the daemon and various other steps would
> not cause it to work again. ?And now that I've gone back to test, it's
> working again...on the old code. ?It makes me sad that it is
> inconsistent and I don't know what variable is changing. ?It's not
> even clear if it is the controller failing or the supplicant.
>
> In the middle of writing this I moved the client around to cause a
> roam and it re-auth'd with RADIUS....so I'm seeing some sort of
> inconsistent failure of fast roaming. ?Here is what the supplicant
> says:
>
> Setting authentication timeout: 70 sec 0 usec
> RSN: Authenticator did not accept PMKID, doing full EAP authentication
> EAPOL: Supplicant port status: Unauthorized
>

So this time, I was constantly re-authing successfully until the PMK
expiration timer on the controller fired, and nuked the PMK for my
station.  After that, all of the supplicant's attempts to use its
internal PMK would fail.

Here is the log entry from the controller's side, of the PMK getting
nuked (mostly FYI, just in case it's helpful):

*apfPmkCacheTimer: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 Removing
expired PMK cache entry for station 1c:65:9d:e5:d3:46 AKM
was:APF_KEY_MGMT_80211i
*apfReceiveTask: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 Initiating
802.1x due to PMK Timeout Event for STA
*dot1xMsgTask: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 dot1x - moving
mobile 1c:65:9d:e5:d3:46 into Connecting state
*dot1xMsgTask: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 Sending
EAP-Request/Identity to mobile 1c:65:9d:e5:d3:46 (EAP Id 1)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.435: 1c:65:9d:e5:d3:46 Received
EAPOL EAPPKT from mobile 1c:65:9d:e5:d3:46

<snip lots of RADIUS traffic>

*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.679: 1c:65:9d:e5:d3:46 Received
EAP Response from mobile 1c:65:9d:e5:d3:46 (EAP Id 10, EAP Type 13)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.679: 1c:65:9d:e5:d3:46 Entering
Backend Auth Response state for mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Processing
Access-Accept for mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Setting
re-auth timeout to 1800 seconds, got from WLAN config.
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Station
1c:65:9d:e5:d3:46 setting dot1x reauth timeout = 1800
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Creating a
PKC PMKID Cache entry for station 1c:65:9d:e5:d3:46 (RSN 2)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Adding
BSSID 04:fe:7f:48:db:29 to PMKID cache for station 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: New PMKID: (16)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683:      [0000] c5 88 3d 3c 34
37 02 35 ba 52 c8 a2 24 9e 97 bf
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Disabling
re-auth since PMK lifetime can take care of same.
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 PMK sent
to mobility group
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Sending
EAP-Success to mobile 1c:65:9d:e5:d3:46 (EAP Id 10)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: Including PMKID in M1  (16)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684:      [0000] c5 88 3d 3c 34
37 02 35 ba 52 c8 a2 24 9e 97 bf
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Starting
key exchange to mobile 1c:65:9d:e5:d3:46, data packets will be dropped
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Sending
EAPOL-Key Message to mobile 1c:65:9d:e5:d3:46

                                             state INITPMK (message
1), replay counter 00.00.00.00.00.00.00.02
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Entering
Backend Auth Success state (id=10) for mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Received
Auth Success while in Authenticating state for mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 dot1x -
moving mobile 1c:65:9d:e5:d3:46 into Authenticated state
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Received
EAPOL-Key from mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Ignoring
invalid EAPOL version (1) in EAPOL-key message from mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Received
EAPOL-key in PTK_START state (message 2) from mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Stopping
retransmission timer for mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.690: 1c:65:9d:e5:d3:46 Sending
EAPOL-Key Message to mobile 1c:65:9d:e5:d3:46

                                             state PTKINITNEGOTIATING
(message 3), replay counter 00.00.00.00.00.00.00.03
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 Received
EAPOL-Key from mobile 1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 Ignoring
invalid EAPOL version (1) in EAPOL-key message from mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 Received
EAPOL-key in PTKINITNEGOTIATING state (message 4) from mobile
1c:65:9d:e5:d3:46
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 STA
[1c:65:9d:e5:d3:46, 10.9.9.90] Deleting Fast Path Rule (8021X_AUTH)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMsRunStateDec
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMs1xStateDec
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Change state to 8021X_REQD (3) last state RUN (20)
*pemReceiveTask: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
Removed NPU entry.
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMs1xStateInc
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
8021X_REQD (3) Change state to L2AUTHCOMPLETE (4) last state RUN (20)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
L2AUTHCOMPLETE (4) Plumbed mobile LWAPP rule on AP 04:fe:7f:48:db:20
vapId 7 apVapId 7
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMsRunStateInc
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
L2AUTHCOMPLETE (4) Change state to RUN (20) last state RUN (20)
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Reached PLUMBFASTPATH: from line 4604
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Adding Fast Path rule
  type = Airespace AP Client
  on AP 04:fe:7f:48:db:20, slot 1, interface = 13, QOS = 0
  ACL Id = 255, Jumbo Frames = NO
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Fast Path rule (contd...) 802.1P = 0, DSCP = 0, TokenID =
7006  IPv6 Vlan = 9, IPv6 intf id = 13
*Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
RUN (20) Successfully plumbed mobile rule (ACL ID 255)


I would expect though, that after the station successfully re-auths,
it should update its PMK so that future attempts to re-auth with it
succeed.  But it doesn't look like it is doing that.  Do you have any
ideas?

Thanks!

--
Matt


From kinoyatov  Thu Sep 22 00:05:50 2011
From: kinoyatov (Khamidulla Inoyatov)
Date: Thu, 22 Sep 2011 16:05:50 +0900
Subject: IAPP working configuration
Message-ID: <CAGqDgf5_k=nnEFH8+oPSPz_Nc8-NLNaFZ8BoX9iAA-_iuu1HwA@mail.gmail.com>

Dear all members,

Does somebody configure EAP-TLS authentication and IAPP in following
topology? if yes can you provide correct configuration for hostapds and
wpa_supplicants.

MN (wpa_supplicant) <--wireless link--> AP (hostapd)<--wired link--> AP
(hostapd) <--wired link--> AAA Server (freeradius)

Sincerely yours,
Khamidulla Inoyatov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110922/f0714225/attachment.htm 


From andriy.v.tkachuk  Thu Sep 22 08:53:06 2011
From: andriy.v.tkachuk (Andriy Tkachuk)
Date: Thu, 22 Sep 2011 18:53:06 +0300
Subject: [patch] Set WPS/WSC IE for ProbeRequests via WEXT driver wrapper
Message-ID: <CALzbMt6NRy1TqDvNQ+V9qYkF0aG68bd8YqaLvT7AUFsbArUkPA@mail.gmail.com>

Hi folks,

The following patch set the WPS/WSC IE for ProbeRequests (as required
by WPS spec) via WEXT driver wrapper.

diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index e731101..85b6ef6 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -43,6 +43,7 @@ static int wpa_driver_wext_get_range(void *priv);
 static int wpa_driver_wext_finish_drv_init(struct wpa_driver_wext_data *drv);
 static void wpa_driver_wext_disconnect(struct wpa_driver_wext_data *drv);
 static int wpa_driver_wext_set_auth_alg(void *priv, int auth_alg);
+static int wpa_driver_wext_set_gen_ie(void *priv, const u8 *ie, size_t ie_len);


 int wpa_driver_wext_set_auth_param(struct wpa_driver_wext_data *drv,
@@ -989,6 +990,8 @@ int wpa_driver_wext_scan(void *priv, struct
wpa_driver_scan_params *params)
        os_memset(&iwr, 0, sizeof(iwr));
        os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);

+       wpa_driver_wext_set_gen_ie(priv, params->extra_ies,
+                                        params->extra_ies_len);
        if (ssid && ssid_len) {
                os_memset(&req, 0, sizeof(req));
                req.essid_len = ssid_len;


Regards,
? Andriy


From rmanohar  Thu Sep 22 08:56:38 2011
From: rmanohar (Rajkumar Manoharan)
Date: Thu, 22 Sep 2011 21:26:38 +0530
Subject: [RFC 2/2] nl80211: Add support to disable CCK rate for p2p probe and
	frames
In-Reply-To: <1316706998-24719-1-git-send-email-rmanohar@qca.qualcomm.com>
References: <1316706998-24719-1-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <1316706998-24719-2-git-send-email-rmanohar@qca.qualcomm.com>

Add a new attribute to specify whether to use CCK rate or not during
scan and sending management frames. This helps to send p2p probes
at non-CCK rate. This ensures that P2P probe request/response/action
frames are awlays sent at non CCK rates.

Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
 src/drivers/driver_nl80211.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9bdd1f7..59d8e0b 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2508,6 +2508,8 @@ static int wpa_driver_nl80211_scan(void *priv,
 		NLA_PUT(rates, NL80211_BAND_2GHZ, 8,
 			"\x0c\x12\x18\x24\x30\x48\x60\x6c");
 		nla_put_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES, rates);
+
+		NLA_PUT_FLAG(msg, NL80211_ATTR_TX_NO_CCK_RATE);
 	}
 
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
@@ -6518,6 +6520,8 @@ static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
 	if (wait)
 		NLA_PUT_U32(msg, NL80211_ATTR_DURATION, wait);
 	NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK);
+	NLA_PUT_FLAG(msg, NL80211_ATTR_TX_NO_CCK_RATE);
+
 	NLA_PUT(msg, NL80211_ATTR_FRAME, buf_len, buf);
 
 	cookie = 0;
-- 
1.7.6.3



From rmanohar  Thu Sep 22 08:56:37 2011
From: rmanohar (Rajkumar Manoharan)
Date: Thu, 22 Sep 2011 21:26:37 +0530
Subject: [RFC 1/2] nl80211: Sync with include/linux/nl80211.h in
	wireless-testing.git
Message-ID: <1316706998-24719-1-git-send-email-rmanohar@qca.qualcomm.com>

Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
 src/drivers/nl80211_copy.h |   52 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index 8aa7bad..c73582f 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -238,6 +238,8 @@
  *
  * @NL80211_CMD_GET_SCAN: get scan results
  * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
+ *	%NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
+ *	probe requests at CCK rate or not.
  * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  *	NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
@@ -432,6 +434,8 @@
  *	specified using %NL80211_ATTR_DURATION. When called, this operation
  *	returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
  *	TX status event pertaining to the TX request.
+ *	%NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
+ *	management frames at CCK rate or not in 2GHz band.
  * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
  *	command may be used with the corresponding cookie to cancel the wait
  *	time if it is known that it is no longer necessary.
@@ -499,6 +503,9 @@
  *	this command may also be sent by the driver as an MLME event to
  *	inform userspace of the new replay counter.
  *
+ * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
+ *	of PMKSA caching dandidates.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -623,6 +630,8 @@ enum nl80211_commands {
 
 	NL80211_CMD_SET_REKEY_OFFLOAD,
 
+	NL80211_CMD_PMKSA_CANDIDATE,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -1070,6 +1079,16 @@ enum nl80211_commands {
  * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of
  *	roaming to another AP in the same ESS if the signal lever is low.
  *
+ * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching
+ *	candidate information, see &enum nl80211_pmksa_candidate_attr.
+ *
+ * @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not
+ *	for management frames transmission. In order to avoid p2p probe/action
+ *	frames are being transmitted at CCK rate in 2GHz band, the user space
+ *	applications use this attribute.
+ *	This attribute is used with %NL80211_CMD_TRIGGER_SCAN and
+ *	%NL80211_CMD_FRAME commands.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1288,6 +1307,10 @@ enum nl80211_attrs {
 	NL80211_ATTR_SCHED_SCAN_MATCH,
 	NL80211_ATTR_MAX_MATCH_SETS,
 
+	NL80211_ATTR_PMKSA_CANDIDATE,
+
+	NL80211_ATTR_TX_NO_CCK_RATE,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -2541,8 +2564,10 @@ enum nl80211_hidden_ssid {
 /**
  * enum nl80211_sta_wme_attr - station WME attributes
  * @__NL80211_STA_WME_INVALID: invalid number for nested attribute
- * @NL80211_STA_WME_QUEUES: bitmap of uapsd queues.
- * @NL80211_STA_WME_MAX_SP: max service period.
+ * @NL80211_STA_WME_UAPSD_QUEUES: bitmap of uapsd queues. the format
+ *	is the same as the AC bitmap in the QoS info field.
+ * @NL80211_STA_WME_MAX_SP: max service period. the format is the same
+ *	as the MAX_SP field in the QoS info field (but already shifted down).
  * @__NL80211_STA_WME_AFTER_LAST: internal
  * @NL80211_STA_WME_MAX: highest station WME attribute
  */
@@ -2556,4 +2581,27 @@ enum nl80211_sta_wme_attr {
 	NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1
 };
 
+/**
+ * enum nl80211_pmksa_candidate_attr - attributes for PMKSA caching candidates
+ * @__NL80211_PMKSA_CANDIDATE_INVALID: invalid number for nested attributes
+ * @NL80211_PMKSA_CANDIDATE_INDEX: candidate index (u32; the smaller, the higher
+ *	priority)
+ * @NL80211_PMKSA_CANDIDATE_BSSID: candidate BSSID (6 octets)
+ * @NL80211_PMKSA_CANDIDATE_PREAUTH: RSN pre-authentication supported (flag)
+ * @NUM_NL80211_PMKSA_CANDIDATE: number of PMKSA caching candidate attributes
+ *	(internal)
+ * @MAX_NL80211_PMKSA_CANDIDATE: highest PMKSA caching candidate attribute
+ *	(internal)
+ */
+enum nl80211_pmksa_candidate_attr {
+	__NL80211_PMKSA_CANDIDATE_INVALID,
+	NL80211_PMKSA_CANDIDATE_INDEX,
+	NL80211_PMKSA_CANDIDATE_BSSID,
+	NL80211_PMKSA_CANDIDATE_PREAUTH,
+
+	/* keep last */
+	NUM_NL80211_PMKSA_CANDIDATE,
+	MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1
+};
+
 #endif /* __LINUX_NL80211_H */
-- 
1.7.6.3



From j  Thu Sep 22 10:19:38 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 20:19:38 +0300
Subject: [RFC 2/2] nl80211: Add support to disable CCK rate for p2p probe
	and frames
In-Reply-To: <1316706998-24719-2-git-send-email-rmanohar@qca.qualcomm.com>
References: <1316706998-24719-1-git-send-email-rmanohar@qca.qualcomm.com>
	<1316706998-24719-2-git-send-email-rmanohar@qca.qualcomm.com>
Message-ID: <20110922171938.GA794@jm.kir.nu>

On Thu, Sep 22, 2011 at 09:26:38PM +0530, Rajkumar Manoharan wrote:
> Add a new attribute to specify whether to use CCK rate or not during
> scan and sending management frames. This helps to send p2p probes
> at non-CCK rate. This ensures that P2P probe request/response/action
> frames are awlays sent at non CCK rates.

Thanks!

This looks reasonable for now. The nl80211_send_frame_cmd() can be made
to use a new internal flag to indicate the P2P use case separately.


PS.

There is no need to send me patches to update nl80211_copy.h. I will
pull those separately from wireless-testing.git anyway and will only do
this after the changes actually get applied there.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Sep 22 10:42:22 2011
From: j (Jouni Malinen)
Date: Thu, 22 Sep 2011 20:42:22 +0300
Subject: [patch] Set WPS/WSC IE for ProbeRequests via WEXT driver wrapper
In-Reply-To: <CALzbMt6NRy1TqDvNQ+V9qYkF0aG68bd8YqaLvT7AUFsbArUkPA@mail.gmail.com>
References: <CALzbMt6NRy1TqDvNQ+V9qYkF0aG68bd8YqaLvT7AUFsbArUkPA@mail.gmail.com>
Message-ID: <20110922174222.GA1248@jm.kir.nu>

On Thu, Sep 22, 2011 at 06:53:06PM +0300, Andriy Tkachuk wrote:
> The following patch set the WPS/WSC IE for ProbeRequests (as required
> by WPS spec) via WEXT driver wrapper.

> diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
> @@ -989,6 +990,8 @@ int wpa_driver_wext_scan(void *priv, struct
> wpa_driver_scan_params *params)
>         os_memset(&iwr, 0, sizeof(iwr));
>         os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
> 
> +       wpa_driver_wext_set_gen_ie(priv, params->extra_ies,
> +                                        params->extra_ies_len);
>         if (ssid && ssid_len) {
>                 os_memset(&req, 0, sizeof(req));
>                 req.essid_len = ssid_len;

Hmm.. How would this be cleared? Could we accidentally leave behind some
values that really should not be used? For example, active PBC mode
configured by wpa_supplicant and then any scan on the system would claim
the device is in active PBC mode.. At minimum, this would need to be
cleared when processing the scan completed event (or scan timeout).

How commonly is this ioctl used to change Probe Request behavior? Do all
or even most drivers do that? The exact behavior is not really
documented very well and the only existing use case in wpa_supplicant
seems to be in configuring IEs to (Re)Association Request frames.

-- 
Jouni Malinen                                            PGP id EFC895FA


From johannes  Thu Sep 22 10:44:31 2011
From: johannes (Johannes Berg)
Date: Thu, 22 Sep 2011 19:44:31 +0200
Subject: [patch] Set WPS/WSC IE for ProbeRequests via WEXT driver wrapper
In-Reply-To: <20110922174222.GA1248@jm.kir.nu>
References: <CALzbMt6NRy1TqDvNQ+V9qYkF0aG68bd8YqaLvT7AUFsbArUkPA@mail.gmail.com>
	<20110922174222.GA1248@jm.kir.nu>
Message-ID: <1316713471.3899.55.camel@jlt3.sipsolutions.net>

On Thu, 2011-09-22 at 20:42 +0300, Jouni Malinen wrote:

> > +       wpa_driver_wext_set_gen_ie(priv, params->extra_ies,
> > +                                        params->extra_ies_len);
> >         if (ssid && ssid_len) {
> >                 os_memset(&req, 0, sizeof(req));
> >                 req.essid_len = ssid_len;
[...]
> How commonly is this ioctl used to change Probe Request behavior? Do all
> or even most drivers do that? The exact behavior is not really
> documented very well and the only existing use case in wpa_supplicant
> seems to be in configuring IEs to (Re)Association Request frames.

Certainly not in cfg80211.

johannes



From sivasanath  Fri Sep 23 13:23:37 2011
From: sivasanath (Siva Pothireddy)
Date: Sat, 24 Sep 2011 01:53:37 +0530
Subject: No subject
Message-ID: <CAJViskgzkfEATgCzQtNKnVJTW+vd+eF5OXNN9phy-jvD6pjHbw@mail.gmail.com>

...Never late to change your life!  http://safogo.com/com.friend.php?kpage=16ac6


From arik  Mon Sep 26 03:55:21 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:21 +0300
Subject: [PATCH 00/14] TDLS support for nl80211 drivers
Message-ID: <1317034535-4892-1-git-send-email-arik@wizery.com>

This series adds basic TDLS support for nl80211 based drivers.
It is based in part on patches by Kalyan C. Gaddam, cc-ed here.

Support is added for peer discovery and data path setup/teardown.
Currently not implemented: QoS/HT, peer PSM, peer U-APSD and channel
switching.

Kernel-mode support is added in a companion series.

The main change from the RFC series is the addition of a TDLS peer STA
before initiating setup. This allows the driver to drop/buffer frames
sent to the peer during link setup, as required by the specification.

Tested with wl12xx hardware, with a nl80211/mac80211 based driver.

Arik

Cc: Kalyan C Gaddam <chakkal at iit.edu>

Arik Nemtsov (14):
  TDLS: support setting CONFIG_TDLS_TESTING in .config
  nl80211: update nl80211_copy.h to kernel version with TDLS support
  nl80211: implement TDLS callback functions and propagate capabilities
  TDLS: get TDLS related capabilities from driver
  TDLS: process discovery requests and send discovery responses
  TDLS/nl80211: support receiving TDLS discovery response frames
  TDLS: support sending a teardown frame from usermode
  TDLS: support sending TDLS discovery requests
  TDLS: implement low-ack event for lost TDLS peers
  TDLS: collect peer capabilities and supp-rates during link setup
  TDLS: add peer as a STA during link setup
  TDLS: support mgmt-frame Tx for ctrl-iface operations
  TDLS: make use of wpa_tdls_add_peer to avoid code duplication
  TDLS: use a valid dialog-token in a setup request

 src/common/ieee802_11_defs.h |    1 +
 src/drivers/driver.h         |   30 ++++-
 src/drivers/driver_nl80211.c |  181 +++++++++++++++++++++-
 src/drivers/nl80211_copy.h   |   48 ++++++
 src/rsn_supp/tdls.c          |  350 ++++++++++++++++++++++++++++++++++++------
 src/rsn_supp/wpa.h           |   13 ++-
 src/rsn_supp/wpa_i.h         |   31 ++++
 src/rsn_supp/wpa_ie.c        |   11 ++
 src/rsn_supp/wpa_ie.h        |    4 +
 wpa_supplicant/Android.mk    |    4 +
 wpa_supplicant/Makefile      |    4 +
 wpa_supplicant/ctrl_iface.c  |   20 ++-
 wpa_supplicant/driver_i.h    |   11 ++
 wpa_supplicant/events.c      |   18 ++-
 wpa_supplicant/wpas_glue.c   |   43 +++++
 15 files changed, 698 insertions(+), 71 deletions(-)

-- 
1.7.4.1



From arik  Mon Sep 26 03:55:22 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:22 +0300
Subject: [PATCH 01/14] TDLS: support setting CONFIG_TDLS_TESTING in .config
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-2-git-send-email-arik@wizery.com>

Fix the regular and android makefiles.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 wpa_supplicant/Android.mk |    4 ++++
 wpa_supplicant/Makefile   |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 8ce24ad..05a7998 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -179,6 +179,10 @@ NEED_SHA256=y
 NEED_AES_OMAC1=y
 endif
 
+ifdef CONFIG_TDLS_TESTING
+L_CFLAGS += -DCONFIG_TDLS_TESTING
+endif
+
 ifdef CONFIG_PEERKEY
 L_CFLAGS += -DCONFIG_PEERKEY
 endif
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 49bbcd7..2230dc0 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -161,6 +161,10 @@ NEED_SHA256=y
 NEED_AES_OMAC1=y
 endif
 
+ifdef CONFIG_TDLS_TESTING
+CFLAGS += -DCONFIG_TDLS_TESTING
+endif
+
 ifdef CONFIG_PEERKEY
 CFLAGS += -DCONFIG_PEERKEY
 endif
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:23 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:23 +0300
Subject: [PATCH 02/14] nl80211: update nl80211_copy.h to kernel version with
	TDLS support
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-3-git-send-email-arik@wizery.com>

This copy of the nl80211.h header introduces new TDLS commands and
constants.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/nl80211_copy.h |   48 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index 460b12a..165a49c 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -502,6 +502,9 @@
  * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
  *	of PMKSA caching dandidates.
  *
+ * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
+ * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -628,6 +631,9 @@ enum nl80211_commands {
 
 	NL80211_CMD_PMKSA_CANDIDATE,
 
+	NL80211_CMD_TDLS_OPER,
+	NL80211_CMD_TDLS_MGMT,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -1078,6 +1084,20 @@ enum nl80211_commands {
  * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching
  *	candidate information, see &enum nl80211_pmksa_candidate_attr.
  *
+ * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup
+ *	request, link setup confirm, link teardown, etc.). Values are
+ *	described in the TDLS (802.11z) specification.
+ * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a
+ *	TDLS conversation between two devices.
+ * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see
+ *	&enum nl80211_tdls_operation, represented as a u8.
+ * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate
+ *	as a TDLS peer sta.
+ * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown
+ *	procedures should be performed by sending TDLS packets via
+ *	%NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
+ *	used for asking the driver to perform a TDLS operation.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1298,6 +1318,12 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_PMKSA_CANDIDATE,
 
+	NL80211_ATTR_TDLS_ACTION,
+	NL80211_ATTR_TDLS_DIALOG_TOKEN,
+	NL80211_ATTR_TDLS_OPERATION,
+	NL80211_ATTR_TDLS_SUPPORT,
+	NL80211_ATTR_TDLS_EXTERNAL_SETUP,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -1395,6 +1421,7 @@ enum nl80211_iftype {
  * @NL80211_STA_FLAG_WME: station is WME/QoS capable
  * @NL80211_STA_FLAG_MFP: station uses management frame protection
  * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
+ * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer
  * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
  * @__NL80211_STA_FLAG_AFTER_LAST: internal use
  */
@@ -1405,6 +1432,7 @@ enum nl80211_sta_flags {
 	NL80211_STA_FLAG_WME,
 	NL80211_STA_FLAG_MFP,
 	NL80211_STA_FLAG_AUTHENTICATED,
+	NL80211_STA_FLAG_TDLS_PEER,
 
 	/* keep last */
 	__NL80211_STA_FLAG_AFTER_LAST,
@@ -2591,4 +2619,24 @@ enum nl80211_pmksa_candidate_attr {
 	MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1
 };
 
+/**
+ * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION
+ * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request
+ * @NL80211_TDLS_SETUP: Setup TDLS link
+ * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established
+ * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link
+ * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link
+ * @NL80211_TDLS_ENABLE: (Re-)Enable TDLS operation
+ * @NL80211_TDLS_DISABLE: Disable TDLS operation
+ */
+enum nl80211_tdls_operation {
+	NL80211_TDLS_DISCOVERY_REQ,
+	NL80211_TDLS_SETUP,
+	NL80211_TDLS_TEARDOWN,
+	NL80211_TDLS_ENABLE_LINK,
+	NL80211_TDLS_DISABLE_LINK,
+	NL80211_TDLS_ENABLE,
+	NL80211_TDLS_DISABLE
+};
+
 #endif /* __LINUX_NL80211_H */
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:24 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:24 +0300
Subject: [PATCH 03/14] nl80211: implement TDLS callback functions and
	propagate capabilities
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-4-git-send-email-arik@wizery.com>

Allow passing high-level TDLS commands and TDLS frames to kernel
via new nl80211 commands.

Propagate TDLS related nl80211 capability flags from kernel and add them
as driver capability flags.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver.h         |    4 ++
 src/drivers/driver_nl80211.c |  118 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 08623e7..5d76ae8 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -689,6 +689,10 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS		0x00010000
 /* Driver indicates TX status events for Deauth/Disassoc frames */
 #define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS		0x00020000
+/* Driver supports operating as a TDLS peer */
+#define WPA_DRIVER_FLAGS_TDLS_SUPPORT			0x00040000
+/* Driver requires external TDLS setup/teardown/discovery */
+#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP		0x00080000
 	unsigned int flags;
 
 	int max_scan_ssids;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index eaafae7..9c8c0e2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1688,6 +1688,8 @@ struct wiphy_info_data {
 	int connect_supported;
 	int offchan_tx_supported;
 	int max_remain_on_chan;
+	int tdls_supported;
+	int tdls_external_setup;
 };
 
 
@@ -1815,6 +1817,13 @@ broken_combination:
 		info->max_remain_on_chan =
 			nla_get_u32(tb[NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION]);
 
+	if (tb[NL80211_ATTR_TDLS_SUPPORT]) {
+		info->tdls_supported = 1;
+
+		if (tb[NL80211_ATTR_TDLS_EXTERNAL_SETUP])
+			info->tdls_external_setup = 1;
+	}
+
 	return NL_SKIP;
 }
 
@@ -1884,6 +1893,16 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_OFFCHANNEL_TX;
 	}
 
+	if (info.tdls_supported) {
+		wpa_printf(MSG_DEBUG, "nl80211: TDLS supported");
+		drv->capa.flags |= WPA_DRIVER_FLAGS_TDLS_SUPPORT;
+
+		if (info.tdls_external_setup) {
+			wpa_printf(MSG_DEBUG, "nl80211: TDLS external setup");
+			drv->capa.flags |= WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP;
+		}
+	}
+
 	drv->capa.flags |= WPA_DRIVER_FLAGS_SANE_ERROR_CODES;
 	drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
 	if (info.p2p_supported)
@@ -7144,6 +7163,101 @@ static void nl80211_set_rekey_info(void *priv, const u8 *kek, const u8 *kck,
 }
 
 
+#ifdef CONFIG_TDLS
+static enum nl80211_tdls_operation nl80211_tdls_get_oper(enum tdls_oper oper)
+{
+	switch (oper) {
+	case TDLS_DISCOVERY_REQ:
+		return NL80211_TDLS_DISCOVERY_REQ;
+	case TDLS_SETUP:
+		return NL80211_TDLS_SETUP;
+	case TDLS_TEARDOWN:
+		return NL80211_TDLS_TEARDOWN;
+	case TDLS_ENABLE_LINK:
+		return NL80211_TDLS_ENABLE_LINK;
+	case TDLS_DISABLE_LINK:
+		return NL80211_TDLS_DISABLE_LINK;
+	case TDLS_ENABLE:
+		return NL80211_TDLS_ENABLE;
+	case TDLS_DISABLE:
+		return NL80211_TDLS_DISABLE;
+	}
+
+	return -1;
+}
+
+
+static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
+				  u8 dialog_token, u16 status_code,
+				  const u8 *buf, size_t len)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+
+	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
+		return -ENOTSUP;
+
+	if (!dst)
+		return -EINVAL;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_TDLS_MGMT, 0);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_ACTION, action_code);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_DIALOG_TOKEN, dialog_token);
+	NLA_PUT_U16(msg, NL80211_ATTR_STATUS_CODE, status_code);
+	NLA_PUT(msg, NL80211_ATTR_IE, len, buf);
+
+	return send_and_recv_msgs(drv, msg, NULL, NULL);
+
+ nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+
+
+static int nl80211_tdls_oper(void *priv, enum tdls_oper oper, const u8 *peer)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+	enum nl80211_tdls_operation nl80211_oper;
+
+	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
+		return -ENOTSUP;
+
+	nl80211_oper = nl80211_tdls_get_oper(oper);
+	if (nl80211_oper == -1) {
+		wpa_printf(MSG_DEBUG, "nl80211: Invalid TDLS oper: %d",
+			   oper);
+		return -EINVAL;
+	}
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_TDLS_OPER, 0);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_OPERATION, nl80211_oper);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer);
+
+	return send_and_recv_msgs(drv, msg, NULL, NULL);
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+#endif /* CONFIG TDLS */
+
+
 const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.name = "nl80211",
 	.desc = "Linux nl80211/cfg80211",
@@ -7217,4 +7331,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.remove_pmkid = nl80211_remove_pmkid,
 	.flush_pmkid = nl80211_flush_pmkid,
 	.set_rekey_info = nl80211_set_rekey_info,
+#ifdef CONFIG_TDLS
+	.send_tdls_mgmt = nl80211_send_tdls_mgmt,
+	.tdls_oper = nl80211_tdls_oper,
+#endif /* CONFIG_TDLS */
 };
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:25 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:25 +0300
Subject: [PATCH 04/14] TDLS: get TDLS related capabilities from driver
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-5-git-send-email-arik@wizery.com>

Put glue code in place to propagate TDLS related driver capabilities to
the TDLS state machine.

If the driver doesn't support capabilities, assume TDLS is supported
internally.

When TDLS is explicitly not supported, disable all user facing TDLS
operations.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c        |   26 +++++++++++++++++++++-----
 src/rsn_supp/wpa.h         |    2 ++
 src/rsn_supp/wpa_i.h       |   19 +++++++++++++++++++
 wpa_supplicant/wpas_glue.c |   22 ++++++++++++++++++++++
 4 files changed, 64 insertions(+), 5 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index e751867..d005c8e 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -625,7 +625,7 @@ int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
 	u8 *rbuf, *pos;
 	int ielen;
 
-	if (sm->tdls_disabled)
+	if (sm->tdls_disabled || !sm->tdls_supported)
 		return -1;
 
 	/* Find the node and free from the list */
@@ -1823,7 +1823,7 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
 	struct wpa_tdls_peer *peer;
 	int tdls_prohibited = sm->tdls_prohibited;
 
-	if (sm->tdls_disabled)
+	if (sm->tdls_disabled || !sm->tdls_supported)
 		return -1;
 
 #ifdef CONFIG_TDLS_TESTING
@@ -1870,7 +1870,7 @@ int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr)
 {
 	struct wpa_tdls_peer *peer;
 
-	if (sm->tdls_disabled)
+	if (sm->tdls_disabled || !sm->tdls_supported)
 		return -1;
 
 	for (peer = sm->tdls; peer; peer = peer->next) {
@@ -1899,8 +1899,9 @@ static void wpa_supplicant_rx_tdls(void *ctx, const u8 *src_addr,
 	wpa_hexdump(MSG_DEBUG, "TDLS: Received Data frame encapsulation",
 		    buf, len);
 
-	if (sm->tdls_disabled) {
-		wpa_printf(MSG_DEBUG, "TDLS: Discard message - TDLS disabled");
+	if (sm->tdls_disabled || !sm->tdls_supported) {
+		wpa_printf(MSG_DEBUG, "TDLS: Discard message - TDLS disabled "
+			   "or unsupported by driver");
 		return;
 	}
 
@@ -1969,6 +1970,21 @@ int wpa_tdls_init(struct wpa_sm *sm)
 		return -1;
 	}
 
+	/*
+	 * Drivers that support TDLS but don't implement the get_capa callback
+	 * are assumed to perform everything internally
+	 */
+	if (wpa_sm_tdls_get_capa(sm, &sm->tdls_supported,
+				 &sm->tdls_external_setup) < 0) {
+		sm->tdls_supported = 1;
+		sm->tdls_external_setup = 0;
+	}
+
+	wpa_printf(MSG_DEBUG, "TDLS: TDLS operaton%s supported by "
+		   "driver", sm->tdls_supported ? "" : " not");
+	wpa_printf(MSG_DEBUG, "TDLS: Driver uses %s link setup",
+		   sm->tdls_external_setup ? "external" : "internal");
+
 	return 0;
 }
 
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index a01baf9..297f216 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -56,6 +56,8 @@ struct wpa_sm_ctx {
 			      const u8 *ies, size_t ies_len);
 	int (*mark_authenticated)(void *ctx, const u8 *target_ap);
 #ifdef CONFIG_TDLS
+	int (*tdls_get_capa)(void *ctx, int *tdls_supported,
+			     int *tdls_ext_setup);
 	int (*send_tdls_mgmt)(void *ctx, const u8 *dst,
 			      u8 action_code, u8 dialog_token,
 			      u16 status_code, const u8 *buf, size_t len);
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index ebe73ca..67c3390 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -98,6 +98,15 @@ struct wpa_sm {
 	struct wpa_tdls_peer *tdls;
 	int tdls_prohibited;
 	int tdls_disabled;
+
+	/* The driver supports TDLS */
+	int tdls_supported;
+
+	/*
+	 * The driver requires explicit discovery/setup/teardown frames sent
+	 * to it via tdls_mgmt.
+	 */
+	int tdls_external_setup;
 #endif /* CONFIG_TDLS */
 
 #ifdef CONFIG_IEEE80211R
@@ -253,6 +262,16 @@ static inline void wpa_sm_set_rekey_offload(struct wpa_sm *sm)
 }
 
 #ifdef CONFIG_TDLS
+static inline int wpa_sm_tdls_get_capa(struct wpa_sm *sm,
+				       int *tdls_supported,
+				       int *tdls_ext_setup)
+{
+	if (sm->ctx->tdls_get_capa)
+		return sm->ctx->tdls_get_capa(sm->ctx->ctx, tdls_supported,
+					      tdls_ext_setup);
+	return -1;
+}
+
 static inline int wpa_sm_send_tdls_mgmt(struct wpa_sm *sm, const u8 *dst,
 					u8 action_code, u8 dialog_token,
 					u16 status_code, const u8 *buf,
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 0547c16..7feeaeb 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -538,6 +538,27 @@ static int wpa_supplicant_mark_authenticated(void *ctx, const u8 *target_ap)
 
 #ifdef CONFIG_TDLS
 
+static int wpa_supplicant_tdls_get_capa(void *ctx, int *tdls_supported,
+					int *tdls_ext_setup)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	struct wpa_driver_capa capa;
+
+	*tdls_supported = 0;
+	*tdls_ext_setup = 0;
+
+	if (wpa_drv_get_capa(wpa_s, &capa) < 0)
+		return -1;
+
+	if (capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)
+		*tdls_supported = 1;
+
+	if (capa.flags & WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP)
+		*tdls_ext_setup = 1;
+
+	return 0;
+}
+
 static int wpa_supplicant_send_tdls_mgmt(void *ctx, const u8 *dst,
 					 u8 action_code, u8 dialog_token,
 					 u16 status_code, const u8 *buf,
@@ -713,6 +734,7 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s)
 	ctx->mark_authenticated = wpa_supplicant_mark_authenticated;
 #endif /* CONFIG_IEEE80211R */
 #ifdef CONFIG_TDLS
+	ctx->tdls_get_capa = wpa_supplicant_tdls_get_capa;
 	ctx->send_tdls_mgmt = wpa_supplicant_send_tdls_mgmt;
 	ctx->tdls_oper = wpa_supplicant_tdls_oper;
 #endif /* CONFIG_TDLS */
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:26 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:26 +0300
Subject: [PATCH 05/14] TDLS: process discovery requests and send discovery
	responses
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-6-git-send-email-arik@wizery.com>

When a discovery request is received, add the peer to the TDLS peer
cache and send a response containing minimal data. Mandatory IEs in
the discovery response frame will be filled out by the driver.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/common/ieee802_11_defs.h |    1 +
 src/rsn_supp/tdls.c          |   89 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 89 insertions(+), 1 deletions(-)

diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 113eea2..67f1016 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -249,6 +249,7 @@
 #define WLAN_PA_GAS_INITIAL_RESP 11
 #define WLAN_PA_GAS_COMEBACK_REQ 12
 #define WLAN_PA_GAS_COMEBACK_RESP 13
+#define WLAN_TDLS_DISCOVERY_RESPONSE 14
 
 /* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
 #define WLAN_SA_QUERY_REQUEST 0
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index d005c8e..6867326 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -214,7 +214,9 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 	}
 
 	if (action_code == WLAN_TDLS_SETUP_CONFIRM ||
-	    action_code == WLAN_TDLS_TEARDOWN)
+	    action_code == WLAN_TDLS_TEARDOWN ||
+	    action_code == WLAN_TDLS_DISCOVERY_REQUEST ||
+	    action_code == WLAN_TDLS_DISCOVERY_RESPONSE)
 		return 0; /* No retries */
 
 	for (peer = sm->tdls; peer; peer = peer->next) {
@@ -802,6 +804,27 @@ static int wpa_tdls_send_error(struct wpa_sm *sm, const u8 *dst,
 }
 
 
+static struct wpa_tdls_peer *
+wpa_tdls_add_peer(struct wpa_sm *sm, const u8* addr)
+{
+	struct wpa_tdls_peer *peer;
+
+	wpa_printf(MSG_INFO, "TDLS: creating peer entry for " MACSTR,
+		   MAC2STR(addr));
+
+	peer = os_malloc(sizeof(*peer));
+	if (peer == NULL)
+		return NULL;
+
+	os_memset(peer, 0, sizeof(*peer));
+	os_memcpy(peer->addr, addr, ETH_ALEN);
+	peer->next = sm->tdls;
+	sm->tdls = peer;
+
+	return peer;
+}
+
+
 static int wpa_tdls_send_tpk_m1(struct wpa_sm *sm,
 				struct wpa_tdls_peer *peer)
 {
@@ -1143,6 +1166,67 @@ skip_ies:
 	return 0;
 }
 
+static int wpa_tdls_send_discovery_response(
+	struct wpa_sm *sm, struct wpa_tdls_peer *peer, u8 dialog_token)
+{
+	wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Discovery Response "
+			"(peer " MACSTR ")",  MAC2STR(peer->addr));
+
+	return wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_DISCOVERY_RESPONSE,
+				 dialog_token, 0, NULL, 0);
+}
+
+
+static int
+wpa_tdls_process_discovery_request(struct wpa_sm *sm, const u8 *addr,
+				   const u8 *buf, size_t len)
+{
+	struct wpa_eapol_ie_parse kde;
+	struct wpa_tdls_lnkid *lnkid;
+	struct wpa_tdls_peer *peer;
+	size_t min_req_len = sizeof(struct wpa_tdls_frame) +
+			     1 + /* dialog token */
+			     sizeof(struct wpa_tdls_lnkid);
+	u8 dialog_token;
+
+	wpa_printf(MSG_DEBUG, "TDLS discovery req from " MACSTR,
+		   MAC2STR(addr));
+
+	if (len < min_req_len) {
+		wpa_printf(MSG_DEBUG, "TDLS Discovery req is too short: %d",
+			   len);
+		return -1;
+	}
+
+	dialog_token = buf[sizeof(struct wpa_tdls_frame)];
+
+	if (wpa_supplicant_parse_ies(buf + sizeof(struct wpa_tdls_frame) + 1,
+				     len - (sizeof(struct wpa_tdls_frame) + 1),
+				     &kde) < 0)
+		return -1;
+
+	if (!kde.lnkid) {
+		wpa_printf(MSG_DEBUG, "TDLS: link ID not found in discovery "
+			   "request");
+		return -1;
+	}
+
+	lnkid = (void *)kde.lnkid;
+
+	if (os_memcmp(sm->bssid, lnkid->bssid, ETH_ALEN) != 0) {
+		wpa_printf(MSG_DEBUG, "TDLS: Discovery request from different "
+			   " BSS " MACSTR, MAC2STR(lnkid->bssid));
+		return -1;
+	}
+
+	peer = wpa_tdls_add_peer(sm, addr);
+	if (peer == NULL)
+		return -1;
+
+	return wpa_tdls_send_discovery_response(sm, peer, dialog_token);
+}
+
+
 
 static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 				   const u8 *buf, size_t len)
@@ -1938,6 +2022,9 @@ static void wpa_supplicant_rx_tdls(void *ctx, const u8 *src_addr,
 	case WLAN_TDLS_TEARDOWN:
 		wpa_tdls_recv_teardown(sm, src_addr, buf, len);
 		break;
+	case WLAN_TDLS_DISCOVERY_REQUEST:
+		wpa_tdls_process_discovery_request(sm, src_addr, buf, len);
+		break;
 	default:
 		/* Kernel code will process remaining frames */
 		wpa_printf(MSG_DEBUG, "TDLS: Ignore TDLS frame action code %u",
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:27 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:27 +0300
Subject: [PATCH 06/14] TDLS/nl80211: support receiving TDLS discovery response
	frames
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-7-git-send-email-arik@wizery.com>

Register for the TDLS discovery response public action frame in nl80211.
Print out a debug message when a discovery-resp frame is received and
validated.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver_nl80211.c |   10 ++++++++++
 wpa_supplicant/events.c      |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 9c8c0e2..cc10331 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2283,6 +2283,16 @@ static int nl80211_register_action_frames(struct wpa_driver_nl80211_data *drv)
 	if (nl80211_register_action_frame(drv, (u8 *) "\x08\x01", 2) < 0)
 		return -1;
 #endif /* CONFIG_IEEE80211W */
+#ifdef CONFIG_TDLS
+	if ((drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT)) {
+		int ret;
+
+		/* TDLS Discovery Response */
+		ret = nl80211_register_action_frame(drv, (u8 *) "\x04\x0e", 2);
+		if (ret < 0)
+			return -1;
+	}
+#endif
 
 	/* FT Action frames */
 	if (nl80211_register_action_frame(drv, (u8 *) "\x06", 1) < 0)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a307eda..1856a63 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2030,6 +2030,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 				   data->rx_action.data,
 				   data->rx_action.len, data->rx_action.freq);
 #endif /* CONFIG_P2P */
+#ifdef CONFIG_TDLS
+		if (data->rx_action.category == WLAN_ACTION_PUBLIC &&
+		    data->rx_action.len >= 4 &&
+		    data->rx_action.data[0] == WLAN_TDLS_DISCOVERY_RESPONSE) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "Received TDLS discovery "
+				"response from " MACSTR,
+				MAC2STR(data->rx_action.sa));
+		}
+#endif /* CONFIG_TDLS */
 		break;
 	case EVENT_RX_PROBE_REQ:
 		if (data->rx_probe_req.sa == NULL ||
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:28 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:28 +0300
Subject: [PATCH 07/14] TDLS: support sending a teardown frame from usermode
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-8-git-send-email-arik@wizery.com>

When a driver does not implement the TDLS_TEARDOWN operation internally,
send an explicit TDLS link teardown frame to the driver.

Change all teardown calls to use these calling semantics.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c     |   65 +++++++++++++++++++++++++++++++++++++++-------
 src/rsn_supp/wpa.h      |    4 +-
 wpa_supplicant/events.c |    5 +--
 3 files changed, 59 insertions(+), 15 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 6867326..77d94d0 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -255,6 +255,27 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 }
 
 
+static int wpa_tdls_do_teardown(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
+				u16 reason_code)
+{
+	int ret;
+
+	if (sm->tdls_external_setup) {
+		ret = wpa_tdls_send_teardown(sm, peer->addr, reason_code);
+
+		/* disable the link after teardown was sent */
+		wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, peer->addr);
+	} else {
+		ret = wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
+	}
+
+	/* clear the Peerkey statemachine */
+	wpa_tdls_peer_free(sm, peer);
+
+	return ret;
+}
+
+
 static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 {
 
@@ -293,15 +314,11 @@ static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
 		eloop_register_timeout(peer->sm_tmr.timer / 1000, 0,
 				       wpa_tdls_tpk_retry_timeout, sm, peer);
 	} else {
-		wpa_printf(MSG_INFO, "Sending Tear_Down Request");
-		wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
-
-		wpa_printf(MSG_INFO, "Clearing SM: Peerkey(" MACSTR ")",
-			   MAC2STR(peer->addr));
 		eloop_cancel_timeout(wpa_tdls_tpk_retry_timeout, sm, peer);
 
-		/* clear the Peerkey statemachine */
-		wpa_tdls_peer_free(sm, peer);
+		wpa_printf(MSG_INFO, "Sending Tear_Down Request");
+		wpa_tdls_do_teardown(sm, peer,
+				     WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 	}
 }
 
@@ -578,7 +595,8 @@ static void wpa_tdls_tpk_timeout(void *eloop_ctx, void *timeout_ctx)
 	} else {
 		wpa_printf(MSG_DEBUG, "TDLS: TPK lifetime expired for " MACSTR
 			   " - tear down", MAC2STR(peer->addr));
-		wpa_sm_tdls_oper(sm, TDLS_TEARDOWN, peer->addr);
+		wpa_tdls_do_teardown(sm, peer,
+				     WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 	}
 }
 
@@ -617,8 +635,7 @@ static void wpa_tdls_linkid(struct wpa_sm *sm, struct wpa_tdls_peer *peer,
 }
 
 
-int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
-				  u16 reason_code)
+int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
 {
 	struct wpa_tdls_peer *peer;
 	struct wpa_tdls_ftie *ftie;
@@ -707,6 +724,34 @@ skip_ies:
 }
 
 
+int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
+{
+	struct wpa_tdls_peer *peer;
+
+	if (sm->tdls_disabled || !sm->tdls_supported)
+		return -1;
+
+	for (peer = sm->tdls; peer; peer = peer->next) {
+		if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
+			break;
+	}
+
+	if (peer == NULL) {
+		wpa_printf(MSG_DEBUG, "TDLS: Could not find peer " MACSTR
+		   " for link Teardown", MAC2STR(addr));
+		return -1;
+	}
+
+	if (!peer->tpk_success) {
+		wpa_printf(MSG_DEBUG, "TDLS: Peer " MACSTR
+		   " not connected - cannot Teardown link", MAC2STR(addr));
+		return -1;
+	}
+
+	return wpa_tdls_do_teardown(sm, peer, reason_code);
+}
+
+
 static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
 				  const u8 *buf, size_t len)
 {
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 297f216..eb08994 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -360,8 +360,8 @@ void wpa_tdls_ap_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
 void wpa_tdls_assoc_resp_ies(struct wpa_sm *sm, const u8 *ies, size_t len);
 int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr);
-int wpa_tdls_recv_teardown_notify(struct wpa_sm *sm, const u8 *addr,
-				  u16 reason_code);
+int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
+int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
 int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 1856a63..d552484 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1631,9 +1631,8 @@ static void wpa_supplicant_event_tdls(struct wpa_supplicant *wpa_s,
 		wpa_tdls_start(wpa_s->wpa, data->tdls.peer);
 		break;
 	case TDLS_REQUEST_TEARDOWN:
-		/* request from driver to add FTIE */
-		wpa_tdls_recv_teardown_notify(wpa_s->wpa, data->tdls.peer,
-					      data->tdls.reason_code);
+		wpa_tdls_send_teardown(wpa_s->wpa, data->tdls.peer,
+				       data->tdls.reason_code);
 		break;
 	}
 }
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:29 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:29 +0300
Subject: [PATCH 08/14] TDLS: support sending TDLS discovery requests
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-9-git-send-email-arik@wizery.com>

Allow sending a TDLS discovery request as a frame through the driver.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c |   11 +++++++++++
 src/rsn_supp/wpa.h  |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 77d94d0..0354731 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1272,6 +1272,17 @@ wpa_tdls_process_discovery_request(struct wpa_sm *sm, const u8 *addr,
 }
 
 
+int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr)
+{
+	if (sm->tdls_disabled || !sm->tdls_supported)
+		return -1;
+
+	wpa_printf(MSG_DEBUG, "TDLS Discovery Req: Peer:" MACSTR,
+		   MAC2STR(addr));
+	return wpa_tdls_tpk_send(sm, addr, WLAN_TDLS_DISCOVERY_REQUEST,
+				 1, 0, NULL, 0);
+}
+
 
 static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 				   const u8 *buf, size_t len)
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index eb08994..20a3e4f 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -362,6 +362,7 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_reneg(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_send_teardown(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
 int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code);
+int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:30 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:30 +0300
Subject: [PATCH 09/14] TDLS: implement low-ack event for lost TDLS peers
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-10-git-send-email-arik@wizery.com>

Disable the direct connection when a TDLS peer stops responding
to packets, as indicated by the "LOW ACK" event coming from a driver.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c     |   18 ++++++++++++++++++
 src/rsn_supp/wpa.h      |    1 +
 wpa_supplicant/events.c |    4 ++++
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 0354731..8b3acf9 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -752,6 +752,24 @@ int wpa_tdls_teardown_link(struct wpa_sm *sm, const u8 *addr, u16 reason_code)
 }
 
 
+void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr)
+{
+	struct wpa_tdls_peer *peer;
+
+	for (peer = sm->tdls; peer; peer = peer->next) {
+		if (os_memcmp(peer->addr, addr, ETH_ALEN) == 0)
+			break;
+	}
+
+	if (peer) {
+		wpa_sm_tdls_oper(sm, TDLS_DISABLE_LINK, addr);
+
+		/* clear the Peerkey statemachine */
+		wpa_tdls_peer_free(sm, peer);
+	}
+}
+
+
 static int wpa_tdls_recv_teardown(struct wpa_sm *sm, const u8 *src_addr,
 				  const u8 *buf, size_t len)
 {
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 20a3e4f..492fd34 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -366,5 +366,6 @@ int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr);
 int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
+void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr);
 
 #endif /* WPA_H */
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index d552484..9054c18 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2221,6 +2221,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 			hostapd_event_sta_low_ack(wpa_s->ap_iface->bss[0],
 						  data->low_ack.addr);
 #endif /* CONFIG_AP */
+#ifdef CONFIG_TDLS
+		if (data)
+			wpa_tdls_disable_link(wpa_s->wpa, data->low_ack.addr);
+#endif /* CONFIG_TDLS */
 		break;
 	case EVENT_IBSS_PEER_LOST:
 #ifdef CONFIG_IBSS_RSN
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:31 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:31 +0300
Subject: [PATCH 10/14] TDLS: collect peer capabilities and supp-rates during
	link setup
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-11-git-send-email-arik@wizery.com>

Record the capabilities and supported rates of the TDLS peer during
link setup. These are given in the IEs passed in SETUP_REQUEST and
SETUP_RESPONSE frames.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c   |   97 ++++++++++++++++++++++++++++++++++++++-----------
 src/rsn_supp/wpa_ie.c |   11 ++++++
 src/rsn_supp/wpa_ie.h |    4 ++
 3 files changed, 91 insertions(+), 21 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 8b3acf9..1b80ac5 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -119,6 +119,12 @@ struct wpa_tdls_peer {
 		int buf_len;    /* length of TPK message for retransmission */
 		u8 *buf;        /* buffer for TPK message */
 	} sm_tmr;
+
+	u16 capability;
+
+#define IEEE80211_MAX_SUPP_RATES 32
+	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
+	size_t supp_rates_len;
 };
 
 
@@ -1324,6 +1330,7 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 	u16 ielen;
 	u16 status = WLAN_STATUS_UNSPECIFIED_FAILURE;
 	int tdls_prohibited = sm->tdls_prohibited;
+	int existing_peer = 0;
 
 	if (len < 3 + 3)
 		return -1;
@@ -1336,7 +1343,22 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 
 	wpa_printf(MSG_INFO, "TDLS: Dialog Token in TPK M1 %d", dtoken);
 
-	cpos += 2; /* capability information */
+	for (peer = sm->tdls; peer; peer = peer->next) {
+		if (os_memcmp(peer->addr, src_addr, ETH_ALEN) == 0) {
+			existing_peer = 1;
+			break;
+		}
+	}
+
+	if (peer == NULL) {
+		peer = wpa_tdls_add_peer(sm, src_addr);
+		if (peer == NULL)
+			goto error;
+	}
+
+	/* capability information */
+	peer->capability = WPA_GET_LE16(cpos);
+	cpos += 2;
 
 	ielen = len - (cpos - buf); /* start of IE in buf */
 	if (wpa_supplicant_parse_ies(cpos, ielen, &kde) < 0) {
@@ -1361,6 +1383,29 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 	wpa_printf(MSG_DEBUG, "TDLS: TPK M1 - TPK initiator " MACSTR,
 		   MAC2STR(src_addr));
 
+	if (!kde.supp_rates) {
+		wpa_printf(MSG_DEBUG, "TDLS: No supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	if (kde.supp_rates_len - 2 + kde.ext_supp_rates_len - 2 >
+	    IEEE80211_MAX_SUPP_RATES) {
+		wpa_printf(MSG_DEBUG, "TDLS: Too much supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	peer->supp_rates_len = kde.supp_rates_len - 2;
+	os_memcpy(peer->supp_rates, kde.supp_rates + 2,
+		  kde.supp_rates_len - 2);
+
+	if (kde.ext_supp_rates) {
+		os_memcpy(peer->supp_rates + peer->supp_rates_len,
+			  kde.ext_supp_rates + 2, kde.ext_supp_rates_len - 2);
+		peer->supp_rates_len += kde.ext_supp_rates_len - 2;
+	}
+
 #ifdef CONFIG_TDLS_TESTING
 	if (tdls_testing & TDLS_TESTING_CONCURRENT_INIT) {
 		for (peer = sm->tdls; peer; peer = peer->next) {
@@ -1460,26 +1505,10 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 	}
 
 skip_rsn:
-	/* Find existing entry and if found, use that instead of adding
-	 * a new one; how to handle the case where both ends initiate at the
+	/* If found, use existing entry instead of adding a new one;
+	 * how to handle the case where both ends initiate at the
 	 * same time? */
-	for (peer = sm->tdls; peer; peer = peer->next) {
-		if (os_memcmp(peer->addr, src_addr, ETH_ALEN) == 0)
-			break;
-	}
-
-	if (peer == NULL) {
-		wpa_printf(MSG_INFO, "TDLS: No matching entry found for "
-			   "peer, creating one for " MACSTR,
-			   MAC2STR(src_addr));
-		peer = os_malloc(sizeof(*peer));
-		if (peer == NULL)
-			goto error;
-		os_memset(peer, 0, sizeof(*peer));
-		os_memcpy(peer->addr, src_addr, ETH_ALEN);
-		peer->next = sm->tdls;
-		sm->tdls = peer;
-	} else {
+	if (existing_peer) {
 		if (peer->tpk_success) {
 			wpa_printf(MSG_DEBUG, "TDLS: TDLS Setup Request while "
 				   "direct link is enabled - tear down the "
@@ -1680,7 +1709,10 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
 
 	if (len < 3 + 2 + 1 + 2)
 		return -1;
-	pos += 2; /* capability information */
+
+	/* capability information */
+	peer->capability = WPA_GET_LE16(pos);
+	pos += 2;
 
 	ielen = len - (pos - buf); /* start of IE in buf */
 	if (wpa_supplicant_parse_ies(pos, ielen, &kde) < 0) {
@@ -1711,6 +1743,29 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
 		goto error;
 	}
 
+	if (!kde.supp_rates) {
+		wpa_printf(MSG_DEBUG, "TDLS: No supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	if (kde.supp_rates_len - 2 + kde.ext_supp_rates_len - 2 >
+	    IEEE80211_MAX_SUPP_RATES) {
+		wpa_printf(MSG_DEBUG, "TDLS: Too much supported rates in "
+			   "Setup Req");
+		goto error;
+	}
+
+	peer->supp_rates_len = kde.supp_rates_len - 2;
+	os_memcpy(peer->supp_rates, kde.supp_rates + 2,
+		  kde.supp_rates_len - 2);
+
+	if (kde.ext_supp_rates) {
+		os_memcpy(peer->supp_rates + peer->supp_rates_len,
+			  kde.ext_supp_rates + 2, kde.ext_supp_rates_len - 2);
+		peer->supp_rates_len += kde.ext_supp_rates_len - 2;
+	}
+
 	if (!wpa_tdls_get_privacy(sm)) {
 		peer->rsnie_p_len = 0;
 		peer->cipher = WPA_CIPHER_NONE;
diff --git a/src/rsn_supp/wpa_ie.c b/src/rsn_supp/wpa_ie.c
index 654cc1f..0f89623 100644
--- a/src/rsn_supp/wpa_ie.c
+++ b/src/rsn_supp/wpa_ie.c
@@ -426,9 +426,20 @@ int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
 		} else if (*pos == WLAN_EID_LINK_ID) {
 			ie->lnkid = pos;
 			ie->lnkid_len = pos[1] + 2;
+
+			if (ie->lnkid_len < 18 + 2) {
+				ie->lnkid = 0;
+				ie->lnkid_len = 0;
+			}
 		} else if (*pos == WLAN_EID_EXT_CAPAB) {
 			ie->ext_capab = pos;
 			ie->ext_capab_len = pos[1] + 2;
+		} else if (*pos == WLAN_EID_SUPP_RATES) {
+			ie->supp_rates = pos;
+			ie->supp_rates_len = pos[1] + 2;
+		} else if (*pos == WLAN_EID_EXT_SUPP_RATES) {
+			ie->ext_supp_rates = pos;
+			ie->ext_supp_rates_len = pos[1] + 2;
 		} else if (*pos == WLAN_EID_VENDOR_SPECIFIC) {
 			ret = wpa_parse_generic(pos, end, ie);
 			if (ret < 0)
diff --git a/src/rsn_supp/wpa_ie.h b/src/rsn_supp/wpa_ie.h
index f939b13..c13d94c 100644
--- a/src/rsn_supp/wpa_ie.h
+++ b/src/rsn_supp/wpa_ie.h
@@ -51,6 +51,10 @@ struct wpa_eapol_ie_parse {
 	size_t lnkid_len;
 	const u8 *ext_capab;
 	size_t ext_capab_len;
+	const u8 *supp_rates;
+	size_t supp_rates_len;
+	const u8 *ext_supp_rates;
+	size_t ext_supp_rates_len;
 };
 
 int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:32 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:32 +0300
Subject: [PATCH 11/14] TDLS: add peer as a STA during link setup
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-12-git-send-email-arik@wizery.com>

Before commencing setup, add a new STA entry to the driver representing
the peer. Later during setup, update the STA entry using information
received from the peer.

Define a new driver callback for adding/modifying a peer entry and
connect it to the TDLS state machine. Implement this callback for the
nl80211 driver and send peer information to kernel.

Mark TDLS peer entries with a new flag and translate it to a
corresponding nl80211 flag in the nl80211 driver.

In addition, correct TDLS related documentation in the wpa_driver_ops
structure.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/drivers/driver.h         |   26 +++++++++++++++++++-
 src/drivers/driver_nl80211.c |   53 ++++++++++++++++++++++++++++++++++-------
 src/rsn_supp/tdls.c          |   23 ++++++++++++++++-
 src/rsn_supp/wpa.h           |    3 ++
 src/rsn_supp/wpa_i.h         |   12 +++++++++
 wpa_supplicant/driver_i.h    |   11 ++++++++
 wpa_supplicant/wpas_glue.c   |   21 ++++++++++++++++
 7 files changed, 137 insertions(+), 12 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 5d76ae8..935fcb9 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -816,6 +816,7 @@ struct wpa_bss_params {
 #define WPA_STA_WMM BIT(1)
 #define WPA_STA_SHORT_PREAMBLE BIT(2)
 #define WPA_STA_MFP BIT(3)
+#define WPA_STA_TDLS_PEER BIT(4)
 
 /**
  * struct p2p_params - P2P parameters for driver-based P2P management
@@ -2348,6 +2349,19 @@ struct wpa_driver_ops {
 			  const u8 *go_dev_addr, int persistent_group);
 
 	/**
+	 * tdls_peer_addset - for adding/modifying TDLS peer stations
+	 * @priv: private driver interface data
+	 * @add: non-zero when adding a new TDLS peer
+	 * @params: station parameters
+	 * Returns: 0 on success, negative (<0) on failure
+	 *
+	 * This optional function can be used to to add TDLS peer
+	 * entries to the driver, or modify their parameters.
+	 */
+	int (*tdls_peer_addset)(void *priv, int add,
+				struct hostapd_sta_add_params *params);
+
+	/**
 	 * send_tdls_mgmt - for sending TDLS management packets
 	 * @priv: private driver interface data
 	 * @dst: Destination (peer) MAC address
@@ -2356,7 +2370,7 @@ struct wpa_driver_ops {
 	 * @status_code: Status Code or Reason Code to use (if needed)
 	 * @buf: TDLS IEs to add to the message
 	 * @len: Length of buf in octets
-	 * Returns: 0 on success, -1 on failure
+	 * Returns: 0 on success, negative (<0) on failure
 	 *
 	 * This optional function can be used to send packet to driver which is
 	 * responsible for receiving and sending all TDLS packets.
@@ -2365,6 +2379,16 @@ struct wpa_driver_ops {
 			      u8 dialog_token, u16 status_code,
 			      const u8 *buf, size_t len);
 
+	/**
+	 * tdls_oper - ask the driver to perform high-level TDLS operations
+	 * @priv: private driver interface data
+	 * @oper: TDLS high-level operation. See %enum tdls_oper
+	 * @peer: Destination (peer) MAC address
+	 * Returns: 0 on success, negative (<0) on failure
+	 *
+	 * This optional function can be used to send high-level TDLS commands
+	 * to the driver.
+	 */
 	int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
 
 	/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index cc10331..bbf5cde 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4191,34 +4191,43 @@ static u32 sta_flags_nl80211(int flags)
 		f |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE);
 	if (flags & WPA_STA_MFP)
 		f |= BIT(NL80211_STA_FLAG_MFP);
+	if (flags & WPA_STA_TDLS_PEER)
+		f |= BIT(NL80211_STA_FLAG_TDLS_PEER);
 
 	return f;
 }
 
 
-static int wpa_driver_nl80211_sta_add(void *priv,
-				      struct hostapd_sta_add_params *params)
+static int wpa_driver_nl80211_sta_addset(void *priv, int add,
+					 struct hostapd_sta_add_params *params)
 {
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	struct nl_msg *msg;
 	struct nl80211_sta_flag_update upd;
+	int cmd;
 	int ret = -ENOBUFS;
 
 	msg = nlmsg_alloc();
 	if (!msg)
 		return -ENOMEM;
 
-	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0,
-		    0, NL80211_CMD_NEW_STATION, 0);
+	if (add)
+		cmd = NL80211_CMD_NEW_STATION;
+	else
+		cmd = NL80211_CMD_SET_STATION;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0, cmd, 0);
 
 	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, if_nametoindex(bss->ifname));
 	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, params->addr);
-	NLA_PUT_U16(msg, NL80211_ATTR_STA_AID, params->aid);
 	NLA_PUT(msg, NL80211_ATTR_STA_SUPPORTED_RATES, params->supp_rates_len,
 		params->supp_rates);
-	NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL,
-		    params->listen_interval);
+	if (add) {
+		NLA_PUT_U16(msg, NL80211_ATTR_STA_AID, params->aid);
+		NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL,
+			    params->listen_interval);
+	}
 	if (params->ht_capabilities) {
 		NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY,
 			sizeof(*params->ht_capabilities),
@@ -4232,8 +4241,9 @@ static int wpa_driver_nl80211_sta_add(void *priv,
 
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	if (ret)
-		wpa_printf(MSG_DEBUG, "nl80211: NL80211_CMD_NEW_STATION "
-			   "result: %d (%s)", ret, strerror(-ret));
+		wpa_printf(MSG_DEBUG, "nl80211: NL80211_CMD_%s_STATION "
+			   "result: %d (%s)", add ? "NEW" : "SET", ret,
+			   strerror(-ret));
 	if (ret == -EEXIST)
 		ret = 0;
  nla_put_failure:
@@ -4241,6 +4251,13 @@ static int wpa_driver_nl80211_sta_add(void *priv,
 }
 
 
+static int wpa_driver_nl80211_sta_add(void *priv,
+				      struct hostapd_sta_add_params *params)
+{
+	return wpa_driver_nl80211_sta_addset(priv, 1, params);
+}
+
+
 static int wpa_driver_nl80211_sta_remove(void *priv, const u8 *addr)
 {
 	struct i802_bss *bss = priv;
@@ -4907,6 +4924,9 @@ static int wpa_driver_nl80211_sta_set_flags(void *priv, const u8 *addr,
 	if (total_flags & WPA_STA_MFP)
 		NLA_PUT_FLAG(flags, NL80211_STA_FLAG_MFP);
 
+	if (total_flags & WPA_STA_TDLS_PEER)
+		NLA_PUT_FLAG(flags, NL80211_STA_FLAG_TDLS_PEER);
+
 	if (nla_put_nested(msg, NL80211_ATTR_STA_FLAGS, flags))
 		goto nla_put_failure;
 
@@ -7174,6 +7194,20 @@ static void nl80211_set_rekey_info(void *priv, const u8 *kek, const u8 *kck,
 
 
 #ifdef CONFIG_TDLS
+
+static int nl80211_tdls_peer_addset(void *priv, int add,
+				    struct hostapd_sta_add_params *params)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+
+	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
+		return -ENOTSUP;
+
+	return wpa_driver_nl80211_sta_addset(priv, add, params);
+}
+
+
 static enum nl80211_tdls_operation nl80211_tdls_get_oper(enum tdls_oper oper)
 {
 	switch (oper) {
@@ -7342,6 +7376,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.flush_pmkid = nl80211_flush_pmkid,
 	.set_rekey_info = nl80211_set_rekey_info,
 #ifdef CONFIG_TDLS
+	.tdls_peer_addset = nl80211_tdls_peer_addset,
 	.send_tdls_mgmt = nl80211_send_tdls_mgmt,
 	.tdls_oper = nl80211_tdls_oper,
 #endif /* CONFIG_TDLS */
diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 1b80ac5..771f77c 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1620,8 +1620,14 @@ skip_rsn:
 	wpa_tdls_generate_tpk(peer, sm->own_addr, sm->bssid);
 
 skip_rsn_check:
+	/* add the peer to the driver as a "setup in progress" peer */
+	wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, NULL, 0);
+
 	wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Setup Response / TPK M2");
-	wpa_tdls_send_tpk_m2(sm, src_addr, dtoken, lnkid, peer);
+	if (wpa_tdls_send_tpk_m2(sm, src_addr, dtoken, lnkid, peer) < 0) {
+		wpa_tdls_disable_link(sm, peer->addr);
+		goto error;
+	}
 
 	return 0;
 
@@ -1654,6 +1660,11 @@ static void wpa_tdls_enable_link(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
 	}
 #endif /* CONFIG_TDLS_TESTING */
 	}
+
+	/* add supported rates and capabilities to the TDLS peer */
+	wpa_sm_tdls_peer_addset(sm, peer->addr, 0, peer->capability,
+				peer->supp_rates, peer->supp_rates_len);
+
 	wpa_sm_tdls_oper(sm, TDLS_ENABLE_LINK, peer->addr);
 }
 
@@ -2075,7 +2086,15 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
 
 	peer->initiator = 1;
 
-	return wpa_tdls_send_tpk_m1(sm, peer);
+	/* add the peer to the driver as a "setup in progress" peer */
+	wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, NULL, 0);
+
+	if (wpa_tdls_send_tpk_m1(sm, peer) < 0) {
+		wpa_tdls_disable_link(sm, peer->addr);
+		return -1;
+	}
+
+	return 0;
 }
 
 
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 492fd34..d4ae09c 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -62,6 +62,9 @@ struct wpa_sm_ctx {
 			      u8 action_code, u8 dialog_token,
 			      u16 status_code, const u8 *buf, size_t len);
 	int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
+	int (*tdls_peer_addset)(void *ctx, const u8 *addr, int add,
+				u16 capability, const u8 *supp_rates,
+				size_t supp_rates_len);
 #endif /* CONFIG_TDLS */
 	void (*set_rekey_offload)(void *ctx, const u8 *kek, const u8 *kck,
 				  const u8 *replay_ctr);
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index 67c3390..39124c4 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -291,6 +291,18 @@ static inline int wpa_sm_tdls_oper(struct wpa_sm *sm, int oper,
 		return sm->ctx->tdls_oper(sm->ctx->ctx, oper, peer);
 	return -1;
 }
+
+static inline int
+wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
+			u16 capability, const u8 *supp_rates,
+			size_t supp_rates_len)
+{
+	if (sm->ctx->tdls_peer_addset)
+		return sm->ctx->tdls_peer_addset(sm->ctx->ctx, addr, add,
+						 capability, supp_rates,
+						 supp_rates_len);
+	return -1;
+}
 #endif /* CONFIG_TDLS */
 
 void wpa_eapol_key_send(struct wpa_sm *sm, const u8 *kck,
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 79fdddd..9f1e7b0 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -700,6 +700,17 @@ static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
 	return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
 }
 
+static inline int
+wpa_drv_tdls_peer_addset(struct wpa_supplicant *wpa_s, int add,
+			 struct hostapd_sta_add_params *params)
+{
+	if (wpa_s->driver->tdls_peer_addset)
+		return wpa_s->driver->tdls_peer_addset(wpa_s->drv_priv, add,
+						       params);
+	return -1;
+}
+
+
 static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
 					  const u8 *kek, const u8 *kck,
 					  const u8 *replay_ctr)
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 7feeaeb..6a8d1f8 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -576,6 +576,26 @@ static int wpa_supplicant_tdls_oper(void *ctx, int oper, const u8 *peer)
 	return wpa_drv_tdls_oper(wpa_s, oper, peer);
 }
 
+
+static int wpa_supplicant_tdls_peer_addset(void *ctx, const u8 *peer, int add,
+				       u16 capability, const u8 *supp_rates,
+				       size_t supp_rates_len)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	struct hostapd_sta_add_params params;
+
+	params.addr = peer;
+	params.aid = 1;
+	params.capability = capability;
+	params.flags = WPA_STA_TDLS_PEER | WPA_STA_AUTHORIZED;
+	params.ht_capabilities = NULL;
+	params.listen_interval = 0;
+	params.supp_rates = supp_rates;
+	params.supp_rates_len = supp_rates_len;
+
+	return wpa_drv_tdls_peer_addset(wpa_s, add, &params);
+}
+
 #endif /* CONFIG_TDLS */
 
 
@@ -737,6 +757,7 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s)
 	ctx->tdls_get_capa = wpa_supplicant_tdls_get_capa;
 	ctx->send_tdls_mgmt = wpa_supplicant_send_tdls_mgmt;
 	ctx->tdls_oper = wpa_supplicant_tdls_oper;
+	ctx->tdls_peer_addset = wpa_supplicant_tdls_peer_addset;
 #endif /* CONFIG_TDLS */
 	ctx->set_rekey_offload = wpa_supplicant_set_rekey_offload;
 
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:33 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:33 +0300
Subject: [PATCH 12/14] TDLS: support mgmt-frame Tx for ctrl-iface operations
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-13-git-send-email-arik@wizery.com>

Use capability information to decide whether to perform a given TDLS
operation internally or through mgmt-frame Tx.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c         |    6 ++++++
 src/rsn_supp/wpa.h          |    2 +-
 wpa_supplicant/ctrl_iface.c |   20 ++++++++++++++++----
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 771f77c..5bbd2b0 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -2318,3 +2318,9 @@ void wpa_tdls_enable(struct wpa_sm *sm, int enabled)
 	wpa_printf(MSG_DEBUG, "TDLS: %s", enabled ? "enabled" : "disabled");
 	sm->tdls_disabled = !enabled;
 }
+
+
+int wpa_tdls_is_external_setup(struct wpa_sm *sm)
+{
+	return sm->tdls_external_setup;
+}
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index d4ae09c..6ab2a48 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -370,5 +370,5 @@ int wpa_tdls_init(struct wpa_sm *sm);
 void wpa_tdls_deinit(struct wpa_sm *sm);
 void wpa_tdls_enable(struct wpa_sm *sm, int enabled);
 void wpa_tdls_disable_link(struct wpa_sm *sm, const u8 *addr);
-
+int wpa_tdls_is_external_setup(struct wpa_sm *sm);
 #endif /* WPA_H */
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index a55a528..d991190 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -204,6 +204,7 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
 	struct wpa_supplicant *wpa_s, char *addr)
 {
 	u8 peer[ETH_ALEN];
+	int ret;
 
 	if (hwaddr_aton(addr, peer)) {
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER: invalid "
@@ -214,7 +215,12 @@ static int wpa_supplicant_ctrl_iface_tdls_discover(
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_DISCOVER " MACSTR,
 		   MAC2STR(peer));
 
-	return wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
+	if (wpa_tdls_is_external_setup(wpa_s->wpa))
+		ret = wpa_tdls_send_discovery_request(wpa_s->wpa, peer);
+	else
+		ret = wpa_drv_tdls_oper(wpa_s, TDLS_DISCOVERY_REQ, peer);
+
+	return ret;
 }
 
 
@@ -234,8 +240,13 @@ static int wpa_supplicant_ctrl_iface_tdls_setup(
 		   MAC2STR(peer));
 
 	ret = wpa_tdls_reneg(wpa_s->wpa, peer);
-	if (ret)
-		ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
+	if (ret) {
+		if (wpa_tdls_is_external_setup(wpa_s->wpa))
+			ret = wpa_tdls_start(wpa_s->wpa, peer);
+		else
+			ret = wpa_drv_tdls_oper(wpa_s, TDLS_SETUP, peer);
+	}
+
 	return ret;
 }
 
@@ -254,7 +265,8 @@ static int wpa_supplicant_ctrl_iface_tdls_teardown(
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE TDLS_TEARDOWN " MACSTR,
 		   MAC2STR(peer));
 
-	return wpa_drv_tdls_oper(wpa_s, TDLS_TEARDOWN, peer);
+	return wpa_tdls_teardown_link(wpa_s->wpa, peer,
+				      WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED);
 }
 
 #endif /* CONFIG_TDLS */
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:34 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:34 +0300
Subject: [PATCH 13/14] TDLS: make use of wpa_tdls_add_peer to avoid code
	duplication
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-14-git-send-email-arik@wizery.com>

Use the wpa_tdls_add_peer function to allocate TDLS peer structures.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 5bbd2b0..558a004 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1413,12 +1413,9 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 				break;
 		}
 		if (peer == NULL) {
-			peer = os_zalloc(sizeof(*peer));
+			peer = wpa_tdls_add_peer(sm, src_addr);
 			if (peer == NULL)
 				goto error;
-			os_memcpy(peer->addr, src_addr, ETH_ALEN);
-			peer->next = sm->tdls;
-			sm->tdls = peer;
 		}
 		wpa_printf(MSG_DEBUG, "TDLS: Testing concurrent initiation of "
 			   "TDLS setup - send own request");
@@ -2073,15 +2070,9 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
 	}
 
 	if (peer == NULL) {
-		wpa_printf(MSG_INFO, "TDLS: No matching entry found for "
-			   "peer, creating one for " MACSTR, MAC2STR(addr));
-		peer = os_malloc(sizeof(*peer));
+		peer = wpa_tdls_add_peer(sm, addr);
 		if (peer == NULL)
 			return -1;
-		os_memset(peer, 0, sizeof(*peer));
-		os_memcpy(peer->addr, addr, ETH_ALEN);
-		peer->next = sm->tdls;
-		sm->tdls = peer;
 	}
 
 	peer->initiator = 1;
-- 
1.7.4.1



From arik  Mon Sep 26 03:55:35 2011
From: arik (Arik Nemtsov)
Date: Mon, 26 Sep 2011 13:55:35 +0300
Subject: [PATCH 14/14] TDLS: use a valid dialog-token in a setup request
In-Reply-To: <1317034535-4892-1-git-send-email-arik@wizery.com>
References: <1317034535-4892-1-git-send-email-arik@wizery.com>
Message-ID: <1317034535-4892-15-git-send-email-arik@wizery.com>

A zero dialog-token is considered invalid by the TDLS specification.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
 src/rsn_supp/tdls.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/rsn_supp/tdls.c b/src/rsn_supp/tdls.c
index 558a004..ccf3822 100644
--- a/src/rsn_supp/tdls.c
+++ b/src/rsn_supp/tdls.c
@@ -1064,7 +1064,7 @@ skip_ies:
 		   "Handshake Message 1 (peer " MACSTR ")",
 		   MAC2STR(peer->addr));
 
-	wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_SETUP_REQUEST, 0, 0,
+	wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_SETUP_REQUEST, 1, 0,
 			  rbuf, pos - rbuf);
 	os_free(rbuf);
 
-- 
1.7.4.1



From j  Mon Sep 26 04:30:59 2011
From: j (Jouni Malinen)
Date: Mon, 26 Sep 2011 14:30:59 +0300
Subject: [PATCH] wpa_supplicant: Modify bgscan based roaming behaviour.
In-Reply-To: <1314608205-4995-1-git-send-email-nataraja@qca.qualcomm.com>
References: <1314608205-4995-1-git-send-email-nataraja@qca.qualcomm.com>
Message-ID: <20110926113059.GA12346@jm.kir.nu>

On Mon, Aug 29, 2011 at 02:26:45PM +0530, Vivek Natarajan wrote:
> Cancel background scan based roaming behavior if the driver
> is capable of handling roaming in the firmware. For fullmac
> drivers like ath6kl, the roaming logic is handled in the
> firmware and for supplicant to initiate roam, the station
> has to disconnect completely and then reconnect with the
> new AP which takes a longer time without preauth.
> 
> Currently, if the supplicant also tries to roam, all requests
> are rejected by cfg80211 resulting in a spam of log.

I applied the driver.h and driver_nl80211.c parts to get the new driver
flag for this, but the change to events.c did not look correct, so I
left that out. wpa_supplicant will need quite a bit more changes to be
able to work in ap_scan=2 like way in the default ap_scan=1 mode when
the driver indicates this BSS-selection-in-driver(firmware) capability.
Those changes will take care of not even getting to the
wpa_supplicant_connect(), so there should be no need to modify it in the
way done in this patch.

-- 
Jouni Malinen                                            PGP id EFC895FA


From matt.causey  Mon Sep 26 10:38:21 2011
From: matt.causey (Matt Causey)
Date: Mon, 26 Sep 2011 13:38:21 -0400
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <CAGnc4p_aY=cEnmbDM=dLZtnT0+wbzoDZY3VO32=bTMpL=V5Fgg@mail.gmail.com>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
	<20110921192448.GA5220@jm.kir.nu>
	<CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>
	<20110921212947.GA6184@jm.kir.nu>
	<CAGnc4p9F11P26rzODTPd+aA3cSyDceNG9ZfmzJ82JVd7E0RBMw@mail.gmail.com>
	<CAGnc4p_aY=cEnmbDM=dLZtnT0+wbzoDZY3VO32=bTMpL=V5Fgg@mail.gmail.com>
Message-ID: <CAGnc4p9PfxLETsJAD5S-8+qksWpJjywK2eYjQT439w6tXVz73A@mail.gmail.com>

So, I know that all of you are super busy with, well probably your
real life.  :-)  But I was wondering if you have any ideas for how to
diagnose this issue further?  I'm at a place where the data points to
a bug in the supplicant somewhere, but I am not sure...

--
Matt


On Wed, Sep 21, 2011 at 9:26 PM, Matt Causey <matt.causey at gmail.com> wrote:
>>> On Wed, Sep 21, 2011 at 05:05:59PM -0400, Matt Causey wrote:
>>>> > Which WLAN driver are you using? If the 0.8.x snapshot does not fix
>>>> > this, please provide verbose debug log from wpa_supplicant (-ddt on
>>>> > command line; or -ddKt if this is a test network and you don't care
>>>> > about revealing passwords/keys etc. private information).
>>>
>>>> We're running with -onl80211, using the vanilla ath9k code in our
>>>> kernel version.
>>>>
>>>> This version seems to roam flawlessly. ? How much testing has this
>>>> version of code seen?
>>>>
>>>> Just FYI, I've posted the output from out controller below, in case it
>>>> is helpful.
>>>
>>> Interesting.. It is unclear from those logs what exactly was causing the
>>> problem in 0.7.3. The fixes I've done in 0.8.x branch should have
>>> addressed somewhat different issues.
>>>
>>
>> Hum. ?Well since you said that, I decided to test _again_ with the
>> latest stable, and I cannot reproduce the problem.
>>
>> So, to fill in some detail that I left out initially, I did have this
>> work on the latest stable, but something changed and fast roaming
>> stopped working. ? Restarting the daemon and various other steps would
>> not cause it to work again. ?And now that I've gone back to test, it's
>> working again...on the old code. ?It makes me sad that it is
>> inconsistent and I don't know what variable is changing. ?It's not
>> even clear if it is the controller failing or the supplicant.
>>
>> In the middle of writing this I moved the client around to cause a
>> roam and it re-auth'd with RADIUS....so I'm seeing some sort of
>> inconsistent failure of fast roaming. ?Here is what the supplicant
>> says:
>>
>> Setting authentication timeout: 70 sec 0 usec
>> RSN: Authenticator did not accept PMKID, doing full EAP authentication
>> EAPOL: Supplicant port status: Unauthorized
>>
>
> So this time, I was constantly re-authing successfully until the PMK
> expiration timer on the controller fired, and nuked the PMK for my
> station. ?After that, all of the supplicant's attempts to use its
> internal PMK would fail.
>
> Here is the log entry from the controller's side, of the PMK getting
> nuked (mostly FYI, just in case it's helpful):
>
> *apfPmkCacheTimer: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 Removing
> expired PMK cache entry for station 1c:65:9d:e5:d3:46 AKM
> was:APF_KEY_MGMT_80211i
> *apfReceiveTask: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 Initiating
> 802.1x due to PMK Timeout Event for STA
> *dot1xMsgTask: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 dot1x - moving
> mobile 1c:65:9d:e5:d3:46 into Connecting state
> *dot1xMsgTask: Sep 22 02:18:04.433: 1c:65:9d:e5:d3:46 Sending
> EAP-Request/Identity to mobile 1c:65:9d:e5:d3:46 (EAP Id 1)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.435: 1c:65:9d:e5:d3:46 Received
> EAPOL EAPPKT from mobile 1c:65:9d:e5:d3:46
>
> <snip lots of RADIUS traffic>
>
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.679: 1c:65:9d:e5:d3:46 Received
> EAP Response from mobile 1c:65:9d:e5:d3:46 (EAP Id 10, EAP Type 13)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.679: 1c:65:9d:e5:d3:46 Entering
> Backend Auth Response state for mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Processing
> Access-Accept for mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Setting
> re-auth timeout to 1800 seconds, got from WLAN config.
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Station
> 1c:65:9d:e5:d3:46 setting dot1x reauth timeout = 1800
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Creating a
> PKC PMKID Cache entry for station 1c:65:9d:e5:d3:46 (RSN 2)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Adding
> BSSID 04:fe:7f:48:db:29 to PMKID cache for station 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: New PMKID: (16)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: ? ? ?[0000] c5 88 3d 3c 34
> 37 02 35 ba 52 c8 a2 24 9e 97 bf
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.683: 1c:65:9d:e5:d3:46 Disabling
> re-auth since PMK lifetime can take care of same.
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 PMK sent
> to mobility group
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Sending
> EAP-Success to mobile 1c:65:9d:e5:d3:46 (EAP Id 10)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: Including PMKID in M1 ?(16)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: ? ? ?[0000] c5 88 3d 3c 34
> 37 02 35 ba 52 c8 a2 24 9e 97 bf
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Starting
> key exchange to mobile 1c:65:9d:e5:d3:46, data packets will be dropped
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Sending
> EAPOL-Key Message to mobile 1c:65:9d:e5:d3:46
>
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? state INITPMK (message
> 1), replay counter 00.00.00.00.00.00.00.02
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Entering
> Backend Auth Success state (id=10) for mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 Received
> Auth Success while in Authenticating state for mobile
> 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.684: 1c:65:9d:e5:d3:46 dot1x -
> moving mobile 1c:65:9d:e5:d3:46 into Authenticated state
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Received
> EAPOL-Key from mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Ignoring
> invalid EAPOL version (1) in EAPOL-key message from mobile
> 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Received
> EAPOL-key in PTK_START state (message 2) from mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.689: 1c:65:9d:e5:d3:46 Stopping
> retransmission timer for mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.690: 1c:65:9d:e5:d3:46 Sending
> EAPOL-Key Message to mobile 1c:65:9d:e5:d3:46
>
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? state PTKINITNEGOTIATING
> (message 3), replay counter 00.00.00.00.00.00.00.03
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 Received
> EAPOL-Key from mobile 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 Ignoring
> invalid EAPOL version (1) in EAPOL-key message from mobile
> 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 Received
> EAPOL-key in PTKINITNEGOTIATING state (message 4) from mobile
> 1c:65:9d:e5:d3:46
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 STA
> [1c:65:9d:e5:d3:46, 10.9.9.90] Deleting Fast Path Rule (8021X_AUTH)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMsRunStateDec
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMs1xStateDec
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> RUN (20) Change state to 8021X_REQD (3) last state RUN (20)
> *pemReceiveTask: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> Removed NPU entry.
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMs1xStateInc
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> 8021X_REQD (3) Change state to L2AUTHCOMPLETE (4) last state RUN (20)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> L2AUTHCOMPLETE (4) Plumbed mobile LWAPP rule on AP 04:fe:7f:48:db:20
> vapId 7 apVapId 7
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 apfMsRunStateInc
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> L2AUTHCOMPLETE (4) Change state to RUN (20) last state RUN (20)
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> RUN (20) Reached PLUMBFASTPATH: from line 4604
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> RUN (20) Adding Fast Path rule
> ?type = Airespace AP Client
> ?on AP 04:fe:7f:48:db:20, slot 1, interface = 13, QOS = 0
> ?ACL Id = 255, Jumbo Frames = NO
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> RUN (20) Fast Path rule (contd...) 802.1P = 0, DSCP = 0, TokenID =
> 7006 ?IPv6 Vlan = 9, IPv6 intf id = 13
> *Dot1x_NW_MsgTask_6: Sep 22 02:18:04.693: 1c:65:9d:e5:d3:46 10.9.9.90
> RUN (20) Successfully plumbed mobile rule (ACL ID 255)
>
>
> I would expect though, that after the station successfully re-auths,
> it should update its PMK so that future attempts to re-auth with it
> succeed. ?But it doesn't look like it is doing that. ?Do you have any
> ideas?
>
> Thanks!
>
> --
> Matt
>


From j  Mon Sep 26 11:12:23 2011
From: j (Jouni Malinen)
Date: Mon, 26 Sep 2011 21:12:23 +0300
Subject: Opportunistic Key Caching on wpa_supplicant
In-Reply-To: <CAGnc4p9PfxLETsJAD5S-8+qksWpJjywK2eYjQT439w6tXVz73A@mail.gmail.com>
References: <CAGnc4p_r+zL8Kmnu5kKZncAY=m+AN2EDkNW50zKVq+hLZTxVgg@mail.gmail.com>
	<20110921192448.GA5220@jm.kir.nu>
	<CAGnc4p8p7PEC4rTCFTLedhgA0f7PN3H6bUiWLvjR4A0q6e=PQQ@mail.gmail.com>
	<20110921212947.GA6184@jm.kir.nu>
	<CAGnc4p9F11P26rzODTPd+aA3cSyDceNG9ZfmzJ82JVd7E0RBMw@mail.gmail.com>
	<CAGnc4p_aY=cEnmbDM=dLZtnT0+wbzoDZY3VO32=bTMpL=V5Fgg@mail.gmail.com>
	<CAGnc4p9PfxLETsJAD5S-8+qksWpJjywK2eYjQT439w6tXVz73A@mail.gmail.com>
Message-ID: <20110926181223.GA9295@jm.kir.nu>

On Mon, Sep 26, 2011 at 01:38:21PM -0400, Matt Causey wrote:
> So, I know that all of you are super busy with, well probably your
> real life.  :-)  But I was wondering if you have any ideas for how to
> diagnose this issue further?  I'm at a place where the data points to
> a bug in the supplicant somewhere, but I am not sure...

OKC works in my tests, so I would need to see a wpa_supplicant debug log
(with command line including -ddt or ideally -ddKt if this is in a test
network and revealing passwords/keys is fine).
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From fracting  Mon Sep 26 13:08:44 2011
From: fracting (Qian Hong)
Date: Tue, 27 Sep 2011 04:08:44 +0800
Subject: Need help with off-standard 802.1x authentication on Linux
In-Reply-To: <20110918161754.GB4941@jm.kir.nu>
References: <CALd+sZQT0aYO57NoMTu+gjksq3Q_4Y3VjY247C+_TuVbTUwM8A@mail.gmail.com>
	<20110918161754.GB4941@jm.kir.nu>
Message-ID: <CALd+sZRYbwX5K6NBXEAxAo-HOvRDtOSdgBZLgWKShvbWRuMpfw@mail.gmail.com>

Hello Jouni,

Thanks for the quick reply, and sorry for my delay :<
I've forwarded this post to several mailing list which focusing on
off-standard 802.1x protocal such as Ruijie and H3C iNode, but few
response until now. I'll answer your question as I can, but I don't
know very much about 802.1x, hopes I won't make too much mistakes.

On Mon, Sep 19, 2011 at 12:17 AM, Jouni Malinen <j at w1.fi> wrote:

> It depends.. In general, I like to promote use of standard-based
> solutions and protocols that have open standard. That said, if there are
> are authentication mechanisms that are in common use, it sounds
> reasonable to consider adding support for them.

Appreciate for your support!

> I agree that it would be desirable for Linux distributions to work
> out-of-box on networks that are widely deployed.

Yep, I'm so glad that you agree with it ;-)


> Sending a feature request to this mailing list and reporting which
> protocols are being used is a good start.
Ok, I'll post some feature request to http://w1.fi/bugz/ and update
this mail with the bug url.

> I've never even heard of many of the examples you mentioned.
Yes, most of them are only using in Colleges in China. What's worse,
those company usually don't care Linux users.

> Unfortunately, there is still quite a bit
> of language barrier that can explain that and while some of the
> automated translation services are making it easier to get the needed
> information, it can still slow down efforts getting these implemented.
> It can certainly if people familiar with the custom authentication
> mechanisms (or at least familiar with the language used in their
> specification and/or implementations) can participate in the effort.
That is why I forward our conversation to other 802.1x lists. However,
most of pre-developer who ever worked on off-standard 802.1x open
source client have leave school for some years, they have no testing
environment any more.
I'm interesting in getting involve, please feel free to let me know
what can I help. At this time I can test with both Ruijie network
environment and H3C network environment. Also I can capture
authentication packages with wireshark.

> As far as legal issues are concerned, there can be potential problems in
> using proprietary solutions. It is difficult to give generic comments on
> this as this will mostly need to be handled on case by case basis.
> Ideally there would be a publicly available description of the used
> protocol, but if not, 3rd party reverse engineered implementations could
> be considered as documentation.

IIRC there is no publicly available documentation from those client
company. However, there is some notes from open source developers.
Since those notes are in Chinese, I wonder if they will helps more
then source code.
Here is an example: http://apt-blog.net/tag/8021x
Do you think it is necessary to translate them to English?

> I'm not completely sure what you ask here. In general, it will be
> difficult to work on custom protocols without having access to a test
> setup that can be used to verify protocol and implementation behavior,
> so many cases can be too time consuming to justify the effort.

For example, the latest version of H3C INode (V3.6-E6203) has never
been implemented by it's open source alternatives. However I agree
that so many cases can be too time consuming to justify the effort,
maybe it is not the right time to consider supporting H3C INode
V3.6-E6203 now.

>> H3C INode
>> Official Website(Chinese) :
>> http://www.h3c.cn/Service/Document_Center/IP_Management/H3C_iNode/
>> Third party open source implement: git://github.com/liuqun/njit8021xclient
>
> This looks like some kind of design based in wired IEEE 802.1X
> authentication and the 802.1X part itself could even be standard
> compliant (didn't really review it in detail). There is some kind of
> custom EAP method (EAP type 20 which is unassigned). There seem to be
> even university-based differences in how exactly those messages are
> processed based on the comments. In addition, EAP notification may be
> used in some custom way.
> The client seems to include support for EAP-MD5, so that may be used, too.

Yes, a user from njit8021xclient mailing list reported that he has
successfully pass the authentication using wpa_supplicant, however,
he'll be auto disconnect by server after a while. Below is his
configure file:
ap_scan=0
network={
   key_mgmt=IEEE8021X
   eap=MD5
   identity="username"
   password="password"
   eapol_flags=0
}

> I don't really like the concept of picking an unassigned EAP type and
> using it for some custom purpose taken into account that this can easily
> conflict with other uses should the specific EAP type actually get
> assigned in the future. Anyway, it sounds possible to add support for
> this in wpa_supplicant.
>

Sounds great if it is supported by wpa_supplicant ;-)

> Would you happen to know how widely this is deployed? The comments in
> njit8021xclient seemed to point to at least some university use.
I can confirm that H3C INode and Ruijie Network are very widely
deployed, fortunately I can access to both environment ( as I
mentioned above ) . For other clients, maybe the sub-forum of
http://forum.ubuntu.org.cn is
a good place to see how widely it used:
http://forum.ubuntu.org.cn/viewforum.php?f=156&sid=e07de44511d52a6a20992cfb706013c2
 (In Chinese)
There is also a summary here http://wiki.ubuntu.org.cn/802.1X

> I would
> assume this is a wired network using something from H3C (Huawei-3Com?).
Yes, it is.

> Any idea whether the technology is still being developed and supported
> (as part of HP now?)?
I think the technology is still being supported, but I'm not sure. In
fact H3C release a Linux INode last year, but even their own Linux
Client does not support their latest V3.6-E6203 ... No updates from
H3C since last year.

>
> Do you know whether there is any documentation of the custom EAP method
> or changes to EAP? H3C seemed to have some related documentation in
> English available at
> http://www.h3c.com/portal/Technical_Support___Documents/Technical_Documents/Switches/H3C_S12500_Series_Switches/Configuration/Operation_Manual/H3C_S12500_CG-Release1335-5W130/11/201108/722596_1285_0.htm
>

Do you think this one is useful?
H3C Client V2.40-0143 encryption
algorithm:  http://goo.gl/8xUvk

It is wrote by a pre-developer of njit8021xclient, unfortunately it is
in Chinese... Hopes I can help.


>> Ruijie
>> Official Website: http://www.ruijienetworks.com/
>> Third party open source implement: http://code.google.com/p/mentohust/
>
> This seemed to include some functionality that would be outside the
> scope of wpa_supplicant. I'm not completely sure what exactly is in
> scope, but there were some references on 8021x.exe (but that was not
> really used for more than extracting something from the binary) and the
> group MAC address for Ruijie (01:d0:f8:00:00:03) was used similarly to
> the IEEE 802.1X EAPOL group address, so there is some connection, but it
> would take more time to figure out what exactly is being done here.
>
Does some packages captured by wireshark helps?

>> Dr.com
>> Official Website: http://www.doctorcom.com/en/index.php
>> Third party open source implement: http://sourceforge.net/projects/drcom-client/
>
> This seems to be out of scope for wpa_supplicant functionality, so it
> looks like the project could be integrated on its own to network
> management functionality in a distro.
>
Got it, thanks!

Thank you Jouni!

> --
> Jouni Malinen ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>



-- 
Regards,
Qian Hong
-
Sent from Ubuntu
http://www.ubuntu.com/


From fracting  Mon Sep 26 13:44:26 2011
From: fracting (Qian Hong)
Date: Tue, 27 Sep 2011 04:44:26 +0800
Subject: Need help with off-standard 802.1x authentication on Linux
In-Reply-To: <CALd+sZRYbwX5K6NBXEAxAo-HOvRDtOSdgBZLgWKShvbWRuMpfw@mail.gmail.com>
References: <CALd+sZQT0aYO57NoMTu+gjksq3Q_4Y3VjY247C+_TuVbTUwM8A@mail.gmail.com>
	<20110918161754.GB4941@jm.kir.nu>
	<CALd+sZRYbwX5K6NBXEAxAo-HOvRDtOSdgBZLgWKShvbWRuMpfw@mail.gmail.com>
Message-ID: <CALd+sZSA-8kdLawDT=qaut8iD=AH+ijoyxvTshGmUuNXk6Pf5g@mail.gmail.com>

Hello,

Updates:

Bug 416 http://w1.fi/bugz/show_bug.cgi?id=416
[Feature request] Please support Huawei 3COM 802.1x authentication system

Bug 417 http://w1.fi/bugz/show_bug.cgi?id=417
[Feature request] Please support Ruijie Supplicant

Thanks!


From kaniki.uday  Tue Sep 27 05:02:53 2011
From: kaniki.uday (uday kiran)
Date: Tue, 27 Sep 2011 17:32:53 +0530
Subject: IEEE 802.11 MIB support in hostapd
Message-ID: <CAOeh9MsjtoFigTU_aaWD63LZr4rb4o=NQQbogaW08HCvGi_WbA@mail.gmail.com>

Hi

Does hostapd supports the IEEE 802.11 MIB ?

For example, if I want to get dot11DisassociateStation variable , which
variable in hostapd should i need to look for.

Is it that these MIB parameters are supported at different levels like some
in hostapd, some in MAC80211 stack ?

-Uday
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110927/96e84c3a/attachment-0001.htm 


From andriy.v.tkachuk  Tue Sep 27 06:22:35 2011
From: andriy.v.tkachuk (Andriy Tkachuk)
Date: Tue, 27 Sep 2011 16:22:35 +0300
Subject: [patch] Set WPS/WSC IE for ProbeRequests via WEXT driver wrapper
In-Reply-To: <CALzbMt6NRy1TqDvNQ+V9qYkF0aG68bd8YqaLvT7AUFsbArUkPA@mail.gmail.com>
References: <CALzbMt6NRy1TqDvNQ+V9qYkF0aG68bd8YqaLvT7AUFsbArUkPA@mail.gmail.com>
Message-ID: <CALzbMt408qSOu-ZbWdyF3nqtQYQ1-o0CdsuLmNwLC+5hm5fwPQ@mail.gmail.com>

Hi Jouni,

you asked (in another mail) - "How would this be cleared?" The answer
- exactly this way. I.e. on next scanning params->extra_ies will be
reset (if it is not WPS) and correspondent ioctl will be called with
empty value for GENIE (that might reset it). BTW, doesn't it work the
same way in wpa_driver_wext_associate() for Open mode when we call
wpa_driver_wext_set_gen_ie()?



From danicamps81  Tue Sep 27 06:29:34 2011
From: danicamps81 (Dani Camps)
Date: Tue, 27 Sep 2011 14:29:34 +0100 (BST)
Subject: Help understanding WPS trace
In-Reply-To: <CAOeh9MsjtoFigTU_aaWD63LZr4rb4o=NQQbogaW08HCvGi_WbA@mail.gmail.com>
References: <CAOeh9MsjtoFigTU_aaWD63LZr4rb4o=NQQbogaW08HCvGi_WbA@mail.gmail.com>
Message-ID: <1317130174.84220.YahooMailNeo@web29718.mail.ird.yahoo.com>



Dear all,

I attach at the end of this email a WPS trace that I am having trouble to understand. I would appreciate if somebody can help me?decipher?what is going on. The trace is obtained using the P2P implementation in wpa_supplicant when the P2P Client is trying to obtain the network credentials from the P2P GO. The chipset being used is AR5412 with ath5k. These are the steps that look strange to me in the trace:

1) After the M1-M8 messages to convey network credentials to the P2P Client, the P2P Client disassociates in order to reconnect to the network with the proper credentials. You can see in frames 508 and 509 how the P2P Client is authenticating with the P2P GO in order to re-enter the network. However, when authentication completes instead of proceeding with the re-association the P2P Client stays quiet for 5 seconds, i.e.?6.779815 seconds to?11.779928 seconds. My guess is that the P2P Client is doing scanning through the 2.4Ghz band during this time. Finally at?11.779928 seconds the re-connection with the P2P GO starts. What I do not understand here, is why does the P2P Client in the middle of the re-connection with the P2P GO in WPS goes to do an scanning ?

2) When the P2P Client attempts the re-connection to the P2P GO with the proper network credentials, this re-connection fails for two times and finally succeeds the third time. In particular the P2P GO disassociates the P2P Client after this one submits the WPA key. You can see this happening at times?14.654176 seconds and?17.853630 seconds, and finally succeeds at time?21.064690 seconds. Why would the first two connection attempts fail ? Checking the format of the packet they seem identical to the one that succeeds, the WPA key is the same and only differ on the Nonce and the MIC. Can it be that the P2P GO is not ready and that is why it cancels the procedure? But then I do not understand why does the P2P GO initiate the key exchange in the first place.

Thanks for your help

Best Regards

Daniel

Wireshark Trace:

? ? ?No. ? ? Time ? ? ? ?Source ? ? ? ? ? ? ? ?Destination ? ? ? ? ? Protocol Info
? ? 224 3.111613 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Authentication, SN=48, FN=0, Flags=........
? ? 225 3.112065 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Authentication, SN=16, FN=0, Flags=........
? ? 227 3.112558 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Association Request, SN=49, FN=0, Flags=........, SSID="DIRECT-BT"
? ? 230 3.130242 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Association Response, SN=17, FN=0, Flags=........
? ? 232 3.131710 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAP ? ? ?Request, Identity [RFC3748]
? ? 234 3.132895 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAP ? ? ?Response, Identity [RFC3748]
? ? 235 3.133302 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAP ? ? ?Request, Expanded Type [RFC3748]
? ? 242 3.212666 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAP ? ? ?Response, Expanded Type [RFC3748]
? ? 247 3.245831 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAP ? ? ?Request, Expanded Type [RFC3748]
? ? 262 3.333194 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAP ? ? ?Response, Expanded Type [RFC3748]
? ? 263 3.337864 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAP ? ? ?Request, Expanded Type [RFC3748]
? ? 267 3.342888 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAP ? ? ?Response, Expanded Type [RFC3748]
? ? 268 3.372607 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAP ? ? ?Request, Expanded Type [RFC3748]
? ? 270 3.373002 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAP ? ? ?Response, Expanded Type [RFC3748]
? ? 273 3.410399 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAP ? ? ?Failure
? ? 274 3.415030 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Deauthentication, SN=56, FN=0, Flags=........
? ? 275 3.420762 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Deauthentication, SN=28, FN=0, Flags=........
? ? 292 3.631890 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Probe Response, SN=31, FN=0, Flags=........, BI=100, SSID="DIRECT-BT"
? ? 508 6.468064 ? ?D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Authentication, SN=74, FN=0, Flags=........
? ? 509 6.468524 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Authentication, SN=61, FN=0, Flags=........
? ? 527 6.779815 ? ?D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Probe Response, SN=65, FN=0, Flags=........, BI=100, SSID="DIRECT-BT"
? ?1003 11.779928 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Probe Response, SN=117, FN=0, Flags=........, BI=100, SSID="DIRECT-BT"
? ?1172 14.616333 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Authentication, SN=109, FN=0, Flags=........
? ?1174 14.616734 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Authentication, SN=146, FN=0, Flags=........
? ?1176 14.617248 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Association Request, SN=110, FN=0, Flags=........, SSID="DIRECT-BT"
? ?1177 14.618125 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Association Response, SN=147, FN=0, Flags=........
? ?1183 14.651225 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAPOL ? ?Key
? ?1185 14.654176 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAPOL ? ?Key
? ?1186 14.654540 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Deauthentication, SN=149, FN=0, Flags=........
? ?1434 17.808337 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Authentication, SN=129, FN=0, Flags=........
? ?1436 17.808759 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Authentication, SN=186, FN=0, Flags=........
? ?1438 17.809217 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Reassociation Request, SN=130, FN=0, Flags=........, SSID="DIRECT-BT"
? ?1439 17.812823 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Reassociation Response, SN=187, FN=0, Flags=........
? ?1444 17.850420 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAPOL ? ?Key
? ?1446 17.853630 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAPOL ? ?Key
? ?1447 17.853975 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Deauthentication, SN=189, FN=0, Flags=........
? ?1468 18.172101 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Probe Response, SN=194, FN=0, Flags=........, BI=100, SSID="DIRECT-BT"
? ?1687 21.008353 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Authentication, SN=149, FN=0, Flags=........
? ?1688 21.008784 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Authentication, SN=225, FN=0, Flags=........
? ?1690 21.009235 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? IEEE 802.11 Reassociation Request, SN=150, FN=0, Flags=........, SSID="DIRECT-BT"
? ?1691 21.013081 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? IEEE 802.11 Reassociation Response, SN=226, FN=0, Flags=........
? ?1696 21.060251 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAPOL ? ?Key
? ?1698 21.063466 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAPOL ? ?Key
? ?1699 21.064253 ? D-Link_c5:56:a4 ? ? ? D-Link_c5:53:93 ? ? ? EAPOL ? ?Key
? ?1701 21.064690 ? D-Link_c5:53:93 ? ? ? D-Link_c5:56:a4 ? ? ? EAPOL ? ?Key
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110927/565d39c9/attachment.htm 


From johannes  Tue Sep 27 07:35:02 2011
From: johannes (Johannes Berg)
Date: Tue, 27 Sep 2011 16:35:02 +0200
Subject: [RFC] wpa_supplicant: add fast reconnect support
In-Reply-To: <CA+yqC4ai9xtOt-uRwO3uVOvO0Ny37Qbs=fES8M9tJGRMraKXuQ@mail.gmail.com>
	(sfid-20110921_203643_613368_B87E37CD)
References: <20110324012220.CE69C58107@lefflers.sfo.corp.google.com>
	<1316606999.3940.34.camel@jlt3.sipsolutions.net>
	<CA+yqC4ai9xtOt-uRwO3uVOvO0Ny37Qbs=fES8M9tJGRMraKXuQ@mail.gmail.com>
	(sfid-20110921_203643_613368_B87E37CD)
Message-ID: <1317134102.1931.1.camel@jlt3.sipsolutions.net>

On Wed, 2011-09-21 at 11:36 -0700, Sam Leffler wrote:

> > I looked at this in more detail since I want something like this too for
> > resume support, but I don't like the way you play with the internal
> > state machines -- not advancing it at all but still calling back into
> > the core code etc. I think that adds too much fragility to an already
> > pretty finicky system.
> 
> I totally agree.  Since that patch I had to fix some edge cases and
> there may still be more.  I think to make this work right it needs to
> be carefully tied to the SME pieces of supplicant or madness will
> ensue.  OTOH all this could be dramatically simplified if one could
> just re-auth w/o having to re-establish the BSS entry in the kernel by
> doing the 1-channel scan...

:-)

I don't think it's actually possible though since we rely on the BSS
entry for a whole bunch of things like knowing what we're connected to.

Maybe it'd be possible to hide it in driver_nl80211?

johannes



From coelho  Tue Sep 27 12:21:28 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:28 +0300
Subject: [PATCH 00/11] Initial sched_scan support in wpa_supplicant
Message-ID: <1317151299-22029-1-git-send-email-coelho@ti.com>

Hi,

I think this is ready for inclusion now.  I didn't get any comments to
my RFC, so that can only mean tha my approach was ok. ;)

Since my RFC, I've done the following changes:

* Changed max_sched_scan_ssids type from size_t to int
* Added scheduled scan capability flag
* Added filter support
* Check whether scheduled scan is supported before calling it
* Added P2P and WPS extra IEs to the probe requests

Known issues:
-------------

* I have implemented a rather simple algorithm that is used when we
  need to scan for more than the maximum SSIDs supported by the
  driver.  In this case, we need to eventually stop the sched_scan and
  start a new one with the remaining SSIDs.  In this implementation, I
  always start with a timeout of max_sched_scan_ssids * 2 seconds and
  an interval of 2 seconds.  After the timeout, I double the scan
  interval and halve the timeout.  This backing off algorithm is used
  because the SSIDs are supposedly sorted in order of importance, so
  we spend less time and with longer intervals when scanning lower
  priority SSIDs.

  => I think this is good enough for now and can be changed in the
     future if someone comes up with a better algorith.

* We only perform sched_scans when the wpa_supplicant is starting and
  when a connection fails or we disconnect.  We don't perform
  scheduled scans yet when the SSID list is changed, an SSID is
  enabled or on other scan scenarios.  This should be fairly simple to
  add, but I want to maturize the current use-case first.

  => I'll send a patch in the near future to address the other scan
  scenarios.  For now, the most important use-cases are handled and,
  in any case, most of the other scenarios should work indirectly.

Cheers,
Luca.

Luciano Coelho (11):
  wpa_s: add scheduled scan driver operations
  nl80211: add scheduled scan support
  wpa_s: use sched_scan in driver init
  wpa_s: Increase number of SSIDs per scan
  wpa_s: check if sched_scan is supported before using it
  nl80211: check if sched_scan is supported in wiphy info
  wpa_s: add filter support to scheduled scans
  nl80211: add support for sched_scan filtering
  wpa_s: reorganize P2P and WPS scan code
  wpa_s: add delayed scheduled scan request
  wpa_s: add extra IEs for P2P and WPS in scheduled scan probe reqs

 src/drivers/driver.h              |   40 ++++-
 src/drivers/driver_nl80211.c      |  178 +++++++++++++++++
 wpa_supplicant/driver_i.h         |   17 ++
 wpa_supplicant/events.c           |   17 ++-
 wpa_supplicant/scan.c             |  394 +++++++++++++++++++++++++++++-------
 wpa_supplicant/scan.h             |    4 +
 wpa_supplicant/sme.c              |    1 +
 wpa_supplicant/wpa_supplicant.c   |   12 +-
 wpa_supplicant/wpa_supplicant_i.h |   10 +
 9 files changed, 591 insertions(+), 82 deletions(-)



From coelho  Tue Sep 27 12:21:29 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:29 +0300
Subject: [PATCH 01/11] wpa_s: add scheduled scan driver operations
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-2-git-send-email-coelho@ti.com>

In new kernel versions (>=3.0), NL80211 adds scheduled scan
capability.  In order to use this feature to its full extent, we need
to support it in the wpa_supplicant core, so that it can also be used
by other drivers.

This commit adds initial scheduled scan support operations and events.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver.h              |   36 +++++++-
 wpa_supplicant/driver_i.h         |   17 ++++
 wpa_supplicant/events.c           |    9 ++
 wpa_supplicant/scan.c             |  181 ++++++++++++++++++++++++++++++++++++-
 wpa_supplicant/scan.h             |    2 +
 wpa_supplicant/wpa_supplicant.c   |    2 +
 wpa_supplicant/wpa_supplicant_i.h |    8 ++
 7 files changed, 252 insertions(+), 3 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 1a5fe05..7c2eed9 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -694,6 +694,7 @@ struct wpa_driver_capa {
 	unsigned int flags;
 
 	int max_scan_ssids;
+	int max_sched_scan_ssids;
 
 	/**
 	 * max_remain_on_chan - Maximum remain-on-channel duration in msec
@@ -1398,6 +1399,37 @@ struct wpa_driver_ops {
 	int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
 
 	/**
+	 * sched_scan - Request the driver to initiate scheduled scan
+	 * @priv: private driver interface data
+	 * @params: Scan parameters
+	 * @interval: interval between scan cycles
+	 *
+	 * Returns: 0 on success, -1 on failure
+	 *
+	 * This operation should be used for scheduled scan offload to
+	 * the hardware.  Every time scan results are available, the
+	 * driver should report scan results event for wpa_supplicant
+	 * which will eventually request the results with
+	 * wpa_driver_get_scan_results2().  This operation is optional
+	 * and if not provided or if it returns -1, we fall back to
+	 * normal host-scheduled scans.
+	 */
+	int (*sched_scan)(void *priv, struct wpa_driver_scan_params *params,
+			  u32 interval);
+
+	/**
+	 * stop_sched_scan - Request the driver to stop a scheduled scan
+	 * @priv: private driver interface data
+	 *
+	 * Returns: 0 on success, -1 on failure
+	 *
+	 * This should cause the scheduled scan to be stopped and
+	 * results should stop being sent.  Must be supported if
+	 * sched_scan is supported.
+	 */
+	int (*stop_sched_scan)(void *priv);
+
+	/**
 	 * authenticate - Request driver to authenticate
 	 * @priv: private driver interface data
 	 * @params: authentication parameters
@@ -2809,7 +2841,9 @@ enum wpa_event_type {
 	 * completed Group Key Handshake while the host (including
 	 * wpa_supplicant was sleeping).
 	 */
-	EVENT_DRIVER_GTK_REKEY
+	EVENT_DRIVER_GTK_REKEY,
+
+	EVENT_SCHED_SCAN_STOPPED,
 };
 
 
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 79fdddd..2f439fc 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -79,6 +79,23 @@ static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
 	return -1;
 }
 
+static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
+				     struct wpa_driver_scan_params *params,
+				     u32 interval)
+{
+	if (wpa_s->driver->sched_scan)
+		return wpa_s->driver->sched_scan(wpa_s->drv_priv,
+						 params, interval);
+	return -1;
+}
+
+static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->driver->stop_sched_scan)
+		return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
+	return -1;
+}
+
 static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
 	struct wpa_supplicant *wpa_s)
 {
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index e60a25e..23cd191 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2232,6 +2232,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		wpa_sm_update_replay_ctr(wpa_s->wpa,
 					 data->driver_gtk_rekey.replay_ctr);
 		break;
+	case EVENT_SCHED_SCAN_STOPPED:
+		wpa_s->sched_scanning = 0;
+		wpa_supplicant_notify_scanning(wpa_s, 0);
+
+		/* If we timed out, start a new sched scan to continue
+		 * searching for more SSIDs */
+		if (wpa_s->sched_scan_timed_out)
+			wpa_supplicant_req_sched_scan(wpa_s);
+		break;
 	default:
 		wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event);
 		break;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 7689ff6..6bf007c 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -207,6 +207,52 @@ int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
 }
 
 
+static void
+wpa_supplicant_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx)
+{
+	struct wpa_supplicant *wpa_s = eloop_ctx;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Sched scan timeout - stopping it");
+
+	wpa_s->sched_scan_timed_out = 1;
+	wpa_supplicant_cancel_sched_scan(wpa_s);
+}
+
+static int
+wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
+				struct wpa_driver_scan_params *params,
+				int interval)
+{
+	int ret;
+
+	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
+		return -EOPNOTSUPP;
+
+	wpa_supplicant_notify_scanning(wpa_s, 1);
+	ret = wpa_drv_sched_scan(wpa_s, params, interval * 1000);
+	if (ret)
+		wpa_supplicant_notify_scanning(wpa_s, 0);
+	else
+		wpa_s->sched_scanning = 1;
+
+	return ret;
+}
+
+
+static int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	int ret;
+
+	ret = wpa_drv_stop_sched_scan(wpa_s);
+	if (ret) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "stopping sched_scan failed!");
+		/* TODO: what to do if stopping fails? */
+		return -1;
+	}
+
+	return ret;
+}
+
 static struct wpa_driver_scan_filter *
 wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids)
 {
@@ -350,8 +396,6 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 			ssid = wpa_s->conf->ssid;
 		while (ssid) {
 			if (!ssid->disabled && ssid->scan_ssid) {
-				wpa_hexdump_ascii(MSG_DEBUG, "Scan SSID",
-						  ssid->ssid, ssid->ssid_len);
 				params.ssids[params.num_ssids].ssid =
 					ssid->ssid;
 				params.ssids[params.num_ssids].ssid_len =
@@ -530,6 +574,122 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
 	eloop_register_timeout(sec, usec, wpa_supplicant_scan, wpa_s, NULL);
 }
 
+/**
+ * wpa_supplicant_req_sched_scan - Start a periodic scheduled scan
+ * @wpa_s: Pointer to wpa_supplicant data
+ *
+ * This function is used to schedule periodic scans for neighboring
+ * access points repeating the scan continuously.
+ */
+int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	struct wpa_driver_scan_params params;
+	enum wpa_states prev_state;
+	struct wpa_ssid *ssid;
+	int ret;
+	int use_wildcard = 0;
+	int max_sched_scan_ssids;
+
+	if (wpa_s->max_sched_scan_ssids > WPAS_MAX_SCAN_SSIDS)
+		max_sched_scan_ssids = WPAS_MAX_SCAN_SSIDS;
+	else
+		max_sched_scan_ssids = wpa_s->max_sched_scan_ssids;
+
+	/* TODO: Add WPS and P2P support */
+
+	if (wpa_s->sched_scanning)
+		return 0;
+
+	os_memset(&params, 0, sizeof(params));
+
+	prev_state = wpa_s->wpa_state;
+	if (wpa_s->wpa_state == WPA_DISCONNECTED ||
+	    wpa_s->wpa_state == WPA_INACTIVE)
+		wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
+
+	/* Find the starting point from which to continue scanning */
+	ssid = wpa_s->conf->ssid;
+	if (wpa_s->prev_sched_ssid) {
+		while (ssid) {
+			if (ssid == wpa_s->prev_sched_ssid) {
+				ssid = ssid->next;
+				break;
+			}
+			ssid = ssid->next;
+		}
+	}
+
+	if (!ssid || !wpa_s->prev_sched_ssid) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Beginning of SSID list");
+
+		wpa_s->sched_scan_interval = 2;
+		wpa_s->sched_scan_timeout = max_sched_scan_ssids * 2;
+		wpa_s->first_sched_scan = 1;
+		ssid = wpa_s->conf->ssid;
+		wpa_s->prev_sched_ssid = ssid;
+	}
+
+	while (ssid) {
+		if (ssid->disabled) {
+			wpa_s->prev_sched_ssid = ssid;
+			ssid = ssid->next;
+			continue;
+		}
+
+		if (!ssid->scan_ssid)
+			use_wildcard = 1;
+		else {
+			params.ssids[params.num_ssids].ssid =
+				ssid->ssid;
+			params.ssids[params.num_ssids].ssid_len =
+				ssid->ssid_len;
+			params.num_ssids++;
+			if (params.num_ssids + 1 >= max_sched_scan_ssids) {
+				wpa_s->prev_sched_ssid = ssid;
+				break;
+			}
+		}
+		wpa_s->prev_sched_ssid = ssid;
+		ssid = ssid->next;
+	}
+
+	if (ssid || use_wildcard) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Include wildcard SSID in "
+			"the sched scan request");
+		params.num_ssids++;
+	} else {
+		wpa_dbg(wpa_s, MSG_DEBUG, "ssid %p - list ended", ssid);
+	}
+
+	if (!params.num_ssids)
+		return 0;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Starting sched scan: interval %d timeout %d",
+		wpa_s->sched_scan_interval, wpa_s->sched_scan_timeout);
+
+	ret = wpa_supplicant_start_sched_scan(wpa_s, &params,
+					      wpa_s->sched_scan_interval);
+	if (ret) {
+		wpa_msg(wpa_s, MSG_WARNING, "Failed to initiate sched scan");
+		if (prev_state != wpa_s->wpa_state)
+			wpa_supplicant_set_state(wpa_s, prev_state);
+		return ret;
+	}
+
+	/* If we have more SSIDs to scan, add a timeout so we scan them too */
+	if (ssid || !wpa_s->first_sched_scan) {
+		wpa_s->sched_scan_timed_out = 0;
+		eloop_register_timeout(wpa_s->sched_scan_timeout, 0,
+				       wpa_supplicant_sched_scan_timeout,
+				       wpa_s, NULL);
+		wpa_s->first_sched_scan = 0;
+		wpa_s->sched_scan_timeout /= 2;
+		wpa_s->sched_scan_interval *= 2;
+	}
+
+	return 0;
+}
+
 
 /**
  * wpa_supplicant_cancel_scan - Cancel a scheduled scan request
@@ -545,6 +705,23 @@ void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s)
 }
 
 
+/**
+ * wpa_supplicant_cancel_sched_scan - Stop running scheduled scans
+ * @wpa_s: Pointer to wpa_supplicant data
+ *
+ * This function is used to stop a periodic scheduled scan.
+ */
+void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s)
+{
+	if (!wpa_s->sched_scanning)
+		return;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling sched scan");
+	eloop_cancel_timeout(wpa_supplicant_sched_scan_timeout, wpa_s, NULL);
+	wpa_supplicant_stop_sched_scan(wpa_s);
+}
+
+
 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
 				    int scanning)
 {
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index 025b815..f9d21b0 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -17,7 +17,9 @@
 
 int wpa_supplicant_enabled_networks(struct wpa_config *conf);
 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
+int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
+void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,
 				    int scanning);
 struct wpa_driver_scan_params;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 7389bc3..44ea306 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2078,6 +2078,7 @@ static struct wpa_supplicant * wpa_supplicant_alloc(void)
 	wpa_s->scan_interval = 5;
 	wpa_s->new_connection = 1;
 	wpa_s->parent = wpa_s;
+	wpa_s->sched_scanning = 0;
 
 	return wpa_s;
 }
@@ -2242,6 +2243,7 @@ next_driver:
 				return -1;
 		}
 		wpa_s->max_scan_ssids = capa.max_scan_ssids;
+		wpa_s->max_sched_scan_ssids = capa.max_sched_scan_ssids;
 		wpa_s->max_remain_on_chan = capa.max_remain_on_chan;
 		wpa_s->max_stations = capa.max_stations;
 	}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index f0e218c..8a7cb97 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -380,6 +380,12 @@ struct wpa_supplicant {
 					  */
 #define WILDCARD_SSID_SCAN ((struct wpa_ssid *) 1)
 
+	struct wpa_ssid *prev_sched_ssid; /* last SSID used in sched scan */
+	int sched_scan_timeout;
+	int sched_scan_interval;
+	int first_sched_scan;
+	int sched_scan_timed_out;
+
 	void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
 				 struct wpa_scan_results *scan_res);
 	struct dl_list bss; /* struct wpa_bss::list */
@@ -398,6 +404,7 @@ struct wpa_supplicant {
 
 	enum wpa_states wpa_state;
 	int scanning;
+	int sched_scanning;
 	int new_connection;
 	int reassociated_connection;
 
@@ -421,6 +428,7 @@ struct wpa_supplicant {
 	struct wpa_client_mlme mlme;
 	unsigned int drv_flags;
 	int max_scan_ssids;
+	int max_sched_scan_ssids;
 	unsigned int max_remain_on_chan;
 	unsigned int max_stations;
 
-- 
1.7.1



From coelho  Tue Sep 27 12:21:30 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:30 +0300
Subject: [PATCH 02/11] nl80211: add scheduled scan support
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-3-git-send-email-coelho@ti.com>

This commit adds scheduled scan support in the nl80211 driver.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver_nl80211.c |  142 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6dfad0a..1a4bf1f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1536,6 +1536,13 @@ static int process_event(struct nl_msg *msg, void *arg)
 	case NL80211_CMD_TRIGGER_SCAN:
 		wpa_printf(MSG_DEBUG, "nl80211: Scan trigger");
 		break;
+	case NL80211_CMD_START_SCHED_SCAN:
+		wpa_printf(MSG_DEBUG, "nl80211: Sched scan started");
+		break;
+	case NL80211_CMD_SCHED_SCAN_STOPPED:
+		wpa_printf(MSG_DEBUG, "nl80211: Sched scan stopped");
+		wpa_supplicant_event(drv->ctx, EVENT_SCHED_SCAN_STOPPED, NULL);
+		break;
 	case NL80211_CMD_NEW_SCAN_RESULTS:
 		wpa_printf(MSG_DEBUG, "nl80211: New scan results available");
 		drv->scan_complete_events = 1;
@@ -1543,6 +1550,10 @@ static int process_event(struct nl_msg *msg, void *arg)
 				     drv->ctx);
 		send_scan_event(drv, 0, tb);
 		break;
+	case NL80211_CMD_SCHED_SCAN_RESULTS:
+		wpa_printf(MSG_DEBUG, "nl80211: New sched scan results available");
+		send_scan_event(drv, 0, tb);
+		break;
 	case NL80211_CMD_SCAN_ABORTED:
 		wpa_printf(MSG_DEBUG, "nl80211: Scan aborted");
 		/*
@@ -1681,6 +1692,7 @@ nla_put_failure:
 
 struct wiphy_info_data {
 	int max_scan_ssids;
+	int max_sched_scan_ssids;
 	int ap_supported;
 	int p2p_supported;
 	int p2p_concurrent;
@@ -1717,6 +1729,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 		info->max_scan_ssids =
 			nla_get_u8(tb[NL80211_ATTR_MAX_NUM_SCAN_SSIDS]);
 
+	if (tb[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS])
+		info->max_sched_scan_ssids =
+			nla_get_u8(tb[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS]);
+
 	if (tb[NL80211_ATTR_SUPPORTED_IFTYPES]) {
 		struct nlattr *nl_mode;
 		int i;
@@ -1871,6 +1887,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 		WPA_DRIVER_AUTH_LEAP;
 
 	drv->capa.max_scan_ssids = info.max_scan_ssids;
+	drv->capa.max_sched_scan_ssids = info.max_sched_scan_ssids;
 	if (info.ap_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP;
 
@@ -2614,6 +2631,129 @@ nla_put_failure:
 }
 
 
+/**
+ * wpa_driver_nl80211_sched_scan - Initiate a scheduled scan
+ * @priv: Pointer to private driver data from wpa_driver_nl80211_init()
+ * @params: Scan parameters
+ * @interval: interval between scan cycles
+ * Returns: 0 on success, -1 on failure or if not supported
+ */
+static int wpa_driver_nl80211_sched_scan(void *priv,
+					 struct wpa_driver_scan_params *params,
+					 u32 interval)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	int ret = 0;
+	struct nl_msg *msg, *ssids, *freqs;
+	size_t i;
+
+	msg = nlmsg_alloc();
+	ssids = nlmsg_alloc();
+	freqs = nlmsg_alloc();
+	if (!msg || !ssids || !freqs) {
+		nlmsg_free(msg);
+		nlmsg_free(ssids);
+		nlmsg_free(freqs);
+		return -1;
+	}
+
+	os_free(drv->filter_ssids);
+	drv->filter_ssids = params->filter_ssids;
+	params->filter_ssids = NULL;
+	drv->num_filter_ssids = params->num_filter_ssids;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_START_SCHED_SCAN, 0);
+
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+
+	NLA_PUT_U32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, interval);
+
+	for (i = 0; i < params->num_ssids; i++) {
+		wpa_hexdump_ascii(MSG_MSGDUMP, "nl80211: Sched scan SSID",
+				  params->ssids[i].ssid,
+				  params->ssids[i].ssid_len);
+		NLA_PUT(ssids, i + 1, params->ssids[i].ssid_len,
+			params->ssids[i].ssid);
+	}
+	if (params->num_ssids)
+		nla_put_nested(msg, NL80211_ATTR_SCAN_SSIDS, ssids);
+
+	if (params->extra_ies) {
+		wpa_hexdump_ascii(MSG_MSGDUMP, "nl80211: Sched scan extra IEs",
+				  params->extra_ies, params->extra_ies_len);
+		NLA_PUT(msg, NL80211_ATTR_IE, params->extra_ies_len,
+			params->extra_ies);
+	}
+
+	if (params->freqs) {
+		for (i = 0; params->freqs[i]; i++) {
+			wpa_printf(MSG_MSGDUMP, "nl80211: Scan frequency %u "
+				   "MHz", params->freqs[i]);
+			NLA_PUT_U32(freqs, i + 1, params->freqs[i]);
+		}
+		nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
+	}
+
+	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+
+	/* TODO: if we get an error here, we should fall back to normal scan */
+
+	msg = NULL;
+	if (ret) {
+		wpa_printf(MSG_DEBUG, "nl80211: sched scan start failed: ret=%d "
+			   "(%s)", ret, strerror(-ret));
+		goto nla_put_failure;
+	}
+
+	wpa_printf(MSG_DEBUG, "nl80211: Sched scan requested (ret=%d) - scan interval %d "
+		   "msec", ret, interval);
+
+nla_put_failure:
+	nlmsg_free(ssids);
+	nlmsg_free(msg);
+	nlmsg_free(freqs);
+	return ret;
+}
+
+/**
+ * wpa_driver_nl80211_stop_sched_scan - Stop a scheduled scan
+ * @priv: Pointer to private driver data from wpa_driver_nl80211_init()
+ * Returns: 0 on success, -1 on failure or if not supported
+ */
+static int wpa_driver_nl80211_stop_sched_scan(void *priv)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	int ret = 0;
+	struct nl_msg *msg;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -1;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_STOP_SCHED_SCAN, 0);
+
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+
+	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
+	msg = NULL;
+	if (ret) {
+		wpa_printf(MSG_DEBUG, "nl80211: sched scan stop failed: ret=%d "
+			   "(%s)", ret, strerror(-ret));
+		goto nla_put_failure;
+	}
+
+	wpa_printf(MSG_DEBUG, "nl80211: Sched scan stop sent (ret=%d)", ret);
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return ret;
+}
+
+
 static const u8 * nl80211_get_ie(const u8 *ies, size_t ies_len, u8 ie)
 {
 	const u8 *end, *pos;
@@ -7160,6 +7300,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.get_ssid = wpa_driver_nl80211_get_ssid,
 	.set_key = wpa_driver_nl80211_set_key,
 	.scan2 = wpa_driver_nl80211_scan,
+	.sched_scan = wpa_driver_nl80211_sched_scan,
+	.stop_sched_scan = wpa_driver_nl80211_stop_sched_scan,
 	.get_scan_results2 = wpa_driver_nl80211_get_scan_results,
 	.deauthenticate = wpa_driver_nl80211_deauthenticate,
 	.disassociate = wpa_driver_nl80211_disassociate,
-- 
1.7.1



From coelho  Tue Sep 27 12:21:31 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:31 +0300
Subject: [PATCH 03/11] wpa_s: use sched_scan in driver init
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-4-git-send-email-coelho@ti.com>

This patch uses sched_scan, if available, when the driver is
initialized.  It also adds a couple of cancel operations where
appropriate.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 wpa_supplicant/events.c         |    8 ++++++--
 wpa_supplicant/sme.c            |    1 +
 wpa_supplicant/wpa_supplicant.c |    6 +++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 23cd191..d56f6cb 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -990,10 +990,14 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 				 */
 				timeout_sec = 0;
 				timeout_usec = 250000;
+				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
+							    timeout_usec);
+				return 0;
 			}
 #endif /* CONFIG_P2P */
-			wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
-						    timeout_usec);
+			if(wpa_supplicant_req_sched_scan(wpa_s))
+				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
+							    timeout_usec);
 		}
 	}
 	return 0;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index dbf385e..4cb5062 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -237,6 +237,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 	}
 #endif /* CONFIG_P2P */
 
+	wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 44ea306..6194c9a 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1154,6 +1154,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 			wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
 		os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
 	}
+	wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	/* Starting new association, so clear the possibly used WPA IE from the
@@ -2051,7 +2052,10 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 
 	wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
 	if (wpa_supplicant_enabled_networks(wpa_s->conf)) {
-		wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
+		int ret;
+		ret = wpa_supplicant_req_sched_scan(wpa_s);
+		if (ret)
+			wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
 		interface_count++;
 	} else
 		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
-- 
1.7.1



From coelho  Tue Sep 27 12:21:32 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:32 +0300
Subject: [PATCH 04/11] wpa_s: Increase number of SSIDs per scan
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-5-git-send-email-coelho@ti.com>

With scheduled scan support, we may need to pass more than 10 SSIDs in
a single scan request.  Some drivers (eg. wl12xx) support up to 16
SSIDs at once.

Change WPAS_MAX_SCAN_SSIDS from 10 to 16.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 7c2eed9..5db525a 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -195,7 +195,7 @@ struct wpa_interface_info {
 	const char *drv_name;
 };
 
-#define WPAS_MAX_SCAN_SSIDS 10
+#define WPAS_MAX_SCAN_SSIDS 16
 
 /**
  * struct wpa_driver_scan_params - Scan parameters
-- 
1.7.1



From coelho  Tue Sep 27 12:21:33 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:33 +0300
Subject: [PATCH 05/11] wpa_s: check if sched_scan is supported before using it
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-6-git-send-email-coelho@ti.com>

Previously, we were trying to use scheduled scan without checking
whether the driver supports it.  This is okay, but it is not efficient
because we need to go all the way down to the kernel driver before we
find out it is not supported.

This patch adds a capability flag in wpa_supplicant that is used to
check whether sched_scan is supported or not.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver.h              |    1 +
 wpa_supplicant/scan.c             |    3 +++
 wpa_supplicant/wpa_supplicant.c   |    1 +
 wpa_supplicant/wpa_supplicant_i.h |    1 +
 4 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 5db525a..c0914fc 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -695,6 +695,7 @@ struct wpa_driver_capa {
 
 	int max_scan_ssids;
 	int max_sched_scan_ssids;
+	int sched_scan_supported;
 
 	/**
 	 * max_remain_on_chan - Maximum remain-on-channel duration in msec
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 6bf007c..151a1fa 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -590,6 +590,9 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 	int use_wildcard = 0;
 	int max_sched_scan_ssids;
 
+	if (!wpa_s->sched_scan_supported)
+		return -EOPNOTSUPP;
+
 	if (wpa_s->max_sched_scan_ssids > WPAS_MAX_SCAN_SSIDS)
 		max_sched_scan_ssids = WPAS_MAX_SCAN_SSIDS;
 	else
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 6194c9a..320e16c 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2248,6 +2248,7 @@ next_driver:
 		}
 		wpa_s->max_scan_ssids = capa.max_scan_ssids;
 		wpa_s->max_sched_scan_ssids = capa.max_sched_scan_ssids;
+		wpa_s->sched_scan_supported = capa.sched_scan_supported;
 		wpa_s->max_remain_on_chan = capa.max_remain_on_chan;
 		wpa_s->max_stations = capa.max_stations;
 	}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 8a7cb97..2c5c805 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -429,6 +429,7 @@ struct wpa_supplicant {
 	unsigned int drv_flags;
 	int max_scan_ssids;
 	int max_sched_scan_ssids;
+	int sched_scan_supported;
 	unsigned int max_remain_on_chan;
 	unsigned int max_stations;
 
-- 
1.7.1



From coelho  Tue Sep 27 12:21:34 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:34 +0300
Subject: [PATCH 06/11] nl80211: check if sched_scan is supported in wiphy info
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-7-git-send-email-coelho@ti.com>

Tell wpa_supplicant whether sched_scan is supported by the driver by
looking into the wiphy info data.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver_nl80211.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 1a4bf1f..d6df922 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1701,6 +1701,7 @@ struct wiphy_info_data {
 	int offchan_tx_supported;
 	int max_remain_on_chan;
 	int firmware_roam;
+	int sched_scan_supported;
 };
 
 
@@ -1822,6 +1823,8 @@ broken_combination:
 				info->auth_supported = 1;
 			else if (cmd == NL80211_CMD_CONNECT)
 				info->connect_supported = 1;
+			else if (cmd == NL80211_CMD_START_SCHED_SCAN)
+				info->sched_scan_supported = 1;
 		}
 	}
 
@@ -1888,6 +1891,8 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 
 	drv->capa.max_scan_ssids = info.max_scan_ssids;
 	drv->capa.max_sched_scan_ssids = info.max_sched_scan_ssids;
+	drv->capa.sched_scan_supported = info.sched_scan_supported;
+
 	if (info.ap_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP;
 
-- 
1.7.1



From coelho  Tue Sep 27 12:21:35 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:35 +0300
Subject: [PATCH 07/11] wpa_s: add filter support to scheduled scans
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-8-git-send-email-coelho@ti.com>

Pass SSIDs to be matched in scheduled scan results.  Only the SSIDs
that are included in the match lists will be reported by the driver,
so the filtering can be offloaded to the hardware and the power
consumption can be reduced.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver.h              |    1 +
 wpa_supplicant/scan.c             |   35 +++++++++++++++++++++--------------
 wpa_supplicant/wpa_supplicant.c   |    1 +
 wpa_supplicant/wpa_supplicant_i.h |    1 +
 4 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index c0914fc..2432d59 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -696,6 +696,7 @@ struct wpa_driver_capa {
 	int max_scan_ssids;
 	int max_sched_scan_ssids;
 	int sched_scan_supported;
+	int max_match_sets;
 
 	/**
 	 * max_remain_on_chan - Maximum remain-on-channel duration in msec
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 151a1fa..9aa0967 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -587,7 +587,6 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 	enum wpa_states prev_state;
 	struct wpa_ssid *ssid;
 	int ret;
-	int use_wildcard = 0;
 	int max_sched_scan_ssids;
 
 	if (!wpa_s->sched_scan_supported)
@@ -605,6 +604,10 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 
 	os_memset(&params, 0, sizeof(params));
 
+	/* if we can't allocate space for the filters, we just don't filter */
+	params.filter_ssids = os_zalloc(wpa_s->max_match_sets *
+					sizeof(struct wpa_driver_scan_filter));
+
 	prev_state = wpa_s->wpa_state;
 	if (wpa_s->wpa_state == WPA_DISCONNECTED ||
 	    wpa_s->wpa_state == WPA_INACTIVE)
@@ -639,39 +642,43 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 			continue;
 		}
 
-		if (!ssid->scan_ssid)
-			use_wildcard = 1;
-		else {
+		if (params.filter_ssids && ssid->ssid && ssid->ssid_len) {
+			os_memcpy(params.filter_ssids[params.num_filter_ssids].ssid,
+				  ssid->ssid, ssid->ssid_len);
+			params.filter_ssids[params.num_filter_ssids].ssid_len =
+				ssid->ssid_len;
+			params.num_filter_ssids++;
+		}
+
+		if (ssid->scan_ssid) {
 			params.ssids[params.num_ssids].ssid =
 				ssid->ssid;
 			params.ssids[params.num_ssids].ssid_len =
 				ssid->ssid_len;
 			params.num_ssids++;
-			if (params.num_ssids + 1 >= max_sched_scan_ssids) {
+			if (params.num_ssids >= max_sched_scan_ssids) {
 				wpa_s->prev_sched_ssid = ssid;
 				break;
 			}
 		}
+
+		if (params.num_filter_ssids >= wpa_s->max_match_sets)
+			break;
 		wpa_s->prev_sched_ssid = ssid;
 		ssid = ssid->next;
 	}
 
-	if (ssid || use_wildcard) {
-		wpa_dbg(wpa_s, MSG_DEBUG, "Include wildcard SSID in "
-			"the sched scan request");
-		params.num_ssids++;
-	} else {
-		wpa_dbg(wpa_s, MSG_DEBUG, "ssid %p - list ended", ssid);
-	}
-
-	if (!params.num_ssids)
+	if (!params.num_ssids) {
+		os_free(params.filter_ssids);
 		return 0;
+	}
 
 	wpa_dbg(wpa_s, MSG_DEBUG, "Starting sched scan: interval %d timeout %d",
 		wpa_s->sched_scan_interval, wpa_s->sched_scan_timeout);
 
 	ret = wpa_supplicant_start_sched_scan(wpa_s, &params,
 					      wpa_s->sched_scan_interval);
+	os_free(params.filter_ssids);
 	if (ret) {
 		wpa_msg(wpa_s, MSG_WARNING, "Failed to initiate sched scan");
 		if (prev_state != wpa_s->wpa_state)
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 320e16c..c7c6b45 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2249,6 +2249,7 @@ next_driver:
 		wpa_s->max_scan_ssids = capa.max_scan_ssids;
 		wpa_s->max_sched_scan_ssids = capa.max_sched_scan_ssids;
 		wpa_s->sched_scan_supported = capa.sched_scan_supported;
+		wpa_s->max_match_sets = capa.max_match_sets;
 		wpa_s->max_remain_on_chan = capa.max_remain_on_chan;
 		wpa_s->max_stations = capa.max_stations;
 	}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 2c5c805..a774941 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -430,6 +430,7 @@ struct wpa_supplicant {
 	int max_scan_ssids;
 	int max_sched_scan_ssids;
 	int sched_scan_supported;
+	int max_match_sets;
 	unsigned int max_remain_on_chan;
 	unsigned int max_stations;
 
-- 
1.7.1



From coelho  Tue Sep 27 12:21:36 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:36 +0300
Subject: [PATCH 08/11] nl80211: add support for sched_scan filtering
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-9-git-send-email-coelho@ti.com>

Use the SSID filter list passed in the scheduled scan request down to
the kernel driver, so it can use the list to return only the wanted
SSIDs.  Some kernel drivers can use this information to offload the
SSID filter to the hardware, helping with reducing the power
consumption.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 src/drivers/driver_nl80211.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d6df922..a105b4c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1702,6 +1702,7 @@ struct wiphy_info_data {
 	int max_remain_on_chan;
 	int firmware_roam;
 	int sched_scan_supported;
+	int max_match_sets;
 };
 
 
@@ -1734,6 +1735,10 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 		info->max_sched_scan_ssids =
 			nla_get_u8(tb[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS]);
 
+	if (tb[NL80211_ATTR_MAX_MATCH_SETS])
+		info->max_match_sets =
+			nla_get_u8(tb[NL80211_ATTR_MAX_MATCH_SETS]);
+
 	if (tb[NL80211_ATTR_SUPPORTED_IFTYPES]) {
 		struct nlattr *nl_mode;
 		int i;
@@ -1892,6 +1897,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 	drv->capa.max_scan_ssids = info.max_scan_ssids;
 	drv->capa.max_sched_scan_ssids = info.max_sched_scan_ssids;
 	drv->capa.sched_scan_supported = info.sched_scan_supported;
+	drv->capa.max_match_sets = info.max_match_sets;
 
 	if (info.ap_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_AP;
@@ -2650,7 +2656,7 @@ static int wpa_driver_nl80211_sched_scan(void *priv,
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
 	int ret = 0;
-	struct nl_msg *msg, *ssids, *freqs;
+	struct nl_msg *msg, *ssids, *freqs, *match_set_ssid, *match_sets;
 	size_t i;
 
 	msg = nlmsg_alloc();
@@ -2675,6 +2681,31 @@ static int wpa_driver_nl80211_sched_scan(void *priv,
 
 	NLA_PUT_U32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, interval);
 
+	if (drv->num_filter_ssids) {
+		match_sets = nlmsg_alloc();
+
+		for (i = 0; i < drv->num_filter_ssids; i++) {
+			wpa_hexdump_ascii(MSG_MSGDUMP,
+					  "nl80211: Sched scan filter SSID",
+					  drv->filter_ssids[i].ssid,
+					  drv->filter_ssids[i].ssid_len);
+
+			match_set_ssid = nlmsg_alloc();
+			nla_put(match_set_ssid,
+				NL80211_ATTR_SCHED_SCAN_MATCH_SSID,
+				drv->filter_ssids[i].ssid_len,
+				drv->filter_ssids[i].ssid);
+
+			nla_put_nested(match_sets, i + 1, match_set_ssid);
+
+			nlmsg_free(match_set_ssid);
+		}
+
+		nla_put_nested(msg, NL80211_ATTR_SCHED_SCAN_MATCH,
+			       match_sets);
+		nlmsg_free(match_sets);
+	}
+
 	for (i = 0; i < params->num_ssids; i++) {
 		wpa_hexdump_ascii(MSG_MSGDUMP, "nl80211: Sched scan SSID",
 				  params->ssids[i].ssid,
-- 
1.7.1



From coelho  Tue Sep 27 12:21:37 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:37 +0300
Subject: [PATCH 09/11] wpa_s: reorganize P2P and WPS scan code
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-10-git-send-email-coelho@ti.com>

Move some code to separate functions to reorganize the P2P and WPS
handling during scans.  This makes the code a bit cleaner and is
needed for the scheduled scan implementation to avoid duplicated code.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 wpa_supplicant/scan.c |  166 +++++++++++++++++++++++++++----------------------
 1 files changed, 91 insertions(+), 75 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 9aa0967..1d0c89b 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -52,13 +52,13 @@ static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s)
 
 
 #ifdef CONFIG_WPS
-static int wpas_wps_in_use(struct wpa_config *conf,
+static int wpas_wps_in_use(struct wpa_supplicant *wpa_s,
 			   enum wps_request_type *req_type)
 {
 	struct wpa_ssid *ssid;
 	int wps = 0;
 
-	for (ssid = conf->ssid; ssid; ssid = ssid->next) {
+	for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
 		if (!(ssid->key_mgmt & WPA_KEY_MGMT_WPS))
 			continue;
 
@@ -71,6 +71,14 @@ static int wpas_wps_in_use(struct wpa_config *conf,
 			return 2;
 	}
 
+#ifdef CONFIG_P2P
+	wpa_s->wps->dev.p2p = 1;
+	if (!wps) {
+		wps = 1;
+		*req_type = WPS_REQ_ENROLLEE_INFO;
+	}
+#endif /* CONFIG_P2P */
+
 	return wps;
 }
 #endif /* CONFIG_WPS */
@@ -285,17 +293,92 @@ wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids)
 	return ssids;
 }
 
+static void wpa_supplicant_optimize_freqs(struct wpa_supplicant *wpa_s,
+					  struct wpa_driver_scan_params *params)
+{
+#ifdef CONFIG_P2P
+	if (params->freqs == NULL && wpa_s->p2p_in_provisioning &&
+	    wpa_s->go_params) {
+		/* Optimize provisioning state scan based on GO information */
+		if (wpa_s->p2p_in_provisioning < 5 &&
+		    wpa_s->go_params->freq > 0) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO "
+				"preferred frequency %d MHz",
+				wpa_s->go_params->freq);
+			params->freqs = os_zalloc(2 * sizeof(int));
+			if (params->freqs)
+				params->freqs[0] = wpa_s->go_params->freq;
+		} else if (wpa_s->p2p_in_provisioning < 8 &&
+			   wpa_s->go_params->freq_list[0]) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only common "
+				"channels");
+			int_array_concat(&params->freqs,
+					 wpa_s->go_params->freq_list);
+			if (params->freqs)
+				int_array_sort_unique(params->freqs);
+		}
+		wpa_s->p2p_in_provisioning++;
+	}
+#endif /* CONFIG_P2P */
 
-static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
+#ifdef CONFIG_WPS
+	if (params->freqs == NULL && wpa_s->after_wps && wpa_s->wps_freq) {
+		/*
+		 * Optimize post-provisioning scan based on channel used
+		 * during provisioning.
+		 */
+		wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz "
+			"that was used during provisioning", wpa_s->wps_freq);
+		params->freqs = os_zalloc(2 * sizeof(int));
+		if (params->freqs)
+			params->freqs[0] = wpa_s->wps_freq;
+		wpa_s->after_wps--;
+	}
+
+#endif /* CONFIG_WPS */
+}
+
+struct wpabuf *wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s,
+					struct wpa_driver_scan_params *params)
 {
-	struct wpa_supplicant *wpa_s = eloop_ctx;
-	struct wpa_ssid *ssid;
-	int scan_req = 0, ret;
 	struct wpabuf *wps_ie = NULL;
 #ifdef CONFIG_WPS
 	int wps = 0;
 	enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
+
+	wps = wpas_wps_in_use(wpa_s, &req_type);
+
+	if (wps) {
+		wps_ie = wps_build_probe_req_ie(wps == 2, &wpa_s->wps->dev,
+						wpa_s->wps->uuid, req_type,
+						0, NULL);
+		if (wps_ie) {
+			params->extra_ies = wpabuf_head(wps_ie);
+			params->extra_ies_len = wpabuf_len(wps_ie);
+		}
+	}
+
+#ifdef CONFIG_P2P
+	if (wps_ie) {
+		if (wpabuf_resize(&wps_ie, 100) == 0) {
+			wpas_p2p_scan_ie(wpa_s, wps_ie);
+			params->extra_ies = wpabuf_head(wps_ie);
+			params->extra_ies_len = wpabuf_len(wps_ie);
+		}
+	}
+#endif /* CONFIG_P2P */
+
 #endif /* CONFIG_WPS */
+
+	return wps_ie;
+}
+
+static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
+{
+	struct wpa_supplicant *wpa_s = eloop_ctx;
+	struct wpa_ssid *ssid;
+	int scan_req = 0, ret;
+	struct wpabuf *wps_ie = NULL;
 	struct wpa_driver_scan_params params;
 	size_t max_ssids;
 	enum wpa_states prev_state;
@@ -339,10 +422,6 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 			max_ssids = WPAS_MAX_SCAN_SSIDS;
 	}
 
-#ifdef CONFIG_WPS
-	wps = wpas_wps_in_use(wpa_s->conf, &req_type);
-#endif /* CONFIG_WPS */
-
 	scan_req = wpa_s->scan_req;
 	wpa_s->scan_req = 0;
 
@@ -443,71 +522,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 			"SSID");
 	}
 
-#ifdef CONFIG_P2P
-	wpa_s->wps->dev.p2p = 1;
-	if (!wps) {
-		wps = 1;
-		req_type = WPS_REQ_ENROLLEE_INFO;
-	}
-
-	if (params.freqs == NULL && wpa_s->p2p_in_provisioning &&
-	    wpa_s->go_params) {
-		/* Optimize provisioning state scan based on GO information */
-		if (wpa_s->p2p_in_provisioning < 5 &&
-		    wpa_s->go_params->freq > 0) {
-			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO "
-				"preferred frequency %d MHz",
-				wpa_s->go_params->freq);
-			params.freqs = os_zalloc(2 * sizeof(int));
-			if (params.freqs)
-				params.freqs[0] = wpa_s->go_params->freq;
-		} else if (wpa_s->p2p_in_provisioning < 8 &&
-			   wpa_s->go_params->freq_list[0]) {
-			wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only common "
-				"channels");
-			int_array_concat(&params.freqs,
-					 wpa_s->go_params->freq_list);
-			if (params.freqs)
-				int_array_sort_unique(params.freqs);
-		}
-		wpa_s->p2p_in_provisioning++;
-	}
-#endif /* CONFIG_P2P */
-
-#ifdef CONFIG_WPS
-	if (params.freqs == NULL && wpa_s->after_wps && wpa_s->wps_freq) {
-		/*
-		 * Optimize post-provisioning scan based on channel used
-		 * during provisioning.
-		 */
-		wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz "
-			"that was used during provisioning", wpa_s->wps_freq);
-		params.freqs = os_zalloc(2 * sizeof(int));
-		if (params.freqs)
-			params.freqs[0] = wpa_s->wps_freq;
-		wpa_s->after_wps--;
-	}
-
-	if (wps) {
-		wps_ie = wps_build_probe_req_ie(wps == 2, &wpa_s->wps->dev,
-						wpa_s->wps->uuid, req_type,
-						0, NULL);
-		if (wps_ie) {
-			params.extra_ies = wpabuf_head(wps_ie);
-			params.extra_ies_len = wpabuf_len(wps_ie);
-		}
-	}
-#endif /* CONFIG_WPS */
-
-#ifdef CONFIG_P2P
-	if (wps_ie) {
-		if (wpabuf_resize(&wps_ie, 100) == 0) {
-			wpas_p2p_scan_ie(wpa_s, wps_ie);
-			params.extra_ies = wpabuf_head(wps_ie);
-			params.extra_ies_len = wpabuf_len(wps_ie);
-		}
-	}
-#endif /* CONFIG_P2P */
+	wpa_supplicant_optimize_freqs(wpa_s, &params);
+	wps_ie = wpa_supplicant_extra_ies(wpa_s, &params);
 
 	if (params.freqs == NULL && wpa_s->next_scan_freqs) {
 		wpa_dbg(wpa_s, MSG_DEBUG, "Optimize scan based on previously "
-- 
1.7.1



From coelho  Tue Sep 27 12:21:39 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:39 +0300
Subject: [PATCH 11/11] wpa_s: add extra IEs for P2P and WPS in scheduled scan
	probe reqs
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-12-git-send-email-coelho@ti.com>

When WPS and P2P are enabled, we need to send the proper IEs in the
probe requests sent during scheduled scans.  Add extra IEs to the
scheduled scan parameters.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 wpa_supplicant/scan.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 6bef4e1..3eade6c 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -635,6 +635,7 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 	struct wpa_driver_scan_params params;
 	enum wpa_states prev_state;
 	struct wpa_ssid *ssid;
+	struct wpabuf *wps_ie = NULL;
 	int ret;
 	int max_sched_scan_ssids;
 
@@ -646,8 +647,6 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 	else
 		max_sched_scan_ssids = wpa_s->max_sched_scan_ssids;
 
-	/* TODO: Add WPS and P2P support */
-
 	if (wpa_s->sched_scanning)
 		return 0;
 
@@ -722,12 +721,17 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 		return 0;
 	}
 
+	if (wpa_s->wps)
+		wps_ie = wpa_supplicant_extra_ies(wpa_s, &params);
+
 	wpa_dbg(wpa_s, MSG_DEBUG, "Starting sched scan: interval %d timeout %d",
 		wpa_s->sched_scan_interval, wpa_s->sched_scan_timeout);
 
 	ret = wpa_supplicant_start_sched_scan(wpa_s, &params,
 					      wpa_s->sched_scan_interval);
+	wpabuf_free(wps_ie);
 	os_free(params.filter_ssids);
+
 	if (ret) {
 		wpa_msg(wpa_s, MSG_WARNING, "Failed to initiate sched scan");
 		if (prev_state != wpa_s->wpa_state)
-- 
1.7.1



From coelho  Tue Sep 27 12:21:38 2011
From: coelho (Luciano Coelho)
Date: Tue, 27 Sep 2011 22:21:38 +0300
Subject: [PATCH 10/11] wpa_s: add delayed scheduled scan request
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <1317151299-22029-11-git-send-email-coelho@ti.com>

When initializing, the scheduled scan code was being called before
everything is ready.  With normal scans, the first scan round is
delayed, so the initialization is finished by the time it really
starts.

Add a function that can be used to request a delayed scheduled scan.
The scan will only start after the specified time has elapsed.  Call
this function instead of starting the scheduled scan directly during
driver initialization.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 wpa_supplicant/scan.c           |   33 +++++++++++++++++++++++++++++++++
 wpa_supplicant/scan.h           |    2 ++
 wpa_supplicant/wpa_supplicant.c |    4 +++-
 3 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 1d0c89b..6bef4e1 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -216,6 +216,17 @@ int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
 
 
 static void
+wpa_supplicant_delayed_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx)
+{
+	struct wpa_supplicant *wpa_s = eloop_ctx;
+
+	wpa_dbg(wpa_s, MSG_DEBUG, "Starting delayed sched scan");
+
+	if (wpa_supplicant_req_sched_scan(wpa_s))
+		wpa_supplicant_req_scan(wpa_s, 0, 0);
+}
+
+static void
 wpa_supplicant_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx)
 {
 	struct wpa_supplicant *wpa_s = eloop_ctx;
@@ -591,6 +602,28 @@ void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec)
 }
 
 /**
+ * wpa_supplicant_delayed_sched_scan - Request a delayed scheduled scan
+ * @wpa_s: Pointer to wpa_supplicant data
+ * @sec: Number of seconds after which to scan
+ * @usec: Number of microseconds after which to scan
+ *
+ * This function is used to schedule periodic scans for neighboring
+ * access points after the specified time.
+ */
+int wpa_supplicant_delayed_sched_scan(struct wpa_supplicant *wpa_s,
+				      int sec, int usec)
+{
+	if (!wpa_s->sched_scan_supported)
+		return -EOPNOTSUPP;
+
+	eloop_register_timeout(sec, usec,
+			       wpa_supplicant_delayed_sched_scan_timeout,
+			       wpa_s, NULL);
+
+	return 0;
+}
+
+/**
  * wpa_supplicant_req_sched_scan - Start a periodic scheduled scan
  * @wpa_s: Pointer to wpa_supplicant data
  *
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index f9d21b0..81dee01 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -17,6 +17,8 @@
 
 int wpa_supplicant_enabled_networks(struct wpa_config *conf);
 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
+int wpa_supplicant_delayed_sched_scan(struct wpa_supplicant *wpa_s,
+				      int sec, int usec);
 int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c7c6b45..f73ebc2 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2053,7 +2053,9 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 	wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
 	if (wpa_supplicant_enabled_networks(wpa_s->conf)) {
 		int ret;
-		ret = wpa_supplicant_req_sched_scan(wpa_s);
+		ret = wpa_supplicant_delayed_sched_scan(wpa_s,
+							interface_count,
+							100000);
 		if (ret)
 			wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
 		interface_count++;
-- 
1.7.1



From j  Wed Sep 28 01:37:34 2011
From: j (Jouni Malinen)
Date: Wed, 28 Sep 2011 11:37:34 +0300
Subject: IEEE 802.11 MIB support in hostapd
In-Reply-To: <CAOeh9MsjtoFigTU_aaWD63LZr4rb4o=NQQbogaW08HCvGi_WbA@mail.gmail.com>
References: <CAOeh9MsjtoFigTU_aaWD63LZr4rb4o=NQQbogaW08HCvGi_WbA@mail.gmail.com>
Message-ID: <20110928083734.GA2166@jm.kir.nu>

On Tue, Sep 27, 2011 at 05:32:53PM +0530, uday kiran wrote:
> Does hostapd supports the IEEE 802.11 MIB ?

Depends on what you mean with that.. Some of the values in the MIB are
configurable and some come be fetched.

> Is it that these MIB parameters are supported at different levels like some
> in hostapd, some in MAC80211 stack ?

Yes.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Sep 28 01:40:19 2011
From: j (Jouni Malinen)
Date: Wed, 28 Sep 2011 11:40:19 +0300
Subject: Help understanding WPS trace
In-Reply-To: <1317130174.84220.YahooMailNeo@web29718.mail.ird.yahoo.com>
References: <CAOeh9MsjtoFigTU_aaWD63LZr4rb4o=NQQbogaW08HCvGi_WbA@mail.gmail.com>
	<1317130174.84220.YahooMailNeo@web29718.mail.ird.yahoo.com>
Message-ID: <20110928084019.GB2166@jm.kir.nu>

On Tue, Sep 27, 2011 at 02:29:34PM +0100, Dani Camps wrote:
> I attach at the end of this email a WPS trace that I am having trouble to understand. I would appreciate if somebody can help me?decipher?what is going on. The trace is obtained using the P2P implementation in wpa_supplicant when the P2P Client is trying to obtain the network credentials from the P2P GO. The chipset being used is AR5412 with ath5k. These are the steps that look strange to me in the trace:

It would be much easier to figure out what is going on based on a debug
log from wpa_supplicant. Sniffer trace like this (especially with all
the details removed) does not really provide any good explanation for
the issues you mention.

-- 
Jouni Malinen                                            PGP id EFC895FA


From johannes  Wed Sep 28 01:41:11 2011
From: johannes (Johannes Berg)
Date: Wed, 28 Sep 2011 10:41:11 +0200
Subject: [PATCH] AP: use QoS nullfunc for connection poll
Message-ID: <1317199271.3986.9.camel@jlt3.sipsolutions.net>

From: Johannes Berg <johannes.berg at intel.com>

When polling a station that has been inactive for a while, hostapd currently
always uses a null data frame. This is a bit strange with uAPSD clients
(though it seems to mostly work) since the EOSP bit can never be set in a
non-QoS frame. Make hostapd use QoS null data frames for probing when the
station is a QoS STA.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 src/ap/sta_info.c |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index ef90bf9..ff849ca 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -322,12 +322,16 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
 #ifndef CONFIG_NATIVE_WINDOWS
 		/* send data frame to poll STA and check whether this frame
 		 * is ACKed */
-		struct ieee80211_hdr hdr;
+		struct {
+			struct ieee80211_hdr hdr;
+			u16 qos_ctl;
+		} STRUCT_PACKED nulldata;
+		int size = sizeof(struct ieee80211_hdr);
 
 		wpa_printf(MSG_DEBUG, "  Polling STA with data frame");
 		sta->flags |= WLAN_STA_PENDING_POLL;
 
-		os_memset(&hdr, 0, sizeof(hdr));
+		os_memset(&nulldata, 0, sizeof(nulldata));
 		if (hapd->driver &&
 		    os_strcmp(hapd->driver->name, "hostap") == 0) {
 			/*
@@ -335,22 +339,28 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
 			 * but it is apparently not retried so TX Exc events
 			 * are not received for it.
 			 */
-			hdr.frame_control =
+			nulldata.hdr.frame_control =
 				IEEE80211_FC(WLAN_FC_TYPE_DATA,
 					     WLAN_FC_STYPE_DATA);
 		} else {
-			hdr.frame_control =
-				IEEE80211_FC(WLAN_FC_TYPE_DATA,
-					     WLAN_FC_STYPE_NULLFUNC);
+			if (sta->flags & WLAN_STA_WMM) {
+				nulldata.hdr.frame_control =
+					IEEE80211_FC(WLAN_FC_TYPE_DATA,
+						     WLAN_FC_STYPE_QOS_NULL);
+				size = sizeof(nulldata);
+			} else
+				nulldata.hdr.frame_control =
+					IEEE80211_FC(WLAN_FC_TYPE_DATA,
+						     WLAN_FC_STYPE_NULLFUNC);
 		}
 
-		hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
-		os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
-		os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,
+		nulldata.hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
+		os_memcpy(nulldata.hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
+		os_memcpy(nulldata.hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,
 			  ETH_ALEN);
-		os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
+		os_memcpy(nulldata.hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
 
-		if (hostapd_drv_send_mlme(hapd, &hdr, sizeof(hdr)) < 0)
+		if (hostapd_drv_send_mlme(hapd, &nulldata, size) < 0)
 			perror("ap_handle_timer: send");
 #endif /* CONFIG_NATIVE_WINDOWS */
 	} else if (sta->timeout_next != STA_REMOVE) {
-- 
1.7.6.3





From raghunathan.kailasanathan  Wed Sep 28 03:22:32 2011
From: raghunathan.kailasanathan (raghunathan.kailasanathan at wipro.com)
Date: Wed, 28 Sep 2011 10:22:32 +0000
Subject: EAP support in wifi dongle
Message-ID: <F099D0EF3989304DBA09D2E81781FF0B049DEB10@BLR-SJP-MBX4.wipro.com>

Hi Jouni/all,
Simple question. Is enterprise EAP support purely a software protocol implemented on the host ? Or does it require some support from the wifi dongle and the firmware running on the dongle ?

Assuming my dongle can do TKIP/AES, do I still require some cryptographic software in host for enterprise ?

Regards
Raghu

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com


From arik  Wed Sep 28 04:41:55 2011
From: arik (Arik Nemtsov)
Date: Wed, 28 Sep 2011 14:41:55 +0300
Subject: [PATCH] nl80211: implement TDLS callback functions and propagate
	capabilities
In-Reply-To: <1317034535-4892-4-git-send-email-arik@wizery.com>
References: <1317034535-4892-4-git-send-email-arik@wizery.com>
Message-ID: <1317210115-20261-1-git-send-email-arik@wizery.com>

Allow passing high-level TDLS commands and TDLS frames to kernel
via new nl80211 commands.

Propagate TDLS related nl80211 capability flags from kernel and add them
as driver capability flags.

Signed-off-by: Arik Nemtsov <arik at wizery.com>
Cc: Kalyan C Gaddam <chakkal at iit.edu>
---
v2: remove the nl80211 equivalents of the TDLS_ENABLE/DISABLE sub-commands.
These were unused for now.

src/drivers/driver.h         |    4 ++
 src/drivers/driver_nl80211.c |  118 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 08623e7..5d76ae8 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -689,6 +689,10 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS		0x00010000
 /* Driver indicates TX status events for Deauth/Disassoc frames */
 #define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS		0x00020000
+/* Driver supports operating as a TDLS peer */
+#define WPA_DRIVER_FLAGS_TDLS_SUPPORT			0x00040000
+/* Driver requires external TDLS setup/teardown/discovery */
+#define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP		0x00080000
 	unsigned int flags;
 
 	int max_scan_ssids;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index eaafae7..d94e515 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1688,6 +1688,8 @@ struct wiphy_info_data {
 	int connect_supported;
 	int offchan_tx_supported;
 	int max_remain_on_chan;
+	int tdls_supported;
+	int tdls_external_setup;
 };
 
 
@@ -1815,6 +1817,13 @@ broken_combination:
 		info->max_remain_on_chan =
 			nla_get_u32(tb[NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION]);
 
+	if (tb[NL80211_ATTR_TDLS_SUPPORT]) {
+		info->tdls_supported = 1;
+
+		if (tb[NL80211_ATTR_TDLS_EXTERNAL_SETUP])
+			info->tdls_external_setup = 1;
+	}
+
 	return NL_SKIP;
 }
 
@@ -1884,6 +1893,16 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_OFFCHANNEL_TX;
 	}
 
+	if (info.tdls_supported) {
+		wpa_printf(MSG_DEBUG, "nl80211: TDLS supported");
+		drv->capa.flags |= WPA_DRIVER_FLAGS_TDLS_SUPPORT;
+
+		if (info.tdls_external_setup) {
+			wpa_printf(MSG_DEBUG, "nl80211: TDLS external setup");
+			drv->capa.flags |= WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP;
+		}
+	}
+
 	drv->capa.flags |= WPA_DRIVER_FLAGS_SANE_ERROR_CODES;
 	drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
 	if (info.p2p_supported)
@@ -7144,6 +7163,101 @@ static void nl80211_set_rekey_info(void *priv, const u8 *kek, const u8 *kck,
 }
 
 
+#ifdef CONFIG_TDLS
+static enum nl80211_tdls_operation nl80211_tdls_get_oper(enum tdls_oper oper)
+{
+	switch (oper) {
+	case TDLS_DISCOVERY_REQ:
+		return NL80211_TDLS_DISCOVERY_REQ;
+	case TDLS_SETUP:
+		return NL80211_TDLS_SETUP;
+	case TDLS_TEARDOWN:
+		return NL80211_TDLS_TEARDOWN;
+	case TDLS_ENABLE_LINK:
+		return NL80211_TDLS_ENABLE_LINK;
+	case TDLS_DISABLE_LINK:
+		return NL80211_TDLS_DISABLE_LINK;
+	/* these should not be sent */
+	case TDLS_ENABLE:
+	case TDLS_DISABLE:
+		return -1;
+	}
+
+	return -1;
+}
+
+
+static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
+				  u8 dialog_token, u16 status_code,
+				  const u8 *buf, size_t len)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+
+	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
+		return -ENOTSUP;
+
+	if (!dst)
+		return -EINVAL;
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_TDLS_MGMT, 0);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_ACTION, action_code);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_DIALOG_TOKEN, dialog_token);
+	NLA_PUT_U16(msg, NL80211_ATTR_STATUS_CODE, status_code);
+	NLA_PUT(msg, NL80211_ATTR_IE, len, buf);
+
+	return send_and_recv_msgs(drv, msg, NULL, NULL);
+
+ nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+
+
+static int nl80211_tdls_oper(void *priv, enum tdls_oper oper, const u8 *peer)
+{
+	struct i802_bss *bss = priv;
+	struct wpa_driver_nl80211_data *drv = bss->drv;
+	struct nl_msg *msg;
+	enum nl80211_tdls_operation nl80211_oper;
+
+	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_TDLS_SUPPORT))
+		return -ENOTSUP;
+
+	nl80211_oper = nl80211_tdls_get_oper(oper);
+	if (nl80211_oper == -1) {
+		wpa_printf(MSG_DEBUG, "nl80211: Invalid TDLS oper: %d",
+			   oper);
+		return -EINVAL;
+	}
+
+	msg = nlmsg_alloc();
+	if (!msg)
+		return -ENOMEM;
+
+	genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
+		    NL80211_CMD_TDLS_OPER, 0);
+	NLA_PUT_U8(msg, NL80211_ATTR_TDLS_OPERATION, nl80211_oper);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer);
+
+	return send_and_recv_msgs(drv, msg, NULL, NULL);
+
+nla_put_failure:
+	nlmsg_free(msg);
+	return -ENOBUFS;
+}
+#endif /* CONFIG TDLS */
+
+
 const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.name = "nl80211",
 	.desc = "Linux nl80211/cfg80211",
@@ -7217,4 +7331,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
 	.remove_pmkid = nl80211_remove_pmkid,
 	.flush_pmkid = nl80211_flush_pmkid,
 	.set_rekey_info = nl80211_set_rekey_info,
+#ifdef CONFIG_TDLS
+	.send_tdls_mgmt = nl80211_send_tdls_mgmt,
+	.tdls_oper = nl80211_tdls_oper,
+#endif /* CONFIG_TDLS */
 };
-- 
1.7.4.1



From dcbw  Wed Sep 28 09:34:51 2011
From: dcbw (Dan Williams)
Date: Wed, 28 Sep 2011 11:34:51 -0500
Subject: EAP support in wifi dongle
In-Reply-To: <F099D0EF3989304DBA09D2E81781FF0B049DEB10@BLR-SJP-MBX4.wipro.com>
References: <F099D0EF3989304DBA09D2E81781FF0B049DEB10@BLR-SJP-MBX4.wipro.com>
Message-ID: <1317227693.6834.1.camel@dcbw.foobar.com>

On Wed, 2011-09-28 at 10:22 +0000, raghunathan.kailasanathan at wipro.com
wrote:
> Hi Jouni/all,
> Simple question. Is enterprise EAP support purely a software protocol implemented on the host ? Or does it require some support from the wifi dongle and the firmware running on the dongle ?

It is almost totally software on the host.  Some support from the
hardware/firmware is necessary but nothing material to the 802.1x
authentication process.

Dan

> Assuming my dongle can do TKIP/AES, do I still require some cryptographic software in host for enterprise ?
> 
> Regards
> Raghu
> 
> Please do not print this email unless it is absolutely necessary. 
> 
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 
> 
> www.wipro.com
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap




From raghunathan.kailasanathan  Wed Sep 28 09:54:16 2011
From: raghunathan.kailasanathan (raghunathan.kailasanathan at wipro.com)
Date: Wed, 28 Sep 2011 16:54:16 +0000
Subject: EAP support in wifi dongle
In-Reply-To: <1317227693.6834.1.camel@dcbw.foobar.com>
References: <F099D0EF3989304DBA09D2E81781FF0B049DEB10@BLR-SJP-MBX4.wipro.com>
	<1317227693.6834.1.camel@dcbw.foobar.com>
Message-ID: <F099D0EF3989304DBA09D2E81781FF0B049DEC75@BLR-SJP-MBX4.wipro.com>

>It is almost totally software on the host.  Some support from the
>hardware/firmware is necessary but nothing material to the 802.1x
>authentication process.

Thanks Dan. How about WPS (PIN and PBC)? I can see product briefs of lots of wifi dongles claiming WPS 
support, so I assume some firmware support is essential for it.

Regards
Raghu

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com


From kinoyatov  Thu Sep 29 08:46:54 2011
From: kinoyatov (Khamidulla Inoyatov)
Date: Fri, 30 Sep 2011 00:46:54 +0900
Subject: Problem with IAPP
Message-ID: <CAGqDgf6a=ZueKqJA0bRBe_Sv9L7GSNDcnjXG+zzBREL1Zi9zFA@mail.gmail.com>

Dear all members,

I have following configuration for IAPP with EAP-TLS authentication:


MN(wpa_supplicant) <--wireless link-->AP_1(hostapd with eth0 interface for
IAPP)<--wired link-->AP_2(hostapd with eth0 interface for IAPP)<---wired
link->AAA Server(freeradius)


AP has two interface for wired and wireless link, eth0 and
ath0 respectively. However AP configured as bridge. Madwifi is used as
wireless network device's driver. Configuration file for hostapd as
following:

# Cleaned up example, see original hostapd.conf for comments.

interface=ath0
driver=madwifi

logger_syslog=-1
logger_syslog_level=0
logger_stdout=-1
logger_stdout_level=0

iapp_interface=eth0


dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel

##### IEEE 802.11 related configuration #######################################

ssid=IEEE80211r
macaddr_acl=0
auth_algs=1

##### IEEE 802.1X-REV related configuration ###################################

ieee8021x=1

##### RADIUS client configuration #############################################

own_ip_addr=165.229.167.248

auth_server_addr=165.229.167.249
auth_server_port=1812
auth_server_shared_secret=pw4radius

##### WPA/IEEE 802.11i configuration ##########################################

wpa=2
wpa_key_mgmt=WPA-EAP
wpa_pairwise=CCMP TKIP


 However when i run i have following output:

[root at localhost hostapd]# ./hostapd -dd
/root/Download/hostapd-0.7.3/hostapd/hostapd.conf
Configuration file: /root/Download/hostapd-0.7.3/hostapd/hostapd.conf
ctrl_interface_group=10 (from group name 'wheel')
Configure bridge br0 for EAPOL traffic.
madwifi_set_privacy: enabled=0
SIOCGIWRANGE: WE(compiled)=22 WE(source)=13 enc_capa=0xf
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
Completing interface initialization
Flushing old station entries
madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3
ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument
madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 3)
Could not connect to kernel driver.
Deauthenticate all stations
madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=2
ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument
madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 2)
madwifi_set_privacy: enabled=0
madwifi_del_key: addr=00:00:00:00:00:00 key_idx=0
madwifi_del_key: addr=00:00:00:00:00:00 key_idx=1
madwifi_del_key: addr=00:00:00:00:00:00 key_idx=2
madwifi_del_key: addr=00:00:00:00:00:00 key_idx=3
Using interface ath0 with hwaddr 00:1e:c1:4d:34:74 and ssid 'IEEE80211r'
ath0: RADIUS Authentication server 165.229.167.249:1812
RADIUS local address: 165.229.167.242:60530
madwifi_set_ieee8021x: enabled=1
madwifi_configure_wpa: group key cipher=1
madwifi_configure_wpa: pairwise key ciphers=0xa
madwifi_configure_wpa: key management algorithms=0x1
madwifi_configure_wpa: rsn capabilities=0x0
madwifi_configure_wpa: enable WPA=0x2
WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
GMK - hexdump(len=32): [REMOVED]
GTK - hexdump(len=32): [REMOVED]
WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
wpa_driver_madwifi_set_key: alg=2 addr=00:00:00:00:00:00 key_idx=1
madwifi_set_privacy: enabled=1
ifr.ifr_name=eth0
iface=eth0
ifr.ifr_ifindex=4
ifindex=4
iapp->udp_sock=10
errno = 99
output=-1
ioctl(SIOCGIFADDR): Cannot assign requested address
setsockopt[UDP,IP_DEL_MEMBERSHIP]: Cannot assign requested address
IEEE 802.11F (IAPP) initialization failed.
ath0: Unable to setup interface.
Flushing old station entries
madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3
ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument
madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 3)
Could not connect to kernel driver.
Deauthenticate all stations
madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=2
ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument
madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 2)
rmdir[ctrl_interface]: No such file or directory
madwifi_set_privacy: enabled=0
madwifi_set_ieee8021x: enabled=0


What is problem? Why it shows that it cannot assign requested address?
Can any body share some knowledge on this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110930/d406797d/attachment.htm 


From wanqingsong_1983  Thu Sep 29 23:56:57 2011
From: wanqingsong_1983 (=?GBK?B?zfLH4MvJ?=)
Date: Fri, 30 Sep 2011 14:56:57 +0800 (CST)
Subject: About the EAP-AKA
Message-ID: <1eccb037.17e3a.132b91f217f.Coremail.wanqingsong_1983@126.com>

Hi All,
 
I just make the hostapd as an Authentication server to test the EAP-AKA.
In the hlr_auc_gw.milenage_db there's some parameters, such as IMSI Ki OPc AMF SQN.
#232010000000000 90dca4eda45b53cf0f12d7c9c3bc6a89 cb9cccc4b9258e6dca4760379fb82581 61df 000000000000
I've got an USIM card and its IMSI,  but can not get the others.
Maybe the "Ki OPc AMF SQN" should not be changed, only change the IMSI ?
 
And another issue is the hostapd.eap_user. This is my configuration:
#"cisco"*  AKA
The "cisco" is the radius user name.
Is there something wrong?
 
Many thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110930/f6bc5c04/attachment.htm 


From tajen  Fri Sep 30 01:04:39 2011
From: tajen (Christian Jensen)
Date: Fri, 30 Sep 2011 08:04:39 +0000
Subject: wpa_supplicant DBus Interface
Message-ID: <1D86C1EE3B8AD94DB890AB25A34139AC01FDAA56@NORTH-SEA.oxy.local>

Hi,

Isn't there someone who knows which signals/methods exists within the wpa_supplicant DBus interface.
One could study the code, but it will take a lot of time compared to a man page lookup.

Best regards,
Christian Jensen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110930/21a01924/attachment.htm 


From johannes  Fri Sep 30 01:06:54 2011
From: johannes (Johannes Berg)
Date: Fri, 30 Sep 2011 10:06:54 +0200
Subject: wpa_supplicant DBus Interface
In-Reply-To: <1D86C1EE3B8AD94DB890AB25A34139AC01FDAA56@NORTH-SEA.oxy.local>
References: <1D86C1EE3B8AD94DB890AB25A34139AC01FDAA56@NORTH-SEA.oxy.local>
Message-ID: <1317370014.3955.0.camel@jlt3.sipsolutions.net>

On Fri, 2011-09-30 at 08:04 +0000, Christian Jensen wrote:

> Isn't there someone who knows which signals/methods exists within the
> wpa_supplicant DBus interface. 

If you compile the supplicant correctly, it supports introspection.

johannes




From jithu  Fri Sep 30 02:30:34 2011
From: jithu (Jithu Jance)
Date: Fri, 30 Sep 2011 02:30:34 -0700
Subject: [PATCH] To address SELECT_NETWORK command for an already
	associated Network
Message-ID: <6C370B347C3FE8438C9692873287D2E1194A8D86D7@SJEXCHCCR01.corp.ad.broadcom.com>

For STA mode, SELECT_NETWORK doesn't address the scenario of an already associated network. If a selected network and currently associated network is same, wpa_supplicant currently keeps on "trying to associate" with the already associated network. In my opinion, either it should disassociate and then reconnect or shouldn't try to reconnect at all. The below patch will avoid reconnection, if it is already associated to the same network. Kindly review the patch and share your opinion.

---
 wpa_supplicant/wpa_supplicant.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index d2e29c0..7e50834 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1628,9 +1628,16 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,

        struct wpa_ssid *other_ssid;

-       if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid)
-               wpa_supplicant_disassociate(
-                       wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+       if (ssid && wpa_s->current_ssid) {
+               if(ssid != wpa_s->current_ssid) {
+                       wpa_supplicant_disassociate(
+                               wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+               } else {
+                       wpa_printf(MSG_DEBUG, "Already associated to "
+                               "selected network. Do nothing.");
+                       return;
+               }
+       }

        /*
         * Mark all other networks disabled or mark all networks enabled if no
-- 
1.7.4.1







- Jithu Jance.



From Marek.Kwaczynski  Fri Sep 30 02:45:05 2011
From: Marek.Kwaczynski (Marek.Kwaczynski at tieto.com)
Date: Fri, 30 Sep 2011 12:45:05 +0300
Subject: P2p_peers command
Message-ID: <3A42A4F4F2ABA44EBD5853ED09926647164293F9E2@EXMB02.eu.tieto.com>


Hi,

1)
I would like to ask about p2p_peers command and P2P_PEER_EXPIRATION_AGE time. Is it correct behaviour that all p2p_devices are removed from list of peers although they are send Probe Requests all time?
The filed last_seen from p2p_device structure isn't updated because this device is known. From my point of view if the device is active every time this field should be updated. I attached patch with small change that fixes this issue. Maybe you decide that it is useful.

2) The second issue:
When two devices are connected (the first one is GO and the second one is p2p_client)  they don't send Probe Requests/Responses beetwen each other and it is a root cause that they are removed from list of peers. Is it correct? Maybe these devices should be kept on the list during connection?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.shmoo.com/pipermail/hostap/attachments/20110930/4a959f52/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-P2P-Add-refreshing-age-of-peer-entries.patch
Type: application/octet-stream
Size: 832 bytes
Desc: 0001-P2P-Add-refreshing-age-of-peer-entries.patch
Url : http://lists.shmoo.com/pipermail/hostap/attachments/20110930/4a959f52/attachment.obj 


From jithu  Fri Sep 30 06:43:44 2011
From: jithu (Jithu Jance)
Date: Fri, 30 Sep 2011 06:43:44 -0700
Subject: [PATCH] P2P Take care of interface name size limit for Monitor
	interface
Message-ID: <6C370B347C3FE8438C9692873287D2E1194A8D874B@SJEXCHCCR01.corp.ad.broadcom.com>


Currently the P2P Interface name[p2p-%s-%d] is reset when the P2P Interface name reaches the "IFNAMSIZ" limit. Monitor interface name is derived from p2p interface name with the addition of few characters [mon.p2p-%s-%d] and hence Monitor interface name hits IFNAMSIZ limit before P2P Interface name. So we need to reset p2p interface name early enough to take care of extra characters in monitor interface name. This will make sure that "%d" enumeration is in sync for p2p and monitor interface. This patch also reduces the monitor interface name length to increase the reset window ["mon." to "m."].

Subject: [PATCH] Take care of interface name size limit for Monitor interface

---
 src/drivers/driver.h            |    2 ++
 src/drivers/driver_nl80211.c    |    2 +-
 wpa_supplicant/p2p_supplicant.c |    2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index f51df4e..c52cae4 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -35,6 +35,8 @@
 #define HOSTAPD_CHAN_HT40MINUS 0x00000020
 #define HOSTAPD_CHAN_HT40 0x00000040

+#define WPA_MONITOR_IFNAME_PREFIX      "m."
+
 /**
  * struct hostapd_channel_data - Channel information
  */
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6dfad0a..031b40b 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4698,7 +4698,7 @@ nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv)
        int optval;
        socklen_t optlen;

-       snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss.ifname);
+       snprintf(buf, IFNAMSIZ, "%s%s", WPA_MONITOR_IFNAME_PREFIX, drv->first_bss.ifname);
        buf[IFNAMSIZ - 1] = '\0';

        drv->monitor_ifidx =
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 92bfc41..fa18d64 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -803,7 +803,7 @@ static int wpas_p2p_add_group_interface(struct wpa_supplicant *wpa_s,

        os_snprintf(ifname, sizeof(ifname), "p2p-%s-%d", wpa_s->ifname,
                    wpa_s->p2p_group_idx);
-       if (os_strlen(ifname) >= IFNAMSIZ &&
+       if (os_strlen(ifname) + os_strlen(WPA_MONITOR_IFNAME_PREFIX)  >= IFNAMSIZ &&
            os_strlen(wpa_s->ifname) < IFNAMSIZ) {
                /* Try to avoid going over the IFNAMSIZ length limit */
                os_snprintf(ifname, sizeof(ifname), "p2p-%d",
-- 
1.7.4.1



- Jithu Jance.



From matt.causey  Fri Sep 30 06:45:20 2011
From: matt.causey (Matt Causey)
Date: Fri, 30 Sep 2011 09:45:20 -0400
Subject: [PATCH 00/11] Initial sched_scan support in wpa_supplicant
In-Reply-To: <1317151299-22029-1-git-send-email-coelho@ti.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
Message-ID: <CAGnc4p9vD_iiLYoCL7NLUJkVsoiwh=ypkyg76WFfNWzHs3Hxow@mail.gmail.com>

On Tue, Sep 27, 2011 at 3:21 PM, Luciano Coelho <coelho at ti.com> wrote:
> Known issues:
> -------------
>
> * I have implemented a rather simple algorithm that is used when we
> ?need to scan for more than the maximum SSIDs supported by the
> ?driver. ?In this case, we need to eventually stop the sched_scan and
> ?start a new one with the remaining SSIDs. ?In this implementation, I
> ?always start with a timeout of max_sched_scan_ssids * 2 seconds and
> ?an interval of 2 seconds. ?After the timeout, I double the scan
> ?interval and halve the timeout. ?This backing off algorithm is used
> ?because the SSIDs are supposedly sorted in order of importance, so
> ?we spend less time and with longer intervals when scanning lower
> ?priority SSIDs.

I know you mentioned that sched_scan only happens at start, fail, and
disconnect, but in your testing, what is the impact of the scanning to
traffic that's passing over the wireless card?  In my experience more
time spent scanning means more time that user traffic is delayed or
dropped, so I was just wondering if you have seen similar results.

--
Matt



> Luciano Coelho (11):
> ?wpa_s: add scheduled scan driver operations
> ?nl80211: add scheduled scan support
> ?wpa_s: use sched_scan in driver init
> ?wpa_s: Increase number of SSIDs per scan
> ?wpa_s: check if sched_scan is supported before using it
> ?nl80211: check if sched_scan is supported in wiphy info
> ?wpa_s: add filter support to scheduled scans
> ?nl80211: add support for sched_scan filtering
> ?wpa_s: reorganize P2P and WPS scan code
> ?wpa_s: add delayed scheduled scan request
> ?wpa_s: add extra IEs for P2P and WPS in scheduled scan probe reqs
>
> ?src/drivers/driver.h ? ? ? ? ? ? ?| ? 40 ++++-
> ?src/drivers/driver_nl80211.c ? ? ?| ?178 +++++++++++++++++
> ?wpa_supplicant/driver_i.h ? ? ? ? | ? 17 ++
> ?wpa_supplicant/events.c ? ? ? ? ? | ? 17 ++-
> ?wpa_supplicant/scan.c ? ? ? ? ? ? | ?394 +++++++++++++++++++++++++++++-------
> ?wpa_supplicant/scan.h ? ? ? ? ? ? | ? ?4 +
> ?wpa_supplicant/sme.c ? ? ? ? ? ? ?| ? ?1 +
> ?wpa_supplicant/wpa_supplicant.c ? | ? 12 +-
> ?wpa_supplicant/wpa_supplicant_i.h | ? 10 +
> ?9 files changed, 591 insertions(+), 82 deletions(-)
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>


From coelho  Fri Sep 30 06:50:11 2011
From: coelho (Luciano Coelho)
Date: Fri, 30 Sep 2011 16:50:11 +0300
Subject: [PATCH 00/11] Initial sched_scan support in wpa_supplicant
In-Reply-To: <CAGnc4p9vD_iiLYoCL7NLUJkVsoiwh=ypkyg76WFfNWzHs3Hxow@mail.gmail.com>
References: <1317151299-22029-1-git-send-email-coelho@ti.com>
	<CAGnc4p9vD_iiLYoCL7NLUJkVsoiwh=ypkyg76WFfNWzHs3Hxow@mail.gmail.com>
Message-ID: <1317390611.2171.271.camel@cumari>

Hi Matt,

On Fri, 2011-09-30 at 09:45 -0400, Matt Causey wrote: 
> On Tue, Sep 27, 2011 at 3:21 PM, Luciano Coelho <coelho at ti.com> wrote:
> > Known issues:
> > -------------
> >
> > * I have implemented a rather simple algorithm that is used when we
> >  need to scan for more than the maximum SSIDs supported by the
> >  driver.  In this case, we need to eventually stop the sched_scan and
> >  start a new one with the remaining SSIDs.  In this implementation, I
> >  always start with a timeout of max_sched_scan_ssids * 2 seconds and
> >  an interval of 2 seconds.  After the timeout, I double the scan
> >  interval and halve the timeout.  This backing off algorithm is used
> >  because the SSIDs are supposedly sorted in order of importance, so
> >  we spend less time and with longer intervals when scanning lower
> >  priority SSIDs.
> 
> I know you mentioned that sched_scan only happens at start, fail, and
> disconnect, but in your testing, what is the impact of the scanning to
> traffic that's passing over the wireless card?  In my experience more
> time spent scanning means more time that user traffic is delayed or
> dropped, so I was just wondering if you have seen similar results.

We are not currently scanning while connected.  So this is not
implemented for roaming and thus there is not traffic to be disturbed.

I don't know how this would effect an existing connection, because the
wl12xx firmware (which is the only one that currently supports
sched_scan at all) doens't support sched_scans while associated.  So
what happens in this case is that any ongoing sched_scan is stopped
before associating.

-- 
Cheers,
Luca.



From neerajkg  Fri Sep 30 06:54:58 2011
From: neerajkg (Neeraj Kumar Garg)
Date: Fri, 30 Sep 2011 06:54:58 -0700
Subject: [PATCH] P2P Adding interval parameter to set_noa and also
	update beacon after noa params are applied in the driver
Message-ID: <2C2F1EBA8050E74EA81502D5740B4BD6BBA941708B@SJEXCHCCR02.corp.ad.broadcom.com>

p2p_set noa doesn't support interval parameter. This paramter is essential for setting up presence of GO between the time of (interval - duration). This is also required by WifiDirect Sigma Test-suite for optional tests.
Also we need to update the beacon information after setting the NOA in the driver.
Also when overwriting group->noa in p2p_group.c, we need to put group->noa_used=0 otherwise, wpa_buf_put_data will crash when p2p_group_notif_noa is called again.
Also we need to update becaon (p2p_group_notif_noa) for opportunistic power-save.

---
 src/ap/ap_drv_ops.c             |    4 +-
 src/ap/ap_drv_ops.h             |    2 +-
 src/ap/hostapd.h                |    1 +
 src/ap/p2p_hostapd.c            |   14 ++++++------
 src/ap/p2p_hostapd.h            |    2 +-
 src/drivers/driver.h            |    2 +-
 src/p2p/p2p_group.c             |    4 +-
 wpa_supplicant/ctrl_iface.c     |   22 +++++++++++++-------
 wpa_supplicant/p2p_supplicant.c |   42 +++++++++++++++++++++++++++++++++++---
 wpa_supplicant/p2p_supplicant.h |    4 ++-
 10 files changed, 70 insertions(+), 27 deletions(-)
 mode change 100644 => 100755 src/ap/ap_drv_ops.c
 mode change 100644 => 100755 src/ap/ap_drv_ops.h
 mode change 100644 => 100755 src/ap/hostapd.h
 mode change 100644 => 100755 src/ap/p2p_hostapd.c
 mode change 100644 => 100755 src/ap/p2p_hostapd.h
 mode change 100644 => 100755 src/drivers/driver.h
 mode change 100644 => 100755 src/p2p/p2p_group.c
 mode change 100644 => 100755 wpa_supplicant/ctrl_iface.c
 mode change 100644 => 100755 wpa_supplicant/p2p_supplicant.c
 mode change 100644 => 100755 wpa_supplicant/p2p_supplicant.h

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
old mode 100644
new mode 100755
index 9751b29..a45a2c3
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -643,11 +643,11 @@ struct wpa_scan_results * hostapd_driver_get_scan_results(
 
 
 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
-			   int duration)
+			   int duration, int interval)
 {
 	if (hapd->driver && hapd->driver->set_noa)
 		return hapd->driver->set_noa(hapd->drv_priv, count, start,
-					     duration);
+					     duration, interval);
 	return -1;
 }
 
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
old mode 100644
new mode 100755
index f270695..260fc50
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -90,7 +90,7 @@ int hostapd_driver_scan(struct hostapd_data *hapd,
 struct wpa_scan_results * hostapd_driver_get_scan_results(
 	struct hostapd_data *hapd);
 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
-			   int duration);
+			   int duration, int interval);
 int hostapd_drv_set_key(const char *ifname,
 			struct hostapd_data *hapd,
 			enum wpa_alg alg, const u8 *addr,
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
old mode 100644
new mode 100755
index 803776c..a49ad71
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -163,6 +163,7 @@ struct hostapd_data {
 	int noa_enabled;
 	int noa_start;
 	int noa_duration;
+	int noa_interval;
 #endif /* CONFIG_P2P */
 };
 
diff --git a/src/ap/p2p_hostapd.c b/src/ap/p2p_hostapd.c
old mode 100644
new mode 100755
index 6f8b778..f1af146
--- a/src/ap/p2p_hostapd.c
+++ b/src/ap/p2p_hostapd.c
@@ -35,9 +35,8 @@ int hostapd_p2p_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
 	return p2p_ie_text(sta->p2p_ie, buf, buf + buflen);
 }
 
-
 int hostapd_p2p_set_noa(struct hostapd_data *hapd, u8 count, int start,
-			int duration)
+			int duration, int interval)
 {
 	wpa_printf(MSG_DEBUG, "P2P: Set NoA parameters: count=%u start=%d "
 		   "duration=%d", count, start, duration);
@@ -46,22 +45,23 @@ int hostapd_p2p_set_noa(struct hostapd_data *hapd, u8 count, int start,
 		hapd->noa_enabled = 0;
 		hapd->noa_start = 0;
 		hapd->noa_duration = 0;
+		hapd->noa_interval = 0;
 	}
 
 	if (count != 255) {
 		wpa_printf(MSG_DEBUG, "P2P: Non-periodic NoA - set "
 			   "NoA parameters");
-		return hostapd_driver_set_noa(hapd, count, start, duration);
+		return hostapd_driver_set_noa(hapd, count, start, duration, interval);
 	}
 
 	hapd->noa_enabled = 1;
 	hapd->noa_start = start;
 	hapd->noa_duration = duration;
-
+	hapd->noa_interval = interval;
 	if (hapd->num_sta_no_p2p == 0) {
 		wpa_printf(MSG_DEBUG, "P2P: No legacy STAs connected - update "
 			   "periodic NoA parameters");
-		return hostapd_driver_set_noa(hapd, count, start, duration);
+		return hostapd_driver_set_noa(hapd, count, start, duration, interval);
 	}
 
 	wpa_printf(MSG_DEBUG, "P2P: Legacy STA(s) connected - do not enable "
@@ -77,7 +77,7 @@ void hostapd_p2p_non_p2p_sta_connected(struct hostapd_data *hapd)
 
 	if (hapd->noa_enabled) {
 		wpa_printf(MSG_DEBUG, "P2P: Disable periodic NoA");
-		hostapd_driver_set_noa(hapd, 0, 0, 0);
+		hostapd_driver_set_noa(hapd, 0, 0, 0, 0);
 	}
 }
 
@@ -89,7 +89,7 @@ void hostapd_p2p_non_p2p_sta_disconnected(struct hostapd_data *hapd)
 	if (hapd->noa_enabled) {
 		wpa_printf(MSG_DEBUG, "P2P: Enable periodic NoA");
 		hostapd_driver_set_noa(hapd, 255, hapd->noa_start,
-				       hapd->noa_duration);
+				       hapd->noa_duration, hapd->noa_interval);
 	}
 }
 
diff --git a/src/ap/p2p_hostapd.h b/src/ap/p2p_hostapd.h
old mode 100644
new mode 100755
index 95b31d9..779c4a4
--- a/src/ap/p2p_hostapd.h
+++ b/src/ap/p2p_hostapd.h
@@ -20,7 +20,7 @@
 int hostapd_p2p_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
 			    char *buf, size_t buflen);
 int hostapd_p2p_set_noa(struct hostapd_data *hapd, u8 count, int start,
-			int duration);
+			int duration, int interval);
 void hostapd_p2p_non_p2p_sta_connected(struct hostapd_data *hapd);
 void hostapd_p2p_non_p2p_sta_disconnected(struct hostapd_data *hapd);
 
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
old mode 100644
new mode 100755
index f51df4e..fd94c97
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2090,7 +2090,7 @@ struct wpa_driver_ops {
 	 * is used only for testing. To disable NoA, all parameters are set to
 	 * 0.
 	 */
-	int (*set_noa)(void *priv, u8 count, int start, int duration);
+	int (*set_noa)(void *priv, u8 count, int start, int duration, int interval);
 
 	/**
 	 * set_p2p_powersave - Set P2P power save options
diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c
old mode 100644
new mode 100755
index 14a475d..b6323b2
--- a/src/p2p/p2p_group.c
+++ b/src/p2p/p2p_group.c
@@ -494,7 +494,7 @@ int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa,
 	} else {
 		if (group->noa) {
 			if (wpabuf_size(group->noa) >= noa_len) {
-				group->noa->size = 0;
+				group->noa->used = 0;
 				wpabuf_put_data(group->noa, noa, noa_len);
 			} else {
 				wpabuf_free(group->noa);
@@ -642,7 +642,7 @@ u8 p2p_group_presence_req(struct p2p_group *group,
 			    curr_noa_len);
 
 	/* TODO: properly process request and store copy */
-	if (curr_noa_len > 0)
+	if (curr_noa_len < 0)
 		return P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
 
 	return P2P_SC_SUCCESS;
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
old mode 100644
new mode 100755
index a55a528..72520c8
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2709,10 +2709,9 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
 		return p2p_set_ssid_postfix(wpa_s->global->p2p, (u8 *) param,
 					    os_strlen(param));
 	}
-
 	if (os_strcmp(cmd, "noa") == 0) {
 		char *pos;
-		int count, start, duration;
+		int count, start, duration, interval;
 		/* GO NoA parameters: count,start_offset(ms),duration(ms) */
 		count = atoi(param);
 		pos = os_strchr(param, ',');
@@ -2725,23 +2724,30 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
 			return -1;
 		pos++;
 		duration = atoi(pos);
-		if (count < 0 || count > 255 || start < 0 || duration < 0)
+		pos = os_strchr(pos, ',');
+		if (pos == NULL)
+			return -1;
+		pos++;
+		interval = atoi(pos);
+		if (count < 0 || count > 255 || start < 0 || duration < 0 || interval < 0 || interval < duration)
 			return -1;
 		if (count == 0 && duration > 0)
 			return -1;
+		if (count == 0 && interval > 0)
+			return -1;
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE: P2P_SET GO NoA: count=%d "
-			   "start=%d duration=%d", count, start, duration);
-		return wpas_p2p_set_noa(wpa_s, count, start, duration);
+			   "start=%d duration=%d interval=%d", count, start, duration, interval);
+		return wpas_p2p_set_noa(wpa_s, count, start, duration, interval);
 	}
 
 	if (os_strcmp(cmd, "ps") == 0)
-		return wpa_drv_set_p2p_powersave(wpa_s, atoi(param), -1, -1);
+		return wpas_drv_set_p2p_powersave(wpa_s, atoi(param), -1, -1);
 
 	if (os_strcmp(cmd, "oppps") == 0)
-		return wpa_drv_set_p2p_powersave(wpa_s, -1, atoi(param), -1);
+		return wpas_drv_set_p2p_powersave(wpa_s, -1, atoi(param), -1);
 
 	if (os_strcmp(cmd, "ctwindow") == 0)
-		return wpa_drv_set_p2p_powersave(wpa_s, -1, -1, atoi(param));
+		return wpas_drv_set_p2p_powersave(wpa_s, -1, -1, atoi(param));
 
 	if (os_strcmp(cmd, "disabled") == 0) {
 		wpa_s->global->p2p_disabled = atoi(param);
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
old mode 100644
new mode 100755
index 92bfc41..6c10d1a
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3863,14 +3863,48 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s)
 	}
 }
 
-
+#define NOA_BUF_LEN 50
 int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start,
-		     int duration)
+		     int duration, int interval)
 {
 	if (!wpa_s->ap_iface)
 		return -1;
-	return hostapd_p2p_set_noa(wpa_s->ap_iface->bss[0], count, start,
-				   duration);
+	/* Set the NOA descriptor in the driver */
+	if (hostapd_p2p_set_noa(wpa_s->ap_iface->bss[0], count, start,
+			duration, interval) < 0) {
+		wpa_printf(MSG_ERROR, "P2P: Set NOA attributes in driver failed");
+		return -1;
+	}
+
+	if(count > 0) {
+		u8 noa[NOA_BUF_LEN];
+		int noa_len = 0;
+		wpa_printf(MSG_DEBUG, "P2P: Get NOA attribute from driver");
+		noa_len = wpa_drv_get_noa(wpa_s, noa, NOA_BUF_LEN);
+		if (noa_len) {
+			wpa_printf(MSG_DEBUG, "P2P: Update NOA attributes in Beacons/ProbeRsps noa_len %d", noa_len);
+			return p2p_group_notif_noa(wpa_s->p2p_group, noa, noa_len);
+		}
+		else
+			return 0;
+	}
+	else
+		return 0;
+}
+int wpas_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s, int legacy_ps, int opp_ps, int ctwindow)
+{
+
+	u8 noa[NOA_BUF_LEN];
+	int noa_len = 0;
+	wpa_drv_set_p2p_powersave(wpa_s, legacy_ps, opp_ps, ctwindow);
+	wpa_printf(MSG_DEBUG, "P2P: Get NOA attribute from driver");
+	noa_len = wpa_drv_get_noa(wpa_s, noa, NOA_BUF_LEN);
+	if (noa_len) {
+		wpa_printf(MSG_DEBUG, "P2P: Now Update NOA attributes in Beacons/ProbeRsps noa_len %d", noa_len);
+		return p2p_group_notif_noa(wpa_s->p2p_group, noa, noa_len);
+	}
+	else
+		return 0;
 }
 
 
diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h
old mode 100644
new mode 100755
index 9a13f9f..71a8839
--- a/wpa_supplicant/p2p_supplicant.h
+++ b/wpa_supplicant/p2p_supplicant.h
@@ -109,11 +109,13 @@ int wpas_p2p_ext_listen(struct wpa_supplicant *wpa_s, unsigned int period,
 			unsigned int interval);
 void wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid,
 			   u16 reason_code, const u8 *ie, size_t ie_len);
+int wpas_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s, int legacy_ps,
+	int opp_ps, int ctwindow);
 void wpas_p2p_disassoc_notif(struct wpa_supplicant *wpa_s, const u8 *bssid,
 			     u16 reason_code, const u8 *ie, size_t ie_len);
 void wpas_p2p_update_config(struct wpa_supplicant *wpa_s);
 int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start,
-		     int duration);
+		     int duration, int interval);
 int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled);
 void wpas_p2p_notif_connected(struct wpa_supplicant *wpa_s);
 void wpas_p2p_notif_disconnected(struct wpa_supplicant *wpa_s);
-- 
1.7.4.1
 
Regards,
-Neeraj



From fracting  Fri Sep 30 07:10:59 2011
From: fracting (Qian Hong)
Date: Fri, 30 Sep 2011 22:10:59 +0800
Subject: Need help with off-standard 802.1x authentication on Linux
In-Reply-To: <CALd+sZRYbwX5K6NBXEAxAo-HOvRDtOSdgBZLgWKShvbWRuMpfw@mail.gmail.com>
References: <CALd+sZQT0aYO57NoMTu+gjksq3Q_4Y3VjY247C+_TuVbTUwM8A@mail.gmail.com>
	<20110918161754.GB4941@jm.kir.nu>
	<CALd+sZRYbwX5K6NBXEAxAo-HOvRDtOSdgBZLgWKShvbWRuMpfw@mail.gmail.com>
Message-ID: <CALd+sZSL75=s3td6UpNZdZckAjkGuZnGhP2CHL7NKW9iZ4AA1Q@mail.gmail.com>

Hello?

On Tue, Sep 27, 2011 at 4:08 AM, Qian Hong <fracting at gmail.com> wrote:
> Do you think this one is useful?
> H3C Client V2.40-0143 encryption
> algorithm: ?http://goo.gl/8xUvk

Updates?
Another notes from njit-client developer, describing the encryption of
H3C client.
http://goo.gl/albP2
If someone wants a English version, please let me know, I'll try to
translate it to English.

Thanks!

-- 
Regards,
Qian Hong
-
??????? *???* ??: http://goo.gl/HFhP5
Please help my classmate *Yao Xunyuan* and his family by a small
donation: http://goo.gl/91Q7X
-
Sent from Ubuntu
http://www.ubuntu.com/


