From holgerschurig  Mon Feb  3 00:43:18 2014
From: holgerschurig (Holger Schurig)
Date: Mon, 3 Feb 2014 09:43:18 +0100
Subject: [PATCH] wpa_supplicant: systemd service directives
In-Reply-To: <20140130113520.GA7542@w1.fi>
References: <8761pdkqrb.fsf@holos.localdomain>
	<20140130113520.GA7542@w1.fi>
Message-ID: <CAOpc7mHCOdJRmdnEE8xRawvqu6BeFv9qtKbj=Q8R4+AdmxA8WQ@mail.gmail.com>

> $ man systemd.unit
> No manual entry for systemd.unit

It seems that you don't run systemd, because this man page comes with
systemd. You can find all of it's manpages online as well, see
http://0pointer.de/public/systemd-man/

The one in question is
http://0pointer.de/public/systemd-man/systemd.unit.html. It says ...

Alias=
Additional names this unit shall be installed under. The names listed
here must have the same suffix (i.e. type) as the unit file name. This
option may be specified more than once, in which case all listed names
are used. At installation time, systemctl enable will create symlinks
from these names to the unit filename.

WantedBy=, RequiredBy=
A symbolic link is created in the .wants/ or .requires/ directory of
the listed unit when this unit is activated by systemctl enable. This
has the effect that a dependency of type Wants= or Requires= is added
from the listed unit to the current unit. The primary result is that
the current unit will be started when the listed unit is started. See
the description of Wants= and Requires= in the [Unit] section for
details.

WantedBy=foo.service in a service bar.service is mostly equivalent to
Alias=foo.service.wants/bar.service in the same file. In case of
template units, systemctl enable must be called with an instance name,
and this instance will be added to the .wants/ or .requires/ list of
the listed unit. E.g. WantedBy=getty.target in a service
getty at .service will result in systemctl enable getty at tty2.service
creating a getty.target.wants/getty at tty2.service link to
getty at .service.



But with all of this info, I don't see why this comment is necessary.
And I don't know why the patched unit files are "systemd unit
templates" (they use %I inside),but why they aren't named like
template units: they lack the @ in their filename.


From prashanthkumar.kr  Mon Feb  3 04:19:02 2014
From: prashanthkumar.kr (Prashanth Kumar)
Date: Mon,  3 Feb 2014 17:49:02 +0530
Subject: [PATCH] wpa_supplicant: Fix misplaced os_free
Message-ID: <1391429942-4190-1-git-send-email-prashanthkumar.kr@globaledgesoft.com>

os_free has wfd_dev_info_hex as an argument which is defined within
CONFIG_NO_STDOUT_DEBUG

Signed-hostap: Prashanth Kumar <prashanthkumar.kr at globaledgesoft.com>
---
 wpa_supplicant/p2p_supplicant.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 8d6c381..2fce8c4 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1684,9 +1684,12 @@ static void wpas_dev_found(void *ctx, const u8 *addr,
 		       info->dev_capab, info->group_capab,
 		       wfd_dev_info_hex ? " wfd_dev_info=0x" : "",
 		       wfd_dev_info_hex ? wfd_dev_info_hex : "");
-#endif /* CONFIG_NO_STDOUT_DEBUG */
 
+#ifdef CONFIG_WIFI_DISPLAY
 	os_free(wfd_dev_info_hex);
+#endif /* CONFIG_WIFI_DISPLAY */
+
+#endif /* CONFIG_NO_STDOUT_DEBUG */
 
 	wpas_notify_p2p_device_found(ctx, info->p2p_device_addr, new_device);
 }
-- 
1.7.9.5



From xpumapu  Mon Feb  3 04:46:44 2014
From: xpumapu (Marek Puzyniak)
Date: Mon, 3 Feb 2014 13:46:44 +0100
Subject: [PATCH] Add Support for TPC and VHT-TPE IE's
In-Reply-To: <CABPxzYK-F9=BWLD8r-1yexYQNdmGE2Zz83V2SG_sdHvcd+5Fkw@mail.gmail.com>
References: <000201ce889f$e2f6b640$a8e422c0$@gmail.com>
	<20130831172228.GA20957@w1.fi>
	<CABPxzYK-F9=BWLD8r-1yexYQNdmGE2Zz83V2SG_sdHvcd+5Fkw@mail.gmail.com>
Message-ID: <CAD_=uH8esS4jYMV5NMpbzHo2=X4WSMd0nKgo=2YiMcD-ma8ieA@mail.gmail.com>

Hi All,

2013/9/1 Krishna Chaitanya <chaitanya.mgit at gmail.com>:
>> Please do not merge independent changes into a single patch even if they
>> are in similar category. It's much easier to review and manage shorter
>> patches that add each add a specific change. In addition, there were
>> quite a bit of whitespace damage in the changes. Please either fix your
>> MUA to not break the patch or as a less preferred backup, send the patch
>> as an attachment in addition to inline.
>>
>> I split the changes into three parts and cleaned them up to make it
>> easier to review them (doing that before for contributions would be
>> appreciated and likely to speed up the process of getting these into
>> hostap.git). The following commits have number of TODO/FIX comments
>> pointing out the changes that I think will be needed to make these work
>> properly.
>
> Thanks a lot Jouni for the comments. Will handle the comments and send them
> as a 3 individual patches.
>
>> FIX: ieee80211h configuration parameter is not appropriate way of
>> deciding whether to add this to the Beacon/Probe Response frames since
>> it is used for other purposes (enabling DFS support). In addition,
>> hardcoding Local Power Constraint to 0 does not look good. Maybe add a
>> new configuration parameter local_pwr_constraint and add this element
>> only if that is set.
>
>
> Accepted.
>
>
>> FIX: ieee80211h is not appropriate parameter for selecting when spectrum
>> management is marked required. A new spectrum_mgmt_required
>> configuration parameter could be added to do this instead.
>
> Accepted.
>
>
>> TODO: Is use of 127 as the config-value-not-set appropritate? Would
>> sound better to use int values in configuration and a unique
>> value to indicate not set rather than re-use 127 which has a
>> special meaning in the standard.
>
> Agree that 127 has a special meaning but that meaning says there is
> no local power constraint, so we can safely use it to not to include the
> IE.
>
>> TODO: It is not appropriate to use ieee80211h config parameter as a
>> constraint for including this. Use vht_tpe_loc_20 parameter
>> present/not-present for this instead.
>
> Accepted.
>
>> Add Transmit Power Envelope element per IEEE 802.11ac/D6.0 if VHT is
>> enabled.
>
> Sure, our patch was based on 5.0 will upgrade.
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap

What is the current status of TPC implementation?
I am asking because I would like to continue that work or test that if
it is already done.

Thanks,
Marek


From chaitanya.mgit  Mon Feb  3 06:28:05 2014
From: chaitanya.mgit (Krishna Chaitanya)
Date: Mon, 3 Feb 2014 19:58:05 +0530
Subject: [PATCH] Add Support for TPC and VHT-TPE IE's
In-Reply-To: <CAD_=uH8esS4jYMV5NMpbzHo2=X4WSMd0nKgo=2YiMcD-ma8ieA@mail.gmail.com>
References: <000201ce889f$e2f6b640$a8e422c0$@gmail.com>
	<20130831172228.GA20957@w1.fi>
	<CABPxzYK-F9=BWLD8r-1yexYQNdmGE2Zz83V2SG_sdHvcd+5Fkw@mail.gmail.com>
	<CAD_=uH8esS4jYMV5NMpbzHo2=X4WSMd0nKgo=2YiMcD-ma8ieA@mail.gmail.com>
Message-ID: <CABPxzYLqoNJyT0gGe6=5yuHJ6BxajH3d9B6OoCHoS1CWt=dsgg@mail.gmail.com>

> What is the current status of TPC implementation?
> I am asking because I would like to continue that work or test that if
> it is already done.

I was busy with other things at hand, so couldn't spend time to
address the comments.

You can go ahead if you have time else will try to address them
myself. Either way its fine with me.


From marek.kwaczynski  Mon Feb  3 06:55:19 2014
From: marek.kwaczynski (Marek Kwaczynski)
Date: Mon,  3 Feb 2014 15:55:19 +0100
Subject: [PATCH V3] hostapd: Add Operating Mode Notification support
Message-ID: <1391439319-28071-1-git-send-email-marek.kwaczynski@tieto.com>

Handling Operating Mode Notification received in Assoc Request.

Signed-hostap: Marek Kwaczynski <marek.kwaczynski at tieto.com>
---
Required patches in mac80211 were applied.

 src/ap/ap_drv_ops.c            |    4 +++-
 src/ap/ap_drv_ops.h            |    2 +-
 src/ap/ieee802_11.c            |    8 +++++++-
 src/ap/ieee802_11.h            |    2 ++
 src/ap/ieee802_11_vht.c        |   26 ++++++++++++++++++++++++++
 src/ap/sta_info.h              |    2 ++
 src/common/ieee802_11_common.c |    4 ++++
 src/common/ieee802_11_common.h |    2 ++
 src/common/ieee802_11_defs.h   |    7 +++++++
 src/drivers/driver.h           |    2 ++
 src/drivers/driver_nl80211.c   |    6 ++++++
 11 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 893e6d9..e998fc6 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -346,7 +346,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 		    u16 listen_interval,
 		    const struct ieee80211_ht_capabilities *ht_capab,
 		    const struct ieee80211_vht_capabilities *vht_capab,
-		    u32 flags, u8 qosinfo)
+		    u32 flags, u8 qosinfo, u8 vht_opmode)
 {
 	struct hostapd_sta_add_params params;
 
@@ -364,6 +364,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 	params.listen_interval = listen_interval;
 	params.ht_capabilities = ht_capab;
 	params.vht_capabilities = vht_capab;
+	params.vht_opmode_enabled = !!(flags & WLAN_STA_VHT_OPMODE_ENABLED);
+	params.vht_opmode = vht_opmode;
 	params.flags = hostapd_sta_flags_to_drv(flags);
 	params.qosinfo = qosinfo;
 	return hapd->driver->sta_add(hapd->drv_priv, &params);
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 15a4b26..9edaf7d 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -40,7 +40,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 		    u16 listen_interval,
 		    const struct ieee80211_ht_capabilities *ht_capab,
 		    const struct ieee80211_vht_capabilities *vht_capab,
-		    u32 flags, u8 qosinfo);
+		    u32 flags, u8 qosinfo, u8 vht_opmode);
 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
 			     size_t elem_len);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index dee3c7a..d22b2a0 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -910,6 +910,12 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 				  elems.vht_capabilities_len);
 	if (resp != WLAN_STATUS_SUCCESS)
 		return resp;
+
+	resp = set_sta_vht_opmode(hapd, sta, elems.vht_opmode_notif,
+				  elems.vht_opmode_notif_len);
+	if (resp != WLAN_STATUS_SUCCESS)
+		return resp;
+
 	if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht &&
 	    !(sta->flags & WLAN_STA_VHT)) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
@@ -1953,7 +1959,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
 			    sta->listen_interval,
 			    sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
 			    sta->flags & WLAN_STA_VHT ? &vht_cap : NULL,
-			    sta->flags, sta->qosinfo)) {
+			    sta->flags, sta->qosinfo, sta->vht_opmode)) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_NOTICE,
 			       "Could not add STA to kernel driver");
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 5edeb71..4966bcd 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -62,6 +62,8 @@ u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 void update_ht_state(struct hostapd_data *hapd, struct sta_info *sta);
 u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 		       const u8 *vht_capab, size_t vht_capab_len);
+u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
+                       const u8 *vht_opmode, size_t vht_opmode_len);
 void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
 		       const u8 *buf, size_t len, int ack);
 void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst,
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index f2ab182..136a9dd 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -108,6 +108,32 @@ u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 	return WLAN_STATUS_SUCCESS;
 }
 
+u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
+		      const u8 *vht_oper_notif, size_t vht_oper_notif_len)
+{
+	u8 channel_width;
+
+	if (!vht_oper_notif || vht_oper_notif_len != VHT_OPMODE_LEN) {
+		sta->flags &= ~WLAN_STA_VHT_OPMODE_ENABLED;
+		return WLAN_STATUS_SUCCESS;
+	}
+
+	channel_width = *vht_oper_notif & VHT_OPMODE_CHANNEL_WIDTH_MASK;
+
+	if (channel_width != VHT_CHANWIDTH_USE_HT &&
+	    channel_width != VHT_CHANWIDTH_80MHZ &&
+	    channel_width != VHT_CHANWIDTH_160MHZ &&
+	    channel_width != VHT_CHANWIDTH_80P80MHZ &&
+	    (*vht_oper_notif & VHT_OPMODE_CHANNEL_RxNSS_MASK) > VHT_RX_NSS_MAX_STREAMS - 1) {
+		sta->flags &= ~WLAN_STA_VHT_OPMODE_ENABLED;
+		return WLAN_STATUS_UNSPECIFIED_FAILURE;
+	}
+
+	sta->flags |= WLAN_STA_VHT_OPMODE_ENABLED;
+	sta->vht_opmode = *vht_oper_notif;
+	return WLAN_STATUS_SUCCESS;
+}
+
 void hostapd_get_vht_capab(struct hostapd_data *hapd,
 			   struct ieee80211_vht_capabilities *vht_cap,
 			   struct ieee80211_vht_capabilities *neg_vht_cap)
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 9b77e06..1973af6 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -27,6 +27,7 @@
 #define WLAN_STA_GAS BIT(17)
 #define WLAN_STA_VHT BIT(18)
 #define WLAN_STA_WNM_SLEEP_MODE BIT(19)
+#define WLAN_STA_VHT_OPMODE_ENABLED BIT(20)
 #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
 #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
 #define WLAN_STA_NONERP BIT(31)
@@ -104,6 +105,7 @@ struct sta_info {
 	struct ieee80211_ht_capabilities *ht_capabilities;
 	struct ieee80211_vht_capabilities *vht_capabilities;
 
+	u8 vht_opmode;
 #ifdef CONFIG_IEEE80211W
 	int sa_query_count; /* number of pending SA Query requests;
 			     * 0 = no SA Query in progress */
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 809089f..cc58ea2 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -252,6 +252,10 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
 			elems->vht_operation = pos;
 			elems->vht_operation_len = elen;
 			break;
+		case WLAN_EID_VHT_OPERATING_MODE_NOTIFICATION:
+			elems->vht_opmode_notif = pos;
+			elems->vht_opmode_notif_len = elen;
+			break;
 		case WLAN_EID_LINK_ID:
 			if (elen < 18)
 				break;
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index b84dd9e..178bdb6 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -30,6 +30,7 @@ struct ieee802_11_elems {
 	const u8 *ht_operation;
 	const u8 *vht_capabilities;
 	const u8 *vht_operation;
+	const u8 *vht_opmode_notif;
 	const u8 *vendor_ht_cap;
 	const u8 *p2p;
 	const u8 *wfd;
@@ -60,6 +61,7 @@ struct ieee802_11_elems {
 	u8 ht_operation_len;
 	u8 vht_capabilities_len;
 	u8 vht_operation_len;
+	u8 vht_opmode_notif_len;
 	u8 vendor_ht_cap_len;
 	u8 p2p_len;
 	u8 wfd_len;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 6f7f777..a927ed3 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -764,6 +764,13 @@ struct ieee80211_vht_operation {
 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
 #define VHT_CAP_TX_ANTENNA_PATTERN                  ((u32) BIT(29))
 
+#define VHT_OPMODE_CHANNEL_WIDTH_MASK		    ((u8) BIT(6) | BIT(7))
+#define VHT_OPMODE_CHANNEL_RxNSS_MASK		    ((u8) BIT(1) | BIT(2) | BIT(3))
+#define VHT_OPMODE_NOTIF_RX_NSS_SHIFT		    4
+#define VHT_OPMODE_LEN				    1
+
+#define VHT_RX_NSS_MAX_STREAMS			    8
+
 /* VHT channel widths */
 #define VHT_CHANWIDTH_USE_HT	0
 #define VHT_CHANWIDTH_80MHZ	1
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 2f4536e..f4b4672 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1007,6 +1007,8 @@ struct hostapd_sta_add_params {
 	u16 listen_interval;
 	const struct ieee80211_ht_capabilities *ht_capabilities;
 	const struct ieee80211_vht_capabilities *vht_capabilities;
+	int vht_opmode_enabled;
+	u8 vht_opmode;
 	u32 flags; /* bitmask of WPA_STA_* flags */
 	int set; /* Set STA parameters instead of add */
 	u8 qosinfo;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 81f20b3..20642a1 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7347,6 +7347,12 @@ static int wpa_driver_nl80211_sta_add(void *priv,
 			params->vht_capabilities);
 	}
 
+	if (params->vht_opmode_enabled) {
+		wpa_printf(MSG_DEBUG, "  * opmode=%u", params->vht_opmode);
+		NLA_PUT_U8(msg, NL80211_ATTR_OPMODE_NOTIF,
+			   params->vht_opmode);
+	}
+
 	wpa_printf(MSG_DEBUG, "  * capability=0x%x", params->capability);
 	NLA_PUT_U16(msg, NL80211_ATTR_STA_CAPABILITY, params->capability);
 
-- 
1.7.9.5



From gustav.schaffter  Mon Feb  3 09:28:50 2014
From: gustav.schaffter (Gustav Schaffter)
Date: Mon, 3 Feb 2014 18:28:50 +0100
Subject: wpa_supplicant 1.0 fails to execute the 'up' routines.
Message-ID: <CACHkCZcgeFJXr8R0Md2QQZ7c5+cY7tDj-Stj_AegegWSEsLVfg@mail.gmail.com>

Hi, Guys.

I'm new to this list, as well as to wpa_supplicant. Please, bear with me.


My environment:
Raspbian on a Raspberry Pi.
# cat /etc/debian_version
7.2
# wpa_supplicant -v
wpa_supplicant v1.0


===================================================
My problem:

Using wpa_supplicant I can't get the 'pre-up', 'up' and 'post-up' routines
to execute.

The 'pre-down', 'down' and 'post-down' routines do get executed.
Only the 'up' routines fail to execute.


===================================================
Some examples:

This *will work*, so that both the 'up' and the 'down' routines will be
executed. It will of course *fail* to correctly configure the interface,
since wpa_supplicant isn't there to provide any credentials.



From j  Mon Feb  3 09:37:23 2014
From: j (Jouni Malinen)
Date: Mon, 3 Feb 2014 19:37:23 +0200
Subject: [PATCH] wpa_supplicant: Fix misplaced os_free
In-Reply-To: <1391429942-4190-1-git-send-email-prashanthkumar.kr@globaledgesoft.com>
References: <1391429942-4190-1-git-send-email-prashanthkumar.kr@globaledgesoft.com>
Message-ID: <20140203173723.GA5258@w1.fi>

On Mon, Feb 03, 2014 at 05:49:02PM +0530, Prashanth Kumar wrote:
> os_free has wfd_dev_info_hex as an argument which is defined within
> CONFIG_NO_STDOUT_DEBUG

Thanks, applied.

> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> @@ -1684,9 +1684,12 @@ static void wpas_dev_found(void *ctx, const u8 *addr,
> -#endif /* CONFIG_NO_STDOUT_DEBUG */
>  
> +#ifdef CONFIG_WIFI_DISPLAY
>  	os_free(wfd_dev_info_hex);
> +#endif /* CONFIG_WIFI_DISPLAY */
> +
> +#endif /* CONFIG_NO_STDOUT_DEBUG */

Though, I skipped the unnecessary #ifdef CONFIG_WIFI_DISPLAY to keep
this a bit nicer to look at.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Feb  3 09:37:46 2014
From: j (Jouni Malinen)
Date: Mon, 3 Feb 2014 19:37:46 +0200
Subject: [PATCH] BSD: Fix hostapd complier warning
In-Reply-To: <CAFk-A4m6ZA00y8uUBsixNmHL4RyoSMpyfiUCG16KHicgPhfB4A@mail.gmail.com>
References: <CAFk-A4m6ZA00y8uUBsixNmHL4RyoSMpyfiUCG16KHicgPhfB4A@mail.gmail.com>
Message-ID: <20140203173746.GB5258@w1.fi>

On Fri, Jan 31, 2014 at 12:32:47PM +0900, Masashi Honma wrote:
> The hostapd compilation displays a below warning On NetBSD 6.1.2.
> 
> ../src/drivers/driver_bsd.c:72:1: warning: 'get80211opmode' defined but not used
> 
> This patch solves it and moves other functions to appropriate position to
> reduce #ifdef.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From mvoteiza  Mon Feb  3 10:18:50 2014
From: mvoteiza (Mark Oteiza)
Date: Mon, 03 Feb 2014 13:18:50 -0500
Subject: [PATCH] wpa_supplicant: systemd service directives
In-Reply-To: <CAOpc7mHCOdJRmdnEE8xRawvqu6BeFv9qtKbj=Q8R4+AdmxA8WQ@mail.gmail.com>
	(Holger Schurig's message of "Mon, 3 Feb 2014 09:43:18 +0100")
References: <8761pdkqrb.fsf@holos.localdomain> <20140130113520.GA7542@w1.fi>
	<CAOpc7mHCOdJRmdnEE8xRawvqu6BeFv9qtKbj=Q8R4+AdmxA8WQ@mail.gmail.com>
Message-ID: <8738k012lx.fsf@holos.localdomain>

Holger Schurig <holgerschurig at gmail.com> writes:

>> $ man systemd.unit
>> No manual entry for systemd.unit
>
> It seems that you don't run systemd, because this man page comes with
> systemd. You can find all of it's manpages online as well, see
> http://0pointer.de/public/systemd-man/
>
> The one in question is
> http://0pointer.de/public/systemd-man/systemd.unit.html.

In addition to the documentation, perhaps examples from other projects
will help show how wpa_supplicant's dbus service is fine; the others
misuse Alias.

[/usr/lib/systemd/system]$ find -type f -name '*.service' -exec grep
'Alias' {} +
./wpa_supplicant at .service:Alias=multi-user.target.wants/wpa_supplicant at wlan0.service
./wpa_supplicant.service:Alias=dbus-fi.epitest.hostap.WPASupplicant.service
./avahi-daemon.service:Alias=dbus-org.freedesktop.Avahi.service
./wpa_supplicant-nl80211 at .service:Alias=multi-user.target.wants/wpa_supplicant-nl80211 at wlan0.service
./wpa_supplicant-wired at .service:Alias=multi-user.target.wants/wpa_supplicant-wired at wlan0.service

[/usr/lib/systemd/system]$ find -type f -name '*.service' -exec grep
'WantedBy' {} +
./sshd.service:WantedBy=multi-user.target
./ntpd.service:WantedBy=multi-user.target
./iptables.service:WantedBy=multi-user.target
./rfkill-block at .service:WantedBy=multi-user.target
./dhcpcd at .service:WantedBy=multi-user.target
./rsyncd.service:WantedBy=multi-user.target
./krb5-kpropd.service:WantedBy=multi-user.target
./systemd-readahead-drop.service:WantedBy=system-update.target
./dhcpcd.service:WantedBy=multi-user.target
./ftpd.service:WantedBy=multi-user.target
./lvm-monitoring.service:WantedBy=sysinit.target
./krb5-kadmind.service:WantedBy=multi-user.target
./wpa_supplicant.service:WantedBy=multi-user.target
./systemd-readahead-replay.service:WantedBy=default.target
./xinetd.service:WantedBy=multi-user.target
./ip6tables.service:WantedBy=multi-user.target
./getty at .service:WantedBy=getty.target
./avahi-daemon.service:WantedBy=multi-user.target
./atop.service:WantedBy=multi-user.target
./envoy at .service:WantedBy=multi-user.target
./console-shell.service:WantedBy=getty.target
./systemd-readahead-collect.service:WantedBy=default.target
./cpupower.service:WantedBy=multi-user.target
./bitlbee.service:WantedBy=multi-user.target
./lightd.service:WantedBy=multi-user.target
./debug-shell.service:WantedBy=sysinit.target
./connman-vpn.service:WantedBy=multi-user.target
./console-getty.service:WantedBy=getty.target
./gpm.service:WantedBy=multi-user.target
./ifplugd at .service:WantedBy=multi-user.target
./avahi-dnsconfd.service:WantedBy=multi-user.target
./nginx.service:WantedBy=multi-user.target
./mdadm.service:WantedBy=multi-user.target
./nscd.service:WantedBy=multi-user.target
./connman.service:WantedBy=multi-user.target
./rfkill-unblock at .service:WantedBy=multi-user.target
./krb5-kdc.service:WantedBy=multi-user.target
./mpd.service:WantedBy=multi-user.target
./ntpdate.service:WantedBy=multi-user.target
./vnstat.service:WantedBy=multi-user.target
./ppp at .service:WantedBy=multi-user.target

> But with all of this info, I don't see why this comment is necessary.
> And I don't know why the patched unit files are "systemd unit
> templates" (they use %I inside),but why they aren't named like
> template units: they lack the @ in their filename.

They are .in files, the build system renames them.


From holgerschurig  Mon Feb  3 11:39:44 2014
From: holgerschurig (Holger Schurig)
Date: Mon, 3 Feb 2014 20:39:44 +0100
Subject: wpa_supplicant 1.0 fails to execute the 'up' routines.
In-Reply-To: <CACHkCZcgeFJXr8R0Md2QQZ7c5+cY7tDj-Stj_AegegWSEsLVfg@mail.gmail.com>
References: <CACHkCZcgeFJXr8R0Md2QQZ7c5+cY7tDj-Stj_AegegWSEsLVfg@mail.gmail.com>
Message-ID: <CAOpc7mEFQRjehAqGPGHx-NjWXOWasNqsQ5We44AjYW0=HLo4nw@mail.gmail.com>

> Why do the 'up' echoes not show up?

You're on Debian or it's lesser descendents (Ubuntu, laught). And
their scripts are involved into your problem. It's not
wpa_supplicant's fault what you see!

Now, you can use "ifup -v" for verbose operation and/or put a "set -x"
to get a trace near the beginning of /etc/network/if-up.d/<script>. It
forgot the actual name, but <script> might probably be named
wpasupplicant or similar.


From dimitrysh  Mon Feb  3 13:30:46 2014
From: dimitrysh (Dmitry Shmidt)
Date: Mon, 3 Feb 2014 13:30:46 -0800
Subject: [PATCH] wpa_supplicant: Add DFS indicator to get_capability freq
Message-ID: <20140203213429.0B00013F9B7@ushik.mtv.corp.google.com>

Change-Id: Ic65683aaeef7dd2be4c375695b668e59736e8ec3
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 wpa_supplicant/ctrl_iface.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 9a3cbea..ca57c25 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3158,10 +3158,13 @@ static int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s,
 		for (i = 0; i < wpa_s->hw.modes[j].num_channels; i++) {
 			if (chnl[i].flag & HOSTAPD_CHAN_DISABLED)
 				continue;
-			ret = os_snprintf(pos, end - pos, " %d = %d MHz%s\n",
+			ret = os_snprintf(pos, end - pos, " %d = %d MHz%s%s\n",
 					  chnl[i].chan, chnl[i].freq,
 					  chnl[i].flag & HOSTAPD_CHAN_NO_IBSS ?
-					  " (NO_IBSS)" : "");
+					  " (NO_IBSS)" : "",
+					  chnl[i].flag & HOSTAPD_CHAN_DFS_MASK ?
+					  " (DFS)" : "");
+
 			if (ret < 0 || ret >= end - pos)
 				return pos - buf;
 			pos += ret;
-- 
1.9.0.rc1.175.g0b1dcb5



From gustav.schaffter  Mon Feb  3 14:05:38 2014
From: gustav.schaffter (Gustav Schaffter)
Date: Mon, 3 Feb 2014 23:05:38 +0100
Subject: wpa_supplicant 1.0 fails to execute the 'up' routines.
In-Reply-To: <CAOpc7mEFQRjehAqGPGHx-NjWXOWasNqsQ5We44AjYW0=HLo4nw@mail.gmail.com>
References: <CACHkCZcgeFJXr8R0Md2QQZ7c5+cY7tDj-Stj_AegegWSEsLVfg@mail.gmail.com>
	<CAOpc7mEFQRjehAqGPGHx-NjWXOWasNqsQ5We44AjYW0=HLo4nw@mail.gmail.com>
Message-ID: <CACHkCZdHB0pPnBBX-yMEd4nftp3qyf9daC9eStFqD+YYcnV_uA@mail.gmail.com>

Thanks for replying, Holger.

Your advice of using the -x was a good one. ;-)

I little bit more peekin' an' pokin' tells me that it's probably not a
problem within the /etc/network/if-up.d/wpasupplicant script. (BTW, this
'script' is a symbolic link to the 'real' script file
/etc/wpa_supplicant/ifupdown.sh which I believe is part of the
wpasupplicant suite.)

Anyway, AFAICU the problem lies somewhere in the ifupdown software.

Having read
http://pureperl.blogspot.fr/2013/01/the-debian-ifupdown-package-and.html I
start to understand that ifupdown may not be extremely well maintained
today. (My current version, 0.7.8, includes a copyright statement valid
1999-2007.)

It seems that Kyle Moffett, the author of the Blog entry is (was?) pretty
unhappy with the source code he finally found for ifupdown and that he
intended to do a 'Next Gen' version of ifupdown in Python. Unfortunately,
it looks like his initiative has stalled since about a year ago.

Wonder if I can somehow switch over to use the software in iproute2 instead
of ifupdown?



Anyway, Holger, thanks for your pointers. That was exactly what I needed.


Regards
GuS

P.S. Yes, Raspbian is a 'descendent' of Debian and built explicitly for the
Raspberry Pi computer.



On Mon, Feb 3, 2014 at 8:39 PM, Holger Schurig <holgerschurig at gmail.com>wrote:

> > Why do the 'up' echoes not show up?
>
> You're on Debian or it's lesser descendents (Ubuntu, laught). And
> their scripts are involved into your problem. It's not
> wpa_supplicant's fault what you see!
>
> Now, you can use "ifup -v" for verbose operation and/or put a "set -x"
> to get a trace near the beginning of /etc/network/if-up.d/<script>. It
> forgot the actual name, but <script> might probably be named
> wpasupplicant or similar.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140203/01850174/attachment.htm>


From dimitrysh  Mon Feb  3 13:30:46 2014
From: dimitrysh (Dmitry Shmidt)
Date: Mon, 3 Feb 2014 13:30:46 -0800
Subject: [PATCH] wpa_supplicant: Add DFS indicator to get_capability freq
Message-ID: <20140203234020.6D33E13F9B7@ushik.mtv.corp.google.com>

Change-Id: Ic65683aaeef7dd2be4c375695b668e59736e8ec3
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 wpa_supplicant/ctrl_iface.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 9a3cbea..78a0ce0 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3158,10 +3158,13 @@ static int ctrl_iface_get_capability_freq(struct wpa_supplicant *wpa_s,
 		for (i = 0; i < wpa_s->hw.modes[j].num_channels; i++) {
 			if (chnl[i].flag & HOSTAPD_CHAN_DISABLED)
 				continue;
-			ret = os_snprintf(pos, end - pos, " %d = %d MHz%s\n",
+			ret = os_snprintf(pos, end - pos, " %d = %d MHz%s%s\n",
 					  chnl[i].chan, chnl[i].freq,
 					  chnl[i].flag & HOSTAPD_CHAN_NO_IBSS ?
-					  " (NO_IBSS)" : "");
+					  " (NO_IBSS)" : "",
+					  chnl[i].flag & HOSTAPD_CHAN_RADAR ?
+					  " (DFS)" : "");
+
 			if (ret < 0 || ret >= end - pos)
 				return pos - buf;
 			pos += ret;
-- 
1.9.0.rc1.175.g0b1dcb5



From holgerschurig  Mon Feb  3 23:09:53 2014
From: holgerschurig (Holger Schurig)
Date: Tue, 4 Feb 2014 08:09:53 +0100
Subject: wpa_supplicant 1.0 fails to execute the 'up' routines.
In-Reply-To: <CACHkCZdHB0pPnBBX-yMEd4nftp3qyf9daC9eStFqD+YYcnV_uA@mail.gmail.com>
References: <CACHkCZcgeFJXr8R0Md2QQZ7c5+cY7tDj-Stj_AegegWSEsLVfg@mail.gmail.com>
	<CAOpc7mEFQRjehAqGPGHx-NjWXOWasNqsQ5We44AjYW0=HLo4nw@mail.gmail.com>
	<CACHkCZdHB0pPnBBX-yMEd4nftp3qyf9daC9eStFqD+YYcnV_uA@mail.gmail.com>
Message-ID: <CAOpc7mEc2aZTq5Nv3s-e2fm=b1U=EjbZhFxYzneFJ1Vjyhm51g@mail.gmail.com>

Gustav,

no, /etc/wpa_supplicant/ifupdown.sh might come with Debian's
wpasupplicant_*.deb file, but it's still not from the hostap project.
Network bringup is one of the areas where the distributions do things
quite differently, e.g. Redhat derived ones with /etc/sysconfig/* and
Debian derived ones with /etc/network/interfaces ... and some (e.g.
Arch) leave this as an exercise to the user. :-)

I actually like that Debian doesn't have a hard dependency on Python,
I have embedded Debian systems without a Python on their sdcard /
eMMC.


iproute2 is just the powerful, underdocumented, not so loved successor
of ifconfig/route. It doesn't define a configuration file format to
store persistent information (e.g. ip addresses, passphrases) between
boots.


From holgerschurig  Mon Feb  3 23:18:58 2014
From: holgerschurig (Holger Schurig)
Date: Tue, 4 Feb 2014 08:18:58 +0100
Subject: wpa_supplicant 1.0 fails to execute the 'up' routines.
In-Reply-To: <CAOpc7mEc2aZTq5Nv3s-e2fm=b1U=EjbZhFxYzneFJ1Vjyhm51g@mail.gmail.com>
References: <CACHkCZcgeFJXr8R0Md2QQZ7c5+cY7tDj-Stj_AegegWSEsLVfg@mail.gmail.com>
	<CAOpc7mEFQRjehAqGPGHx-NjWXOWasNqsQ5We44AjYW0=HLo4nw@mail.gmail.com>
	<CACHkCZdHB0pPnBBX-yMEd4nftp3qyf9daC9eStFqD+YYcnV_uA@mail.gmail.com>
	<CAOpc7mEc2aZTq5Nv3s-e2fm=b1U=EjbZhFxYzneFJ1Vjyhm51g@mail.gmail.com>
Message-ID: <CAOpc7mFR-P1zdH+44k_73CF6=qRtGeP6YRQnY_KwDA9js9sXeA@mail.gmail.com>

> http://pureperl.blogspot.fr/2013/01/the-debian-ifupdown-package-and.html

Nice pointer, he has many good ideas for improvement, but some things
stick out like a sore eye:

* he wants to do dependecy management ... we have something for this:
systemd unit files
* he says (rightfully) that if you brought up a dhcp (or
wpa_supplicant) network, change it's configuration to
non-dhcp/non-wpa_supplicant and bring it down, that dhcp-client /
wpa_supplicant isn't stopped. Again, this is a solved problem if you
let systemd bring up/down the interfaces.
* network configuration was and is a wide and deep field, e.g. look at
Cisco Router stuff. It either is simple and cannot handle all cases
and needs shell-plugins. Or it is feature rich, vast and overly
complicated. I don't believe in a one-does-it-all tool.


(last post from me on this subject, as this isn't exactly on-topic for
this list)


From jithu  Tue Feb  4 01:09:00 2014
From: jithu (Jithu Jance)
Date: Tue, 4 Feb 2014 14:39:00 +0530
Subject: [PATCH 1/2] P2P: Addressing few issues seen with Broadcast SD
Message-ID: <137202264661b954a4fa6ffea014c5182616aa68.1391502949.git.jithu@broadcom.com>

1) Suppose we have multiple peers and we have peers advertising
SD capability, but no services registered for adverstising.
In this case, even if there are mutliple broadcast queries set,
we might end up sending only the lastly added Broadcast to the
same device (Since SD_INFO won't get set for the first broadcast)

2) Some times it is seen that before advancing to next device in the
list, the scan results come and updates SD_SCHEDULE flag. This will
result in sending the already sent query to the same device without
giving chance to other devices. This issue again is seen with peer
devices advertising SD capability without any services registered.

Signed-hostap: Jithu Jance <jithu at broadcom.com>
---
 src/p2p/p2p.c    |   19 +++++++++----------
 src/p2p/p2p_i.h  |    6 ++++++
 src/p2p/p2p_sd.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 63 insertions(+), 14 deletions(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 8aabfc0..9b22e22 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -732,9 +732,6 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,

 	p2p_parse_free(&msg);

-	if (p2p_pending_sd_req(p2p, dev))
-		dev->flags |= P2P_DEV_SD_SCHEDULE;
-
 	if (dev->flags & P2P_DEV_REPORTED)
 		return 0;

@@ -2384,6 +2381,7 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)

 	p2p->go_timeout = 100;
 	p2p->client_timeout = 20;
+	p2p->num_p2p_sd_queries = 0;

 	p2p_dbg(p2p, "initialized");
 	p2p_channels_dump(p2p, "channels", &p2p->cfg->channels);
@@ -2618,13 +2616,18 @@ void p2p_continue_find(struct p2p_data *p2p)
 	struct p2p_device *dev;
 	p2p_set_state(p2p, P2P_SEARCH);
 	dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
-		if (dev->flags & P2P_DEV_SD_SCHEDULE) {
+		if (dev->sd_pending_bcast_queries == 0) {
+			/* Initialize with Total number of Registered BCAST Queries*/
+			dev->sd_pending_bcast_queries = p2p->num_p2p_sd_queries;
+		}
+
+		if (dev->sd_pending_bcast_queries > 0) {
 			if (p2p_start_sd(p2p, dev) == 0)
 				return;
 			else
 				break;
 		} else if (dev->req_config_methods &&
-			   !(dev->flags & P2P_DEV_PD_FOR_JOIN)) {
+		   !(dev->flags & P2P_DEV_PD_FOR_JOIN)) {
 			p2p_dbg(p2p, "Send pending Provision Discovery Request to "
 				MACSTR " (config methods 0x%x)",
 				MAC2STR(dev->info.p2p_device_addr),
@@ -2646,7 +2649,6 @@ static void p2p_sd_cb(struct p2p_data *p2p, int success)

 	if (!success) {
 		if (p2p->sd_peer) {
-			p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 			p2p->sd_peer = NULL;
 		}
 		p2p_continue_find(p2p);
@@ -3457,7 +3459,7 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  "country=%c%c\n"
 			  "oper_freq=%d\n"
 			  "req_config_methods=0x%x\n"
-			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
+			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
 			  "status=%d\n"
 			  "wait_count=%u\n"
 			  "invitation_reqs=%u\n",
@@ -3480,9 +3482,6 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  dev->flags & P2P_DEV_REPORTED ? "[REPORTED]" : "",
 			  dev->flags & P2P_DEV_NOT_YET_READY ?
 			  "[NOT_YET_READY]" : "",
-			  dev->flags & P2P_DEV_SD_INFO ? "[SD_INFO]" : "",
-			  dev->flags & P2P_DEV_SD_SCHEDULE ? "[SD_SCHEDULE]" :
-			  "",
 			  dev->flags & P2P_DEV_PD_PEER_DISPLAY ?
 			  "[PD_PEER_DISPLAY]" : "",
 			  dev->flags & P2P_DEV_PD_PEER_KEYPAD ?
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index 3e105eb..926fdd9 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -105,6 +105,7 @@ struct p2p_device {

 	u8 go_timeout;
 	u8 client_timeout;
+	int sd_pending_bcast_queries;
 };

 struct p2p_sd_query {
@@ -250,6 +251,11 @@ struct p2p_data {
 	 */
 	struct p2p_sd_query *sd_query;

+	/**
+	 * total number of sd broadcast queries present in the list
+	 */
+	int num_p2p_sd_queries;
+
 	/* GO Negotiation data */

 	/**
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 0e0c7f1..6dd10e8 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -52,6 +52,7 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 {
 	struct p2p_sd_query *q;
 	int wsd = 0;
+	int count = 0;

 	if (!(dev->info.dev_capab & P2P_DEV_CAPAB_SERVICE_DISCOVERY))
 		return NULL; /* peer does not support SD */
@@ -64,8 +65,17 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 		/* Use WSD only if the peer indicates support or it */
 		if (q->wsd && !wsd)
 			continue;
-		if (q->for_all_peers && !(dev->flags & P2P_DEV_SD_INFO))
-			return q;
+		/* if the query is a broadcast query */
+		if (q->for_all_peers) {
+			/* check if there are any broadcast queries pending for this device */
+			if (dev->sd_pending_bcast_queries <= 0)
+				return NULL;
+			/* query number that needs to be send to the device */
+			else if (count == (dev->sd_pending_bcast_queries - 1)) {
+				return q;
+			} else
+				count++;
+		}
 		if (!q->for_all_peers &&
 		    os_memcmp(q->peer, dev->info.p2p_device_addr, ETH_ALEN) ==
 		    0)
@@ -80,10 +90,25 @@ static int p2p_unlink_sd_query(struct p2p_data *p2p,
 			       struct p2p_sd_query *query)
 {
 	struct p2p_sd_query *q, *prev;
+	struct p2p_device *dev;
+	int query_number = 0;
 	q = p2p->sd_queries;
 	prev = NULL;
 	while (q) {
 		if (q == query) {
+			/* if the query is a broadcast query decrease one from all the devices */
+			if (query->for_all_peers) {
+				p2p->num_p2p_sd_queries--;
+				dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
+					if (query_number <= (dev->sd_pending_bcast_queries - 1)) {
+						/*
+						 * Query not yet send to the device and is to be removed.
+						 * So update the pending count.
+						 */
+						dev->sd_pending_bcast_queries--;
+					}
+				}
+			}
 			if (prev)
 				prev->next = q->next;
 			else
@@ -92,6 +117,8 @@ static int p2p_unlink_sd_query(struct p2p_data *p2p,
 				p2p->sd_query = NULL;
 			return 1;
 		}
+		if (q->for_all_peers)
+			query_number++;
 		prev = q;
 		q = q->next;
 	}
@@ -262,6 +289,16 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
 		ret = -1;
 	}

+	/* Update the pending Bcast sd query count for this device */
+	dev->sd_pending_bcast_queries--;
+
+	/*
+	 * If there are no pending bcast query for this device,
+	 * mark it as done (-1).
+	 */
+	if (dev->sd_pending_bcast_queries == 0)
+		dev->sd_pending_bcast_queries = -1;
+
 	wpabuf_free(req);

 	return ret;
@@ -841,8 +878,15 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,

 	if (dst == NULL) {
 		struct p2p_device *dev;
-		dl_list_for_each(dev, &p2p->devices, struct p2p_device, list)
-			dev->flags &= ~P2P_DEV_SD_INFO;
+		p2p->num_p2p_sd_queries++;
+
+		/* Update all the devices for the newly added bcast query */
+		dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
+			if (dev->sd_pending_bcast_queries <= 0)
+				dev->sd_pending_bcast_queries = 1;
+			else
+				dev->sd_pending_bcast_queries++;
+		}
 	}

 	return q;
--
1.7.9.5



From jithu  Tue Feb  4 01:09:41 2014
From: jithu (Jithu Jance)
Date: Tue, 4 Feb 2014 14:39:41 +0530
Subject: [PATCH 2/2] P2P: Fix regression seen with Service Discovery
In-Reply-To: <137202264661b954a4fa6ffea014c5182616aa68.1391502949.git.jithu@broadcom.com>
References: <137202264661b954a4fa6ffea014c5182616aa68.1391502949.git.jithu@broadcom.com>
Message-ID: <4b19dee4cc4140cde4074259ce93489280adbcf1.1391502949.git.jithu@broadcom.com>

Signed-hostap: Jithu Jance <jithu at broadcom.com>
---
 src/p2p/p2p_sd.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 6dd10e8..20865fe 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -145,6 +145,7 @@ void p2p_free_sd_queries(struct p2p_data *p2p)
 		q = q->next;
 		p2p_free_sd_query(prev);
 	}
+	p2p->num_p2p_sd_queries = 0;
 }


--
1.7.9.5



From j  Tue Feb  4 06:09:48 2014
From: j (Jouni Malinen)
Date: Tue, 4 Feb 2014 16:09:48 +0200
Subject: hostapd/wpa_supplicant - new release v2.1
Message-ID: <20140204140948.GA21873@w1.fi>

New versions of wpa_supplicant and hostapd were just
released and are now available from http://w1.fi/

This release follows the style used with v2.0, but it was not really
supposed to take this long between the releases.. We'll see how it goes
with v2.2, but all the new test scripting and lightweight release
process should make it easier to get to a bit more frequent sequence
(which was the initial plan for 2.x).

With this release, the old 1.x branch is considered to have reached its
end-of-life. If you are still using 1.x (or any older version), you are
recommended to update to the 2.1 release since there will be no upstream
support for the older branches.

There has been quite a few new features and fixes since the 2.0 release
a year ago. The following ChangeLog entries highlight some of the main
changes:

hostapd:
* added support for simultaneous authentication of equals (SAE) for
  stronger password-based authentication with WPA2-Personal
* added nl80211 functionality
  - VHT configuration for nl80211
  - support split wiphy dump
  - driver-based MAC ACL
  - QoS Mapping configuration
* added fully automated regression testing with mac80211_hwsim
* allow ctrl_iface group to be specified on command line (-G<group>)
* allow single hostapd process to control independent WPS interfaces
  (wps_independent=1) instead of synchronized operations through all
  configured interfaces within a process
* avoid processing received management frames multiple times when using
  nl80211 with multiple BSSes
* added support for DFS (processing radar detection events, CAC, channel
  re-selection)
* added EAP-EKE server
* added automatic channel selection (ACS)
* added option for using per-BSS (vif) configuration files with
  -b<phyname>:<config file name>
* extended global control interface ADD/REMOVE commands to allow BSSes
  of a radio to be removed individually without having to add/remove all
  other BSSes of the radio at the same time
* added support for sending debug info to Linux tracing (-T on command
  line)
* replace dump_file functionality with same information being available
  through the hostapd control interface
* added support for using Protected Dual of Public Action frames for
  GAS/ANQP exchanges when PMF is enabled
* added support for WPS+NFC updates
  - improved protocol
  - option to fetch and report alternative carrier records for external
    NFC operations
* various bug fixes

wpa_supplicant:
* added support for simultaneous authentication of equals (SAE) for
  stronger password-based authentication with WPA2-Personal
* improved P2P negotiation and group formation robustness
  - avoid unnecessary Dialog Token value changes during retries
  - avoid more concurrent scanning cases during full group formation
    sequence
  - do not use potentially obsolete scan result data from driver
    cache for peer discovery/updates
  - avoid undesired re-starting of GO negotiation based on Probe
    Request frames
  - increase GO Negotiation and Invitation timeouts to address busy
    environments and peers that take long time to react to messages,
    e.g., due to power saving
  - P2P Device interface type
* improved P2P channel selection (use more peer information and allow
  more local options)
* added support for optional per-device PSK assignment by P2P GO
  (wpa_cli p2p_set per_sta_psk <0/1>)
* added P2P_REMOVE_CLIENT for removing a client from P2P groups
  (including persistent groups); this can be used to securely remove
  a client from a group if per-device PSKs are used
* added more configuration flexibility for allowed P2P GO/client
  channels (p2p_no_go_freq list and p2p_add_cli_chan=0/1)
* added nl80211 functionality
  - VHT configuration for nl80211
  - MFP (IEEE 802.11w) information for nl80211 command API
  - support split wiphy dump
  - FT (IEEE 802.11r) with driver-based SME
  - use advertised number of supported concurrent channels
  - QoS Mapping configuration
* improved TDLS negotiation robustness
* added more TDLS peer parameters to be configured to the driver
* optimized connection time by allowing recently received scan results
  to be used instead of having to run through a new scan
* fixed ctrl_iface BSS command iteration with RANGE argument and no
  exact matches; also fixed argument parsing for some cases with
  multiple arguments
* added 'SCAN TYPE=ONLY' ctrl_iface command to request manual scan
  without executing roaming/network re-selection on scan results
* added Session-Id derivation for EAP peer methods
* added fully automated regression testing with mac80211_hwsim
* changed configuration parser to reject invalid integer values
* allow AP/Enrollee to be specified with BSSID instead of UUID for
  WPS ER operations
* disable network block temporarily on repeated connection failures
* changed the default driver interface from wext to nl80211 if both are
  included in the build
* remove duplicate networks if WPS provisioning is run multiple times
* remove duplicate networks when Interworking network selection uses the
  same network
* added global freq_list configuration to allow scan frequencies to be
  limited for all cases instead of just for a specific network block
* added support for BSS Transition Management
* added option to use "IFNAME=<ifname> " prefix to use the global
  control interface connection to perform per-interface commands;
  similarly, allow global control interface to be used as a monitor
  interface to receive events from all interfaces
* fixed OKC-based PMKSA cache entry clearing
* fixed TKIP group key configuration with FT
* added support for using OCSP stapling to validate server certificate
  (ocsp=1 as optional and ocsp=2 as mandatory)
* added EAP-EKE peer
* added peer restart detection for IBSS RSN
* added domain_suffix_match (and domain_suffix_match2 for Phase 2
  EAP-TLS) to specify additional constraint for the server certificate
  domain name
* added support for external SIM/USIM processing in EAP-SIM, EAP-AKA,
  and EAP-AKA' (CTRL-REQ-SIM and CTRL-RSP-SIM commands over control
  interface)
* added global bgscan configuration option as a default for all network
  blocks that do not specify their own bgscan parameters
* added D-Bus methods for TDLS
* added more control to scan requests
  - "SCAN freq=<freq list>" can be used to specify which channels are
    scanned (comma-separated frequency ranges in MHz)
  - "SCAN passive=1" can be used to request a passive scan (no Probe
    Request frames are sent)
  - "SCAN use_id" can be used to request a scan id to be returned and
    included in event messages related to this specific scan operation
  - "SCAN only_new=1" can be used to request the driver/cfg80211 to
    report only BSS entries that have been updated during this scan
    round
  - these optional arguments to the SCAN command can be combined with
    each other
* modified behavior on externally triggered scans
  - avoid concurrent operations requiring full control of the radio when
    an externally triggered scan is detected
  - do not use results for internal roaming decision
* added a new cred block parameter 'temporary' to allow credential
  blocks to be stored separately even if wpa_supplicant configuration
  file is used to maintain other network information
* added "radio work" framework to schedule exclusive radio operations
  for off-channel functionality
  - reduce issues with concurrent operations that try to control which
    channel is used
  - allow external programs to request exclusive radio control in a way
    that avoids conflicts with wpa_supplicant
* added support for using Protected Dual of Public Action frames for
  GAS/ANQP exchanges when associated with PMF
* added support for WPS+NFC updates and P2P+NFC
  - improved protocol for WPS
  - P2P group formation/join based on NFC connection handover
  - new IPv4 address assignment for P2P groups (ip_addr_* configuration
    parameters on the GO) to replace DHCP
  - option to fetch and report alternative carrier records for external
    NFC operations
* various bug fixes


git-shortlog for 2.0 -> 2.1:

Well.. There were 1646 commits, so the list would be too long for this
email. Anyway, if you are interested in the details, they are available
in the hostap.git repository. diffstat has following to say about the
changes:
 498 files changed, 59457 insertions(+), 12356 deletions(-)

-- 
Jouni Malinen                                            PGP id EFC895FA


From mike.auty  Tue Feb  4 09:05:57 2014
From: mike.auty (Mike Auty)
Date: Tue, 04 Feb 2014 17:05:57 +0000
Subject: wpa_supplicant: Experimenting with wifi_display
Message-ID: <52F11DF5.8000005@gmail.com>

Hi there,

I've recently been trying out the wifi_display support in wpa_supplicant
(I just tested this with wpa_supplicant-2.1).  I realize from the lack
of documentation that this is still under development and not at all
ready for bug posts or similar, but I thought I'd try it and see where I
could get to in its current state.

There appear to be a number of calls that don't sufficiently check the
validity of the variables they're handed, and attempting to use
openwfd_p2pd I end up segfaulting in p2p_set_wfd_dev_info in p2p.c.
Tracing the call back (full bt attached for those that are interested) I
get to wifi_display_update_wfd_ie in wifi_display.c which had global
with p2p as null (global from gdb attached too).

The list of commands openwfd uses are as follows:

GET wifi_display
SET ap_scan 1
SET device_name some-random-name
SET device_type 1-0050F204-1
SET wifi_display 1

That last one triggers the segfault, presumably because no p2p
connection has been setup already?  My knowledge of Wifi Direct is
limited though, so that's about as far as i can get.

Has anyone else gotten wifi_display to work?  If so are they using
custom software or openwfd?  Is openwfd making the right calls to
wpa_supplicant?  If so, could someone help me figure out why p2p isn't
being setup properly, and where it should be setup for this call?

Any help would be greatly appreciated!  5:)

Mike  5:)

-------------- next part --------------
(gdb) bt full
#0  p2p_set_wfd_dev_info (p2p=0x0, elem=0x0) at ../src/p2p/p2p.c:4278
No locals.
#1  0x0000000000445e2d in wifi_display_update_wfd_ie (global=0x7517b0) at wifi_display.c:63
        ie = <optimized out>
        buf = <optimized out>
        len = <optimized out>
        plen = <optimized out>
#2  0x00000000004463c0 in wifi_display_enable (global=<optimized out>, enabled=<optimized out>) at wifi_display.c:190
No locals.
#3  0x00000000004943f8 in wpa_supplicant_ctrl_iface_set (cmd=0x7fffffffcad4 "wifi_display", wpa_s=0x7519d0) at ctrl_iface.c:443
        value = 0x7fffffffcae1 "1"
        ret = 0
#4  wpa_supplicant_ctrl_iface_process (wpa_s=wpa_s at entry=0x7519d0, buf=<optimized out>, buf at entry=0x7fffffffcad0 "SET wifi_display", resp_len=resp_len at entry=0x7fffffffc988) at ctrl_iface.c:5817
        reply = 0x777cf0 "OK\n\366\377\177"
        reply_len = <optimized out>
#5  0x0000000000497762 in wpa_supplicant_ctrl_iface_receive (sock=16, eloop_ctx=0x7519d0, sock_ctx=0x76f6b0) at ctrl_iface_unix.c:194
        wpa_s = <optimized out>
        priv = 0x76f6b0
        buf = "SET wifi_display\000\061\000\060\065\060F204-1\000ame\000\313\377\377\377\177\000\000Q\000\000\000\000\000\000\000P\004w\000\000\000\000\000x\202A", '\000' <repeats 13 times>, "\030\000\000\000\060\000\000\000\240\314\377\377\377\177\000\000\300\313\377\377\377\177\000\000wlan0: \000\001\000\000\000\000\000\000\000P\004w\000\000\000\000\000\357|I\000\000\000\000\000\021\000\000\000\000\000\000\000\260\366v", '\000' <repeats 13 times>, "\360|w\000\000\000\000\000\320\031u\000\000\000\000\000\003\000\000\000\000\000\000\000\371(O\000\000\000\000\000\001\000\000\000\000\000\000\000P\004w\000\000\000\000\000"...
        res = <optimized out>
        from = {sun_family = 1, 
          sun_path = "/tmp/wpa_ctrl_16364-1\000\000\220\377\367\377\177\000\000\060\313\377\377\377\177\000\000\023\325\300\366\377\177\000\000Y\000\000\000\000\000\000\000\n\000\000\000\000\000\000\000\320\031u\000\000\000\000\000%\355\300\366\377\177\000\000\240\202\363\366\377\177\000\000\203\360\300\366\377\177\000\000\240\202\363\366\377\177\000\000\002\000\000\000\000"}
        fromlen = 24
        reply = 0x0
        reply_buf = 0x0
        reply_len = 0
        new_attached = 0
#6  0x00000000004195d4 in eloop_sock_table_dispatch (table=table at entry=0x750548 <eloop+8>, fds=fds at entry=0x753430) at ../src/utils/eloop.c:393
        i = 6
#7  0x0000000000419fc7 in eloop_run () at ../src/utils/eloop.c:862
        timeout = <optimized out>
        rfds = 0x753430
        wfds = 0x7700d0
        efds = 0x770160
        _tv = {tv_sec = 9, tv_usec = 214694}
        res = 1
        tv = <optimized out>
        now = {sec = 23579, usec = 390761}
#8  0x00000000004b3ef1 in wpa_supplicant_run (global=global at entry=0x7517b0) at wpa_supplicant.c:3874
        wpa_s = <optimized out>
#9  0x000000000040f931 in main (argc=<optimized out>, argv=<optimized out>) at main.c:329
        c = <optimized out>
        i = 1
        ifaces = 0x751010
        iface = <optimized out>
        iface_count = <optimized out>
        exitcode = <optimized out>
        params = {daemonize = 0, wait_for_monitor = 0, pid_file = 0x0, wpa_debug_level = 1, wpa_debug_show_keys = 0, wpa_debug_timestamp = 0, ctrl_interface = 0x0, ctrl_interface_group = 0x0, 
          dbus_ctrl_interface = 0, wpa_debug_file_path = 0x0, wpa_debug_syslog = 0, wpa_debug_tracing = 0, override_driver = 0x0, override_ctrl_interface = 0x0, entropy_file = 0x0}
        global = 0x7517b0

-------------- next part --------------
(gdb) inspect *global
$5 = {ifaces = 0x72c970, params = {daemonize = 0, wait_for_monitor = 0, pid_file = 0x0, wpa_debug_level = 1, wpa_debug_show_keys = 0, wpa_debug_timestamp = 0, ctrl_interface = 0x0, dbus_ctrl_interface = 0, 
    wpa_debug_file_path = 0x0, wpa_debug_syslog = 0, wpa_debug_tracing = 0, override_driver = 0x0, override_ctrl_interface = 0x0, entropy_file = 0x0}, ctrl_iface = 0x72c920, dbus = 0x0, drv_priv = 0x72c940, 
  drv_count = 4, suspend_time = {sec = 0, usec = 0}, p2p = 0x0, p2p_init_wpa_s = 0x0, p2p_group_formation = 0x0, p2p_dev_addr = "\000\000\000\000\000", p2p_srv_bonjour = {next = 0x72c850, prev = 0x72c850}, 
  p2p_srv_upnp = {next = 0x72c860, prev = 0x72c860}, p2p_disabled = 0, cross_connection = 0, p2p_disallow_freq = 0x0, num_p2p_disallow_freq = 0, conc_pref = WPA_CONC_PREF_NOT_SET, p2p_cb_on_scan_complete = 0, 
  wifi_display = 1, wfd_subelem = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}



From sw  Wed Feb  5 09:10:09 2014
From: sw (Simon Wunderlich)
Date: Wed,  5 Feb 2014 18:10:09 +0100
Subject: [PATCH 3/4] hostapd: allow to switch to usable DFS channels
In-Reply-To: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391620210-15506-4-git-send-email-sw@simonwunderlich.de>

If channels are "available", change to "usable" DFS channels as a
fallback too. This requires CAC, but it is still better to do that
instead of stopping service completely.

Signed-off-by: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 6cb8915..5edf53a 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -724,9 +724,32 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 					skip_radar);
 
 	if (!channel) {
-		/* FIXME: Wait for channel(s) to become available */
+		/* if there is no channel to switch immediately to, check
+		 * if there is another channel where we can switch even if
+		 * it requires to perform a CAC first. */
+		skip_radar = 0;
+		channel = dfs_get_valid_channel(iface, &secondary_channel,
+						&vht_oper_centr_freq_seg0_idx,
+						&vht_oper_centr_freq_seg1_idx,
+						skip_radar);
+		if (!channel) {
+			/* FIXME: Wait for channel(s) to become available */
+			hostapd_disable_iface(iface);
+			return err;
+
+		}
+
+		iface->freq = channel->freq;
+		iface->conf->channel = channel->chan;
+		iface->conf->secondary_channel = secondary_channel;
+		iface->conf->vht_oper_centr_freq_seg0_idx =
+			vht_oper_centr_freq_seg0_idx;
+		iface->conf->vht_oper_centr_freq_seg1_idx =
+			vht_oper_centr_freq_seg1_idx;
+
 		hostapd_disable_iface(iface);
-		return err;
+		hostapd_enable_iface(iface);
+		return 0;
 	}
 
 	wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
-- 
1.7.10.4



From sw  Wed Feb  5 09:10:10 2014
From: sw (Simon Wunderlich)
Date: Wed,  5 Feb 2014 18:10:10 +0100
Subject: [PATCH 4/4] hostapd: terminate hostapd when no channel is available
In-Reply-To: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391620210-15506-5-git-send-email-sw@simonwunderlich.de>

Until hostapd is able to restart service on a channel (e.g. by reacting
to an event that a DFS non-occupancy period is over), better shut down
hostapd when no channel is available anymore.

The current behaviour, disabling the interface, will just lead to
hostapd hanging without recovering frmo this state. If hostapd shuts
down, userspace can at least work around and restart hostapd when
channels are available again.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 5edf53a..3ef5be6 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -10,6 +10,7 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
+#include "utils/eloop.h"
 #include "common/ieee802_11_defs.h"
 #include "common/wpa_ctrl.h"
 #include "hostapd.h"
@@ -734,7 +735,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 						skip_radar);
 		if (!channel) {
 			/* FIXME: Wait for channel(s) to become available */
-			hostapd_disable_iface(iface);
+			eloop_terminate();
 			return err;
 
 		}
@@ -776,7 +777,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 
 	if (err) {
 		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
-		hostapd_disable_iface(iface);
+		eloop_terminate();
 		return err;
 	}
 
-- 
1.7.10.4



From sw  Wed Feb  5 09:10:08 2014
From: sw (Simon Wunderlich)
Date: Wed,  5 Feb 2014 18:10:08 +0100
Subject: [PATCH 2/4] hostapd: allow to switch to DFS channels if available
In-Reply-To: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391620210-15506-3-git-send-email-sw@simonwunderlich.de>

If DFS channels are marked as "available", an AP can switch to them
immediately without performing CAC. Therefore, the channel selection
function should consider these channels even though these are radar
channels.

Signed-off-by: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index b2c6a7f..6cb8915 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -50,9 +50,11 @@ static int dfs_channel_available(struct hostapd_channel_data *chan,
 	/*
 	 * When radar detection happens, CSA is performed. However, there's no
 	 * time for CAC, so radar channels must be skipped when finding a new
-	 * channel for CSA.
+	 * channel for CSA, unless they are available for immediate use.
 	 */
-	if (skip_radar && chan->flag & HOSTAPD_CHAN_RADAR)
+	if (skip_radar && (chan->flag & HOSTAPD_CHAN_RADAR) &&
+	    ((chan->flag & HOSTAPD_CHAN_DFS_MASK) !=
+	     HOSTAPD_CHAN_DFS_AVAILABLE))
 		return 0;
 
 	if (chan->flag & HOSTAPD_CHAN_DISABLED)
-- 
1.7.10.4



From sw  Wed Feb  5 09:10:06 2014
From: sw (Simon Wunderlich)
Date: Wed,  5 Feb 2014 18:10:06 +0100
Subject: [PATCH 0/4] hostapd: DFS channel list and associated fixes
Message-ID: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>

This series contains the rebased patch to add a dfs channel list
in the config file. This is especially useful if one wants to select
a special subset of channels which allows high transmission power in
the local regulation, e.g. up to 500mW for channel 100-140 in Germany
without TPC, for example.

Along with that, there are two patches which handle special cases
when no channels are available - the patch allowing to select an
available DFS channel should also be useful in the "general" case
when dfs_chanlist is not set.

Finally, makes hostapd stop when no channels are availble anymore.
I tried to fix this properly by enabling the iface once a NOP event
is received (that means the channel is usable again). However since
the interface has been de-initialized and the event handlers have
been deregistered, the event is received by hostapd but not processed
for the interface. This is somehow a chicken-egg-problem, can anyone
point me to how to solve that?

Thanks,
	Simon


Simon Wunderlich (4):
  hostapd: add config option for dfs channels
  hostapd: allow to switch to DFS channels if available
  hostapd: allow to switch to usable DFS channels
  hostapd: terminate hostapd when no channel is available

 hostapd/config_file.c |    6 ++++++
 hostapd/hostapd.conf  |    6 ++++++
 src/ap/ap_config.c    |    1 +
 src/ap/ap_config.h    |    1 +
 src/ap/dfs.c          |   57 ++++++++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 66 insertions(+), 5 deletions(-)

-- 
1.7.10.4



From sw  Wed Feb  5 09:10:07 2014
From: sw (Simon Wunderlich)
Date: Wed,  5 Feb 2014 18:10:07 +0100
Subject: [PATCH 1/4] hostapd: add config option for dfs channels
In-Reply-To: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391620210-15506-2-git-send-email-sw@simonwunderlich.de>

From: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>

Different channels allow different transmission power, at least in ETSI
countries. Also, ETSI requires a "channel plan" for DFS operation, and
channels should be randomly choosen from these channels.

Add a channel list configuration option for users to add channels
hostapd may pick from.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
---
 hostapd/config_file.c |    6 ++++++
 hostapd/hostapd.conf  |    6 ++++++
 src/ap/ap_config.c    |    1 +
 src/ap/ap_config.h    |    1 +
 src/ap/dfs.c          |   21 +++++++++++++++++++++
 5 files changed, 35 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 54e4af9..0df7edf 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2235,6 +2235,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 				conf->channel = 0;
 			} else
 				conf->channel = atoi(pos);
+		} else if (os_strcmp(buf, "dfs_chanlist") == 0) {
+			if (hostapd_parse_intlist(&conf->dfs_chanlist, pos)) {
+				wpa_printf(MSG_ERROR, "Line %d: invalid channel "
+					   "list", line);
+				errors++;
+			}
 		} else if (os_strcmp(buf, "beacon_int") == 0) {
 			int val = atoi(pos);
 			/* MIB defines range as 1..65535, but very small values
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index da7817f..7591663 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -140,6 +140,12 @@ channel=1
 # Defaults:
 #acs_num_scans=5
 
+# DFS Channels. This option allows hostapd to select on of the provided
+# DFS Channels when the current channels becomes unavailable due to
+# radar interference. Only useful when ieee80211h=1 is set.
+# Default: not set
+#dfs_chanlist=100 104 108 112 116
+
 # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
 beacon_int=100
 
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 368b202..c369cd6 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -554,6 +554,7 @@ void hostapd_config_free(struct hostapd_config *conf)
 	os_free(conf->bss);
 	os_free(conf->supported_rates);
 	os_free(conf->basic_rates);
+	os_free(conf->dfs_chanlist);
 
 	os_free(conf);
 }
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index b4860a0..b29323f 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -493,6 +493,7 @@ struct hostapd_config {
 	int fragm_threshold;
 	u8 send_probe_response;
 	u8 channel;
+	int *dfs_chanlist;
 	enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
 	enum {
 		LONG_PREAMBLE = 0,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index e4c00f8..b2c6a7f 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -130,6 +130,24 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
 }
 
 
+static int is_in_dfs_chanlist(struct hostapd_iface *iface,
+			      struct hostapd_channel_data *chan)
+{
+	int *chan_entry;
+
+	if (!iface->conf->dfs_chanlist)
+		return 1;
+
+	for (chan_entry = iface->conf->dfs_chanlist;
+	     *chan_entry != -1;
+	     chan_entry++) {
+		if (*chan_entry == chan->chan)
+			return 1;
+	}
+	return 0;
+}
+
+
 /*
  * The function assumes HT40+ operation.
  * Make sure to adjust the following variables after calling this:
@@ -162,6 +180,9 @@ static int dfs_find_channel(struct hostapd_iface *iface,
 		if (!dfs_chan_range_available(mode, i, n_chans, skip_radar))
 			continue;
 
+		if (!is_in_dfs_chanlist(iface, chan))
+			continue;
+
 		if (ret_chan && idx == channel_idx) {
 			wpa_printf(MSG_DEBUG, "Selected ch. #%d", chan->chan);
 			*ret_chan = chan;
-- 
1.7.10.4



From sw  Wed Feb  5 10:33:01 2014
From: sw (Simon Wunderlich)
Date: Wed, 5 Feb 2014 19:33:01 +0100
Subject: [PATCH 0/4] hostapd: DFS channel list and associated fixes
In-Reply-To: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <201402051933.01556.sw@simonwunderlich.de>

> Thanks,
> 	Simon
> 
> 
> Simon Wunderlich (4):
>   hostapd: add config option for dfs channels
>   hostapd: allow to switch to DFS channels if available
>   hostapd: allow to switch to usable DFS channels
>   hostapd: terminate hostapd when no channel is available

Oh my, two of them with signed-off-by instead of signed-hostap and I also 
forgot to change the author to my new mail address in the first patch ...

Please consider all patches as if they were sent with

From: Simon Wunderlich <sw at simonwunderlich.de>
Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>

I can also resend if you prefer. Sorry about the noise.

Thanks,
    Simon


From helmut.schaa  Thu Feb  6 01:24:12 2014
From: helmut.schaa (Helmut Schaa)
Date: Thu, 6 Feb 2014 10:24:12 +0100
Subject: [PATCH 1/4] hostapd: add config option for dfs channels
In-Reply-To: <1391620210-15506-2-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
	<1391620210-15506-2-git-send-email-sw@simonwunderlich.de>
Message-ID: <CAGXE3d_Upu1Q-hKGMSO---ucoDSZQ5wgt0LPtH8kkxq2P539aA@mail.gmail.com>

On Wed, Feb 5, 2014 at 6:10 PM, Simon Wunderlich <sw at simonwunderlich.de> wrote:
> From: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>
>
> Different channels allow different transmission power, at least in ETSI
> countries. Also, ETSI requires a "channel plan" for DFS operation, and
> channels should be randomly choosen from these channels.
>
> Add a channel list configuration option for users to add channels
> hostapd may pick from.
>
> Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
> ---

[...]

> diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
> index da7817f..7591663 100644
> --- a/hostapd/hostapd.conf
> +++ b/hostapd/hostapd.conf
> @@ -140,6 +140,12 @@ channel=1
>  # Defaults:
>  #acs_num_scans=5
>
> +# DFS Channels. This option allows hostapd to select on of the provided
> +# DFS Channels when the current channels becomes unavailable due to
> +# radar interference. Only useful when ieee80211h=1 is set.
> +# Default: not set
> +#dfs_chanlist=100 104 108 112 116
> +

Would it make sense to also use this for automatic channel selection?
So, instead of just using it for DFS channel switching we might use the
same list to restrict ACS to a subset of channels?
In that case however this should have a more generic name like "chanlist".

Helmut


From sw  Thu Feb  6 01:34:58 2014
From: sw (Simon Wunderlich)
Date: Thu, 6 Feb 2014 10:34:58 +0100
Subject: [PATCH 1/4] hostapd: add config option for dfs channels
In-Reply-To: <CAGXE3d_Upu1Q-hKGMSO---ucoDSZQ5wgt0LPtH8kkxq2P539aA@mail.gmail.com>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
	<1391620210-15506-2-git-send-email-sw@simonwunderlich.de>
	<CAGXE3d_Upu1Q-hKGMSO---ucoDSZQ5wgt0LPtH8kkxq2P539aA@mail.gmail.com>
Message-ID: <201402061034.58575.sw@simonwunderlich.de>

Hello Helmut,

> On Wed, Feb 5, 2014 at 6:10 PM, Simon Wunderlich <sw at simonwunderlich.de> 
wrote:
> > From: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>
> > 
> > Different channels allow different transmission power, at least in ETSI
> > countries. Also, ETSI requires a "channel plan" for DFS operation, and
> > channels should be randomly choosen from these channels.
> > 
> > Add a channel list configuration option for users to add channels
> > hostapd may pick from.
> > 
> > Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
> > ---
> 
> [...]
> 
> > diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
> > index da7817f..7591663 100644
> > --- a/hostapd/hostapd.conf
> > +++ b/hostapd/hostapd.conf
> > @@ -140,6 +140,12 @@ channel=1
> > 
> >  # Defaults:
> >  #acs_num_scans=5
> > 
> > +# DFS Channels. This option allows hostapd to select on of the provided
> > +# DFS Channels when the current channels becomes unavailable due to
> > +# radar interference. Only useful when ieee80211h=1 is set.
> > +# Default: not set
> > +#dfs_chanlist=100 104 108 112 116
> > +
> 
> Would it make sense to also use this for automatic channel selection?
> So, instead of just using it for DFS channel switching we might use the
> same list to restrict ACS to a subset of channels?
> In that case however this should have a more generic name like "chanlist".

That might be useful indeed, although I'm not familiar with ACS and don't plan 
to work on it. If you want, I can change the parameter name to chanlist as you 
suggest and leave the ACS part to someone else?

Cheers,
    Simon


From helmut.schaa  Thu Feb  6 01:52:51 2014
From: helmut.schaa (Helmut Schaa)
Date: Thu, 6 Feb 2014 10:52:51 +0100
Subject: [PATCH 1/4] hostapd: add config option for dfs channels
In-Reply-To: <201402061034.58575.sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
	<1391620210-15506-2-git-send-email-sw@simonwunderlich.de>
	<CAGXE3d_Upu1Q-hKGMSO---ucoDSZQ5wgt0LPtH8kkxq2P539aA@mail.gmail.com>
	<201402061034.58575.sw@simonwunderlich.de>
Message-ID: <CAGXE3d-5T_s_w3kN5WAnjPHfDq4erW6tqEieHGn5jCMdfQ_o=g@mail.gmail.com>

On Thu, Feb 6, 2014 at 10:34 AM, Simon Wunderlich <sw at simonwunderlich.de> wrote:
> Hello Helmut,
>
>> On Wed, Feb 5, 2014 at 6:10 PM, Simon Wunderlich <sw at simonwunderlich.de>
> wrote:
>> > From: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>
>> >
>> > Different channels allow different transmission power, at least in ETSI
>> > countries. Also, ETSI requires a "channel plan" for DFS operation, and
>> > channels should be randomly choosen from these channels.
>> >
>> > Add a channel list configuration option for users to add channels
>> > hostapd may pick from.
>> >
>> > Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
>> > ---
>>
>> [...]
>>
>> > diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
>> > index da7817f..7591663 100644
>> > --- a/hostapd/hostapd.conf
>> > +++ b/hostapd/hostapd.conf
>> > @@ -140,6 +140,12 @@ channel=1
>> >
>> >  # Defaults:
>> >  #acs_num_scans=5
>> >
>> > +# DFS Channels. This option allows hostapd to select on of the provided
>> > +# DFS Channels when the current channels becomes unavailable due to
>> > +# radar interference. Only useful when ieee80211h=1 is set.
>> > +# Default: not set
>> > +#dfs_chanlist=100 104 108 112 116
>> > +
>>
>> Would it make sense to also use this for automatic channel selection?
>> So, instead of just using it for DFS channel switching we might use the
>> same list to restrict ACS to a subset of channels?
>> In that case however this should have a more generic name like "chanlist".
>
> That might be useful indeed, although I'm not familiar with ACS and don't plan
> to work on it. If you want, I can change the parameter name to chanlist as you
> suggest and leave the ACS part to someone else?

I think that makes sense. The comments can still point out DFS for now but
it would allow to reuse the chanlist config item for ACS in the future.

To allow DFS to switch to a non-DFS channel (like 36) would that channel
have to be in the channel list?

Helmut


From sw  Thu Feb  6 01:57:21 2014
From: sw (Simon Wunderlich)
Date: Thu, 6 Feb 2014 10:57:21 +0100
Subject: [PATCH 1/4] hostapd: add config option for dfs channels
In-Reply-To: <CAGXE3d-5T_s_w3kN5WAnjPHfDq4erW6tqEieHGn5jCMdfQ_o=g@mail.gmail.com>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
	<201402061034.58575.sw@simonwunderlich.de>
	<CAGXE3d-5T_s_w3kN5WAnjPHfDq4erW6tqEieHGn5jCMdfQ_o=g@mail.gmail.com>
Message-ID: <201402061057.21496.sw@simonwunderlich.de>

Hello Helmut,

> On Thu, Feb 6, 2014 at 10:34 AM, Simon Wunderlich <sw at simonwunderlich.de> 
wrote:
> > Hello Helmut,
> > 
> >> On Wed, Feb 5, 2014 at 6:10 PM, Simon Wunderlich <sw at simonwunderlich.de>
> > 
> > wrote:
> >> > From: Simon Wunderlich <siwu at hrz.tu-chemnitz.de>
> >> > 
> >> > Different channels allow different transmission power, at least in
> >> > ETSI countries. Also, ETSI requires a "channel plan" for DFS
> >> > operation, and channels should be randomly choosen from these
> >> > channels.
> >> > 
> >> > Add a channel list configuration option for users to add channels
> >> > hostapd may pick from.
> >> > 
> >> > Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
> >> > ---
> >> 
> >> [...]
> >> 
> >> > diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
> >> > index da7817f..7591663 100644
> >> > --- a/hostapd/hostapd.conf
> >> > +++ b/hostapd/hostapd.conf
> >> > @@ -140,6 +140,12 @@ channel=1
> >> > 
> >> >  # Defaults:
> >> >  #acs_num_scans=5
> >> > 
> >> > +# DFS Channels. This option allows hostapd to select on of the
> >> > provided +# DFS Channels when the current channels becomes
> >> > unavailable due to +# radar interference. Only useful when
> >> > ieee80211h=1 is set.
> >> > +# Default: not set
> >> > +#dfs_chanlist=100 104 108 112 116
> >> > +
> >> 
> >> Would it make sense to also use this for automatic channel selection?
> >> So, instead of just using it for DFS channel switching we might use the
> >> same list to restrict ACS to a subset of channels?
> >> In that case however this should have a more generic name like
> >> "chanlist".
> > 
> > That might be useful indeed, although I'm not familiar with ACS and don't
> > plan to work on it. If you want, I can change the parameter name to
> > chanlist as you suggest and leave the ACS part to someone else?
> 
> I think that makes sense. The comments can still point out DFS for now but
> it would allow to reuse the chanlist config item for ACS in the future.

OK, sounds reasonable, I'll prepare v2.

> 
> To allow DFS to switch to a non-DFS channel (like 36) would that channel
> have to be in the channel list?

Yes, exactly. This channel list is considered by the DFS channel selection 
code, which is called if a channel is/becomes unavailable (e.g. due to radar).

Cheers,
    SImon


From j  Thu Feb  6 06:08:39 2014
From: j (Jouni Malinen)
Date: Thu, 6 Feb 2014 16:08:39 +0200
Subject: wpa_supplicant: Experimenting with wifi_display
In-Reply-To: <52F11DF5.8000005@gmail.com>
References: <52F11DF5.8000005@gmail.com>
Message-ID: <20140206140839.GA10913@w1.fi>

On Tue, Feb 04, 2014 at 05:05:57PM +0000, Mike Auty wrote:
> I've recently been trying out the wifi_display support in wpa_supplicant
> (I just tested this with wpa_supplicant-2.1).  I realize from the lack
> of documentation that this is still under development and not at all
> ready for bug posts or similar, but I thought I'd try it and see where I
> could get to in its current state.

As far as I know, it works fine and is used in large number of deployed
devices.

> There appear to be a number of calls that don't sufficiently check the
> validity of the variables they're handed, and attempting to use
> openwfd_p2pd I end up segfaulting in p2p_set_wfd_dev_info in p2p.c.
> Tracing the call back (full bt attached for those that are interested) I
> get to wifi_display_update_wfd_ie in wifi_display.c which had global
> with p2p as null (global from gdb attached too).

The only way I was able to reproduce this was by manually forcing P2P to
be disabled first. Obviously, wpa_supplicant should not hit segfault in
such a case and I'll fix that, but anyway, I'm assuming the main reason
for the issues you are seeing is in P2P not being enabled in the first
place. Which driver are you using?

> The list of commands openwfd uses are as follows:
> 
> GET wifi_display
> SET ap_scan 1

I'm not sure what these commands are trying to achieve..

> SET device_name some-random-name
> SET device_type 1-0050F204-1
> SET wifi_display 1

.. but these are fine.

> That last one triggers the segfault, presumably because no p2p
> connection has been setup already?  My knowledge of Wifi Direct is
> limited though, so that's about as far as i can get.

You don't need P2P connection for this, but you do need the P2P module
to be initialized and that will happen only if the driver supports P2P.

-- 
Jouni Malinen                                            PGP id EFC895FA


From robert.plestenjak  Thu Feb  6 06:24:45 2014
From: robert.plestenjak (Robert Plestenjak)
Date: Thu, 6 Feb 2014 15:24:45 +0100 (CET)
Subject: Radius DAS won't work
In-Reply-To: <1021589269.543059.1391692267361.JavaMail.zimbra@zimbra.xlab.si>
Message-ID: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>

When I send disconnect message, I get this:

# cat ~/packet.txt | radclient -x 172.16.117.235:3799 disconnect supersecret
Sending Disconnect-Request of id 224 to 172.16.117.235 port 3799
	Acct-Session-Id = "52F38076-00000003"
	User-Name = "janez"
	NAS-IP-Address = 172.16.117.235
rad_recv: Disconnect-NAK packet from host 172.16.117.235 port 3799, id=224, length=50
rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)

Hostapd logs this:
DAS: Received 52 bytes from 172.16.93.117:50432
DAS: Unsupported attribute 4 in Disconnect-Request from 172.16.93.117:50432
DAS: Reply to 172.16.93.117:50432


My disconnect message (package.txt):
Acct-Session-Id = "52F38076-00000003"
User-Name = "janez"
NAS-IP-Address = "172.16.117.235"


My DAS config:
...
radius_das_port=3799
radius_das_client=172.16.93.117 supersecret
radius_das_time_window=300
radius_das_require_event_timestamp=0


First I thought Radius sends attribute 4 and not 40, but I confirmed it's 40 with tcpdump and wireshark.


From j  Thu Feb  6 06:29:43 2014
From: j (Jouni Malinen)
Date: Thu, 6 Feb 2014 16:29:43 +0200
Subject: [PATCH V3] hostapd: Add Operating Mode Notification support
In-Reply-To: <1391439319-28071-1-git-send-email-marek.kwaczynski@tieto.com>
References: <1391439319-28071-1-git-send-email-marek.kwaczynski@tieto.com>
Message-ID: <20140206142943.GB10913@w1.fi>

On Mon, Feb 03, 2014 at 03:55:19PM +0100, Marek Kwaczynski wrote:
> Handling Operating Mode Notification received in Assoc Request.

> diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
> @@ -108,6 +108,32 @@ u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
> +u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
> +		      const u8 *vht_oper_notif, size_t vht_oper_notif_len)
> +{

> +	channel_width = *vht_oper_notif & VHT_OPMODE_CHANNEL_WIDTH_MASK;

This would be otherwise fine, but that mask was defined as BIT(6)|BIT(7)
which does not match IEEE Std 802.11ac-2013 (Channel Width is in B0..B1
of the Operating Mode field).

> +	if (channel_width != VHT_CHANWIDTH_USE_HT &&
> +	    channel_width != VHT_CHANWIDTH_80MHZ &&
> +	    channel_width != VHT_CHANWIDTH_160MHZ &&
> +	    channel_width != VHT_CHANWIDTH_80P80MHZ &&
> +	    (*vht_oper_notif & VHT_OPMODE_CHANNEL_RxNSS_MASK) > VHT_RX_NSS_MAX_STREAMS - 1) {

That use of VHT_OPMODE_CHANNEL_RxNSS_MASK does not look correct. That
mask was defined to be BIT(1)|BIT(2)|BIT(3) and have a shift of 4. The
shift value looks actually correct, but there is no shift operation
here.. Furthermore, the bits selected in that mask look pretty strange.
IEEe Std 802.11ac-2013 shows Rx NSS to be in B4..B6.

> diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
> @@ -252,6 +252,10 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
> +		case WLAN_EID_VHT_OPERATING_MODE_NOTIFICATION:
> +			elems->vht_opmode_notif = pos;
> +			elems->vht_opmode_notif_len = elen;
> +			break;

It looks unnecessarily complex to include length field for a one-octet
information element.. I'd add "if (elen < 1) break" here and remove
vht_opmode_notif_len.

> diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
> @@ -764,6 +764,13 @@ struct ieee80211_vht_operation {
> +#define VHT_OPMODE_CHANNEL_WIDTH_MASK		    ((u8) BIT(6) | BIT(7))
> +#define VHT_OPMODE_CHANNEL_RxNSS_MASK		    ((u8) BIT(1) | BIT(2) | BIT(3))

These do not seem to match IEEE Std 802.11ac-2013.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb  6 07:17:48 2014
From: j (Jouni Malinen)
Date: Thu, 6 Feb 2014 17:17:48 +0200
Subject: [PATCH] wpa_supplicant: Add DFS indicator to get_capability freq
In-Reply-To: <20140203234020.6D33E13F9B7@ushik.mtv.corp.google.com>
References: <20140203234020.6D33E13F9B7@ushik.mtv.corp.google.com>
Message-ID: <20140206151748.GA17912@w1.fi>

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From sw  Thu Feb  6 10:30:36 2014
From: sw (Simon Wunderlich)
Date: Thu,  6 Feb 2014 19:30:36 +0100
Subject: [PATCHv2 0/4] hostapd: DFS channel list and associated fixes
Message-ID: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>

This series contains the rebased patch to add a dfs channel list
in the config file. This is especially useful if one wants to select
a special subset of channels which allows high transmission power in
the local regulation, e.g. up to 500mW for channel 100-140 in Germany
without TPC, for example.

Changes to PATCH series:
 * renamed dfs_chanlist to chanlist and fixed the comment (suggestion
   by Helmut Schaa)
 * fixed author and Signed-hostap entries

Along with that, there are two patches which handle special cases
when no channels are available - the patch allowing to select an
available DFS channel should also be useful in the "general" case
when dfs_chanlist is not set.

Finally, makes hostapd stop when no channels are availble anymore.
I tried to fix this properly by enabling the iface once a NOP event
is received (that means the channel is usable again). However since
the interface has been de-initialized and the event handlers have
been deregistered, the event is received by hostapd but not processed
for the interface. This is somehow a chicken-egg-problem, can anyone
point me to how to solve that?

Thanks,
	Simon

Simon Wunderlich (4):
  hostapd: add config option for dfs channels
  hostapd: allow to switch to DFS channels if available
  hostapd: allow to switch to usable DFS channels
  hostapd: terminate hostapd when no channel is available

 hostapd/config_file.c |    6 ++++++
 hostapd/hostapd.conf  |    8 +++++++
 src/ap/ap_config.c    |    1 +
 src/ap/ap_config.h    |    1 +
 src/ap/dfs.c          |   57 ++++++++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 68 insertions(+), 5 deletions(-)

-- 
1.7.10.4



From sw  Thu Feb  6 10:30:37 2014
From: sw (Simon Wunderlich)
Date: Thu,  6 Feb 2014 19:30:37 +0100
Subject: [PATCHv2 1/4] hostapd: add config option for dfs channels
In-Reply-To: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
References: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391711440-10607-2-git-send-email-sw@simonwunderlich.de>

Different channels allow different transmission power, at least in ETSI
countries. Also, ETSI requires a "channel plan" for DFS operation, and
channels should be randomly choosen from these channels.

Add a channel list configuration option for users to add channels
hostapd may pick from.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
---
 hostapd/config_file.c |    6 ++++++
 hostapd/hostapd.conf  |    8 ++++++++
 src/ap/ap_config.c    |    1 +
 src/ap/ap_config.h    |    1 +
 src/ap/dfs.c          |   21 +++++++++++++++++++++
 5 files changed, 37 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 54e4af9..0abe564 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2235,6 +2235,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 				conf->channel = 0;
 			} else
 				conf->channel = atoi(pos);
+		} else if (os_strcmp(buf, "chanlist") == 0) {
+			if (hostapd_parse_intlist(&conf->chanlist, pos)) {
+				wpa_printf(MSG_ERROR, "Line %d: invalid channel "
+					   "list", line);
+				errors++;
+			}
 		} else if (os_strcmp(buf, "beacon_int") == 0) {
 			int val = atoi(pos);
 			/* MIB defines range as 1..65535, but very small values
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index da7817f..6d73268 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -140,6 +140,14 @@ channel=1
 # Defaults:
 #acs_num_scans=5
 
+# Channel list restriction. This option allows hostapd to select one of the
+# provided channels when a channel should be automatically selected. This
+# is currently only used for DFS when the current channels becomes unavailable
+# due to radar interference, and is currently only useful when ieee80211h=1 is
+# set.
+# Default: not set
+#chanlist=100 104 108 112 116
+
 # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
 beacon_int=100
 
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 368b202..3e7e6f9 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -554,6 +554,7 @@ void hostapd_config_free(struct hostapd_config *conf)
 	os_free(conf->bss);
 	os_free(conf->supported_rates);
 	os_free(conf->basic_rates);
+	os_free(conf->chanlist);
 
 	os_free(conf);
 }
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index b4860a0..2ccec14 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -493,6 +493,7 @@ struct hostapd_config {
 	int fragm_threshold;
 	u8 send_probe_response;
 	u8 channel;
+	int *chanlist;
 	enum hostapd_hw_mode hw_mode; /* HOSTAPD_MODE_IEEE80211A, .. */
 	enum {
 		LONG_PREAMBLE = 0,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index e4c00f8..1819705 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -130,6 +130,24 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
 }
 
 
+static int is_in_chanlist(struct hostapd_iface *iface,
+			  struct hostapd_channel_data *chan)
+{
+	int *chan_entry;
+
+	if (!iface->conf->chanlist)
+		return 1;
+
+	for (chan_entry = iface->conf->chanlist;
+	     *chan_entry != -1;
+	     chan_entry++) {
+		if (*chan_entry == chan->chan)
+			return 1;
+	}
+	return 0;
+}
+
+
 /*
  * The function assumes HT40+ operation.
  * Make sure to adjust the following variables after calling this:
@@ -162,6 +180,9 @@ static int dfs_find_channel(struct hostapd_iface *iface,
 		if (!dfs_chan_range_available(mode, i, n_chans, skip_radar))
 			continue;
 
+		if (!is_in_chanlist(iface, chan))
+			continue;
+
 		if (ret_chan && idx == channel_idx) {
 			wpa_printf(MSG_DEBUG, "Selected ch. #%d", chan->chan);
 			*ret_chan = chan;
-- 
1.7.10.4



From sw  Thu Feb  6 10:30:39 2014
From: sw (Simon Wunderlich)
Date: Thu,  6 Feb 2014 19:30:39 +0100
Subject: [PATCHv2 3/4] hostapd: allow to switch to usable DFS channels
In-Reply-To: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
References: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391711440-10607-4-git-send-email-sw@simonwunderlich.de>

If channels are "available", change to "usable" DFS channels as a
fallback too. This requires CAC, but it is still better to do that
instead of stopping service completely.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index ef3b4e7..78668dc 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -724,9 +724,32 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 					skip_radar);
 
 	if (!channel) {
-		/* FIXME: Wait for channel(s) to become available */
+		/* if there is no channel to switch immediately to, check
+		 * if there is another channel where we can switch even if
+		 * it requires to perform a CAC first. */
+		skip_radar = 0;
+		channel = dfs_get_valid_channel(iface, &secondary_channel,
+						&vht_oper_centr_freq_seg0_idx,
+						&vht_oper_centr_freq_seg1_idx,
+						skip_radar);
+		if (!channel) {
+			/* FIXME: Wait for channel(s) to become available */
+			hostapd_disable_iface(iface);
+			return err;
+
+		}
+
+		iface->freq = channel->freq;
+		iface->conf->channel = channel->chan;
+		iface->conf->secondary_channel = secondary_channel;
+		iface->conf->vht_oper_centr_freq_seg0_idx =
+			vht_oper_centr_freq_seg0_idx;
+		iface->conf->vht_oper_centr_freq_seg1_idx =
+			vht_oper_centr_freq_seg1_idx;
+
 		hostapd_disable_iface(iface);
-		return err;
+		hostapd_enable_iface(iface);
+		return 0;
 	}
 
 	wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
-- 
1.7.10.4



From sw  Thu Feb  6 10:30:38 2014
From: sw (Simon Wunderlich)
Date: Thu,  6 Feb 2014 19:30:38 +0100
Subject: [PATCHv2 2/4] hostapd: allow to switch to DFS channels if available
In-Reply-To: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
References: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391711440-10607-3-git-send-email-sw@simonwunderlich.de>

If DFS channels are marked as "available", an AP can switch to them
immediately without performing CAC. Therefore, the channel selection
function should consider these channels even though these are radar
channels.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 1819705..ef3b4e7 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -50,9 +50,11 @@ static int dfs_channel_available(struct hostapd_channel_data *chan,
 	/*
 	 * When radar detection happens, CSA is performed. However, there's no
 	 * time for CAC, so radar channels must be skipped when finding a new
-	 * channel for CSA.
+	 * channel for CSA, unless they are available for immediate use.
 	 */
-	if (skip_radar && chan->flag & HOSTAPD_CHAN_RADAR)
+	if (skip_radar && (chan->flag & HOSTAPD_CHAN_RADAR) &&
+	    ((chan->flag & HOSTAPD_CHAN_DFS_MASK) !=
+	     HOSTAPD_CHAN_DFS_AVAILABLE))
 		return 0;
 
 	if (chan->flag & HOSTAPD_CHAN_DISABLED)
-- 
1.7.10.4



From sw  Thu Feb  6 10:30:40 2014
From: sw (Simon Wunderlich)
Date: Thu,  6 Feb 2014 19:30:40 +0100
Subject: [PATCHv2 4/4] hostapd: terminate hostapd when no channel is available
In-Reply-To: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
References: <1391711440-10607-1-git-send-email-sw@simonwunderlich.de>
Message-ID: <1391711440-10607-5-git-send-email-sw@simonwunderlich.de>

Until hostapd is able to restart service on a channel (e.g. by reacting
to an event that a DFS non-occupancy period is over), better shut down
hostapd when no channel is available anymore.

The current behaviour, disabling the interface, will just lead to
hostapd hanging without recovering frmo this state. If hostapd shuts
down, userspace can at least work around and restart hostapd when
channels are available again.

Signed-hostap: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 78668dc..a46811a 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -10,6 +10,7 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
+#include "utils/eloop.h"
 #include "common/ieee802_11_defs.h"
 #include "common/wpa_ctrl.h"
 #include "hostapd.h"
@@ -734,7 +735,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 						skip_radar);
 		if (!channel) {
 			/* FIXME: Wait for channel(s) to become available */
-			hostapd_disable_iface(iface);
+			eloop_terminate();
 			return err;
 
 		}
@@ -776,7 +777,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 
 	if (err) {
 		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
-		hostapd_disable_iface(iface);
+		eloop_terminate();
 		return err;
 	}
 
-- 
1.7.10.4



From aland  Thu Feb  6 10:56:55 2014
From: aland (Alan DeKok)
Date: Thu, 06 Feb 2014 13:56:55 -0500
Subject: Radius DAS won't work
In-Reply-To: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
Message-ID: <52F3DAF7.5040508@deployingradius.com>

Robert Plestenjak wrote:
> When I send disconnect message, I get this:
> 
> # cat ~/packet.txt | radclient -x 172.16.117.235:3799 disconnect supersecret
> Sending Disconnect-Request of id 224 to 172.16.117.235 port 3799
> 	Acct-Session-Id = "52F38076-00000003"
> 	User-Name = "janez"
> 	NAS-IP-Address = 172.16.117.235
> rad_recv: Disconnect-NAK packet from host 172.16.117.235 port 3799, id=224, length=50
> rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)

  If you're running a very old version of FreeRADIUS, it might have a
bug which gets the Message-Authenticator wrong for disconnect packets.
Try upgrading to the latest version.

  But barring that, if it says the shared secret is wrong, it's because
the shared secret is wrong.

  Alan DeKok.


From helmut.schaa  Fri Feb  7 01:31:56 2014
From: helmut.schaa (Helmut Schaa)
Date: Fri,  7 Feb 2014 10:31:56 +0100
Subject: [PATCH] hostapd: Enable 802.11w in defconfig
Message-ID: <1391765516-19183-1-git-send-email-helmut.schaa@googlemail.com>

802.11w is ratified since 2009 already. So this comment does not seem
to be valid anymore.

Signed-hostap: Helmut Schaa <helmut.schaa at googlemail.com>
---

Jouni, any reason not to enable 11w by default. Do you know of any
limitation in the current implementation?
Helmut

 hostapd/defconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/hostapd/defconfig b/hostapd/defconfig
index e329a11..8c8f0ea 100644
--- a/hostapd/defconfig
+++ b/hostapd/defconfig
@@ -55,10 +55,7 @@ CONFIG_RSN_PREAUTH=y
 CONFIG_PEERKEY=y
 
 # IEEE 802.11w (management frame protection)
-# This version is an experimental implementation based on IEEE 802.11w/D1.0
-# draft and is subject to change since the standard has not yet been finalized.
-# Driver support is also needed for IEEE 802.11w.
-#CONFIG_IEEE80211W=y
+CONFIG_IEEE80211W=y
 
 # Integrated EAP server
 CONFIG_EAP=y
-- 
1.8.1.4



From robert.plestenjak  Fri Feb  7 03:44:34 2014
From: robert.plestenjak (Robert Plestenjak)
Date: Fri, 7 Feb 2014 12:44:34 +0100 (CET)
Subject: Radius DAS won't work
In-Reply-To: <52F3DAF7.5040508@deployingradius.com>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
	<52F3DAF7.5040508@deployingradius.com>
Message-ID: <1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>

Thanks for response. Shared secret "supersecret" is same on both sides, Freeradius is 2.1.12 (CentOS 6).

DAS: Received 52 bytes from 172.16.93.117:41409
RADIUS message: code=40 (Disconnect-Request) identifier=40 length=52
   Attribute 44 (Acct-Session-Id) length=19
      Value: '52F4B5D1-00000000'
   Attribute 1 (User-Name) length=7
      Value: 'janez'
   Attribute 4 (NAS-IP-Address) length=6
      Value: 172.16.117.235
DAS: Unsupported attribute 4 in Disconnect-Request from 172.16.93.117:41409
DAS: Reply to 172.16.93.117:41409
RADIUS message: code=42 (Disconnect-NAK) identifier=40 length=50
   Attribute 101 (Error-Cause) length=6
      Value: 401
   Attribute 55 (Event-Timestamp) length=6
      Value: 1391769189
   Attribute 80 (Message-Authenticator) length=18
      Value: e1 b8 ce 44 85 6e 79 c0 30 5c 81 86 fd 87 3a f5


Now, if I get this right, NAS receives Disconnect-Request and it complains that it doesn't support attribute 4 (Accounting-Request). Then it sends response NAK and error, attribute 101 with value 401 (unsuported attribute).


Sending Disconnect-Request of id 40 to 172.16.117.235 port 3799
	Acct-Session-Id = "52F4B5D1-00000000"
	User-Name = "janez"
	NAS-IP-Address = 172.16.117.235
rad_recv: Disconnect-NAK packet from host 172.16.117.235 port 3799, id=40, length=50
rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)
radclient: no response from server for ID 40 socket 3


On Freeradius side we see that disconnect requst was send, NAK received and after that it fails verifying Message-Authenticator response.

- Robert

----- Original Message -----
From: "Alan DeKok" <aland at deployingradius.com>
To: "Robert Plestenjak" <robert.plestenjak at xlab.si>
Cc: hostap at lists.shmoo.com
Sent: Thursday, February 6, 2014 7:56:55 PM
Subject: Re: Radius DAS won't work

Robert Plestenjak wrote:
> When I send disconnect message, I get this:
> 
> # cat ~/packet.txt | radclient -x 172.16.117.235:3799 disconnect supersecret
> Sending Disconnect-Request of id 224 to 172.16.117.235 port 3799
> 	Acct-Session-Id = "52F38076-00000003"
> 	User-Name = "janez"
> 	NAS-IP-Address = 172.16.117.235
> rad_recv: Disconnect-NAK packet from host 172.16.117.235 port 3799, id=224, length=50
> rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)

  If you're running a very old version of FreeRADIUS, it might have a
bug which gets the Message-Authenticator wrong for disconnect packets.
Try upgrading to the latest version.

  But barring that, if it says the shared secret is wrong, it's because
the shared secret is wrong.

  Alan DeKok.


From vda.linux  Fri Feb  7 06:55:12 2014
From: vda.linux (Denys Vlasenko)
Date: Fri, 7 Feb 2014 15:55:12 +0100
Subject: How to run a helper script on state changes?
Message-ID: <CAK1hOcNJKLdU+kg2byY_HV7_of=EHTC0xtvUqubH2FyECY27WA@mail.gmail.com>

Hi,

I want to run a script every time wpa_supplicant detects
a change in association state.
In particular, I want to restart DHCP client,
since my home wifi is not using the same IP as my work wifi.
Currently, wpa_supplicant happily drops old association and
acquires new one... but DHCP client is blissfully unaware
that it needs to restart, and I am stuck with wrong IP
until I manually restart DHCP client.

Many other network daemon have such functionality:
pppd, openvpn, udhcpc.

I read "man wpa_supplicant" and "man wpa_supplicant.conf"
and I don't see such functionality mentioned anywhere.
Did I miss it?


As an example, udhcpc executes a specified script
with the following $1 and some environment variables:

deconfig: udhcpc starts, or lease is lost.
Environment example: interface=eth0

bound: lease is obtained. Environment example:
dhcptype=5
serverid=172.16.42.102
lease=97200
interface=eth0
ip=172.16.42.177
subnet=255.255.255.0
mask=24
broadcast=172.16.22.255
router=172.16.42.98
dns=10.34.32.125 10.32.63.5 10.34.255.7 10.11.255.27
domain=lab.example.com example.com
ntpsrv=10.34.32.125 10.34.255.7

renew: lease is renewed. Environment is similar to "bound".
The IP address does not not change, however, the other DHCP paramaters,
such as the default gateway, subnet mask, and dns server may change.

nak: udhcpc received a NAK message.
Environment example: interface=eth0

leasefail: udhcpc cannot obtain a lease (DHCP server not responding, etc).
Environment example: interface=eth0


From mike.auty  Fri Feb  7 09:15:58 2014
From: mike.auty (Mike Auty)
Date: Fri, 07 Feb 2014 17:15:58 +0000
Subject: wpa_supplicant: Experimenting with wifi_display
In-Reply-To: <20140206140839.GA10913@w1.fi>
References: <52F11DF5.8000005@gmail.com> <20140206140839.GA10913@w1.fi>
Message-ID: <52F514CE.7030206@gmail.com>

On 06/02/14 14:08, Jouni Malinen wrote:
> As far as I know, it works fine and is used in large number of deployed
> devices.

Ok, that's great news!  I'll work harder at trying to get it all working
then, thanks!  5:)

> The only way I was able to reproduce this was by manually forcing P2P to
> be disabled first. Obviously, wpa_supplicant should not hit segfault in
> such a case and I'll fix that, but anyway, I'm assuming the main reason
> for the issues you are seeing is in P2P not being enabled in the first
> place. Which driver are you using?

Hmmm, my wireless card is listed by lspci as :

Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

using the kernel Intel Wireless WiFi Next Gen AGN (iwlwifi) option with
DVM and MVM firmware support enabled as modules.  The wpa_supplicant has
the following drivers enabled in .config:

ATMEL, HOSTAP, IPW, NDISWRAPPER, NL80211, RALINK, WEXT, WIRED

It has CONFIG_P2P and CONFIG_WIFI_DISPLAY enabled, but does not have
CONFIG_AP, or any of the CONFIG_WPS_* settings enabled.

> You don't need P2P connection for this, but you do need the P2P module
> to be initialized and that will happen only if the driver supports P2P.

Is there any other debugging output I can enable, or anything I can do
to find out which driver's in use, and possibly why the P2P module
wasn't started automatically?  Sorry if my questions are a bit basic or
have an obvious answer, I'm just starting up with the
internals/configuration of wpa_supplicant.  Thanks!

Mike  5:)


From marek.puzyniak  Fri Feb  7 13:19:13 2014
From: marek.puzyniak (Marek Puzyniak)
Date: Fri,  7 Feb 2014 22:19:13 +0100
Subject: [PATCH 1/2] hostapd: Add Power Constraint element
Message-ID: <1391807954-4016-1-git-send-email-marek.puzyniak@tieto.com>

From: Srinivasan B <srinivasanb at posedge.com>

Add Power Constraint information element to Beacon and Probe Response
frames when hostapd is configured on 5 GHz band and Country information
element is also added. According to spec IEEE802.11-2012 a STA shall
determine a local maximum transmit power for the current channel based
on information derived from Country and Power Constraint elements.

In order to add Power Constraint element ieee80211d option need to be
enabled and new local_pwr_constraint config option need to be set to
unsigned value in units of decibels. For now this value is statically
configured but the future goal is to implement dynamic TPC algorithm
to control local power constraint.

Signed-hostap: Srinivasan <srinivasanb at posedge.com>
Signed-hostap: Chaitanya T K <chaitanyatk at posedge.com>
Signed-hostap: Marek Puzyniak <marek.puzyniak at tieto.com>
---
 hostapd/config_file.c |  9 +++++++++
 hostapd/hostapd.conf  |  8 ++++++++
 src/ap/ap_config.c    |  9 +++++++++
 src/ap/ap_config.h    |  7 +++++++
 src/ap/beacon.c       | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 54e4af9..4f989ac 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2905,6 +2905,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 					   "sae_groups value '%s'", line, pos);
 				return 1;
 			}
+		} else if (os_strcmp(buf, "local_pwr_contraint") == 0) {
+			int val = atoi(pos);
+			if (val < 0 || val > 255) {
+				wpa_printf(MSG_ERROR, "Line %d: invalid "
+					   "local_pwr_constraint %d (expected "
+					   "0..255)", line, val);
+				errors++;
+			} else
+				conf->local_pwr_constraint = val;
 		} else {
 			wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
 				   "item '%s'", line, buf);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index da7817f..1357c03 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -108,6 +108,14 @@ ssid=test
 # (default: 0 = disabled)
 #ieee80211h=1
 
+# Add Power Constraint element for Beacon and Probe Response frames.
+# This config option adds power constraint information element when available
+# and set to corect value and country information element is added.
+# Power Constraint element is required by Transmit Power Control. This can be
+# used only with ieee80211d=1.
+# Valid values are 0..255.
+#local_pwr_constraint=3
+
 # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
 # ad = IEEE 802.11ad (60 GHz); a/g options are used with IEEE 802.11n, too, to
 # specify band)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 368b202..6c80e48 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -154,6 +154,8 @@ struct hostapd_config * hostapd_config_defaults(void)
 	conf->rts_threshold = -1; /* use driver default: 2347 */
 	conf->fragm_threshold = -1; /* user driver default: 2346 */
 	conf->send_probe_response = 1;
+	/* Set to invalid value means do not add Power Constraint IE */
+	conf->local_pwr_constraint = -1;
 
 	conf->wmm_ac_params[0] = ac_be;
 	conf->wmm_ac_params[1] = ac_bk;
@@ -829,6 +831,13 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
 		return -1;
 	}
 
+	if (full_config && conf->local_pwr_constraint != -1 &&
+	    !conf->ieee80211d) {
+		wpa_printf(MSG_ERROR, "Cannot add Power Constraint element "
+			   "without Country element");
+		return -1;
+	}
+
 	for (i = 0; i < conf->num_bss; i++) {
 		if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
 			return -1;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index b4860a0..8c3bddb 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -518,6 +518,13 @@ struct hostapd_config {
 
 	int ieee80211h; /* DFS */
 
+	/*
+	 * Local power constraint is octed coded as an unsigned
+	 * integer in units of decibels. Invalid value -1 indicates
+	 * that Power Constraint element should not be added.
+	 */
+	int local_pwr_constraint;
+
 	struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
 
 	/*
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index b1ebf6e..fd7c547 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -102,6 +102,34 @@ static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid)
 }
 
 
+static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
+{
+	u8 *pos = eid;
+
+	if (hapd->iconf->local_pwr_constraint == -1 ||
+	    hapd->iface->current_mode == NULL ||
+	    hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
+		return eid;
+
+	/*
+	 * CRDA provides reduced TX power than actual regulatory max TX power.
+	 * Value of 0 to the local power constraint provides an opportunity
+	 * for the client devices to operate at the power limit provided by CRDA
+	 * (for client devices
+	 * "Local max TX pwr" = regulatory max TX pwr - Local pwr constraint)
+	 */
+
+	/* Element ID */
+	*pos++ = WLAN_EID_PWR_CONSTRAINT;
+	/* Length */
+	*pos++ = 1;
+	/* Local Power Constraint */
+	*pos++ = hapd->iconf->local_pwr_constraint;
+
+	return pos;
+}
+
+
 static u8 * hostapd_eid_country_add(u8 *pos, u8 *end, int chan_spacing,
 				    struct hostapd_channel_data *start,
 				    struct hostapd_channel_data *prev)
@@ -315,6 +343,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
 	pos = hostapd_eid_country(hapd, pos, epos - pos);
 
+	/* Power Constraint element */
+	pos = hostapd_eid_pwr_constraint(hapd, pos);
+
 	/* ERP Information element */
 	pos = hostapd_eid_erp_info(hapd, pos);
 
@@ -721,6 +752,9 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_eid_country(hapd, tailpos,
 				      tail + BEACON_TAIL_BUF_SIZE - tailpos);
 
+	/* Power Constraint element */
+	tailpos = hostapd_eid_pwr_constraint(hapd, tailpos);
+
 	/* ERP Information element */
 	tailpos = hostapd_eid_erp_info(hapd, tailpos);
 
-- 
1.8.1.2



From marek.puzyniak  Fri Feb  7 13:19:14 2014
From: marek.puzyniak (Marek Puzyniak)
Date: Fri,  7 Feb 2014 22:19:14 +0100
Subject: [PATCH 2/2] hostapd: Configure spectrum management capability
In-Reply-To: <1391807954-4016-1-git-send-email-marek.puzyniak@tieto.com>
References: <1391807954-4016-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <1391807954-4016-2-git-send-email-marek.puzyniak@tieto.com>

From: Chaitanya T K <chaitanyatk at posedge.com>

Add configuration of Spectrum Managment subfield in
the Capability Information of Beacon, Probe Response and
Association Response. Spectrum Management bit is set when directly
requested by new configuration option spectrum_mgmt_required=1
or when AP is running on DFS channels. In future also TPC
shall require this bit to be set.

Signed-hostap: Srinivasan <srinivasanb at posedge.com>
Signed-hostap: Chaitanya T K <chaitanyatk at posedge.com>
Signed-hostap: Marek Puzyniak <marek.puzyniak at tieto.com>
---
 hostapd/config_file.c |  2 ++
 hostapd/hostapd.conf  |  7 +++++++
 src/ap/ap_config.c    |  6 ++++++
 src/ap/ap_config.h    |  3 +++
 src/ap/beacon.c       | 43 +++++++++++++++++++++++++++++++++++++++----
 src/ap/dfs.c          | 19 +++++++++++++++++++
 src/ap/dfs.h          |  2 ++
 src/ap/ieee802_11.c   | 21 +++++++++++++++++++++
 8 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 4f989ac..1cf54de 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2914,6 +2914,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 				errors++;
 			} else
 				conf->local_pwr_constraint = val;
+		} else if (os_strcmp(buf, "spectrum_mgmt_required") == 0) {
+			conf->spectrum_mgmt_required = atoi(pos);
 		} else {
 			wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
 				   "item '%s'", line, buf);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 1357c03..354e1c7 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -116,6 +116,13 @@ ssid=test
 # Valid values are 0..255.
 #local_pwr_constraint=3
 
+# Set Spectrum Managment subfield in the Capability Information field.
+# This config option forces Spectrum Management bit to be set. When this
+# option is not set then value of Spectrum Management bit depends on whether
+# DFS or TPC is reuired by regulatory authorities.This can be used only with
+# ieee80211d=1 and local_pwr_constraint configured.
+#spectrum_mgmt_required=1
+
 # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
 # ad = IEEE 802.11ad (60 GHz); a/g options are used with IEEE 802.11n, too, to
 # specify band)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 6c80e48..cc64f92 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -838,6 +838,12 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
 		return -1;
 	}
 
+	if (full_config && conf->spectrum_mgmt_required &&
+	    conf->local_pwr_constraint == -1) {
+		wpa_printf(MSG_ERROR, "Cannot set Spectrum Management bit "
+			   "without Country and Power Constraint elements");
+		return -1;
+	}
 	for (i = 0; i < conf->num_bss; i++) {
 		if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
 			return -1;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 8c3bddb..3cbfc8f 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -525,6 +525,9 @@ struct hostapd_config {
 	 */
 	int local_pwr_constraint;
 
+	/* Control Spectrum Management bit */
+	int spectrum_mgmt_required;
+
 	struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
 
 	/*
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index fd7c547..7daea0c 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -27,6 +27,7 @@
 #include "ap_drv_ops.h"
 #include "beacon.h"
 #include "hs20.h"
+#include "dfs.h"
 
 
 #ifdef NEED_AP_MLME
@@ -105,13 +106,44 @@ static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid)
 static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
 {
 	u8 *pos = eid;
+	int local_pwr_constraint = 0;
+	int dfs;
 
-	if (hapd->iconf->local_pwr_constraint == -1 ||
-	    hapd->iface->current_mode == NULL ||
-	    hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
+	if (hapd->iface->current_mode == NULL ||
+            hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
+                return eid;
+
+	/*
+	 * There is no DFS support and power constraint was not direcly
+	 * requested by config option.
+	 */
+	if (!hapd->iconf->ieee80211h &&
+	    hapd->iconf->local_pwr_constraint == -1)
+		return eid;
+
+	/* Check if DFS is required by regulatory. */
+	dfs = hostapd_is_dfs_required(hapd->iface);
+	if (dfs < 0 ) {
+		wpa_printf(MSG_WARNING, "Failed to check if dfs "
+			   "is required ret=%d", dfs);
+		dfs = 0;
+	}
+
+	if (dfs == 0 && hapd->iconf->local_pwr_constraint == -1)
 		return eid;
 
 	/*
+	 * ieee80211h (DFS) is enabled so Power Constraint element shall
+	 * be added when running on DFS channel whenever local_pwr_constraint
+	 * is configured or not. In order to meet regulations when TPC is not
+	 * implemented using a transmit power that is below the legal maximum
+	 * (including any mitigation factor) should help. In this case 3dB below
+	 * maximum allowed transmit power.
+	 */
+	if (hapd->iconf->local_pwr_constraint == -1)
+		local_pwr_constraint = 3;
+
+	/*
 	 * CRDA provides reduced TX power than actual regulatory max TX power.
 	 * Value of 0 to the local power constraint provides an opportunity
 	 * for the client devices to operate at the power limit provided by CRDA
@@ -124,7 +156,10 @@ static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
 	/* Length */
 	*pos++ = 1;
 	/* Local Power Constraint */
-	*pos++ = hapd->iconf->local_pwr_constraint;
+	if (local_pwr_constraint)
+		*pos++ = local_pwr_constraint;
+	else
+		*pos++ = hapd->iconf->local_pwr_constraint;
 
 	return pos;
 }
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index e4c00f8..1597139 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -801,3 +801,22 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
 		      cf1, cf2, HOSTAPD_CHAN_DFS_USABLE);
 	return 0;
 }
+
+int hostapd_is_dfs_required(struct hostapd_iface *iface)
+{
+	int n_chans, start_chan_idx;
+	int res = 0;
+
+	/* Get start (first) channel for current configuration */
+	start_chan_idx = dfs_get_start_chan_idx(iface);
+	if (start_chan_idx == -1)
+		return -1;
+
+	/* Get number of used channels, depend on width */
+	n_chans = dfs_get_used_n_chans(iface);
+
+	/* Check if any of configured channels require DFS */
+	res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
+
+	return res;
+}
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
index 859ff79..2710021 100644
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -21,5 +21,7 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
 			     int ht_enabled,
 			     int chan_offset, int chan_width, int cf1, int cf2);
+int hostapd_is_dfs_required(struct hostapd_iface *iface);
+
 
 #endif /* DFS_H */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 0f67883..0e85da8 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -38,6 +38,7 @@
 #include "ap_drv_ops.h"
 #include "wnm_ap.h"
 #include "ieee802_11.h"
+#include "dfs.h"
 
 
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
@@ -137,6 +138,15 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
 {
 	int capab = WLAN_CAPABILITY_ESS;
 	int privacy;
+	int dfs;
+
+	/* Check if any of configured channels require DFS */
+	dfs = hostapd_is_dfs_required(hapd->iface);
+	if (dfs < 0 ) {
+		wpa_printf(MSG_WARNING, "Failed to check if dfs "
+			   "is required ret=%d", dfs);
+		dfs = 0;
+	}
 
 	if (hapd->iface->num_sta_no_short_preamble == 0 &&
 	    hapd->iconf->preamble == SHORT_PREAMBLE)
@@ -174,6 +184,17 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
 	    hapd->iface->num_sta_no_short_slot_time == 0)
 		capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
 
+	/*
+	 * Currently Spectrum Management capability bit is set when directly
+	 * requested in configuration by spectrum_mgmt_required or when AP is
+	 * running on DFS channel.
+	 * TODO: Also consider driver support for TPC to set Spectrum Mgmt bit
+	 */
+	if (hapd->iface->current_mode &&
+	    hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A &&
+	    (hapd->iconf->spectrum_mgmt_required || dfs))
+		capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
+
 	return capab;
 }
 
-- 
1.8.1.2



From narayanraddi.m  Mon Feb 10 01:24:18 2014
From: narayanraddi.m (Narayan)
Date: Mon, 10 Feb 2014 14:54:18 +0530
Subject: compilation error in wpa_supplicant
Message-ID: <52F89AC2.3080306@globaledgesoft.com>

Hi All,

There is a compilation error when CONFIG_EAPOL_TEST and 
CONFIG_NO_CONFIG_WRITE flags are enabled.

-Werror gcc flag is enabled by CONFIG_EAPOL_TEST flag and is throwing 
error in wpas_p2p_store_persistent_group function. Below is the error 
message

p2p_supplicant.c: In function ?wpas_p2p_store_persistent_group?:
p2p_supplicant.c:644:6: error: variable ?changed? set but not used 
[-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
make: *** [p2p_supplicant.o] Error 1

-- 
Thanks & Regards,
Narayanraddi M



From ilan.peer  Mon Feb 10 02:55:02 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:02 +0200
Subject: [PATCH 0/7] Fixes for static analysis and compiler warnings
Message-ID: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>

This series includes few compilation warning fixes and fixes for
issues captured by static analysis.

Eytan Lifshitz (5):
  wpa_supplicant: fix memroy leak in ieee802_11_vendor_ie_concat()
  wpa_supplicant: fix null pointer dereference, and unneeded null
    check.
  wpa_supplicant: fix null dereference in eap_fast_parse_end()
  wpa_supplicant: fix null dereference in tls_verify_cb()
  wpa_supplicant: fix null dereference in ieee802_1x_get_mib_sta()

Max Stepanov (2):
  dfs: fix of compiler warnings in src/ap/dfs.c
  p2p: fix of compiler warning in wpa_supplicant/p2p_supplicant.c

 hostapd/main.c                  |    3 ++-
 src/ap/dfs.c                    |    8 ++++----
 src/ap/ieee802_11.c             |    3 +--
 src/ap/ieee802_1x.c             |    8 ++++++--
 src/crypto/tls_openssl.c        |    3 +++
 src/eap_peer/eap_fast_pac.c     |    2 ++
 wpa_supplicant/ctrl_iface.c     |    4 +++-
 wpa_supplicant/p2p_supplicant.c |    2 +-
 8 files changed, 22 insertions(+), 11 deletions(-)

-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:03 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:03 +0200
Subject: [PATCH 1/7] wpa_supplicant: fix memroy leak in
	ieee802_11_vendor_ie_concat()
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-2-git-send-email-ilan.peer@intel.com>

From: Eytan Lifshitz <eytan.lifshitz at intel.com>

Memory allocated by calling function ieee802_11_vendor_ie_concat
isn't freed in some case. fixed.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 wpa_supplicant/ctrl_iface.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index ddddad3..494e0d5 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -3490,8 +3490,10 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
 						  WFD_IE_VENDOR_TYPE);
 		if (wfd) {
 			ret = os_snprintf(pos, end - pos, "wfd_subelems=");
-			if (ret < 0 || ret >= end - pos)
+			if (ret < 0 || ret >= end - pos) {
+				wpabuf_free(wfd);
 				return 0;
+			}
 			pos += ret;
 
 			pos += wpa_snprintf_hex(pos, end - pos,
-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:04 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:04 +0200
Subject: [PATCH 2/7] dfs: fix of compiler warnings in src/ap/dfs.c
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-3-git-send-email-ilan.peer@intel.com>

From: Max Stepanov <Max.Stepanov at intel.com>

Added variable intitialization to fix [-Wmaybeuninitialized] compiler warning
in hostapd_handle_dfs and hostapd_dfs_start_channel_switch_cac functions.

Signed-hostap: Max Stepanov <Max.Stepanov at intel.com>
---
 src/ap/dfs.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index e4c00f8..ec691db 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -566,8 +566,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
 		wpa_printf(MSG_DEBUG, "DFS %d chans unavailable - choose other channel: %s",
 			   res, res ? "yes": "no");
 		if (res) {
-			int sec;
-			u8 cf1, cf2;
+			int sec = 0;
+			u8 cf1 = 0, cf2 = 0;
 
 			channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2,
 							skip_radar);
@@ -633,8 +633,8 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
 {
 	struct hostapd_channel_data *channel;
 	int secondary_channel;
-	u8 vht_oper_centr_freq_seg0_idx;
-	u8 vht_oper_centr_freq_seg1_idx;
+	u8 vht_oper_centr_freq_seg0_idx = 0;
+	u8 vht_oper_centr_freq_seg1_idx = 0;
 	int skip_radar = 0;
 	int err = 1;
 
-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:05 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:05 +0200
Subject: [PATCH 3/7] p2p: fix of compiler warning in
	wpa_supplicant/p2p_supplicant.c
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-4-git-send-email-ilan.peer@intel.com>

From: Max Stepanov <Max.Stepanov at intel.com>

Added flag variable intitialization to fix [-Wmaybeuninitialized]
compiler warning in wpas_p2p_verify_channel.

Signed-hostap: Max Stepanov <Max.Stepanov at intel.com>
---
 wpa_supplicant/p2p_supplicant.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 113ef83..1495ea4 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3461,7 +3461,7 @@ static enum chan_allowed wpas_p2p_verify_channel(struct wpa_supplicant *wpa_s,
 						 struct hostapd_hw_modes *mode,
 						 u8 channel, u8 bw)
 {
-	int flag;
+	int flag = 0;
 	enum chan_allowed res, res2;
 
 	res2 = res = has_channel(wpa_s->global, mode, channel, &flag);
-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:06 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:06 +0200
Subject: [PATCH 4/7] wpa_supplicant: fix null pointer dereference,
	and unneeded null check.
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-5-git-send-email-ilan.peer@intel.com>

From: Eytan Lifshitz <eytan.lifshitz at intel.com>

1. In void send_assoc_resp(), sta is checked for null, although
   it can't be null.
2. In hostapd_logger_cb(), module_str is checked for NULL, and then
   dereferenced anyway.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 hostapd/main.c      |    3 ++-
 src/ap/ieee802_11.c |    3 +--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hostapd/main.c b/hostapd/main.c
index 5a1b0a9..cd73511 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -91,7 +91,8 @@ static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
 	if (hapd && hapd->conf && addr)
 		os_snprintf(format, maxlen, "%s: STA " MACSTR "%s%s: %s",
 			    hapd->conf->iface, MAC2STR(addr),
-			    module_str ? " " : "", module_str, txt);
+			    module_str ? " " : "", module_str ? module_str : "",
+			    txt);
 	else if (hapd && hapd->conf)
 		os_snprintf(format, maxlen, "%s:%s%s %s",
 			    hapd->conf->iface, module_str ? " " : "",
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 0f67883..9dc50ce 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1127,8 +1127,7 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 	reply->u.assoc_resp.capab_info =
 		host_to_le16(hostapd_own_capab_info(hapd, sta, 0));
 	reply->u.assoc_resp.status_code = host_to_le16(status_code);
-	reply->u.assoc_resp.aid = host_to_le16((sta ? sta->aid : 0)
-					       | BIT(14) | BIT(15));
+	reply->u.assoc_resp.aid = host_to_le16(sta->aid | BIT(14) | BIT(15));
 	/* Supported rates */
 	p = hostapd_eid_supp_rates(hapd, reply->u.assoc_resp.variable);
 	/* Extended supported rates */
-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:07 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:07 +0200
Subject: [PATCH 5/7] wpa_supplicant: fix null dereference in
	eap_fast_parse_end()
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-6-git-send-email-ilan.peer@intel.com>

From: Eytan Lifshitz <eytan.lifshitz at intel.com>

in eap_fast_parse_end(), pos might be NULL if the line doesn't
contain '='.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 src/eap_peer/eap_fast_pac.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/eap_peer/eap_fast_pac.c b/src/eap_peer/eap_fast_pac.c
index 8c480b9..21d6098 100644
--- a/src/eap_peer/eap_fast_pac.c
+++ b/src/eap_peer/eap_fast_pac.c
@@ -330,6 +330,8 @@ static const char * eap_fast_parse_end(struct eap_fast_pac **pac_root,
 static const char * eap_fast_parse_pac_type(struct eap_fast_pac *pac,
 					    char *pos)
 {
+	if (!pos)
+		return "Cannot parse pac type";
 	pac->pac_type = atoi(pos);
 	if (pac->pac_type != PAC_TYPE_TUNNEL_PAC &&
 	    pac->pac_type != PAC_TYPE_USER_AUTHORIZATION &&
-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:08 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:08 +0200
Subject: [PATCH 6/7] wpa_supplicant: fix null dereference in tls_verify_cb()
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-7-git-send-email-ilan.peer@intel.com>

From: Eytan Lifshitz <eytan.lifshitz at intel.com>

In function tls_verify_cb(), X509_STORE_CTX_get_current_cert() may
return null, and it will be dereference by X509_get_subject_name().

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 src/crypto/tls_openssl.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index d025ae0..a13fa38 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -1368,6 +1368,9 @@ static int tls_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx)
 	const char *err_str;
 
 	err_cert = X509_STORE_CTX_get_current_cert(x509_ctx);
+	if (!err_cert)
+		return 0;
+
 	err = X509_STORE_CTX_get_error(x509_ctx);
 	depth = X509_STORE_CTX_get_error_depth(x509_ctx);
 	ssl = X509_STORE_CTX_get_ex_data(x509_ctx,
-- 
1.7.10.4



From ilan.peer  Mon Feb 10 02:55:09 2014
From: ilan.peer (Ilan Peer)
Date: Mon, 10 Feb 2014 12:55:09 +0200
Subject: [PATCH 7/7] wpa_supplicant: fix null dereference in
	ieee802_1x_get_mib_sta()
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392029710-1169-8-git-send-email-ilan.peer@intel.com>

From: Eytan Lifshitz <eytan.lifshitz at intel.com>

In function ieee802_1x_get_mib_sta(), eap_server_get_name() may
return null, and it will be dereference immidiate by os_snprintf().

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 src/ap/ieee802_1x.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index 49b30e4..21f815a 100644
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -1953,6 +1953,8 @@ 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_reltime diff;
+	const char *name1;
+	const char *name2;
 
 	if (sm == NULL)
 		return 0;
@@ -2088,13 +2090,15 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
 		return len;
 	len += ret;
 
+	name1 = eap_server_get_name(0, sm->eap_type_authsrv);
+	name2 = eap_server_get_name(0, sm->eap_type_supp);
 	ret = os_snprintf(buf + len, buflen - len,
 			  "last_eap_type_as=%d (%s)\n"
 			  "last_eap_type_sta=%d (%s)\n",
 			  sm->eap_type_authsrv,
-			  eap_server_get_name(0, sm->eap_type_authsrv),
+			  name1 ? name1 : "",
 			  sm->eap_type_supp,
-			  eap_server_get_name(0, sm->eap_type_supp));
+			  name2 ? name2 : "");
 	if (ret < 0 || (size_t) ret >= buflen - len)
 		return len;
 	len += ret;
-- 
1.7.10.4



From holgerschurig  Mon Feb 10 03:44:02 2014
From: holgerschurig (Holger Schurig)
Date: Mon, 10 Feb 2014 12:44:02 +0100
Subject: [PATCH 7/7] wpa_supplicant: fix null dereference in
	ieee802_1x_get_mib_sta()
In-Reply-To: <1392029710-1169-8-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
	<1392029710-1169-8-git-send-email-ilan.peer@intel.com>
Message-ID: <CAOpc7mGd-9UJZ6NaY4SxC3zs-TAtBdizbFujXsgiGOeFvkcwow@mail.gmail.com>

Hmm, isn't it allowed to pass NULL to the %s format specifier of
printf/snprintf and friends?  Or is it a GCC feature that it prints
the string "(null)" then?  That is perfectly "valgrind-clean".


From johannes  Mon Feb 10 03:54:56 2014
From: johannes (Johannes Berg)
Date: Mon, 10 Feb 2014 12:54:56 +0100
Subject: [PATCH 7/7] wpa_supplicant: fix null dereference in
	ieee802_1x_get_mib_sta()
In-Reply-To: <CAOpc7mGd-9UJZ6NaY4SxC3zs-TAtBdizbFujXsgiGOeFvkcwow@mail.gmail.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
	<1392029710-1169-8-git-send-email-ilan.peer@intel.com>
	<CAOpc7mGd-9UJZ6NaY4SxC3zs-TAtBdizbFujXsgiGOeFvkcwow@mail.gmail.com>
Message-ID: <1392033296.4128.15.camel@jlt4.sipsolutions.net>

On Mon, 2014-02-10 at 12:44 +0100, Holger Schurig wrote:
> Hmm, isn't it allowed to pass NULL to the %s format specifier of
> printf/snprintf and friends?  Or is it a GCC feature that it prints
> the string "(null)" then?  That is perfectly "valgrind-clean".

I was wondering the same, but POSIX (man 3p printf, if you have it
installed) doesn't seem to talk about passing NULL to %s.

johannes



From sfhacker  Mon Feb 10 04:03:20 2014
From: sfhacker (Sergio NNX)
Date: Mon, 10 Feb 2014 12:03:20 +0000
Subject: Hostapd/wpa_supplicant for Windows
In-Reply-To: <52F89AC2.3080306@globaledgesoft.com>
References: <52F89AC2.3080306@globaledgesoft.com>
Message-ID: <DUB111-W250720EEACAC7F8778A3E2CC900@phx.gbl>

Hi all,

Does someone know where I can download hostapd/wpa_supplicant for Windows from (i.e, the binaries)?

I had a look here: http://w1.fi/cgit/hostap/plain/wpa_supplicant/README-Windows.txt. However, I couldn't find
any reference to the Windows binaries.

Thanks in advance.

Sergio.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140210/7a034157/attachment.htm>


From sfhacker  Mon Feb 10 04:06:28 2014
From: sfhacker (Sergio NNX)
Date: Mon, 10 Feb 2014 12:06:28 +0000
Subject: PEAPv1 testing
In-Reply-To: <52F89AC2.3080306@globaledgesoft.com>
References: <52F89AC2.3080306@globaledgesoft.com>
Message-ID: <DUB111-W25648C4F71803E35B5AFCDCC900@phx.gbl>

Hi all,

I'm trying to test several EAP methods, including PEAPv0 & PEAPv1. PEAPv0 works fine, but PEAPv1.
All other methods (e.g. EAP-TTLS, EAP-AKA, etc) work Ok.
I've done some Google search but I couldn't find any pointers.

I'm using eapol_test (v2.1) to test EAP methods.

This is my .conf file:

network={
        ssid="test"
        key_mgmt=WPA-EAP
        eap=PEAP
        identity="user"
        password="password"
        anonymous_identity="not anonymous"
        ca_cert="ca.pem"
        phase1="peaplabel=1"
        phase2="auth=MD5"
}

And this is eapol_test output:

...
...
...
RADIUS packet matching with station
MS-MPPE-Send-Key (sign) - hexdump(len=32): 0b 56 d2 59 a3 7d 06 86 21 25 3c b0 7
d e3 52 50 3e 67 a5 f9 d4 e4 16 6c e0 cd e2 91 8d 11 17 84
MS-MPPE-Recv-Key (crypt) - hexdump(len=32): 3b 5a 51 96 0a 77 9b 32 1c 50 6c 4b
a8 95 fa 1e bc a8 ba 7a c6 f8 76 cc 3b 09 f4 35 64 8b 26 b1
decapsulated EAP packet (code=3 id=7 len=4) from RADIUS server: EAP Success
EAPOL: Received EAP-Packet frame
EAPOL: SUPP_BE entering state REQUEST
EAPOL: getSuppRsp
EAP: EAP entering state RECEIVED
EAP: Received EAP-Success
EAP: Status notification: completion (param=success)
EAP: EAP entering state SUCCESS
CTRL-EVENT-EAP-SUCCESS EAP authentication completed successfully
EAPOL: IEEE 802.1X for plaintext connection; no EAPOL-Key frames required
WPA: EAPOL processing complete
EAPOL: SUPP_PAE entering state AUTHENTICATED
EAPOL: SUPP_BE entering state RECEIVE
EAPOL: SUPP_BE entering state SUCCESS
EAPOL: SUPP_BE entering state IDLE
eapol_sm_cb: result=1
EAPOL: Successfully fetched key (len=32)
PMK from EAPOL - hexdump(len=32): b1 61 62 66 33 67 f8 2f 1e d8 6a e8 1e 39 d8 d
5 34 d8 98 35 36 a8 08 14 9a f1 58 9d 6e 6d 5e ef
WARNING: PMK mismatch
PMK from AS - hexdump(len=32): 3b 5a 51 96 0a 77 9b 32 1c 50 6c 4b a8 95 fa 1e b
c a8 ba 7a c6 f8 76 cc 3b 09 f4 35 64 8b 26 b1
EAP: deinitialize previously used EAP method (25, PEAP) at EAP deinit
ENGINE: engine deinit
MPPE keys OK: 0  mismatch: 1
FAILURE

This is part of hostapd output:

...
...
...
RADIUS SRV: Request for session 0x0
RADIUS SRV: Received EAP data - hexdump(len=6): 02 07 00 06 19 01
EAP: EAP entering state RECEIVED
EAP: parseEapResp: rxResp=1 respId=7 respMethod=25 respVendor=0 respVendorMethod
=0
EAP: EAP entering state INTEGRITY_CHECK
EAP: EAP entering state METHOD_RESPONSE
SSL: Received packet(len=6) - Flags 0x01
SSL: Received packet: Flags 0x1 Message Length 0
EAP-PEAP: SUCCESS_REQ -> SUCCESS
OpenSSL: Using internal PRF
EAP-PEAP: Derived key - hexdump(len=64): 3b 5a 51 96 0a 77 9b 32 1c 50 6c 4b a8
95 fa 1e bc a8 ba 7a c6 f8 76 cc 3b 09 f4 35 64 8b 26 b1 0b 56 d2 59 a3 7d 06 86
 21 25 3c b0 7d e3 52 50 3e 67 a5 f9 d4 e4 16 6c e0 cd e2 91 8d 11 17 84
EAP: EAP entering state SELECT_ACTION
EAP: getDecision: method succeeded -> SUCCESS
EAP: EAP entering state SUCCESS
EAP: Building EAP-Success (id=7)
eth0: CTRL-EVENT-EAP-SUCCESS 00:00:00:00:00:00
RADIUS SRV: EAP data from the state machine - hexdump(len=4): 03 07 00 04
RADIUS SRV: Reply to 127.0.0.1:53035
RADIUS message: code=2 (Access-Accept) identifier=7 length=160
   Attribute 79 (EAP-Message) length=6
      Value: 03 07 00 04
   Attribute 26 (Vendor-Specific) length=58
      Value: 00 00 01 37 10 34 c9 03 67 98 8d d4 08 2e 3a 8c 82 00 d2 e6 20 e2 9
7 a0 fd e6 f8 dd e6 b4 76 1b 77 61 51 f3 c2 52 88 80 68 54 f4 ce 0c 18 c6 31 0e
f4 10 02 96 eb ee ba
   Attribute 26 (Vendor-Specific) length=58
      Value: 00 00 01 37 11 34 c9 02 79 4f 83 ba 16 8a ac 6b 17 17 c4 46 f5 e2 e
8 98 12 9a 2f ba 41 fd 5c 15 3a fd 1c 30 41 fa 13 b6 6f bc 78 c4 1f 1e 76 21 19
77 19 ff 17 a6 70 b1
   Attribute 80 (Message-Authenticator) length=18
      Value: c7 17 84 d4 57 54 c7 5f 35 15 a3 ef 2b 7f f3 d5
      

Any pointers/examples/etc will be greatly appreciated.

Thanks in advance.

Sergio.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140210/681dd989/attachment.htm>


From ilan.peer  Mon Feb 10 04:32:14 2014
From: ilan.peer (Peer, Ilan)
Date: Mon, 10 Feb 2014 12:32:14 +0000
Subject: [PATCH 7/7] wpa_supplicant: fix null dereference in
	ieee802_1x_get_mib_sta()
In-Reply-To: <1392033296.4128.15.camel@jlt4.sipsolutions.net>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
	<1392029710-1169-8-git-send-email-ilan.peer@intel.com>
	<CAOpc7mGd-9UJZ6NaY4SxC3zs-TAtBdizbFujXsgiGOeFvkcwow@mail.gmail.com>
	<1392033296.4128.15.camel@jlt4.sipsolutions.net>
Message-ID: <CB3B3D4774441E42AA3EA0E1BA8230A0333788EF@HASMSX106.ger.corp.intel.com>

> -----Original Message-----
> From: Johannes Berg [mailto:johannes at sipsolutions.net]
> Sent: Monday, February 10, 2014 13:55
> To: Holger Schurig
> Cc: Peer, Ilan; Lifshitz, Eytan; hostap at lists.shmoo.com
> Subject: Re: [PATCH 7/7] wpa_supplicant: fix null dereference in
> ieee802_1x_get_mib_sta()
> 
> On Mon, 2014-02-10 at 12:44 +0100, Holger Schurig wrote:
> > Hmm, isn't it allowed to pass NULL to the %s format specifier of
> > printf/snprintf and friends?  Or is it a GCC feature that it prints
> > the string "(null)" then?  That is perfectly "valgrind-clean".
> 
> I was wondering the same, but POSIX (man 3p printf, if you have it
> installed) doesn't seem to talk about passing NULL to %s.
> 

Quotation from: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf about the s modifier:

"If no l length modi?er is present, the argument shall be a pointer to the initial element of an array of character type. Characters from the array are written up to (but not including) the terminating null character ..."

As far as I understand the above, passing the NULL pointer is not valid ...

Regards,

Ilan.




From marek.kwaczynski  Mon Feb 10 04:43:05 2014
From: marek.kwaczynski (Marek Kwaczynski)
Date: Mon, 10 Feb 2014 13:43:05 +0100
Subject: [PATCH V4] hostapd: Add Operating Mode Notification support
Message-ID: <1392036185-4650-1-git-send-email-marek.kwaczynski@tieto.com>

Handling Operating Mode Notification received in Assoc Request.

Signed-hostap: Marek Kwaczynski <marek.kwaczynski at tieto.com>
---
 src/ap/ap_drv_ops.c            |    4 +++-
 src/ap/ap_drv_ops.h            |    2 +-
 src/ap/ieee802_11.c            |    7 ++++++-
 src/ap/ieee802_11.h            |    2 ++
 src/ap/ieee802_11_vht.c        |   27 +++++++++++++++++++++++++++
 src/ap/sta_info.h              |    2 ++
 src/common/ieee802_11_common.c |    5 +++++
 src/common/ieee802_11_common.h |    1 +
 src/common/ieee802_11_defs.h   |    7 +++++++
 src/drivers/driver.h           |    2 ++
 src/drivers/driver_nl80211.c   |    6 ++++++
 11 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 893e6d9..e998fc6 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -346,7 +346,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 		    u16 listen_interval,
 		    const struct ieee80211_ht_capabilities *ht_capab,
 		    const struct ieee80211_vht_capabilities *vht_capab,
-		    u32 flags, u8 qosinfo)
+		    u32 flags, u8 qosinfo, u8 vht_opmode)
 {
 	struct hostapd_sta_add_params params;
 
@@ -364,6 +364,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 	params.listen_interval = listen_interval;
 	params.ht_capabilities = ht_capab;
 	params.vht_capabilities = vht_capab;
+	params.vht_opmode_enabled = !!(flags & WLAN_STA_VHT_OPMODE_ENABLED);
+	params.vht_opmode = vht_opmode;
 	params.flags = hostapd_sta_flags_to_drv(flags);
 	params.qosinfo = qosinfo;
 	return hapd->driver->sta_add(hapd->drv_priv, &params);
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 15a4b26..9edaf7d 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -40,7 +40,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
 		    u16 listen_interval,
 		    const struct ieee80211_ht_capabilities *ht_capab,
 		    const struct ieee80211_vht_capabilities *vht_capab,
-		    u32 flags, u8 qosinfo);
+		    u32 flags, u8 qosinfo, u8 vht_opmode);
 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
 			     size_t elem_len);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index dee3c7a..d64af8e 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -910,6 +910,11 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 				  elems.vht_capabilities_len);
 	if (resp != WLAN_STATUS_SUCCESS)
 		return resp;
+
+	resp = set_sta_vht_opmode(hapd, sta, elems.vht_opmode_notif);
+	if (resp != WLAN_STATUS_SUCCESS)
+		return resp;
+
 	if (hapd->iconf->ieee80211ac && hapd->iconf->require_vht &&
 	    !(sta->flags & WLAN_STA_VHT)) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
@@ -1953,7 +1958,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
 			    sta->listen_interval,
 			    sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
 			    sta->flags & WLAN_STA_VHT ? &vht_cap : NULL,
-			    sta->flags, sta->qosinfo)) {
+			    sta->flags, sta->qosinfo, sta->vht_opmode)) {
 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
 			       HOSTAPD_LEVEL_NOTICE,
 			       "Could not add STA to kernel driver");
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 5edeb71..6ad35f1 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -62,6 +62,8 @@ u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 void update_ht_state(struct hostapd_data *hapd, struct sta_info *sta);
 u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 		       const u8 *vht_capab, size_t vht_capab_len);
+u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
+                       const u8 *vht_opmode);
 void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
 		       const u8 *buf, size_t len, int ack);
 void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst,
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index f2ab182..66fc01f 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -108,6 +108,33 @@ u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 	return WLAN_STATUS_SUCCESS;
 }
 
+u16 set_sta_vht_opmode(struct hostapd_data *hapd, struct sta_info *sta,
+		       const u8 *vht_oper_notif)
+{
+	u8 channel_width;
+
+	if (!vht_oper_notif) {
+		sta->flags &= ~WLAN_STA_VHT_OPMODE_ENABLED;
+		return WLAN_STATUS_SUCCESS;
+	}
+
+	channel_width = *vht_oper_notif & VHT_OPMODE_CHANNEL_WIDTH_MASK;
+
+	if (channel_width != VHT_CHANWIDTH_USE_HT &&
+	    channel_width != VHT_CHANWIDTH_80MHZ &&
+	    channel_width != VHT_CHANWIDTH_160MHZ &&
+	    channel_width != VHT_CHANWIDTH_80P80MHZ &&
+	    ((*vht_oper_notif & VHT_OPMODE_CHANNEL_RxNSS_MASK) >>
+	     VHT_OPMODE_NOTIF_RX_NSS_SHIFT) > VHT_RX_NSS_MAX_STREAMS - 1) {
+		sta->flags &= ~WLAN_STA_VHT_OPMODE_ENABLED;
+		return WLAN_STATUS_UNSPECIFIED_FAILURE;
+	}
+
+	sta->flags |= WLAN_STA_VHT_OPMODE_ENABLED;
+	sta->vht_opmode = *vht_oper_notif;
+	return WLAN_STATUS_SUCCESS;
+}
+
 void hostapd_get_vht_capab(struct hostapd_data *hapd,
 			   struct ieee80211_vht_capabilities *vht_cap,
 			   struct ieee80211_vht_capabilities *neg_vht_cap)
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 9b77e06..1973af6 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -27,6 +27,7 @@
 #define WLAN_STA_GAS BIT(17)
 #define WLAN_STA_VHT BIT(18)
 #define WLAN_STA_WNM_SLEEP_MODE BIT(19)
+#define WLAN_STA_VHT_OPMODE_ENABLED BIT(20)
 #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
 #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
 #define WLAN_STA_NONERP BIT(31)
@@ -104,6 +105,7 @@ struct sta_info {
 	struct ieee80211_ht_capabilities *ht_capabilities;
 	struct ieee80211_vht_capabilities *vht_capabilities;
 
+	u8 vht_opmode;
 #ifdef CONFIG_IEEE80211W
 	int sa_query_count; /* number of pending SA Query requests;
 			     * 0 = no SA Query in progress */
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 809089f..50bdc01 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -252,6 +252,11 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
 			elems->vht_operation = pos;
 			elems->vht_operation_len = elen;
 			break;
+		case WLAN_EID_VHT_OPERATING_MODE_NOTIFICATION:
+			if (elen != 1)
+				break;
+			elems->vht_opmode_notif = pos;
+			break;
 		case WLAN_EID_LINK_ID:
 			if (elen < 18)
 				break;
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index b84dd9e..4fb2e84 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -30,6 +30,7 @@ struct ieee802_11_elems {
 	const u8 *ht_operation;
 	const u8 *vht_capabilities;
 	const u8 *vht_operation;
+	const u8 *vht_opmode_notif;
 	const u8 *vendor_ht_cap;
 	const u8 *p2p;
 	const u8 *wfd;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 6f7f777..c567017 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -764,6 +764,13 @@ struct ieee80211_vht_operation {
 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
 #define VHT_CAP_TX_ANTENNA_PATTERN                  ((u32) BIT(29))
 
+#define VHT_OPMODE_CHANNEL_WIDTH_MASK		    ((u8) BIT(0) | BIT(1))
+#define VHT_OPMODE_CHANNEL_RxNSS_MASK		    ((u8) BIT(4) | BIT(5) | BIT(6))
+#define VHT_OPMODE_NOTIF_RX_NSS_SHIFT		    4
+#define VHT_OPMODE_LEN				    1
+
+#define VHT_RX_NSS_MAX_STREAMS			    8
+
 /* VHT channel widths */
 #define VHT_CHANWIDTH_USE_HT	0
 #define VHT_CHANWIDTH_80MHZ	1
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 2f4536e..f4b4672 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1007,6 +1007,8 @@ struct hostapd_sta_add_params {
 	u16 listen_interval;
 	const struct ieee80211_ht_capabilities *ht_capabilities;
 	const struct ieee80211_vht_capabilities *vht_capabilities;
+	int vht_opmode_enabled;
+	u8 vht_opmode;
 	u32 flags; /* bitmask of WPA_STA_* flags */
 	int set; /* Set STA parameters instead of add */
 	u8 qosinfo;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 81f20b3..20642a1 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -7347,6 +7347,12 @@ static int wpa_driver_nl80211_sta_add(void *priv,
 			params->vht_capabilities);
 	}
 
+	if (params->vht_opmode_enabled) {
+		wpa_printf(MSG_DEBUG, "  * opmode=%u", params->vht_opmode);
+		NLA_PUT_U8(msg, NL80211_ATTR_OPMODE_NOTIF,
+			   params->vht_opmode);
+	}
+
 	wpa_printf(MSG_DEBUG, "  * capability=0x%x", params->capability);
 	NLA_PUT_U16(msg, NL80211_ATTR_STA_CAPABILITY, params->capability);
 
-- 
1.7.9.5



From narayanraddi.m  Mon Feb 10 03:56:16 2014
From: narayanraddi.m (Narayanraddi)
Date: Mon, 10 Feb 2014 17:26:16 +0530
Subject: [PATCH] wpa_supplicant:	compilation error
Message-ID: <1392033376-7335-1-git-send-email-narayanraddi.m@globaledgesoft.com>

Fix compilation error in wpa_supplicant

Signed-hostap: Narayanraddi <narayanraddi.m at globaledgesoft.com>
---
 wpa_supplicant/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index d1e11a3..799a1c2 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -132,7 +132,7 @@ endif
 
 
 ifdef CONFIG_EAPOL_TEST
-CFLAGS += -Werror -DEAPOL_TEST
+CFLAGS += -DEAPOL_TEST
 endif
 
 ifdef CONFIG_CODE_COVERAGE
-- 
1.7.9.5



From arend  Mon Feb 10 06:41:19 2014
From: arend (Arend van Spriel)
Date: Mon, 10 Feb 2014 15:41:19 +0100
Subject: Hostapd/wpa_supplicant for Windows
In-Reply-To: <DUB111-W250720EEACAC7F8778A3E2CC900@phx.gbl>
References: <52F89AC2.3080306@globaledgesoft.com>
	<DUB111-W250720EEACAC7F8778A3E2CC900@phx.gbl>
Message-ID: <52F8E50F.3000700@broadcom.com>

On 02/10/2014 01:03 PM, Sergio NNX wrote:
> Hi all,
> 
> Does someone know where I can download hostapd/wpa_supplicant for Windows from (i.e, the binaries)?
> 
> I had a look here: http://w1.fi/cgit/hostap/plain/wpa_supplicant/README-Windows.txt. However, I couldn't find
> any reference to the Windows binaries.
> 
> Thanks in advance.
> 
> Sergio.

Maybe your Windows distro has them :-p

Arend



From luca  Mon Feb 10 06:56:42 2014
From: luca (Luciano Coelho)
Date: Mon, 10 Feb 2014 16:56:42 +0200
Subject: [PATCH] hwsim tests: add support for the chanctx flag when creating
	radios
Message-ID: <1392044202-26995-1-git-send-email-luca@coelho.fi>

From: Luciano Coelho <luciano.coelho at intel.com>

Add a new option to set the use_chanctx flag when creating a radio.
While at it, refactor the arguments parsing code to use argparse.

Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>
---
 tests/hwsim/hwsim.py   | 47 +++++++++++++++++++++++++++++++++++++----------
 tests/hwsim/netlink.py |  4 ++++
 2 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py
index 55fa0c1..90a0c42 100644
--- a/tests/hwsim/hwsim.py
+++ b/tests/hwsim/hwsim.py
@@ -15,6 +15,7 @@ HWSIM_CMD_DESTROY_RADIO		= 5
 
 HWSIM_ATTR_CHANNELS		= 9
 HWSIM_ATTR_RADIO_ID		= 10
+HWSIM_ATTR_USE_CHANCTX		= 15
 
 # the controller class
 class HWSimController(object):
@@ -22,10 +23,13 @@ class HWSimController(object):
         self._conn = netlink.Connection(netlink.NETLINK_GENERIC)
         self._fid = netlink.genl_controller.get_family_id('MAC80211_HWSIM')
 
-    def create_radio(self, n_channels=None):
+    def create_radio(self, n_channels=None, use_chanctx=True):
         attrs = []
         if n_channels:
             attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
+        if use_chanctx:
+            attrs.append(netlink.FlagAttr(HWSIM_ATTR_USE_CHANCTX))
+
         msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
                                   flags = netlink.NLM_F_REQUEST |
                                           netlink.NLM_F_ACK,
@@ -40,14 +44,37 @@ class HWSimController(object):
                                   attrs = attrs)
         msg.send_and_recv(self._conn)
 
+def create(args):
+    print 'Created radio %d' % c.create_radio(n_channels=args.channels,
+                                              use_chanctx=args.chanctx)
+
+def destroy(args):
+    print c.destroy_radio(args.radio)
+
 if __name__ == '__main__':
-    import sys
+    import argparse
     c = HWSimController()
-    if sys.argv[1] == 'create':
-        if len(sys.argv) > 2:
-            n_channels = int(sys.argv[2])
-        else:
-            n_channels = 0
-        print 'Created radio %d' % c.create_radio(n_channels=n_channels)
-    elif sys.argv[1] == 'destroy':
-        print c.destroy_radio(int(sys.argv[2]))
+
+    parser = argparse.ArgumentParser(description='send hwsim control commands')
+    subparsers = parser.add_subparsers(help="Commands", dest='command')
+    parser_create = subparsers.add_parser('create', help='create a radio')
+    parser_create.add_argument('--channels', metavar='<number_of_channels>', type=int,
+                               default=0,
+                               help='Number of concurrent channels supported by the radio.  ' +
+                               'If not specified, the number of channels specified in ' +
+                               'the mac80211_hwsim.channels module parameter is used')
+    parser_create.add_argument('--chanctx', action="store_true",
+                               help='Use channel contexts, regardless of whether the number of ' +
+                               'channels is 1 or greater.  By default channel contexts ' +
+                               'are only used if the number of channels is greater than 1.')
+    parser_create.set_defaults(func=create)
+
+    parser_destroy = subparsers.add_parser('destroy', help='destroy a radio')
+    parser_destroy.add_argument('radio', metavar='<radio>', type=int,
+                                default=0,
+                                help='The number of the radio to be destroyed ' +
+                                '(ie. 0 for phy0, 1 for phy1...)')
+    parser_destroy.set_defaults(func=destroy)
+
+    args = parser.parse_args()
+    args.func(args)
diff --git a/tests/hwsim/netlink.py b/tests/hwsim/netlink.py
index 835c709..82b6fa2 100644
--- a/tests/hwsim/netlink.py
+++ b/tests/hwsim/netlink.py
@@ -69,6 +69,10 @@ class U8Attr(Attr):
     def __init__(self, attr_type, val):
         Attr.__init__(self, attr_type, "B", val)
 
+class FlagAttr(Attr):
+    def __init__(self, attr_type):
+        Attr.__init__(self, attr_type, "")
+
 class Nested(Attr):
     def __init__(self, attr_type, attrs):
         self.attrs = attrs
-- 
1.8.5.3



From sw  Mon Feb 10 07:04:17 2014
From: sw (Simon Wunderlich)
Date: Mon, 10 Feb 2014 16:04:17 +0100
Subject: [PATCH] hostapd: Process management frames only once per BSS
Message-ID: <1392044657-11378-1-git-send-email-sw@simonwunderlich.de>

From: Simon Wunderlich <simon at open-mesh.com>

At least in nl80211, management frames for broadcast, like probe
requests, are processed multiple times per BSS if multi-BSS is active.
In the case of probe requests, hostap will create multiple redundant
probe responses which are problematic when many BSS are on one channel.

This problem is caused by driver_nl80211 generating an event for
wpa_supplicant_event() for each BSS, and hostapd_mgmt_rx() calls
ieee802_11_mgmt() for each BSS too.

Fix this by processing broadcast events only for the BSS the driver
intended to. The behaviour is not changed for drivers not setting a BSS.

Signed-hostap: Simon Wunderlich <simon at open-mesh.com>
---
 src/ap/drv_callbacks.c       |    6 ++++++
 src/drivers/driver.h         |    6 ++++++
 src/drivers/driver_nl80211.c |    6 ++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 9af9646..f62709a 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -678,6 +678,12 @@ static int hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt)
 		size_t i;
 		ret = 0;
 		for (i = 0; i < iface->num_bss; i++) {
+			/* if bss is set, driver will call this function for
+			 * each bss individually. */
+			if (rx_mgmt->drv_priv &&
+			    (iface->bss[i]->drv_priv != rx_mgmt->drv_priv))
+				continue;
+
 			if (ieee802_11_mgmt(iface->bss[i], rx_mgmt->frame,
 					    rx_mgmt->frame_len, &fi) > 0)
 				ret = 1;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 7ad8576..24fdda2 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -3525,6 +3525,12 @@ union wpa_event_data {
 		const u8 *frame;
 		size_t frame_len;
 		u32 datarate;
+		/**
+		 * drv_priv - pointer to store driver private bss information,
+		 * 	used for comparison with struct hostapd_data->drv_priv
+		 * 	if not set to NULL.
+		 */
+		void *drv_priv;
 
 		/**
 		 * freq - Frequency (in MHz) on which the frame was received
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 5978568..cfddf42 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1670,10 +1670,11 @@ static void mlme_timeout_event(struct wpa_driver_nl80211_data *drv,
 }
 
 
-static void mlme_event_mgmt(struct wpa_driver_nl80211_data *drv,
+static void mlme_event_mgmt(struct i802_bss *bss,
 			    struct nlattr *freq, struct nlattr *sig,
 			    const u8 *frame, size_t len)
 {
+	struct wpa_driver_nl80211_data *drv = bss->drv;
 	const struct ieee80211_mgmt *mgmt;
 	union wpa_event_data event;
 	u16 fc, stype;
@@ -1704,6 +1705,7 @@ static void mlme_event_mgmt(struct wpa_driver_nl80211_data *drv,
 	event.rx_mgmt.frame = frame;
 	event.rx_mgmt.frame_len = len;
 	event.rx_mgmt.ssi_signal = ssi_signal;
+	event.rx_mgmt.drv_priv = bss;
 	wpa_supplicant_event(drv->ctx, EVENT_RX_MGMT, &event);
 }
 
@@ -1928,7 +1930,7 @@ static void mlme_event(struct i802_bss *bss,
 					   nla_data(frame), nla_len(frame));
 		break;
 	case NL80211_CMD_FRAME:
-		mlme_event_mgmt(drv, freq, sig, nla_data(frame),
+		mlme_event_mgmt(bss, freq, sig, nla_data(frame),
 				nla_len(frame));
 		break;
 	case NL80211_CMD_FRAME_TX_STATUS:
-- 
1.7.10.4



From luca  Mon Feb 10 07:06:19 2014
From: luca (Luciano Coelho)
Date: Mon, 10 Feb 2014 17:06:19 +0200
Subject: [PATCH v2] hwsim tests: add support for the chanctx flag when
	creating radios
Message-ID: <1392044779-28372-1-git-send-email-luca@coelho.fi>

From: Luciano Coelho <luciano.coelho at intel.com>

Add a new option to set the use_chanctx flag when creating a radio.
While at it, refactor the arguments parsing code to use argparse.

Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>
---
In v2:

* use chanctx=False by default in create_radio() (thanks Johannes)
---
 tests/hwsim/hwsim.py   | 47 +++++++++++++++++++++++++++++++++++++----------
 tests/hwsim/netlink.py |  4 ++++
 2 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py
index 55fa0c1..e9856e6 100644
--- a/tests/hwsim/hwsim.py
+++ b/tests/hwsim/hwsim.py
@@ -15,6 +15,7 @@ HWSIM_CMD_DESTROY_RADIO		= 5
 
 HWSIM_ATTR_CHANNELS		= 9
 HWSIM_ATTR_RADIO_ID		= 10
+HWSIM_ATTR_USE_CHANCTX		= 15
 
 # the controller class
 class HWSimController(object):
@@ -22,10 +23,13 @@ class HWSimController(object):
         self._conn = netlink.Connection(netlink.NETLINK_GENERIC)
         self._fid = netlink.genl_controller.get_family_id('MAC80211_HWSIM')
 
-    def create_radio(self, n_channels=None):
+    def create_radio(self, n_channels=None, use_chanctx=False):
         attrs = []
         if n_channels:
             attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
+        if use_chanctx:
+            attrs.append(netlink.FlagAttr(HWSIM_ATTR_USE_CHANCTX))
+
         msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
                                   flags = netlink.NLM_F_REQUEST |
                                           netlink.NLM_F_ACK,
@@ -40,14 +44,37 @@ class HWSimController(object):
                                   attrs = attrs)
         msg.send_and_recv(self._conn)
 
+def create(args):
+    print 'Created radio %d' % c.create_radio(n_channels=args.channels,
+                                              use_chanctx=args.chanctx)
+
+def destroy(args):
+    print c.destroy_radio(args.radio)
+
 if __name__ == '__main__':
-    import sys
+    import argparse
     c = HWSimController()
-    if sys.argv[1] == 'create':
-        if len(sys.argv) > 2:
-            n_channels = int(sys.argv[2])
-        else:
-            n_channels = 0
-        print 'Created radio %d' % c.create_radio(n_channels=n_channels)
-    elif sys.argv[1] == 'destroy':
-        print c.destroy_radio(int(sys.argv[2]))
+
+    parser = argparse.ArgumentParser(description='send hwsim control commands')
+    subparsers = parser.add_subparsers(help="Commands", dest='command')
+    parser_create = subparsers.add_parser('create', help='create a radio')
+    parser_create.add_argument('--channels', metavar='<number_of_channels>', type=int,
+                               default=0,
+                               help='Number of concurrent channels supported by the radio.  ' +
+                               'If not specified, the number of channels specified in ' +
+                               'the mac80211_hwsim.channels module parameter is used')
+    parser_create.add_argument('--chanctx', action="store_true",
+                               help='Use channel contexts, regardless of whether the number of ' +
+                               'channels is 1 or greater.  By default channel contexts ' +
+                               'are only used if the number of channels is greater than 1.')
+    parser_create.set_defaults(func=create)
+
+    parser_destroy = subparsers.add_parser('destroy', help='destroy a radio')
+    parser_destroy.add_argument('radio', metavar='<radio>', type=int,
+                                default=0,
+                                help='The number of the radio to be destroyed ' +
+                                '(ie. 0 for phy0, 1 for phy1...)')
+    parser_destroy.set_defaults(func=destroy)
+
+    args = parser.parse_args()
+    args.func(args)
diff --git a/tests/hwsim/netlink.py b/tests/hwsim/netlink.py
index 835c709..82b6fa2 100644
--- a/tests/hwsim/netlink.py
+++ b/tests/hwsim/netlink.py
@@ -69,6 +69,10 @@ class U8Attr(Attr):
     def __init__(self, attr_type, val):
         Attr.__init__(self, attr_type, "B", val)
 
+class FlagAttr(Attr):
+    def __init__(self, attr_type):
+        Attr.__init__(self, attr_type, "")
+
 class Nested(Attr):
     def __init__(self, attr_type, attrs):
         self.attrs = attrs
-- 
1.8.5.3



From james.wood  Mon Feb 10 14:54:20 2014
From: james.wood (James Wood)
Date: Mon, 10 Feb 2014 22:54:20 -0000
Subject: Hotspot 2.0 (802.11u) with hostapd/wpa_supplicant
Message-ID: <150b01cf26b3$09b1c340$1d1549c0$@purplewifi.net>

Hi All

 

I'm hoping you can help me with my testing of Hotspot 2.0 for some proof of
concept trials.

 

I have looked at the hostapd.conf examples and everything seems to make
sense but I am wondering what the basic configuration options required are
in order for a client device that supports Hotspot 2.0 to connect to the
service.

 

We traditionally use an open network with a captive portal authentication
page, and are looking to take advantage of Hotspot 2.0 whilst still
requiring the user to be redirected to our captive portal/login page.

 

Am I right in thinking the below should suffice? Am I missing anything, or
is any of this not required? Also, where does wpa_supplication fit in?

 

Appreciate this is vague at this stage as I'm at the initial stage of seeing
if this can work for us.

 

interworking=1

access_network_type=3

internet=1

asra=1

esr=1

uesa=1

roaming_consortium=2233445566

venue_name=eng:My venue

network_auth_type=02http://www.my-captive-portal.com

ipv4_type=3

domain_name=mydomain.com

 

hs20=1

hs20_oper_friendly_name=eng:FreeWiFi

 

Finally, a generic question (I've been reading up about Hostspot 2.0 in
general but still not perfectly clear) is that how does authentication (ie
EAP-TTLS) take place before the user even connects to the AP and we
authenticate them via the captive portal page?

 

Thank you

 

J

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140210/aeea1c94/attachment.htm>


From s.p.armitage  Tue Feb 11 00:29:30 2014
From: s.p.armitage (Scott Armitage)
Date: Tue, 11 Feb 2014 08:29:30 +0000
Subject: Hotspot 2.0 (802.11u) with hostapd/wpa_supplicant
In-Reply-To: <150b01cf26b3$09b1c340$1d1549c0$@purplewifi.net>
References: <150b01cf26b3$09b1c340$1d1549c0$@purplewifi.net>
Message-ID: <56728F2A-19C5-42EE-85F9-386754E2B2C0@scottarmitage.eu>


On 10 Feb 2014, at 22:54, James Wood <james.wood at purplewifi.net> wrote:

> Hi All
>  
> I?m hoping you can help me with my testing of Hotspot 2.0 for some proof of concept trials.
>  
> I have looked at the hostapd.conf examples and everything seems to make sense but I am wondering what the basic configuration options required are in order for a client device that supports Hotspot 2.0 to connect to the service.
>  
> We traditionally use an open network with a captive portal authentication page, and are looking to take advantage of Hotspot 2.0 whilst still requiring the user to be redirected to our captive portal/login page.
>  
> Am I right in thinking the below should suffice? Am I missing anything, or is any of this not required? Also, where does wpa_supplication fit in?
>  
> Appreciate this is vague at this stage as I?m at the initial stage of seeing if this can work for us.
>  
> interworking=1
> access_network_type=3
> internet=1
> asra=1
> esr=1
> uesa=1
> roaming_consortium=2233445566
> venue_name=eng:My venue
> network_auth_type=02http://www.my-captive-portal.com
> ipv4_type=3
> domain_name=mydomain.com
>  
> hs20=1
> hs20_oper_friendly_name=eng:FreeWiFi
>  
> Finally, a generic question (I?ve been reading up about Hostspot 2.0 in general but still not perfectly clear) is that how does authentication (ie EAP-TTLS) take place before the user even connects to the AP and we authenticate them via the captive portal page?


HS 2.0 only works on WPA2 Enterprise networks which use EAP authentication.  You don?t have to use EAP-TTLS you could use any EAP Method (PEAP, EAP-TLS, EAP-PWD, EAP-SIM etc.).  

Get your network EAP authenticating first, then look at the HS2.0 settings.  


Regards


Scott

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140211/bdf05b2a/attachment.pgp>


From gurli  Wed Feb 12 06:37:20 2014
From: gurli (Bjarke Istrup Pedersen)
Date: Wed, 12 Feb 2014 15:37:20 +0100
Subject: Problem compiling wpa_supplicant 2.1 with WPS NFC enabled
Message-ID: <CAD=gAD_JtpyrdvTBnABJ+n82RwmtomfJd8gemvL+8BbgbWEmyQ@mail.gmail.com>

Hey,

I just tried compiling wpa_supplicant with the following config:

CONFIG_CTRL_IFACE=y
CONFIG_BACKEND=file
CONFIG_EAP_GTC=y
CONFIG_EAP_MD5=y
CONFIG_EAP_OTP=y
CONFIG_EAP_PAX=y
CONFIG_EAP_PSK=y
CONFIG_EAP_TLV=y
CONFIG_EAP_EXE=y
CONFIG_IEEE8021X_EAPOL=y
CONFIG_PKCS12=y
CONFIG_PEERKEY=y
CONFIG_EAP_LEAP=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TLS=y
CONFIG_EAP_TTLS=y
CONFIG_BGSCAN_SIMPLE=y
CONFIG_BGSCAN_LEARN=y
CONFIG_DEBUG_FILE=y
CONFIG_READLINE=y
CONFIG_TLS=openssl
CONFIG_DRIVER_ATMEL=y
CONFIG_DRIVER_HOSTAP=y
CONFIG_DRIVER_IPW=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_RALINK=y
CONFIG_DRIVER_WEXT=y
CONFIG_DRIVER_WIRED=y
CONFIG_WPS=y
CONFIG_WPS2=y
CONFIG_WPS_UFD=y
CONFIG_WPS_ER=y
CONFIG_WPS_UPNP=y
CONFIG_WPS_NFC=y
CONFIG_DELAYED_MIC_ERROR_REPORT=y
CONFIG_LIBNL32=y

This results in the following errors:

ctrl_iface.o: In function `wpas_ctrl_nfc_get_handover_req_p2p':
/var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:952:
undefined reference to `wpas_p2p_nfc_handover_req'
ctrl_iface.o: In function `wpas_ctrl_nfc_report_handover':
/var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:1233:
undefined reference to `wpas_ap_wps_nfc_report_handover'
/var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:1241:
undefined reference to `wpas_p2p_nfc_report_handover'
ctrl_iface.o: In function `wpas_ctrl_nfc_get_handover_sel_p2p':
/var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:1033:
undefined reference to `wpas_p2p_nfc_handover_sel'
collect2: error: ld returned 1 exit status
Makefile:1569: recipe for target 'wpa_supplicant' failed
make: *** [wpa_supplicant] Error 1

Any ideas on what is missing?

Thanks.

/Bjarke


From Olivier.Marce  Wed Feb 12 07:42:34 2014
From: Olivier.Marce (Olivier Marce)
Date: Wed, 12 Feb 2014 16:42:34 +0100
Subject: Enabling packet aggregation
Message-ID: <52FB966A.6000905@alcatel-lucent.com>

Hi everybody
thanks a lot to all contributor for the development of this amazing soft 
that is hostapd.

I'm trying to use it in 11n with packet aggregation.
I put in my config file :
ieee80211n=1
wmm_enabled=1

So far I'm unable to see packets aggregation and BA in the AP and STA 
exchange. For testing I simply send a file over udp from one node to the 
other.

Did I miss some other configuration that enable packet aggregation ?
And/or does the aggregation triggered on particular conditions ?

Thanks for any hints

Regards
-- 
Olivier Marc?
Alcatel-Lucent Bell Labs France


From ilan.peer  Thu Feb 13 01:23:59 2014
From: ilan.peer (Ilan Peer)
Date: Thu, 13 Feb 2014 11:23:59 +0200
Subject: [PATCH 1/3] pno: Change sched_scan_stopped event to handle pending
	PNO properly
Message-ID: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>

From: Alexander Bondar <alexander.bondar at intel.com>

1. Move pno_start and pno_stop to scan.c as more relevant location. Rename
   them to wpa_supplicant_start_pno/stop_pno.
2. Change wpa_supplicant_stop_pno so that nothing will be done if PNO is
   not in progress.
3. When a sched_scan_stopped event is received and there is a pending PNO,
   it uses regular scheduled scan parameters instead of PNO specific
   parameters. Change it by calling wpa_supplicant_start_pno.

Signed-hostap: Alexander Bondar <alexander.bondar at intel.com>
---
 wpa_supplicant/ctrl_iface.c |  106 +------------------------------------------
 wpa_supplicant/events.c     |   15 ++----
 wpa_supplicant/scan.c       |  106 +++++++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/scan.h       |    2 +
 4 files changed, 115 insertions(+), 114 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index ddddad3..4047b64 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -46,108 +46,6 @@ static int wpa_supplicant_global_iface_list(struct wpa_global *global,
 static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
 						  char *buf, int len);
 
-
-static int pno_start(struct wpa_supplicant *wpa_s)
-{
-	int ret, interval;
-	size_t i, num_ssid;
-	struct wpa_ssid *ssid;
-	struct wpa_driver_scan_params params;
-
-	if (wpa_s->pno || wpa_s->pno_sched_pending)
-		return 0;
-
-	if ((wpa_s->wpa_state > WPA_SCANNING) &&
-	    (wpa_s->wpa_state <= WPA_COMPLETED)) {
-		wpa_printf(MSG_ERROR, "PNO: In assoc process");
-		return -EAGAIN;
-	}
-
-	if (wpa_s->wpa_state == WPA_SCANNING) {
-		wpa_supplicant_cancel_scan(wpa_s);
-		if (wpa_s->sched_scanning) {
-			wpa_printf(MSG_DEBUG, "Schedule PNO on completion of "
-				   "ongoing sched scan");
-			wpa_supplicant_cancel_sched_scan(wpa_s);
-			wpa_s->pno_sched_pending = 1;
-			return 0;
-		}
-	}
-
-	os_memset(&params, 0, sizeof(params));
-
-	num_ssid = 0;
-	ssid = wpa_s->conf->ssid;
-	while (ssid) {
-		if (!wpas_network_disabled(wpa_s, ssid))
-			num_ssid++;
-		ssid = ssid->next;
-	}
-	if (num_ssid > WPAS_MAX_SCAN_SSIDS) {
-		wpa_printf(MSG_DEBUG, "PNO: Use only the first %u SSIDs from "
-			   "%u", WPAS_MAX_SCAN_SSIDS, (unsigned int) num_ssid);
-		num_ssid = WPAS_MAX_SCAN_SSIDS;
-	}
-
-	if (num_ssid == 0) {
-		wpa_printf(MSG_DEBUG, "PNO: No configured SSIDs");
-		return -1;
-	}
-
-	params.filter_ssids = os_malloc(sizeof(struct wpa_driver_scan_filter) *
-					num_ssid);
-	if (params.filter_ssids == NULL)
-		return -1;
-	i = 0;
-	ssid = wpa_s->conf->ssid;
-	while (ssid) {
-		if (!wpas_network_disabled(wpa_s, ssid)) {
-			params.ssids[i].ssid = ssid->ssid;
-			params.ssids[i].ssid_len = ssid->ssid_len;
-			params.num_ssids++;
-			os_memcpy(params.filter_ssids[i].ssid, ssid->ssid,
-				  ssid->ssid_len);
-			params.filter_ssids[i].ssid_len = ssid->ssid_len;
-			params.num_filter_ssids++;
-			i++;
-			if (i == num_ssid)
-				break;
-		}
-		ssid = ssid->next;
-	}
-
-	if (wpa_s->conf->filter_rssi)
-		params.filter_rssi = wpa_s->conf->filter_rssi;
-
-	interval = wpa_s->conf->sched_scan_interval ?
-		wpa_s->conf->sched_scan_interval : 10;
-
-	ret = wpa_supplicant_start_sched_scan(wpa_s, &params, interval);
-	os_free(params.filter_ssids);
-	if (ret == 0)
-		wpa_s->pno = 1;
-	return ret;
-}
-
-
-static int pno_stop(struct wpa_supplicant *wpa_s)
-{
-	int ret = 0;
-
-	if (wpa_s->pno || wpa_s->sched_scanning) {
-		wpa_s->pno = 0;
-		ret = wpa_supplicant_stop_sched_scan(wpa_s);
-	}
-
-	wpa_s->pno_sched_pending = 0;
-
-	if (wpa_s->wpa_state == WPA_SCANNING)
-		wpa_supplicant_req_scan(wpa_s, 0, 0);
-
-	return ret;
-}
-
-
 static int set_bssid_filter(struct wpa_supplicant *wpa_s, char *val)
 {
 	char *pos;
@@ -391,9 +289,9 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_TDLS */
 	} else if (os_strcasecmp(cmd, "pno") == 0) {
 		if (atoi(value))
-			ret = pno_start(wpa_s);
+			ret = wpa_supplicant_start_pno(wpa_s);
 		else
-			ret = pno_stop(wpa_s);
+			ret = wpa_supplicant_stop_pno(wpa_s);
 	} else if (os_strcasecmp(cmd, "radio_disabled") == 0) {
 		int disabled = atoi(value);
 		if (wpa_drv_radio_disable(wpa_s, disabled) < 0)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a72f2fa..182b473 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3300,17 +3300,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		 * Start a new sched scan to continue searching for more SSIDs
 		 * either if timed out or PNO schedule scan is pending.
 		 */
-		if (wpa_s->sched_scan_timed_out || wpa_s->pno_sched_pending) {
-
-			if (wpa_supplicant_req_sched_scan(wpa_s) < 0 &&
-			    wpa_s->pno_sched_pending) {
-				wpa_msg(wpa_s, MSG_ERROR, "Failed to schedule PNO");
-			} else if (wpa_s->pno_sched_pending) {
-				wpa_s->pno_sched_pending = 0;
-				wpa_s->pno = 1;
-			}
+		if (wpa_s->sched_scan_timed_out)
+			wpa_supplicant_req_sched_scan(wpa_s);
+		else if (wpa_s->pno_sched_pending) {
+			wpa_s->pno_sched_pending = 0;
+			wpa_supplicant_start_pno(wpa_s);
 		}
-
 		break;
 	case EVENT_WPS_BUTTON_PUSHED:
 #ifdef CONFIG_WPS
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 18d243e..2d1eb2a 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1801,3 +1801,109 @@ void wpa_scan_free_params(struct wpa_driver_scan_params *params)
 	os_free(params->filter_ssids);
 	os_free(params);
 }
+
+int wpa_supplicant_start_pno(struct wpa_supplicant *wpa_s)
+{
+	int ret, interval;
+	size_t i, num_ssid;
+	struct wpa_ssid *ssid;
+	struct wpa_driver_scan_params params;
+
+	if (!wpa_s->sched_scan_supported)
+		return -1;
+
+	if (wpa_s->pno || wpa_s->pno_sched_pending)
+		return 0;
+
+	if ((wpa_s->wpa_state > WPA_SCANNING) &&
+	    (wpa_s->wpa_state <= WPA_COMPLETED)) {
+		wpa_printf(MSG_ERROR, "PNO: In assoc process");
+		return -EAGAIN;
+	}
+
+	if (wpa_s->wpa_state == WPA_SCANNING) {
+		wpa_supplicant_cancel_scan(wpa_s);
+		if (wpa_s->sched_scanning) {
+			wpa_printf(MSG_DEBUG, "Schedule PNO on completion of "
+				   "ongoing sched scan");
+			wpa_supplicant_cancel_sched_scan(wpa_s);
+			wpa_s->pno_sched_pending = 1;
+			return 0;
+		}
+	}
+
+	os_memset(&params, 0, sizeof(params));
+
+	num_ssid = 0;
+	ssid = wpa_s->conf->ssid;
+	while (ssid) {
+		if (!wpas_network_disabled(wpa_s, ssid))
+			num_ssid++;
+		ssid = ssid->next;
+	}
+	if (num_ssid > WPAS_MAX_SCAN_SSIDS) {
+		wpa_printf(MSG_DEBUG, "PNO: Use only the first %u SSIDs from "
+			   "%u", WPAS_MAX_SCAN_SSIDS, (unsigned int) num_ssid);
+		num_ssid = WPAS_MAX_SCAN_SSIDS;
+	}
+
+	if (num_ssid == 0) {
+		wpa_printf(MSG_DEBUG, "PNO: No configured SSIDs");
+		return -1;
+	}
+
+	params.filter_ssids = os_malloc(sizeof(struct wpa_driver_scan_filter) *
+					num_ssid);
+	if (params.filter_ssids == NULL)
+		return -1;
+	i = 0;
+	ssid = wpa_s->conf->ssid;
+	while (ssid) {
+		if (!wpas_network_disabled(wpa_s, ssid)) {
+			params.ssids[i].ssid = ssid->ssid;
+			params.ssids[i].ssid_len = ssid->ssid_len;
+			params.num_ssids++;
+			os_memcpy(params.filter_ssids[i].ssid, ssid->ssid,
+				  ssid->ssid_len);
+			params.filter_ssids[i].ssid_len = ssid->ssid_len;
+			params.num_filter_ssids++;
+			i++;
+			if (i == num_ssid)
+				break;
+		}
+		ssid = ssid->next;
+	}
+
+	if (wpa_s->conf->filter_rssi)
+		params.filter_rssi = wpa_s->conf->filter_rssi;
+
+	interval = wpa_s->conf->sched_scan_interval ?
+		wpa_s->conf->sched_scan_interval : 10;
+
+	ret = wpa_supplicant_start_sched_scan(wpa_s, &params, interval);
+	os_free(params.filter_ssids);
+	if (ret == 0)
+		wpa_s->pno = 1;
+	else
+		wpa_msg(wpa_s, MSG_ERROR, "Failed to schedule PNO");
+	return ret;
+}
+
+
+int wpa_supplicant_stop_pno(struct wpa_supplicant *wpa_s)
+{
+	int ret = 0;
+
+	if (!wpa_s->pno)
+		return 0;
+
+	ret = wpa_supplicant_stop_sched_scan(wpa_s);
+
+	wpa_s->pno = 0;
+	wpa_s->pno_sched_pending = 0;
+
+	if (wpa_s->wpa_state == WPA_SCANNING)
+		wpa_supplicant_req_scan(wpa_s, 0, 0);
+
+	return ret;
+}
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index e4c8989..aae0b62 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -46,5 +46,7 @@ int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s);
 struct wpa_driver_scan_params *
 wpa_scan_clone_params(const struct wpa_driver_scan_params *src);
 void wpa_scan_free_params(struct wpa_driver_scan_params *params);
+int wpa_supplicant_start_pno(struct wpa_supplicant *wpa_s);
+int wpa_supplicant_stop_pno(struct wpa_supplicant *wpa_s);
 
 #endif /* SCAN_H */
-- 
1.7.10.4



From ilan.peer  Thu Feb 13 01:24:00 2014
From: ilan.peer (Ilan Peer)
Date: Thu, 13 Feb 2014 11:24:00 +0200
Subject: [PATCH 2/3] wpa_supplicant: Complete radio works on disable event
In-Reply-To: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392283441-13612-2-git-send-email-ilan.peer@intel.com>

From: Andrei Otcheretianski <andrei.otcheretianski at intel.com>

While testing rfkill blocking of a scanning interface, it
was seen that the ongoing scan never completes. This happens
since EVENT_SCAN_RESULTS is discarded on a disabled interface.

Fix this and also other possible radio work completion issues
by removing all the radio works (including started) of the
disabled interface.

To be able to remove already started radio works, make their
callbacks be reentrant with deinit flag (when the work
is started), so each radio work should be able to handle
it's own termination.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 wpa_supplicant/ctrl_iface.c       |    6 ++++-
 wpa_supplicant/events.c           |    2 ++
 wpa_supplicant/gas_query.c        |    6 +++++
 wpa_supplicant/p2p_supplicant.c   |   47 ++++++++++++++++++++++++-------------
 wpa_supplicant/scan.c             |    8 ++++++-
 wpa_supplicant/sme.c              |    3 +++
 wpa_supplicant/wpa_supplicant.c   |   38 +++++++++++++++++++++++-------
 wpa_supplicant/wpa_supplicant_i.h |    4 ++--
 8 files changed, 86 insertions(+), 28 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 4047b64..bc1165d 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5371,7 +5371,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
 	wpa_sm_set_param(wpa_s->wpa, RSNA_SA_TIMEOUT, 60);
 	eapol_sm_notify_logoff(wpa_s->eapol, FALSE);
 
-	radio_remove_unstarted_work(wpa_s, NULL);
+	radio_remove_works(wpa_s, NULL, 1);
 }
 
 
@@ -5423,6 +5423,10 @@ static void wpas_ctrl_radio_work_cb(struct wpa_radio_work *work, int deinit)
 	struct wpa_external_work *ework = work->ctx;
 
 	if (deinit) {
+		if (work->started)
+			eloop_cancel_timeout(wpas_ctrl_radio_work_timeout,
+					     work, NULL);
+
 		os_free(ework);
 		return;
 	}
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 182b473..d1ac784 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3231,6 +3231,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 #endif /* CONFIG_P2P */
 
 		wpa_supplicant_mark_disassoc(wpa_s);
+		radio_remove_works(wpa_s, NULL, 0);
+
 		wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED);
 		break;
 	case EVENT_CHANNEL_LIST_CHANGED:
diff --git a/wpa_supplicant/gas_query.c b/wpa_supplicant/gas_query.c
index abcb391..b255847 100644
--- a/wpa_supplicant/gas_query.c
+++ b/wpa_supplicant/gas_query.c
@@ -573,6 +573,12 @@ static void gas_query_start_cb(struct wpa_radio_work *work, int deinit)
 	struct gas_query *gas = query->gas;
 
 	if (deinit) {
+		if (work->started) {
+			gas->work = NULL;
+			gas_query_done(gas, query, GAS_QUERY_DELETED_AT_DEINIT);
+			return;
+		}
+
 		gas_query_free(query, 1);
 		return;
 	}
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 113ef83..47758ea 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -252,7 +252,12 @@ static void wpas_p2p_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
 	int ret;
 
 	if (deinit) {
-		wpa_scan_free_params(params);
+		if (!work->started) {
+			wpa_scan_free_params(params);
+			return;
+		}
+
+		wpa_s->p2p_scan_work = NULL;
 		return;
 	}
 
@@ -355,7 +360,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 		break;
 	}
 
-	radio_remove_unstarted_work(wpa_s, "p2p-scan");
+	radio_remove_works(wpa_s, "p2p-scan", 0);
 	if (radio_add_work(wpa_s, 0, "p2p-scan", 0, wpas_p2p_trigger_scan_cb,
 			   params) < 0)
 		goto fail;
@@ -1001,6 +1006,12 @@ static void wpas_send_action_cb(struct wpa_radio_work *work, int deinit)
 	struct send_action_work *awork = work->ctx;
 
 	if (deinit) {
+		if (work->started) {
+			eloop_cancel_timeout(wpas_p2p_send_action_work_timeout,
+					     wpa_s, NULL);
+			wpa_s->p2p_send_action_work = NULL;
+			offchannel_send_action_done(wpa_s);
+		}
 		os_free(awork);
 		return;
 	}
@@ -1740,12 +1751,30 @@ static void wpas_p2p_listen_work_done(struct wpa_supplicant *wpa_s)
 }
 
 
+static void wpas_stop_listen(void *ctx)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	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;
+	}
+	wpa_drv_set_ap_wps_ie(wpa_s, NULL, NULL, NULL);
+	wpa_drv_probe_req_report(wpa_s, 0);
+	wpas_p2p_listen_work_done(wpa_s);
+}
+
+
 static void wpas_start_listen_cb(struct wpa_radio_work *work, int deinit)
 {
 	struct wpa_supplicant *wpa_s = work->wpa_s;
 	struct wpas_p2p_listen_work *lwork = work->ctx;
 
 	if (deinit) {
+		if (work->started) {
+			wpa_s->p2p_listen_work = NULL;
+			wpas_stop_listen(wpa_s);
+		}
 		wpas_p2p_listen_work_free(lwork);
 		return;
 	}
@@ -1813,20 +1842,6 @@ static int wpas_start_listen(void *ctx, unsigned int freq,
 }
 
 
-static void wpas_stop_listen(void *ctx)
-{
-	struct wpa_supplicant *wpa_s = ctx;
-	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;
-	}
-	wpa_drv_set_ap_wps_ie(wpa_s, NULL, NULL, NULL);
-	wpa_drv_probe_req_report(wpa_s, 0);
-	wpas_p2p_listen_work_done(wpa_s);
-}
-
-
 static int wpas_send_probe_resp(void *ctx, const struct wpabuf *buf)
 {
 	struct wpa_supplicant *wpa_s = ctx;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 2d1eb2a..c66fa14 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -148,7 +148,13 @@ static void wpas_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
 	int ret;
 
 	if (deinit) {
-		wpa_scan_free_params(params);
+		if (!work->started) {
+			wpa_scan_free_params(params);
+			return;
+		}
+		wpa_supplicant_notify_scanning(wpa_s, 0);
+		wpas_notify_scan_done(wpa_s, 0);
+		wpa_s->scan_work = NULL;
 		return;
 	}
 
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 451f5ae..e712ac4 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -444,6 +444,9 @@ static void sme_auth_start_cb(struct wpa_radio_work *work, int deinit)
 	struct wpa_supplicant *wpa_s = work->wpa_s;
 
 	if (deinit) {
+		if (work->started)
+			wpa_s->connect_work = NULL;
+
 		wpas_connect_work_free(cwork);
 		return;
 	}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 455b158..f2e7abc 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1401,6 +1401,13 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
 #endif /* CONFIG_HT_OVERRIDES */
 
 	if (deinit) {
+		if (work->started) {
+			wpa_s->connect_work = NULL;
+
+			/* cancel possible auth. timeout */
+			eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s,
+					     NULL);
+		}
 		wpas_connect_work_free(cwork);
 		return;
 	}
@@ -3075,25 +3082,40 @@ static void radio_start_next_work(void *eloop_ctx, void *timeout_ctx)
 }
 
 
-void radio_remove_unstarted_work(struct wpa_supplicant *wpa_s, const char *type)
+/*
+ * This function removes both started and pending radio works running on
+ * the provided interface's radio.
+ * Prior to the removal of the radio work, it's callback (cb) is called with
+ * deinit set to be 1. Each work's callback is responsible for clearing it's
+ * internal data and restoring to a correct state.
+ * @wpa_s: wpa_supplicant data
+ * @type: type of works to be removed
+ * @remove_all: 1 to remove all the works on this radio, 0 to remove only
+ * this interface's works.
+ */
+void radio_remove_works(struct wpa_supplicant *wpa_s,
+			const char *type, int remove_all)
 {
 	struct wpa_radio_work *work, *tmp;
 	struct wpa_radio *radio = wpa_s->radio;
 
 	dl_list_for_each_safe(work, tmp, &radio->work, struct wpa_radio_work,
 			      list) {
-		if (type && (work->started || os_strcmp(type, work->type) != 0))
+		if (type && (os_strcmp(type, work->type) != 0))
 			continue;
-		if (work->started) {
-			wpa_dbg(wpa_s, MSG_DEBUG, "Leaving started radio work '%s'@%p in the list",
-				work->type, work);
+
+		/* skip other ifaces' works */
+		if (!remove_all && (work->wpa_s != wpa_s))
 			continue;
-		}
-		wpa_dbg(wpa_s, MSG_DEBUG, "Remove unstarted radio work '%s'@%p",
+
+		wpa_dbg(wpa_s, MSG_DEBUG, "Remove radio work '%s'@%p",
 			work->type, work);
 		work->cb(work, 1);
 		radio_work_free(work);
 	}
+
+	/* in case we removed the started work */
+	radio_work_check_next(wpa_s);
 }
 
 
@@ -3113,7 +3135,7 @@ static void radio_remove_interface(struct wpa_supplicant *wpa_s)
 	}
 
 	wpa_printf(MSG_DEBUG, "Remove radio %s", radio->name);
-	radio_remove_unstarted_work(wpa_s, NULL);
+	radio_remove_works(wpa_s, NULL, 0);
 	eloop_cancel_timeout(radio_start_next_work, radio, NULL);
 	wpa_s->radio = NULL;
 	os_free(radio);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 4ca0306..bcdb4d0 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -305,8 +305,8 @@ int radio_add_work(struct wpa_supplicant *wpa_s, unsigned int freq,
 		   void (*cb)(struct wpa_radio_work *work, int deinit),
 		   void *ctx);
 void radio_work_done(struct wpa_radio_work *work);
-void radio_remove_unstarted_work(struct wpa_supplicant *wpa_s,
-				 const char *type);
+void radio_remove_works(struct wpa_supplicant *wpa_s,
+			const char *type, int remove_all);
 void radio_work_check_next(struct wpa_supplicant *wpa_s);
 
 struct wpa_connect_work {
-- 
1.7.10.4



From ilan.peer  Thu Feb 13 01:24:01 2014
From: ilan.peer (Ilan Peer)
Date: Thu, 13 Feb 2014 11:24:01 +0200
Subject: [PATCH 3/3] nl80211: use nl80211_set_iface_id() to get hw features
	data
In-Reply-To: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1392283441-13612-3-git-send-email-ilan.peer@intel.com>

Use nl80211_set_iface_id() in wpa_driver_nl80211_get_hw_feature_data(),
as otherwise the function fails for a P2P Device interface (which does
not have a netdev associated with it).

Signed-hostap: Ilan Peer <ilan.peer at intel.com>
---
 src/drivers/driver_nl80211.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 5978568..d942a9a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6723,7 +6723,8 @@ wpa_driver_nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
 		nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_WIPHY);
 
 	NLA_PUT_FLAG(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
-	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	if (nl80211_set_iface_id(msg, bss) < 0)
+		goto nla_put_failure;
 
 	if (send_and_recv_msgs(drv, msg, phy_info_handler, &result) == 0) {
 		nl80211_set_regulatory_flags(drv, &result);
-- 
1.7.10.4



From prashanthkumar.kr  Thu Feb 13 01:45:40 2014
From: prashanthkumar.kr (Prashanth Kumar KR)
Date: Thu, 13 Feb 2014 15:15:40 +0530
Subject: Problem compiling wpa_supplicant 2.1 with WPS NFC enabled
In-Reply-To: <CAD=gAD_JtpyrdvTBnABJ+n82RwmtomfJd8gemvL+8BbgbWEmyQ@mail.gmail.com>
References: <CAD=gAD_JtpyrdvTBnABJ+n82RwmtomfJd8gemvL+8BbgbWEmyQ@mail.gmail.com>
Message-ID: <52FC9444.3030201@globaledgesoft.com>

Hi,
Add CONFIG_P2P=y to config then try..

On Wednesday 12 February 2014 08:07 PM, Bjarke Istrup Pedersen wrote:
> Hey,
> 
> I just tried compiling wpa_supplicant with the following config:
> 
> CONFIG_CTRL_IFACE=y
> CONFIG_BACKEND=file
> CONFIG_EAP_GTC=y
> CONFIG_EAP_MD5=y
> CONFIG_EAP_OTP=y
> CONFIG_EAP_PAX=y
> CONFIG_EAP_PSK=y
> CONFIG_EAP_TLV=y
> CONFIG_EAP_EXE=y
> CONFIG_IEEE8021X_EAPOL=y
> CONFIG_PKCS12=y
> CONFIG_PEERKEY=y
> CONFIG_EAP_LEAP=y
> CONFIG_EAP_MSCHAPV2=y
> CONFIG_EAP_PEAP=y
> CONFIG_EAP_TLS=y
> CONFIG_EAP_TTLS=y
> CONFIG_BGSCAN_SIMPLE=y
> CONFIG_BGSCAN_LEARN=y
> CONFIG_DEBUG_FILE=y
> CONFIG_READLINE=y
> CONFIG_TLS=openssl
> CONFIG_DRIVER_ATMEL=y
> CONFIG_DRIVER_HOSTAP=y
> CONFIG_DRIVER_IPW=y
> CONFIG_DRIVER_NL80211=y
> CONFIG_DRIVER_RALINK=y
> CONFIG_DRIVER_WEXT=y
> CONFIG_DRIVER_WIRED=y
> CONFIG_WPS=y
> CONFIG_WPS2=y
> CONFIG_WPS_UFD=y
> CONFIG_WPS_ER=y
> CONFIG_WPS_UPNP=y
> CONFIG_WPS_NFC=y
> CONFIG_DELAYED_MIC_ERROR_REPORT=y
> CONFIG_LIBNL32=y
> 
> This results in the following errors:
> 
> ctrl_iface.o: In function `wpas_ctrl_nfc_get_handover_req_p2p':
> /var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:952:
> undefined reference to `wpas_p2p_nfc_handover_req'
> ctrl_iface.o: In function `wpas_ctrl_nfc_report_handover':
> /var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:1233:
> undefined reference to `wpas_ap_wps_nfc_report_handover'
> /var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:1241:
> undefined reference to `wpas_p2p_nfc_report_handover'
> ctrl_iface.o: In function `wpas_ctrl_nfc_get_handover_sel_p2p':
> /var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:1033:
> undefined reference to `wpas_p2p_nfc_handover_sel'
> collect2: error: ld returned 1 exit status
> Makefile:1569: recipe for target 'wpa_supplicant' failed
> make: *** [wpa_supplicant] Error 1
> 
> Any ideas on what is missing?
> 
> Thanks.
> 
> /Bjarke
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
> 

-- 
Regards,
Prashanth Kumar


From j  Thu Feb 13 05:21:55 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 15:21:55 +0200
Subject: Enabling packet aggregation
In-Reply-To: <52FB966A.6000905@alcatel-lucent.com>
References: <52FB966A.6000905@alcatel-lucent.com>
Message-ID: <20140213132155.GA29198@w1.fi>

On Wed, Feb 12, 2014 at 04:42:34PM +0100, Olivier Marce wrote:
> I'm trying to use it in 11n with packet aggregation.
> I put in my config file :
> ieee80211n=1
> wmm_enabled=1
> 
> So far I'm unable to see packets aggregation and BA in the AP and
> STA exchange. For testing I simply send a file over udp from one
> node to the other.
> 
> Did I miss some other configuration that enable packet aggregation ?
> And/or does the aggregation triggered on particular conditions ?

It should be enough to enable HT and WMM/QoS for this. The actual
aggregation decision is completely within the driver, so hostapd does
not have any control over that and as such, this question would be more
of a scope for the specific driver that you are using on the AP and STA.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 13 05:28:49 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 15:28:49 +0200
Subject: Problem compiling wpa_supplicant 2.1 with WPS NFC enabled
In-Reply-To: <CAD=gAD_JtpyrdvTBnABJ+n82RwmtomfJd8gemvL+8BbgbWEmyQ@mail.gmail.com>
References: <CAD=gAD_JtpyrdvTBnABJ+n82RwmtomfJd8gemvL+8BbgbWEmyQ@mail.gmail.com>
Message-ID: <20140213132849.GB29198@w1.fi>

On Wed, Feb 12, 2014 at 03:37:20PM +0100, Bjarke Istrup Pedersen wrote:
> I just tried compiling wpa_supplicant with the following config:
> CONFIG_WPS_NFC=y

> This results in the following errors:
> 
> ctrl_iface.o: In function `wpas_ctrl_nfc_get_handover_req_p2p':
> /var/tmp/portage/net-wireless/wpa_supplicant-2.1/work/wpa_supplicant-2.1/wpa_supplicant/ctrl_iface.c:952:
> undefined reference to `wpas_p2p_nfc_handover_req'
...

Couple of conditional #ifdefs on CONFIG_P2P and CONFIG_AP were missing
here. I'll fix that, but in the meanwhile, adding CONFIG_P2P=y as
pointed out in the thread is the most convenient way of working around
this.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 13 05:34:37 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 15:34:37 +0200
Subject: Hotspot 2.0 (802.11u) with hostapd/wpa_supplicant
In-Reply-To: <150b01cf26b3$09b1c340$1d1549c0$@purplewifi.net>
References: <150b01cf26b3$09b1c340$1d1549c0$@purplewifi.net>
Message-ID: <20140213133437.GC29198@w1.fi>

On Mon, Feb 10, 2014 at 10:54:20PM -0000, James Wood wrote:
> We traditionally use an open network with a captive portal authentication
> page, and are looking to take advantage of Hotspot 2.0 whilst still
> requiring the user to be redirected to our captive portal/login page.

That is not Hotspot 2.0, but yes, you can advertise such captive portal
requirement through the Interworking (IEEE 802.11u) parameters that
Hotspot 2.0 is using as well.

> Am I right in thinking the below should suffice? Am I missing anything, or
> is any of this not required? Also, where does wpa_supplication fit in?

In practice, I would not expect any station to do much with the network
type advertisement, but it is a valid use of IEEE 802.11u.
wpa_supplicant does not really use it. If you want to use Hotspot 2.0,
that would require WPA2-Enterprise configuration as was pointed out.


> Finally, a generic question (I've been reading up about Hostspot 2.0 in
> general but still not perfectly clear) is that how does authentication (ie
> EAP-TTLS) take place before the user even connects to the AP and we
> authenticate them via the captive portal page?

Depends on what you mean with "before connects".. Hotspot 2.0 uses
WPA2-Enterprise for authentication and that goes through the
authentication step between association and data connection being
enabled. You could have a captive portal in addition to this, but I'd
expect (and hope..) most Hotspot 2.0 uses not to use captive portals
(which I see as a major annoyance for the connection).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 13 05:36:50 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 15:36:50 +0200
Subject: [PATCH] wpa_supplicant:	compilation error
In-Reply-To: <1392033376-7335-1-git-send-email-narayanraddi.m@globaledgesoft.com>
References: <1392033376-7335-1-git-send-email-narayanraddi.m@globaledgesoft.com>
Message-ID: <20140213133649.GD29198@w1.fi>

On Mon, Feb 10, 2014 at 05:26:16PM +0530, Narayanraddi wrote:
> Fix compilation error in wpa_supplicant

> diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
> @@ -132,7 +132,7 @@ endif
>  ifdef CONFIG_EAPOL_TEST
> -CFLAGS += -Werror -DEAPOL_TEST
> +CFLAGS += -DEAPOL_TEST
>  endif

This does not look like a compilation error fix.. It looks more like
hiding a compilation warning. wpa_supplicant is expected to compile
without showing compilation warnings. What is the warning that this is
trying to work around?

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 13 07:05:26 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 17:05:26 +0200
Subject: [PATCH 0/7] Fixes for static analysis and compiler warnings
In-Reply-To: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
References: <1392029710-1169-1-git-send-email-ilan.peer@intel.com>
Message-ID: <20140213150526.GA11967@w1.fi>

On Mon, Feb 10, 2014 at 12:55:02PM +0200, Ilan Peer wrote:
> This series includes few compilation warning fixes and fixes for
> issues captured by static analysis.

Thanks, applied. Most of these looked pretty theoretical at best, but
they seemed to be fine in the sense of not breaking anything.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 13 07:09:32 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 17:09:32 +0200
Subject: hostap.git contributions and Developer Certificate of Origin
Message-ID: <20140213150932.GB11967@w1.fi>

With the license terms having been cleaned up in the hostap.git files,
there is no continued need for the additional (e) item to explicitly
acknowledge BSD license option for contributions. Since DCO v1.1 is
now available from http://developercertificate.org/ it looks reasonable
to move to the unmodified version of DCO and to the commonly used
Signed-off-by tag for this project.

In other words, I've updated the CONTRIBUTIONS file to include a
reference to DCO v1.1 and move the Signed-hostap tag into the history
section. From now on, Signed-off-by tag can be used to acknowledge the
DCO terms similarly to number of other projects. There is no need to
update the pending contributions because of this, but for anything new,
I'd suggest using Signed-off-by.

-- 
Jouni Malinen                                            PGP id EFC895FA


From eduardo.abinader  Thu Feb 13 13:12:42 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Thu, 13 Feb 2014 17:12:42 -0400
Subject: [PATCH 1/1] P2P Client should not issue p2p_find
Message-ID: <1392325962-11708-1-git-send-email-eduardo.abinader@openbossa.org>

According to WFA-P2P, p2p client interfaces should not
probe request while participating a P2P group. This
patch enforces this behavior.

Signed-off-by: Eduardo Abinader <eduardo.abinader at openbossa.org>
---
 wpa_supplicant/p2p_supplicant.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 1495ea4..6ad6eda 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5497,7 +5497,8 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout,
 	wpa_s->p2p_long_listen = 0;
 
 	if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL ||
-	    wpa_s->p2p_in_provisioning)
+	    wpa_s->p2p_in_provisioning ||
+	    wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT)
 		return -1;
 
 	wpa_supplicant_cancel_sched_scan(wpa_s);
-- 
1.8.1.2



From j  Thu Feb 13 13:38:18 2014
From: j (Jouni Malinen)
Date: Thu, 13 Feb 2014 23:38:18 +0200
Subject: [PATCH 1/1] P2P Client should not issue p2p_find
In-Reply-To: <1392325962-11708-1-git-send-email-eduardo.abinader@openbossa.org>
References: <1392325962-11708-1-git-send-email-eduardo.abinader@openbossa.org>
Message-ID: <20140213213818.GA5746@w1.fi>

On Thu, Feb 13, 2014 at 05:12:42PM -0400, Eduardo Abinader wrote:
> According to WFA-P2P, p2p client interfaces should not
> probe request while participating a P2P group. This
> patch enforces this behavior.

Could you please point to a exact clause and sentence that you believe
disallows this? It does not sound useful to prevent device discovery
while in a group, so I'm not going to apply this.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From eduardo.abinader  Thu Feb 13 14:17:16 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Thu, 13 Feb 2014 18:17:16 -0400
Subject: [PATCH 1/1] P2P Client should not issue p2p_find
In-Reply-To: <20140213213818.GA5746@w1.fi>
References: <1392325962-11708-1-git-send-email-eduardo.abinader@openbossa.org>
	<20140213213818.GA5746@w1.fi>
Message-ID: <CABEV-36wPWMUDPcNgpSAjDMOBjzsRXeYeR+C+w-r3_SiBUEB6Q@mail.gmail.com>

If you connect wpa_cli to a p2p interface, p2p_find fails.

Page 96 states PB can be trasmitted by any P2P Device (not P2P client or
GO), thus this patch still allows P2P device (ifname==wlan*) to p2p_find,
as p2p_group_interface==NOT_P2P_GROUP_INTERFACE.
This patch only disallows a P2P Client (not a P2P device),
ifname==p2p-wlan* to p2p_find.



On Thu, Feb 13, 2014 at 5:38 PM, Jouni Malinen <j at w1.fi> wrote:

> On Thu, Feb 13, 2014 at 05:12:42PM -0400, Eduardo Abinader wrote:
> > According to WFA-P2P, p2p client interfaces should not
> > probe request while participating a P2P group. This
> > patch enforces this behavior.
>
> Could you please point to a exact clause and sentence that you believe
> disallows this? It does not sound useful to prevent device discovery
> while in a group, so I'm not going to apply this.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140213/0934df03/attachment.htm>


From greearb  Thu Feb 13 16:22:48 2014
From: greearb (Ben Greear)
Date: Thu, 13 Feb 2014 16:22:48 -0800
Subject: Question on wpa_supplicant and FT over DS.
Message-ID: <52FD61D8.6020606@candelatech.com>

Hello!

Does wpa_supplicant properly support FT over DS?  It seems that when
we tell it to roam to a new AP using wpa_cli, it always does over-the-air
even when AP is beaconing as being FT over DS.

Is this a feature that needs special configuration, or maybe some
special hint when initiating a roam through the CLI?

Thanks,
Ben

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



From j  Fri Feb 14 01:30:31 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 11:30:31 +0200
Subject: Question on wpa_supplicant and FT over DS.
In-Reply-To: <52FD61D8.6020606@candelatech.com>
References: <52FD61D8.6020606@candelatech.com>
Message-ID: <20140214093031.GA7243@w1.fi>

On Thu, Feb 13, 2014 at 04:22:48PM -0800, Ben Greear wrote:
> Does wpa_supplicant properly support FT over DS?  It seems that when
> we tell it to roam to a new AP using wpa_cli, it always does over-the-air
> even when AP is beaconing as being FT over DS.

Yes.

> Is this a feature that needs special configuration, or maybe some
> special hint when initiating a roam through the CLI?

FT_DS command needs to be used if you want to force FT-over-DS to be
used (and no, it would never be used automatically in the current
implementation if I remember correctly).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 01:35:22 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 11:35:22 +0200
Subject: [PATCH 1/1] P2P Client should not issue p2p_find
In-Reply-To: <CABEV-36wPWMUDPcNgpSAjDMOBjzsRXeYeR+C+w-r3_SiBUEB6Q@mail.gmail.com>
References: <1392325962-11708-1-git-send-email-eduardo.abinader@openbossa.org>
	<20140213213818.GA5746@w1.fi>
	<CABEV-36wPWMUDPcNgpSAjDMOBjzsRXeYeR+C+w-r3_SiBUEB6Q@mail.gmail.com>
Message-ID: <20140214093522.GB7243@w1.fi>

On Thu, Feb 13, 2014 at 06:17:16PM -0400, Eduardo Abinader wrote:
> If you connect wpa_cli to a p2p interface, p2p_find fails.

Which driver are you using? Which operation fails?

> Page 96 states PB can be trasmitted by any P2P Device (not P2P client or
> GO), thus this patch still allows P2P device (ifname==wlan*) to p2p_find,
> as p2p_group_interface==NOT_P2P_GROUP_INTERFACE.
> This patch only disallows a P2P Client (not a P2P device),
> ifname==p2p-wlan* to p2p_find.

p2p_find is always performed in P2P Device role. Whether it is issued on
a control interface for another interface should not really matter much
and it could be more convenient to just route the request to the correct
instance within wpa_supplicant instead of rejecting it. I'm not sure
whether there could be external programs that end up using a random
control interface by not specifying any, so there is some risk of
regressions with this type of changes. The new global control interface
design avoids this, but similar redirection of the control interface
command could be used here as well.

-- 
Jouni Malinen                                            PGP id EFC895FA


From eduardo.abinader  Fri Feb 14 03:03:33 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Fri, 14 Feb 2014 07:03:33 -0400
Subject: [PATCH 1/1] P2P Client should not issue p2p_find
In-Reply-To: <20140214093522.GB7243@w1.fi>
References: <1392325962-11708-1-git-send-email-eduardo.abinader@openbossa.org>
	<20140213213818.GA5746@w1.fi>
	<CABEV-36wPWMUDPcNgpSAjDMOBjzsRXeYeR+C+w-r3_SiBUEB6Q@mail.gmail.com>
	<20140214093522.GB7243@w1.fi>
Message-ID: <CABEV-366NwC-C=ey+VA4Az+C24BV075=KBhrNkPxwb-1Tw+b+Q@mail.gmail.com>

On Fri, Feb 14, 2014 at 5:35 AM, Jouni Malinen <j at w1.fi> wrote:

> On Thu, Feb 13, 2014 at 06:17:16PM -0400, Eduardo Abinader wrote:
> > If you connect wpa_cli to a p2p interface, p2p_find fails.
>
> Which driver are you using? Which operation fails?
>
>
It fails with my patch, considering the info below.



> > Page 96 states PB can be trasmitted by any P2P Device (not P2P client or
> > GO), thus this patch still allows P2P device (ifname==wlan*) to p2p_find,
> > as p2p_group_interface==NOT_P2P_GROUP_INTERFACE.
> > This patch only disallows a P2P Client (not a P2P device),
> > ifname==p2p-wlan* to p2p_find.
>
> p2p_find is always performed in P2P Device role. Whether it is issued on
> a control interface for another interface should not really matter much
> and it could be more convenient to just route the request to the correct
> instance within wpa_supplicant instead of rejecting it. I'm not sure
> whether there could be external programs that end up using a random
> control interface by not specifying any, so there is some risk of
> regressions with this type of changes. The new global control interface
> design avoids this, but similar redirection of the control interface
> command could be used here as well.
>
>
I was just thinking about a ConnMan-like listing p2p interfaces and getting
them to use via wpa_s dbus interfaces. This patch would prevent such
non-standard procedures.



> --
> Jouni Malinen                                           PGP id EFC895FA
> _______________________________________________
> 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/20140214/14839bbe/attachment.htm>


From j  Fri Feb 14 09:02:50 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 19:02:50 +0200
Subject: [PATCH 4/4] hostapd: terminate hostapd when no channel is
	available
In-Reply-To: <1391620210-15506-5-git-send-email-sw@simonwunderlich.de>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
	<1391620210-15506-5-git-send-email-sw@simonwunderlich.de>
Message-ID: <20140214170250.GA15831@w1.fi>

On Wed, Feb 05, 2014 at 06:10:10PM +0100, Simon Wunderlich wrote:
> Until hostapd is able to restart service on a channel (e.g. by reacting
> to an event that a DFS non-occupancy period is over), better shut down
> hostapd when no channel is available anymore.
> 
> The current behaviour, disabling the interface, will just lead to
> hostapd hanging without recovering frmo this state. If hostapd shuts
> down, userspace can at least work around and restart hostapd when
> channels are available again.

Shutting down an interface sounds reasonable. Terminating the process
does not, e.g., if there are multiple radios controlled by a single
hostapd process.

> @@ -734,7 +735,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
>  						skip_radar);
>  		if (!channel) {
>  			/* FIXME: Wait for channel(s) to become available */
> -			hostapd_disable_iface(iface);
> +			eloop_terminate();

Calling eloop_terminate() is almost never an acceptable solution if
there is possibility that other radios are being controlled or if the
interface was added through a control interface operation (that control
interface would disappear when hostapd process exists without leaving
any chance for the external control program to add back the interface).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 09:20:24 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 19:20:24 +0200
Subject: Hostapd/wpa_supplicant for Windows
In-Reply-To: <DUB111-W250720EEACAC7F8778A3E2CC900@phx.gbl>
References: <52F89AC2.3080306@globaledgesoft.com>
	<DUB111-W250720EEACAC7F8778A3E2CC900@phx.gbl>
Message-ID: <20140214172024.GB15831@w1.fi>

On Mon, Feb 10, 2014 at 12:03:20PM +0000, Sergio NNX wrote:
> Does someone know where I can download hostapd/wpa_supplicant for Windows from (i.e, the binaries)?

You can find old wpa_supplicant Windows binary releases from
http://w1.fi/releases/

> I had a look here: http://w1.fi/cgit/hostap/plain/wpa_supplicant/README-Windows.txt. However, I couldn't find
> any reference to the Windows binaries.

It should be possible to build wpa_suppliant for Windows, but I'm not
making Windows binary releases anymore.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 09:25:09 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 19:25:09 +0200
Subject: [PATCH 1/2] hostapd: Add Power Constraint element
In-Reply-To: <1391807954-4016-1-git-send-email-marek.puzyniak@tieto.com>
References: <1391807954-4016-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <20140214172509.GC15831@w1.fi>

On Fri, Feb 07, 2014 at 10:19:13PM +0100, Marek Puzyniak wrote:
> From: Srinivasan B <srinivasanb at posedge.com>
> 
> Add Power Constraint information element to Beacon and Probe Response
> frames when hostapd is configured on 5 GHz band and Country information
> element is also added. According to spec IEEE802.11-2012 a STA shall
> determine a local maximum transmit power for the current channel based
> on information derived from Country and Power Constraint elements.

How was this tested?

> +		} else if (os_strcmp(buf, "local_pwr_contraint") == 0) {
> +				conf->local_pwr_constraint = val;

> diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
> +#local_pwr_constraint=3

Note any difference in the spelling?

> +	/*
> +	 * CRDA provides reduced TX power than actual regulatory max TX power.
> +	 * Value of 0 to the local power constraint provides an opportunity
> +	 * for the client devices to operate at the power limit provided by CRDA
> +	 * (for client devices
> +	 * "Local max TX pwr" = regulatory max TX pwr - Local pwr constraint)
> +	 */

This is somewhat confusing statement in the core hostapd code which can
be used with multiple drivers, many of which are not even on Linux,
never mind use CRDA.. Why does this speak about CRDA and is this to be
understood as the functionality not working unless CRDA is used?

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 11:16:08 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 21:16:08 +0200
Subject: [PATCH 1/2] P2P: Addressing few issues seen with Broadcast SD
In-Reply-To: <137202264661b954a4fa6ffea014c5182616aa68.1391502949.git.jithu@broadcom.com>
References: <137202264661b954a4fa6ffea014c5182616aa68.1391502949.git.jithu@broadcom.com>
Message-ID: <20140214191608.GA22228@w1.fi>

On Tue, Feb 04, 2014 at 02:39:00PM +0530, Jithu Jance wrote:
> 1) Suppose we have multiple peers and we have peers advertising
> SD capability, but no services registered for adverstising.
> In this case, even if there are mutliple broadcast queries set,
> we might end up sending only the lastly added Broadcast to the
> same device (Since SD_INFO won't get set for the first broadcast)
> 
> 2) Some times it is seen that before advancing to next device in the
> list, the scan results come and updates SD_SCHEDULE flag. This will
> result in sending the already sent query to the same device without
> giving chance to other devices. This issue again is seen with peer
> devices advertising SD capability without any services registered.

I agree that these issues need to be resolved, but there are still some
issues with the changes here. This breaks couple of the SD test cases:
http://buildbot.w1.fi/hwsim/results.php?run=1392400340
And as such, I cannot apply this.

Please note that I merged in 2/2 to make a single commit (there is no
point in introducing a bug that gets fixed in the second patch in the
same set). In addition, I cleaned up the partial removal of
P2P_DEV_SD_INFO BIT and P2P_DEV_SD_SCHEDULE by removing them completely
since they were either read-only or write-only and did not affect any
operations after the changes.

I have not yet tried to figure out why this breaks things, but anyway,
this cleaned up version would be a good next baseline to use to figure
out what needs to be changed to make sure this does not add any
regressions.


[PATCH] P2P: Address few issues seen with Broadcast SD

1) Suppose we have multiple peers and we have peers advertising SD
capability, but no services registered for advertising. In this case,
even if there are multiple broadcast queries set, we might end up
sending only the last added broadcast query to the same device (Since
SD_INFO won't get set for the first broadcast query).

2) Some times it is seen that before advancing to the next device in the
list, the scan results come and update SD_SCHEDULE flag. This will
result in sending the already sent query to the same device without
giving chance to other devices. This issue again is seen with peer
devices advertising SD capability without any services registered.

Signed-hostap: Jithu Jance <jithu at broadcom.com>
---
 src/p2p/p2p.c    |   22 +++++++++----------
 src/p2p/p2p_i.h  |    9 ++++++--
 src/p2p/p2p_sd.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 73 insertions(+), 22 deletions(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 3010377..5a33b64 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -733,9 +733,6 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
 
 	p2p_parse_free(&msg);
 
-	if (p2p_pending_sd_req(p2p, dev))
-		dev->flags |= P2P_DEV_SD_SCHEDULE;
-
 	if (dev->flags & P2P_DEV_REPORTED)
 		return 0;
 
@@ -2392,6 +2389,7 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)
 
 	p2p->go_timeout = 100;
 	p2p->client_timeout = 20;
+	p2p->num_p2p_sd_queries = 0;
 
 	p2p_dbg(p2p, "initialized");
 	p2p_channels_dump(p2p, "channels", &p2p->cfg->channels);
@@ -2627,7 +2625,13 @@ void p2p_continue_find(struct p2p_data *p2p)
 	struct p2p_device *dev;
 	p2p_set_state(p2p, P2P_SEARCH);
 	dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
-		if (dev->flags & P2P_DEV_SD_SCHEDULE) {
+		if (dev->sd_pending_bcast_queries == 0) {
+			/* Initialize with total number of registered broadcast
+			 * SD queries. */
+			dev->sd_pending_bcast_queries = p2p->num_p2p_sd_queries;
+		}
+
+		if (dev->sd_pending_bcast_queries > 0) {
 			if (p2p_start_sd(p2p, dev) == 0)
 				return;
 			else
@@ -2654,10 +2658,8 @@ static void p2p_sd_cb(struct p2p_data *p2p, int success)
 	p2p->pending_action_state = P2P_NO_PENDING_ACTION;
 
 	if (!success) {
-		if (p2p->sd_peer) {
-			p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
+		if (p2p->sd_peer)
 			p2p->sd_peer = NULL;
-		}
 		p2p_continue_find(p2p);
 		return;
 	}
@@ -3202,7 +3204,6 @@ static void p2p_timeout_sd_during_find(struct p2p_data *p2p)
 	p2p_dbg(p2p, "Service Discovery Query timeout");
 	if (p2p->sd_peer) {
 		p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
-		p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 		p2p->sd_peer = NULL;
 	}
 	p2p_continue_find(p2p);
@@ -3473,7 +3474,7 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  "country=%c%c\n"
 			  "oper_freq=%d\n"
 			  "req_config_methods=0x%x\n"
-			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
+			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
 			  "status=%d\n"
 			  "wait_count=%u\n"
 			  "invitation_reqs=%u\n",
@@ -3496,9 +3497,6 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  dev->flags & P2P_DEV_REPORTED ? "[REPORTED]" : "",
 			  dev->flags & P2P_DEV_NOT_YET_READY ?
 			  "[NOT_YET_READY]" : "",
-			  dev->flags & P2P_DEV_SD_INFO ? "[SD_INFO]" : "",
-			  dev->flags & P2P_DEV_SD_SCHEDULE ? "[SD_SCHEDULE]" :
-			  "",
 			  dev->flags & P2P_DEV_PD_PEER_DISPLAY ?
 			  "[PD_PEER_DISPLAY]" : "",
 			  dev->flags & P2P_DEV_PD_PEER_KEYPAD ?
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index f105083..6de3461 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -81,8 +81,6 @@ struct p2p_device {
 #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
 #define P2P_DEV_REPORTED BIT(1)
 #define P2P_DEV_NOT_YET_READY BIT(2)
-#define P2P_DEV_SD_INFO BIT(3)
-#define P2P_DEV_SD_SCHEDULE BIT(4)
 #define P2P_DEV_PD_PEER_DISPLAY BIT(5)
 #define P2P_DEV_PD_PEER_KEYPAD BIT(6)
 #define P2P_DEV_USER_REJECTED BIT(7)
@@ -110,6 +108,7 @@ struct p2p_device {
 
 	u8 go_timeout;
 	u8 client_timeout;
+	int sd_pending_bcast_queries;
 };
 
 struct p2p_sd_query {
@@ -256,6 +255,12 @@ struct p2p_data {
 	 */
 	struct p2p_sd_query *sd_query;
 
+	/**
+	 * num_p2p_sd_queries - Total number of broadcast SD queries present in
+	 * the list
+	 */
+	int num_p2p_sd_queries;
+
 	/* GO Negotiation data */
 
 	/**
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 0e0c7f1..b7509da 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -52,6 +52,7 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 {
 	struct p2p_sd_query *q;
 	int wsd = 0;
+	int count = 0;
 
 	if (!(dev->info.dev_capab & P2P_DEV_CAPAB_SERVICE_DISCOVERY))
 		return NULL; /* peer does not support SD */
@@ -64,8 +65,17 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 		/* Use WSD only if the peer indicates support or it */
 		if (q->wsd && !wsd)
 			continue;
-		if (q->for_all_peers && !(dev->flags & P2P_DEV_SD_INFO))
-			return q;
+		/* if the query is a broadcast query */
+		if (q->for_all_peers) {
+			/* check if there are any broadcast queries pending for
+			 * this device */
+			if (dev->sd_pending_bcast_queries <= 0)
+				return NULL;
+			/* query number that needs to be send to the device */
+			if (count == dev->sd_pending_bcast_queries - 1)
+				return q;
+			count++;
+		}
 		if (!q->for_all_peers &&
 		    os_memcmp(q->peer, dev->info.p2p_device_addr, ETH_ALEN) ==
 		    0)
@@ -76,14 +86,36 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 }
 
 
+static void p2p_decrease_sd_bc_queries(struct p2p_data *p2p, int query_number)
+{
+	struct p2p_device *dev;
+
+	p2p->num_p2p_sd_queries--;
+	dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
+		if (query_number <= dev->sd_pending_bcast_queries - 1) {
+			/*
+			 * Query not yet sent to the device and it is to be
+			 * removed, so update the pending count.
+			 */
+			dev->sd_pending_bcast_queries--;
+		}
+	}
+}
+
+
 static int p2p_unlink_sd_query(struct p2p_data *p2p,
 			       struct p2p_sd_query *query)
 {
 	struct p2p_sd_query *q, *prev;
+	int query_number = 0;
 	q = p2p->sd_queries;
 	prev = NULL;
 	while (q) {
 		if (q == query) {
+			/* If the query is a broadcast query, decrease one from
+			 * all the devices */
+			if (query->for_all_peers)
+				p2p_decrease_sd_bc_queries(p2p, query_number);
 			if (prev)
 				prev->next = q->next;
 			else
@@ -92,6 +124,8 @@ static int p2p_unlink_sd_query(struct p2p_data *p2p,
 				p2p->sd_query = NULL;
 			return 1;
 		}
+		if (q->for_all_peers)
+			query_number++;
 		prev = q;
 		q = q->next;
 	}
@@ -118,6 +152,7 @@ void p2p_free_sd_queries(struct p2p_data *p2p)
 		q = q->next;
 		p2p_free_sd_query(prev);
 	}
+	p2p->num_p2p_sd_queries = 0;
 }
 
 
@@ -262,6 +297,16 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
 		ret = -1;
 	}
 
+	/* Update the pending broadcast SD query count for this device */
+	dev->sd_pending_bcast_queries--;
+
+	/*
+	 * If there are no pending broadcast queries for this device, mark it as
+	 * done (-1).
+	 */
+	if (dev->sd_pending_bcast_queries == 0)
+		dev->sd_pending_bcast_queries = -1;
+
 	wpabuf_free(req);
 
 	return ret;
@@ -541,8 +586,6 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
 	p2p_dbg(p2p, "Service Update Indicator: %u", update_indic);
 	pos += 2;
 
-	p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
-	p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 	p2p->sd_peer = NULL;
 
 	if (p2p->sd_query) {
@@ -787,8 +830,6 @@ skip_nqp_header:
 		return;
 	}
 
-	p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
-	p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 	p2p->sd_peer = NULL;
 
 	if (p2p->sd_query) {
@@ -841,8 +882,15 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
 
 	if (dst == NULL) {
 		struct p2p_device *dev;
-		dl_list_for_each(dev, &p2p->devices, struct p2p_device, list)
-			dev->flags &= ~P2P_DEV_SD_INFO;
+		p2p->num_p2p_sd_queries++;
+
+		/* Update all the devices for the newly added broadcast query */
+		dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
+			if (dev->sd_pending_bcast_queries <= 0)
+				dev->sd_pending_bcast_queries = 1;
+			else
+				dev->sd_pending_bcast_queries++;
+		}
 	}
 
 	return q;
-- 
1.7.9.5

 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 11:59:53 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 21:59:53 +0200
Subject: [PATCH] hostapd: Enable 802.11w in defconfig
In-Reply-To: <1391765516-19183-1-git-send-email-helmut.schaa@googlemail.com>
References: <1391765516-19183-1-git-send-email-helmut.schaa@googlemail.com>
Message-ID: <20140214195953.GA23689@w1.fi>

On Fri, Feb 07, 2014 at 10:31:56AM +0100, Helmut Schaa wrote:
> 802.11w is ratified since 2009 already. So this comment does not seem
> to be valid anymore.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 12:00:17 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 22:00:17 +0200
Subject: [PATCH V4] hostapd: Add Operating Mode Notification support
In-Reply-To: <1392036185-4650-1-git-send-email-marek.kwaczynski@tieto.com>
References: <1392036185-4650-1-git-send-email-marek.kwaczynski@tieto.com>
Message-ID: <20140214200017.GB23689@w1.fi>

On Mon, Feb 10, 2014 at 01:43:05PM +0100, Marek Kwaczynski wrote:
> Handling Operating Mode Notification received in Assoc Request.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 14 12:00:33 2014
From: j (Jouni Malinen)
Date: Fri, 14 Feb 2014 22:00:33 +0200
Subject: [PATCH 3/3] nl80211: use nl80211_set_iface_id() to get hw
	features data
In-Reply-To: <1392283441-13612-3-git-send-email-ilan.peer@intel.com>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
	<1392283441-13612-3-git-send-email-ilan.peer@intel.com>
Message-ID: <20140214200033.GC23689@w1.fi>

On Thu, Feb 13, 2014 at 11:24:01AM +0200, Ilan Peer wrote:
> Use nl80211_set_iface_id() in wpa_driver_nl80211_get_hw_feature_data(),
> as otherwise the function fails for a P2P Device interface (which does
> not have a netdev associated with it).

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From greearb  Fri Feb 14 12:17:30 2014
From: greearb (Ben Greear)
Date: Fri, 14 Feb 2014 12:17:30 -0800
Subject: Question on wpa_supplicant and FT over DS.
In-Reply-To: <20140214093031.GA7243@w1.fi>
References: <52FD61D8.6020606@candelatech.com> <20140214093031.GA7243@w1.fi>
Message-ID: <52FE79DA.9070908@candelatech.com>

On 02/14/2014 01:30 AM, Jouni Malinen wrote:
> On Thu, Feb 13, 2014 at 04:22:48PM -0800, Ben Greear wrote:
>> Does wpa_supplicant properly support FT over DS?  It seems that when
>> we tell it to roam to a new AP using wpa_cli, it always does over-the-air
>> even when AP is beaconing as being FT over DS.
> 
> Yes.
> 
>> Is this a feature that needs special configuration, or maybe some
>> special hint when initiating a roam through the CLI?
> 
> FT_DS command needs to be used if you want to force FT-over-DS to be
> used (and no, it would never be used automatically in the current
> implementation if I remember correctly).


Ok, using ft_ds wpa_cli command seems to do the trick.  I might have found
a bug though...after a large number of ft_ds roams, it started to fail to
roam and I saw large amounts of spam in the supplicant logs:

1392407947.289795: sta1: CTRL-EVENT-EAP-FAILURE EAP authentication failed
1392407947.289799: EAPOL: SUPP_PAE entering state AUTHENTICATING
1392407947.289803: EAPOL: SUPP_BE entering state FAIL
1392407947.289806: EAPOL: SUPP_PAE entering state HELD
1392407947.289810: EAPOL: Supplicant port status: Unauthorized
1392407947.289813: nl80211: Set supplicant port unauthorized for dc:a5:f4:ff:4f:ae
1392407947.289831: EAPOL: SUPP_BE entering state IDLE
1392407947.289836: EAPOL: SUPP_PAE entering state RESTART
1392407947.289840: EAP: EAP entering state INITIALIZE
1392407947.289844: EAP: EAP entering state IDLE
1392407947.289847: EAP: EAP entering state FAILURE
1392407947.289851: sta1: CTRL-EVENT-EAP-FAILURE EAP authentication failed
1392407947.289855: EAPOL: SUPP_PAE entering state AUTHENTICATING
1392407947.289859: EAPOL: SUPP_BE entering state FAIL
1392407947.289862: EAPOL: SUPP_PAE entering state HELD
1392407947.289865: EAPOL: Supplicant port status: Unauthorized
1392407947.289869: nl80211: Set supplicant port unauthorized for dc:a5:f4:ff:4f:ae

I have logging set on verbose, and since no other logging messages
are shown during this spammage, it seems to me that this might be some
state machine malfunction?

It eventually recovered and started roaming properly again.  The logs wrapped
and went away before I could capture the transition back to normal
behaviour.

Thanks,
Ben

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



From andersk  Fri Feb 14 21:21:32 2014
From: andersk (Anders Kaseorg)
Date: Sat, 15 Feb 2014 00:21:32 -0500 (EST)
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
Message-ID: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>

Commit 51e3eafb68e15e78e98ca955704be8a6c3a7b304 was too strict in
forbidding certificates marked for client use.  For example, this
broke the MIT SECURE wireless network.  The extended key usage is a
_list_ of allowed uses, and rather than checking that client use is
not in the list, we should check that server use is in the list.

Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
 src/crypto/tls.h         |  2 +-
 src/crypto/tls_openssl.c | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/crypto/tls.h b/src/crypto/tls.h
index 287fd33..3f07600 100644
--- a/src/crypto/tls.h
+++ b/src/crypto/tls.h
@@ -42,7 +42,7 @@ enum tls_fail_reason {
 	TLS_FAIL_BAD_CERTIFICATE = 7,
 	TLS_FAIL_SERVER_CHAIN_PROBE = 8,
 	TLS_FAIL_DOMAIN_SUFFIX_MISMATCH = 9,
-	TLS_FAIL_SERVER_USED_CLIENT_CERT = 10
+	TLS_FAIL_NON_SERVER_KEY_USAGE = 10,
 };
 
 union tls_event_data {
diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index d025ae0..485a21e 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -1479,11 +1479,13 @@ static int tls_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx)
 
 	if (!conn->server && err_cert && preverify_ok && depth == 0 &&
 	    (err_cert->ex_flags & EXFLAG_XKUSAGE) &&
-	    (err_cert->ex_xkusage & XKU_SSL_CLIENT)) {
-		wpa_printf(MSG_WARNING, "TLS: Server used client certificate");
+	    !(err_cert->ex_xkusage & XKU_SSL_SERVER)) {
+		wpa_printf(MSG_WARNING, "TLS: Server certificate marked for "
+			   "non-server key usage");
 		openssl_tls_fail_event(conn, err_cert, err, depth, buf,
-				       "Server used client certificate",
-				       TLS_FAIL_SERVER_USED_CLIENT_CERT);
+				       "Server certificate marked for "
+				       "non-server key usage",
+				       TLS_FAIL_NON_SERVER_KEY_USAGE);
 		preverify_ok = 0;
 	}
 
-- 
1.9.0.rc3



From j  Fri Feb 14 23:48:31 2014
From: j (Jouni Malinen)
Date: Sat, 15 Feb 2014 09:48:31 +0200
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
Message-ID: <20140215074831.GA4045@w1.fi>

On Sat, Feb 15, 2014 at 12:21:32AM -0500, Anders Kaseorg wrote:
> Commit 51e3eafb68e15e78e98ca955704be8a6c3a7b304 was too strict in
> forbidding certificates marked for client use.  For example, this
> broke the MIT SECURE wireless network.  The extended key usage is a
> _list_ of allowed uses, and rather than checking that client use is
> not in the list, we should check that server use is in the list.

This is unfortunate.. This check was added based on an explicit
specification requirement on the server certificate being rejected if
it contains id-kp-clientAuth and as such, that commit was actually
following that requirement on purpose in the way that would trigger
based on any entry matching.

I understand the view that this should not break (reasonably) deployed
existing networks and this may require some reconsideration. However, I
don't think that this change to require id-kp-serverAuth to be present
would be good either since it would likely break even more use cases. It
might be more reasonable to reject the server based on id-kp-clientAuth
being present without id-kp-serverAuth.

Would it be possible to get the MIT SECURE server certificate that hits
this new constraint on id-kp-clientAuth being present? This would be
useful for further discussion on possible spec changes/clarifications.

-- 
Jouni Malinen                                            PGP id EFC895FA


From andersk  Sat Feb 15 02:24:38 2014
From: andersk (Anders Kaseorg)
Date: Sat, 15 Feb 2014 05:24:38 -0500
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <20140215074831.GA4045@w1.fi>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi>
Message-ID: <52FF4066.8090104@mit.edu>

On 02/15/2014 02:48 AM, Jouni Malinen wrote:
> On Sat, Feb 15, 2014 at 12:21:32AM -0500, Anders Kaseorg wrote:
>> Commit 51e3eafb68e15e78e98ca955704be8a6c3a7b304 was too strict in
>> forbidding certificates marked for client use.  For example, this
>> broke the MIT SECURE wireless network.  The extended key usage is a
>> _list_ of allowed uses, and rather than checking that client use is
>> not in the list, we should check that server use is in the list.
>
> This is unfortunate.. This check was added based on an explicit
> specification requirement on the server certificate being rejected if
> it contains id-kp-clientAuth and as such, that commit was actually
> following that requirement on purpose in the way that would trigger
> based on any entry matching.

I?m not seeing that specification requirement.  I looked at EAP-TLS (RFC 
5216):

    Implementations SHOULD use the Extended Key
    Usage (see Section 4.2.1.13 of [RFC3280]) extension and ensure that
    at least one of the following is true:

    1) The certificate issuer included no Extended Key Usage identifiers
       in the certificate.
    2) The issuer included the anyExtendedKeyUsage identifier in the
       certificate (see Section 4.2.1.13 of [RFC3280]).
    3) The issuer included the id-kp-serverAuth identifier in the
       certificate (see Section 4.2.1.13 [RFC3280]).

and EAP-TTLS (RFC 5281):

    Clients and servers should implement policies related to the Extended
    Key Usage (EKU) extension [RFC5280] of certificates it receives, to
    ensure that the other party's certificate usage conforms to the
    certificate's purpose.  Typically, a client EKU, when present, would
    be expected to include id-kp-clientAuth; a server EKU, when present,
    would be expected to include id-kp-serverAuth.  Note that absence of
    the EKU extension or a value of anyExtendedKeyUsage implies absence
    of constraint on the certificate's purpose.

and the specification of id-ce-extKeyUsage itself (RFC 5280):

    If the extension is present, then the certificate MUST only be used
    for one of the purposes indicated.  If multiple purposes are
    indicated the application need not recognize all purposes indicated,
    as long as the intended purpose is present.  Certificate using
    applications MAY require that the extended key usage extension be
    present and that a particular purpose be indicated in order for the
    certificate to be acceptable to that application.

    If a CA includes extended key usages to satisfy such applications,
    but does not wish to restrict usages of the key, the CA can include
    the special KeyPurposeId anyExtendedKeyUsage in addition to the
    particular key purposes required by the applications.  Conforming CAs
    SHOULD NOT mark this extension as critical if the anyExtendedKeyUsage
    KeyPurposeId is present.  Applications that require the presence of a
    particular purpose MAY reject certificates that include the
    anyExtendedKeyUsage OID but not the particular OID expected for the
    application.

This is all about requiring certain key usage values to be included; 
there?s nothing about requiring other values to be excluded.

Admittedly, I should fix the patch to accept anyExtendedKeyUsage 
(XKU_ANYEKU) as well.

> I understand the view that this should not break (reasonably) deployed
> existing networks and this may require some reconsideration. However, I
> don't think that this change to require id-kp-serverAuth to be present
> would be good either since it would likely break even more use cases. It
> might be more reasonable to reject the server based on id-kp-clientAuth
> being present without id-kp-serverAuth.

We don?t reject if the EKU extension is missing entirely, and my patch 
doesn?t change that.  Are you worried about certificates that explicitly 
include an EKU extension listing none of id-kp-clientAuth, 
id-kp-serverAuth, or anyExtendedKeyUsage?

> Would it be possible to get the MIT SECURE server certificate that hits
> this new constraint on id-kp-clientAuth being present? This would be
> useful for further discussion on possible spec changes/clarifications.

Can I extract it from wpa_supplicant?  (I don?t have any kind of special 
access to the servers.  All that MIT provides is these fingerprints: 
http://kb.mit.edu/confluence/x/YgAwB .)

Anders



From andersk  Sat Feb 15 02:28:27 2014
From: andersk (Anders Kaseorg)
Date: Sat, 15 Feb 2014 05:28:27 -0500 (EST)
Subject: [PATCH v2] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <52FF4066.8090104@mit.edu>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi> <52FF4066.8090104@mit.edu>
Message-ID: <alpine.DEB.2.02.1402150527020.43540@department-of-alchemy.MIT.EDU>

Commit 51e3eafb68e15e78e98ca955704be8a6c3a7b304 was too strict in
forbidding certificates marked for client use.  For example, this
broke the MIT SECURE wireless network.  The extended key usage is a
_list_ of allowed uses, and rather than checking that client use is
not in the list, we should check that server use is in the list.

Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
(Change from v1: accept XKU_ANYEKU.)

 src/crypto/tls.h         |  2 +-
 src/crypto/tls_openssl.c | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/crypto/tls.h b/src/crypto/tls.h
index 287fd33..3f07600 100644
--- a/src/crypto/tls.h
+++ b/src/crypto/tls.h
@@ -42,7 +42,7 @@ enum tls_fail_reason {
 	TLS_FAIL_BAD_CERTIFICATE = 7,
 	TLS_FAIL_SERVER_CHAIN_PROBE = 8,
 	TLS_FAIL_DOMAIN_SUFFIX_MISMATCH = 9,
-	TLS_FAIL_SERVER_USED_CLIENT_CERT = 10
+	TLS_FAIL_NON_SERVER_KEY_USAGE = 10,
 };
 
 union tls_event_data {
diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index d025ae0..a935e4b 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -1479,11 +1479,13 @@ static int tls_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx)
 
 	if (!conn->server && err_cert && preverify_ok && depth == 0 &&
 	    (err_cert->ex_flags & EXFLAG_XKUSAGE) &&
-	    (err_cert->ex_xkusage & XKU_SSL_CLIENT)) {
-		wpa_printf(MSG_WARNING, "TLS: Server used client certificate");
+	    !(err_cert->ex_xkusage & (XKU_SSL_SERVER | XKU_ANYEKU))) {
+		wpa_printf(MSG_WARNING, "TLS: Server certificate marked for "
+			   "non-server key usage");
 		openssl_tls_fail_event(conn, err_cert, err, depth, buf,
-				       "Server used client certificate",
-				       TLS_FAIL_SERVER_USED_CLIENT_CERT);
+				       "Server certificate marked for "
+				       "non-server key usage",
+				       TLS_FAIL_NON_SERVER_KEY_USAGE);
 		preverify_ok = 0;
 	}
 
-- 
1.9.0



From andersk  Sat Feb 15 02:46:00 2014
From: andersk (Anders Kaseorg)
Date: Sat, 15 Feb 2014 05:46:00 -0500 (EST)
Subject: [PATCH v2] OpenSSL: Accept certificates marked for both server
	and client use
In-Reply-To: <alpine.DEB.2.02.1402150527020.43540@department-of-alchemy.MIT.EDU>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi> <52FF4066.8090104@mit.edu>
	<alpine.DEB.2.02.1402150527020.43540@department-of-alchemy.MIT.EDU>
Message-ID: <alpine.DEB.2.02.1402150541120.43540@department-of-alchemy.MIT.EDU>

On Sat, 15 Feb 2014, Anders Kaseorg wrote:
> (Change from v1: accept XKU_ANYEKU.)

Argh, it always has to be more complicated: XKU_ANYEKU is new in OpenSSL 
1.1.x Git and not yet in any released version of OpenSSL.  So the only 
correct thing I think we can do is put #ifdef XKU_ANYEKU around the entire 
check, causing it to be skipped for OpenSSL versions that aren?t from the 
future.

Does that sound reasonable?

Anders


From j  Sat Feb 15 03:11:40 2014
From: j (Jouni Malinen)
Date: Sat, 15 Feb 2014 13:11:40 +0200
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <52FF4066.8090104@mit.edu>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi> <52FF4066.8090104@mit.edu>
Message-ID: <20140215111140.GA30581@w1.fi>

On Sat, Feb 15, 2014 at 05:24:38AM -0500, Anders Kaseorg wrote:
> I?m not seeing that specification requirement.  I looked at EAP-TLS
> (RFC 5216):

> This is all about requiring certain key usage values to be included;
> there?s nothing about requiring other values to be excluded.

I know. I was referring to a different specification (sorry, cannot talk
about details yet).

> We don?t reject if the EKU extension is missing entirely, and my
> patch doesn?t change that.  Are you worried about certificates that
> explicitly include an EKU extension listing none of
> id-kp-clientAuth, id-kp-serverAuth, or anyExtendedKeyUsage?

To be honest, I did not notice that, but I was thinking of not including
id-kp-serverAuth and now that you say it, I guess that could also happen
with an EKU (for something completely different) being included. I don't
think id-kp-serverAuth is universally used, so I don't really want to
mandate it. id-kp-clientAuth alone is actually already rejected by
OpenSSL, so no need for that separately in tls_openssl.c.

> >Would it be possible to get the MIT SECURE server certificate that hits
> >this new constraint on id-kp-clientAuth being present? This would be
> >useful for further discussion on possible spec changes/clarifications.
> 
> Can I extract it from wpa_supplicant?  (I don?t have any kind of
> special access to the servers.  All that MIT provides is these
> fingerprints: http://kb.mit.edu/confluence/x/YgAwB .)

You can extract the server certificate with a connection to probe for
such information. For example, in wpa_cli:

add_network
set_network 0 ssid "your ssid"
set_network 0 key_mgmt WPA-EAP
set_network 0 eap TTLS
set_network 0 identity "probe"
set_network 0 ca_cert "probe://"
select_network 0
...
CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/C=FI/O=w1.fi/CN=server.w1.fi' cert=30820295308201....


There's going to be number of CTRL-EVENT-EAP-PEER-CERT events listed
here. I'm most interested in the one with depth=0 and cert=<hexdump>
value which is the hexdump of the DER encoding X.509 certificate of the
authentication server. Anyway, if you can send all those
CTRL-EVENT-EAP-PEER-CERT events, that would give even better picture by
including all the CA certificates.

-- 
Jouni Malinen                                            PGP id EFC895FA


From ghudson  Sat Feb 15 08:27:46 2014
From: ghudson (Greg Hudson)
Date: Sat, 15 Feb 2014 11:27:46 -0500
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <20140215111140.GA30581@w1.fi>
Message-ID: <x7d38jk8hod.fsf@equal-rites.mit.edu>

>> This is all about requiring certain key usage values to be included;
>> there?s nothing about requiring other values to be excluded.

> I know. I was referring to a different specification (sorry, cannot
> talk about details yet).

I'm having trouble imagining a valid reason for anyone to try to
respecify X.509 EKU purposes as restrictive via an embargoed document.
http://tools.ietf.org/html/rfc5280#section-4.2.1.12 makes it clear that
key purposes are permissive, although the presence of an EKU at all is
restrictive (if the application understands what EKUs are or if the
extension is marked critical).

Every web server SSL certificate I can find contains an EKU with
id-kp-clientAuth and id-kp-serverAuth, leading me to believe that CAs
issue certificates with both purposes as a matter of course, and that
this check probably breaks most real-world usage of WPA.


From janusz.dziedzic  Sat Feb 15 10:37:21 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Sat, 15 Feb 2014 19:37:21 +0100
Subject: [PATCH 1/2] hostapd: DFS allow mixed channels
Message-ID: <1392489442-14770-1-git-send-email-janusz.dziedzic@tieto.com>

Allow mixed DFS and non-DFS channels.
Eg. VHT160 on channels 36-64.
Usefull for testing with mac80211_hwsim
and VHT160.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/ap/dfs.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index ec691db..b8ffaec 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -296,6 +296,13 @@ static int dfs_check_chans_available(struct hostapd_iface *iface,
 
 	for(i = 0; i < n_chans; i++) {
 		channel = &mode->channels[start_chan_idx + i];
+
+		if (channel->flag & HOSTAPD_CHAN_DISABLED)
+			break;
+
+		if (!(channel->flag & HOSTAPD_CHAN_RADAR))
+			continue;
+
 		if ((channel->flag & HOSTAPD_CHAN_DFS_MASK) !=
 		    HOSTAPD_CHAN_DFS_AVAILABLE)
 			break;
-- 
1.7.9.5



From janusz.dziedzic  Sat Feb 15 10:37:22 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Sat, 15 Feb 2014 19:37:22 +0100
Subject: [PATCH 2/2] hostapd: DFS, add VHT160 available channels
In-Reply-To: <1392489442-14770-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1392489442-14770-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <1392489442-14770-2-git-send-email-janusz.dziedzic@tieto.com>

Add VHT160 available channels, we can choose
when detect radar event.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/ap/dfs.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index b8ffaec..692b717 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -78,6 +78,11 @@ static int dfs_is_chan_allowed(struct hostapd_channel_data *chan, int n_chans)
 	 * 42, 58, 106, 122, 138, 155
 	 */
 	int allowed_80[] = { 36, 52, 100, 116, 132, 149 };
+	/*
+	 * VHT160 valid channels based on center frequency:
+	 * 50, 114
+	 */
+	int allowed_160[] = { 36, 100 };
 	int *allowed = allowed_40;
 	unsigned int i, allowed_no = 0;
 
@@ -90,6 +95,10 @@ static int dfs_is_chan_allowed(struct hostapd_channel_data *chan, int n_chans)
 		allowed = allowed_80;
 		allowed_no = ARRAY_SIZE(allowed_80);
 		break;
+	case 8:
+		allowed = allowed_160;
+		allowed_no = ARRAY_SIZE(allowed_160);
+		break;
 	default:
 		wpa_printf(MSG_DEBUG, "Unknown width for %d channels", n_chans);
 		break;
-- 
1.7.9.5



From janusz.dziedzic  Sat Feb 15 10:44:33 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Sat, 15 Feb 2014 19:44:33 +0100
Subject: [PATCH] wpa_supplicant: add support for IPv6 when CTRL UDP used
Message-ID: <1392489873-15001-1-git-send-email-janusz.dziedzic@tieto.com>

Add IPv6 support when using udp/udp-remote control
interface. Added new config options:
CONFIG_CTRL_IFACE=udp6
CONFIG_CTRL_IFACE=udp6-remote

This is usefull for testing, while we don't need
assign IPv4 address (static or using dhcpd) and just
use auto configured IPv6 addresses - link local, which
base on mac address. Added also scope id support for
link local case.

Eg.
./wpa_cli
./wpa_cli -i ::1,9877
./wpa_cli -i fe80::203:7fff:fe05:69%wlan0,9877

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/common/wpa_ctrl.c           |   71 ++++++++++++++++++++++++++--
 wpa_supplicant/Makefile         |   11 +++++
 wpa_supplicant/ctrl_iface_udp.c |   97 +++++++++++++++++++++++++++++++++++++--
 wpa_supplicant/defconfig        |    2 +
 4 files changed, 174 insertions(+), 7 deletions(-)

diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c
index f4af94a..2b0c3bd 100644
--- a/src/common/wpa_ctrl.c
+++ b/src/common/wpa_ctrl.c
@@ -25,6 +25,10 @@
 #include "private/android_filesystem_config.h"
 #endif /* ANDROID */
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+#include <net/if.h>
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
+
 #include "wpa_ctrl.h"
 #include "common.h"
 
@@ -46,8 +50,13 @@
 struct wpa_ctrl {
 #ifdef CONFIG_CTRL_IFACE_UDP
 	int s;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 local;
+	struct sockaddr_in6 dest;
+#else
 	struct sockaddr_in local;
 	struct sockaddr_in dest;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	char *cookie;
 	char *remote_ifname;
 	char *remote_ip;
@@ -279,19 +288,33 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 		return NULL;
 	os_memset(ctrl, 0, sizeof(*ctrl));
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	ctrl->s = socket(PF_INET6, SOCK_DGRAM, 0);
+#else
 	ctrl->s = socket(PF_INET, SOCK_DGRAM, 0);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	if (ctrl->s < 0) {
 		perror("socket");
 		os_free(ctrl);
 		return NULL;
 	}
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	ctrl->local.sin6_family = AF_INET6;
+#ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
+	ctrl->local.sin6_addr = in6addr_any;
+#else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+	inet_pton(AF_INET6, "::1", &ctrl->local.sin6_addr);
+#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#else /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	ctrl->local.sin_family = AF_INET;
 #ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
 	ctrl->local.sin_addr.s_addr = INADDR_ANY;
 #else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 	ctrl->local.sin_addr.s_addr = htonl((127 << 24) | 1);
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
+
 	if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
 		 sizeof(ctrl->local)) < 0) {
 		close(ctrl->s);
@@ -299,14 +322,24 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 		return NULL;
 	}
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	ctrl->dest.sin6_family = AF_INET6;
+	inet_pton(AF_INET6, "::1", &ctrl->dest.sin6_addr);
+	ctrl->dest.sin6_port = htons(WPA_CTRL_IFACE_PORT);
+#else
 	ctrl->dest.sin_family = AF_INET;
 	ctrl->dest.sin_addr.s_addr = htonl((127 << 24) | 1);
 	ctrl->dest.sin_port = htons(WPA_CTRL_IFACE_PORT);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 #ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
 	if (ctrl_path) {
 		char *port, *name;
 		int port_id;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		char *scope;
+		int scope_id = 0;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 		name = os_strdup(ctrl_path);
 		if (name == NULL) {
@@ -314,7 +347,11 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 			os_free(ctrl);
 			return NULL;
 		}
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		port = os_strchr(name, ',');
+#else
 		port = os_strchr(name, ':');
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 		if (port) {
 			port_id = atoi(&port[1]);
@@ -322,9 +359,19 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 		} else
 			port_id = WPA_CTRL_IFACE_PORT;
 
-		h = gethostbyname(name);
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		scope = os_strchr(name, '%');
+		if (scope) {
+			scope_id = if_nametoindex(&scope[1]);
+			scope[0] = '\0';
+		}
+		h = gethostbyname2(name, AF_INET6);
+#else
+		h = gethostbyname2(name, AF_INET);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 		ctrl->remote_ip = os_strdup(name);
 		os_free(name);
+
 		if (h == NULL) {
 			perror("gethostbyname");
 			close(ctrl->s);
@@ -332,16 +379,32 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 			os_free(ctrl);
 			return NULL;
 		}
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		ctrl->dest.sin6_scope_id = scope_id;
+		ctrl->dest.sin6_port = htons(port_id);
+		os_memcpy(&ctrl->dest.sin6_addr, h->h_addr, h->h_length);
+#else
 		ctrl->dest.sin_port = htons(port_id);
-		os_memcpy(h->h_addr, (char *) &ctrl->dest.sin_addr.s_addr,
-			  h->h_length);
+		os_memcpy(&ctrl->dest.sin_addr.s_addr, h->h_addr, h->h_length);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	} else
 		ctrl->remote_ip = os_strdup("localhost");
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 
 	if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest,
 		    sizeof(ctrl->dest)) < 0) {
-		perror("connect");
+		char con_error[1000];
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		char addr[INET_ADDRSTRLEN];
+		snprintf(con_error, 1000, "connect %s %d",
+		       inet_ntop(AF_INET6, &ctrl->dest.sin6_addr, addr, sizeof(ctrl->dest)),
+		       ntohs(ctrl->dest.sin6_port));
+#else
+		snprintf(con_error, 1000, "connect %s %d",
+		       inet_ntoa(ctrl->dest.sin_addr),
+		       ntohs(ctrl->dest.sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
+		perror(con_error);
 		close(ctrl->s);
 		os_free(ctrl->remote_ip);
 		os_free(ctrl);
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index d1e11a3..c82c055 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1259,6 +1259,11 @@ endif
 ifeq ($(CONFIG_CTRL_IFACE), udp)
 CFLAGS += -DCONFIG_CTRL_IFACE_UDP
 endif
+ifeq ($(CONFIG_CTRL_IFACE), udp6)
+CONFIG_CTRL_IFACE=udp
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
+endif
 ifeq ($(CONFIG_CTRL_IFACE), named_pipe)
 CFLAGS += -DCONFIG_CTRL_IFACE_NAMED_PIPE
 endif
@@ -1267,6 +1272,12 @@ CONFIG_CTRL_IFACE=udp
 CFLAGS += -DCONFIG_CTRL_IFACE_UDP
 CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
 endif
+ifeq ($(CONFIG_CTRL_IFACE), udp6-remote)
+CONFIG_CTRL_IFACE=udp
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
+endif
 OBJS += ctrl_iface.o ctrl_iface_$(CONFIG_CTRL_IFACE).o
 endif
 
diff --git a/wpa_supplicant/ctrl_iface_udp.c b/wpa_supplicant/ctrl_iface_udp.c
index 8c09ba1..46fc154 100644
--- a/wpa_supplicant/ctrl_iface_udp.c
+++ b/wpa_supplicant/ctrl_iface_udp.c
@@ -30,7 +30,11 @@
  */
 struct wpa_ctrl_dst {
 	struct wpa_ctrl_dst *next;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 addr;
+#else
 	struct sockaddr_in addr;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	socklen_t addrlen;
 	int debug_level;
 	int errors;
@@ -51,38 +55,66 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
 
 
 static int wpa_supplicant_ctrl_iface_attach(struct ctrl_iface_priv *priv,
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+					    struct sockaddr_in6 *from,
+#else
 					    struct sockaddr_in *from,
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 					    socklen_t fromlen)
 {
 	struct wpa_ctrl_dst *dst;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET_ADDRSTRLEN];
+#endif /* CONFIG_UDP_IPV6 */
 
 	dst = os_zalloc(sizeof(*dst));
 	if (dst == NULL)
 		return -1;
-	os_memcpy(&dst->addr, from, sizeof(struct sockaddr_in));
+	os_memcpy(&dst->addr, from, sizeof(*from));
 	dst->addrlen = fromlen;
 	dst->debug_level = MSG_INFO;
 	dst->next = priv->ctrl_dst;
 	priv->ctrl_dst = dst;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor attached %s:%d",
+		   inet_ntop(AF_INET6, &from->sin6_addr, addr, sizeof(*from)),
+		   ntohs(from->sin6_port));
+#else
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor attached %s:%d",
 		   inet_ntoa(from->sin_addr), ntohs(from->sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	return 0;
 }
 
 
 static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+					    struct sockaddr_in6 *from,
+#else
 					    struct sockaddr_in *from,
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 					    socklen_t fromlen)
 {
 	struct wpa_ctrl_dst *dst, *prev = NULL;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	dst = priv->ctrl_dst;
 	while (dst) {
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		if (from->sin6_port == dst->addr.sin6_port &&
+		    !memcmp(&from->sin6_addr, &dst->addr.sin6_addr, sizeof(from->sin6_addr))) {
+			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor detached %s:%d",
+				   inet_ntop(AF_INET6, &from->sin6_addr, addr, sizeof(*from)),
+				   ntohs(from->sin6_port));
+#else
 		if (from->sin_addr.s_addr == dst->addr.sin_addr.s_addr &&
 		    from->sin_port == dst->addr.sin_port) {
 			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor detached "
 				   "%s:%d", inet_ntoa(from->sin_addr),
 				   ntohs(from->sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 			if (prev == NULL)
 				priv->ctrl_dst = dst->next;
 			else
@@ -98,21 +130,36 @@ static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
 
 
 static int wpa_supplicant_ctrl_iface_level(struct ctrl_iface_priv *priv,
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+					   struct sockaddr_in6 *from,
+#else
 					   struct sockaddr_in *from,
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 					   socklen_t fromlen,
 					   char *level)
 {
 	struct wpa_ctrl_dst *dst;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE LEVEL %s", level);
 
 	dst = priv->ctrl_dst;
 	while (dst) {
+#if CONFIG_CTRL_IFACE_UDP_IPV6
+		if (from->sin6_port == dst->addr.sin6_port &&
+		    !memcmp(&from->sin6_addr, &dst->addr.sin6_addr, sizeof(from->sin6_addr))) {
+			wpa_printf(MSG_DEBUG, "CTRL_IFACE changed monitor level %s:%d",
+				   inet_ntop(AF_INET6, &from->sin6_addr, addr, sizeof(*from)),
+				   ntohs(from->sin6_port));
+#else
 		if (from->sin_addr.s_addr == dst->addr.sin_addr.s_addr &&
 		    from->sin_port == dst->addr.sin_port) {
 			wpa_printf(MSG_DEBUG, "CTRL_IFACE changed monitor "
 				   "level %s:%d", inet_ntoa(from->sin_addr),
 				   ntohs(from->sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 			dst->debug_level = atoi(level);
 			return 0;
 		}
@@ -150,7 +197,14 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 	struct ctrl_iface_priv *priv = sock_ctx;
 	char buf[256], *pos;
 	int res;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 from;
+#ifndef CONFIG_CTRL_IFACE_UDP_REMOTE
+	char addr[INET_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#else
 	struct sockaddr_in from;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	socklen_t fromlen = sizeof(from);
 	char *reply = NULL;
 	size_t reply_len = 0;
@@ -165,6 +219,13 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 	}
 
 #ifndef CONFIG_CTRL_IFACE_UDP_REMOTE
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	inet_ntop(AF_INET6, &from.sin6_addr, addr, sizeof(from));
+	if (strcmp(addr, "::1")) {
+		wpa_printf(MSG_DEBUG, "CTRL: Drop packet from unexpected "
+			   "source %s", addr);
+	}
+#else
 	if (from.sin_addr.s_addr != htonl((127 << 24) | 1)) {
 		/*
 		 * The OS networking stack is expected to drop this kind of
@@ -176,6 +237,7 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 			   "source %s", inet_ntoa(from.sin_addr));
 		return;
 	}
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 
 	buf[res] = '\0';
@@ -269,8 +331,14 @@ struct ctrl_iface_priv *
 wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
 {
 	struct ctrl_iface_priv *priv;
-	struct sockaddr_in addr;
 	int port = WPA_CTRL_IFACE_PORT;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 addr;
+	int domain = PF_INET6;
+#else
+	struct sockaddr_in addr;
+	int domain = PF_INET;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	priv = os_zalloc(sizeof(*priv));
 	if (priv == NULL)
@@ -282,12 +350,21 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
 	if (wpa_s->conf->ctrl_interface == NULL)
 		return priv;
 
-	priv->sock = socket(PF_INET, SOCK_DGRAM, 0);
+	priv->sock = socket(domain, SOCK_DGRAM, 0);
 	if (priv->sock < 0) {
 		perror("socket(PF_INET)");
 		goto fail;
 	}
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	os_memset(&addr, 0, sizeof(addr));
+	addr.sin6_family = AF_INET6;
+#ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
+	addr.sin6_addr = in6addr_any;
+#else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+	inet_pton(AF_INET6, "::1", &addr.sin6_addr);
+#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#else /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	os_memset(&addr, 0, sizeof(addr));
 	addr.sin_family = AF_INET;
 #ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
@@ -295,8 +372,13 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
 #else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 	addr.sin_addr.s_addr = htonl((127 << 24) | 1);
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 try_again:
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	addr.sin6_port = htons(port);
+#else
 	addr.sin_port = htons(port);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	if (bind(priv->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
 		port--;
 		if ((WPA_CTRL_IFACE_PORT - port) < WPA_CTRL_IFACE_PORT_LIMIT)
@@ -362,6 +444,9 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
 	int idx;
 	char *sbuf;
 	int llen;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	dst = priv->ctrl_dst;
 	if (priv->sock < 0 || dst == NULL)
@@ -381,9 +466,15 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
 	while (dst) {
 		next = dst->next;
 		if (level >= dst->debug_level) {
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor send %s:%d",
+				   inet_ntop(AF_INET6, &dst->addr.sin6_addr, addr, sizeof(dst->addr)),
+				   ntohs(dst->addr.sin6_port));
+#else
 			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor send %s:%d",
 				   inet_ntoa(dst->addr.sin_addr),
 				   ntohs(dst->addr.sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 			if (sendto(priv->sock, sbuf, llen + len, 0,
 				   (struct sockaddr *) &dst->addr,
 				   sizeof(dst->addr)) < 0) {
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 6684782..91eea35 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -192,8 +192,10 @@ CONFIG_SMARTCARD=y
 # Select control interface backend for external programs, e.g, wpa_cli:
 # unix = UNIX domain sockets (default for Linux/*BSD)
 # udp = UDP sockets using localhost (127.0.0.1)
+# udp6 = UDP IPv6 sockets using localhost (::1)
 # named_pipe = Windows Named Pipe (default for Windows)
 # udp-remote = UDP sockets with remote access (only for tests systems/purpose)
+# udp6-remote = UDP IPv6 sockets with remote access (only for tests purpose)
 # y = use default (backwards compatibility)
 # If this option is commented out, control interface is not included in the
 # build.
-- 
1.7.9.5



From j  Sat Feb 15 14:30:32 2014
From: j (Jouni Malinen)
Date: Sun, 16 Feb 2014 00:30:32 +0200
Subject: [PATCH 2/3] wpa_supplicant: Complete radio works on disable event
In-Reply-To: <1392283441-13612-2-git-send-email-ilan.peer@intel.com>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
	<1392283441-13612-2-git-send-email-ilan.peer@intel.com>
Message-ID: <20140215223032.GA7753@w1.fi>

On Thu, Feb 13, 2014 at 11:24:00AM +0200, Ilan Peer wrote:
> While testing rfkill blocking of a scanning interface, it
> was seen that the ongoing scan never completes. This happens
> since EVENT_SCAN_RESULTS is discarded on a disabled interface.
> 
> Fix this and also other possible radio work completion issues
> by removing all the radio works (including started) of the
> disabled interface.
> 
> To be able to remove already started radio works, make their
> callbacks be reentrant with deinit flag (when the work
> is started), so each radio work should be able to handle
> it's own termination.

Thanks, applied. I saw this in my hwsim test runs today as well (when a
P2P group interface was removed while a scan was in progress).

-- 
Jouni Malinen                                            PGP id EFC895FA


From andersk  Sat Feb 15 16:05:05 2014
From: andersk (Anders Kaseorg)
Date: Sat, 15 Feb 2014 19:05:05 -0500 (EST)
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <20140215111140.GA30581@w1.fi>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi> <52FF4066.8090104@mit.edu>
	<20140215111140.GA30581@w1.fi>
Message-ID: <alpine.DEB.2.02.1402151853090.43540@department-of-alchemy.MIT.EDU>

On Sat, 15 Feb 2014, Jouni Malinen wrote:
> I know. I was referring to a different specification (sorry, cannot talk 
> about details yet).

It?s not that I don?t believe you, but you realize how this sounds, right?  
How am I going to supposed to explain to the MIT network team that they 
need to ?fix? their certificate that already conforms with every published 
specification and works with every client except wpa_supplicant 2.1?

(Most Linux users aren?t even going to notice this problem for a while 
because Fedora is still on 2.0 and Debian/Ubuntu are stuck at 1.0 because 
of regressions in later versions.  I only noticed because I?m trying to 
help get Debian/Ubuntu unstuck, but I worry that the maintainers aren?t 
going to be encouraged by the current state.)

> To be honest, I did not notice that, but I was thinking of not including 
> id-kp-serverAuth and now that you say it, I guess that could also happen 
> with an EKU (for something completely different) being included. I don't 
> think id-kp-serverAuth is universally used, so I don't really want to 
> mandate it. id-kp-clientAuth alone is actually already rejected by 
> OpenSSL, so no need for that separately in tls_openssl.c.

Okay, then it sounds like the most reasonable solution is reverting commit 
51e3eafb68e15e78e98ca955704be8a6c3a7b304.

> CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/C=FI/O=w1.fi/CN=server.w1.fi' cert=30820295308201....

While trying to extract these certificates, I ran into both a 256-byte 
wpa_cli limit and a 2048-byte wpa_supplicant limit on the length of that 
control message.  After fixing the latter (will send this patch) and 
arbitrarily bumping up the former (we should do something about that too), 
I?ve extracted the following:

<3>CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/C=US/O=GeoTrust, Inc./CN=GeoTrust SSL CA' hash=d4c4c99819f3a5f2c6261c9444c62a8b263b39bc6acce35cdcabe272d5037fb2
<3>CTRL-EVENT-EAP-PEER-CERT depth=1 subject='/C=US/O=GeoTrust, Inc./CN=GeoTrust SSL CA'  
<3>CTRL-EVENT-EAP-STATUS status='remote certificate verification' parameter='success'
<3>CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/serialNumber=cVycYduKJuN-QJPtPROOvgg5Rmr8DMNh/C=US/ST=Massachusetts/L=Cambridge/O=Massachusetts Institute of Technology/OU=Information Services and Technology/CN=wireless-radius-2.mit.edu' hash=b4ec7484d07a6a40ad9c700b1ac7557dcceb8f19331449ca0bed9c7c52bba315
<3>CTRL-EVENT-EAP-PEER-CERT depth=0 subject='/serialNumber=cVycYduKJuN-QJPtPROOvgg5Rmr8DMNh/C=US/ST=Massachusetts/L=Cambridge/O=Massachusetts Institute of Technology/OU=Information Services and Technology/CN=wireless-radius-2.mit.edu'  
<3>CTRL-EVENT-EAP-TLS-CERT-ERROR reason=8 depth=0 subject='/serialNumber=cVycYduKJuN-QJPtPROOvgg5Rmr8DMNh/C=US/ST=Massachusetts/L=Cambridge/O=Massachusetts Institute of Technology/OU=Information Services and Technology/CN=wireless-radius-2.mit.edu' err='Server certificate chain probe'

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 145104 (0x236d0)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
        Validity
            Not Before: Feb 19 22:39:26 2010 GMT
            Not After : Feb 18 22:39:26 2020 GMT
        Subject: C=US, O=GeoTrust, Inc., CN=GeoTrust SSL CA
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:90:b3:80:c1:e4:e5:46:ad:70:60:3d:ba:e5:14:
                    dd:9e:8a:5e:8b:75:5a:e6:ca:6d:41:a5:23:e8:39:
                    85:26:7a:a7:55:77:9a:48:a1:92:7e:3a:1e:1a:f1:
                    27:ab:a3:4c:39:cc:cb:3d:47:af:81:ae:16:6a:5c:
                    37:ef:45:41:fd:fb:9a:97:3c:a0:43:9d:c6:df:17:
                    21:d1:8a:a2:56:c2:03:49:84:12:81:3e:c9:0a:54:
                    60:66:b9:8c:54:e4:f9:e6:f9:94:f1:e0:5f:75:11:
                    f2:29:b9:e4:86:a2:b1:89:ad:a6:1e:83:29:63:b2:
                    f0:54:1c:85:0b:7a:e7:e1:2e:0d:af:a4:bd:cd:e7:
                    b1:5a:d7:8c:05:5a:0e:4b:73:28:8b:75:5d:34:d8:
                    77:0b:e1:74:62:e2:71:30:62:d8:bc:8a:05:e5:31:
                    63:4a:54:89:6a:33:78:a7:4e:55:24:1d:97:ef:1a:
                    e4:12:c6:0f:30:18:b4:34:4d:e1:d8:23:3b:21:5b:
                    2d:30:19:25:0e:74:f7:a4:21:4b:a0:a4:20:c9:6c:
                    cd:98:56:c0:f2:a8:5f:3e:26:75:a0:0d:f8:36:88:
                    8a:2c:5a:7d:67:30:a9:0f:d1:99:70:2e:78:e1:51:
                    26:af:55:7a:24:be:8c:39:0d:77:9d:de:02:c3:0c:
                    bd:1f
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Key Usage: critical
                Certificate Sign, CRL Sign
            X509v3 Subject Key Identifier: 
                42:79:54:1B:61:CD:55:2B:3E:63:D5:3C:48:57:F5:9F:FB:45:CE:4A
            X509v3 Authority Key Identifier: 
                keyid:C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E

            X509v3 Basic Constraints: critical
                CA:TRUE, pathlen:0
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://crl.geotrust.com/crls/gtglobal.crl

            Authority Information Access: 
                OCSP - URI:http://ocsp.geotrust.com

    Signature Algorithm: sha1WithRSAEncryption
         d4:ef:53:84:e8:1a:bd:a1:8b:04:c0:a9:f5:5f:a1:10:78:45:
         5d:b2:57:6a:4e:24:cb:65:4e:31:97:91:9a:d4:24:f8:e2:27:
         66:70:31:9c:c1:62:54:06:e7:97:1d:3a:9a:c0:a4:29:48:0a:
         af:24:c7:a8:c4:9a:54:c1:7c:4c:78:4c:2b:68:2c:5d:17:a6:
         54:78:4c:46:e2:80:c3:1f:38:71:12:d2:d7:53:e3:54:85:50:
         b8:02:cb:ee:63:3a:f8:56:89:4d:55:bb:2e:c0:c8:18:77:86:
         31:0b:0b:70:f0:7e:35:83:a4:2a:13:64:56:67:34:5d:16:5f:
         73:ac:7b:06:24:da:4f:50:6d:2a:ab:d0:4d:53:41:c2:8e:bb:
         71:03:49:29:86:18:cf:21:42:4c:74:62:51:15:c5:6f:a8:ef:
         c4:27:e5:1b:33:dd:5a:88:d7:7f:12:d1:a7:61:25:1f:d5:e0:
         dc:1d:cf:1a:10:d8:a0:cb:5f:8c:fa:0c:e5:bf:71:ff:e5:5d:
         44:1d:a6:3e:87:47:fa:1a:4e:83:83:12:3f:88:66:95:98:79:
         9a:85:eb:02:47:cd:25:e3:f2:06:04:4e:99:ca:5c:a0:6e:7a:
         bb:dd:a3:90:1a:45:33:ef:bf:3e:d2:04:c4:b6:e0:2a:85:65:
         41:3e:10:d4
-----BEGIN CERTIFICATE-----

TpnKXKBuervdo5AaRTPvvz7SBMS24CqFZUE+ENQ=
-----END CERTIFICATE-----

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 91039 (0x1639f)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=US, O=GeoTrust, Inc., CN=GeoTrust SSL CA
        Validity
            Not Before: May  1 22:27:01 2012 GMT
            Not After : Jun  3 12:24:00 2017 GMT
        Subject: serialNumber=cVycYduKJuN-QJPtPROOvgg5Rmr8DMNh, C=US, ST=Massachusetts, L=Cambridge, O=Massachusetts Institute of Technology, OU=Information Services and Technology, CN=wireless-radius-2.mit.edu
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:da:ad:91:92:38:fd:27:72:dc:25:ee:70:dc:ad:
                    77:05:1e:88:02:ee:35:72:8f:03:8a:d3:47:5d:51:
                    02:e6:03:b9:66:ec:e4:0e:e0:ef:38:c7:43:17:6e:
                    4a:85:ab:05:34:40:57:ba:a0:8b:c5:33:a5:8b:f8:
                    a6:d2:57:d4:0e:ac:53:e2:3d:eb:26:54:7a:8e:e1:
                    59:89:6f:be:6c:5b:83:a1:48:7b:45:17:6f:5d:ca:
                    2c:74:9f:05:35:3e:ba:34:39:5c:8d:9e:1e:67:13:
                    c2:53:47:0d:52:05:4a:b3:1b:19:f5:25:4c:2d:6b:
                    5e:91:72:4d:c8:dc:a7:49:33:15:4a:de:57:ad:83:
                    e8:33:71:b3:dc:80:bb:83:84:ce:ed:34:20:58:93:
                    45:2b:b6:fe:25:20:fa:0e:06:3b:21:90:ea:28:e2:
                    84:1d:9f:ca:fb:eb:e0:33:5e:79:84:49:d3:74:14:
                    3b:62:00:90:fe:28:94:dd:e8:b5:05:66:5a:de:13:
                    76:60:33:10:88:63:f0:b1:74:da:57:07:18:52:f6:
                    e1:75:1c:c6:f3:2f:4b:e6:ba:e1:97:1c:34:33:d8:
                    6f:6c:be:ba:cb:25:ef:69:dd:f6:d9:80:14:2b:32:
                    40:e4:37:83:e3:86:00:23:ab:99:1f:94:19:c6:76:
                    40:4b
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Authority Key Identifier: 
                keyid:42:79:54:1B:61:CD:55:2B:3E:63:D5:3C:48:57:F5:9F:FB:45:CE:4A

            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment, Data Encipherment
            X509v3 Extended Key Usage: 
                TLS Web Server Authentication, TLS Web Client Authentication
            X509v3 Subject Alternative Name: 
                DNS:wireless-radius-2.mit.edu
            X509v3 CRL Distribution Points: 

                Full Name:
                  URI:http://gtssl-crl.geotrust.com/crls/gtssl.crl

            X509v3 Subject Key Identifier: 
                F9:08:C9:F7:52:E1:40:28:1F:2F:BC:6F:D4:15:2B:FA:B4:A9:92:FB
            X509v3 Basic Constraints: critical
                CA:FALSE
            Authority Information Access: 
                CA Issuers - URI:http://gtssl-aia.geotrust.com/gtssl.crt

    Signature Algorithm: sha1WithRSAEncryption
         41:c8:77:63:15:16:d8:20:45:03:3b:d0:73:0a:a3:5e:5e:d7:
         03:2f:bd:b0:31:2f:3a:6a:3f:cd:fd:93:34:5f:68:a4:4b:73:
         9e:c4:98:06:5f:44:35:2a:ff:18:79:18:d1:ab:6b:e6:d8:5b:
         eb:da:3a:5c:4f:0c:8e:12:87:da:ab:02:ea:62:e7:c4:80:42:
         7b:74:db:97:3a:90:02:d4:82:27:73:f6:bf:43:3d:9c:5e:0d:
         d5:3f:76:30:3d:7a:ab:0d:db:22:73:b2:47:cb:93:0d:1d:ad:
         c8:05:ba:51:82:7f:8e:62:5d:38:bf:d7:6c:4f:bc:17:64:ad:
         c0:2a:59:25:df:a5:19:b3:39:93:09:3f:fc:df:ba:dc:24:7b:
         a3:af:38:a4:4a:b2:2e:03:85:6d:33:9f:7c:aa:69:1d:1f:3c:
         d3:34:58:9d:ec:4d:0c:51:78:e2:3f:e5:40:8f:29:29:9f:db:
         7f:77:62:40:45:59:77:d7:6b:54:f1:ab:b9:ff:92:6b:1b:3d:
         cf:99:07:e1:3e:51:2b:3f:94:37:6d:cf:d0:25:79:3b:e8:65:
         f1:a1:4b:00:a1:29:61:57:0c:77:a2:70:28:7b:43:ec:32:9f:
         40:ba:30:a0:67:e4:66:08:44:75:64:19:62:10:b8:83:df:c7:
         54:3b:8c:05
-----BEGIN CERTIFICATE-----

AKEpYVcMd6JwKHtD7DKfQLowoGfkZghEdWQZYhC4g9/HVDuMBQ==
-----END CERTIFICATE-----

Anders


From andersk  Sat Feb 15 16:08:32 2014
From: andersk (Anders Kaseorg)
Date: Sat, 15 Feb 2014 19:08:32 -0500 (EST)
Subject: [PATCH] wpa_debug: Remove 2048 byte message length limit
Message-ID: <alpine.DEB.2.02.1402151906000.43540@department-of-alchemy.MIT.EDU>

Signed-off-by: Anders Kaseorg <andersk at mit.edu>
---
 src/utils/wpa_debug.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
index 7846c1e..647f6b4 100644
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -596,10 +596,14 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...)
 {
 	va_list ap;
 	char *buf;
-	const int buflen = 2048;
+	int buflen;
 	int len;
 	char prefix[130];
 
+	va_start(ap, fmt);
+	buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+	va_end(ap);
+
 	buf = os_malloc(buflen);
 	if (buf == NULL) {
 		wpa_printf(MSG_ERROR, "wpa_msg: Failed to allocate message "
@@ -630,12 +634,16 @@ void wpa_msg_ctrl(void *ctx, int level, const char *fmt, ...)
 {
 	va_list ap;
 	char *buf;
-	const int buflen = 2048;
+	int buflen;
 	int len;
 
 	if (!wpa_msg_cb)
 		return;
 
+	va_start(ap, fmt);
+	buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+	va_end(ap);
+
 	buf = os_malloc(buflen);
 	if (buf == NULL) {
 		wpa_printf(MSG_ERROR, "wpa_msg_ctrl: Failed to allocate "
@@ -654,9 +662,13 @@ void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
 {
 	va_list ap;
 	char *buf;
-	const int buflen = 2048;
+	int buflen;
 	int len;
 
+	va_start(ap, fmt);
+	buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+	va_end(ap);
+
 	buf = os_malloc(buflen);
 	if (buf == NULL) {
 		wpa_printf(MSG_ERROR, "wpa_msg_global: Failed to allocate "
@@ -677,9 +689,13 @@ void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
 {
 	va_list ap;
 	char *buf;
-	const int buflen = 2048;
+	int buflen;
 	int len;
 
+	va_start(ap, fmt);
+	buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+	va_end(ap);
+
 	buf = os_malloc(buflen);
 	if (buf == NULL) {
 		wpa_printf(MSG_ERROR, "wpa_msg_no_global: Failed to allocate "
@@ -712,9 +728,13 @@ void hostapd_logger(void *ctx, const u8 *addr, unsigned int module, int level,
 {
 	va_list ap;
 	char *buf;
-	const int buflen = 2048;
+	int buflen;
 	int len;
 
+	va_start(ap, fmt);
+	buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+	va_end(ap);
+
 	buf = os_malloc(buflen);
 	if (buf == NULL) {
 		wpa_printf(MSG_ERROR, "hostapd_logger: Failed to allocate "
-- 
1.9.0



From ilan.peer  Sat Feb 15 23:21:15 2014
From: ilan.peer (Peer, Ilan)
Date: Sun, 16 Feb 2014 07:21:15 +0000
Subject: [PATCH 2/3] wpa_supplicant: Complete radio works on disable event
In-Reply-To: <20140215223032.GA7753@w1.fi>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
	<1392283441-13612-2-git-send-email-ilan.peer@intel.com>
	<20140215223032.GA7753@w1.fi>
Message-ID: <CB3B3D4774441E42AA3EA0E1BA8230A03337EA51@HASMSX106.ger.corp.intel.com>

> On Thu, Feb 13, 2014 at 11:24:00AM +0200, Ilan Peer wrote:
> > While testing rfkill blocking of a scanning interface, it was seen
> > that the ongoing scan never completes. This happens since
> > EVENT_SCAN_RESULTS is discarded on a disabled interface.
> >
> > Fix this and also other possible radio work completion issues by
> > removing all the radio works (including started) of the disabled
> > interface.
> >
> > To be able to remove already started radio works, make their callbacks
> > be reentrant with deinit flag (when the work is started), so each
> > radio work should be able to handle it's own termination.
> 
> Thanks, applied. I saw this in my hwsim test runs today as well (when a P2P
> group interface was removed while a scan was in progress).
> 

Great (we were not 100 % that this is the best approach ... :)). 

Thanks,

Ilan.


From j  Sun Feb 16 00:35:53 2014
From: j (Jouni Malinen)
Date: Sun, 16 Feb 2014 10:35:53 +0200
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <alpine.DEB.2.02.1402151853090.43540@department-of-alchemy.MIT.EDU>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi> <52FF4066.8090104@mit.edu>
	<20140215111140.GA30581@w1.fi>
	<alpine.DEB.2.02.1402151853090.43540@department-of-alchemy.MIT.EDU>
Message-ID: <20140216083553.GA3522@w1.fi>

On Sat, Feb 15, 2014 at 07:05:05PM -0500, Anders Kaseorg wrote:
> How am I going to supposed to explain to the MIT network team that they 
> need to ?fix? their certificate that already conforms with every published 
> specification and works with every client except wpa_supplicant 2.1?

Just to be clear: I have not and do not in any way suggest that the AAA
server certificate here should be changed.

> Okay, then it sounds like the most reasonable solution is reverting commit 
> 51e3eafb68e15e78e98ca955704be8a6c3a7b304.

Probably yes. The unfortunate part here is that there seems to be a
conflicting requirement in this area. Hopefully, that requirement can be
changed, but if not, this is going to be much wider issue and something
else is going to be needed to work around this.

> While trying to extract these certificates, I ran into both a 256-byte 
> wpa_cli limit and a 2048-byte wpa_supplicant limit on the length of that 
> control message.  After fixing the latter (will send this patch) and 
> arbitrarily bumping up the former (we should do something about that too), 
> I?ve extracted the following:

Thanks! This is exactly the information I need for trying to get the
requirement side resolved.

-- 
Jouni Malinen                                            PGP id EFC895FA


From sw  Mon Feb 17 02:18:49 2014
From: sw (Simon Wunderlich)
Date: Mon, 17 Feb 2014 11:18:49 +0100
Subject: [PATCH 4/4] hostapd: terminate hostapd when no channel is
	available
In-Reply-To: <20140214170250.GA15831@w1.fi>
References: <1391620210-15506-1-git-send-email-sw@simonwunderlich.de>
	<1391620210-15506-5-git-send-email-sw@simonwunderlich.de>
	<20140214170250.GA15831@w1.fi>
Message-ID: <201402171118.49830.sw@simonwunderlich.de>

Hello Jouni,

> On Wed, Feb 05, 2014 at 06:10:10PM +0100, Simon Wunderlich wrote:
> > Until hostapd is able to restart service on a channel (e.g. by reacting
> > to an event that a DFS non-occupancy period is over), better shut down
> > hostapd when no channel is available anymore.
> > 
> > The current behaviour, disabling the interface, will just lead to
> > hostapd hanging without recovering frmo this state. If hostapd shuts
> > down, userspace can at least work around and restart hostapd when
> > channels are available again.
> 
> Shutting down an interface sounds reasonable. Terminating the process
> does not, e.g., if there are multiple radios controlled by a single
> hostapd process.

Shutting down is not my preferred solution either, but at least that would be 
consistent compared to starting hostap, which willl also terminate when no 
channels are available.

It would be better to wait for the channel to become available again and 
automatically re-select the channel. As explained in my cover mail, I don't 
know how to do that since the disabled interface won't parse events anymore. 
Therefore we can't react to the NOP event telling that a channel is usable 
again - this is some kind of chicken-and-egg problem here. Do  you have any 
suggestions? :)

BTW, I don't know even think re-enabling the interface is possible via the 
control interface, since the channel list update events lost and thus all 
channels stay "blocked" in this case. (Haven't checked that though)

If you agree, please merge the the other patches (1-3/4). I'd love to find a 
solution for the event problem explained above and send a proper patch for 
this.

Thanks!
     Simon


From shyamms2003  Mon Feb 17 06:19:58 2014
From: shyamms2003 (Shyam)
Date: Mon, 17 Feb 2014 19:49:58 +0530
Subject: Questions regarding Anonymous-TLS
Message-ID: <CAAdcsmt=uK_rr=0NjqFKNkO+VkGBRsfkxbWscy41XH015jGacw@mail.gmail.com>

Hi Jouni,
Want to try out anonymous-TLS.I would like to know what is the
configuration at the client(peer side) and at the radius server side.

*1.At Client Side*
For a normal TLS connection the network block at the client side might look
like this:

network={
	ssid="1x-test"
	key_mgmt=IEEE8021X
	eap=TLS
	identity="user at example.com"
	ca_cert="/etc/cert/ca.pem"
	client_cert="/etc/cert/user.pem"
	private_key="/etc/cert/user.prv"
	private_key_passwd="password"
	eapol_flags=3
}

How does the anonymous TLS network block look like?
*2.At Radius Server*

What is the configuration at the Radius Server?

Please Clarify.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140217/c40dbe24/attachment.htm>


From Anton.Nayshtut  Mon Feb 17 06:43:18 2014
From: Anton.Nayshtut (Anton Nayshtut)
Date: Mon, 17 Feb 2014 16:43:18 +0200
Subject: [PATCH 0/3] Fast Session Transfer (FST)
Message-ID: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>

From: Anton Nayshtut <Anton.Nayshtut at wilocity.com>

This set of patches introduces Fast Session Transfer (FST) support by both
hostapd and wpa_supplicant.

Fast Session Transfer (FST) is the transfer of a session from a channel to
another channel, in the same or different frequency bands. The term "session"
refers to non-physical layer state information kept by a pair of stations (STAs)
that communicate directly (i.e., excludes forwarding).

The FST is implemented in accordance with WGA Specification.

Definitions

 * FST interface - an interface for which FST functionality is enabled
 * FST peer - a Multi-band capable STA connected

Configuration and Initialization

 * FST functionality can enabled by compilation flag (CONFIG_FST)
 * hostapd/wpa_supplicant controlling multiple interfaces are used for FST
 * once enabled by compilation, the FST can be enabled for specific interfaces
   in configuration files
 * one of the FST interfaces must be set as an FST default interface
 * the FST default interface is the interface FST will always try to switch from
   Thus, for example, for the maximal throughput, it should be the slowest FST
   interface in the FST setup.
 * FST interfaces advertise the Multi-band capability by including the
   Multi-band element in the corresponding frames

Single-band connection

* When 1st FST interface becomes connected to a FST Peer, the FST sets it as the
active FST interface for this FST Peer, i.e. the FST interface is used for data
transmission to this FST peer.

Session Establishment

* FST tries to establish FST Session wheb=n either:
  - Multi-band connection becomes available available, i.e. when more than one
    FST interfaces are connected to the same FST peer
  - successful session transition ends
  - non-active FST interface for which already established FST Session becomes
    disconnected
* Following LLT values are used in FST Session establishment:
  - LLT=0 if current active FST interface is the FST default interface
  - LLT=MAX_U8 otherwise

Session Transfer

* FST tries to perform the FST Session transfer when either:
  - FST Session becomes established with LLT=0 (according to 10.32.2.2
    Transitioning between states)
  - active FST interface becomes disconnected (i.e. when LTT virtually becomes
    0)
* Upon successful session transfer, FST sets the target FST interface as the new
active FST interface for this FST Peer.

Session Reset

* FST resets the FST Session when either:
  - STT becomes 0 (in accordance with 10.32.2.2 Transitioning between states)
  - only active FST interface stays connected

Anton Nayshtut (3):
  Transparent FST: fst module introduced
  Transparent FST: hostapd integration
  Transparent FST: wpa_supplicant integration

 hostapd/Makefile                   |    8 +
 hostapd/config_file.c              |   17 +
 hostapd/defconfig                  |    3 +
 hostapd/hostapd.conf               |   20 +
 hostapd/main.c                     |   25 +-
 src/Makefile                       |    2 +-
 src/ap/ap_config.h                 |    5 +
 src/ap/ap_drv_ops.c                |   15 +
 src/ap/beacon.c                    |   28 +-
 src/ap/drv_callbacks.c             |   27 +
 src/ap/hostapd.c                   |   56 +-
 src/ap/hostapd.h                   |    4 +
 src/ap/ieee802_11.c                |   28 +-
 src/ap/sta_info.c                  |   15 +
 src/ap/sta_info.h                  |    3 +
 src/ap/utils.c                     |   12 +-
 src/common/ieee802_11_common.c     |   34 +
 src/common/ieee802_11_common.h     |   15 +
 src/common/ieee802_11_defs.h       |   65 ++
 src/drivers/driver_nl80211.c       |   11 +
 src/fst/Makefile                   |    8 +
 src/fst/fst.c                      | 1457 ++++++++++++++++++++++++++++++++++++
 src/fst/fst.h                      |   48 ++
 src/fst/fst_defs.h                 |   91 +++
 src/fst/fst_drv.c                  |  442 +++++++++++
 src/fst/fst_drv.h                  |   24 +
 src/fst/fst_rtnl.c                 |  284 +++++++
 src/fst/fst_rtnl.h                 |   25 +
 wpa_supplicant/Makefile            |    8 +
 wpa_supplicant/config.c            |    7 +
 wpa_supplicant/config.h            |    5 +
 wpa_supplicant/defconfig           |    3 +
 wpa_supplicant/events.c            |   48 +-
 wpa_supplicant/main.c              |   16 +
 wpa_supplicant/notify.c            |   13 +
 wpa_supplicant/scan.c              |    7 +
 wpa_supplicant/sme.c               |   14 +
 wpa_supplicant/wpa_supplicant.c    |   91 +++
 wpa_supplicant/wpa_supplicant.conf |   20 +
 wpa_supplicant/wpa_supplicant_i.h  |    6 +
 40 files changed, 3003 insertions(+), 7 deletions(-)
 create mode 100644 src/fst/Makefile
 create mode 100644 src/fst/fst.c
 create mode 100644 src/fst/fst.h
 create mode 100644 src/fst/fst_defs.h
 create mode 100644 src/fst/fst_drv.c
 create mode 100644 src/fst/fst_drv.h
 create mode 100644 src/fst/fst_rtnl.c
 create mode 100644 src/fst/fst_rtnl.h

-- 
1.8.3.1



From Anton.Nayshtut  Mon Feb 17 06:43:20 2014
From: Anton.Nayshtut (Anton Nayshtut)
Date: Mon, 17 Feb 2014 16:43:20 +0200
Subject: [PATCH 2/3] Transparent FST: hostapd integration
In-Reply-To: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
References: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
Message-ID: <1392648201-7416-3-git-send-email-Anton.Nayshtut@Wilocity.com>

From: Anton Nayshtut  <Anton.Nayshtut at wilocity.com>

This patch integrates the FST into the hostapd.

Signed-off-by: Anton Nayshtut <Anton.Nayshtut at wilocity.com>
Signed-off-by: Erez Kirshenbaum <Erez.Kirshenbaum at wilocity.com>
---
 hostapd/config_file.c          | 17 +++++++++++++
 hostapd/defconfig              |  3 +++
 hostapd/hostapd.conf           | 20 +++++++++++++++
 hostapd/main.c                 | 25 ++++++++++++++++++-
 src/ap/ap_config.h             |  5 ++++
 src/ap/ap_drv_ops.c            | 15 +++++++++++
 src/ap/beacon.c                | 28 ++++++++++++++++++++-
 src/ap/drv_callbacks.c         | 27 ++++++++++++++++++++
 src/ap/hostapd.c               | 56 +++++++++++++++++++++++++++++++++++++++++-
 src/ap/hostapd.h               |  4 +++
 src/ap/ieee802_11.c            | 28 ++++++++++++++++++++-
 src/ap/sta_info.c              | 15 +++++++++++
 src/ap/sta_info.h              |  3 +++
 src/ap/utils.c                 | 12 ++++++++-
 src/common/ieee802_11_common.c | 34 +++++++++++++++++++++++++
 src/common/ieee802_11_common.h | 15 +++++++++++
 src/drivers/driver_nl80211.c   | 11 +++++++++
 17 files changed, 313 insertions(+), 5 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 19d6ad3..2f3fc14 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2907,6 +2907,23 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 					   "sae_groups value '%s'", line, pos);
 				return 1;
 			}
+#ifdef CONFIG_FST
+		} else if (os_strcmp(buf, "fst_bond") == 0) {
+			size_t len = os_strlen(pos);
+			if (!len || len > IFNAMSIZ) {
+				wpa_printf(MSG_ERROR, "Line %d: Invalid "
+					   "fst_bond value '%s'", line, pos);
+				errors++;
+			} else if (conf->fst_bond[0]) {
+				wpa_printf(MSG_ERROR, "Line %d: Duplicate "
+					   "fst_bond value '%s'", line, pos);
+				errors++;
+			} else
+				os_strlcpy(conf->fst_bond, pos,
+						sizeof(conf->fst_bond));
+		} else if (os_strcmp(buf, "fst_default") == 0) {
+			conf->fst_default = atoi(pos);
+#endif
 		} else {
 			wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
 				   "item '%s'", line, buf);
diff --git a/hostapd/defconfig b/hostapd/defconfig
index 8c8f0ea..3132fe6 100644
--- a/hostapd/defconfig
+++ b/hostapd/defconfig
@@ -286,6 +286,9 @@ CONFIG_IPV6=y
 # Enable SQLite database support in hlr_auc_gw, EAP-SIM DB, and eap_user_file
 #CONFIG_SQLITE=y
 
+# Enable Fast Session Transfer (FST)
+# CONFIG_FST=y
+
 # Testing options
 # This can be used to enable some testing options (see also the example
 # configuration file) that are really useful only for testing clients that
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index c503ce2..8504130 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1666,3 +1666,23 @@ own_ip_addr=127.0.0.1
 #bss=wlan0_1
 #bssid=00:13:10:95:fe:0b
 # ...
+
+##### Fast Session Transfer (FST) support #####################################
+#
+# The options in this section are only available when the build configuration
+# option CONFIG_FST is set while compiling hostapd. They allow this interface
+# to be a part of FST setup.
+#
+# FST is the transfer of a session from a channel to another channel, in the
+# same or different frequency bands.
+#
+# For detals, see WGA Specification.
+
+# Bonding to be used for FST operations
+#fst_bond=bond0
+
+# Whether the interface is the FST default.
+# Each fst_bond must have one and only one fst_default interface defined.
+# 0 = don't use this interface as FST default
+# 1 = use this interface as FST default
+#fst_default=1
diff --git a/hostapd/main.c b/hostapd/main.c
index 3026929..e69c77d 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -27,7 +27,9 @@
 #include "config_file.h"
 #include "eap_register.h"
 #include "ctrl_iface.h"
-
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 struct hapd_global {
 	void **drv_priv;
@@ -654,6 +656,13 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
+#ifdef CONFIG_FST
+	if (fst_global_init()) {
+		wpa_printf(MSG_ERROR, "Failed to initilize global FST context");
+		goto out;
+	}
+#endif
+
 	/* Allocate and parse configuration for full interface files */
 	for (i = 0; i < interfaces.count; i++) {
 		interfaces.iface[i] = hostapd_interface_init(&interfaces,
@@ -716,6 +725,13 @@ int main(int argc, char *argv[])
 			goto out;
 	}
 
+#ifdef CONFIG_FST
+	if (fst_global_start())	{
+		wpa_printf(MSG_ERROR, "Failed to start FST");
+		goto out;
+	}
+#endif
+
 	hostapd_global_ctrl_iface_init(&interfaces);
 
 	if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
@@ -727,6 +743,9 @@ int main(int argc, char *argv[])
 
  out:
 	hostapd_global_ctrl_iface_deinit(&interfaces);
+#ifdef CONFIG_FST
+	fst_global_stop();
+#endif
 	/* Deinitialize all interfaces */
 	for (i = 0; i < interfaces.count; i++)
 		hostapd_interface_deinit_free(interfaces.iface[i]);
@@ -741,6 +760,10 @@ int main(int argc, char *argv[])
 
 	os_free(bss_config);
 
+#ifdef CONFIG_FST
+	fst_global_deinit();
+#endif
+
 	os_program_deinit();
 
 	return ret;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 4631ca9..d9fc525 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -543,6 +543,11 @@ struct hostapd_config {
 	u8 vht_oper_centr_freq_seg0_idx;
 	u8 vht_oper_centr_freq_seg1_idx;
 
+#ifdef CONFIG_FST
+	char fst_bond[IFNAMSIZ + 1];
+	int fst_default;
+#endif
+
 #ifdef CONFIG_TESTING_OPTIONS
 	double ignore_probe_probability;
 	double ignore_auth_probability;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index e998fc6..de25cfc 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -172,6 +172,21 @@ int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
 	}
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_FST
+	if (hapd->iface->fst_ies) {
+		size_t add = wpabuf_len(hapd->iface->fst_ies);
+		if (wpabuf_resize(&beacon, add) < 0)
+			goto fail;
+		wpabuf_put_buf(beacon, hapd->iface->fst_ies);
+		if (wpabuf_resize(&proberesp, add) < 0)
+			goto fail;
+		wpabuf_put_buf(proberesp, hapd->iface->fst_ies);
+		if (wpabuf_resize(&assocresp, add) < 0)
+			goto fail;
+		wpabuf_put_buf(assocresp, hapd->iface->fst_ies);
+	}
+#endif
+
 	if (hapd->conf->vendor_elements) {
 		size_t add = wpabuf_len(hapd->conf->vendor_elements);
 		if (wpabuf_resize(&beacon, add) == 0)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index b1ebf6e..b130d7b 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -27,7 +27,9 @@
 #include "ap_drv_ops.h"
 #include "beacon.h"
 #include "hs20.h"
-
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 #ifdef NEED_AP_MLME
 
@@ -279,6 +281,10 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 	if (hapd->p2p_probe_resp_ie)
 		buflen += wpabuf_len(hapd->p2p_probe_resp_ie);
 #endif /* CONFIG_P2P */
+#ifdef CONFIG_FST
+	if (hapd->iface->fst_ies)
+		buflen += wpabuf_len(hapd->iface->fst_ies);
+#endif
 	if (hapd->conf->vendor_elements)
 		buflen += wpabuf_len(hapd->conf->vendor_elements);
 	resp = os_zalloc(buflen);
@@ -376,6 +382,14 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 	pos = hostapd_eid_hs20_indication(hapd, pos);
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_FST
+	if (hapd->iface->fst_ies) {
+		os_memcpy(pos, wpabuf_head(hapd->iface->fst_ies),
+			wpabuf_len(hapd->iface->fst_ies));
+		pos += wpabuf_len(hapd->iface->fst_ies);
+	}
+#endif
+
 	if (hapd->conf->vendor_elements) {
 		os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements),
 			  wpabuf_len(hapd->conf->vendor_elements));
@@ -669,6 +683,11 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	if (hapd->p2p_beacon_ie)
 		tail_len += wpabuf_len(hapd->p2p_beacon_ie);
 #endif /* CONFIG_P2P */
+#ifdef CONFIG_FST
+	if (hapd->iface->fst_ies) {
+		tail_len += wpabuf_len(hapd->iface->fst_ies);
+	}
+#endif
 	if (hapd->conf->vendor_elements)
 		tail_len += wpabuf_len(hapd->conf->vendor_elements);
 	tailpos = tail = os_malloc(tail_len);
@@ -780,6 +799,13 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	    P2P_MANAGE)
 		tailpos = hostapd_eid_p2p_manage(hapd, tailpos);
 #endif /* CONFIG_P2P_MANAGER */
+#ifdef CONFIG_FST
+	if (hapd->iface->fst_ies) {
+		os_memcpy(tailpos, wpabuf_head(hapd->iface->fst_ies),
+			wpabuf_len(hapd->iface->fst_ies));
+		tailpos += wpabuf_len(hapd->iface->fst_ies);
+	}
+#endif
 
 #ifdef CONFIG_HS20
 	tailpos = hostapd_eid_hs20_indication(hapd, tailpos);
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 9af9646..c546e82 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -31,6 +31,9 @@
 #include "hw_features.h"
 #include "dfs.h"
 
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
 			const u8 *req_ies, size_t req_ies_len, int reassoc)
@@ -131,6 +134,14 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
 		sta->hs20_ie = NULL;
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_FST
+	wpabuf_free(sta->mb_ies);
+	if (hapd->iface->fst) {
+		sta->mb_ies = mb_ies_by_info(&elems.mb_ies);
+	} else
+		sta->mb_ies = NULL;
+#endif
+
 	if (hapd->conf->wpa) {
 		if (ie == NULL || ielen == 0) {
 #ifdef CONFIG_WPS
@@ -301,6 +312,15 @@ skip_wpa_check:
 	sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;
 	sta->flags &= ~WLAN_STA_WNM_SLEEP_MODE;
 
+	if ((!hapd->conf->ieee802_1x && !hapd->conf->wpa) ||
+	    sta->auth_alg == WLAN_AUTH_FT) {
+		/*
+		 * Open, static WEP, or FT protocol; no separate authorization
+		 * step.
+		 */
+		ap_sta_set_authorized(hapd, sta, 1);
+	}
+
 	if (reassoc && (sta->auth_alg == WLAN_AUTH_FT))
 		wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
 	else
@@ -602,6 +622,13 @@ static void hostapd_action_rx(struct hostapd_data *hapd,
 		ieee802_11_rx_wnm_action_ap(hapd, mgmt, drv_mgmt->frame_len);
 	}
 #endif /* CONFIG_WNM */
+#ifdef CONFIG_FST
+	if (mgmt->u.action.category == WLAN_ACTION_FST && hapd->iface->fst) {
+		fst_rx_action(hapd->iface->fst, mgmt, drv_mgmt->frame_len);
+		return;
+	}
+#endif
+
 }
 
 
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index f9edf3b..477dccf 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -34,6 +34,9 @@
 #include "gas_serv.h"
 #include "dfs.h"
 
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
@@ -533,7 +536,6 @@ static int hostapd_das_nas_mismatch(struct hostapd_data *hapd,
 	return 0;
 }
 
-
 static struct sta_info * hostapd_das_find_sta(struct hostapd_data *hapd,
 					      struct radius_das_attrs *attr)
 {
@@ -1072,6 +1074,37 @@ static int setup_interface2(struct hostapd_iface *iface)
 	return hostapd_setup_interface_complete(iface, 0);
 }
 
+#ifdef CONFIG_FST
+static const u8 * fst_hostapd_get_bssid_cb(void *ctx)
+{
+	struct hostapd_data *hapd = ctx;
+	return hapd->own_addr;
+}
+
+static void fst_hostapd_get_channel_info_cb(void *ctx,
+		enum hostapd_hw_mode *hw_mode, u8 *channel)
+{
+	struct hostapd_data *hapd = ctx;
+	*hw_mode = ieee80211_freq_to_chan(hapd->iface->freq, channel);
+}
+
+
+static void fst_hostapd_set_ies_cb(void *ctx, struct wpabuf *fst_ies)
+{
+	struct hostapd_data *hapd = ctx;
+	if (hapd->iface->fst_ies != fst_ies) {
+		hapd->iface->fst_ies = fst_ies;
+		ieee802_11_set_beacon(hapd);
+	}
+}
+
+static int fst_hostapd_send_action_cb(void *ctx, const u8 *da, struct wpabuf *buf)
+{
+	struct hostapd_data *hapd = ctx;
+	return hostapd_drv_send_action(hapd, hapd->iface->freq, 0,
+			da, wpabuf_head(buf), wpabuf_len(buf));
+}
+#endif
 
 /**
  * hostapd_setup_interface_complete - Complete interface setup
@@ -1095,6 +1128,27 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
 		return -1;
 	}
 
+#ifdef CONFIG_FST
+	if (hapd->iconf->fst_bond[0]) {
+		struct fst_wpa_obj iface_obj = {
+			.ctx = hapd,
+			.get_bssid         = fst_hostapd_get_bssid_cb,
+			.get_channel_info  = fst_hostapd_get_channel_info_cb,
+			.set_ies           = fst_hostapd_set_ies_cb,
+			.send_action       = fst_hostapd_send_action_cb,
+		};
+		iface->fst = fst_attach(hapd->iconf->fst_bond,
+				hapd->iconf->fst_default, &iface_obj, hapd->conf->iface);
+		if (!iface->fst) {
+			wpa_printf(MSG_ERROR, "Could not attach to FST %s",
+					hapd->iconf->fst_bond);
+			return -1;
+		}
+		wpa_printf(MSG_DEBUG, "FST attached to %s (default=%d)",
+			hapd->iconf->fst_bond, hapd->iconf->fst_default);
+	}
+#endif
+
 	wpa_printf(MSG_DEBUG, "Completing interface initialization");
 	if (iface->conf->channel) {
 #ifdef NEED_AP_MLME
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 489ab16..866b96f 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -272,6 +272,10 @@ struct hostapd_iface {
 
 	unsigned int wait_channel_update:1;
 	unsigned int cac_started:1;
+#ifdef CONFIG_FST
+	struct fst_iface  *fst;
+	struct wpabuf     *fst_ies;
+#endif
 
 	int num_ap; /* number of entries in ap_list */
 	struct ap_info *ap_list; /* AP info list head */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 9251ac3..7c6cebc 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -38,7 +38,9 @@
 #include "ap_drv_ops.h"
 #include "wnm_ap.h"
 #include "ieee802_11.h"
-
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
 {
@@ -1084,6 +1086,16 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
 		sta->hs20_ie = NULL;
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_FST
+	wpabuf_free(sta->mb_ies);
+	if (hapd->iface->fst) {
+		sta->mb_ies = mb_ies_by_info(&elems.mb_ies);
+	}
+	else {
+		sta->mb_ies = NULL;
+	}
+#endif
+
 	return WLAN_STATUS_SUCCESS;
 }
 
@@ -1215,6 +1227,14 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
 		p = hostapd_eid_p2p_manage(hapd, p);
 #endif /* CONFIG_P2P_MANAGER */
 
+#ifdef CONFIG_FST
+	if (hapd->iface->fst_ies) {
+		os_memcpy(p, wpabuf_head(hapd->iface->fst_ies),
+			wpabuf_len(hapd->iface->fst_ies));
+		p += wpabuf_len(hapd->iface->fst_ies);
+	}
+#endif
+
 	send_len += p - reply->u.assoc_resp.variable;
 
 	if (hostapd_drv_send_mlme(hapd, reply, send_len, 0) < 0)
@@ -1607,6 +1627,12 @@ static int handle_action(struct hostapd_data *hapd,
 		ieee802_11_rx_wnm_action_ap(hapd, mgmt, len);
 		return 1;
 #endif /* CONFIG_WNM */
+#ifdef CONFIG_FST
+	case WLAN_ACTION_FST:
+		if (hapd->iface->fst)
+			fst_rx_action(hapd->iface->fst, mgmt, len);
+		return 1;
+#endif /* CONFIG_FST */
 	case WLAN_ACTION_PUBLIC:
 	case WLAN_ACTION_PROTECTED_DUAL:
 		if (hapd->public_action_cb) {
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 24e764d..cd70436 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -31,6 +31,9 @@
 #include "ap_drv_ops.h"
 #include "gas_serv.h"
 #include "sta_info.h"
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
 				       struct sta_info *sta);
@@ -259,6 +262,9 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 	wpabuf_free(sta->wps_ie);
 	wpabuf_free(sta->p2p_ie);
 	wpabuf_free(sta->hs20_ie);
+#ifdef CONFIG_FST
+	wpabuf_free(sta->mb_ies);
+#endif
 
 	os_free(sta->ht_capabilities);
 	os_free(sta->vht_capabilities);
@@ -962,6 +968,15 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
 		sta->flags &= ~WLAN_STA_AUTHORIZED;
 	}
 
+#ifdef CONFIG_FST
+	if (hapd->iface->fst) {
+		if (authorized)
+			fst_notify_peer_connected(hapd->iface->fst, sta->addr, sta->mb_ies);
+		else
+			fst_notify_peer_disconnected(hapd->iface->fst, sta->addr);
+	}
+#endif
+
 	if (hapd->sta_authorized_cb)
 		hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
 					sta->addr, authorized, dev_addr);
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 240b926..66db800 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -125,6 +125,9 @@ struct sta_info {
 	struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
 	struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
 	struct wpabuf *hs20_ie; /* HS 2.0 IE from (Re)Association Request */
+#ifdef CONFIG_FST
+	struct wpabuf *mb_ies; /* MB IEs from (Re)Association Request */
+#endif
 
 	struct os_reltime connected_time;
 
diff --git a/src/ap/utils.c b/src/ap/utils.c
index 931968c..b97bebb 100644
--- a/src/ap/utils.c
+++ b/src/ap/utils.c
@@ -12,7 +12,9 @@
 #include "common/ieee802_11_defs.h"
 #include "sta_info.h"
 #include "hostapd.h"
-
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 int hostapd_register_probereq_cb(struct hostapd_data *hapd,
 				 int (*cb)(void *ctx, const u8 *sa,
@@ -55,6 +57,14 @@ static int prune_associations(struct hostapd_iface *iface, void *ctx)
 		ohapd = iface->bss[j];
 		if (ohapd == data->hapd)
 			continue;
+#ifdef CONFIG_FST
+		/* Don't prune STAs belong to same FST */
+		if (ohapd->iface->fst &&
+			data->hapd->iface->fst &&
+			fst_are_ifaces_aggregated(ohapd->iface->fst,
+				data->hapd->iface->fst))
+			continue;
+#endif
 		osta = ap_get_sta(ohapd, data->addr);
 		if (!osta)
 			continue;
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 50bdc01..10afc17 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -285,6 +285,18 @@ ParseRes ieee802_11_parse_elems(const u8 *start, size_t len,
 			elems->ssid_list = pos;
 			elems->ssid_list_len = elen;
 			break;
+		case WLAN_EID_MULTI_BAND:
+			if (elems->mb_ies.nof_ies < MAX_NOF_MB_IES_SUPPORTED) {
+				elems->mb_ies.ies[elems->mb_ies.nof_ies].ie = pos;
+				elems->mb_ies.ies[elems->mb_ies.nof_ies].ie_len = elen;
+				++elems->mb_ies.nof_ies;
+			}
+			else {
+				wpa_printf(MSG_WARNING, "IEEE 802.11 element parse "
+					"ignored MB IE (id=%d elen=%d)",
+					id, elen);
+			}
+			break;
 		default:
 			unknown++;
 			if (!show_errors)
@@ -541,3 +553,25 @@ int supp_rates_11b_only(struct ieee802_11_elems *elems)
 
 	return num_11b > 0 && num_others == 0;
 }
+
+struct wpabuf *mb_ies_by_info(struct mb_ies_info *info)
+{
+	struct wpabuf *mb_ies = NULL;
+	WPA_ASSERT(info != NULL);
+	if (info->nof_ies) {
+		u8 i;
+		size_t mb_ies_size = 0;
+		for (i = 0; i < info->nof_ies; i++) {
+			mb_ies_size += info->ies[i].ie_len + 2;
+		}
+		mb_ies = wpabuf_alloc(mb_ies_size);
+		if (mb_ies) {
+			for (i = 0; i < info->nof_ies; i++) {
+				wpabuf_put_data(mb_ies,
+					info->ies[i].ie - 2,
+					info->ies[i].ie_len + 2);
+			}
+		}
+	}
+	return mb_ies;
+}
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 4fb2e84..62fcb1c 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -9,6 +9,18 @@
 #ifndef IEEE802_11_COMMON_H
 #define IEEE802_11_COMMON_H
 
+#define MAX_NOF_MB_IES_SUPPORTED 5
+
+struct mb_ies_info
+{
+	struct
+	{
+		const u8 *ie;
+		u8        ie_len;
+	} ies[MAX_NOF_MB_IES_SUPPORTED];
+	u8 nof_ies;
+};
+
 /* Parsed Information Elements */
 struct ieee802_11_elems {
 	const u8 *ssid;
@@ -69,6 +81,8 @@ struct ieee802_11_elems {
 	u8 hs20_len;
 	u8 ext_capab_len;
 	u8 ssid_list_len;
+
+	struct mb_ies_info mb_ies;
 };
 
 typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
@@ -95,5 +109,6 @@ int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
 enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel);
 
 int supp_rates_11b_only(struct ieee802_11_elems *elems);
+struct wpabuf *mb_ies_by_info(struct mb_ies_info *info);
 
 #endif /* IEEE802_11_COMMON_H */
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 32a371d..7d9ff25 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3827,6 +3827,11 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 	drv->use_monitor = !info.poll_command_supported || !info.data_tx_status;
 
 	if (drv->device_ap_sme && drv->use_monitor) {
+#ifdef CONFIG_FST
+		wpa_printf(MSG_DEBUG, "nl80211: Disable use_monitor "
+			   "with device_ap_sme due to FST");
+		drv->use_monitor = 0;
+#else
 		/*
 		 * Non-mac80211 drivers may not support monitor interface.
 		 * Make sure we do not get stuck with incorrect capability here
@@ -3838,6 +3843,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 				   "support detected");
 			drv->use_monitor = 0;
 		}
+#endif
 	}
 
 	/*
@@ -4358,6 +4364,11 @@ static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
 			ret = -1;
 	}
 #endif /* CONFIG_TDLS */
+#ifdef CONFIG_FST
+	/* FST Action frames */
+	if (nl80211_register_action_frame(bss, (u8 *) "\x12", 1) < 0)
+		ret = -1;
+#endif /* CONFIG_FST */
 
 	/* FT Action frames */
 	if (nl80211_register_action_frame(bss, (u8 *) "\x06", 1) < 0)
-- 
1.8.3.1



From Anton.Nayshtut  Mon Feb 17 06:43:21 2014
From: Anton.Nayshtut (Anton Nayshtut)
Date: Mon, 17 Feb 2014 16:43:21 +0200
Subject: [PATCH 3/3] Transparent FST: wpa_supplicant integration
In-Reply-To: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
References: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
Message-ID: <1392648201-7416-4-git-send-email-Anton.Nayshtut@Wilocity.com>

From: Anton Nayshtut  <Anton.Nayshtut at wilocity.com>

This patch integrates the FST into the wpa_supplicant.

Signed-off-by: Anton Nayshtut <Anton.Nayshtut at wilocity.com>
Signed-off-by: Erez Kirshenbaum <Erez.Kirshenbaum at wilocity.com>
---
 wpa_supplicant/config.c            |  7 +++
 wpa_supplicant/config.h            |  5 +++
 wpa_supplicant/defconfig           |  3 ++
 wpa_supplicant/events.c            | 48 +++++++++++++++++++-
 wpa_supplicant/main.c              | 16 +++++++
 wpa_supplicant/notify.c            | 13 ++++++
 wpa_supplicant/scan.c              |  7 +++
 wpa_supplicant/sme.c               | 14 ++++++
 wpa_supplicant/wpa_supplicant.c    | 91 ++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/wpa_supplicant.conf | 20 +++++++++
 wpa_supplicant/wpa_supplicant_i.h  |  6 +++
 11 files changed, 229 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 2dd7054..c26cf6f 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1998,6 +1998,9 @@ void wpa_config_free(struct wpa_config *config)
 	os_free(config->ext_password_backend);
 	os_free(config->sae_groups);
 	wpabuf_free(config->ap_vendor_elements);
+#ifdef CONFIG_FST
+	os_free(config->fst_bond);
+#endif
 	os_free(config);
 }
 
@@ -3401,6 +3404,10 @@ static const struct global_parse_data global_fields[] = {
 	{ INT(scan_cur_freq), 0 },
 	{ INT(sched_scan_interval), 0 },
 	{ INT(tdls_external_control), 0},
+#ifdef CONFIG_FST
+	{ STR(fst_bond), 0 },
+	{ INT_RANGE(fst_default, 0, 1), 0 },
+#endif
 };
 
 #undef FUNC
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index e7bdaa5..4d58077 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -953,6 +953,11 @@ struct wpa_config {
 	u8 ip_addr_mask[4];
 	u8 ip_addr_start[4];
 	u8 ip_addr_end[4];
+
+#ifdef CONFIG_FST
+	char *fst_bond;
+	int fst_default;
+#endif
 };
 
 
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 6684782..75af101 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -495,3 +495,6 @@ CONFIG_PEERKEY=y
 #
 # External password backend for testing purposes (developer use)
 #CONFIG_EXT_PASSWORD_TEST=y
+
+# Enable Fast Session Transfer (FST)
+# CONFIG_FST=y
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 47434e4..4a8fc2c 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -42,7 +42,9 @@
 #include "scan.h"
 #include "offchannel.h"
 #include "interworking.h"
-
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 #ifndef CONFIG_NO_SCAN_PROCESSING
 static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
@@ -1780,6 +1782,43 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s,
 	if (wpa_found || rsn_found)
 		wpa_s->ap_ies_from_associnfo = 1;
 
+#ifdef CONFIG_FST
+	wpabuf_free(wpa_s->received_mb_ies);
+	wpa_s->received_mb_ies = NULL;
+	if (wpa_s->fst) {
+		struct mb_ies_info mb_ies;
+
+		os_memset(&mb_ies, 0, sizeof(mb_ies));
+
+		wpa_printf(MSG_DEBUG, "Looking for MB IE...");
+
+		p = data->assoc_info.beacon_ies;
+		l = data->assoc_info.beacon_ies_len;
+		p = data->assoc_info.resp_ies;
+	        l = data->assoc_info.resp_ies_len;
+
+		while (p && l >= 2 && mb_ies.nof_ies < MAX_NOF_MB_IES_SUPPORTED) {
+			len = p[1] + 2;
+			if (len > l) {
+				wpa_hexdump(MSG_DEBUG, "Truncated IE in beacon_ies",
+					p, l);
+				break;
+			}
+
+			if (p[0] == WLAN_EID_MULTI_BAND) {
+				wpa_printf(MSG_DEBUG, "MB IE of %u bytes found", len);
+				mb_ies.ies[mb_ies.nof_ies].ie = p + 2;
+				mb_ies.ies[mb_ies.nof_ies].ie_len = len - 2;
+				++mb_ies.nof_ies;
+			}
+
+			l -= len;
+			p += len;
+		}
+		wpa_s->received_mb_ies = mb_ies_by_info(&mb_ies);
+	}
+#endif
+
 	if (wpa_s->assoc_freq && data->assoc_info.freq &&
 	    wpa_s->assoc_freq != data->assoc_info.freq) {
 		wpa_printf(MSG_DEBUG, "Operating frequency changed from "
@@ -2767,6 +2806,13 @@ static void wpas_event_rx_mgmt_action(struct wpa_supplicant *wpa_s,
 	}
 #endif /* CONFIG_INTERWORKING */
 
+#ifdef CONFIG_FST
+	if (mgmt->u.action.category == WLAN_ACTION_FST && wpa_s->fst) {
+		fst_rx_action(wpa_s->fst, mgmt, len);
+		return;
+	}
+#endif
+
 #ifdef CONFIG_P2P
 	wpas_p2p_rx_action(wpa_s, mgmt->da, mgmt->sa, mgmt->bssid,
 			   category, payload, plen, freq);
diff --git a/wpa_supplicant/main.c b/wpa_supplicant/main.c
index d56935d..f015de0 100644
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -16,6 +16,11 @@
 #include "driver_i.h"
 #include "p2p_supplicant.h"
 
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
+
+extern struct wpa_driver_ops *wpa_drivers[];
 
 static void usage(void)
 {
@@ -325,9 +330,20 @@ int main(int argc, char *argv[])
 #endif /* CONFIG_P2P */
 	}
 
+#ifdef CONFIG_FST
+	if (exitcode == 0 && fst_global_start()) {
+		wpa_printf(MSG_ERROR, "Failed to start FST");
+		exitcode = -1;
+	}
+#endif
+
 	if (exitcode == 0)
 		exitcode = wpa_supplicant_run(global);
 
+#ifdef CONFIG_FST
+	fst_global_stop();
+#endif
+
 	wpa_supplicant_deinit(global);
 
 out:
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index a82fbf3..d99b93b 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -22,6 +22,9 @@
 #include "p2p_supplicant.h"
 #include "sme.h"
 #include "notify.h"
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 int wpas_notify_supplicant_initialized(struct wpa_global *global)
 {
@@ -79,6 +82,16 @@ void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
 	/* notify the new DBus API */
 	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
 
+#ifdef CONFIG_FST
+	if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
+		if (new_state == WPA_COMPLETED)
+			fst_notify_peer_connected(wpa_s->fst,
+				wpa_s->bssid, wpa_s->received_mb_ies);
+		else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
+			fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
+	}
+#endif
+
 #ifdef CONFIG_P2P
 	if (new_state == WPA_COMPLETED)
 		wpas_p2p_notif_connected(wpa_s);
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 6c742d6..3f6ad67 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -428,6 +428,13 @@ static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s)
 		wpas_hs20_add_indication(extra_ie);
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_FST
+	if (wpa_s->fst_ies) {
+		if (wpabuf_resize(&extra_ie, wpabuf_len(wpa_s->fst_ies)) == 0)
+			wpabuf_put_buf(extra_ie, wpa_s->fst_ies);
+	}
+#endif
+
 	return extra_ie;
 }
 
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index e712ac4..61765a2 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -370,6 +370,20 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
 	}
 #endif /* CONFIG_HS20 */
 
+#ifdef CONFIG_FST
+	if (wpa_s->fst_ies) {
+		int fst_ies_len = wpabuf_len(wpa_s->fst_ies);
+		if (wpa_s->sme.assoc_req_ie_len + fst_ies_len <=
+			sizeof(wpa_s->sme.assoc_req_ie)) {
+				os_memcpy(wpa_s->sme.assoc_req_ie +
+					wpa_s->sme.assoc_req_ie_len,
+					wpabuf_head(wpa_s->fst_ies),
+					fst_ies_len);
+			wpa_s->sme.assoc_req_ie_len += fst_ies_len;
+		}
+	}
+#endif
+
 	ext_capab_len = wpas_build_ext_capab(wpa_s, ext_capab);
 	if (ext_capab_len > 0) {
 		u8 *pos = wpa_s->sme.assoc_req_ie;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index e942b62..3df2476 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -51,6 +51,9 @@
 #include "offchannel.h"
 #include "hs20_supplicant.h"
 #include "wnm_sta.h"
+#ifdef CONFIG_FST
+#include "fst/fst.h"
+#endif
 
 const char *wpa_supplicant_version =
 "wpa_supplicant v" VERSION_STR "\n"
@@ -1613,6 +1616,19 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
 		}
 	}
 
+#ifdef CONFIG_FST
+	if (wpa_s->fst_ies)
+	{
+		int fst_ies_len = wpabuf_len(wpa_s->fst_ies);
+		if (wpa_ie_len + fst_ies_len <= sizeof(wpa_ie)) {
+			os_memcpy(wpa_ie + wpa_ie_len,
+					wpabuf_head(wpa_s->fst_ies),
+					fst_ies_len);
+			wpa_ie_len += fst_ies_len;
+		}
+	}
+#endif
+
 	wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL);
 	use_crypt = 1;
 	cipher_pairwise = wpa_s->pairwise_cipher;
@@ -2995,6 +3011,37 @@ int wpas_init_ext_pw(struct wpa_supplicant *wpa_s)
 	return 0;
 }
 
+#ifdef CONFIG_FST
+static const u8 * fst_wpa_supplicant_get_bssid_cb(void *ctx)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	return is_zero_ether_addr(wpa_s->bssid) ? NULL : wpa_s->bssid;
+}
+
+static void fst_wpa_supplicant_get_channel_info_cb(void *ctx,
+		enum hostapd_hw_mode *hw_mode, u8 *channel)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	*hw_mode = ieee80211_freq_to_chan(wpa_s->current_bss->freq, channel);
+}
+
+static void fst_wpa_supplicant_set_ies_cb(void *ctx,
+	struct wpabuf *fst_ies)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	wpa_s->fst_ies = fst_ies;
+}
+
+static int fst_wpa_supplicant_send_action_cb(void *ctx, const u8 *da,
+		struct wpabuf *data)
+{
+	struct wpa_supplicant *wpa_s = ctx;
+	WPA_ASSERT(os_memcmp(wpa_s->bssid, da, ETH_ALEN) == 0);
+	return wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
+					  wpa_s->own_addr, wpa_s->bssid,
+					  wpabuf_head(data), wpabuf_len(data), 0);
+}
+#endif
 
 static struct wpa_radio * radio_add_interface(struct wpa_supplicant *wpa_s,
 					      const char *rn)
@@ -3472,6 +3519,27 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
 		return -1;
 	}
 
+#ifdef CONFIG_FST
+	if (wpa_s->conf->fst_bond[0]) {
+		struct fst_wpa_obj iface_obj = {
+			.ctx = wpa_s,
+			.get_bssid         = fst_wpa_supplicant_get_bssid_cb,
+			.get_channel_info  = fst_wpa_supplicant_get_channel_info_cb,
+			.set_ies           = fst_wpa_supplicant_set_ies_cb,
+			.send_action       = fst_wpa_supplicant_send_action_cb,
+		};
+		wpa_s->fst = fst_attach(wpa_s->conf->fst_bond,
+				wpa_s->conf->fst_default, &iface_obj, wpa_s->ifname);
+		if (!wpa_s->fst) {
+			wpa_msg(wpa_s, MSG_ERROR, "Could not find FST %s",
+				wpa_s->conf->fst_bond);
+			return -1;
+		}
+		wpa_msg(wpa_s, MSG_DEBUG, "FST set: %s",
+			wpa_s->conf->fst_bond);
+	}
+#endif
+
 	if (wpas_wps_init(wpa_s))
 		return -1;
 
@@ -3559,6 +3627,17 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
 	wpas_ctrl_radio_work_flush(wpa_s);
 	radio_remove_interface(wpa_s);
 
+#ifdef CONFIG_FST
+	if (wpa_s->fst) {
+		fst_detach(wpa_s->fst);
+		wpa_s->fst = NULL;
+	}
+	if (wpa_s->received_mb_ies) {
+		wpabuf_free(wpa_s->received_mb_ies);
+		wpa_s->received_mb_ies = NULL;
+	}
+#endif
+
 	if (wpa_s->drv_priv)
 		wpa_drv_deinit(wpa_s);
 
@@ -3824,6 +3903,14 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params)
 
 	wpa_printf(MSG_DEBUG, "wpa_supplicant v" VERSION_STR);
 
+#ifdef CONFIG_FST
+	if (fst_global_init()) {
+		wpa_printf(MSG_ERROR, "Failed to initialize FST");
+		wpa_supplicant_deinit(global);
+		return NULL;
+	}
+#endif
+
 	if (eloop_init()) {
 		wpa_printf(MSG_ERROR, "Failed to initialize event loop");
 		wpa_supplicant_deinit(global);
@@ -3943,6 +4030,10 @@ void wpa_supplicant_deinit(struct wpa_global *global)
 
 	eloop_destroy();
 
+#ifdef CONFIG_FST
+	fst_global_deinit();
+#endif
+
 	if (global->params.pid_file) {
 		os_daemonize_terminate(global->params.pid_file);
 		os_free(global->params.pid_file);
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index 9d3bf6d..874cf69 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -920,6 +920,26 @@ fast_reauth=1
 #  2: MCS 0-9
 #  3: not supported
 
+# Fast Session Transfer (FST)
+#
+# The options in this section are only available when the build configuration
+# option CONFIG_FST is set while compiling hostapd. They allow this interface
+# to be a part of FST setup.
+#
+# FST is the transfer of a session from a channel to another channel, in the
+# same or different frequency bands.
+#
+# For detals, see WGA Specification.
+#
+# Bonding to be used for FST operations
+##fst_bond=bond0
+#
+# Whether the interface is the FST default
+# Each fst_bond must have one and only one fst_default interface defined.
+# 0 = don't use this interface as FST default
+# 1 = use this interface as FST default
+#fst_default=1
+
 # Example blocks:
 
 # Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index bcdb4d0..d0eb599 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -811,6 +811,12 @@ struct wpa_supplicant {
 	struct wpa_radio_work *connect_work;
 
 	unsigned int ext_work_id;
+
+#ifdef CONFIG_FST
+	struct fst_iface *fst;
+	struct wpabuf    *fst_ies;
+	struct wpabuf    *received_mb_ies;
+#endif
 };
 
 
-- 
1.8.3.1



From roger.zanoni  Mon Feb 17 11:02:47 2014
From: roger.zanoni (Roger Zanoni)
Date: Mon, 17 Feb 2014 15:02:47 -0400
Subject: [PATCH 1/1] Fix hostapd and wpa_supplicant build with binutils >=
	2.24.x
Message-ID: <1392663767-30469-1-git-send-email-roger.zanoni@openbossa.org>

Using binutils >= 2.24.x and setting
CONFIG_WPA_TRACE/CONFIG_WPA_TRACE_BDF causes both builds to fail with
"#error config.h must be included before this header" message.

Since version 2.24.x, the bfd header checks for PACKAGE and
PACKAGE_VERSION macros.

As suggested in http://sourceware.org/bugzilla/show_bug.cgi?id=14243
projects that use bfd and don't use autotools should define a PACKAGE
macro.

Signed-off-by: Roger Zanoni <roger.zanoni at openbossa.org>
---
 hostapd/Makefile        | 2 +-
 wpa_supplicant/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hostapd/Makefile b/hostapd/Makefile
index ef093e5..d7ff91e 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -77,7 +77,7 @@ HOBJS += ../src/utils/trace.o
 LDFLAGS += -rdynamic
 CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
-CFLAGS += -DWPA_TRACE_BFD
+CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
 LIBS += -lbfd
 LIBS_c += -lbfd
 LIBS_h += -lbfd
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index d1e11a3..496f6fb 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -106,7 +106,7 @@ OBJS_priv += ../src/utils/trace.o
 LDFLAGS += -rdynamic
 CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
-CFLAGS += -DWPA_TRACE_BFD
+CFLAGS += -DPACKAGE="wpa_supplicant" -DWPA_TRACE_BFD
 LIBS += -lbfd
 LIBS_p += -lbfd
 LIBS_c += -lbfd
-- 
1.8.5.4



From greearb  Mon Feb 17 11:44:05 2014
From: greearb (Ben Greear)
Date: Mon, 17 Feb 2014 11:44:05 -0800
Subject: Question on how encryption keys are supposed to be handled.
Message-ID: <53026685.7040303@candelatech.com>


I've been debugging an issue where my ath10k firmware is running out of key
objects to allocate.  This could be a simple issue in the firmware, but first I
wanted to try to figure out how things are supposed to work.

What I see in my firmware is that near time of association it allocates
4 keys.  Two of them are multicast, and one of the multicast is index 0,
the second is index 1.

Then, some time later (probably on rekey), another multicast is added at index 2.

After that, key space is exhausted so I see errors in the kernel logs about adding
broadcast keys failing.

TCP and UDP traffic continues to flow, but I am not testing multicast traffic,
so maybe that would be failing.

So, question is:  Is it expected that the mcast keys keep being added at increasing
key indexes?  If so, what is the maximum index allowed?

Is this something primarily controlled at the supplicant level?

Thanks,
Ben

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



From emanuel.taube  Tue Feb 18 02:36:34 2014
From: emanuel.taube (Emanuel Taube)
Date: Tue, 18 Feb 2014 11:36:34 +0100
Subject: [PATCH 1/2] hostapd: make it possible to remove addresses from
	maclists
Message-ID: <1392719795-10744-1-git-send-email-emanuel.taube@gmail.com>

It is already possible to add mac addresses at runtime.
This patch allows also to remove some of them by the prefix "-"
in the address file.

Signed-off-by: Emanuel Taube <emanuel.taube at gmail.com>
---
 hostapd/config_file.c |   23 +++++++++++++++++++++--
 src/utils/os.h        |   19 +++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 19d6ad3..c45d30e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -116,6 +116,8 @@ static int hostapd_config_read_maclist(const char *fname,
 	char buf[128], *pos;
 	int line = 0;
 	u8 addr[ETH_ALEN];
+	Boolean remove;
+	int i;
 	struct mac_acl_entry *newacl;
 	int vlan_id;
 
@@ -143,14 +145,31 @@ static int hostapd_config_read_maclist(const char *fname,
 		}
 		if (buf[0] == '\0')
 			continue;
+		pos = buf;
+		if (buf[0] == '-') {
+			remove = TRUE;
+			pos++;
+		} else
+			remove = FALSE;
 
-		if (hwaddr_aton(buf, addr)) {
+		if (hwaddr_aton(pos, addr)) {
 			wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
-				   "line %d in '%s'", buf, line, fname);
+				   "line %d in '%s'", pos, line, fname);
 			fclose(f);
 			return -1;
 		}
 
+		if (remove) {
+			for (i = 0; i < *num; i++)
+				if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) ==
+				    0) {
+					*acl = os_remove_in_array(
+						*acl, *num,
+						sizeof(**acl), i);
+					(*num)--;
+				}
+			continue;
+		}
 		vlan_id = 0;
 		pos = buf;
 		while (*pos != '\0' && *pos != ' ' && *pos != '\t')
diff --git a/src/utils/os.h b/src/utils/os.h
index 2e2350a..961020b 100644
--- a/src/utils/os.h
+++ b/src/utils/os.h
@@ -549,6 +549,25 @@ static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
 	return os_realloc(ptr, nmemb * size);
 }
 
+/**
+ * os_remove_in_array - Remove a member from an array by index
+ * @ptr: pointer to the array
+ * @nmemb: current member count of the array
+ * @size: the size per member of the array
+ * @idx: index of the member which should be removed
+ * Returns: pointer to the new array.
+ */
+static inline void * os_remove_in_array(void *ptr, size_t nmemb, size_t size,
+				        unsigned int idx)
+{
+	if (idx >= nmemb)
+		return ptr;
+	if (idx < nmemb - 1)
+		os_memmove(ptr + idx * size, ptr + (idx + 1) * size,
+			   (nmemb - idx - 1) * size);
+
+	return os_realloc_array(ptr, nmemb-1, size);
+}
 
 /**
  * os_strlcpy - Copy a string with size bound and NUL-termination
-- 
1.7.10.4



From emanuel.taube  Tue Feb 18 02:36:35 2014
From: emanuel.taube (Emanuel Taube)
Date: Tue, 18 Feb 2014 11:36:35 +0100
Subject: [PATCH 2/2] hostapd: deauthenticate clients forbidden by maclists
In-Reply-To: <1392719795-10744-1-git-send-email-emanuel.taube@gmail.com>
References: <1392719795-10744-1-git-send-email-emanuel.taube@gmail.com>
Message-ID: <1392719795-10744-2-git-send-email-emanuel.taube@gmail.com>

After adding or removing a mac address from a list the
corresponding station is not deauthenticated as expected.

Signed-off-by: Emanuel Taube <emanuel.taube at gmail.com>
---
 hostapd/ctrl_iface.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 4a9da5f..e2df568 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -984,6 +984,30 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
 #endif /* CONFIG_TESTING_OPTIONS */
 	} else {
 		ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
+		if (ret)
+			return ret;
+		if (os_strcasecmp(cmd, "deny_mac_file") == 0) {
+			struct sta_info *sta;
+			int vlan_id;
+			for (sta = hapd->sta_list; sta; sta = sta->next) {
+				if (hostapd_maclist_found(hapd->conf->deny_mac,
+				    hapd->conf->num_deny_mac, sta->addr,&vlan_id) &&
+				   (!vlan_id || vlan_id == sta->vlan_id))
+					ap_sta_deauthenticate(hapd, sta,
+						     WLAN_REASON_UNSPECIFIED);
+			}
+		} else if (os_strcasecmp(cmd, "accept_mac_file") == 0) {
+			struct sta_info *sta;
+			int vlan_id;
+			for (sta = hapd->sta_list; sta; sta = sta->next) {
+				if (!hostapd_maclist_found(hapd->conf->accept_mac,
+				    hapd->conf->num_accept_mac, sta->addr,&vlan_id) ||
+				   (vlan_id && vlan_id != sta->vlan_id))
+					ap_sta_deauthenticate(hapd, sta,
+						     WLAN_REASON_UNSPECIFIED);
+			}
+		}
+
 	}
 
 	return ret;
-- 
1.7.10.4



From jithujance  Tue Feb 18 05:37:26 2014
From: jithujance (Jithu Jance)
Date: Tue, 18 Feb 2014 19:07:26 +0530
Subject: [PATCH 1/2] P2P: Addressing few issues seen with Broadcast SD
In-Reply-To: <20140214191608.GA22228@w1.fi>
References: <137202264661b954a4fa6ffea014c5182616aa68.1391502949.git.jithu@broadcom.com>
	<20140214191608.GA22228@w1.fi>
Message-ID: <CAGCGobAsMJFS8gPheKXCr-T9D8B9S1MSaQOQBbREYEDRCqJeOQ@mail.gmail.com>

Hi Jouni,

>but there are still some
>issues with the changes here. This breaks couple of the SD test cases:
Strangely, all SD related tests were passing for me. But now I see
that two tests are failing. Looks like I messed up something while
testing.  I will check this.

> Please note that I merged in 2/2 to make a single commit
> P2P_DEV_SD_INFO BIT and P2P_DEV_SD_SCHEDULE by removing them completely
> this cleaned up version would be a good next baseline to use to figure
> out what needs to be changed to make sure this does not add any
> regressions.
Thanks a lot!. I will try check the regression with this base-line patch.


Jithu Jance





On Sat, Feb 15, 2014 at 12:46 AM, Jouni Malinen <j at w1.fi> wrote:
>
> On Tue, Feb 04, 2014 at 02:39:00PM +0530, Jithu Jance wrote:
> > 1) Suppose we have multiple peers and we have peers advertising
> > SD capability, but no services registered for adverstising.
> > In this case, even if there are mutliple broadcast queries set,
> > we might end up sending only the lastly added Broadcast to the
> > same device (Since SD_INFO won't get set for the first broadcast)
> >
> > 2) Some times it is seen that before advancing to next device in the
> > list, the scan results come and updates SD_SCHEDULE flag. This will
> > result in sending the already sent query to the same device without
> > giving chance to other devices. This issue again is seen with peer
> > devices advertising SD capability without any services registered.
>
> I agree that these issues need to be resolved, but there are still some
> issues with the changes here. This breaks couple of the SD test cases:
> http://buildbot.w1.fi/hwsim/results.php?run=1392400340
> And as such, I cannot apply this.
>
> Please note that I merged in 2/2 to make a single commit (there is no
> point in introducing a bug that gets fixed in the second patch in the
> same set). In addition, I cleaned up the partial removal of
> P2P_DEV_SD_INFO BIT and P2P_DEV_SD_SCHEDULE by removing them completely
> since they were either read-only or write-only and did not affect any
> operations after the changes.
>
> I have not yet tried to figure out why this breaks things, but anyway,
> this cleaned up version would be a good next baseline to use to figure
> out what needs to be changed to make sure this does not add any
> regressions.
>
>
> [PATCH] P2P: Address few issues seen with Broadcast SD
>
> 1) Suppose we have multiple peers and we have peers advertising SD
> capability, but no services registered for advertising. In this case,
> even if there are multiple broadcast queries set, we might end up
> sending only the last added broadcast query to the same device (Since
> SD_INFO won't get set for the first broadcast query).
>
> 2) Some times it is seen that before advancing to the next device in the
> list, the scan results come and update SD_SCHEDULE flag. This will
> result in sending the already sent query to the same device without
> giving chance to other devices. This issue again is seen with peer
> devices advertising SD capability without any services registered.
>
> Signed-hostap: Jithu Jance <jithu at broadcom.com>
> ---
>  src/p2p/p2p.c    |   22 +++++++++----------
>  src/p2p/p2p_i.h  |    9 ++++++--
>  src/p2p/p2p_sd.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++-------
>  3 files changed, 73 insertions(+), 22 deletions(-)
>
> diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
> index 3010377..5a33b64 100644
> --- a/src/p2p/p2p.c
> +++ b/src/p2p/p2p.c
> @@ -733,9 +733,6 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,
>
>         p2p_parse_free(&msg);
>
> -       if (p2p_pending_sd_req(p2p, dev))
> -               dev->flags |= P2P_DEV_SD_SCHEDULE;
> -
>         if (dev->flags & P2P_DEV_REPORTED)
>                 return 0;
>
> @@ -2392,6 +2389,7 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)
>
>         p2p->go_timeout = 100;
>         p2p->client_timeout = 20;
> +       p2p->num_p2p_sd_queries = 0;
>
>         p2p_dbg(p2p, "initialized");
>         p2p_channels_dump(p2p, "channels", &p2p->cfg->channels);
> @@ -2627,7 +2625,13 @@ void p2p_continue_find(struct p2p_data *p2p)
>         struct p2p_device *dev;
>         p2p_set_state(p2p, P2P_SEARCH);
>         dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
> -               if (dev->flags & P2P_DEV_SD_SCHEDULE) {
> +               if (dev->sd_pending_bcast_queries == 0) {
> +                       /* Initialize with total number of registered broadcast
> +                        * SD queries. */
> +                       dev->sd_pending_bcast_queries = p2p->num_p2p_sd_queries;
> +               }
> +
> +               if (dev->sd_pending_bcast_queries > 0) {
>                         if (p2p_start_sd(p2p, dev) == 0)
>                                 return;
>                         else
> @@ -2654,10 +2658,8 @@ static void p2p_sd_cb(struct p2p_data *p2p, int success)
>         p2p->pending_action_state = P2P_NO_PENDING_ACTION;
>
>         if (!success) {
> -               if (p2p->sd_peer) {
> -                       p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
> +               if (p2p->sd_peer)
>                         p2p->sd_peer = NULL;
> -               }
>                 p2p_continue_find(p2p);
>                 return;
>         }
> @@ -3202,7 +3204,6 @@ static void p2p_timeout_sd_during_find(struct p2p_data *p2p)
>         p2p_dbg(p2p, "Service Discovery Query timeout");
>         if (p2p->sd_peer) {
>                 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
> -               p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
>                 p2p->sd_peer = NULL;
>         }
>         p2p_continue_find(p2p);
> @@ -3473,7 +3474,7 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
>                           "country=%c%c\n"
>                           "oper_freq=%d\n"
>                           "req_config_methods=0x%x\n"
> -                         "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
> +                         "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
>                           "status=%d\n"
>                           "wait_count=%u\n"
>                           "invitation_reqs=%u\n",
> @@ -3496,9 +3497,6 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
>                           dev->flags & P2P_DEV_REPORTED ? "[REPORTED]" : "",
>                           dev->flags & P2P_DEV_NOT_YET_READY ?
>                           "[NOT_YET_READY]" : "",
> -                         dev->flags & P2P_DEV_SD_INFO ? "[SD_INFO]" : "",
> -                         dev->flags & P2P_DEV_SD_SCHEDULE ? "[SD_SCHEDULE]" :
> -                         "",
>                           dev->flags & P2P_DEV_PD_PEER_DISPLAY ?
>                           "[PD_PEER_DISPLAY]" : "",
>                           dev->flags & P2P_DEV_PD_PEER_KEYPAD ?
> diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
> index f105083..6de3461 100644
> --- a/src/p2p/p2p_i.h
> +++ b/src/p2p/p2p_i.h
> @@ -81,8 +81,6 @@ struct p2p_device {
>  #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
>  #define P2P_DEV_REPORTED BIT(1)
>  #define P2P_DEV_NOT_YET_READY BIT(2)
> -#define P2P_DEV_SD_INFO BIT(3)
> -#define P2P_DEV_SD_SCHEDULE BIT(4)
>  #define P2P_DEV_PD_PEER_DISPLAY BIT(5)
>  #define P2P_DEV_PD_PEER_KEYPAD BIT(6)
>  #define P2P_DEV_USER_REJECTED BIT(7)
> @@ -110,6 +108,7 @@ struct p2p_device {
>
>         u8 go_timeout;
>         u8 client_timeout;
> +       int sd_pending_bcast_queries;
>  };
>
>  struct p2p_sd_query {
> @@ -256,6 +255,12 @@ struct p2p_data {
>          */
>         struct p2p_sd_query *sd_query;
>
> +       /**
> +        * num_p2p_sd_queries - Total number of broadcast SD queries present in
> +        * the list
> +        */
> +       int num_p2p_sd_queries;
> +
>         /* GO Negotiation data */
>
>         /**
> diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
> index 0e0c7f1..b7509da 100644
> --- a/src/p2p/p2p_sd.c
> +++ b/src/p2p/p2p_sd.c
> @@ -52,6 +52,7 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
>  {
>         struct p2p_sd_query *q;
>         int wsd = 0;
> +       int count = 0;
>
>         if (!(dev->info.dev_capab & P2P_DEV_CAPAB_SERVICE_DISCOVERY))
>                 return NULL; /* peer does not support SD */
> @@ -64,8 +65,17 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
>                 /* Use WSD only if the peer indicates support or it */
>                 if (q->wsd && !wsd)
>                         continue;
> -               if (q->for_all_peers && !(dev->flags & P2P_DEV_SD_INFO))
> -                       return q;
> +               /* if the query is a broadcast query */
> +               if (q->for_all_peers) {
> +                       /* check if there are any broadcast queries pending for
> +                        * this device */
> +                       if (dev->sd_pending_bcast_queries <= 0)
> +                               return NULL;
> +                       /* query number that needs to be send to the device */
> +                       if (count == dev->sd_pending_bcast_queries - 1)
> +                               return q;
> +                       count++;
> +               }
>                 if (!q->for_all_peers &&
>                     os_memcmp(q->peer, dev->info.p2p_device_addr, ETH_ALEN) ==
>                     0)
> @@ -76,14 +86,36 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
>  }
>
>
> +static void p2p_decrease_sd_bc_queries(struct p2p_data *p2p, int query_number)
> +{
> +       struct p2p_device *dev;
> +
> +       p2p->num_p2p_sd_queries--;
> +       dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
> +               if (query_number <= dev->sd_pending_bcast_queries - 1) {
> +                       /*
> +                        * Query not yet sent to the device and it is to be
> +                        * removed, so update the pending count.
> +                        */
> +                       dev->sd_pending_bcast_queries--;
> +               }
> +       }
> +}
> +
> +
>  static int p2p_unlink_sd_query(struct p2p_data *p2p,
>                                struct p2p_sd_query *query)
>  {
>         struct p2p_sd_query *q, *prev;
> +       int query_number = 0;
>         q = p2p->sd_queries;
>         prev = NULL;
>         while (q) {
>                 if (q == query) {
> +                       /* If the query is a broadcast query, decrease one from
> +                        * all the devices */
> +                       if (query->for_all_peers)
> +                               p2p_decrease_sd_bc_queries(p2p, query_number);
>                         if (prev)
>                                 prev->next = q->next;
>                         else
> @@ -92,6 +124,8 @@ static int p2p_unlink_sd_query(struct p2p_data *p2p,
>                                 p2p->sd_query = NULL;
>                         return 1;
>                 }
> +               if (q->for_all_peers)
> +                       query_number++;
>                 prev = q;
>                 q = q->next;
>         }
> @@ -118,6 +152,7 @@ void p2p_free_sd_queries(struct p2p_data *p2p)
>                 q = q->next;
>                 p2p_free_sd_query(prev);
>         }
> +       p2p->num_p2p_sd_queries = 0;
>  }
>
>
> @@ -262,6 +297,16 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
>                 ret = -1;
>         }
>
> +       /* Update the pending broadcast SD query count for this device */
> +       dev->sd_pending_bcast_queries--;
> +
> +       /*
> +        * If there are no pending broadcast queries for this device, mark it as
> +        * done (-1).
> +        */
> +       if (dev->sd_pending_bcast_queries == 0)
> +               dev->sd_pending_bcast_queries = -1;
> +
>         wpabuf_free(req);
>
>         return ret;
> @@ -541,8 +586,6 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
>         p2p_dbg(p2p, "Service Update Indicator: %u", update_indic);
>         pos += 2;
>
> -       p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
> -       p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
>         p2p->sd_peer = NULL;
>
>         if (p2p->sd_query) {
> @@ -787,8 +830,6 @@ skip_nqp_header:
>                 return;
>         }
>
> -       p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
> -       p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
>         p2p->sd_peer = NULL;
>
>         if (p2p->sd_query) {
> @@ -841,8 +882,15 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
>
>         if (dst == NULL) {
>                 struct p2p_device *dev;
> -               dl_list_for_each(dev, &p2p->devices, struct p2p_device, list)
> -                       dev->flags &= ~P2P_DEV_SD_INFO;
> +               p2p->num_p2p_sd_queries++;
> +
> +               /* Update all the devices for the newly added broadcast query */
> +               dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
> +                       if (dev->sd_pending_bcast_queries <= 0)
> +                               dev->sd_pending_bcast_queries = 1;
> +                       else
> +                               dev->sd_pending_bcast_queries++;
> +               }
>         }
>
>         return q;
> --
> 1.7.9.5
>
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap


From dimitrysh  Tue Feb 18 16:26:10 2014
From: dimitrysh (Dmitry Shmidt)
Date: Tue, 18 Feb 2014 16:26:10 -0800
Subject: [PATCH] Android: Use external libnl 2.0 dynamic library
Message-ID: <20140219002721.E232313FF21@ushik.mtv.corp.google.com>

Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 hostapd/Android.mk        | 8 ++++++++
 wpa_supplicant/Android.mk | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 6e37beb..5d6fe56 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -51,8 +51,12 @@ INCLUDES += $(LOCAL_PATH)/src/utils
 INCLUDES += external/openssl/include
 INCLUDES += system/security/keystore/include
 ifdef CONFIG_DRIVER_NL80211
+ifneq ($(wildcard external/libnl),)
+INCLUDES += external/libnl/include
+else
 INCLUDES += external/libnl-headers
 endif
+endif
 
 
 ifndef CONFIG_OS
@@ -910,8 +914,12 @@ LOCAL_STATIC_LIBRARIES += $(BOARD_HOSTAPD_PRIVATE_LIB)
 endif
 LOCAL_SHARED_LIBRARIES := libc libcutils liblog libcrypto libssl
 ifdef CONFIG_DRIVER_NL80211
+ifneq ($(wildcard external/libnl),)
+LOCAL_SHARED_LIBRARIES += libnl
+else
 LOCAL_STATIC_LIBRARIES += libnl_2
 endif
+endif
 LOCAL_CFLAGS := $(L_CFLAGS)
 LOCAL_SRC_FILES := $(OBJS)
 LOCAL_C_INCLUDES := $(INCLUDES)
diff --git a/wpa_supplicant/Android.mk b/wpa_supplicant/Android.mk
index 9b07460..2880b2d 100644
--- a/wpa_supplicant/Android.mk
+++ b/wpa_supplicant/Android.mk
@@ -70,8 +70,12 @@ INCLUDES += $(LOCAL_PATH)/src/wps
 INCLUDES += external/openssl/include
 INCLUDES += system/security/keystore/include
 ifdef CONFIG_DRIVER_NL80211
+ifneq ($(wildcard external/libnl),)
+INCLUDES += external/libnl/include
+else
 INCLUDES += external/libnl-headers
 endif
+endif
 
 ifdef CONFIG_FIPS
 CONFIG_NO_RANDOM_POOL=
@@ -1568,8 +1572,12 @@ ifeq ($(CONFIG_TLS), openssl)
 LOCAL_SHARED_LIBRARIES += libcrypto libssl libkeystore_binder
 endif
 ifdef CONFIG_DRIVER_NL80211
+ifneq ($(wildcard external/libnl),)
+LOCAL_SHARED_LIBRARIES += libnl
+else
 LOCAL_STATIC_LIBRARIES += libnl_2
 endif
+endif
 LOCAL_CFLAGS := $(L_CFLAGS)
 LOCAL_SRC_FILES := $(OBJS)
 LOCAL_C_INCLUDES := $(INCLUDES)
-- 
1.9.0.rc1.175.g0b1dcb5



From billtsai  Tue Feb 18 20:30:12 2014
From: billtsai (billtsai)
Date: Wed, 19 Feb 2014 12:30:12 +0800
Subject: Question about 80211r and 80211k
Message-ID: <1392784212.4962.7.camel@billtsai-Aspire-4935>

1.    From configuration 80211R is supported, I want to test this
feature but no idea about the test environment.
        Please instruct under what environment AP/STA to enable this
feature.
2.    Will wpa_supplicant support 80211k in the future?

Sincerely,
Bill Tsai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140219/c101b4e6/attachment.htm>


From samiran.linux  Tue Feb 18 23:10:26 2014
From: samiran.linux (samiran saha)
Date: Wed, 19 Feb 2014 12:40:26 +0530
Subject: EAP-AKA fast re-authentication using hostapd as library
Message-ID: <CAOdN5SD3CjG8DkKdAK1howfNoxHq3fgmmGoAiiQo2Lu=ZD_jMA@mail.gmail.com>

Hello,
        I am trying to implement server client program using hostapd as
library that will at first complete full authentication process and then it
will do fast re-authentication using the re-authentication id received from
server. I have completed the first step i.e. full authentication process
using EAP-AKA but can not proceed further for fast re-authentication
because after full authentication server goes to EAP-SUCCESS state and if I
reinitialize the state machine then it allocate new sm . So how can I do
fast re-authentication, any clue or does hostapd support fast
re-authentication at all?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140219/3ef8bb90/attachment.htm>


From j  Wed Feb 19 03:26:58 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 13:26:58 +0200
Subject: EAP-AKA fast re-authentication using hostapd as library
In-Reply-To: <CAOdN5SD3CjG8DkKdAK1howfNoxHq3fgmmGoAiiQo2Lu=ZD_jMA@mail.gmail.com>
References: <CAOdN5SD3CjG8DkKdAK1howfNoxHq3fgmmGoAiiQo2Lu=ZD_jMA@mail.gmail.com>
Message-ID: <20140219112658.GA17962@w1.fi>

On Wed, Feb 19, 2014 at 12:40:26PM +0530, samiran saha wrote:
>         I am trying to implement server client program using hostapd as
> library that will at first complete full authentication process and then it
> will do fast re-authentication using the re-authentication id received from
> server. I have completed the first step i.e. full authentication process
> using EAP-AKA but can not proceed further for fast re-authentication
> because after full authentication server goes to EAP-SUCCESS state and if I
> reinitialize the state machine then it allocate new sm . So how can I do
> fast re-authentication, any clue or does hostapd support fast
> re-authentication at all?

I'm not sure how you use "hostapd as a library", but anyway, hostapd as
an independent process does support EAP-AKA fast re-authentication. The
fast re-auth information is kept in memory by default, so if you
reinitialize state completely, you will lose that data. You can enable
CONFIG_SQLITE=y for the build and set eap_user_file to point to an
SQLite database to use a database to store such information to
persistent over hostapd restarts, so I'd assume that would work for you
use case as well.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 03:36:06 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 13:36:06 +0200
Subject: [PATCH 1/2] hostapd: make it possible to remove addresses from
	maclists
In-Reply-To: <1392719795-10744-1-git-send-email-emanuel.taube@gmail.com>
References: <1392719795-10744-1-git-send-email-emanuel.taube@gmail.com>
Message-ID: <20140219113606.GB17962@w1.fi>

On Tue, Feb 18, 2014 at 11:36:34AM +0100, Emanuel Taube wrote:
> It is already possible to add mac addresses at runtime.
> This patch allows also to remove some of them by the prefix "-"
> in the address file.

> diff --git a/hostapd/config_file.c b/hostapd/config_file.c
> @@ -143,14 +145,31 @@ static int hostapd_config_read_maclist(const char *fname,
> +		if (remove) {
> +			for (i = 0; i < *num; i++)
> +				if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) ==
> +				    0) {
> +					*acl = os_remove_in_array(
> +						*acl, *num,
> +						sizeof(**acl), i);

This looks like it could leak memory on failure (and even worse, crash
on NULL dereference if the list were to have more entries).. Not really
expected to happen in practice, but whenever I see realloc and the
pointer be reassigned without being verified, this triggers warnings..

In addition, it looks like this loop would skip checking the entry
following the one that got removed. Not that there is an expectation for
there to be multiple entries for the same MAC address, but since that
loop did not break out on the first match, it looks like it is trying to
handle that case as well.

> diff --git a/src/utils/os.h b/src/utils/os.h
> @@ -549,6 +549,25 @@ static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
>  	return os_realloc(ptr, nmemb * size);
> +static inline void * os_remove_in_array(void *ptr, size_t nmemb, size_t size,
> +				        unsigned int idx)
> +{
> +	if (idx >= nmemb)
> +		return ptr;
> +	if (idx < nmemb - 1)
> +		os_memmove(ptr + idx * size, ptr + (idx + 1) * size,
> +			   (nmemb - idx - 1) * size);
> +
> +	return os_realloc_array(ptr, nmemb-1, size);
> +}

Is it really worth the effort to realloc the buffer here? I would
consider changing this to a void function with the last step removed.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 03:39:36 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 13:39:36 +0200
Subject: Questions regarding Anonymous-TLS
In-Reply-To: <CAAdcsmt=uK_rr=0NjqFKNkO+VkGBRsfkxbWscy41XH015jGacw@mail.gmail.com>
References: <CAAdcsmt=uK_rr=0NjqFKNkO+VkGBRsfkxbWscy41XH015jGacw@mail.gmail.com>
Message-ID: <20140219113936.GD17962@w1.fi>

On Mon, Feb 17, 2014 at 07:49:58PM +0530, Shyam wrote:
> Want to try out anonymous-TLS.I would like to know what is the
> configuration at the client(peer side) and at the radius server side.

Just like EAP-TLS, but no client_cert/private_key configured on the
client and eap=UNAUTH-TLS instead of TLS both on the client and on the
server (eap_users file).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 03:45:58 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 13:45:58 +0200
Subject: [PATCH] wpa_debug: Remove 2048 byte message length limit
In-Reply-To: <alpine.DEB.2.02.1402151906000.43540@department-of-alchemy.MIT.EDU>
References: <alpine.DEB.2.02.1402151906000.43540@department-of-alchemy.MIT.EDU>
Message-ID: <20140219114558.GE17962@w1.fi>

On Sat, Feb 15, 2014 at 07:08:32PM -0500, Anders Kaseorg wrote:
> diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
> @@ -596,10 +596,14 @@ void wpa_msg(void *ctx, int level, const char *fmt, ...)
> +	va_start(ap, fmt);
> +	buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
> +	va_end(ap);

How portable is this? SUSv2 seems to imply that n==0 would result in
undefined behavior, so this may not work without being compliant with
C99. There are some strange targets that wpa_supplicant is used on, so
I'm not sure whether there would be enough justification for this change
if there is risk of breaking debugging on such platforms.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 03:48:23 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 13:48:23 +0200
Subject: PEAPv1 testing
In-Reply-To: <DUB111-W25648C4F71803E35B5AFCDCC900@phx.gbl>
References: <52F89AC2.3080306@globaledgesoft.com>
	<DUB111-W25648C4F71803E35B5AFCDCC900@phx.gbl>
Message-ID: <20140219114823.GF17962@w1.fi>

On Mon, Feb 10, 2014 at 12:06:28PM +0000, Sergio NNX wrote:
> I'm trying to test several EAP methods, including PEAPv0 & PEAPv1. PEAPv0 works fine, but PEAPv1.
> All other methods (e.g. EAP-TTLS, EAP-AKA, etc) work Ok.
> I've done some Google search but I couldn't find any pointers.

> network={
>         eap=PEAP
>         phase1="peaplabel=1"

Is there a particular reason for forcing the very uncommon PEAP label to
be used? That will not interoperate with most authentication servers..

> WARNING: PMK mismatch

And would most likely explain this.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 03:58:29 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 13:58:29 +0200
Subject: Radius DAS won't work
In-Reply-To: <1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
	<52F3DAF7.5040508@deployingradius.com>
	<1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>
Message-ID: <20140219115829.GG17962@w1.fi>

On Fri, Feb 07, 2014 at 12:44:34PM +0100, Robert Plestenjak wrote:
> DAS: Received 52 bytes from 172.16.93.117:41409
> RADIUS message: code=40 (Disconnect-Request) identifier=40 length=52
>    Attribute 44 (Acct-Session-Id) length=19
>       Value: '52F4B5D1-00000000'
>    Attribute 1 (User-Name) length=7
>       Value: 'janez'
>    Attribute 4 (NAS-IP-Address) length=6
>       Value: 172.16.117.235
> DAS: Unsupported attribute 4 in Disconnect-Request from 172.16.93.117:41409


> Now, if I get this right, NAS receives Disconnect-Request and it complains that it doesn't support attribute 4 (Accounting-Request). Then it sends response NAK and error, attribute 101 with value 401 (unsuported attribute).

That's an attribute, not code.. In other words, attribute 4 is
NAS-IP-Address. hostapd does not currently support identification of the
NAS based on attributes (it doesn't make much sense to do that since
hostapd is not a proxy and Disconnect-Request sent to its IP address is
already identifying the target). Based on RFC 5176, any unsupported
attribute in the request will result in Disconnect-NAK with error code
401. In other words, you would need to drop that NAS-IP-Address from the
Disconnect-Request for now.

I understand that the RADIUS proxy would likely end up forwarding all
the attributes, so it would make sense to add support in hostapd at
least for NAS-IP-Address (and NAS-IPv6-Address) and maybe NAS-Identifier
as well, since it is also mentioned in the RFC, so that the proxy case
would work as well.

> rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)
> radclient: no response from server for ID 40 socket 3
> 
> 
> On Freeradius side we see that disconnect requst was send, NAK received and after that it fails verifying Message-Authenticator response.

I don't remember in which version this was fixed, but I'd assume you'll
see this go away by updating to the latest FreeRADIUS release.

-- 
Jouni Malinen                                            PGP id EFC895FA


From samiran.linux  Wed Feb 19 04:04:50 2014
From: samiran.linux (samiran saha)
Date: Wed, 19 Feb 2014 17:34:50 +0530
Subject: EAP-AKA fast re-authentication using hostapd as library
In-Reply-To: <20140219112658.GA17962@w1.fi>
References: <CAOdN5SD3CjG8DkKdAK1howfNoxHq3fgmmGoAiiQo2Lu=ZD_jMA@mail.gmail.com>
	<20140219112658.GA17962@w1.fi>
Message-ID: <CAOdN5SB6aMP+UFhhBR4AS_D3y-fFezWHeA1c6oahXba91eUSNw@mail.gmail.com>

Hi,
    Thanks for your suggestion, but my real concern is about, after first
full authentication sm->EAP_state of server goes to EAP_SUCCESS state. For
another authentication (fast re-authentication) I have to change the
EAP_state from EAP_SUCCESS to some other state right? So, what would be
that state?


On Wed, Feb 19, 2014 at 4:56 PM, Jouni Malinen <j at w1.fi> wrote:

> On Wed, Feb 19, 2014 at 12:40:26PM +0530, samiran saha wrote:
> >         I am trying to implement server client program using hostapd as
> > library that will at first complete full authentication process and then
> it
> > will do fast re-authentication using the re-authentication id received
> from
> > server. I have completed the first step i.e. full authentication process
> > using EAP-AKA but can not proceed further for fast re-authentication
> > because after full authentication server goes to EAP-SUCCESS state and
> if I
> > reinitialize the state machine then it allocate new sm . So how can I do
> > fast re-authentication, any clue or does hostapd support fast
> > re-authentication at all?
>
> I'm not sure how you use "hostapd as a library", but anyway, hostapd as
> an independent process does support EAP-AKA fast re-authentication. The
> fast re-auth information is kept in memory by default, so if you
> reinitialize state completely, you will lose that data. You can enable
> CONFIG_SQLITE=y for the build and set eap_user_file to point to an
> SQLite database to use a database to store such information to
> persistent over hostapd restarts, so I'd assume that would work for you
> use case as well.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140219/5d73d1f7/attachment.htm>


From j  Wed Feb 19 04:08:20 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 14:08:20 +0200
Subject: EAP-AKA fast re-authentication using hostapd as library
In-Reply-To: <CAOdN5SB6aMP+UFhhBR4AS_D3y-fFezWHeA1c6oahXba91eUSNw@mail.gmail.com>
References: <CAOdN5SD3CjG8DkKdAK1howfNoxHq3fgmmGoAiiQo2Lu=ZD_jMA@mail.gmail.com>
	<20140219112658.GA17962@w1.fi>
	<CAOdN5SB6aMP+UFhhBR4AS_D3y-fFezWHeA1c6oahXba91eUSNw@mail.gmail.com>
Message-ID: <20140219120820.GA18763@w1.fi>

On Wed, Feb 19, 2014 at 05:34:50PM +0530, samiran saha wrote:
>     Thanks for your suggestion, but my real concern is about, after first
> full authentication sm->EAP_state of server goes to EAP_SUCCESS state. For
> another authentication (fast re-authentication) I have to change the
> EAP_state from EAP_SUCCESS to some other state right? So, what would be
> that state?

I don't think you would use that same EAP server sm instance again,
i.e., it would be a new instance for the second authentication (and that
would then find the AKA fast re-auth data separately to be able to
handle that option).

-- 
Jouni Malinen                                            PGP id EFC895FA


From andersk  Wed Feb 19 04:09:48 2014
From: andersk (Anders Kaseorg)
Date: Wed, 19 Feb 2014 07:09:48 -0500 (EST)
Subject: [PATCH] wpa_debug: Remove 2048 byte message length limit
In-Reply-To: <20140219114558.GE17962@w1.fi>
References: <alpine.DEB.2.02.1402151906000.43540@department-of-alchemy.MIT.EDU>
	<20140219114558.GE17962@w1.fi>
Message-ID: <alpine.DEB.2.02.1402190651020.43540@department-of-alchemy.MIT.EDU>

On Wed, 19 Feb 2014, Jouni Malinen wrote:
> How portable is this? SUSv2 seems to imply that n==0 would result in 
> undefined behavior, so this may not work without being compliant with 
> C99. There are some strange targets that wpa_supplicant is used on, so 
> I'm not sure whether there would be enough justification for this change 
> if there is risk of breaking debugging on such platforms.

This was corrected in SUSv3.  According to the Autoconf manual,

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Function-Portability.html#index-g_t_0040code_007bsnprintf_007d-357

?The C99 standard says that if the output array isn't big enough and if no 
other errors occur, snprintf and vsnprintf truncate the output and return 
the number of bytes that ought to have been produced. Some older systems 
return the truncated length (e.g., GNU C Library 2.0.x or IRIX 6.5), some 
a negative value (e.g., earlier GNU C Library versions), and some the 
buffer length without truncation (e.g., 32-bit Solaris 7). Also, some 
buggy older systems ignore the length and overrun the buffer (e.g., 64-bit 
Solaris 7).?

glibc 2.0.x and Solaris 7 have been obsolete for at least 14 years, and I 
can?t find any evidence of wpa_supplicant being used on IRIX, but you 
would know better than me.  If any of these platforms are a concern, we 
could work around these problems by checking for potential truncation and 
redoubling the buffer length until there?s enough space?  (Except 64-bit 
Solaris 7, which just sounds completely hopeless.)

Keep in mind that snprintf isn?t even part of C89 at all, so we have to 
draw a line somewhere.

Anders


From j  Wed Feb 19 04:16:33 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 14:16:33 +0200
Subject: [PATCH] TLS: Add tls_options field per network to set addition
	TLS options
In-Reply-To: <20140130205619.06C5513FE69@ushik.mtv.corp.google.com>
References: <20140130205619.06C5513FE69@ushik.mtv.corp.google.com>
Message-ID: <20140219121633.GB18763@w1.fi>

On Wed, Jan 29, 2014 at 01:49:43PM -0800, Dmitry Shmidt wrote:
> diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
> +static long tls_connection_get_opt(const struct tls_connection_params *params)
> +{
> +	long options = 0;
> +
> +	if (params->tls_options == NULL)
> +		return options;
> +	if (os_strstr(params->tls_options, "tls_no_tlsv1_1"))
> +		options |= SSL_OP_NO_TLSv1_1;
> +	if (os_strstr(params->tls_options, "tls_no_tlsv1_2"))
> +		options |= SSL_OP_NO_TLSv1_2;
> +	return options;
> +}

There is already a mechanism for passing TLS parameters that are similar
to disabling TLS v1.1/v1.2. struct tls_connection_params::flags is a
bitfield of TLS_CONN* flags (see src/crypto/tls.h).
TLS_CONN_DISABLE_TLSv1_1 and _2 would fit in there nicely.


> diff --git a/src/eap_peer/eap_config.h b/src/eap_peer/eap_config.h
> @@ -678,6 +678,13 @@ struct eap_peer_config {
> +	/**
> +	 * tls_options - Additional options for TLS connection
> +	 *
> +	 * This filed allows to set additional TLS options per network.
> +	 */
> +	char *tls_options;

And this new parameter would not be needed with TLS_CONN_* flags, i.e.,
these flags are set based on the existing phase1 parameter (e.g.,
phase1="tls_disable_session_ticket=1").


(This patch was missing saving of this new parameter in config write
options, but anyway, I'd rather handle this through the existing
configuration parameter.)

-- 
Jouni Malinen                                            PGP id EFC895FA


From samiran.linux  Wed Feb 19 04:30:36 2014
From: samiran.linux (samiran saha)
Date: Wed, 19 Feb 2014 18:00:36 +0530
Subject: EAP-AKA fast re-authentication using hostapd as library
In-Reply-To: <20140219120820.GA18763@w1.fi>
References: <CAOdN5SD3CjG8DkKdAK1howfNoxHq3fgmmGoAiiQo2Lu=ZD_jMA@mail.gmail.com>
	<20140219112658.GA17962@w1.fi>
	<CAOdN5SB6aMP+UFhhBR4AS_D3y-fFezWHeA1c6oahXba91eUSNw@mail.gmail.com>
	<20140219120820.GA18763@w1.fi>
Message-ID: <CAOdN5SAc8_Kw1=pPwaPm9f52y1gVftCVe8g4xVd0u_DHA=H1Cg@mail.gmail.com>

Ok, So I have to call eap_server_sm_init and set the content of
eap_sim_db_priv to what previous sm had.. am I thinking right?


On Wed, Feb 19, 2014 at 5:38 PM, Jouni Malinen <j at w1.fi> wrote:

> On Wed, Feb 19, 2014 at 05:34:50PM +0530, samiran saha wrote:
> >     Thanks for your suggestion, but my real concern is about, after first
> > full authentication sm->EAP_state of server goes to EAP_SUCCESS state.
> For
> > another authentication (fast re-authentication) I have to change the
> > EAP_state from EAP_SUCCESS to some other state right? So, what would be
> > that state?
>
> I don't think you would use that same EAP server sm instance again,
> i.e., it would be a new instance for the second authentication (and that
> would then find the AKA fast re-auth data separately to be able to
> handle that option).
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140219/12893d55/attachment-0001.htm>


From j  Wed Feb 19 05:21:41 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 15:21:41 +0200
Subject: [PATCH 1/1] Fix hostapd and wpa_supplicant build with binutils
	>= 2.24.x
In-Reply-To: <1392663767-30469-1-git-send-email-roger.zanoni@openbossa.org>
References: <1392663767-30469-1-git-send-email-roger.zanoni@openbossa.org>
Message-ID: <20140219132141.GA27439@w1.fi>

On Mon, Feb 17, 2014 at 03:02:47PM -0400, Roger Zanoni wrote:
> Using binutils >= 2.24.x and setting
> CONFIG_WPA_TRACE/CONFIG_WPA_TRACE_BDF causes both builds to fail with
> "#error config.h must be included before this header" message.
> 
> Since version 2.24.x, the bfd header checks for PACKAGE and
> PACKAGE_VERSION macros.
> 
> As suggested in http://sourceware.org/bugzilla/show_bug.cgi?id=14243
> projects that use bfd and don't use autotools should define a PACKAGE
> macro.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 05:22:00 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 15:22:00 +0200
Subject: [PATCH] Android: Use external libnl 2.0 dynamic library
In-Reply-To: <20140219002721.E232313FF21@ushik.mtv.corp.google.com>
References: <20140219002721.E232313FF21@ushik.mtv.corp.google.com>
Message-ID: <20140219132200.GB27439@w1.fi>

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Feb 19 05:25:20 2014
From: j (Jouni Malinen)
Date: Wed, 19 Feb 2014 15:25:20 +0200
Subject: [PATCH] OpenSSL: Accept certificates marked for both server and
	client use
In-Reply-To: <alpine.DEB.2.02.1402151853090.43540@department-of-alchemy.MIT.EDU>
References: <alpine.DEB.2.02.1402150018560.43540@department-of-alchemy.MIT.EDU>
	<20140215074831.GA4045@w1.fi> <52FF4066.8090104@mit.edu>
	<20140215111140.GA30581@w1.fi>
	<alpine.DEB.2.02.1402151853090.43540@department-of-alchemy.MIT.EDU>
Message-ID: <20140219132520.GC27439@w1.fi>

On Sat, Feb 15, 2014 at 07:05:05PM -0500, Anders Kaseorg wrote:
> Okay, then it sounds like the most reasonable solution is reverting commit 
> 51e3eafb68e15e78e98ca955704be8a6c3a7b304.

I did that now. I don't yet know what will happen with the other
conflicting requirements in this area, but I'll try to get them changed
and at least keep this use case in mind as far as wpa_supplicant
implementation is concerned. There is now a regression test case that
verifies interop with this type of AAA server certificate.

-- 
Jouni Malinen                                            PGP id EFC895FA


From emanuel.taube  Wed Feb 19 06:53:15 2014
From: emanuel.taube (Emanuel Taube)
Date: Wed, 19 Feb 2014 15:53:15 +0100
Subject: [PATCHv2 1/2] hostapd: make it possible to remove addresses from
	maclists
Message-ID: <1392821596-3034-1-git-send-email-emanuel.taube@gmail.com>

It is already possible to add mac addresses at runtime.
This patch allows also to remove some of them by the prefix "-"
in the address file.

Signed-off-by: Emanuel Taube <emanuel.taube at gmail.com>
---
 hostapd/config_file.c |   23 +++++++++++++++++++++--
 src/utils/os.h        |   16 ++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 19d6ad3..35e1438 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -116,6 +116,8 @@ static int hostapd_config_read_maclist(const char *fname,
 	char buf[128], *pos;
 	int line = 0;
 	u8 addr[ETH_ALEN];
+	Boolean remove;
+	int i;
 	struct mac_acl_entry *newacl;
 	int vlan_id;
 
@@ -143,14 +145,31 @@ static int hostapd_config_read_maclist(const char *fname,
 		}
 		if (buf[0] == '\0')
 			continue;
+		pos = buf;
+		if (buf[0] == '-') {
+			remove = TRUE;
+			pos++;
+		} else
+			remove = FALSE;
 
-		if (hwaddr_aton(buf, addr)) {
+		if (hwaddr_aton(pos, addr)) {
 			wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
-				   "line %d in '%s'", buf, line, fname);
+				   "line %d in '%s'", pos, line, fname);
 			fclose(f);
 			return -1;
 		}
 
+		if (remove) {
+			for (i = 0; i < *num; i++)
+				if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) ==
+				    0) {
+					os_remove_in_array(
+						*acl, *num,
+						sizeof(**acl), i--);
+					(*num)--;
+				}
+			continue;
+		}
 		vlan_id = 0;
 		pos = buf;
 		while (*pos != '\0' && *pos != ' ' && *pos != '\t')
diff --git a/src/utils/os.h b/src/utils/os.h
index 2e2350a..3786bdf 100644
--- a/src/utils/os.h
+++ b/src/utils/os.h
@@ -549,6 +549,22 @@ static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
 	return os_realloc(ptr, nmemb * size);
 }
 
+/**
+ * os_remove_in_array - Remove a member from an array by index
+ * @ptr: pointer to the array
+ * @nmemb: current member count of the array
+ * @size: the size per member of the array
+ * @idx: index of the member which should be removed
+ */
+static inline void os_remove_in_array(void *ptr, size_t nmemb, size_t size,
+				        unsigned int idx)
+{
+	if (idx >= nmemb)
+		return;
+	if (idx < nmemb - 1)
+		os_memmove(ptr + idx * size, ptr + (idx + 1) * size,
+			   (nmemb - idx - 1) * size);
+}
 
 /**
  * os_strlcpy - Copy a string with size bound and NUL-termination
-- 
1.7.10.4



From emanuel.taube  Wed Feb 19 07:30:10 2014
From: emanuel.taube (Emanuel Taube)
Date: Wed, 19 Feb 2014 16:30:10 +0100
Subject: [PATCH 1/2] hostapd: make it possible to remove addresses from
	maclists
In-Reply-To: <20140219113606.GB17962@w1.fi>
References: <1392719795-10744-1-git-send-email-emanuel.taube@gmail.com>
	<20140219113606.GB17962@w1.fi>
Message-ID: <CAANdOW4+3d8Ox-ha1FotLdm=67EADX4jA5mdSXqrxj2ox+70Pg@mail.gmail.com>

Thank you, for the feedback.
I've just sent in v2 with your corrections built in.


In addition, it looks like this loop would skip checking the entry
> following the one that got removed. Not that there is an expectation for
> there to be multiple entries for the same MAC address, but since that
> loop did not break out on the first match, it looks like it is trying to
> handle that case as well.
>

Indeed it tries to handle that case as well, cause nothing prevents the
other
side to send in the same mac address twice for whatever reason. And I
think changing the mac address list at runtime could higher the possibility
for that to happen.

Regards,
Emanuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140219/34c703c9/attachment.htm>


From moon.linux  Wed Feb 19 09:03:28 2014
From: moon.linux (Anand Moon)
Date: Wed, 19 Feb 2014 09:03:28 -0800 (PST)
Subject: Can hwsim test router AP.
Message-ID: <1392829408.80884.YahooMailNeo@web122303.mail.ne1.yahoo.com>



Hi Jouni

Can hwsim be used to test route AP wireless features or is it meant only for mac80211_hwsim.

-Anand Moon


From roger.zanoni  Wed Feb 19 11:46:11 2014
From: roger.zanoni (Roger Zanoni)
Date: Wed, 19 Feb 2014 15:46:11 -0400
Subject: [PATCH 2/2] Avoid undefined references with CONFIG_WPA_TRACE_BFD set
In-Reply-To: <1392839171-15481-1-git-send-email-roger.zanoni@openbossa.org>
References: <1392839171-15481-1-git-send-email-roger.zanoni@openbossa.org>
Message-ID: <1392839171-15481-2-git-send-email-roger.zanoni@openbossa.org>

libdl, libberty and libzlib are dependencies for libbfd.

Signed-off-by: Roger Zanoni <roger.zanoni at openbossa.org>
---
 hostapd/Makefile        | 6 +++---
 wpa_supplicant/Makefile | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hostapd/Makefile b/hostapd/Makefile
index 385f865..251b3c9 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -78,9 +78,9 @@ LDFLAGS += -rdynamic
 override CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
 override CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
-LIBS += -lbfd
-LIBS_c += -lbfd
-LIBS_h += -lbfd
+LIBS += -lbfd -ldl -liberty -lz
+LIBS_c += -lbfd -ldl -liberty -lz
+LIBS_h += -lbfd -ldl -liberty -lz
 endif
 endif
 
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 5ddc05f..fd8256d 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -107,9 +107,9 @@ LDFLAGS += -rdynamic
 override CFLAGS += -funwind-tables
 ifdef CONFIG_WPA_TRACE_BFD
 override CFLAGS += -DPACKAGE="wpa_supplicant" -DWPA_TRACE_BFD
-LIBS += -lbfd
-LIBS_p += -lbfd
-LIBS_c += -lbfd
+LIBS += -lbfd -ldl -liberty -lz
+LIBS_p += -lbfd -ldl -liberty -lz
+LIBS_c += -lbfd -ldl -liberty -lz
 endif
 endif
 
-- 
1.9.0



From dimitrysh  Wed Feb 19 13:21:58 2014
From: dimitrysh (Dmitry Shmidt)
Date: Wed, 19 Feb 2014 13:21:58 -0800
Subject: [PATCH] TLS: Add tls_disable_tlsv1_1 and tls_disable_tlsv1_2 params
Message-ID: <20140219212304.AE9C713FFD8@ushik.mtv.corp.google.com>

Change-Id: I5c23b6f7ea07719829622e6661807ca53da5b068
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 src/crypto/tls.h              | 2 ++
 src/crypto/tls_openssl.c      | 9 +++++++++
 src/eap_peer/eap_tls_common.c | 8 ++++++++
 3 files changed, 19 insertions(+)

diff --git a/src/crypto/tls.h b/src/crypto/tls.h
index feba13f..88afae4 100644
--- a/src/crypto/tls.h
+++ b/src/crypto/tls.h
@@ -85,6 +85,8 @@ struct tls_config {
 #define TLS_CONN_DISABLE_SESSION_TICKET BIT(2)
 #define TLS_CONN_REQUEST_OCSP BIT(3)
 #define TLS_CONN_REQUIRE_OCSP BIT(4)
+#define TLS_CONN_DISABLE_TLSv1_1 BIT(5)
+#define TLS_CONN_DISABLE_TLSv1_2 BIT(6)
 
 /**
  * struct tls_connection_params - Parameters for TLS connection
diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index 2fd7bbb..eeabbd7 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -3182,6 +3182,15 @@ int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
 #endif /* SSL_clear_options */
 #endif /*  SSL_OP_NO_TICKET */
 
+	if (params->flags & TLS_CONN_DISABLE_TLSv1_1)
+		SSL_set_options(conn->ssl, SSL_OP_NO_TLSv1_1);
+	else
+		SSL_clear_options(conn->ssl, SSL_OP_NO_TLSv1_1);
+	if (params->flags & TLS_CONN_DISABLE_TLSv1_2)
+		SSL_set_options(conn->ssl, SSL_OP_NO_TLSv1_2);
+	else
+		SSL_clear_options(conn->ssl, SSL_OP_NO_TLSv1_2);
+
 #ifdef HAVE_OCSP
 	if (params->flags & TLS_CONN_REQUEST_OCSP) {
 		SSL_CTX *ssl_ctx = tls_ctx;
diff --git a/src/eap_peer/eap_tls_common.c b/src/eap_peer/eap_tls_common.c
index 008af37..b3a99b6 100644
--- a/src/eap_peer/eap_tls_common.c
+++ b/src/eap_peer/eap_tls_common.c
@@ -64,6 +64,14 @@ static void eap_tls_params_flags(struct tls_connection_params *params,
 		params->flags |= TLS_CONN_DISABLE_SESSION_TICKET;
 	if (os_strstr(txt, "tls_disable_session_ticket=0"))
 		params->flags &= ~TLS_CONN_DISABLE_SESSION_TICKET;
+	if (os_strstr(txt, "tls_disable_tlsv1_1=1"))
+		params->flags |= TLS_CONN_DISABLE_TLSv1_1;
+	if (os_strstr(txt, "tls_disable_tlsv1_1=0"))
+		params->flags &= ~TLS_CONN_DISABLE_TLSv1_1;
+	if (os_strstr(txt, "tls_disable_tlsv1_2=1"))
+		params->flags |= TLS_CONN_DISABLE_TLSv1_2;
+	if (os_strstr(txt, "tls_disable_tlsv1_2=0"))
+		params->flags &= ~TLS_CONN_DISABLE_TLSv1_2;
 }
 
 
-- 
1.9.0.rc1.175.g0b1dcb5



From dimitrysh  Wed Feb 19 13:24:26 2014
From: dimitrysh (Dmitry Shmidt)
Date: Wed, 19 Feb 2014 13:24:26 -0800
Subject: [PATCH] TLS: Add tls_options field per network to set addition
	TLS options
In-Reply-To: <20140219121633.GB18763@w1.fi>
References: <20140130205619.06C5513FE69@ushik.mtv.corp.google.com>
	<20140219121633.GB18763@w1.fi>
Message-ID: <CAH7ZN-xibAy20wCPmr4+-vzSsqK=Vm=5XM51e+WUr=NK7-FAPg@mail.gmail.com>

On Wed, Feb 19, 2014 at 4:16 AM, Jouni Malinen <j at w1.fi> wrote:
> On Wed, Jan 29, 2014 at 01:49:43PM -0800, Dmitry Shmidt wrote:
>> diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
>> +static long tls_connection_get_opt(const struct tls_connection_params *params)
>> +{
>> +     long options = 0;
>> +
>> +     if (params->tls_options == NULL)
>> +             return options;
>> +     if (os_strstr(params->tls_options, "tls_no_tlsv1_1"))
>> +             options |= SSL_OP_NO_TLSv1_1;
>> +     if (os_strstr(params->tls_options, "tls_no_tlsv1_2"))
>> +             options |= SSL_OP_NO_TLSv1_2;
>> +     return options;
>> +}
>
> There is already a mechanism for passing TLS parameters that are similar
> to disabling TLS v1.1/v1.2. struct tls_connection_params::flags is a
> bitfield of TLS_CONN* flags (see src/crypto/tls.h).
> TLS_CONN_DISABLE_TLSv1_1 and _2 would fit in there nicely.
>
>
>> diff --git a/src/eap_peer/eap_config.h b/src/eap_peer/eap_config.h
>> @@ -678,6 +678,13 @@ struct eap_peer_config {
>> +     /**
>> +      * tls_options - Additional options for TLS connection
>> +      *
>> +      * This filed allows to set additional TLS options per network.
>> +      */
>> +     char *tls_options;
>
> And this new parameter would not be needed with TLS_CONN_* flags, i.e.,
> these flags are set based on the existing phase1 parameter (e.g.,
> phase1="tls_disable_session_ticket=1").

You mean something like this:
http://patchwork.ozlabs.org/patch/322016/

>
>
> (This patch was missing saving of this new parameter in config write
> options, but anyway, I'd rather handle this through the existing
> configuration parameter.)
>
> --
> Jouni Malinen                                            PGP id EFC895FA


From robert.plestenjak  Wed Feb 19 23:43:53 2014
From: robert.plestenjak (Robert Plestenjak)
Date: Thu, 20 Feb 2014 08:43:53 +0100 (CET)
Subject: Radius DAS won't work
In-Reply-To: <20140219115829.GG17962@w1.fi>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
	<52F3DAF7.5040508@deployingradius.com>
	<1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>
	<20140219115829.GG17962@w1.fi>
Message-ID: <655613187.1038432.1392882233710.JavaMail.zimbra@zimbra.xlab.si>

Yes! That was it, I had to remove 'NAS-IP-Address = 172.16.117.235' from disconnect request.

Proper Disconnect-request package (package.txt):

Acct-Session-Id = "5305B0C7-00000001"
User-Name = "janez"


And you send it like:

cat ~/packet.txt | radclient -r 1 -x 172.16.117.235:3799 disconnect supersecret


Thanks for help.

- Robert


----- Original Message -----
From: "Jouni Malinen" <j at w1.fi>
To: hostap at lists.shmoo.com
Sent: Wednesday, February 19, 2014 12:58:29 PM
Subject: Re: Radius DAS won't work

On Fri, Feb 07, 2014 at 12:44:34PM +0100, Robert Plestenjak wrote:
> DAS: Received 52 bytes from 172.16.93.117:41409
> RADIUS message: code=40 (Disconnect-Request) identifier=40 length=52
>    Attribute 44 (Acct-Session-Id) length=19
>       Value: '52F4B5D1-00000000'
>    Attribute 1 (User-Name) length=7
>       Value: 'janez'
>    Attribute 4 (NAS-IP-Address) length=6
>       Value: 172.16.117.235
> DAS: Unsupported attribute 4 in Disconnect-Request from 172.16.93.117:41409


> Now, if I get this right, NAS receives Disconnect-Request and it complains that it doesn't support attribute 4 (Accounting-Request). Then it sends response NAK and error, attribute 101 with value 401 (unsuported attribute).

That's an attribute, not code.. In other words, attribute 4 is
NAS-IP-Address. hostapd does not currently support identification of the
NAS based on attributes (it doesn't make much sense to do that since
hostapd is not a proxy and Disconnect-Request sent to its IP address is
already identifying the target). Based on RFC 5176, any unsupported
attribute in the request will result in Disconnect-NAK with error code
401. In other words, you would need to drop that NAS-IP-Address from the
Disconnect-Request for now.

I understand that the RADIUS proxy would likely end up forwarding all
the attributes, so it would make sense to add support in hostapd at
least for NAS-IP-Address (and NAS-IPv6-Address) and maybe NAS-Identifier
as well, since it is also mentioned in the RFC, so that the proxy case
would work as well.

> rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)
> radclient: no response from server for ID 40 socket 3
> 
> 
> On Freeradius side we see that disconnect requst was send, NAK received and after that it fails verifying Message-Authenticator response.

I don't remember in which version this was fixed, but I'd assume you'll
see this go away by updating to the latest FreeRADIUS release.

-- 
Jouni Malinen                                            PGP id EFC895FA
_______________________________________________
HostAP mailing list
HostAP at lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap


From robert.plestenjak  Thu Feb 20 01:43:29 2014
From: robert.plestenjak (Robert Plestenjak)
Date: Thu, 20 Feb 2014 10:43:29 +0100 (CET)
Subject: Radius DAS won't work
In-Reply-To: <655613187.1038432.1392882233710.JavaMail.zimbra@zimbra.xlab.si>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
	<52F3DAF7.5040508@deployingradius.com>
	<1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>
	<20140219115829.GG17962@w1.fi>
	<655613187.1038432.1392882233710.JavaMail.zimbra@zimbra.xlab.si>
Message-ID: <1022517895.1047717.1392889409050.JavaMail.zimbra@zimbra.xlab.si>

PMKSA cache may not be acting properly. After it receives disconnect-message, connection is broken but then it accepts client by authenticating it with data from cache.


wlan0: AP-STA-DISCONNECTED 20:64:32:52:53:bb
wlan0: STA 20:64:32:52:53:bb RADIUS: stopped accounting session 5305C7A0-00000002
wlan0: STA 20:64:32:52:53:bb IEEE 802.11: authenticated
wlan0: STA 20:64:32:52:53:bb IEEE 802.11: associated (aid 1)
wlan0: STA 20:64:32:52:53:bb WPA: pairwise key handshake completed (RSN)
wlan0: AP-STA-CONNECTED 20:64:32:52:53:bb
wlan0: STA 20:64:32:52:53:bb RADIUS: starting accounting session 5305C7A0-00000002
wlan0: STA 20:64:32:52:53:bb IEEE 802.1X: authenticated - EAP type: 25 (PEAP) (PMKSA cache)


You can disable PMKSA cache with 'disable_pmksa_caching=1', then access will be properly denied to client (if account is disabled on Radius server).


wlan0: AP-STA-DISCONNECTED 20:64:32:52:53:bb
wlan0: STA 20:64:32:52:53:bb RADIUS: stopped accounting session 5305C89C-00000003
wlan0: STA 20:64:32:52:53:bb IEEE 802.11: authenticated
wlan0: STA 20:64:32:52:53:bb IEEE 802.11: associated (aid 1)
wlan0: CTRL-EVENT-EAP-STARTED 20:64:32:52:53:bb
wlan0: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
wlan0: STA 20:64:32:52:53:bb IEEE 802.1X: could not extract EAP-Message from RADIUS message
wlan0: STA 20:64:32:52:53:bb IEEE 802.1X: authentication failed - EAP type: 0 ((null))
wlan0: STA 20:64:32:52:53:bb IEEE 802.1X: Supplicant used different EAP type: 1 (Identity)
wlan0: STA 20:64:32:52:53:bb IEEE 802.11: deauthenticated due to local deauth request


Hostapd should probably ignore cached identity data in case of disconnect-message?

- Robert


----- Original Message -----
From: "Robert Plestenjak" <robert.plestenjak at xlab.si>
To: "Jouni Malinen" <j at w1.fi>
Cc: hostap at lists.shmoo.com
Sent: Thursday, February 20, 2014 8:43:53 AM
Subject: Re: Radius DAS won't work

Yes! That was it, I had to remove 'NAS-IP-Address = 172.16.117.235' from disconnect request.

Proper Disconnect-request package (package.txt):

Acct-Session-Id = "5305B0C7-00000001"
User-Name = "janez"


And you send it like:

cat ~/packet.txt | radclient -r 1 -x 172.16.117.235:3799 disconnect supersecret


Thanks for help.

- Robert


----- Original Message -----
From: "Jouni Malinen" <j at w1.fi>
To: hostap at lists.shmoo.com
Sent: Wednesday, February 19, 2014 12:58:29 PM
Subject: Re: Radius DAS won't work

On Fri, Feb 07, 2014 at 12:44:34PM +0100, Robert Plestenjak wrote:
> DAS: Received 52 bytes from 172.16.93.117:41409
> RADIUS message: code=40 (Disconnect-Request) identifier=40 length=52
>    Attribute 44 (Acct-Session-Id) length=19
>       Value: '52F4B5D1-00000000'
>    Attribute 1 (User-Name) length=7
>       Value: 'janez'
>    Attribute 4 (NAS-IP-Address) length=6
>       Value: 172.16.117.235
> DAS: Unsupported attribute 4 in Disconnect-Request from 172.16.93.117:41409


> Now, if I get this right, NAS receives Disconnect-Request and it complains that it doesn't support attribute 4 (Accounting-Request). Then it sends response NAK and error, attribute 101 with value 401 (unsuported attribute).

That's an attribute, not code.. In other words, attribute 4 is
NAS-IP-Address. hostapd does not currently support identification of the
NAS based on attributes (it doesn't make much sense to do that since
hostapd is not a proxy and Disconnect-Request sent to its IP address is
already identifying the target). Based on RFC 5176, any unsupported
attribute in the request will result in Disconnect-NAK with error code
401. In other words, you would need to drop that NAS-IP-Address from the
Disconnect-Request for now.

I understand that the RADIUS proxy would likely end up forwarding all
the attributes, so it would make sense to add support in hostapd at
least for NAS-IP-Address (and NAS-IPv6-Address) and maybe NAS-Identifier
as well, since it is also mentioned in the RFC, so that the proxy case
would work as well.

> rad_verify: Received packet from 172.16.117.235 with invalid Message-Authenticator!  (Shared secret is incorrect.)
> radclient: no response from server for ID 40 socket 3
> 
> 
> On Freeradius side we see that disconnect requst was send, NAK received and after that it fails verifying Message-Authenticator response.

I don't remember in which version this was fixed, but I'd assume you'll
see this go away by updating to the latest FreeRADIUS release.

-- 
Jouni Malinen                                            PGP id EFC895FA
_______________________________________________
HostAP mailing list
HostAP at lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap
_______________________________________________
HostAP mailing list
HostAP at lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap


From rahul.jain  Thu Feb 20 03:30:27 2014
From: rahul.jain (Rahul Jain)
Date: Thu, 20 Feb 2014 11:30:27 +0000 (GMT)
Subject: Reg Process for submiting changes for review
Message-ID: <CC.05.09100.357E5035@epcpsbgx2.samsung.com>

An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140220/34b10d03/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 14036 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140220/34b10d03/attachment.gif>


From jithu  Thu Feb 20 03:43:25 2014
From: jithu (Jithu Jance)
Date: Thu, 20 Feb 2014 17:13:25 +0530
Subject: [PATCH v3 1/1] P2P: Addressing few issues seen with P2P SD
Message-ID: <4d8fb2829c6d8678a7652dabc55f820cbb38e520.1392896340.git.jithu@broadcom.com>

Hi Jouni,

I have fixed the P2P SD regression issues seen with the earlier
version of this patch. Please see whether the patch is fine.


1) Suppose we have multiple peers and we have peers advertising
 SD capability, but no services registered for adverstising
 In this case, even if there are mutliple broadcast queries set,
 we might end up sending only the lastly added Broadcast to the
 same device (Since SD_INFO won't get set for the first broadcast)

2) Some times it is seen that before advancing to next device in the
 list, the scan results come and updates SD_SCHEDULE flag. This will
 result in sending the already sent query to the same device without
 giving chance to other devices. This issue again is seen with peer
 devices advertising SD capability without any services registered.

Signed-off-by: Jithu Jance <jithu at broadcom.com>
---
 src/p2p/p2p.c    |   29 ++++++++++---------------
 src/p2p/p2p_i.h  |    9 ++++++--
 src/p2p/p2p_sd.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 75 insertions(+), 27 deletions(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 2ecc547..b726136 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -733,9 +733,6 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq,

 	p2p_parse_free(&msg);

-	if (p2p_pending_sd_req(p2p, dev))
-		dev->flags |= P2P_DEV_SD_SCHEDULE;
-
 	if (dev->flags & P2P_DEV_REPORTED)
 		return 0;

@@ -2406,6 +2403,7 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)

 	p2p->go_timeout = 100;
 	p2p->client_timeout = 20;
+	p2p->num_p2p_sd_queries = 0;

 	p2p_dbg(p2p, "initialized");
 	p2p_channels_dump(p2p, "channels", &p2p->cfg->channels);
@@ -2641,12 +2639,15 @@ void p2p_continue_find(struct p2p_data *p2p)
 	struct p2p_device *dev;
 	p2p_set_state(p2p, P2P_SEARCH);
 	dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
-		if (dev->flags & P2P_DEV_SD_SCHEDULE) {
-			if (p2p_start_sd(p2p, dev) == 0)
-				return;
-			else
-				break;
-		} else if (dev->req_config_methods &&
+		if (dev->sd_pending_bcast_queries == 0) {
+			/* Initialize with total number of registered broadcast
+			 * SD queries. */
+			dev->sd_pending_bcast_queries = p2p->num_p2p_sd_queries;
+		}
+
+		if (p2p_start_sd(p2p, dev) == 0)
+			return;
+		else if (dev->req_config_methods &&
 			   !(dev->flags & P2P_DEV_PD_FOR_JOIN)) {
 			p2p_dbg(p2p, "Send pending Provision Discovery Request to "
 				MACSTR " (config methods 0x%x)",
@@ -2668,10 +2669,8 @@ static void p2p_sd_cb(struct p2p_data *p2p, int success)
 	p2p->pending_action_state = P2P_NO_PENDING_ACTION;

 	if (!success) {
-		if (p2p->sd_peer) {
-			p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
+		if (p2p->sd_peer)
 			p2p->sd_peer = NULL;
-		}
 		p2p_continue_find(p2p);
 		return;
 	}
@@ -3216,7 +3215,6 @@ static void p2p_timeout_sd_during_find(struct p2p_data *p2p)
 	p2p_dbg(p2p, "Service Discovery Query timeout");
 	if (p2p->sd_peer) {
 		p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
-		p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 		p2p->sd_peer = NULL;
 	}
 	p2p_continue_find(p2p);
@@ -3487,7 +3485,7 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  "country=%c%c\n"
 			  "oper_freq=%d\n"
 			  "req_config_methods=0x%x\n"
-			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
+			  "flags=%s%s%s%s%s%s%s%s%s%s%s%s%s\n"
 			  "status=%d\n"
 			  "wait_count=%u\n"
 			  "invitation_reqs=%u\n",
@@ -3510,9 +3508,6 @@ int p2p_get_peer_info_txt(const struct p2p_peer_info *info,
 			  dev->flags & P2P_DEV_REPORTED ? "[REPORTED]" : "",
 			  dev->flags & P2P_DEV_NOT_YET_READY ?
 			  "[NOT_YET_READY]" : "",
-			  dev->flags & P2P_DEV_SD_INFO ? "[SD_INFO]" : "",
-			  dev->flags & P2P_DEV_SD_SCHEDULE ? "[SD_SCHEDULE]" :
-			  "",
 			  dev->flags & P2P_DEV_PD_PEER_DISPLAY ?
 			  "[PD_PEER_DISPLAY]" : "",
 			  dev->flags & P2P_DEV_PD_PEER_KEYPAD ?
diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index f105083..6de3461 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -81,8 +81,6 @@ struct p2p_device {
 #define P2P_DEV_PROBE_REQ_ONLY BIT(0)
 #define P2P_DEV_REPORTED BIT(1)
 #define P2P_DEV_NOT_YET_READY BIT(2)
-#define P2P_DEV_SD_INFO BIT(3)
-#define P2P_DEV_SD_SCHEDULE BIT(4)
 #define P2P_DEV_PD_PEER_DISPLAY BIT(5)
 #define P2P_DEV_PD_PEER_KEYPAD BIT(6)
 #define P2P_DEV_USER_REJECTED BIT(7)
@@ -110,6 +108,7 @@ struct p2p_device {

 	u8 go_timeout;
 	u8 client_timeout;
+	int sd_pending_bcast_queries;
 };

 struct p2p_sd_query {
@@ -256,6 +255,12 @@ struct p2p_data {
 	 */
 	struct p2p_sd_query *sd_query;

+	/**
+	 * num_p2p_sd_queries - Total number of broadcast SD queries present in
+	 * the list
+	 */
+	int num_p2p_sd_queries;
+
 	/* GO Negotiation data */

 	/**
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 0e0c7f1..ab3b3eb 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -52,6 +52,7 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 {
 	struct p2p_sd_query *q;
 	int wsd = 0;
+	int count = 0;

 	if (!(dev->info.dev_capab & P2P_DEV_CAPAB_SERVICE_DISCOVERY))
 		return NULL; /* peer does not support SD */
@@ -64,8 +65,19 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 		/* Use WSD only if the peer indicates support or it */
 		if (q->wsd && !wsd)
 			continue;
-		if (q->for_all_peers && !(dev->flags & P2P_DEV_SD_INFO))
-			return q;
+		/* if the query is a broadcast query */
+		if (q->for_all_peers) {
+			/*
+			* check if there are any broadcast queries pending for
+			* this device
+			*/
+			if (dev->sd_pending_bcast_queries <= 0)
+				return NULL;
+			/* query number that needs to be send to the device */
+			if (count == dev->sd_pending_bcast_queries - 1)
+				return q;
+			count++;
+		}
 		if (!q->for_all_peers &&
 		    os_memcmp(q->peer, dev->info.p2p_device_addr, ETH_ALEN) ==
 		    0)
@@ -75,15 +87,35 @@ struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
 	return NULL;
 }

+static void p2p_decrease_sd_bc_queries(struct p2p_data *p2p, int query_number)
+{
+	struct p2p_device *dev;
+
+	p2p->num_p2p_sd_queries--;
+	dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
+		if (query_number <= dev->sd_pending_bcast_queries - 1) {
+			/*
+			* Query not yet sent to the device and it is to be
+			* removed, so update the pending count.
+			*/
+			dev->sd_pending_bcast_queries--;
+		}
+	}
+}

 static int p2p_unlink_sd_query(struct p2p_data *p2p,
 			       struct p2p_sd_query *query)
 {
 	struct p2p_sd_query *q, *prev;
+	int query_number = 0;
 	q = p2p->sd_queries;
 	prev = NULL;
 	while (q) {
 		if (q == query) {
+			/* If the query is a broadcast query, decrease one from
+			 * all the devices */
+			if (query->for_all_peers)
+				p2p_decrease_sd_bc_queries(p2p, query_number);
 			if (prev)
 				prev->next = q->next;
 			else
@@ -92,6 +124,8 @@ static int p2p_unlink_sd_query(struct p2p_data *p2p,
 				p2p->sd_query = NULL;
 			return 1;
 		}
+		if (q->for_all_peers)
+			query_number++;
 		prev = q;
 		q = q->next;
 	}
@@ -118,6 +152,7 @@ void p2p_free_sd_queries(struct p2p_data *p2p)
 		q = q->next;
 		p2p_free_sd_query(prev);
 	}
+	p2p->num_p2p_sd_queries = 0;
 }


@@ -262,6 +297,16 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
 		ret = -1;
 	}

+	/* Update the pending broadcast SD query count for this device */
+	dev->sd_pending_bcast_queries--;
+
+	/*
+	 * If there are no pending broadcast queries for this device, mark it as
+	 * done (-1).
+	 */
+	if (dev->sd_pending_bcast_queries == 0)
+		dev->sd_pending_bcast_queries = -1;
+
 	wpabuf_free(req);

 	return ret;
@@ -541,8 +586,6 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
 	p2p_dbg(p2p, "Service Update Indicator: %u", update_indic);
 	pos += 2;

-	p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
-	p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 	p2p->sd_peer = NULL;

 	if (p2p->sd_query) {
@@ -787,8 +830,6 @@ skip_nqp_header:
 		return;
 	}

-	p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
-	p2p->sd_peer->flags &= ~P2P_DEV_SD_SCHEDULE;
 	p2p->sd_peer = NULL;

 	if (p2p->sd_query) {
@@ -841,8 +882,15 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,

 	if (dst == NULL) {
 		struct p2p_device *dev;
-		dl_list_for_each(dev, &p2p->devices, struct p2p_device, list)
-			dev->flags &= ~P2P_DEV_SD_INFO;
+		p2p->num_p2p_sd_queries++;
+
+		/* Update all the devices for the newly added broadcast query */
+		dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
+			if (dev->sd_pending_bcast_queries <= 0)
+				dev->sd_pending_bcast_queries = 1;
+			else
+				dev->sd_pending_bcast_queries++;
+		}
 	}

 	return q;
--
1.7.9.5



From rahul.jain  Thu Feb 20 03:48:09 2014
From: rahul.jain (Rahul Jain)
Date: Thu, 20 Feb 2014 11:48:09 +0000 (GMT)
Subject: Reg Process for submiting changes for review
Message-ID: <CE.68.14383.97BE5035@epcpsbgx3.samsung.com>

An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140220/77c239fe/attachment.htm>


From arend  Thu Feb 20 03:55:08 2014
From: arend (Arend van Spriel)
Date: Thu, 20 Feb 2014 12:55:08 +0100
Subject: Reg Process for submiting changes for review
In-Reply-To: <CE.68.14383.97BE5035@epcpsbgx3.samsung.com>
References: <CE.68.14383.97BE5035@epcpsbgx3.samsung.com>
Message-ID: <5305ED1C.8040107@broadcom.com>

On 02/20/2014 12:48 PM, Rahul Jain wrote:
> hi,
> 
> I have cloned the wpa_supplicant code successfully (git clone 
> http://w1.fi/hostap.git).
> 
> I have committed my fixes into local master branch.
> 
> Please let me know what is the process of pushing fixes for review and 
> submitting into master branch?
> 
> It will be great if the complete process can be put on site 
> http://hostap.epitest.fi/wpa_supplicant/

Your cloned repo contains a CONTRIBUTIONS file, which describes minimum
req for the commit messages. Browsing the mailing list archives also
provides info how contributions are treated.

Basically, it means:
1. assure local commits are signed off.
2. create patch files (git format-patch).
3. send patch files to Jouni/mailing list (git send-email).
4. await comments.

Regards,
Arend

> Thanks
> 
> -Rahul Jain
> 
> Thanks
> 
> -Rahul Jain
> 
> 
> 
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
> 



From j  Thu Feb 20 05:04:59 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 15:04:59 +0200
Subject: Radius DAS won't work
In-Reply-To: <1022517895.1047717.1392889409050.JavaMail.zimbra@zimbra.xlab.si>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
	<52F3DAF7.5040508@deployingradius.com>
	<1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>
	<20140219115829.GG17962@w1.fi>
	<655613187.1038432.1392882233710.JavaMail.zimbra@zimbra.xlab.si>
	<1022517895.1047717.1392889409050.JavaMail.zimbra@zimbra.xlab.si>
Message-ID: <20140220130459.GA4316@w1.fi>

On Thu, Feb 20, 2014 at 10:43:29AM +0100, Robert Plestenjak wrote:
> PMKSA cache may not be acting properly. After it receives disconnect-message, connection is broken but then it accepts client by authenticating it with data from cache.

> Hostapd should probably ignore cached identity data in case of disconnect-message?

Agreed. PMKSA cache entry should have been removed when processing
Disconnect-Request. This is now implemented in the development tree. By
the way, there is also support for NAS identification attributes, so it
should be fine to include NAS-IP-Address as well.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 20 05:49:45 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 15:49:45 +0200
Subject: Can hwsim test router AP.
In-Reply-To: <1392829408.80884.YahooMailNeo@web122303.mail.ne1.yahoo.com>
References: <1392829408.80884.YahooMailNeo@web122303.mail.ne1.yahoo.com>
Message-ID: <20140220134945.GA14199@w1.fi>

On Wed, Feb 19, 2014 at 09:03:28AM -0800, Anand Moon wrote:
> Can hwsim be used to test route AP wireless features or is it meant only for mac80211_hwsim.

I'm not sure I understand what you are referring to with "hwsim" vs.
"mac80211_hwsim" -- they are the same thing for me and you can use
mac80211_hwsim to test router and AP wireless features..

If you are asking about whether the test scripts in tests/hwsim
directory can be used with other drivers than mac80211_hwsim, the answer
would be "in theory, with some changes". The main focus for this tests
is to validate hostapd/wpa_supplicant functionality and compatibility
with the kernel cfg80211/mac80211 implementation. However, there have
been some interest in being able to run a subset of the test cases with
separate devices using real Wi-Fi radios. It should be possible to do so
by extending the Hostapd and WpaSupplicant classes to communicate over
network connection to the hostapd/wpa_supplicant control interfaces.

Some of the test cases won't work as-is (e.g., hwsim_test connectivity
test cases would need to be implemented differently), but it should be
relatively straightforward to get large part of the tests working with
remote devices. This requires some effort, but hopefully not that large
step to get at least some of the tests working.

-- 
Jouni Malinen                                            PGP id EFC895FA


From robert.plestenjak  Thu Feb 20 06:13:26 2014
From: robert.plestenjak (Robert Plestenjak)
Date: Thu, 20 Feb 2014 15:13:26 +0100 (CET)
Subject: Radius DAS won't work
In-Reply-To: <20140220130459.GA4316@w1.fi>
References: <543930511.547164.1391696685174.JavaMail.zimbra@zimbra.xlab.si>
	<52F3DAF7.5040508@deployingradius.com>
	<1013436389.597181.1391773474356.JavaMail.zimbra@zimbra.xlab.si>
	<20140219115829.GG17962@w1.fi>
	<655613187.1038432.1392882233710.JavaMail.zimbra@zimbra.xlab.si>
	<1022517895.1047717.1392889409050.JavaMail.zimbra@zimbra.xlab.si>
	<20140220130459.GA4316@w1.fi>
Message-ID: <1309302765.1111542.1392905606284.JavaMail.zimbra@zimbra.xlab.si>

Great news, thanks!

- Robert

----- Original Message -----
From: "Jouni Malinen" <j at w1.fi>
To: hostap at lists.shmoo.com
Sent: Thursday, February 20, 2014 2:04:59 PM
Subject: Re: Radius DAS won't work

On Thu, Feb 20, 2014 at 10:43:29AM +0100, Robert Plestenjak wrote:
> PMKSA cache may not be acting properly. After it receives disconnect-message, connection is broken but then it accepts client by authenticating it with data from cache.

> Hostapd should probably ignore cached identity data in case of disconnect-message?

Agreed. PMKSA cache entry should have been removed when processing
Disconnect-Request. This is now implemented in the development tree. By
the way, there is also support for NAS identification attributes, so it
should be fine to include NAS-IP-Address as well.
 
-- 
Jouni Malinen                                            PGP id EFC895FA
_______________________________________________
HostAP mailing list
HostAP at lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap


From j  Thu Feb 20 06:28:28 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 16:28:28 +0200
Subject: [PATCH 2/2] Avoid undefined references with CONFIG_WPA_TRACE_BFD
	set
In-Reply-To: <1392839171-15481-2-git-send-email-roger.zanoni@openbossa.org>
References: <1392839171-15481-1-git-send-email-roger.zanoni@openbossa.org>
	<1392839171-15481-2-git-send-email-roger.zanoni@openbossa.org>
Message-ID: <20140220142828.GA20755@w1.fi>

On Wed, Feb 19, 2014 at 03:46:11PM -0400, Roger Zanoni wrote:
> libdl, libberty and libzlib are dependencies for libbfd.

Thanks, applied. Was there supposed to be a patch 1/2 as well?

> diff --git a/hostapd/Makefile b/hostapd/Makefile
> @@ -78,9 +78,9 @@ LDFLAGS += -rdynamic
>  override CFLAGS += -funwind-tables
>  ifdef CONFIG_WPA_TRACE_BFD
>  override CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
> -LIBS += -lbfd

These "override " parts for CFLAGS do not exist in hostap.git, so I'm
assuming something is missing before this patch. Anyway, I did apply
this as-is with those conflicts resolved manually.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 20 06:29:21 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 16:29:21 +0200
Subject: [PATCH] TLS: Add tls_disable_tlsv1_1 and tls_disable_tlsv1_2
	params
In-Reply-To: <20140219212304.AE9C713FFD8@ushik.mtv.corp.google.com>
References: <20140219212304.AE9C713FFD8@ushik.mtv.corp.google.com>
Message-ID: <20140220142921.GB20755@w1.fi>

On Wed, Feb 19, 2014 at 01:21:58PM -0800, Dmitry Shmidt wrote:
> diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
> @@ -3182,6 +3182,15 @@ int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
> +	if (params->flags & TLS_CONN_DISABLE_TLSv1_1)
> +		SSL_set_options(conn->ssl, SSL_OP_NO_TLSv1_1);
> +	else
> +		SSL_clear_options(conn->ssl, SSL_OP_NO_TLSv1_1);
> +	if (params->flags & TLS_CONN_DISABLE_TLSv1_2)
> +		SSL_set_options(conn->ssl, SSL_OP_NO_TLSv1_2);
> +	else
> +		SSL_clear_options(conn->ssl, SSL_OP_NO_TLSv1_2);

Thanks, applied with these protected using #ifdef to avoid breaking
build with older OpenSSL versions and with the new values documented in
wpa_supplicant.conf.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 20 06:30:29 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 16:30:29 +0200
Subject: [PATCH v3 1/1] P2P: Addressing few issues seen with P2P SD
In-Reply-To: <4d8fb2829c6d8678a7652dabc55f820cbb38e520.1392896340.git.jithu@broadcom.com>
References: <4d8fb2829c6d8678a7652dabc55f820cbb38e520.1392896340.git.jithu@broadcom.com>
Message-ID: <20140220143029.GC20755@w1.fi>

On Thu, Feb 20, 2014 at 05:13:25PM +0530, Jithu Jance wrote:
> I have fixed the P2P SD regression issues seen with the earlier
> version of this patch. Please see whether the patch is fine.

Thanks, applied with some cleanup and an update to README-P2P to remove
the obsoleted note about multiple wildcard SD queries. I added some more
hwsim test cases as well to cover the cases listed in the commit log.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Feb 20 06:34:25 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 16:34:25 +0200
Subject: [PATCH] wpa_debug: Remove 2048 byte message length limit
In-Reply-To: <alpine.DEB.2.02.1402190651020.43540@department-of-alchemy.MIT.EDU>
References: <alpine.DEB.2.02.1402151906000.43540@department-of-alchemy.MIT.EDU>
	<20140219114558.GE17962@w1.fi>
	<alpine.DEB.2.02.1402190651020.43540@department-of-alchemy.MIT.EDU>
Message-ID: <20140220143425.GD20755@w1.fi>

On Wed, Feb 19, 2014 at 07:09:48AM -0500, Anders Kaseorg wrote:
> On Wed, 19 Feb 2014, Jouni Malinen wrote:
> > How portable is this? SUSv2 seems to imply that n==0 would result in 
> > undefined behavior, so this may not work without being compliant with 
> > C99. There are some strange targets that wpa_supplicant is used on, so 
> > I'm not sure whether there would be enough justification for this change 
> > if there is risk of breaking debugging on such platforms.
> 
> This was corrected in SUSv3.  According to the Autoconf manual,

Fair enough, applied.

> Keep in mind that snprintf isn?t even part of C89 at all, so we have to 
> draw a line somewhere.

That's why there is a pointer to where to get an snprintf()
implementation from in src/utils/os.h.. I'm more worried about some
embedded platforms that are used with wpa_supplicant (some of which even
I'm not really aware of). Anyway, if these can fill in snprintf(), I'd
assume they can handle vsnprintf() extensions as well.

-- 
Jouni Malinen                                            PGP id EFC895FA


From roger.zanoni  Thu Feb 20 06:54:39 2014
From: roger.zanoni (Roger zanoni)
Date: Thu, 20 Feb 2014 10:54:39 -0400
Subject: [PATCH 2/2] Avoid undefined references with CONFIG_WPA_TRACE_BFD
	set
In-Reply-To: <20140220142828.GA20755@w1.fi>
References: <1392839171-15481-1-git-send-email-roger.zanoni@openbossa.org>
	<1392839171-15481-2-git-send-email-roger.zanoni@openbossa.org>
	<20140220142828.GA20755@w1.fi>
Message-ID: <CAHOmPStRFxnmFwDcixUqcAxq2AOXkqJGpGqTU_x=sSSHp+dj0Q@mail.gmail.com>

Yes, there's another patch, it got stuck because the message is too long:

Your mail to 'HostAP' with the subject

    [PATCH 1/2] Improve hostapd and wpa_supplicant CFLAGS handling

Is being held until the list moderator can review it for approval.

The reason it is being held:

    Message body is too big: 41323 bytes with a limit of 25 KB

I chaged all "CFLAGS +=..." to "override CFLAGS +=..." to allow passing a
CFLAGS variable through command line, without discarding assignments made
in makefile.
I don't knkow if this is the best approach, but I need something like this
to build hostapd and wpa_supplicant in my system (arch linux).

I can always edit the makefile and insert the search paths, but this patch
makes possible to inform them in the make command line.



2014-02-20 10:28 GMT-04:00 Jouni Malinen <j at w1.fi>:

> On Wed, Feb 19, 2014 at 03:46:11PM -0400, Roger Zanoni wrote:
> > libdl, libberty and libzlib are dependencies for libbfd.
>
> Thanks, applied. Was there supposed to be a patch 1/2 as well?
>
> > diff --git a/hostapd/Makefile b/hostapd/Makefile
> > @@ -78,9 +78,9 @@ LDFLAGS += -rdynamic
> >  override CFLAGS += -funwind-tables
> >  ifdef CONFIG_WPA_TRACE_BFD
> >  override CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
> > -LIBS += -lbfd
>
> These "override " parts for CFLAGS do not exist in hostap.git, so I'm
> assuming something is missing before this patch. Anyway, I did apply
> this as-is with those conflicts resolved manually.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140220/080339f5/attachment.htm>


From roger.zanoni  Thu Feb 20 13:08:45 2014
From: roger.zanoni (Roger Zanoni)
Date: Thu, 20 Feb 2014 17:08:45 -0400
Subject: [PATCH 1/1] Change the interpreter directive in test scrips
Message-ID: <1392930525-5804-1-git-send-email-roger.zanoni@openbossa.org>

This makes scripts check the environment for the current python
interpreter in use instead of assuming that the python executable points
to a python 2 interpreter.

Signed-off-by: Roger Zanoni <roger.zanoni at openbossa.org>
---
 tests/hwsim/hostapd.py                | 2 +-
 tests/hwsim/hwsim_utils.py            | 2 +-
 tests/hwsim/radius_das.py             | 2 +-
 tests/hwsim/run-tests.py              | 2 +-
 tests/hwsim/test_ap_acs.py            | 2 +-
 tests/hwsim/test_ap_ciphers.py        | 2 +-
 tests/hwsim/test_ap_dynamic.py        | 2 +-
 tests/hwsim/test_ap_eap.py            | 2 +-
 tests/hwsim/test_ap_ft.py             | 2 +-
 tests/hwsim/test_ap_hs20.py           | 2 +-
 tests/hwsim/test_ap_ht.py             | 2 +-
 tests/hwsim/test_ap_params.py         | 2 +-
 tests/hwsim/test_ap_pmf.py            | 2 +-
 tests/hwsim/test_ap_psk.py            | 2 +-
 tests/hwsim/test_ap_qosmap.py         | 2 +-
 tests/hwsim/test_ap_roam.py           | 2 +-
 tests/hwsim/test_ap_tdls.py           | 2 +-
 tests/hwsim/test_ap_wps.py            | 2 +-
 tests/hwsim/test_connect_cmd.py       | 2 +-
 tests/hwsim/test_dfs.py               | 2 +-
 tests/hwsim/test_ext_password.py      | 2 +-
 tests/hwsim/test_gas.py               | 2 +-
 tests/hwsim/test_ibss.py              | 2 +-
 tests/hwsim/test_ieee8021x.py         | 2 +-
 tests/hwsim/test_monitor_interface.py | 2 +-
 tests/hwsim/test_nfc_p2p.py           | 2 +-
 tests/hwsim/test_nfc_wps.py           | 2 +-
 tests/hwsim/test_p2p_autogo.py        | 2 +-
 tests/hwsim/test_p2p_concurrency.py   | 2 +-
 tests/hwsim/test_p2p_device.py        | 2 +-
 tests/hwsim/test_p2p_discovery.py     | 2 +-
 tests/hwsim/test_p2p_grpform.py       | 2 +-
 tests/hwsim/test_p2p_invitation.py    | 2 +-
 tests/hwsim/test_p2p_persistent.py    | 2 +-
 tests/hwsim/test_p2p_service.py       | 2 +-
 tests/hwsim/test_p2p_wifi_display.py  | 2 +-
 tests/hwsim/test_peerkey.py           | 2 +-
 tests/hwsim/test_pmksa_cache.py       | 2 +-
 tests/hwsim/test_radio_work.py        | 2 +-
 tests/hwsim/test_radius.py            | 2 +-
 tests/hwsim/test_sae.py               | 2 +-
 tests/hwsim/test_scan.py              | 2 +-
 tests/hwsim/test_ssid.py              | 2 +-
 tests/hwsim/test_sta_dynamic.py       | 2 +-
 tests/hwsim/test_wep.py               | 2 +-
 tests/hwsim/test_wext.py              | 2 +-
 tests/hwsim/test_wnm.py               | 2 +-
 tests/hwsim/test_wpas_ap.py           | 2 +-
 tests/hwsim/test_wpas_ctrl.py         | 2 +-
 tests/hwsim/utils.py                  | 2 +-
 tests/hwsim/wlantest.py               | 2 +-
 tests/hwsim/wpasupplicant.py          | 2 +-
 52 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 17d2d56..30a12d6 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Python class for controlling hostapd
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index 621143b..67e8976 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # hwsim testing utilities
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/radius_das.py b/tests/hwsim/radius_das.py
index 1dd0c5e..e820681 100644
--- a/tests/hwsim/radius_das.py
+++ b/tests/hwsim/radius_das.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # RADIUS DAS extensions to pyrad
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 4ae987f..14c5ee2 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # AP tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index cfa45ab..e4058b0 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Test cases for automatic channel selection with hostapd
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py
index dcabe31..f40bee4 100644
--- a/tests/hwsim/test_ap_ciphers.py
+++ b/tests/hwsim/test_ap_ciphers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Cipher suite tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index 3ee6c97..be500c8 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Test cases for dynamic BSS changes with hostapd
 # Copyright (c) 2013, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py
index 219a1dd..b7f0116 100644
--- a/tests/hwsim/test_ap_eap.py
+++ b/tests/hwsim/test_ap_eap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #
 # WPA2-Enterprise tests
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 63f97e9..ac6c9c3 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Fast BSS Transition tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py
index 3983030..c8950bc 100644
--- a/tests/hwsim/test_ap_hs20.py
+++ b/tests/hwsim/test_ap_hs20.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Hotspot 2.0 tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py
index 5071a98..f1e7b63 100644
--- a/tests/hwsim/test_ap_ht.py
+++ b/tests/hwsim/test_ap_ht.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Test cases for HT operations with hostapd
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py
index 2f77683..b3754c8 100644
--- a/tests/hwsim/test_ap_params.py
+++ b/tests/hwsim/test_ap_params.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Test various AP mode parameters
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py
index daf39e8..4d326e2 100644
--- a/tests/hwsim/test_ap_pmf.py
+++ b/tests/hwsim/test_ap_pmf.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Protected management frames tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index 26a3bb4..5b886a4 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # WPA2-Personal tests
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ap_qosmap.py b/tests/hwsim/test_ap_qosmap.py
index 8843b4e..91b5897 100644
--- a/tests/hwsim/test_ap_qosmap.py
+++ b/tests/hwsim/test_ap_qosmap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # QoS Mapping tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_roam.py b/tests/hwsim/test_ap_roam.py
index a9d671c..23ca22a 100644
--- a/tests/hwsim/test_ap_roam.py
+++ b/tests/hwsim/test_ap_roam.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Roaming tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 2163e02..1cfc6ae 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # TDLS tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py
index bc37398..1125962 100644
--- a/tests/hwsim/test_ap_wps.py
+++ b/tests/hwsim/test_ap_wps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # WPS tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_connect_cmd.py b/tests/hwsim/test_connect_cmd.py
index 75833a5..6a4cd71 100644
--- a/tests/hwsim/test_connect_cmd.py
+++ b/tests/hwsim/test_connect_cmd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # cfg80211 connect command (SME in the driver/firmware)
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py
index a92ab83..f8a2e43 100644
--- a/tests/hwsim/test_dfs.py
+++ b/tests/hwsim/test_dfs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Test cases for DFS
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ext_password.py b/tests/hwsim/test_ext_password.py
index 56481e1..f982e9c 100644
--- a/tests/hwsim/test_ext_password.py
+++ b/tests/hwsim/test_ext_password.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # External password storage
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_gas.py b/tests/hwsim/test_gas.py
index 5f901c3..f4efc32 100644
--- a/tests/hwsim/test_gas.py
+++ b/tests/hwsim/test_gas.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # GAS tests
 # Copyright (c) 2013, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ibss.py b/tests/hwsim/test_ibss.py
index 3a92a67..404bb5d 100644
--- a/tests/hwsim/test_ibss.py
+++ b/tests/hwsim/test_ibss.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # IBSS test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ieee8021x.py b/tests/hwsim/test_ieee8021x.py
index 6527f0c..0d1d2b9 100644
--- a/tests/hwsim/test_ieee8021x.py
+++ b/tests/hwsim/test_ieee8021x.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # IEEE 802.1X tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_monitor_interface.py b/tests/hwsim/test_monitor_interface.py
index 2fce1a1..b67935d 100644
--- a/tests/hwsim/test_monitor_interface.py
+++ b/tests/hwsim/test_monitor_interface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # AP mode using the older monitor interface design
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_nfc_p2p.py b/tests/hwsim/test_nfc_p2p.py
index 84418f9..f2511c1 100644
--- a/tests/hwsim/test_nfc_p2p.py
+++ b/tests/hwsim/test_nfc_p2p.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P+NFC tests
 # Copyright (c) 2013, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py
index dc2c848..b8d4248 100644
--- a/tests/hwsim/test_nfc_wps.py
+++ b/tests/hwsim/test_nfc_wps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # WPS+NFC tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py
index ad4a3d9..7c87053 100644
--- a/tests/hwsim/test_p2p_autogo.py
+++ b/tests/hwsim/test_p2p_autogo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P autonomous GO test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_concurrency.py b/tests/hwsim/test_p2p_concurrency.py
index 29aaa26..4f67596 100644
--- a/tests/hwsim/test_p2p_concurrency.py
+++ b/tests/hwsim/test_p2p_concurrency.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P concurrency test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_device.py b/tests/hwsim/test_p2p_device.py
index ce9d2c4..83eb20e 100644
--- a/tests/hwsim/test_p2p_device.py
+++ b/tests/hwsim/test_p2p_device.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # cfg80211 P2P Device
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 685a76c..621fbb1 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P device discovery test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py
index c91b64d..0724e68 100644
--- a/tests/hwsim/test_p2p_grpform.py
+++ b/tests/hwsim/test_p2p_grpform.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P group formation test cases
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_invitation.py b/tests/hwsim/test_p2p_invitation.py
index db8441e..1c08da1 100644
--- a/tests/hwsim/test_p2p_invitation.py
+++ b/tests/hwsim/test_p2p_invitation.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P invitation test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py
index 1f0ef1b..e85b670 100644
--- a/tests/hwsim/test_p2p_persistent.py
+++ b/tests/hwsim/test_p2p_persistent.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P persistent group test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_service.py b/tests/hwsim/test_p2p_service.py
index 43ed5b2..06f4817 100644
--- a/tests/hwsim/test_p2p_service.py
+++ b/tests/hwsim/test_p2p_service.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # P2P service discovery test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_wifi_display.py b/tests/hwsim/test_p2p_wifi_display.py
index a38e8aa..3df06bd 100644
--- a/tests/hwsim/test_p2p_wifi_display.py
+++ b/tests/hwsim/test_p2p_wifi_display.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Wi-Fi Display test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_peerkey.py b/tests/hwsim/test_peerkey.py
index f4da06a..5525af6 100644
--- a/tests/hwsim/test_peerkey.py
+++ b/tests/hwsim/test_peerkey.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # PeerKey tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_pmksa_cache.py b/tests/hwsim/test_pmksa_cache.py
index cbd8d8e..eb01dd3 100644
--- a/tests/hwsim/test_pmksa_cache.py
+++ b/tests/hwsim/test_pmksa_cache.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # WPA2-Enterprise PMKSA caching tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_radio_work.py b/tests/hwsim/test_radio_work.py
index 7f4f5c7..285b6cd 100644
--- a/tests/hwsim/test_radio_work.py
+++ b/tests/hwsim/test_radio_work.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Radio work tests
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_radius.py b/tests/hwsim/test_radius.py
index 5849986..2e4cfcd 100644
--- a/tests/hwsim/test_radius.py
+++ b/tests/hwsim/test_radius.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # RADIUS tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py
index 3461c54..1f91eef 100644
--- a/tests/hwsim/test_sae.py
+++ b/tests/hwsim/test_sae.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Test cases for SAE
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py
index 938abda..f35e9ca 100644
--- a/tests/hwsim/test_scan.py
+++ b/tests/hwsim/test_scan.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Scanning tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ssid.py b/tests/hwsim/test_ssid.py
index 6d1f72d..faf23c4 100644
--- a/tests/hwsim/test_ssid.py
+++ b/tests/hwsim/test_ssid.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #
 # SSID contents and encoding tests
diff --git a/tests/hwsim/test_sta_dynamic.py b/tests/hwsim/test_sta_dynamic.py
index ab9df44..6df0ebc 100644
--- a/tests/hwsim/test_sta_dynamic.py
+++ b/tests/hwsim/test_sta_dynamic.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Dynamic wpa_supplicant interface
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wep.py b/tests/hwsim/test_wep.py
index 7b70484..238507f 100644
--- a/tests/hwsim/test_wep.py
+++ b/tests/hwsim/test_wep.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # WEP tests
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wext.py b/tests/hwsim/test_wext.py
index e456b48..202d67d 100644
--- a/tests/hwsim/test_wext.py
+++ b/tests/hwsim/test_wext.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Deprecated WEXT driver interface in wpa_supplicant
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py
index af5cacb..d3f0cf4 100644
--- a/tests/hwsim/test_wnm.py
+++ b/tests/hwsim/test_wnm.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # WNM tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wpas_ap.py b/tests/hwsim/test_wpas_ap.py
index 4d78cb0..bfd803d 100644
--- a/tests/hwsim/test_wpas_ap.py
+++ b/tests/hwsim/test_wpas_ap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # wpa_supplicant AP mode tests
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py
index c328f73..05c2bb3 100644
--- a/tests/hwsim/test_wpas_ctrl.py
+++ b/tests/hwsim/test_wpas_ctrl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # wpa_supplicant control interface
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py
index 27cbc4e..ac203ab 100644
--- a/tests/hwsim/utils.py
+++ b/tests/hwsim/utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Testing utilities
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/wlantest.py b/tests/hwsim/wlantest.py
index 3056479..7c48de0 100644
--- a/tests/hwsim/wlantest.py
+++ b/tests/hwsim/wlantest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Python class for controlling wlantest
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 963b346..ddd8e06 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #
 # Python class for controlling wpa_supplicant
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
-- 
1.9.0



From s.L-H  Thu Feb 20 13:19:12 2014
From: s.L-H (Stefan Lippers-Hollmann)
Date: Thu, 20 Feb 2014 21:19:12 +0000
Subject: [PATCH] fix spelling s/algorith/algorithm/
Message-ID: <201402202119.15847.s.L-H@gmx.de>

Signed-off-by: Stefan Lippers-Hollmann <s.l-h at gmx.de>
---
 src/eap_peer/eap_aka.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/eap_peer/eap_aka.c b/src/eap_peer/eap_aka.c
index d3cbaca..fee1b7b 100644
--- a/src/eap_peer/eap_aka.c
+++ b/src/eap_peer/eap_aka.c
@@ -316,7 +316,7 @@ static int eap_aka_umts_auth(struct eap_sm *sm, struct eap_aka_data *data)
 
 #else /* CONFIG_USIM_HARDCODED */
 
-	wpa_printf(MSG_DEBUG, "EAP-AKA: No UMTS authentication algorith "
+	wpa_printf(MSG_DEBUG, "EAP-AKA: No UMTS authentication algorithm "
 		   "enabled");
 	return -1;
 
-- 
1.9.0



From j  Thu Feb 20 13:34:04 2014
From: j (Jouni Malinen)
Date: Thu, 20 Feb 2014 23:34:04 +0200
Subject: [PATCH 1/1] Change the interpreter directive in test scrips
In-Reply-To: <1392930525-5804-1-git-send-email-roger.zanoni@openbossa.org>
References: <1392930525-5804-1-git-send-email-roger.zanoni@openbossa.org>
Message-ID: <20140220213404.GA19379@w1.fi>

On Thu, Feb 20, 2014 at 05:08:45PM -0400, Roger Zanoni wrote:
> This makes scripts check the environment for the current python
> interpreter in use instead of assuming that the python executable points
> to a python 2 interpreter.

I could understand using env to find the python installation location,
but that commit message seems to imply that this would be for being able
to change python version.. Is that really the case and is so, have you
tested these with various versions? I've really only used Python 2.7 in
all testing so far..

-- 
Jouni Malinen                                            PGP id EFC895FA


From roger.zanoni  Thu Feb 20 13:53:14 2014
From: roger.zanoni (Roger zanoni)
Date: Thu, 20 Feb 2014 17:53:14 -0400
Subject: [PATCH 1/1] Change the interpreter directive in test scrips
In-Reply-To: <20140220213404.GA19379@w1.fi>
References: <1392930525-5804-1-git-send-email-roger.zanoni@openbossa.org>
	<20140220213404.GA19379@w1.fi>
Message-ID: <CAHOmPSv=ZgrfEeSgSj5izF4d4hAbZvCUQV=FQfZ387JQnegyQw@mail.gmail.com>

Yes, that's the case, but I did this to be able to change from python 3 (in
my distribution /usr/bin/python points to python 3) to python2 using
virtualenv. It won't change behavior, if you're already using python2. For
the distros where python 3 is the default, virtualenv(or other utility)
will set the proper python interpreter to use.


2014-02-20 17:34 GMT-04:00 Jouni Malinen <j at w1.fi>:

> On Thu, Feb 20, 2014 at 05:08:45PM -0400, Roger Zanoni wrote:
> > This makes scripts check the environment for the current python
> > interpreter in use instead of assuming that the python executable points
> > to a python 2 interpreter.
>
> I could understand using env to find the python installation location,
> but that commit message seems to imply that this would be for being able
> to change python version.. Is that really the case and is so, have you
> tested these with various versions? I've really only used Python 2.7 in
> all testing so far..
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140220/082e8c73/attachment-0001.htm>


From moon.linux  Thu Feb 20 19:29:14 2014
From: moon.linux (Anand Moon)
Date: Thu, 20 Feb 2014 19:29:14 -0800 (PST)
Subject: Can hwsim test router AP.
In-Reply-To: <20140220134945.GA14199@w1.fi>
References: <1392829408.80884.YahooMailNeo@web122303.mail.ne1.yahoo.com>
	<20140220134945.GA14199@w1.fi>
Message-ID: <1392953354.11738.YahooMailNeo@web122306.mail.ne1.yahoo.com>

Hi Jouni,

Thanks you very much. Thanks for the clarification.

-Anand Moon

On Thursday, February 20, 2014 7:20 PM, Jouni Malinen <j at w1.fi> wrote:

On Wed, Feb 19, 2014 at 09:03:28AM -0800, Anand Moon wrote:
> Can hwsim be used to test route AP wireless features or is it meant only for mac80211_hwsim.

I'm not sure I understand what you are referring to with "hwsim" vs.
"mac80211_hwsim" -- they are the same thing for me and you can use
mac80211_hwsim to test router and AP wireless features..

If you are asking about whether the test scripts in tests/hwsim
directory can be used with other drivers than mac80211_hwsim, the answer
would be "in theory, with some changes". The main focus for this tests
is to validate hostapd/wpa_supplicant functionality and compatibility
with the kernel cfg80211/mac80211 implementation. However, there have
been some interest in being able to run a subset of the test cases with
separate devices using real Wi-Fi radios. It should be possible to do so
by extending the Hostapd and WpaSupplicant classes to communicate over
network connection to the hostapd/wpa_supplicant control interfaces.

Some of the test cases won't work as-is (e.g., hwsim_test connectivity
test cases would need to be implemented differently), but it should be
relatively straightforward to get large part of the tests working with
remote devices. This requires some effort, but hopefully not that large
step to get at least some of the tests working.

-- 
Jouni Malinen? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? PGP id EFC895FA

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


From rahul.jain  Thu Feb 20 19:40:01 2014
From: rahul.jain (Rahul Jain)
Date: Fri, 21 Feb 2014 03:40:01 +0000 (GMT)
Subject: Patch for review
Message-ID: <46.62.09100.19AC6035@epcpsbgx2.samsung.com>

An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140221/e587ddfd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-for-missing-eloop_cancel_timeout-when-p2p-invita.patch
Type: application/octet-stream
Size: 808 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140221/e587ddfd/attachment.obj>


From johannes  Thu Feb 20 23:54:06 2014
From: johannes (Johannes Berg)
Date: Fri, 21 Feb 2014 08:54:06 +0100
Subject: [PATCH 1/1] Change the interpreter directive in test scrips
In-Reply-To: <1392930525-5804-1-git-send-email-roger.zanoni@openbossa.org>
References: <1392930525-5804-1-git-send-email-roger.zanoni@openbossa.org>
Message-ID: <1392969246.4346.0.camel@jlt4.sipsolutions.net>

On Thu, 2014-02-20 at 17:08 -0400, Roger Zanoni wrote:
> This makes scripts check the environment for the current python
> interpreter in use instead of assuming that the python executable points
> to a python 2 interpreter.

> -#!/usr/bin/python
> +#!/usr/bin/env python

If you're changing this, then IMHO you should change it to "/usr/bin/env
python2" to start with. Practically all systems will have that by now,
and I don't think the scripts work with python3.

johannes



From j  Fri Feb 21 00:42:42 2014
From: j (Jouni Malinen)
Date: Fri, 21 Feb 2014 10:42:42 +0200
Subject: Patch for review
In-Reply-To: <46.62.09100.19AC6035@epcpsbgx2.samsung.com>
References: <46.62.09100.19AC6035@epcpsbgx2.samsung.com>
Message-ID: <20140221084242.GA4307@w1.fi>

On Fri, Feb 21, 2014 at 03:40:01AM +0000, Rahul Jain wrote:
> [PATCH]&nbsp; Fix for missing eloop_cancel_timeout&nbsp; when p2p invitation<BR>&nbsp;is received

> <P>diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c<BR>index 2ecc547..1e9699e 100644<BR>--- a/src/p2p/p2p.c<BR>+++ b/src/p2p/p2p.c<BR>@@ -2145,6 +2145,7 @@ p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; == 0) {<BR>&nbsp;&nbsp;&nbsp;/* Received a Probe Request from Invite peer */<BR>&nbsp;&nbsp;&nbsp;p2p_dbg(p2p, "Found Invite peer - try to start Invite from timeout");<BR>+&nbsp;&nbsp;eloop_cancel_timeout(p2p_invite_start, p2p, NULL);<BR>&nbsp;&nbsp;&nbsp;eloop_register_timeout(0, 0, p2p_invite_start, p2p, NULL);<BR>&nbsp;&nbsp;&nbsp;return P2P_PREQ_PROCESSED;<BR>&nbsp;&nbsp;}


The actual change itself looks reasonable, but I would need to receive a
patch with Signed-off-by line in the commit message to be able to apply
this. Could you please read the CONTRIBUTIONS file(*) and re-send this
with the Signed-off-by added as described in that file?

Please also note that HTML-only email is discouraged on this mailing
list and it would be highly preferred to get a plaintext version. As you
can see from the quoted version of the change above, this didn't look
very clear in my email reader... :)


(*) http://w1.fi/cgit/hostap/tree/CONTRIBUTIONS

-- 
Jouni Malinen                                            PGP id EFC895FA


From rahul.jain  Fri Feb 21 00:58:04 2014
From: rahul.jain (Rahul Jain)
Date: Fri, 21 Feb 2014 08:58:04 +0000 (GMT)
Subject: Patch for review
Message-ID: <6D.8C.10103.C1517035@epcpsbgx1.samsung.com>

hello Jouni,

 As requested, I am attaching patch with signed off.
==
rom 2d330d4b823a8aee9a509af4ea9a696baa8fad57 Mon Sep 17 00:00:00 2001
From: Rahul Jain <rahul.jain at samsung.com>
Date: Thu, 20 Feb 2014 16:34:09 +0530
Subject: [PATCH]  Fix for missing eloop_cancel_timeout  when p2p invitation
 is received


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/p2p/p2p.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 2ecc547..1e9699e 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2145,6 +2145,7 @@ p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
      == 0) {
   /* Received a Probe Request from Invite peer */
   p2p_dbg(p2p, "Found Invite peer - try to start Invite from timeout");
+  eloop_cancel_timeout(p2p_invite_start, p2p, NULL);
   eloop_register_timeout(0, 0, p2p_invite_start, p2p, NULL);
   return P2P_PREQ_PROCESSED;
  }
-- 
1.7.9.5
==

Thanks
-Rahul



------- Original Message -------
Sender : Jouni Malinen<j at w1.fi>
Date : Feb 21, 2014 14:12 (GMT+05:30)
Title : Re: Patch for review

On Fri, Feb 21, 2014 at 03:40:01AM +0000, Rahul Jain wrote:
> [PATCH]  Fix for missing eloop_cancel_timeout  when p2p invitation
 is received

> 
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 2ecc547..1e9699e 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2145,6 +2145,7 @@ p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
      == 0) {
   /* Received a Probe Request from Invite peer */
   p2p_dbg(p2p, "Found Invite peer - try to start Invite from timeout");
+  eloop_cancel_timeout(p2p_invite_start, p2p, NULL);
   eloop_register_timeout(0, 0, p2p_invite_start, p2p, NULL);
   return P2P_PREQ_PROCESSED;
  }


The actual change itself looks reasonable, but I would need to receive a
patch with Signed-off-by line in the commit message to be able to apply
this. Could you please read the CONTRIBUTIONS file(*) and re-send this
with the Signed-off-by added as described in that file?

Please also note that HTML-only email is discouraged on this mailing
list and it would be highly preferred to get a plaintext version. As you
can see from the quoted version of the change above, this didn't look
very clear in my email reader... :)


(*) http://w1.fi/cgit/hostap/tree/CONTRIBUTIONS

-- 
Jouni Malinen                                            PGP id EFC895FA



Thanks
-Rahul Jain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-for-missing-eloop_cancel_timeout-when-p2p-invita.patch
Type: application/octet-stream
Size: 860 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140221/9eeb2566/attachment-0001.obj>


From rahul.jain  Fri Feb 21 03:36:09 2014
From: rahul.jain (Rahul Jain)
Date: Fri, 21 Feb 2014 11:36:09 +0000 (GMT)
Subject: Patch for review
Message-ID: <01.3C.09100.92A37035@epcpsbgx2.samsung.com>

hi,

Please review the attached patch.



From rahul.jainatsamsung.com  Fri Feb 21 03:33:18 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Fri, 21 Feb 2014 17:03:18 +0530
Subject: [PATCH] Fix for checking go intent value before going ahead for
 processing of Go Neg Request Frame
Message-ID: <mailman.0.1445595433.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/p2p/p2p_go_neg.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 2e40db1..c6b47be 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -545,8 +545,14 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
 #endif /* CONFIG_P2P_STRICT */
 	}
 
-	if (msg.go_intent)
+	if (msg.go_intent) {
 		tie_breaker = *msg.go_intent & 0x01;
+		if ((*msg.go_intent >> 1) > P2P_MAX_GO_INTENT) {
+			p2p_dbg(p2p, "Invalid GO Intent value (%u) received",
+				*msg.go_intent >> 1);
+			goto fail;
+		}
+	}
 	else {
 		p2p_dbg(p2p, "Mandatory GO Intent attribute missing from GO Negotiation Request");
 #ifdef CONFIG_P2P_STRICT
-- 
1.7.9.5

Thanks
-Rahul Jain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-for-checking-go-intent-value-before-going-ahead-.patch
Type: application/octet-stream
Size: 1047 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140221/ee2d8e89/attachment.obj>


From samiran.linux  Fri Feb 21 04:24:30 2014
From: samiran.linux (samiran saha)
Date: Fri, 21 Feb 2014 17:54:30 +0530
Subject: suitable EAP-AKA, EAP_SIM client
Message-ID: <CAOdN5SCcSBBHZQFPZ8i2+aZrYwJE2se77G1DVT7pCV_FQ1raRg@mail.gmail.com>

Hello,
        I have implemented the EAP-AKA and EAP-SIM server program that
generates  the EAP message contents using hostapd as library. Now I want to
test this server. Is there any kind of suitable client available for
EAP-SIM and EAP-AKA so that I test my implementation?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140221/3cd7922b/attachment.htm>


From j  Fri Feb 21 05:08:09 2014
From: j (Jouni Malinen)
Date: Fri, 21 Feb 2014 15:08:09 +0200
Subject: Patch for review
In-Reply-To: <6D.8C.10103.C1517035@epcpsbgx1.samsung.com>
References: <6D.8C.10103.C1517035@epcpsbgx1.samsung.com>
Message-ID: <20140221130809.GA5106@w1.fi>

On Fri, Feb 21, 2014 at 08:58:04AM +0000, Rahul Jain wrote:
>  As requested, I am attaching patch with signed off.
> Subject: [PATCH]  Fix for missing eloop_cancel_timeout  when p2p invitation
>  is received

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 21 05:17:35 2014
From: j (Jouni Malinen)
Date: Fri, 21 Feb 2014 15:17:35 +0200
Subject: [PATCH] Fix for checking go intent value before going ahead for
	processing of Go Neg Request Frame
In-Reply-To: <01.3C.09100.92A37035@epcpsbgx2.samsung.com>
References: <01.3C.09100.92A37035@epcpsbgx2.samsung.com>
Message-ID: <20140221131735.GB5106@w1.fi>

On Fri, Feb 21, 2014 at 11:36:09AM +0000, Rahul Jain wrote:
> Please review the attached patch.

> Subject: [PATCH] Fix for checking go intent value before going ahead for
>  processing of Go Neg Request Frame

Please note that it would be useful to use this subject line from the
commit as the subject of the message as well.

> diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
> @@ -545,8 +545,14 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
>  #endif /* CONFIG_P2P_STRICT */
>  	}
>  
> -	if (msg.go_intent)
> +	if (msg.go_intent) {
>  		tie_breaker = *msg.go_intent & 0x01;
> +		if ((*msg.go_intent >> 1) > P2P_MAX_GO_INTENT) {
> +			p2p_dbg(p2p, "Invalid GO Intent value (%u) received",
> +				*msg.go_intent >> 1);
> +			goto fail;
> +		}

While the change itself would be a correct validation step, isn't this
already done in the function when GO Negotiation would be allowed to
start? As such, this addition here would have very little change in the
behavior (status code would change for couple of error paths). Is there
a specific case where this is needed? If so, I think I would be fine
with the change, but I would combine it with removing the other check
that would become practically dead code if this is added into the
beginning of the function.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Feb 21 05:18:44 2014
From: j (Jouni Malinen)
Date: Fri, 21 Feb 2014 15:18:44 +0200
Subject: suitable EAP-AKA, EAP_SIM client
In-Reply-To: <CAOdN5SCcSBBHZQFPZ8i2+aZrYwJE2se77G1DVT7pCV_FQ1raRg@mail.gmail.com>
References: <CAOdN5SCcSBBHZQFPZ8i2+aZrYwJE2se77G1DVT7pCV_FQ1raRg@mail.gmail.com>
Message-ID: <20140221131844.GC5106@w1.fi>

On Fri, Feb 21, 2014 at 05:54:30PM +0530, samiran saha wrote:
>         I have implemented the EAP-AKA and EAP-SIM server program that
> generates  the EAP message contents using hostapd as library. Now I want to
> test this server. Is there any kind of suitable client available for
> EAP-SIM and EAP-AKA so that I test my implementation?

wpa_supplicant include EAP peer implementation for these and you can
either use it or the related eapol_test test program (which includes an
integrated RADIUS client in addition to the EAP peer) for this.

-- 
Jouni Malinen                                            PGP id EFC895FA


From marek.puzyniak  Fri Feb 21 05:38:09 2014
From: marek.puzyniak (Marek Puzyniak)
Date: Fri, 21 Feb 2014 14:38:09 +0100
Subject: [PATCH 1/2] hostapd: Add Power Constraint element
In-Reply-To: <20140214172509.GC15831@w1.fi>
References: <1391807954-4016-1-git-send-email-marek.puzyniak@tieto.com>
	<20140214172509.GC15831@w1.fi>
Message-ID: <CADnKcVjZAGtK4UXmkrfydrSJQ5T+jWcTSmTZuh3RpuwSKK0R=g@mail.gmail.com>

On 14 February 2014 18:25, Jouni Malinen <j at w1.fi> wrote:
> On Fri, Feb 07, 2014 at 10:19:13PM +0100, Marek Puzyniak wrote:
>> From: Srinivasan B <srinivasanb at posedge.com>
>>
>> Add Power Constraint information element to Beacon and Probe Response
>> frames when hostapd is configured on 5 GHz band and Country information
>> element is also added. According to spec IEEE802.11-2012 a STA shall
>> determine a local maximum transmit power for the current channel based
>> on information derived from Country and Power Constraint elements.
>
> How was this tested?

I set local_power_constraint option to 3 in hostapd.conf then started
AP and observed air logs. In beacons and probe responses I can see
Power Constraint element with Local Power Constraint set to 3.

>
>> +             } else if (os_strcmp(buf, "local_pwr_contraint") == 0) {
>> +                             conf->local_pwr_constraint = val;
>
>> diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
>> +#local_pwr_constraint=3
>
> Note any difference in the spelling?

Yes, I see it. Unfortunately I had the same mistake in my hostapd.conf
that's why I haven't noticed that.

>
>> +     /*
>> +      * CRDA provides reduced TX power than actual regulatory max TX power.
>> +      * Value of 0 to the local power constraint provides an opportunity
>> +      * for the client devices to operate at the power limit provided by CRDA
>> +      * (for client devices
>> +      * "Local max TX pwr" = regulatory max TX pwr - Local pwr constraint)
>> +      */
>
> This is somewhat confusing statement in the core hostapd code which can
> be used with multiple drivers, many of which are not even on Linux,
> never mind use CRDA.. Why does this speak about CRDA and is this to be
> understood as the functionality not working unless CRDA is used?

I changed this comment to something like that:
        /*
         * A STA that is not an AP shall use a transmit power less than or
         * equal to the local maximum transmit power level for the channel.
         * The local maximum transmit power can be calculated from the formula:
         * local max TX pwr = max TX pwr - local pwr constraint
         * Where max TX pwr is maximum transmit power level specified for
         * channel in Country element and local pwr contraint is specified
         * for channel in this Power Constraint element.
         */

I will send version 2 of this patch.


Marek


From marek.puzyniak  Fri Feb 21 05:42:17 2014
From: marek.puzyniak (Marek Puzyniak)
Date: Fri, 21 Feb 2014 14:42:17 +0100
Subject: [PATCH 1/2 v2] hostapd: Add Power Constraint element
Message-ID: <1392990138-26878-1-git-send-email-marek.puzyniak@tieto.com>

From: Srinivasan B <srinivasanb at posedge.com>

Add Power Constraint information element to Beacon and Probe Response
frames when hostapd is configured on 5 GHz band and Country information
element is also added. According to spec IEEE802.11-2012 a STA shall
determine a local maximum transmit power for the current channel based
on information derived from Country and Power Constraint elements.

In order to add Power Constraint element ieee80211d option need to be
enabled and new local_pwr_constraint config option need to be set to
unsigned value in units of decibels. For now this value is statically
configured but the future goal is to implement dynamic TPC algorithm
to control local power constraint.

Signed-hostap: Srinivasan <srinivasanb at posedge.com>
Signed-hostap: Chaitanya T K <chaitanyatk at posedge.com>
Signed-hostap: Marek Puzyniak <marek.puzyniak at tieto.com>
---

v2:
-fix typo "contraint" -> "constaint"
-change description to more general

 hostapd/config_file.c |  9 +++++++++
 hostapd/hostapd.conf  |  8 ++++++++
 src/ap/ap_config.c    |  9 +++++++++
 src/ap/ap_config.h    |  7 +++++++
 src/ap/beacon.c       | 36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 69 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 19d6ad3..ef4958a 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2907,6 +2907,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 					   "sae_groups value '%s'", line, pos);
 				return 1;
 			}
+		} else if (os_strcmp(buf, "local_pwr_constraint") == 0) {
+			int val = atoi(pos);
+			if (val < 0 || val > 255) {
+				wpa_printf(MSG_ERROR, "Line %d: invalid "
+					   "local_pwr_constraint %d (expected "
+					   "0..255)", line, val);
+				errors++;
+			} else
+				conf->local_pwr_constraint = val;
 		} else {
 			wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
 				   "item '%s'", line, buf);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index c503ce2..15cd364 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -108,6 +108,14 @@ ssid=test
 # (default: 0 = disabled)
 #ieee80211h=1
 
+# Add Power Constraint element for Beacon and Probe Response frames.
+# This config option adds power constraint information element when available
+# and set to corect value and country information element is added.
+# Power Constraint element is required by Transmit Power Control. This can be
+# used only with ieee80211d=1.
+# Valid values are 0..255.
+#local_pwr_constraint=3
+
 # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
 # ad = IEEE 802.11ad (60 GHz); a/g options are used with IEEE 802.11n, too, to
 # specify band)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 368b202..6c80e48 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -154,6 +154,8 @@ struct hostapd_config * hostapd_config_defaults(void)
 	conf->rts_threshold = -1; /* use driver default: 2347 */
 	conf->fragm_threshold = -1; /* user driver default: 2346 */
 	conf->send_probe_response = 1;
+	/* Set to invalid value means do not add Power Constraint IE */
+	conf->local_pwr_constraint = -1;
 
 	conf->wmm_ac_params[0] = ac_be;
 	conf->wmm_ac_params[1] = ac_bk;
@@ -829,6 +831,13 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
 		return -1;
 	}
 
+	if (full_config && conf->local_pwr_constraint != -1 &&
+	    !conf->ieee80211d) {
+		wpa_printf(MSG_ERROR, "Cannot add Power Constraint element "
+			   "without Country element");
+		return -1;
+	}
+
 	for (i = 0; i < conf->num_bss; i++) {
 		if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
 			return -1;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 4631ca9..c641a83 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -519,6 +519,13 @@ struct hostapd_config {
 
 	int ieee80211h; /* DFS */
 
+	/*
+	 * Local power constraint is octed coded as an unsigned
+	 * integer in units of decibels. Invalid value -1 indicates
+	 * that Power Constraint element should not be added.
+	 */
+	int local_pwr_constraint;
+
 	struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
 
 	/*
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index b1ebf6e..36b0074 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -102,6 +102,36 @@ static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid)
 }
 
 
+static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
+{
+	u8 *pos = eid;
+
+	if (hapd->iconf->local_pwr_constraint == -1 ||
+	    hapd->iface->current_mode == NULL ||
+	    hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
+		return eid;
+
+	/*
+	 * A STA that is not an AP shall use a transmit power less than or
+	 * equal to the local maximum transmit power level for the channel.
+	 * The local maximum transmit power can be calculated from the formula:
+	 * local max TX pwr = max TX pwr - local pwr constraint
+	 * Where max TX pwr is maximum transmit power level specified for
+	 * channel in Country element and local pwr contraint is specified
+	 * for channel in this Power Constraint element.
+	 */
+
+	/* Element ID */
+	*pos++ = WLAN_EID_PWR_CONSTRAINT;
+	/* Length */
+	*pos++ = 1;
+	/* Local Power Constraint */
+	*pos++ = hapd->iconf->local_pwr_constraint;
+
+	return pos;
+}
+
+
 static u8 * hostapd_eid_country_add(u8 *pos, u8 *end, int chan_spacing,
 				    struct hostapd_channel_data *start,
 				    struct hostapd_channel_data *prev)
@@ -315,6 +345,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
 	pos = hostapd_eid_country(hapd, pos, epos - pos);
 
+	/* Power Constraint element */
+	pos = hostapd_eid_pwr_constraint(hapd, pos);
+
 	/* ERP Information element */
 	pos = hostapd_eid_erp_info(hapd, pos);
 
@@ -721,6 +754,9 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_eid_country(hapd, tailpos,
 				      tail + BEACON_TAIL_BUF_SIZE - tailpos);
 
+	/* Power Constraint element */
+	tailpos = hostapd_eid_pwr_constraint(hapd, tailpos);
+
 	/* ERP Information element */
 	tailpos = hostapd_eid_erp_info(hapd, tailpos);
 
-- 
1.8.1.2



From marek.puzyniak  Fri Feb 21 05:42:18 2014
From: marek.puzyniak (Marek Puzyniak)
Date: Fri, 21 Feb 2014 14:42:18 +0100
Subject: [PATCH 2/2] hostapd: Configure spectrum management capability
In-Reply-To: <1392990138-26878-1-git-send-email-marek.puzyniak@tieto.com>
References: <1392990138-26878-1-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <1392990138-26878-2-git-send-email-marek.puzyniak@tieto.com>

From: Chaitanya T K <chaitanyatk at posedge.com>

Add configuration of Spectrum Managment subfield in
the Capability Information of Beacon, Probe Response and
Association Response. Spectrum Management bit is set when directly
requested by new configuration option spectrum_mgmt_required=1
or when AP is running on DFS channels. In future also TPC
shall require this bit to be set.

Signed-hostap: Srinivasan <srinivasanb at posedge.com>
Signed-hostap: Chaitanya T K <chaitanyatk at posedge.com>
Signed-hostap: Marek Puzyniak <marek.puzyniak at tieto.com>
---
 hostapd/config_file.c |  2 ++
 hostapd/hostapd.conf  |  7 +++++++
 src/ap/ap_config.c    |  6 ++++++
 src/ap/ap_config.h    |  3 +++
 src/ap/beacon.c       | 43 +++++++++++++++++++++++++++++++++++++++----
 src/ap/dfs.c          | 19 +++++++++++++++++++
 src/ap/dfs.h          |  2 ++
 src/ap/ieee802_11.c   | 21 +++++++++++++++++++++
 8 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index ef4958a..cde78f1 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2916,6 +2916,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 				errors++;
 			} else
 				conf->local_pwr_constraint = val;
+		} else if (os_strcmp(buf, "spectrum_mgmt_required") == 0) {
+			conf->spectrum_mgmt_required = atoi(pos);
 		} else {
 			wpa_printf(MSG_ERROR, "Line %d: unknown configuration "
 				   "item '%s'", line, buf);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 15cd364..5ae1ab9 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -116,6 +116,13 @@ ssid=test
 # Valid values are 0..255.
 #local_pwr_constraint=3
 
+# Set Spectrum Managment subfield in the Capability Information field.
+# This config option forces Spectrum Management bit to be set. When this
+# option is not set then value of Spectrum Management bit depends on whether
+# DFS or TPC is reuired by regulatory authorities.This can be used only with
+# ieee80211d=1 and local_pwr_constraint configured.
+#spectrum_mgmt_required=1
+
 # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
 # ad = IEEE 802.11ad (60 GHz); a/g options are used with IEEE 802.11n, too, to
 # specify band)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 6c80e48..cc64f92 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -838,6 +838,12 @@ int hostapd_config_check(struct hostapd_config *conf, int full_config)
 		return -1;
 	}
 
+	if (full_config && conf->spectrum_mgmt_required &&
+	    conf->local_pwr_constraint == -1) {
+		wpa_printf(MSG_ERROR, "Cannot set Spectrum Management bit "
+			   "without Country and Power Constraint elements");
+		return -1;
+	}
 	for (i = 0; i < conf->num_bss; i++) {
 		if (hostapd_config_check_bss(conf->bss[i], conf, full_config))
 			return -1;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index c641a83..c8ba441 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -526,6 +526,9 @@ struct hostapd_config {
 	 */
 	int local_pwr_constraint;
 
+	/* Control Spectrum Management bit */
+	int spectrum_mgmt_required;
+
 	struct hostapd_tx_queue_params tx_queue[NUM_TX_QUEUES];
 
 	/*
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 36b0074..5da68f1 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -27,6 +27,7 @@
 #include "ap_drv_ops.h"
 #include "beacon.h"
 #include "hs20.h"
+#include "dfs.h"
 
 
 #ifdef NEED_AP_MLME
@@ -105,13 +106,44 @@ static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid)
 static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
 {
 	u8 *pos = eid;
+	int local_pwr_constraint = 0;
+	int dfs;
 
-	if (hapd->iconf->local_pwr_constraint == -1 ||
-	    hapd->iface->current_mode == NULL ||
-	    hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
+	if (hapd->iface->current_mode == NULL ||
+            hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A)
+                return eid;
+
+	/*
+	 * There is no DFS support and power constraint was not direcly
+	 * requested by config option.
+	 */
+	if (!hapd->iconf->ieee80211h &&
+	    hapd->iconf->local_pwr_constraint == -1)
+		return eid;
+
+	/* Check if DFS is required by regulatory. */
+	dfs = hostapd_is_dfs_required(hapd->iface);
+	if (dfs < 0 ) {
+		wpa_printf(MSG_WARNING, "Failed to check if dfs "
+			   "is required ret=%d", dfs);
+		dfs = 0;
+	}
+
+	if (dfs == 0 && hapd->iconf->local_pwr_constraint == -1)
 		return eid;
 
 	/*
+	 * ieee80211h (DFS) is enabled so Power Constraint element shall
+	 * be added when running on DFS channel whenever local_pwr_constraint
+	 * is configured or not. In order to meet regulations when TPC is not
+	 * implemented using a transmit power that is below the legal maximum
+	 * (including any mitigation factor) should help. In this case 3dB below
+	 * maximum allowed transmit power.
+	 */
+	if (hapd->iconf->local_pwr_constraint == -1)
+		local_pwr_constraint = 3;
+
+	/*
 	 * A STA that is not an AP shall use a transmit power less than or
 	 * equal to the local maximum transmit power level for the channel.
 	 * The local maximum transmit power can be calculated from the formula:
@@ -126,7 +158,10 @@ static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid)
 	/* Length */
 	*pos++ = 1;
 	/* Local Power Constraint */
-	*pos++ = hapd->iconf->local_pwr_constraint;
+	if (local_pwr_constraint)
+		*pos++ = local_pwr_constraint;
+	else
+		*pos++ = hapd->iconf->local_pwr_constraint;
 
 	return pos;
 }
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index ec691db..cd8742e 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -801,3 +801,22 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
 		      cf1, cf2, HOSTAPD_CHAN_DFS_USABLE);
 	return 0;
 }
+
+int hostapd_is_dfs_required(struct hostapd_iface *iface)
+{
+	int n_chans, start_chan_idx;
+	int res = 0;
+
+	/* Get start (first) channel for current configuration */
+	start_chan_idx = dfs_get_start_chan_idx(iface);
+	if (start_chan_idx == -1)
+		return -1;
+
+	/* Get number of used channels, depend on width */
+	n_chans = dfs_get_used_n_chans(iface);
+
+	/* Check if any of configured channels require DFS */
+	res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
+
+	return res;
+}
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
index 859ff79..2710021 100644
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -21,5 +21,7 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
 int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
 			     int ht_enabled,
 			     int chan_offset, int chan_width, int cf1, int cf2);
+int hostapd_is_dfs_required(struct hostapd_iface *iface);
+
 
 #endif /* DFS_H */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 9251ac3..342ef8d 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -38,6 +38,7 @@
 #include "ap_drv_ops.h"
 #include "wnm_ap.h"
 #include "ieee802_11.h"
+#include "dfs.h"
 
 
 u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
@@ -137,6 +138,15 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
 {
 	int capab = WLAN_CAPABILITY_ESS;
 	int privacy;
+	int dfs;
+
+	/* Check if any of configured channels require DFS */
+	dfs = hostapd_is_dfs_required(hapd->iface);
+	if (dfs < 0 ) {
+		wpa_printf(MSG_WARNING, "Failed to check if dfs "
+			   "is required ret=%d", dfs);
+		dfs = 0;
+	}
 
 	if (hapd->iface->num_sta_no_short_preamble == 0 &&
 	    hapd->iconf->preamble == SHORT_PREAMBLE)
@@ -174,6 +184,17 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
 	    hapd->iface->num_sta_no_short_slot_time == 0)
 		capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME;
 
+	/*
+	 * Currently Spectrum Management capability bit is set when directly
+	 * requested in configuration by spectrum_mgmt_required or when AP is
+	 * running on DFS channel.
+	 * TODO: Also consider driver support for TPC to set Spectrum Mgmt bit
+	 */
+	if (hapd->iface->current_mode &&
+	    hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A &&
+	    (hapd->iconf->spectrum_mgmt_required || dfs))
+		capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
+
 	return capab;
 }
 
-- 
1.8.1.2



From roger.zanoni  Fri Feb 21 05:48:40 2014
From: roger.zanoni (Roger Zanoni)
Date: Fri, 21 Feb 2014 09:48:40 -0400
Subject: [PATCH 1/1] Change the interpreter directive in test scrips
Message-ID: <1392990520-23241-1-git-send-email-roger.zanoni@openbossa.org>

This makes scripts check the environment for the current python
interpreter in use instead of assuming that the python executable points
to a python 2 interpreter.

Signed-off-by: Roger Zanoni <roger.zanoni at openbossa.org>
---
 tests/hwsim/hostapd.py                | 2 +-
 tests/hwsim/hwsim_utils.py            | 2 +-
 tests/hwsim/radius_das.py             | 2 +-
 tests/hwsim/run-tests.py              | 2 +-
 tests/hwsim/test_ap_acs.py            | 2 +-
 tests/hwsim/test_ap_ciphers.py        | 2 +-
 tests/hwsim/test_ap_dynamic.py        | 2 +-
 tests/hwsim/test_ap_eap.py            | 2 +-
 tests/hwsim/test_ap_ft.py             | 2 +-
 tests/hwsim/test_ap_hs20.py           | 2 +-
 tests/hwsim/test_ap_ht.py             | 2 +-
 tests/hwsim/test_ap_params.py         | 2 +-
 tests/hwsim/test_ap_pmf.py            | 2 +-
 tests/hwsim/test_ap_psk.py            | 2 +-
 tests/hwsim/test_ap_qosmap.py         | 2 +-
 tests/hwsim/test_ap_roam.py           | 2 +-
 tests/hwsim/test_ap_tdls.py           | 2 +-
 tests/hwsim/test_ap_wps.py            | 2 +-
 tests/hwsim/test_connect_cmd.py       | 2 +-
 tests/hwsim/test_dfs.py               | 2 +-
 tests/hwsim/test_ext_password.py      | 2 +-
 tests/hwsim/test_gas.py               | 2 +-
 tests/hwsim/test_ibss.py              | 2 +-
 tests/hwsim/test_ieee8021x.py         | 2 +-
 tests/hwsim/test_monitor_interface.py | 2 +-
 tests/hwsim/test_nfc_p2p.py           | 2 +-
 tests/hwsim/test_nfc_wps.py           | 2 +-
 tests/hwsim/test_p2p_autogo.py        | 2 +-
 tests/hwsim/test_p2p_concurrency.py   | 2 +-
 tests/hwsim/test_p2p_device.py        | 2 +-
 tests/hwsim/test_p2p_discovery.py     | 2 +-
 tests/hwsim/test_p2p_grpform.py       | 2 +-
 tests/hwsim/test_p2p_invitation.py    | 2 +-
 tests/hwsim/test_p2p_persistent.py    | 2 +-
 tests/hwsim/test_p2p_service.py       | 2 +-
 tests/hwsim/test_p2p_wifi_display.py  | 2 +-
 tests/hwsim/test_peerkey.py           | 2 +-
 tests/hwsim/test_pmksa_cache.py       | 2 +-
 tests/hwsim/test_radio_work.py        | 2 +-
 tests/hwsim/test_radius.py            | 2 +-
 tests/hwsim/test_sae.py               | 2 +-
 tests/hwsim/test_scan.py              | 2 +-
 tests/hwsim/test_ssid.py              | 2 +-
 tests/hwsim/test_sta_dynamic.py       | 2 +-
 tests/hwsim/test_wep.py               | 2 +-
 tests/hwsim/test_wext.py              | 2 +-
 tests/hwsim/test_wnm.py               | 2 +-
 tests/hwsim/test_wpas_ap.py           | 2 +-
 tests/hwsim/test_wpas_ctrl.py         | 2 +-
 tests/hwsim/utils.py                  | 2 +-
 tests/hwsim/wlantest.py               | 2 +-
 tests/hwsim/wpasupplicant.py          | 2 +-
 52 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index 17d2d56..7f7be93 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Python class for controlling hostapd
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index 621143b..89d2c1d 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # hwsim testing utilities
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/radius_das.py b/tests/hwsim/radius_das.py
index 1dd0c5e..5f44ea6 100644
--- a/tests/hwsim/radius_das.py
+++ b/tests/hwsim/radius_das.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # RADIUS DAS extensions to pyrad
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 4ae987f..abaddcd 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # AP tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index cfa45ab..58bcc7d 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Test cases for automatic channel selection with hostapd
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_ciphers.py b/tests/hwsim/test_ap_ciphers.py
index dcabe31..fedeb77 100644
--- a/tests/hwsim/test_ap_ciphers.py
+++ b/tests/hwsim/test_ap_ciphers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Cipher suite tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index 3ee6c97..c1b82ae 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Test cases for dynamic BSS changes with hostapd
 # Copyright (c) 2013, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py
index 219a1dd..870f772 100644
--- a/tests/hwsim/test_ap_eap.py
+++ b/tests/hwsim/test_ap_eap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 # -*- coding: utf-8 -*-
 #
 # WPA2-Enterprise tests
diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 63f97e9..44f73fb 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Fast BSS Transition tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py
index 3983030..de50a8b 100644
--- a/tests/hwsim/test_ap_hs20.py
+++ b/tests/hwsim/test_ap_hs20.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Hotspot 2.0 tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py
index 5071a98..bd974d6 100644
--- a/tests/hwsim/test_ap_ht.py
+++ b/tests/hwsim/test_ap_ht.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Test cases for HT operations with hostapd
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_params.py b/tests/hwsim/test_ap_params.py
index 2f77683..7846825 100644
--- a/tests/hwsim/test_ap_params.py
+++ b/tests/hwsim/test_ap_params.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Test various AP mode parameters
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py
index daf39e8..5f5ee98 100644
--- a/tests/hwsim/test_ap_pmf.py
+++ b/tests/hwsim/test_ap_pmf.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Protected management frames tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index 26a3bb4..79c38de 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # WPA2-Personal tests
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ap_qosmap.py b/tests/hwsim/test_ap_qosmap.py
index 8843b4e..0237e39 100644
--- a/tests/hwsim/test_ap_qosmap.py
+++ b/tests/hwsim/test_ap_qosmap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # QoS Mapping tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_roam.py b/tests/hwsim/test_ap_roam.py
index a9d671c..0c7c90e 100644
--- a/tests/hwsim/test_ap_roam.py
+++ b/tests/hwsim/test_ap_roam.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Roaming tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 2163e02..8b9971a 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # TDLS tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ap_wps.py b/tests/hwsim/test_ap_wps.py
index bc37398..3196854 100644
--- a/tests/hwsim/test_ap_wps.py
+++ b/tests/hwsim/test_ap_wps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # WPS tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_connect_cmd.py b/tests/hwsim/test_connect_cmd.py
index 75833a5..52b3da7 100644
--- a/tests/hwsim/test_connect_cmd.py
+++ b/tests/hwsim/test_connect_cmd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # cfg80211 connect command (SME in the driver/firmware)
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py
index a92ab83..8e45c7f 100644
--- a/tests/hwsim/test_dfs.py
+++ b/tests/hwsim/test_dfs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Test cases for DFS
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ext_password.py b/tests/hwsim/test_ext_password.py
index 56481e1..d847ee7 100644
--- a/tests/hwsim/test_ext_password.py
+++ b/tests/hwsim/test_ext_password.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # External password storage
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_gas.py b/tests/hwsim/test_gas.py
index 5f901c3..22b73ed 100644
--- a/tests/hwsim/test_gas.py
+++ b/tests/hwsim/test_gas.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # GAS tests
 # Copyright (c) 2013, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_ibss.py b/tests/hwsim/test_ibss.py
index 3a92a67..db5131c 100644
--- a/tests/hwsim/test_ibss.py
+++ b/tests/hwsim/test_ibss.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # IBSS test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ieee8021x.py b/tests/hwsim/test_ieee8021x.py
index 6527f0c..61e5fe7 100644
--- a/tests/hwsim/test_ieee8021x.py
+++ b/tests/hwsim/test_ieee8021x.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # IEEE 802.1X tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_monitor_interface.py b/tests/hwsim/test_monitor_interface.py
index 2fce1a1..121313b 100644
--- a/tests/hwsim/test_monitor_interface.py
+++ b/tests/hwsim/test_monitor_interface.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # AP mode using the older monitor interface design
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_nfc_p2p.py b/tests/hwsim/test_nfc_p2p.py
index 84418f9..229c82d 100644
--- a/tests/hwsim/test_nfc_p2p.py
+++ b/tests/hwsim/test_nfc_p2p.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P+NFC tests
 # Copyright (c) 2013, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py
index dc2c848..89041f0 100644
--- a/tests/hwsim/test_nfc_wps.py
+++ b/tests/hwsim/test_nfc_wps.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # WPS+NFC tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_autogo.py b/tests/hwsim/test_p2p_autogo.py
index ad4a3d9..d601105 100644
--- a/tests/hwsim/test_p2p_autogo.py
+++ b/tests/hwsim/test_p2p_autogo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P autonomous GO test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_concurrency.py b/tests/hwsim/test_p2p_concurrency.py
index 29aaa26..3fccb96 100644
--- a/tests/hwsim/test_p2p_concurrency.py
+++ b/tests/hwsim/test_p2p_concurrency.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P concurrency test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_device.py b/tests/hwsim/test_p2p_device.py
index ce9d2c4..b01e880 100644
--- a/tests/hwsim/test_p2p_device.py
+++ b/tests/hwsim/test_p2p_device.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # cfg80211 P2P Device
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index 685a76c..4eeb30f 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P device discovery test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py
index c91b64d..977253c 100644
--- a/tests/hwsim/test_p2p_grpform.py
+++ b/tests/hwsim/test_p2p_grpform.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P group formation test cases
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_invitation.py b/tests/hwsim/test_p2p_invitation.py
index db8441e..3d669e3 100644
--- a/tests/hwsim/test_p2p_invitation.py
+++ b/tests/hwsim/test_p2p_invitation.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P invitation test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_persistent.py b/tests/hwsim/test_p2p_persistent.py
index 1f0ef1b..b5c3b91 100644
--- a/tests/hwsim/test_p2p_persistent.py
+++ b/tests/hwsim/test_p2p_persistent.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P persistent group test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_service.py b/tests/hwsim/test_p2p_service.py
index 43ed5b2..5954a00 100644
--- a/tests/hwsim/test_p2p_service.py
+++ b/tests/hwsim/test_p2p_service.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # P2P service discovery test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_p2p_wifi_display.py b/tests/hwsim/test_p2p_wifi_display.py
index a38e8aa..a752873 100644
--- a/tests/hwsim/test_p2p_wifi_display.py
+++ b/tests/hwsim/test_p2p_wifi_display.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Wi-Fi Display test cases
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_peerkey.py b/tests/hwsim/test_peerkey.py
index f4da06a..fd64c18 100644
--- a/tests/hwsim/test_peerkey.py
+++ b/tests/hwsim/test_peerkey.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # PeerKey tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_pmksa_cache.py b/tests/hwsim/test_pmksa_cache.py
index cbd8d8e..1b15524 100644
--- a/tests/hwsim/test_pmksa_cache.py
+++ b/tests/hwsim/test_pmksa_cache.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # WPA2-Enterprise PMKSA caching tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_radio_work.py b/tests/hwsim/test_radio_work.py
index 7f4f5c7..a39272d 100644
--- a/tests/hwsim/test_radio_work.py
+++ b/tests/hwsim/test_radio_work.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Radio work tests
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_radius.py b/tests/hwsim/test_radius.py
index 5849986..b35cca1 100644
--- a/tests/hwsim/test_radius.py
+++ b/tests/hwsim/test_radius.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # RADIUS tests
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_sae.py b/tests/hwsim/test_sae.py
index 3461c54..5a5c703 100644
--- a/tests/hwsim/test_sae.py
+++ b/tests/hwsim/test_sae.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Test cases for SAE
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py
index 938abda..ea7f64a 100644
--- a/tests/hwsim/test_scan.py
+++ b/tests/hwsim/test_scan.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Scanning tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_ssid.py b/tests/hwsim/test_ssid.py
index 6d1f72d..7972bab 100644
--- a/tests/hwsim/test_ssid.py
+++ b/tests/hwsim/test_ssid.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 # -*- coding: utf-8 -*-
 #
 # SSID contents and encoding tests
diff --git a/tests/hwsim/test_sta_dynamic.py b/tests/hwsim/test_sta_dynamic.py
index ab9df44..5bf43da 100644
--- a/tests/hwsim/test_sta_dynamic.py
+++ b/tests/hwsim/test_sta_dynamic.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Dynamic wpa_supplicant interface
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wep.py b/tests/hwsim/test_wep.py
index 7b70484..8552b7a 100644
--- a/tests/hwsim/test_wep.py
+++ b/tests/hwsim/test_wep.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # WEP tests
 # Copyright (c) 2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wext.py b/tests/hwsim/test_wext.py
index e456b48..779b4f9 100644
--- a/tests/hwsim/test_wext.py
+++ b/tests/hwsim/test_wext.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Deprecated WEXT driver interface in wpa_supplicant
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py
index af5cacb..e711ea2 100644
--- a/tests/hwsim/test_wnm.py
+++ b/tests/hwsim/test_wnm.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # WNM tests
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/test_wpas_ap.py b/tests/hwsim/test_wpas_ap.py
index 4d78cb0..08229f7 100644
--- a/tests/hwsim/test_wpas_ap.py
+++ b/tests/hwsim/test_wpas_ap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # wpa_supplicant AP mode tests
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py
index c328f73..cd18942 100644
--- a/tests/hwsim/test_wpas_ctrl.py
+++ b/tests/hwsim/test_wpas_ctrl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # wpa_supplicant control interface
 # Copyright (c) 2014, Qualcomm Atheros, Inc.
diff --git a/tests/hwsim/utils.py b/tests/hwsim/utils.py
index 27cbc4e..d8cb595 100644
--- a/tests/hwsim/utils.py
+++ b/tests/hwsim/utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Testing utilities
 # Copyright (c) 2013, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/wlantest.py b/tests/hwsim/wlantest.py
index 3056479..8d48b2d 100644
--- a/tests/hwsim/wlantest.py
+++ b/tests/hwsim/wlantest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Python class for controlling wlantest
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 963b346..653cbdd 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 #
 # Python class for controlling wpa_supplicant
 # Copyright (c) 2013-2014, Jouni Malinen <j at w1.fi>
-- 
1.9.0



From j  Fri Feb 21 10:27:21 2014
From: j (Jouni Malinen)
Date: Fri, 21 Feb 2014 20:27:21 +0200
Subject: [PATCH 1/1] Change the interpreter directive in test scrips
In-Reply-To: <1392990520-23241-1-git-send-email-roger.zanoni@openbossa.org>
References: <1392990520-23241-1-git-send-email-roger.zanoni@openbossa.org>
Message-ID: <20140221182721.GA29544@w1.fi>

On Fri, Feb 21, 2014 at 09:48:40AM -0400, Roger Zanoni wrote:
> This makes scripts check the environment for the current python
> interpreter in use instead of assuming that the python executable points
> to a python 2 interpreter.

Thanks.

>  tests/hwsim/hostapd.py                | 2 +-
>  tests/hwsim/hwsim_utils.py            | 2 +-
>  tests/hwsim/radius_das.py             | 2 +-
>  tests/hwsim/run-tests.py              | 2 +-
>  tests/hwsim/test_ap_acs.py            | 2 +-
...

However, it turns out that apart from run-tests.py, there is not really
any point in defining the interpreter in the first place since those
files are not executed directly. I removed the interpreter lines from
all the other files and applied this change to run-tests.py.

-- 
Jouni Malinen                                            PGP id EFC895FA


From janusz.dziedzic  Mon Feb 24 04:22:16 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Mon, 24 Feb 2014 13:22:16 +0100
Subject: [PATCH v2] wpa_supplicant: add support for IPv6 when CTRL UDP used
Message-ID: <1393244536-5585-1-git-send-email-janusz.dziedzic@tieto.com>

Add IPv6 support when using udp/udp-remote control
interface. Added new config options:
CONFIG_CTRL_IFACE=udp6
CONFIG_CTRL_IFACE=udp6-remote

This is usefull for testing, while we don't need
assign IPv4 address (static or using dhcpd) and just
use auto configured IPv6 addresses - link local, which
base on mac address. Added also scope id support for
link local case.

Eg.
./wpa_cli
./wpa_cli -i ::1,9877
./wpa_cli -i fe80::203:7fff:fe05:69%wlan0,9877

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
Fix: *** stack smashing detected ***: ./wpa_cli terminated

 src/common/wpa_ctrl.c           |   71 ++++++++++++++++++++++++++--
 wpa_supplicant/Makefile         |   11 +++++
 wpa_supplicant/ctrl_iface_udp.c |   97 +++++++++++++++++++++++++++++++++++++--
 wpa_supplicant/defconfig        |    2 +
 4 files changed, 174 insertions(+), 7 deletions(-)

diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c
index f4af94a..3cbd852 100644
--- a/src/common/wpa_ctrl.c
+++ b/src/common/wpa_ctrl.c
@@ -25,6 +25,10 @@
 #include "private/android_filesystem_config.h"
 #endif /* ANDROID */
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+#include <net/if.h>
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
+
 #include "wpa_ctrl.h"
 #include "common.h"
 
@@ -46,8 +50,13 @@
 struct wpa_ctrl {
 #ifdef CONFIG_CTRL_IFACE_UDP
 	int s;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 local;
+	struct sockaddr_in6 dest;
+#else
 	struct sockaddr_in local;
 	struct sockaddr_in dest;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	char *cookie;
 	char *remote_ifname;
 	char *remote_ip;
@@ -279,19 +288,33 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 		return NULL;
 	os_memset(ctrl, 0, sizeof(*ctrl));
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	ctrl->s = socket(PF_INET6, SOCK_DGRAM, 0);
+#else
 	ctrl->s = socket(PF_INET, SOCK_DGRAM, 0);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	if (ctrl->s < 0) {
 		perror("socket");
 		os_free(ctrl);
 		return NULL;
 	}
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	ctrl->local.sin6_family = AF_INET6;
+#ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
+	ctrl->local.sin6_addr = in6addr_any;
+#else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+	inet_pton(AF_INET6, "::1", &ctrl->local.sin6_addr);
+#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#else /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	ctrl->local.sin_family = AF_INET;
 #ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
 	ctrl->local.sin_addr.s_addr = INADDR_ANY;
 #else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 	ctrl->local.sin_addr.s_addr = htonl((127 << 24) | 1);
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
+
 	if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
 		 sizeof(ctrl->local)) < 0) {
 		close(ctrl->s);
@@ -299,14 +322,24 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 		return NULL;
 	}
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	ctrl->dest.sin6_family = AF_INET6;
+	inet_pton(AF_INET6, "::1", &ctrl->dest.sin6_addr);
+	ctrl->dest.sin6_port = htons(WPA_CTRL_IFACE_PORT);
+#else
 	ctrl->dest.sin_family = AF_INET;
 	ctrl->dest.sin_addr.s_addr = htonl((127 << 24) | 1);
 	ctrl->dest.sin_port = htons(WPA_CTRL_IFACE_PORT);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 #ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
 	if (ctrl_path) {
 		char *port, *name;
 		int port_id;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		char *scope;
+		int scope_id = 0;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 		name = os_strdup(ctrl_path);
 		if (name == NULL) {
@@ -314,7 +347,11 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 			os_free(ctrl);
 			return NULL;
 		}
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		port = os_strchr(name, ',');
+#else
 		port = os_strchr(name, ':');
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 		if (port) {
 			port_id = atoi(&port[1]);
@@ -322,9 +359,19 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 		} else
 			port_id = WPA_CTRL_IFACE_PORT;
 
-		h = gethostbyname(name);
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		scope = os_strchr(name, '%');
+		if (scope) {
+			scope_id = if_nametoindex(&scope[1]);
+			scope[0] = '\0';
+		}
+		h = gethostbyname2(name, AF_INET6);
+#else
+		h = gethostbyname2(name, AF_INET);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 		ctrl->remote_ip = os_strdup(name);
 		os_free(name);
+
 		if (h == NULL) {
 			perror("gethostbyname");
 			close(ctrl->s);
@@ -332,16 +379,32 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
 			os_free(ctrl);
 			return NULL;
 		}
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		ctrl->dest.sin6_scope_id = scope_id;
+		ctrl->dest.sin6_port = htons(port_id);
+		os_memcpy(&ctrl->dest.sin6_addr, h->h_addr, h->h_length);
+#else
 		ctrl->dest.sin_port = htons(port_id);
-		os_memcpy(h->h_addr, (char *) &ctrl->dest.sin_addr.s_addr,
-			  h->h_length);
+		os_memcpy(&ctrl->dest.sin_addr.s_addr, h->h_addr, h->h_length);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	} else
 		ctrl->remote_ip = os_strdup("localhost");
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 
 	if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest,
 		    sizeof(ctrl->dest)) < 0) {
-		perror("connect");
+		char con_error[1000];
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		char addr[INET6_ADDRSTRLEN];
+		snprintf(con_error, 1000, "connect %s %d",
+			 inet_ntop(AF_INET6, &ctrl->dest.sin6_addr, addr, sizeof(ctrl->dest)),
+			 ntohs(ctrl->dest.sin6_port));
+#else
+		snprintf(con_error, 1000, "connect %s %d",
+		       inet_ntoa(ctrl->dest.sin_addr),
+		       ntohs(ctrl->dest.sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
+		perror(con_error);
 		close(ctrl->s);
 		os_free(ctrl->remote_ip);
 		os_free(ctrl);
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index d1e11a3..c82c055 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -1259,6 +1259,11 @@ endif
 ifeq ($(CONFIG_CTRL_IFACE), udp)
 CFLAGS += -DCONFIG_CTRL_IFACE_UDP
 endif
+ifeq ($(CONFIG_CTRL_IFACE), udp6)
+CONFIG_CTRL_IFACE=udp
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
+endif
 ifeq ($(CONFIG_CTRL_IFACE), named_pipe)
 CFLAGS += -DCONFIG_CTRL_IFACE_NAMED_PIPE
 endif
@@ -1267,6 +1272,12 @@ CONFIG_CTRL_IFACE=udp
 CFLAGS += -DCONFIG_CTRL_IFACE_UDP
 CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
 endif
+ifeq ($(CONFIG_CTRL_IFACE), udp6-remote)
+CONFIG_CTRL_IFACE=udp
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
+CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
+endif
 OBJS += ctrl_iface.o ctrl_iface_$(CONFIG_CTRL_IFACE).o
 endif
 
diff --git a/wpa_supplicant/ctrl_iface_udp.c b/wpa_supplicant/ctrl_iface_udp.c
index 8c09ba1..9b04e3b 100644
--- a/wpa_supplicant/ctrl_iface_udp.c
+++ b/wpa_supplicant/ctrl_iface_udp.c
@@ -30,7 +30,11 @@
  */
 struct wpa_ctrl_dst {
 	struct wpa_ctrl_dst *next;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 addr;
+#else
 	struct sockaddr_in addr;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	socklen_t addrlen;
 	int debug_level;
 	int errors;
@@ -51,38 +55,66 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
 
 
 static int wpa_supplicant_ctrl_iface_attach(struct ctrl_iface_priv *priv,
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+					    struct sockaddr_in6 *from,
+#else
 					    struct sockaddr_in *from,
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 					    socklen_t fromlen)
 {
 	struct wpa_ctrl_dst *dst;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET6_ADDRSTRLEN];
+#endif /* CONFIG_UDP_IPV6 */
 
 	dst = os_zalloc(sizeof(*dst));
 	if (dst == NULL)
 		return -1;
-	os_memcpy(&dst->addr, from, sizeof(struct sockaddr_in));
+	os_memcpy(&dst->addr, from, sizeof(*from));
 	dst->addrlen = fromlen;
 	dst->debug_level = MSG_INFO;
 	dst->next = priv->ctrl_dst;
 	priv->ctrl_dst = dst;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor attached %s:%d",
+		   inet_ntop(AF_INET6, &from->sin6_addr, addr, sizeof(*from)),
+		   ntohs(from->sin6_port));
+#else
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor attached %s:%d",
 		   inet_ntoa(from->sin_addr), ntohs(from->sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	return 0;
 }
 
 
 static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+					    struct sockaddr_in6 *from,
+#else
 					    struct sockaddr_in *from,
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 					    socklen_t fromlen)
 {
 	struct wpa_ctrl_dst *dst, *prev = NULL;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET6_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	dst = priv->ctrl_dst;
 	while (dst) {
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+		if (from->sin6_port == dst->addr.sin6_port &&
+		    !memcmp(&from->sin6_addr, &dst->addr.sin6_addr, sizeof(from->sin6_addr))) {
+			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor detached %s:%d",
+				   inet_ntop(AF_INET6, &from->sin6_addr, addr, sizeof(*from)),
+				   ntohs(from->sin6_port));
+#else
 		if (from->sin_addr.s_addr == dst->addr.sin_addr.s_addr &&
 		    from->sin_port == dst->addr.sin_port) {
 			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor detached "
 				   "%s:%d", inet_ntoa(from->sin_addr),
 				   ntohs(from->sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 			if (prev == NULL)
 				priv->ctrl_dst = dst->next;
 			else
@@ -98,21 +130,36 @@ static int wpa_supplicant_ctrl_iface_detach(struct ctrl_iface_priv *priv,
 
 
 static int wpa_supplicant_ctrl_iface_level(struct ctrl_iface_priv *priv,
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+					   struct sockaddr_in6 *from,
+#else
 					   struct sockaddr_in *from,
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 					   socklen_t fromlen,
 					   char *level)
 {
 	struct wpa_ctrl_dst *dst;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET6_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	wpa_printf(MSG_DEBUG, "CTRL_IFACE LEVEL %s", level);
 
 	dst = priv->ctrl_dst;
 	while (dst) {
+#if CONFIG_CTRL_IFACE_UDP_IPV6
+		if (from->sin6_port == dst->addr.sin6_port &&
+		    !memcmp(&from->sin6_addr, &dst->addr.sin6_addr, sizeof(from->sin6_addr))) {
+			wpa_printf(MSG_DEBUG, "CTRL_IFACE changed monitor level %s:%d",
+				   inet_ntop(AF_INET6, &from->sin6_addr, addr, sizeof(*from)),
+				   ntohs(from->sin6_port));
+#else
 		if (from->sin_addr.s_addr == dst->addr.sin_addr.s_addr &&
 		    from->sin_port == dst->addr.sin_port) {
 			wpa_printf(MSG_DEBUG, "CTRL_IFACE changed monitor "
 				   "level %s:%d", inet_ntoa(from->sin_addr),
 				   ntohs(from->sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 			dst->debug_level = atoi(level);
 			return 0;
 		}
@@ -150,7 +197,14 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 	struct ctrl_iface_priv *priv = sock_ctx;
 	char buf[256], *pos;
 	int res;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 from;
+#ifndef CONFIG_CTRL_IFACE_UDP_REMOTE
+	char addr[INET6_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#else
 	struct sockaddr_in from;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	socklen_t fromlen = sizeof(from);
 	char *reply = NULL;
 	size_t reply_len = 0;
@@ -165,6 +219,13 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 	}
 
 #ifndef CONFIG_CTRL_IFACE_UDP_REMOTE
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	inet_ntop(AF_INET6, &from.sin6_addr, addr, sizeof(from));
+	if (strcmp(addr, "::1")) {
+		wpa_printf(MSG_DEBUG, "CTRL: Drop packet from unexpected "
+			   "source %s", addr);
+	}
+#else
 	if (from.sin_addr.s_addr != htonl((127 << 24) | 1)) {
 		/*
 		 * The OS networking stack is expected to drop this kind of
@@ -176,6 +237,7 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
 			   "source %s", inet_ntoa(from.sin_addr));
 		return;
 	}
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 
 	buf[res] = '\0';
@@ -269,8 +331,14 @@ struct ctrl_iface_priv *
 wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
 {
 	struct ctrl_iface_priv *priv;
-	struct sockaddr_in addr;
 	int port = WPA_CTRL_IFACE_PORT;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	struct sockaddr_in6 addr;
+	int domain = PF_INET6;
+#else
+	struct sockaddr_in addr;
+	int domain = PF_INET;
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	priv = os_zalloc(sizeof(*priv));
 	if (priv == NULL)
@@ -282,12 +350,21 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
 	if (wpa_s->conf->ctrl_interface == NULL)
 		return priv;
 
-	priv->sock = socket(PF_INET, SOCK_DGRAM, 0);
+	priv->sock = socket(domain, SOCK_DGRAM, 0);
 	if (priv->sock < 0) {
 		perror("socket(PF_INET)");
 		goto fail;
 	}
 
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	os_memset(&addr, 0, sizeof(addr));
+	addr.sin6_family = AF_INET6;
+#ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
+	addr.sin6_addr = in6addr_any;
+#else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+	inet_pton(AF_INET6, "::1", &addr.sin6_addr);
+#endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#else /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	os_memset(&addr, 0, sizeof(addr));
 	addr.sin_family = AF_INET;
 #ifdef CONFIG_CTRL_IFACE_UDP_REMOTE
@@ -295,8 +372,13 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
 #else /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 	addr.sin_addr.s_addr = htonl((127 << 24) | 1);
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 try_again:
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	addr.sin6_port = htons(port);
+#else
 	addr.sin_port = htons(port);
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 	if (bind(priv->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
 		port--;
 		if ((WPA_CTRL_IFACE_PORT - port) < WPA_CTRL_IFACE_PORT_LIMIT)
@@ -362,6 +444,9 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
 	int idx;
 	char *sbuf;
 	int llen;
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+	char addr[INET6_ADDRSTRLEN];
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 
 	dst = priv->ctrl_dst;
 	if (priv->sock < 0 || dst == NULL)
@@ -381,9 +466,15 @@ static void wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv *priv,
 	while (dst) {
 		next = dst->next;
 		if (level >= dst->debug_level) {
+#ifdef CONFIG_CTRL_IFACE_UDP_IPV6
+			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor send %s:%d",
+				   inet_ntop(AF_INET6, &dst->addr.sin6_addr, addr, sizeof(dst->addr)),
+				   ntohs(dst->addr.sin6_port));
+#else
 			wpa_printf(MSG_DEBUG, "CTRL_IFACE monitor send %s:%d",
 				   inet_ntoa(dst->addr.sin_addr),
 				   ntohs(dst->addr.sin_port));
+#endif /* CONFIG_CTRL_IFACE_UDP_IPV6 */
 			if (sendto(priv->sock, sbuf, llen + len, 0,
 				   (struct sockaddr *) &dst->addr,
 				   sizeof(dst->addr)) < 0) {
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 6684782..91eea35 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -192,8 +192,10 @@ CONFIG_SMARTCARD=y
 # Select control interface backend for external programs, e.g, wpa_cli:
 # unix = UNIX domain sockets (default for Linux/*BSD)
 # udp = UDP sockets using localhost (127.0.0.1)
+# udp6 = UDP IPv6 sockets using localhost (::1)
 # named_pipe = Windows Named Pipe (default for Windows)
 # udp-remote = UDP sockets with remote access (only for tests systems/purpose)
+# udp6-remote = UDP IPv6 sockets with remote access (only for tests purpose)
 # y = use default (backwards compatibility)
 # If this option is commented out, control interface is not included in the
 # build.
-- 
1.7.9.5



From eduardo.abinader  Mon Feb 24 07:46:53 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Mon, 24 Feb 2014 11:46:53 -0400
Subject: [PATCH 1/1] Fix current log dir symbolic link
Message-ID: <1393256813-6256-1-git-send-email-eduardo.abinader@openbossa.org>

This patch aims to fix the update of current symbolic link,
when LOGDIR is already set. The current symbolic link was only
set, if LOGDIR has not been previously defined. If the user
had chosen to cancel the running test and run it again, the current
symbolic link was not being updated.

Signed-off-by: Eduardo Abinader <eduardo.abinader at openbossa.org>
---
 tests/hwsim/start.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
index f5e8f27..3bd6f02 100755
--- a/tests/hwsim/start.sh
+++ b/tests/hwsim/start.sh
@@ -7,13 +7,11 @@ HAPD=$DIR/../../hostapd/hostapd
 HAPD_AS=$DIR/../../hostapd/hostapd
 WLANTEST=$DIR/../../wlantest/wlantest
 HLR_AUC_GW=$DIR/../../hostapd/hlr_auc_gw
+DATE="$(date +%s)"
 
 if [ -z "$LOGDIR" ] ; then
-    DATE="$(date +%s)"
     LOGDIR="$DIR/logs/$DATE"
     mkdir -p $LOGDIR
-    rm -rf $DIR/logs/current
-    ln -sf $DATE $DIR/logs/current
 else
     if [ -e $LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant ]; then
 	WPAS=$LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant
@@ -29,6 +27,9 @@ else
     fi
 fi
 
+rm -rf $DIR/logs/current
+ln -sf $DATE $DIR/logs/current
+
 if groups | tr ' ' "\n" | grep -q ^admin$; then
     GROUP=admin
 else
-- 
1.8.1.2



From eduardo.abinader  Mon Feb 24 12:25:03 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Mon, 24 Feb 2014 16:25:03 -0400
Subject: [PATCH 1/1] Fix trace parameter invocation
Message-ID: <1393273503-8665-1-git-send-email-eduardo.abinader@openbossa.org>

Summary:
This patch avoids run-tests to keep hanging in a loop,
by simply checking inexistence of trace-cmd command
and exiting the script.

Signed-off-by: Eduardo Abinader <eduardo.abinader at openbossa.org>
---
 tests/hwsim/run-tests.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 68ea439..c85cc22 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -102,6 +102,11 @@ class DataCollector(object):
     def __enter__(self):
         if self._tracing:
             output = os.path.join(self._logdir, '%s.dat' % (self._testname, ))
+            if subprocess.call(["type trace-cmd"], shell=True, 
+                               stdout=subprocess.PIPE, 
+                               stderr=subprocess.PIPE):
+                print "failed: trace-cmd not found"
+                sys.exit(1)
             self._trace_cmd = subprocess.Popen(['sudo', 'trace-cmd', 'record', '-o', output, '-e', 'mac80211', '-e', 'cfg80211', 'sh', '-c', 'echo STARTED ; read l'],
                                                stdin=subprocess.PIPE,
                                                stdout=subprocess.PIPE,
-- 
1.8.1.2



From j  Mon Feb 24 13:06:49 2014
From: j (Jouni Malinen)
Date: Mon, 24 Feb 2014 23:06:49 +0200
Subject: [PATCH 0/3] Fast Session Transfer (FST)
In-Reply-To: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
References: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
Message-ID: <20140224210649.GB21979@w1.fi>

On Mon, Feb 17, 2014 at 04:43:18PM +0200, Anton Nayshtut wrote:
> This set of patches introduces Fast Session Transfer (FST) support by both
> hostapd and wpa_supplicant.

Thanks.

Patch 1/3 did not make it through to the list due to size. The full set
is available here for anyone who is interested at reviewing the
changes: http://w1.fi/p/fst/

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Feb 24 13:12:54 2014
From: j (Jouni Malinen)
Date: Mon, 24 Feb 2014 23:12:54 +0200
Subject: [PATCHv2 1/2] hostapd: make it possible to remove addresses from
	maclists
In-Reply-To: <1392821596-3034-1-git-send-email-emanuel.taube@gmail.com>
References: <1392821596-3034-1-git-send-email-emanuel.taube@gmail.com>
Message-ID: <20140224211254.GC21979@w1.fi>

On Wed, Feb 19, 2014 at 03:53:15PM +0100, Emanuel Taube wrote:
> It is already possible to add mac addresses at runtime.
> This patch allows also to remove some of them by the prefix "-"
> in the address file.

> diff --git a/hostapd/config_file.c b/hostapd/config_file.c
> @@ -116,6 +116,8 @@ static int hostapd_config_read_maclist(const char *fname,
> +	Boolean remove;
> +	int i;

> +		if (remove) {
> +			for (i = 0; i < *num; i++)
> +				if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) ==
> +				    0) {
> +					os_remove_in_array(
> +						*acl, *num,
> +						sizeof(**acl), i--);
> +					(*num)--;

While this may be correct, that i-- hidden in the os_remove_in_array()
call is a bit dubious.. How about using a while loop with that branch
not incrementing i? I would also like to see braces around the for loop
body since it has that many lines.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Feb 24 13:20:49 2014
From: j (Jouni Malinen)
Date: Mon, 24 Feb 2014 23:20:49 +0200
Subject: [PATCH 1/1] Fix current log dir symbolic link
In-Reply-To: <1393256813-6256-1-git-send-email-eduardo.abinader@openbossa.org>
References: <1393256813-6256-1-git-send-email-eduardo.abinader@openbossa.org>
Message-ID: <20140224212049.GD21979@w1.fi>

On Mon, Feb 24, 2014 at 11:46:53AM -0400, Eduardo Abinader wrote:
> This patch aims to fix the update of current symbolic link,
> when LOGDIR is already set. The current symbolic link was only
> set, if LOGDIR has not been previously defined. If the user
> had chosen to cancel the running test and run it again, the current
> symbolic link was not being updated.

What do you mean with canceling a running test? For me, that means
stopping and restarting run-tests.py, so I'm not completely sure I
understood what the problem would be since start.sh would not be even
run again in that case..

> diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
> @@ -7,13 +7,11 @@ HAPD=$DIR/../../hostapd/hostapd
> +DATE="$(date +%s)"
>  
>  if [ -z "$LOGDIR" ] ; then
> -    DATE="$(date +%s)"
>      LOGDIR="$DIR/logs/$DATE"
>      mkdir -p $LOGDIR
> -    rm -rf $DIR/logs/current
> -    ln -sf $DATE $DIR/logs/current
>  else
>      if [ -e $LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant ]; then
>  	WPAS=$LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant
> @@ -29,6 +27,9 @@ else
> +rm -rf $DIR/logs/current
> +ln -sf $DATE $DIR/logs/current

This adds an undesired error message for vm-run.sh cases since $DIR/logs
directory is on a read-only file system within the VM. That's one of the
main reasons why the existing code is within that if branch.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Feb 24 13:23:33 2014
From: j (Jouni Malinen)
Date: Mon, 24 Feb 2014 23:23:33 +0200
Subject: [PATCH 1/1] Fix trace parameter invocation
In-Reply-To: <1393273503-8665-1-git-send-email-eduardo.abinader@openbossa.org>
References: <1393273503-8665-1-git-send-email-eduardo.abinader@openbossa.org>
Message-ID: <20140224212333.GE21979@w1.fi>

On Mon, Feb 24, 2014 at 04:25:03PM -0400, Eduardo Abinader wrote:
> This patch avoids run-tests to keep hanging in a loop,
> by simply checking inexistence of trace-cmd command
> and exiting the script.

> diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
> @@ -102,6 +102,11 @@ class DataCollector(object):
>      def __enter__(self):
>          if self._tracing:
>              output = os.path.join(self._logdir, '%s.dat' % (self._testname, ))
> +            if subprocess.call(["type trace-cmd"], shell=True, 
> +                               stdout=subprocess.PIPE, 
> +                               stderr=subprocess.PIPE):
> +                print "failed: trace-cmd not found"
> +                sys.exit(1)
>              self._trace_cmd = subprocess.Popen(['sudo', 'trace-cmd', 'record', '-o', output, '-e', 'mac80211', '-e', 'cfg80211', 'sh', '-c', 'echo STARTED ; read l'],
>                                                 stdin=subprocess.PIPE,
>                                                 stdout=subprocess.PIPE,

That looks pretty ugly.. Isn't there any convenient way of making the
following loop break out in case the popen call exits? That would sound
quite a bit cleaner and also free of (admittedly theoretical) race
condition on trace-cmd disappearing between the two calls.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From eduardo.abinader  Mon Feb 24 13:34:36 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Mon, 24 Feb 2014 17:34:36 -0400
Subject: [PATCH 1/1] Fix trace parameter invocation
In-Reply-To: <20140224212333.GE21979@w1.fi>
References: <1393273503-8665-1-git-send-email-eduardo.abinader@openbossa.org>
	<20140224212333.GE21979@w1.fi>
Message-ID: <CABEV-37NJ6thEwY5KLTkrkY8wbEcXxvaUQ5HQZVcGEhZ6xv_HA@mail.gmail.com>

Right, Jouni.

Gonna do that.


On Mon, Feb 24, 2014 at 5:23 PM, Jouni Malinen <j at w1.fi> wrote:

> On Mon, Feb 24, 2014 at 04:25:03PM -0400, Eduardo Abinader wrote:
> > This patch avoids run-tests to keep hanging in a loop,
> > by simply checking inexistence of trace-cmd command
> > and exiting the script.
>
> > diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
> > @@ -102,6 +102,11 @@ class DataCollector(object):
> >      def __enter__(self):
> >          if self._tracing:
> >              output = os.path.join(self._logdir, '%s.dat' %
> (self._testname, ))
> > +            if subprocess.call(["type trace-cmd"], shell=True,
> > +                               stdout=subprocess.PIPE,
> > +                               stderr=subprocess.PIPE):
> > +                print "failed: trace-cmd not found"
> > +                sys.exit(1)
> >              self._trace_cmd = subprocess.Popen(['sudo', 'trace-cmd',
> 'record', '-o', output, '-e', 'mac80211', '-e', 'cfg80211', 'sh', '-c',
> 'echo STARTED ; read l'],
> >                                                 stdin=subprocess.PIPE,
> >                                                 stdout=subprocess.PIPE,
>
> That looks pretty ugly.. Isn't there any convenient way of making the
> following loop break out in case the popen call exits? That would sound
> quite a bit cleaner and also free of (admittedly theoretical) race
> condition on trace-cmd disappearing between the two calls.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140224/2a4bc54a/attachment.htm>


From j  Mon Feb 24 15:54:25 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 01:54:25 +0200
Subject: [PATCH] fix spelling s/algorith/algorithm/
In-Reply-To: <201402202119.15847.s.L-H@gmx.de>
References: <201402202119.15847.s.L-H@gmx.de>
Message-ID: <20140224235425.GA8360@w1.fi>

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Mon Feb 24 15:58:17 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 01:58:17 +0200
Subject: [PATCH 2/2] hostapd: Configure spectrum management capability
In-Reply-To: <1392990138-26878-2-git-send-email-marek.puzyniak@tieto.com>
References: <1392990138-26878-1-git-send-email-marek.puzyniak@tieto.com>
	<1392990138-26878-2-git-send-email-marek.puzyniak@tieto.com>
Message-ID: <20140224235817.GB8360@w1.fi>

On Fri, Feb 21, 2014 at 02:42:18PM +0100, Marek Puzyniak wrote:
> From: Chaitanya T K <chaitanyatk at posedge.com>
> 
> Add configuration of Spectrum Managment subfield in
> the Capability Information of Beacon, Probe Response and
> Association Response. Spectrum Management bit is set when directly
> requested by new configuration option spectrum_mgmt_required=1
> or when AP is running on DFS channels. In future also TPC
> shall require this bit to be set.

Thanks, applied both patches with some cleanup/fixes. The
hostapd_is_dfs_required() path ended up crashing hostapd with any driver
that does not use hw_features, including use of hostapd as a RADIUS
server.. This ended up breaking 75 hwsim test cases because of the
authentication server crash; checking that iface->current_mode is set
fixed that.

-- 
Jouni Malinen                                            PGP id EFC895FA


From Anton.Nayshtut  Tue Feb 25 01:22:55 2014
From: Anton.Nayshtut (Anton Nayshtut)
Date: Tue, 25 Feb 2014 11:22:55 +0200
Subject: [PATCH 0/3] Fast Session Transfer (FST)
In-Reply-To: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
References: <1392648201-7416-1-git-send-email-Anton.Nayshtut@Wilocity.com>
Message-ID: <530C60EF.5070805@Wilocity.com>

Hi all,

Please note, Ubuntu (at least 12.04) provides an outdated version of
libnetlink (libnetlink.h matches the commit
b49240ec7eab91418d2f090536bf8cd2205988d6 - a revision committed at
02-Dec-2009).

Thus to compile the FST patches on Ubuntu, one should use the libnetlink
compiled from the iproute2 sources. See
http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2 for
more info.

Best Regards,
Anton

On 2/17/2014 4:43 PM, Anton Nayshtut wrote:
> From: Anton Nayshtut <Anton.Nayshtut at wilocity.com>
> 
> This set of patches introduces Fast Session Transfer (FST) support by both
> hostapd and wpa_supplicant.
> 
> Fast Session Transfer (FST) is the transfer of a session from a channel to
> another channel, in the same or different frequency bands. The term "session"
> refers to non-physical layer state information kept by a pair of stations (STAs)
> that communicate directly (i.e., excludes forwarding).
> 
> The FST is implemented in accordance with WGA Specification.
> 
> Definitions
> 
>  * FST interface - an interface for which FST functionality is enabled
>  * FST peer - a Multi-band capable STA connected
> 
> Configuration and Initialization
> 
>  * FST functionality can enabled by compilation flag (CONFIG_FST)
>  * hostapd/wpa_supplicant controlling multiple interfaces are used for FST
>  * once enabled by compilation, the FST can be enabled for specific interfaces
>    in configuration files
>  * one of the FST interfaces must be set as an FST default interface
>  * the FST default interface is the interface FST will always try to switch from
>    Thus, for example, for the maximal throughput, it should be the slowest FST
>    interface in the FST setup.
>  * FST interfaces advertise the Multi-band capability by including the
>    Multi-band element in the corresponding frames
> 
> Single-band connection
> 
> * When 1st FST interface becomes connected to a FST Peer, the FST sets it as the
> active FST interface for this FST Peer, i.e. the FST interface is used for data
> transmission to this FST peer.
> 
> Session Establishment
> 
> * FST tries to establish FST Session wheb=n either:
>   - Multi-band connection becomes available available, i.e. when more than one
>     FST interfaces are connected to the same FST peer
>   - successful session transition ends
>   - non-active FST interface for which already established FST Session becomes
>     disconnected
> * Following LLT values are used in FST Session establishment:
>   - LLT=0 if current active FST interface is the FST default interface
>   - LLT=MAX_U8 otherwise
> 
> Session Transfer
> 
> * FST tries to perform the FST Session transfer when either:
>   - FST Session becomes established with LLT=0 (according to 10.32.2.2
>     Transitioning between states)
>   - active FST interface becomes disconnected (i.e. when LTT virtually becomes
>     0)
> * Upon successful session transfer, FST sets the target FST interface as the new
> active FST interface for this FST Peer.
> 
> Session Reset
> 
> * FST resets the FST Session when either:
>   - STT becomes 0 (in accordance with 10.32.2.2 Transitioning between states)
>   - only active FST interface stays connected
> 
> Anton Nayshtut (3):
>   Transparent FST: fst module introduced
>   Transparent FST: hostapd integration
>   Transparent FST: wpa_supplicant integration
> 
>  hostapd/Makefile                   |    8 +
>  hostapd/config_file.c              |   17 +
>  hostapd/defconfig                  |    3 +
>  hostapd/hostapd.conf               |   20 +
>  hostapd/main.c                     |   25 +-
>  src/Makefile                       |    2 +-
>  src/ap/ap_config.h                 |    5 +
>  src/ap/ap_drv_ops.c                |   15 +
>  src/ap/beacon.c                    |   28 +-
>  src/ap/drv_callbacks.c             |   27 +
>  src/ap/hostapd.c                   |   56 +-
>  src/ap/hostapd.h                   |    4 +
>  src/ap/ieee802_11.c                |   28 +-
>  src/ap/sta_info.c                  |   15 +
>  src/ap/sta_info.h                  |    3 +
>  src/ap/utils.c                     |   12 +-
>  src/common/ieee802_11_common.c     |   34 +
>  src/common/ieee802_11_common.h     |   15 +
>  src/common/ieee802_11_defs.h       |   65 ++
>  src/drivers/driver_nl80211.c       |   11 +
>  src/fst/Makefile                   |    8 +
>  src/fst/fst.c                      | 1457 ++++++++++++++++++++++++++++++++++++
>  src/fst/fst.h                      |   48 ++
>  src/fst/fst_defs.h                 |   91 +++
>  src/fst/fst_drv.c                  |  442 +++++++++++
>  src/fst/fst_drv.h                  |   24 +
>  src/fst/fst_rtnl.c                 |  284 +++++++
>  src/fst/fst_rtnl.h                 |   25 +
>  wpa_supplicant/Makefile            |    8 +
>  wpa_supplicant/config.c            |    7 +
>  wpa_supplicant/config.h            |    5 +
>  wpa_supplicant/defconfig           |    3 +
>  wpa_supplicant/events.c            |   48 +-
>  wpa_supplicant/main.c              |   16 +
>  wpa_supplicant/notify.c            |   13 +
>  wpa_supplicant/scan.c              |    7 +
>  wpa_supplicant/sme.c               |   14 +
>  wpa_supplicant/wpa_supplicant.c    |   91 +++
>  wpa_supplicant/wpa_supplicant.conf |   20 +
>  wpa_supplicant/wpa_supplicant_i.h  |    6 +
>  40 files changed, 3003 insertions(+), 7 deletions(-)
>  create mode 100644 src/fst/Makefile
>  create mode 100644 src/fst/fst.c
>  create mode 100644 src/fst/fst.h
>  create mode 100644 src/fst/fst_defs.h
>  create mode 100644 src/fst/fst_drv.c
>  create mode 100644 src/fst/fst_drv.h
>  create mode 100644 src/fst/fst_rtnl.c
>  create mode 100644 src/fst/fst_rtnl.h
> 


From emanuel.taube  Tue Feb 25 01:59:44 2014
From: emanuel.taube (Emanuel Taube)
Date: Tue, 25 Feb 2014 10:59:44 +0100
Subject: [PATCHv3 1/2] hostapd: make it possible to remove addresses from
	maclists
In-Reply-To: <20140224211254.GC21979@w1.fi>
References: <20140224211254.GC21979@w1.fi>
Message-ID: <1393322385-3501-1-git-send-email-emanuel.taube@gmail.com>

It is already possible to add mac addresses at runtime.
This patch allows also to remove some of them by the prefix "-"
in the address file.

Signed-off-by: Emanuel Taube <emanuel.taube at gmail.com>
---
 hostapd/config_file.c |   26 ++++++++++++++++++++++++--
 src/utils/os.h        |   16 ++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 19d6ad3..ab35439 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -116,6 +116,8 @@ static int hostapd_config_read_maclist(const char *fname,
 	char buf[128], *pos;
 	int line = 0;
 	u8 addr[ETH_ALEN];
+	Boolean remove;
+	int i;
 	struct mac_acl_entry *newacl;
 	int vlan_id;
 
@@ -143,14 +145,34 @@ static int hostapd_config_read_maclist(const char *fname,
 		}
 		if (buf[0] == '\0')
 			continue;
+		pos = buf;
+		if (buf[0] == '-') {
+			remove = TRUE;
+			pos++;
+		} else
+			remove = FALSE;
 
-		if (hwaddr_aton(buf, addr)) {
+		if (hwaddr_aton(pos, addr)) {
 			wpa_printf(MSG_ERROR, "Invalid MAC address '%s' at "
-				   "line %d in '%s'", buf, line, fname);
+				   "line %d in '%s'", pos, line, fname);
 			fclose(f);
 			return -1;
 		}
 
+		if (remove) {
+			i = 0;
+			while (i < *num) {
+				if (os_memcmp((*acl)[i].addr, addr, ETH_ALEN) ==
+				    0) {
+					os_remove_in_array(
+						*acl, *num,
+						sizeof(**acl), i);
+					(*num)--;
+				} else
+					i++;
+			}
+			continue;
+		}
 		vlan_id = 0;
 		pos = buf;
 		while (*pos != '\0' && *pos != ' ' && *pos != '\t')
diff --git a/src/utils/os.h b/src/utils/os.h
index 2e2350a..3786bdf 100644
--- a/src/utils/os.h
+++ b/src/utils/os.h
@@ -549,6 +549,22 @@ static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
 	return os_realloc(ptr, nmemb * size);
 }
 
+/**
+ * os_remove_in_array - Remove a member from an array by index
+ * @ptr: pointer to the array
+ * @nmemb: current member count of the array
+ * @size: the size per member of the array
+ * @idx: index of the member which should be removed
+ */
+static inline void os_remove_in_array(void *ptr, size_t nmemb, size_t size,
+				        unsigned int idx)
+{
+	if (idx >= nmemb)
+		return;
+	if (idx < nmemb - 1)
+		os_memmove(ptr + idx * size, ptr + (idx + 1) * size,
+			   (nmemb - idx - 1) * size);
+}
 
 /**
  * os_strlcpy - Copy a string with size bound and NUL-termination
-- 
1.7.10.4



From p.kushwaha  Tue Feb 25 02:56:46 2014
From: p.kushwaha (Purushottam Kushwaha)
Date: Tue, 25 Feb 2014 10:56:46 +0000 (GMT)
Subject: [PATCH]
	s/wpa_supplicant_ctrl_iface_process/wpa_supplicant_global_ctrl_iface_process
Message-ID: <2330146.232241393325806680.JavaMail.weblogic@epml02>

hi,

Patch for review


From p.kushwahaatsamsung.com  Tue Feb 25 02:53:22 2014
From: p.kushwahaatsamsung.com (Purushottam Kushwaha)
Date: Tue, 25 Feb 2014 16:23:22 +0530
Subject: [PATCH]
 s/wpa_supplicant_ctrl_iface_process/wpa_supplicant_global_ctrl_iface_process
Message-ID: <mailman.1.1445595433.27496.hostap@lists.infradead.org>

Signed-off-by: Purushottam Kushwaha <p.kushwaha at samsung.com>
---
 wpa_supplicant/ctrl_iface.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wpa_supplicant/ctrl_iface.h b/wpa_supplicant/ctrl_iface.h
index b0dec53..d54cc07 100644
--- a/wpa_supplicant/ctrl_iface.h
+++ b/wpa_supplicant/ctrl_iface.h
@@ -32,7 +32,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
                                         char *buf, size_t *resp_len);

 /**
- * wpa_supplicant_ctrl_iface_process - Process global ctrl_iface command
+ * wpa_supplicant_global_ctrl_iface_process - Process global ctrl_iface command
  * @global: Pointer to global data from wpa_supplicant_init()
  * @buf: Received command buffer (nul terminated string)
  * @resp_len: Variable to be set to the response length
-- 
1.8.3.2

Thanks,
Purushottam


From rahul.jain  Tue Feb 25 04:02:07 2014
From: rahul.jain (Rahul Jain)
Date: Tue, 25 Feb 2014 12:02:07 +0000 (GMT)
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and
	P2P_OUI_TYPE
Message-ID: <16643744.119941393329727710.JavaMail.weblogic@epml20>

hi, 

Patch for review


From rahul.jainatsamsung.com  Tue Feb 25 03:59:10 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Tue, 25 Feb 2014 17:29:10 +0530
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and
 P2P_OUI_TYPE
Message-ID: <mailman.2.1445595433.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/p2p/p2p_build.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index 664fade..e9b683d 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -17,8 +17,7 @@
 void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token)
 {
 	wpabuf_put_u8(buf, WLAN_ACTION_VENDOR_SPECIFIC);
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 
 	wpabuf_put_u8(buf, subtype); /* OUI Subtype */
 	wpabuf_put_u8(buf, dialog_token);
@@ -31,8 +30,7 @@ void p2p_buf_add_public_action_hdr(struct wpabuf *buf, u8 subtype,
 {
 	wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC);
 	wpabuf_put_u8(buf, WLAN_PA_VENDOR_SPECIFIC);
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 
 	wpabuf_put_u8(buf, subtype); /* OUI Subtype */
 	wpabuf_put_u8(buf, dialog_token);
@@ -47,8 +45,7 @@ u8 * p2p_buf_add_ie_hdr(struct wpabuf *buf)
 	/* P2P IE header */
 	wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
 	len = wpabuf_put(buf, 1); /* IE length to be filled */
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 	wpa_printf(MSG_DEBUG, "P2P: * P2P IE header");
 	return len;
 }
-- 
1.7.9.5




Thanks
-Rahul Jain


From j  Tue Feb 25 05:46:07 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 15:46:07 +0200
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA
	and P2P_OUI_TYPE
In-Reply-To: <16643744.119941393329727710.JavaMail.weblogic@epml20>
References: <16643744.119941393329727710.JavaMail.weblogic@epml20>
Message-ID: <20140225134607.GA19182@w1.fi>

On Tue, Feb 25, 2014 at 12:02:07PM +0000, Rahul Jain wrote:
> Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and
>  P2P_OUI_TYPE

> diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
> @@ -17,8 +17,7 @@
>  void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token)
>  {
>  	wpabuf_put_u8(buf, WLAN_ACTION_VENDOR_SPECIFIC);
> -	wpabuf_put_be24(buf, OUI_WFA);
> -	wpabuf_put_u8(buf, P2P_OUI_TYPE);
> +	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);

Why? I don't see much of a practical difference with this, but the
commit here would leave number of places within src/p2p still using the
OUI_WFA + P2P_OUI_TYPE combination, so this does not seem to make this
any more consistent that it is today.

I guess it could be justifiable to make this consistent, but in that
case, I'd expect the changes to go through all files in hostap.git and
likely also to remove P2P_OUI_TYPE define at the same time.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 05:52:18 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 15:52:18 +0200
Subject: [PATCH 1/3] pno: Change sched_scan_stopped event to handle
	pending PNO properly
In-Reply-To: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
Message-ID: <20140225135218.GB19182@w1.fi>

On Thu, Feb 13, 2014 at 11:23:59AM +0200, Ilan Peer wrote:
> From: Alexander Bondar <alexander.bondar at intel.com>
> 
> 1. Move pno_start and pno_stop to scan.c as more relevant location. Rename
>    them to wpa_supplicant_start_pno/stop_pno.
> 2. Change wpa_supplicant_stop_pno so that nothing will be done if PNO is
>    not in progress.
> 3. When a sched_scan_stopped event is received and there is a pending PNO,
>    it uses regular scheduled scan parameters instead of PNO specific
>    parameters. Change it by calling wpa_supplicant_start_pno.

Could you please split this type of changes into two or more commits? I
want to be able to see the real changes separately both now when
reviewing this and when looking at commits later. Moving functions in
the same commit while changing them makes this unnecessarily painful. In
addition, I'm moving more and more towards using "wpas_" prefix instead
of "wpa_supplicant_" to avoid long function names.

-- 
Jouni Malinen                                            PGP id EFC895FA


From ilan.peer  Tue Feb 25 06:11:24 2014
From: ilan.peer (Peer, Ilan)
Date: Tue, 25 Feb 2014 14:11:24 +0000
Subject: [PATCH 1/3] pno: Change sched_scan_stopped event to handle
	pending PNO properly
In-Reply-To: <20140225135218.GB19182@w1.fi>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
	<20140225135218.GB19182@w1.fi>
Message-ID: <CB3B3D4774441E42AA3EA0E1BA8230A03338A0B1@HASMSX106.ger.corp.intel.com>

> -----Original Message-----
> From: Jouni Malinen [mailto:j at w1.fi]
> Sent: Tuesday, February 25, 2014 15:52
> To: Peer, Ilan
> Cc: hostap at lists.shmoo.com
> Subject: Re: [PATCH 1/3] pno: Change sched_scan_stopped event to handle
> pending PNO properly
> 
> On Thu, Feb 13, 2014 at 11:23:59AM +0200, Ilan Peer wrote:
> > From: Alexander Bondar <alexander.bondar at intel.com>
> >
> > 1. Move pno_start and pno_stop to scan.c as more relevant location.
> Rename
> >    them to wpa_supplicant_start_pno/stop_pno.
> > 2. Change wpa_supplicant_stop_pno so that nothing will be done if PNO is
> >    not in progress.
> > 3. When a sched_scan_stopped event is received and there is a pending
> PNO,
> >    it uses regular scheduled scan parameters instead of PNO specific
> >    parameters. Change it by calling wpa_supplicant_start_pno.
> 
> Could you please split this type of changes into two or more commits? I want
> to be able to see the real changes separately both now when reviewing this
> and when looking at commits later. Moving functions in the same commit
> while changing them makes this unnecessarily painful. In addition, I'm
> moving more and more towards using "wpas_" prefix instead of
> "wpa_supplicant_" to avoid long function names.
> 


Np. You want this to for future patches or this one as well?

Thanks,

Ilan.


From j  Tue Feb 25 06:57:43 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 16:57:43 +0200
Subject: [PATCH 1/3] pno: Change sched_scan_stopped event to handle
	pending PNO properly
In-Reply-To: <CB3B3D4774441E42AA3EA0E1BA8230A03338A0B1@HASMSX106.ger.corp.intel.com>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
	<20140225135218.GB19182@w1.fi>
	<CB3B3D4774441E42AA3EA0E1BA8230A03338A0B1@HASMSX106.ger.corp.intel.com>
Message-ID: <20140225145743.GA11878@w1.fi>

On Tue, Feb 25, 2014 at 02:11:24PM +0000, Peer, Ilan wrote:
> Np. You want this to for future patches or this one as well?

In general, so both included. I would end up having to manually undo the
function move and renaming here to be able to review this in the first
place.. I may have done that in the past myself for some contributions,
but I'm getting lazier.. :)

-- 
Jouni Malinen                                            PGP id EFC895FA


From ilan.peer  Tue Feb 25 07:01:29 2014
From: ilan.peer (Peer, Ilan)
Date: Tue, 25 Feb 2014 15:01:29 +0000
Subject: [PATCH 1/3] pno: Change sched_scan_stopped event to handle
	pending PNO properly
In-Reply-To: <20140225145743.GA11878@w1.fi>
References: <1392283441-13612-1-git-send-email-ilan.peer@intel.com>
	<20140225135218.GB19182@w1.fi>
	<CB3B3D4774441E42AA3EA0E1BA8230A03338A0B1@HASMSX106.ger.corp.intel.com>
	<20140225145743.GA11878@w1.fi>
Message-ID: <CB3B3D4774441E42AA3EA0E1BA8230A03338A262@HASMSX106.ger.corp.intel.com>

> -----Original Message-----
> From: Jouni Malinen [mailto:j at w1.fi]
> Sent: Tuesday, February 25, 2014 16:58
> To: Peer, Ilan
> Cc: hostap at lists.shmoo.com
> Subject: Re: [PATCH 1/3] pno: Change sched_scan_stopped event to handle
> pending PNO properly
> 
> On Tue, Feb 25, 2014 at 02:11:24PM +0000, Peer, Ilan wrote:
> > Np. You want this to for future patches or this one as well?
> 
> In general, so both included. I would end up having to manually undo the
> function move and renaming here to be able to review this in the first place..
> I may have done that in the past myself for some contributions, but I'm
> getting lazier.. :)
> 

Hehe ... np, will resubmit as 2 different patches. 

Thanks,

Ilan.


From j  Tue Feb 25 07:38:13 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 17:38:13 +0200
Subject: [PATCH v2] hwsim tests: add support for the chanctx flag when
	creating radios
In-Reply-To: <1392044779-28372-1-git-send-email-luca@coelho.fi>
References: <1392044779-28372-1-git-send-email-luca@coelho.fi>
Message-ID: <20140225153813.GA14638@w1.fi>

On Mon, Feb 10, 2014 at 05:06:19PM +0200, Luciano Coelho wrote:
> Add a new option to set the use_chanctx flag when creating a radio.
> While at it, refactor the arguments parsing code to use argparse.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 07:38:31 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 17:38:31 +0200
Subject: [PATCH 1/2] hostapd: DFS allow mixed channels
In-Reply-To: <1392489442-14770-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1392489442-14770-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <20140225153831.GB14638@w1.fi>

On Sat, Feb 15, 2014 at 07:37:21PM +0100, Janusz Dziedzic wrote:
> Allow mixed DFS and non-DFS channels.
> Eg. VHT160 on channels 36-64.
> Usefull for testing with mac80211_hwsim
> and VHT160.

Thanks, both patches applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 07:39:00 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 17:39:00 +0200
Subject: [PATCH v2] wpa_supplicant: add support for IPv6 when CTRL UDP used
In-Reply-To: <1393244536-5585-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1393244536-5585-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <20140225153900.GC14638@w1.fi>

On Mon, Feb 24, 2014 at 01:22:16PM +0100, Janusz Dziedzic wrote:
> Add IPv6 support when using udp/udp-remote control
> interface. Added new config options:
> CONFIG_CTRL_IFACE=udp6
> CONFIG_CTRL_IFACE=udp6-remote

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 07:39:24 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 17:39:24 +0200
Subject: [PATCHv3 1/2] hostapd: make it possible to remove addresses from
	maclists
In-Reply-To: <1393322385-3501-1-git-send-email-emanuel.taube@gmail.com>
References: <20140224211254.GC21979@w1.fi>
	<1393322385-3501-1-git-send-email-emanuel.taube@gmail.com>
Message-ID: <20140225153924.GD14638@w1.fi>

On Tue, Feb 25, 2014 at 10:59:44AM +0100, Emanuel Taube wrote:
> It is already possible to add mac addresses at runtime.
> This patch allows also to remove some of them by the prefix "-"
> in the address file.

Thanks, both patches applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 07:39:43 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 17:39:43 +0200
Subject: [PATCH]
	s/wpa_supplicant_ctrl_iface_process/wpa_supplicant_global_ctrl_iface_process
In-Reply-To: <2330146.232241393325806680.JavaMail.weblogic@epml02>
References: <2330146.232241393325806680.JavaMail.weblogic@epml02>
Message-ID: <20140225153943.GE14638@w1.fi>

On Tue, Feb 25, 2014 at 10:56:46AM +0000, Purushottam Kushwaha wrote:
>  s/wpa_supplicant_ctrl_iface_process/wpa_supplicant_global_ctrl_iface_process

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 09:16:58 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 19:16:58 +0200
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <1391176517.4141.19.camel@jlt4.sipsolutions.net>
References: <1378752545-9783-1-git-send-email-greearb@candelatech.com>
	<20130923080817.GD10148@w1.fi> <52406696.1090001@candelatech.com>
	<1389106789.4645.3.camel@jlt4.sipsolutions.net>
	<52CC4393.8010304@candelatech.com>
	<1389794799.4338.19.camel@jlt4.sipsolutions.net>
	<52D6C2DD.2090306@candelatech.com>
	<1391176517.4141.19.camel@jlt4.sipsolutions.net>
Message-ID: <20140225171658.GA16120@w1.fi>

On Fri, Jan 31, 2014 at 02:55:17PM +0100, Johannes Berg wrote:
> The obvious other alternative would be to just do this in the kernel,
> assigning high priority to any packets that have
> tx->sdata->control_port_protocol == tx->skb->protocol (speaking in
> mac80211 language) - a number of drivers already do some special things
> via IEEE80211_TX_CTRL_PORT_CTRL_PROTO.
> 
> I'm not entirely sure that's a better solution overall, but in terms of
> driver compatibility it would certainly be less risky.

With commit 1bf4bbb4024dcdab5e57634dd8ae1072d42a53ac ('mac80211: send
control port protocol frames to the VO queue') now in
wireless-testing.git and tagged for stable, I'm planning on dropping
these wpa_supplicant/hostapd changes that use setsockopt() with the
special SO_PRIORITY values.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Feb 25 09:21:07 2014
From: j (Jouni Malinen)
Date: Tue, 25 Feb 2014 19:21:07 +0200
Subject: How to run a helper script on state changes?
In-Reply-To: <CAK1hOcNJKLdU+kg2byY_HV7_of=EHTC0xtvUqubH2FyECY27WA@mail.gmail.com>
References: <CAK1hOcNJKLdU+kg2byY_HV7_of=EHTC0xtvUqubH2FyECY27WA@mail.gmail.com>
Message-ID: <20140225172107.GB16120@w1.fi>

On Fri, Feb 07, 2014 at 03:55:12PM +0100, Denys Vlasenko wrote:
> I want to run a script every time wpa_supplicant detects
> a change in association state.
> In particular, I want to restart DHCP client,
> since my home wifi is not using the same IP as my work wifi.
> Currently, wpa_supplicant happily drops old association and
> acquires new one... but DHCP client is blissfully unaware
> that it needs to restart, and I am stuck with wrong IP
> until I manually restart DHCP client.

It sounds a bit unfortunate if one were to need to restart DHCP client
for this.. A good DHCP client should really track network operstate
changes and handle this automatically, e.g., with a check that the
default gateway is still there after operstate changes..

> I read "man wpa_supplicant" and "man wpa_supplicant.conf"
> and I don't see such functionality mentioned anywhere.
> Did I miss it?

wpa_supplicant/README and the "Using wpa_cli to run external program on
connect/disconnect" section.

-- 
Jouni Malinen                                            PGP id EFC895FA


From greearb  Tue Feb 25 10:39:52 2014
From: greearb (Ben Greear)
Date: Tue, 25 Feb 2014 10:39:52 -0800
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <20140225171658.GA16120@w1.fi>
References: <1378752545-9783-1-git-send-email-greearb@candelatech.com>
	<20130923080817.GD10148@w1.fi> <52406696.1090001@candelatech.com>
	<1389106789.4645.3.camel@jlt4.sipsolutions.net>
	<52CC4393.8010304@candelatech.com>
	<1389794799.4338.19.camel@jlt4.sipsolutions.net>
	<52D6C2DD.2090306@candelatech.com>
	<1391176517.4141.19.camel@jlt4.sipsolutions.net>
	<20140225171658.GA16120@w1.fi>
Message-ID: <530CE378.5080905@candelatech.com>

On 02/25/2014 09:16 AM, Jouni Malinen wrote:
> On Fri, Jan 31, 2014 at 02:55:17PM +0100, Johannes Berg wrote:
>> The obvious other alternative would be to just do this in the kernel,
>> assigning high priority to any packets that have
>> tx->sdata->control_port_protocol == tx->skb->protocol (speaking in
>> mac80211 language) - a number of drivers already do some special things
>> via IEEE80211_TX_CTRL_PORT_CTRL_PROTO.
>>
>> I'm not entirely sure that's a better solution overall, but in terms of
>> driver compatibility it would certainly be less risky.
> 
> With commit 1bf4bbb4024dcdab5e57634dd8ae1072d42a53ac ('mac80211: send
> control port protocol frames to the VO queue') now in
> wireless-testing.git and tagged for stable, I'm planning on dropping
> these wpa_supplicant/hostapd changes that use setsockopt() with the
> special SO_PRIORITY values.

Ok, that sounds fine to me.

Anyone needing that functionality on older or non stable kernels can just
apply the supplicant patch locally.

Thanks,
Ben

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



From roger.zanoni  Tue Feb 25 11:06:08 2014
From: roger.zanoni (Roger Zanoni)
Date: Tue, 25 Feb 2014 15:06:08 -0400
Subject: [PATCH 1/1] Add a variable to handle extra CFLAGS values
Message-ID: <1393355168-9109-1-git-send-email-roger.zanoni@openbossa.org>

Some packages don't install its headers in the default directory
(e.g.: In Arch Linux libiberty and libn13 includes are installed)
in their own subdirectory under /usr/include) and the build fails
trying to find the headers.

This patch will allow passing extra CFLAGS values without discarding
the assignments made in the Makefile. The CFLAGS values in the Makefile
are ignored, if defined directly in the make command line.

Signed-off-by: Roger Zanoni <roger.zanoni at openbossa.org>
---
 hostapd/Makefile        | 1 +
 wpa_supplicant/Makefile | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hostapd/Makefile b/hostapd/Makefile
index 25c560f..f445a58 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -6,6 +6,7 @@ ifndef CFLAGS
 CFLAGS = -MMD -O2 -Wall -g
 endif
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -I$(abspath ../src)
 CFLAGS += -I$(abspath ../src/utils)
 
diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index b9c8a46..3834490 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -10,6 +10,7 @@ export LIBDIR ?= /usr/local/lib/
 export BINDIR ?= /usr/local/sbin/
 PKG_CONFIG ?= pkg-config
 
+CFLAGS += $(EXTRA_CFLAGS)
 CFLAGS += -I$(abspath ../src)
 CFLAGS += -I$(abspath ../src/utils)
 
-- 
1.9.0



From eduardo.abinader  Tue Feb 25 13:27:03 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Tue, 25 Feb 2014 17:27:03 -0400
Subject: [PATCH 1/1] Fix trace parameter invocation
Message-ID: <1393363623-17657-1-git-send-email-eduardo.abinader@openbossa.org>

Summary:
If trace-cmd command does not exist, this patch avoids
run-tests to keep hanging in a loop, by simply checking
inexistence of trace-cmd command and exiting the script.

Signed-off-by: Eduardo Abinader <eduardo.abinader at openbossa.org>
---
 tests/hwsim/run-tests.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 68ea439..b7565b4 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -108,8 +108,12 @@ class DataCollector(object):
                                                stderr=open('/dev/null', 'w'),
                                                cwd=self._logdir)
             l = self._trace_cmd.stdout.read(7)
-            while not 'STARTED' in l:
+            while self._trace_cmd.poll() is None and not 'STARTED' in l:
                 l += self._trace_cmd.stdout.read(1)
+            res = self._trace_cmd.returncode
+            if res:
+                print "Failed calling trace-cmd: returned exit status %d" % res
+                sys.exit(1)
     def __exit__(self, type, value, traceback):
         if self._tracing:
             self._trace_cmd.stdin.write('DONE\n')
-- 
1.8.1.2



From ilan.peer  Tue Feb 25 22:04:10 2014
From: ilan.peer (Ilan Peer)
Date: Wed, 26 Feb 2014 08:04:10 +0200
Subject: [PATCH 1/2] pno: move and rename pno_start/stop
Message-ID: <1393394651-12024-1-git-send-email-ilan.peer@intel.com>

From: Alexander Bondar <alexander.bondar at intel.com>

Move pno_start and pno_stop to scan.c as more relevant location
and rename them to wpas_start_pno/stop_pno.

Signed-off-by: Alexander Bondar <alexander.bondar at intel.com>
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 wpa_supplicant/ctrl_iface.c |  106 +------------------------------------------
 wpa_supplicant/scan.c       |  104 ++++++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/scan.h       |    2 +
 3 files changed, 108 insertions(+), 104 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index e95b55b..e8b4b4a 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -46,108 +46,6 @@ static int wpa_supplicant_global_iface_list(struct wpa_global *global,
 static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
 						  char *buf, int len);
 
-
-static int pno_start(struct wpa_supplicant *wpa_s)
-{
-	int ret, interval;
-	size_t i, num_ssid;
-	struct wpa_ssid *ssid;
-	struct wpa_driver_scan_params params;
-
-	if (wpa_s->pno || wpa_s->pno_sched_pending)
-		return 0;
-
-	if ((wpa_s->wpa_state > WPA_SCANNING) &&
-	    (wpa_s->wpa_state <= WPA_COMPLETED)) {
-		wpa_printf(MSG_ERROR, "PNO: In assoc process");
-		return -EAGAIN;
-	}
-
-	if (wpa_s->wpa_state == WPA_SCANNING) {
-		wpa_supplicant_cancel_scan(wpa_s);
-		if (wpa_s->sched_scanning) {
-			wpa_printf(MSG_DEBUG, "Schedule PNO on completion of "
-				   "ongoing sched scan");
-			wpa_supplicant_cancel_sched_scan(wpa_s);
-			wpa_s->pno_sched_pending = 1;
-			return 0;
-		}
-	}
-
-	os_memset(&params, 0, sizeof(params));
-
-	num_ssid = 0;
-	ssid = wpa_s->conf->ssid;
-	while (ssid) {
-		if (!wpas_network_disabled(wpa_s, ssid))
-			num_ssid++;
-		ssid = ssid->next;
-	}
-	if (num_ssid > WPAS_MAX_SCAN_SSIDS) {
-		wpa_printf(MSG_DEBUG, "PNO: Use only the first %u SSIDs from "
-			   "%u", WPAS_MAX_SCAN_SSIDS, (unsigned int) num_ssid);
-		num_ssid = WPAS_MAX_SCAN_SSIDS;
-	}
-
-	if (num_ssid == 0) {
-		wpa_printf(MSG_DEBUG, "PNO: No configured SSIDs");
-		return -1;
-	}
-
-	params.filter_ssids = os_malloc(sizeof(struct wpa_driver_scan_filter) *
-					num_ssid);
-	if (params.filter_ssids == NULL)
-		return -1;
-	i = 0;
-	ssid = wpa_s->conf->ssid;
-	while (ssid) {
-		if (!wpas_network_disabled(wpa_s, ssid)) {
-			params.ssids[i].ssid = ssid->ssid;
-			params.ssids[i].ssid_len = ssid->ssid_len;
-			params.num_ssids++;
-			os_memcpy(params.filter_ssids[i].ssid, ssid->ssid,
-				  ssid->ssid_len);
-			params.filter_ssids[i].ssid_len = ssid->ssid_len;
-			params.num_filter_ssids++;
-			i++;
-			if (i == num_ssid)
-				break;
-		}
-		ssid = ssid->next;
-	}
-
-	if (wpa_s->conf->filter_rssi)
-		params.filter_rssi = wpa_s->conf->filter_rssi;
-
-	interval = wpa_s->conf->sched_scan_interval ?
-		wpa_s->conf->sched_scan_interval : 10;
-
-	ret = wpa_supplicant_start_sched_scan(wpa_s, &params, interval);
-	os_free(params.filter_ssids);
-	if (ret == 0)
-		wpa_s->pno = 1;
-	return ret;
-}
-
-
-static int pno_stop(struct wpa_supplicant *wpa_s)
-{
-	int ret = 0;
-
-	if (wpa_s->pno || wpa_s->sched_scanning) {
-		wpa_s->pno = 0;
-		ret = wpa_supplicant_stop_sched_scan(wpa_s);
-	}
-
-	wpa_s->pno_sched_pending = 0;
-
-	if (wpa_s->wpa_state == WPA_SCANNING)
-		wpa_supplicant_req_scan(wpa_s, 0, 0);
-
-	return ret;
-}
-
-
 static int set_bssid_filter(struct wpa_supplicant *wpa_s, char *val)
 {
 	char *pos;
@@ -391,9 +289,9 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_TDLS */
 	} else if (os_strcasecmp(cmd, "pno") == 0) {
 		if (atoi(value))
-			ret = pno_start(wpa_s);
+			ret = wpas_start_pno(wpa_s);
 		else
-			ret = pno_stop(wpa_s);
+			ret = wpas_stop_pno(wpa_s);
 	} else if (os_strcasecmp(cmd, "radio_disabled") == 0) {
 		int disabled = atoi(value);
 		if (wpa_drv_radio_disable(wpa_s, disabled) < 0)
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 6c742d6..b92a064 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1807,3 +1807,107 @@ void wpa_scan_free_params(struct wpa_driver_scan_params *params)
 	os_free(params->filter_ssids);
 	os_free(params);
 }
+
+
+int wpas_start_pno(struct wpa_supplicant *wpa_s)
+{
+	int ret, interval;
+	size_t i, num_ssid;
+	struct wpa_ssid *ssid;
+	struct wpa_driver_scan_params params;
+
+	if (wpa_s->pno || wpa_s->pno_sched_pending)
+		return 0;
+
+	if ((wpa_s->wpa_state > WPA_SCANNING) &&
+	    (wpa_s->wpa_state <= WPA_COMPLETED)) {
+		wpa_printf(MSG_ERROR, "PNO: In assoc process");
+		return -EAGAIN;
+	}
+
+	if (wpa_s->wpa_state == WPA_SCANNING) {
+		wpa_supplicant_cancel_scan(wpa_s);
+		if (wpa_s->sched_scanning) {
+			wpa_printf(MSG_DEBUG, "Schedule PNO on completion of "
+				   "ongoing sched scan");
+			wpa_supplicant_cancel_sched_scan(wpa_s);
+			wpa_s->pno_sched_pending = 1;
+			return 0;
+		}
+	}
+
+	os_memset(&params, 0, sizeof(params));
+
+	num_ssid = 0;
+	ssid = wpa_s->conf->ssid;
+	while (ssid) {
+		if (!wpas_network_disabled(wpa_s, ssid))
+			num_ssid++;
+		ssid = ssid->next;
+	}
+	if (num_ssid > WPAS_MAX_SCAN_SSIDS) {
+		wpa_printf(MSG_DEBUG, "PNO: Use only the first %u SSIDs from "
+			   "%u", WPAS_MAX_SCAN_SSIDS, (unsigned int) num_ssid);
+		num_ssid = WPAS_MAX_SCAN_SSIDS;
+	}
+
+	if (num_ssid == 0) {
+		wpa_printf(MSG_DEBUG, "PNO: No configured SSIDs");
+		return -1;
+	}
+
+	params.filter_ssids = os_malloc(sizeof(struct wpa_driver_scan_filter) *
+					num_ssid);
+	if (params.filter_ssids == NULL)
+		return -1;
+	i = 0;
+	ssid = wpa_s->conf->ssid;
+	while (ssid) {
+		if (!wpas_network_disabled(wpa_s, ssid)) {
+			params.ssids[i].ssid = ssid->ssid;
+			params.ssids[i].ssid_len = ssid->ssid_len;
+			params.num_ssids++;
+			os_memcpy(params.filter_ssids[i].ssid, ssid->ssid,
+				  ssid->ssid_len);
+			params.filter_ssids[i].ssid_len = ssid->ssid_len;
+			params.num_filter_ssids++;
+			i++;
+			if (i == num_ssid)
+				break;
+		}
+		ssid = ssid->next;
+	}
+
+	if (wpa_s->conf->filter_rssi)
+		params.filter_rssi = wpa_s->conf->filter_rssi;
+
+	interval = wpa_s->conf->sched_scan_interval ?
+		wpa_s->conf->sched_scan_interval : 10;
+
+	ret = wpa_supplicant_start_sched_scan(wpa_s, &params, interval);
+	os_free(params.filter_ssids);
+	if (ret == 0)
+		wpa_s->pno = 1;
+	return ret;
+}
+
+
+int wpas_stop_pno(struct wpa_supplicant *wpa_s)
+{
+	int ret = 0;
+
+	if (wpa_s->pno || wpa_s->sched_scanning) {
+		wpa_s->pno = 0;
+		ret = wpa_supplicant_stop_sched_scan(wpa_s);
+	}
+
+	wpa_s->pno_sched_pending = 0;
+
+	if (wpa_s->wpa_state == WPA_SCANNING)
+		wpa_supplicant_req_scan(wpa_s, 0, 0);
+
+	return ret;
+}
+
+
+
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index e4c8989..946d2b3 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -46,5 +46,7 @@ int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s);
 struct wpa_driver_scan_params *
 wpa_scan_clone_params(const struct wpa_driver_scan_params *src);
 void wpa_scan_free_params(struct wpa_driver_scan_params *params);
+int wpas_start_pno(struct wpa_supplicant *wpa_s);
+int wpas_stop_pno(struct wpa_supplicant *wpa_s);
 
 #endif /* SCAN_H */
-- 
1.7.10.4



From ilan.peer  Tue Feb 25 22:04:11 2014
From: ilan.peer (Ilan Peer)
Date: Wed, 26 Feb 2014 08:04:11 +0200
Subject: [PATCH 2/2] pno: change sched_scan_stopped event to handle pending
	pno properly
In-Reply-To: <1393394651-12024-1-git-send-email-ilan.peer@intel.com>
References: <1393394651-12024-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1393394651-12024-2-git-send-email-ilan.peer@intel.com>

From: Alexander Bondar <alexander.bondar at intel.com>

When a sched_scan_stopped event is received and there is a pending PNO,
it uses regular scheduled scan parameters instead of PNO specific
parameters. Change it by calling wpas_start_pno.

Signed-off-by: Alexander Bondar <alexander.bondar at intel.com>
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 wpa_supplicant/events.c |   14 +++++---------
 wpa_supplicant/scan.c   |   17 ++++++++++-------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 47434e4..37c3733 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3302,15 +3302,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 		 * Start a new sched scan to continue searching for more SSIDs
 		 * either if timed out or PNO schedule scan is pending.
 		 */
-		if (wpa_s->sched_scan_timed_out || wpa_s->pno_sched_pending) {
-
-			if (wpa_supplicant_req_sched_scan(wpa_s) < 0 &&
-			    wpa_s->pno_sched_pending) {
-				wpa_msg(wpa_s, MSG_ERROR, "Failed to schedule PNO");
-			} else if (wpa_s->pno_sched_pending) {
-				wpa_s->pno_sched_pending = 0;
-				wpa_s->pno = 1;
-			}
+		if (wpa_s->sched_scan_timed_out) {
+			wpa_supplicant_req_sched_scan(wpa_s);
+		} else if (wpa_s->pno_sched_pending) {
+			wpa_s->pno_sched_pending = 0;
+			wpas_start_pno(wpa_s);
 		}
 
 		break;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index b92a064..77b3e44 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1816,6 +1816,9 @@ int wpas_start_pno(struct wpa_supplicant *wpa_s)
 	struct wpa_ssid *ssid;
 	struct wpa_driver_scan_params params;
 
+	if (!wpa_s->sched_scan_supported)
+		return -1;
+
 	if (wpa_s->pno || wpa_s->pno_sched_pending)
 		return 0;
 
@@ -1888,6 +1891,8 @@ int wpas_start_pno(struct wpa_supplicant *wpa_s)
 	os_free(params.filter_ssids);
 	if (ret == 0)
 		wpa_s->pno = 1;
+	else
+		wpa_msg(wpa_s, MSG_ERROR, "Failed to schedule PNO");
 	return ret;
 }
 
@@ -1896,11 +1901,12 @@ int wpas_stop_pno(struct wpa_supplicant *wpa_s)
 {
 	int ret = 0;
 
-	if (wpa_s->pno || wpa_s->sched_scanning) {
-		wpa_s->pno = 0;
-		ret = wpa_supplicant_stop_sched_scan(wpa_s);
-	}
+	if (!wpa_s->pno)
+		return 0;
+
+	ret = wpa_supplicant_stop_sched_scan(wpa_s);
 
+	wpa_s->pno = 0;
 	wpa_s->pno_sched_pending = 0;
 
 	if (wpa_s->wpa_state == WPA_SCANNING)
@@ -1908,6 +1914,3 @@ int wpas_stop_pno(struct wpa_supplicant *wpa_s)
 
 	return ret;
 }
-
-
-
-- 
1.7.10.4



From rahul.jain  Tue Feb 25 22:22:23 2014
From: rahul.jain (Rahul Jain)
Date: Wed, 26 Feb 2014 06:22:23 +0000 (GMT)
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of
	OUI_WFA and P2P_OUI_TYPE
Message-ID: <23557894.712841393395743142.JavaMail.weblogic@epv6ml04>

hi,

I have modified all files under hostap.git which ever is using OUI_WFA and P2P_OUI_TYPE combination with P2P_IE_VENDOR_TYPE.

I am not able to modify ieee802_11_common.c file as ieee802_11_parse_vendor_specific() will require lot of changes.

Patch for review


From rahul.jainatsamsung.com  Tue Feb 25 22:18:07 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Wed, 26 Feb 2014 11:48:07 +0530
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and
  P2P_OUI_TYPE
Message-ID: <mailman.3.1445595433.27496.hostap@lists.infradead.org>

Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/ap/ctrl_iface_ap.c |    5 ++---
 src/ap/p2p_hostapd.c   |    5 ++---
 src/p2p/p2p.c          |   23 ++++++++---------------
 src/p2p/p2p_build.c    |    9 +++------
 src/p2p/p2p_sd.c       |   45 ++++++++++++---------------------------------
 5 files changed, 27 insertions(+), 60 deletions(-)
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 8c0cbab..c27cf3b 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -250,9 +250,8 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
 
  *pos++ = WLAN_EID_VENDOR_SPECIFIC;
  *pos++ = 4 + 3 + 1;
- WPA_PUT_BE24(pos, OUI_WFA);
- pos += 3;
- *pos++ = P2P_OUI_TYPE;
+ WPA_PUT_BE32(pos, P2P_IE_VENDOR_TYPE);
+ pos += 4;
 
  *pos++ = P2P_ATTR_MINOR_REASON_CODE;
  WPA_PUT_LE16(pos, 1);
diff --git a/src/ap/p2p_hostapd.c b/src/ap/p2p_hostapd.c
index 795d313..9be640c 100644
--- a/src/ap/p2p_hostapd.c
+++ b/src/ap/p2p_hostapd.c
@@ -96,9 +96,8 @@ u8 * hostapd_eid_p2p_manage(struct hostapd_data *hapd, u8 *eid)
  u8 bitmap;
  *eid++ = WLAN_EID_VENDOR_SPECIFIC;
  *eid++ = 4 + 3 + 1;
- WPA_PUT_BE24(eid, OUI_WFA);
- eid += 3;
- *eid++ = P2P_OUI_TYPE;
+ WPA_PUT_BE32(eid, P2P_IE_VENDOR_TYPE);
+ eid += 4;
 
  *eid++ = P2P_ATTR_MANAGEABILITY;
  WPA_PUT_LE16(eid, 1);
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 6f3cd68..e6518ee 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1662,18 +1662,15 @@ static void p2p_rx_action_public(struct p2p_data *p2p, const u8 *da,
   len--;
   if (len < 3)
    return;
-  if (WPA_GET_BE24(data) != OUI_WFA)
+  if (WPA_GET_BE32(data) != P2P_IE_VENDOR_TYPE)
    return;
 
-  data += 3;
-  len -= 3;
+  data += 4;
+  len -= 4;
   if (len < 1)
    return;
 
-  if (*data != P2P_OUI_TYPE)
-   return;
-
-  p2p_rx_p2p_action(p2p, sa, data + 1, len - 1, freq);
+  p2p_rx_p2p_action(p2p, sa, data, len, freq);
   break;
  case WLAN_PA_GAS_INITIAL_REQ:
   p2p_rx_gas_initial_req(p2p, sa, data + 1, len - 1, freq);
@@ -1706,15 +1703,10 @@ void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
  if (len < 4)
   return;
 
- if (WPA_GET_BE24(data) != OUI_WFA)
+ if (WPA_GET_BE32(data) != P2P_IE_VENDOR_TYPE)
   return;
- data += 3;
- len -= 3;
-
- if (*data != P2P_OUI_TYPE)
-  return;
- data++;
- len--;
+ data += 4;
+ len -= 4;
 
  /* P2P action frame */
  p2p_dbg(p2p, "RX P2P Action from " MACSTR, MAC2STR(sa));
@@ -1722,6 +1714,7 @@ void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
 
  if (len < 1)
   return;
+
  switch (data[0]) {
  case P2P_NOA:
   p2p_dbg(p2p, "Received P2P Action - Notice of Absence");
diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index 664fade..e9b683d 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -17,8 +17,7 @@
 void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token)
 {
  wpabuf_put_u8(buf, WLAN_ACTION_VENDOR_SPECIFIC);
- wpabuf_put_be24(buf, OUI_WFA);
- wpabuf_put_u8(buf, P2P_OUI_TYPE);
+ wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 
  wpabuf_put_u8(buf, subtype); /* OUI Subtype */
  wpabuf_put_u8(buf, dialog_token);
@@ -31,8 +30,7 @@ void p2p_buf_add_public_action_hdr(struct wpabuf *buf, u8 subtype,
 {
  wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC);
  wpabuf_put_u8(buf, WLAN_PA_VENDOR_SPECIFIC);
- wpabuf_put_be24(buf, OUI_WFA);
- wpabuf_put_u8(buf, P2P_OUI_TYPE);
+ wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 
  wpabuf_put_u8(buf, subtype); /* OUI Subtype */
  wpabuf_put_u8(buf, dialog_token);
@@ -47,8 +45,7 @@ u8 * p2p_buf_add_ie_hdr(struct wpabuf *buf)
  /* P2P IE header */
  wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
  len = wpabuf_put(buf, 1); /* IE length to be filled */
- wpabuf_put_be24(buf, OUI_WFA);
- wpabuf_put_u8(buf, P2P_OUI_TYPE);
+ wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
  wpa_printf(MSG_DEBUG, "P2P: * P2P IE header");
  return len;
 }
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 26b9c2d..497a1f3 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -171,8 +171,7 @@ static struct wpabuf * p2p_build_sd_query(u16 update_indic,
 
  /* ANQP Query Request Frame */
  len_pos = gas_anqp_add_element(buf, ANQP_VENDOR_SPECIFIC);
- wpabuf_put_be24(buf, OUI_WFA);
- wpabuf_put_u8(buf, P2P_OUI_TYPE);
+ wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
  wpabuf_put_le16(buf, update_indic); /* Service Update Indicator */
  wpabuf_put_buf(buf, tlvs);
  gas_anqp_set_element_len(buf, len_pos);
@@ -218,8 +217,7 @@ static struct wpabuf * p2p_build_sd_response(u8 dialog_token, u16 status_code,
  if (tlvs) {
   /* ANQP Query Response Frame */
   len_pos = gas_anqp_add_element(buf, ANQP_VENDOR_SPECIFIC);
-  wpabuf_put_be24(buf, OUI_WFA);
-  wpabuf_put_u8(buf, P2P_OUI_TYPE);
+  wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
    /* Service Update Indicator */
   wpabuf_put_le16(buf, update_indic);
   wpabuf_put_buf(buf, tlvs);
@@ -250,8 +248,7 @@ static struct wpabuf * p2p_build_gas_comeback_resp(u8 dialog_token,
   /* ANQP Query Response Frame */
   wpabuf_put_le16(buf, ANQP_VENDOR_SPECIFIC); /* Info ID */
   wpabuf_put_le16(buf, 3 + 1 + 2 + total_len);
-  wpabuf_put_be24(buf, OUI_WFA);
-  wpabuf_put_u8(buf, P2P_OUI_TYPE);
+  wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
   /* Service Update Indicator */
   wpabuf_put_le16(buf, update_indic);
  }
@@ -393,17 +390,11 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
   return;
  }
 
- if (WPA_GET_BE24(pos) != OUI_WFA) {
-  p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
+ if (WPA_GET_BE32(pos) != P2P_IE_VENDOR_TYPE) {
+  p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE32(pos));
   return;
  }
- pos += 3;
-
- if (*pos != P2P_OUI_TYPE) {
-  p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
-  return;
- }
- pos++;
+ pos += 4;
 
  if (pos + 2 > end)
   return;
@@ -571,17 +562,11 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
   return;
  }
 
- if (WPA_GET_BE24(pos) != OUI_WFA) {
-  p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
-  return;
- }
- pos += 3;
-
- if (*pos != P2P_OUI_TYPE) {
-  p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
+ if (WPA_GET_BE32(pos) != P2P_IE_VENDOR_TYPE) {
+  p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE32(pos));
   return;
  }
- pos++;
+ pos += 4;
 
  if (pos + 2 > end)
   return;
@@ -795,17 +780,11 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
  if (pos + 4 > end)
   return;
 
- if (WPA_GET_BE24(pos) != OUI_WFA) {
-  p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
-  return;
- }
- pos += 3;
-
- if (*pos != P2P_OUI_TYPE) {
-  p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
+ if (WPA_GET_BE32(pos) != P2P_IE_VENDOR_TYPE) {
+  p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE32(pos));
   return;
  }
- pos++;
+ pos += 4;
 
  if (pos + 2 > end)
   return;
-- 
1.7.9.5


------- Original Message -------
Sender : Jouni Malinen<j at w1.fi>
Date : Feb 25, 2014 19:16 (GMT+05:30)
Title : Re: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and P2P_OUI_TYPE

On Tue, Feb 25, 2014 at 12:02:07PM +0000, Rahul Jain wrote:
> Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and
>  P2P_OUI_TYPE

> diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
> @@ -17,8 +17,7 @@
>  void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token)
>  {
>   wpabuf_put_u8(buf, WLAN_ACTION_VENDOR_SPECIFIC);
> - wpabuf_put_be24(buf, OUI_WFA);
> - wpabuf_put_u8(buf, P2P_OUI_TYPE);
> + wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);

Why? I don't see much of a practical difference with this, but the
commit here would leave number of places within src/p2p still using the
OUI_WFA + P2P_OUI_TYPE combination, so this does not seem to make this
any more consistent that it is today.

I guess it could be justifiable to make this consistent, but in that
case, I'd expect the changes to go through all files in hostap.git and
likely also to remove P2P_OUI_TYPE define at the same time.

-- 
Jouni Malinen                                            PGP id EFC895FA



Thanks
-Rahul Jain


From janusz.dziedzic  Tue Feb 25 22:45:50 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Wed, 26 Feb 2014 07:45:50 +0100
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <530CE378.5080905@candelatech.com>
References: <1378752545-9783-1-git-send-email-greearb@candelatech.com>
	<20130923080817.GD10148@w1.fi> <52406696.1090001@candelatech.com>
	<1389106789.4645.3.camel@jlt4.sipsolutions.net>
	<52CC4393.8010304@candelatech.com>
	<1389794799.4338.19.camel@jlt4.sipsolutions.net>
	<52D6C2DD.2090306@candelatech.com>
	<1391176517.4141.19.camel@jlt4.sipsolutions.net>
	<20140225171658.GA16120@w1.fi> <530CE378.5080905@candelatech.com>
Message-ID: <CALhHN=rJ3A23BAZRouWZjB2fXq8c7ZzaO485VcJw40hO0mHHDw@mail.gmail.com>

On 25 February 2014 19:39, Ben Greear <greearb at candelatech.com> wrote:
> On 02/25/2014 09:16 AM, Jouni Malinen wrote:
>> On Fri, Jan 31, 2014 at 02:55:17PM +0100, Johannes Berg wrote:
>>> The obvious other alternative would be to just do this in the kernel,
>>> assigning high priority to any packets that have
>>> tx->sdata->control_port_protocol == tx->skb->protocol (speaking in
>>> mac80211 language) - a number of drivers already do some special things
>>> via IEEE80211_TX_CTRL_PORT_CTRL_PROTO.
>>>
>>> I'm not entirely sure that's a better solution overall, but in terms of
>>> driver compatibility it would certainly be less risky.
>>
>> With commit 1bf4bbb4024dcdab5e57634dd8ae1072d42a53ac ('mac80211: send
>> control port protocol frames to the VO queue') now in
>> wireless-testing.git and tagged for stable, I'm planning on dropping
>> these wpa_supplicant/hostapd changes that use setsockopt() with the
>> special SO_PRIORITY values.
>
Regarding this mac80211 patch I am just curious what in such case

AP (UAPSD)   <-->   STA (AC: VO - default we have in mac80211)
STA go to PS
AP send EAP (VO) packet - we will not set PVB
STA will not wake-up ...

I am not sure about real word here - if vendors/mac80211 allow STA go
to PS during EAP exchange ...

BR
Janusz


From bartosz.markowski  Wed Feb 26 01:39:47 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Wed, 26 Feb 2014 10:39:47 +0100
Subject: [PATCH] hostapd: fix vht_capab 'Maximum AMPDU Length Exponent'
	handling
Message-ID: <1393407587-16842-1-git-send-email-bartosz.markowski@tieto.com>

As per 802.11ac spec: 'Maximum AMPDU Length Exponent' field value
is in range of 0 to 7. Existing implementation assumes
EXP0 to be max length (bits 23, 24 and 25 set) what is incorrect.

This patch adds options to set it up within the 0 to 7 range.

Signed-off-by: Bartosz Markowski <bartosz.markowski at tieto.com>
---
 hostapd/config_file.c        |   16 ++++++++++++++--
 src/ap/hw_features.c         |    2 +-
 src/common/ieee802_11_defs.h |    9 ++++++++-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index fa7d14a..cae5a92 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1096,8 +1096,20 @@ static int hostapd_config_vht_capab(struct hostapd_config *conf,
 		conf->vht_capab |= VHT_CAP_VHT_TXOP_PS;
 	if (os_strstr(capab, "[HTC-VHT]"))
 		conf->vht_capab |= VHT_CAP_HTC_VHT;
-	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP0]"))
-		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP1]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_1;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP2]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_2;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP3]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_3;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP4]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_4;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP5]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_5;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP6]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_6;
+	if (os_strstr(capab, "[MAX-A-MPDU-LEN-EXP7]"))
+		conf->vht_capab |= VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX;
 	if (os_strstr(capab, "[VHT-LINK-ADAPT2]") &&
 	    (conf->vht_capab & VHT_CAP_HTC_VHT))
 		conf->vht_capab |= VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB;
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 7d36790..62ee84a 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -764,7 +764,7 @@ static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
 	VHT_CAP_CHECK(VHT_CAP_MU_BEAMFORMEE_CAPABLE);
 	VHT_CAP_CHECK(VHT_CAP_VHT_TXOP_PS);
 	VHT_CAP_CHECK(VHT_CAP_HTC_VHT);
-	VHT_CAP_CHECK_MAX(VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT);
+	VHT_CAP_CHECK_MAX(VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX);
 	VHT_CAP_CHECK(VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB);
 	VHT_CAP_CHECK(VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB);
 	VHT_CAP_CHECK(VHT_CAP_RX_ANTENNA_PATTERN);
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 520e55d..70e3c5c 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -757,7 +757,14 @@ struct ieee80211_vht_operation {
 #define VHT_CAP_MU_BEAMFORMEE_CAPABLE               ((u32) BIT(20))
 #define VHT_CAP_VHT_TXOP_PS                         ((u32) BIT(21))
 #define VHT_CAP_HTC_VHT                             ((u32) BIT(22))
-#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT          ((u32) BIT(23) | \
+
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_1        ((u32) BIT(23))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_2        ((u32) BIT(24))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_3        ((u32) BIT(23) | BIT(24))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_4        ((u32) BIT(25))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_5        ((u32) BIT(23) | BIT(25))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_6        ((u32) BIT(24) | BIT(25))
+#define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX      ((u32) BIT(23) | \
 							   BIT(24) | BIT(25))
 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB   ((u32) BIT(27))
 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB     ((u32) BIT(26) | BIT(27))
-- 
1.7.10



From j  Wed Feb 26 03:13:56 2014
From: j (Jouni Malinen)
Date: Wed, 26 Feb 2014 13:13:56 +0200
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA
	and P2P_OUI_TYPE
In-Reply-To: <23557894.712841393395743142.JavaMail.weblogic@epv6ml04>
References: <23557894.712841393395743142.JavaMail.weblogic@epv6ml04>
Message-ID: <20140226111356.GA5620@w1.fi>

On Wed, Feb 26, 2014 at 06:22:23AM +0000, Rahul Jain wrote:
> I have modified all files under hostap.git which ever is using OUI_WFA and P2P_OUI_TYPE combination with P2P_IE_VENDOR_TYPE.

Thanks

> I am not able to modify ieee802_11_common.c file as ieee802_11_parse_vendor_specific() will require lot of changes.

OK

> Patch for review

> @@ -250,9 +250,8 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
> - WPA_PUT_BE24(pos, OUI_WFA);
> - pos += 3;
> - *pos++ = P2P_OUI_TYPE;
> + WPA_PUT_BE32(pos, P2P_IE_VENDOR_TYPE);
> + pos += 4;

This is whitespace damaged (tabs converted to a single space). Could
please send a version that could be applied cleanly? If needed, include
a copy of the patch as an attachment, but in general, using a mailer
that is able to sends whitespace cleanly would be most convenient.

-- 
Jouni Malinen                                            PGP id EFC895FA


From rahul.jain  Wed Feb 26 03:13:53 2014
From: rahul.jain (Rahul Jain)
Date: Wed, 26 Feb 2014 11:13:53 +0000 (GMT)
Subject: [PATCH] Hex Value should be instead of Decimal value as per the P2P
	Technical Specifications
Message-ID: <16900292.784891393413233599.JavaMail.weblogic@epv6ml04>

hi, 

Please review


From rahul.jainatsamsung.com  Wed Feb 26 03:11:31 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Wed, 26 Feb 2014 16:41:31 +0530
Subject: [PATCH] Hex Value should be instead of Decimal value as per the P2P
 Technical Specifications
Message-ID: <mailman.4.1445595433.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/wps/wps_defs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h
index 6f8a49f..614c398 100644
--- a/src/wps/wps_defs.h
+++ b/src/wps/wps_defs.h
@@ -138,7 +138,7 @@ enum wps_attribute {
 	ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
 };
 
-#define WPS_VENDOR_ID_WFA 14122
+#define WPS_VENDOR_ID_WFA 0x372A
 
 /* WFA Vendor Extension subelements */
 enum {
-- 
1.7.9.5



Thanks
-Rahul Jain


From arend  Wed Feb 26 03:18:24 2014
From: arend (Arend van Spriel)
Date: Wed, 26 Feb 2014 12:18:24 +0100
Subject: [PATCH] Hex Value should be instead of Decimal value as per the
	P2P Technical Specifications
In-Reply-To: <16900292.784891393413233599.JavaMail.weblogic@epv6ml04>
References: <16900292.784891393413233599.JavaMail.weblogic@epv6ml04>
Message-ID: <530DCD80.100@broadcom.com>

On 02/26/2014 12:13 PM, Rahul Jain wrote:
> hi, 
> 
> Please review
> 
> From 13e5828fcc886c418b276d4ed9afb4783d1a43d8 Mon Sep 17 00:00:00 2001
> From: Rahul Jain <rahul.jain at samsung.com>
> Date: Wed, 26 Feb 2014 16:41:31 +0530
> Subject: [PATCH] Hex Value should be instead of Decimal value as per the P2P
>  Technical Specifications

Really?

> Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
> ---
>  src/wps/wps_defs.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h
> index 6f8a49f..614c398 100644
> --- a/src/wps/wps_defs.h
> +++ b/src/wps/wps_defs.h
> @@ -138,7 +138,7 @@ enum wps_attribute {
>  	ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
>  };
>  
> -#define WPS_VENDOR_ID_WFA 14122
> +#define WPS_VENDOR_ID_WFA 0x372A
>  
>  /* WFA Vendor Extension subelements */
>  enum {
> 



From rahul.jain  Wed Feb 26 03:31:34 2014
From: rahul.jain (Rahul Jain)
Date: Wed, 26 Feb 2014 11:31:34 +0000 (GMT)
Subject: [PATCH] Hex Value should be instead of Decimal value as per
	the P2P Technical Specifications
Message-ID: <14120115.787041393414294298.JavaMail.weblogic@epv6ml04>

hi Arend,

In P2P Specifications, line "WFA Vendor Extension attribute is a Vendor Extension attribute (ID 0x1049) that uses
Vendor ID 0x00372A and contains one or more subelements" is mentioned

It is good if we follow the specifications in general. It will create less confusion.

Thanks
-Rahul

------- Original Message -------
Sender : Arend van Spriel<arend at broadcom.com>
Date : Feb 26, 2014 16:48 (GMT+05:30)
Title : Re: [PATCH] Hex Value should be instead of Decimal value as per the P2P Technical Specifications

On 02/26/2014 12:13 PM, Rahul Jain wrote:
> hi, 
> 
> Please review
> 
> From 13e5828fcc886c418b276d4ed9afb4783d1a43d8 Mon Sep 17 00:00:00 2001
> From: Rahul Jain 
> Date: Wed, 26 Feb 2014 16:41:31 +0530
> Subject: [PATCH] Hex Value should be instead of Decimal value as per the P2P
>  Technical Specifications

Really?

> Signed-off-by: Rahul Jain 
> ---
>  src/wps/wps_defs.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h
> index 6f8a49f..614c398 100644
> --- a/src/wps/wps_defs.h
> +++ b/src/wps/wps_defs.h
> @@ -138,7 +138,7 @@ enum wps_attribute {
>   ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
>  };
>  
> -#define WPS_VENDOR_ID_WFA 14122
> +#define WPS_VENDOR_ID_WFA 0x372A
>  
>  /* WFA Vendor Extension subelements */
>  enum {
> 




Thanks
-Rahul Jain


From rahul.jain  Wed Feb 26 04:12:10 2014
From: rahul.jain (Rahul Jain)
Date: Wed, 26 Feb 2014 12:12:10 +0000 (GMT)
Subject: [PATCH] Added Support for Registrar Configuration Methods under WFA
	Vendor Extension Subelements
Message-ID: <F3.4F.09100.A1ADD035@epcpsbgx2.samsung.com>

hi,
[PATCH] Added Support for Registrar Configuration Methods under WFA
 Vendor Extension Subelements


From rahul.jainatsamsung.com  Wed Feb 26 04:09:49 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Wed, 26 Feb 2014 17:39:49 +0530
Subject: [PATCH] Added Support for Registrar Configuration Methods under WFA
 Vendor Extension Subelements
Message-ID: <mailman.5.1445595433.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/wps/wps_attr_parse.c |    8 ++++++++
 src/wps/wps_attr_parse.h |    1 +
 src/wps/wps_defs.h       |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/wps/wps_attr_parse.c b/src/wps/wps_attr_parse.c
index 1ebcfe9..8aefdd6 100644
--- a/src/wps/wps_attr_parse.c
+++ b/src/wps/wps_attr_parse.c
@@ -59,6 +59,14 @@ static int wps_set_vendor_ext_wfa_subelem(struct wps_parse_attr *attr,
 		}
 		attr->settings_delay_time = pos;
 		break;
+	case WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS:
+		if (len != 2) {
+			wpa_printf(MSG_DEBUG, "WPS: Invalid Registrar Configuration Methods "
+				   "length %u", len);
+			return -1;
+		}
+		attr->registrar_configuration_methods= pos;
+		break;
 	default:
 		wpa_printf(MSG_MSGDUMP, "WPS: Skipped unknown WFA Vendor "
 			   "Extension subelement %u", id);
diff --git a/src/wps/wps_attr_parse.h b/src/wps/wps_attr_parse.h
index eeb08d1..82c4739 100644
--- a/src/wps/wps_attr_parse.h
+++ b/src/wps/wps_attr_parse.h
@@ -55,6 +55,7 @@ struct wps_parse_attr {
 	const u8 *network_key_shareable; /* 1 octet (Bool) */
 	const u8 *request_to_enroll; /* 1 octet (Bool) */
 	const u8 *ap_channel; /* 2 octets */
+	const u8 *registrar_configuration_methods; /* 2 octets */
 
 	/* variable length fields */
 	const u8 *manufacturer;
diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h
index 614c398..d3c3209 100644
--- a/src/wps/wps_defs.h
+++ b/src/wps/wps_defs.h
@@ -146,7 +146,8 @@ enum {
 	WFA_ELEM_AUTHORIZEDMACS = 0x01,
 	WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
 	WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
-	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
+	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04,
+	WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS = 0x05
 };
 
 /* Device Password ID */
-- 
1.7.9.5



Thanks
-Rahul Jain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Added-Support-for-Registrar-Configuration-Methods-un.patch
Type: application/octet-stream
Size: 2045 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140226/48ed9527/attachment.obj>


From j  Wed Feb 26 06:53:47 2014
From: j (Jouni Malinen)
Date: Wed, 26 Feb 2014 16:53:47 +0200
Subject: [PATCH] Hex Value should be instead of Decimal value as per the
	P2P Technical Specifications
In-Reply-To: <14120115.787041393414294298.JavaMail.weblogic@epv6ml04>
References: <14120115.787041393414294298.JavaMail.weblogic@epv6ml04>
Message-ID: <20140226145347.GA15211@w1.fi>

On Wed, Feb 26, 2014 at 11:31:34AM +0000, Rahul Jain wrote:
> In P2P Specifications, line "WFA Vendor Extension attribute is a Vendor Extension attribute (ID 0x1049) that uses
> Vendor ID 0x00372A and contains one or more subelements" is mentioned
> 
> It is good if we follow the specifications in general. It will create less confusion.

I don't think it makes much of a difference here. The authoritative
source of SMI network management private enterprise codes is the IANA
registry here:
http://www.iana.org/assignments/enterprise-numbers/enterprise-numbers

This registry uses decimal values for the vendor ids. Sure, some of the
WFA specifications use the hexadecimal version of this, but I'd rather
go with the IANA allocation.

(And this is all really quite theoretical.. We could even include both
values with one of them as the comment if that makes it easier to
understand which value is used here. None of this has any difference for
the actual behavior.)

-- 
Jouni Malinen                                            PGP id EFC895FA


From mahmoods  Tue Feb 25 12:26:10 2014
From: mahmoods (Shahid Mahmood)
Date: Tue, 25 Feb 2014 20:26:10 +0000 (UTC)
Subject: 802.1X-2004 =?utf-8?b?Rk9SQ0VfQVVUSA==?= supplicant behavior
References: <96682D8F8FA3774497647E5D9FEFDB9F0887E3@MCHP02MSX.global-ad.net>
Message-ID: <loom.20140225T210453-285@post.gmane.org>

Phillips, Owain <owain.phillips <at> siemens-enterprise.com> writes:

> 
> Hi All,
> 
> I am using 0.7.3 wpa_supplicant and have come across the following issue.
> 
> 802.1x Wired Supplicant has credentials loaded for PEAP or EAP-TLS.
> Access switch is NOT configured for PEAP of EAP-TLS (seen with 3Com
Corebuilder, Enterasys C3 - Forced Auth).
> 
> The Authenticator responds to our EAPoL Start with an immediate EAP-Success.
> This does NOT result in any event sent by the supplicant; it just spins
running through sequence send EAPol
> Start, then receive EAP-Success.
> 
> My endpoint gets no event from the supplicant to kick the system on to
start DHCP.
> 
> Looking more closely into the supplicant code I see in src/eap_peer/eap.c
 a routine
> eap_success_workaround() that is used in eap_peer_sm_step_received() to
determine if the EAP
> statemachine is pushed to SUCCESS or FAILURE state.
> 
> What we were seeing is the control taking one of two paths depending on
the identifier in the EAP-Success. In
> eap_success_workaround()  the difference between the reqId and the lastId
was used to determine if we
> were to kick the State Machine or not. As the lastId is always -1 (we
haven't sent a EAP-Req only EAPoLstart -
> no identifier!!); depending on what id the authenticator placed into the
EAP-Success (arbitrary value)
> we either kick the SM into FAILURE state or do nothing.
> 
> I have modified eap_success_workaround such that if lastId is ever -1;
then we always respond such that the
> SM is kicked (to FAILURE ).
> This means for these Forced Authenticated cases where we see EAPoL Start
followed by an immediate
> EAP-Success. The supplicant will always send an event and NOT be silent.
> 
> This does not seem to break our configuration for EAP-TLS or PEAP; but I
don't know if there are other side
> effects for other protocols. It means I get kicked to start DHCP as switch
said EAP-Success (you have a
> network connection).
> 
> Is this a reasonable fix. 
> How does wpa_supplicant normally cope with this FORCE_AUTH case?
> 
> I quote 802.1X-2004.....
> 
> 8.2.4.11 FORCE_AUTH
> ....
> The authPortStatus is set to Authorized, and a "canned" EAP Success packet
(i.e., a message constructed by
> the Authenticator rather than sent by the Authentication Server) is sent
to the Supplicant. If an EAPOL-Start
> message is received from the Supplicant, the state is re-entered and a
further EAP Success message is sent.
> The effect of this set of actions is to force the Port state to
Authorized, and to reflect this state back to the
> Supplicant if it should initiate authentication, thereby removing
unnecessary delays before the Supplicant
> assumes that it has been authenticated successfully.
> 
> Anyone got any advice?
> 
> Kind Regards,
> Owain
> ?
> 

I have the same situation, with same results. I filed a bug on
'http://w1.fi/bugz/show_bug.cgi?id=482' but the site has disappeared. 
I got around this by modifying the eap_success_workaround() by injecting a
success of lastId == -1 && sm->rxSuccess && !sm->rxFailure.





From mahmoods  Wed Feb 26 08:38:44 2014
From: mahmoods (Mahmood, Shahid Shahid)
Date: Wed, 26 Feb 2014 16:38:44 +0000
Subject: wpa_supplicant failure in "Server Fail Fallback" switch setup -
	rfc4137 EAP Peer State Machine in eap.c
Message-ID: <0B87EEAB2B4134499E2A0D4BE20283D8351C4EE1@AZ-US1EXMB03.global.avaya.com>

Hello,
We have a situation where a Juniper Networks switch is configured in a 'Server Fail Fallback' mode. See:
http://www.juniper.net/techpubs/en_US/junos12.2/topics/task/configuration/802-1x-server-fail-fallback-cli.html
In this mode, the switch sends an 'EAP-Success' to the device in response to just an 'EAP-Request-ID', without going through the full cycle authentication.
Roughly, the transaction looks like this:
1) Switch: ===> EAP-Request-ID
2) Device:===> EAP-Response-ID
3) Switch: ===> EAP-Success
4) Device goes to a FAILURE state
Notice there is no 'EAP-Request-MD5/TLS' coming in from the switch.

The device, running a wpa_supplicant (0.5-10) lands here:
-- eap.c: SM_STEP(EAP)
{
...
                                else if (sm->methodState != METHOD_CONT &&
                                                ((sm->rxFailure &&
                                                   sm->decision != DECISION_UNCOND_SUCC) ||
                                                  (sm->rxSuccess && sm->decision == DECISION_FAIL &&
                                                   (sm->selectedMethod != EAP_TYPE_LEAP ||
                                                    sm->methodState != METHOD_MAY_CONT))) &&
                                                (sm->reqId == sm->lastId ||
                                                  eap_success_workaround(sm, sm->reqId, sm->lastId)))
==>                                         SM_ENTER(EAP, FAILURE);
..
}
At this point, sm->rxSuccess *is* true but sm->decision == DECISION_FAIL, due to initial condition. This effectively decides the final state transition, in this case, a FAILURE. rxReq is also false but ignored here.

Although eap.c appears to correctly implement the intent of rfc4137 (specifically page 8 Figure 3: "EAP Peer State Machine") this obviously contradicts the expectations from the switch folks.

Questions:
- Has anyone experienced this? If so, how was that handled?
- Is this a limitation of rfc 4137 or the implementation? (or both).
If answer is 'no' to all, I would like to know how this configuration can be supported.

Otherwise, I can share a patch for review, which addresses this scenario.

Appreciate your time,

Regards,
----------------------
Shahid Mahmood
Avaya Inc, Canada
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140226/3f434dce/attachment.htm>


From janusz.dziedzic  Thu Feb 27 03:51:56 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Thu, 27 Feb 2014 12:51:56 +0100
Subject: [RFC] hostapd: DFS add cac_time cli command
Message-ID: <1393501916-5264-1-git-send-email-janusz.dziedzic@tieto.com>

Add cac_time cli command, that will display
currently configured and left CAC time.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 hostapd/ctrl_iface.c         |    3 +++
 hostapd/hostapd_cli.c        |    7 +++++++
 src/ap/ap_drv_ops.c          |    4 +++-
 src/ap/ctrl_iface_ap.c       |   40 ++++++++++++++++++++++++++++++++++++++++
 src/ap/ctrl_iface_ap.h       |    3 ++-
 src/ap/dfs.c                 |   32 ++++++++++++++++++++++++++++++--
 src/ap/hostapd.h             |    3 +++
 src/drivers/driver.h         |    3 +++
 src/drivers/driver_nl80211.c |    3 +++
 9 files changed, 94 insertions(+), 4 deletions(-)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index dbdc8c6..a56a068 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1470,6 +1470,9 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx,
 	} else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) {
 		if (hostapd_ctrl_iface_chan_switch(hapd, buf + 12))
 			reply_len = -1;
+	} else if (os_strncmp(buf, "CAC_TIME", 8) == 0) {
+		reply_len = hostapd_ctrl_iface_cac_time(hapd, reply,
+							reply_size);
 	} else {
 		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
 		reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 8caca4f..9431b58 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -940,6 +940,12 @@ static int hostapd_cli_cmd_chan_switch(struct wpa_ctrl *ctrl,
 }
 
 
+static int hostapd_cli_cmd_cac_time(struct wpa_ctrl *ctrl,
+				    int argc, char *argv[])
+{
+	return wpa_ctrl_command(ctrl, "CAC_TIME");
+}
+
 struct hostapd_cli_cmd {
 	const char *cmd;
 	int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]);
@@ -988,6 +994,7 @@ static struct hostapd_cli_cmd hostapd_cli_commands[] = {
 	{ "chan_switch", hostapd_cli_cmd_chan_switch },
 	{ "hs20_wnm_notif", hostapd_cli_cmd_hs20_wnm_notif },
 	{ "hs20_deauth_req", hostapd_cli_cmd_hs20_deauth_req },
+	{ "cac_time", hostapd_cli_cmd_cac_time },
 	{ NULL, NULL }
 };
 
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index b8b260a..21f88fa 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -771,8 +771,10 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int mode, int freq,
 		return -1;
 
 	res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data);
-	if (!res)
+	if (!res) {
 		iface->cac_started = 1;
+		os_get_time(&iface->dfs_cac_start);
+	}
 
 	return res;
 }
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 8c0cbab..fac7695 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -508,3 +508,43 @@ int hostapd_parse_csa_settings(const char *pos,
 
 	return 0;
 }
+
+int hostapd_ctrl_iface_cac_time(struct hostapd_data *hapd, char *buf,
+				size_t buflen)
+{
+	struct hostapd_iface *iface = hapd->iface;
+	int ret;
+	struct os_time now;
+	int left_time = 0;
+
+	if (!iface->cac_started) {
+		ret = os_snprintf(buf, buflen,
+				  "DFS CAC not started\n");
+		if (ret < 0 || (size_t) ret >= buflen)
+			return 0;
+		return ret;
+	}
+
+	if (!iface->dfs_cac_ms) {
+		ret = os_snprintf(buf, buflen,
+				  "DFS CAC time unknown\n");
+		if (ret < 0 || (size_t) ret >= buflen)
+			return 0;
+		return ret;
+	}
+
+	os_get_time(&now);
+	left_time = iface->dfs_cac_ms/1000 - (now.sec - iface->dfs_cac_start.sec);
+	if (left_time < 0)
+		left_time = 0;
+	ret = os_snprintf(buf, buflen,
+			  "DFS CAC stat:\n"
+			  "cac_time: %us\n"
+			  "cac_left_time: %ds\n",
+			  iface->dfs_cac_ms/1000,
+			  left_time);
+	if (ret < 0 || (size_t) ret >= buflen)
+		return 0;
+
+	return ret;
+}
diff --git a/src/ap/ctrl_iface_ap.h b/src/ap/ctrl_iface_ap.h
index ee58b4c..eb7947f 100644
--- a/src/ap/ctrl_iface_ap.h
+++ b/src/ap/ctrl_iface_ap.h
@@ -23,6 +23,7 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
 			      size_t buflen);
 int hostapd_parse_csa_settings(const char *pos,
 			       struct csa_settings *settings);
-
+int hostapd_ctrl_iface_cac_time(struct hostapd_data *hapd, char *buf,
+				size_t buflen);
 
 #endif /* CTRL_IFACE_AP_H */
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 612f534..4e67427 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -537,6 +537,28 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
 }
 
 
+static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
+				     int start_chan_idx,
+				     int n_chans)
+{
+	struct hostapd_channel_data *channel;
+	struct hostapd_hw_modes *mode;
+	int i;
+	unsigned int cac_time_ms = 0;
+
+	mode = iface->current_mode;
+
+	for (i = 0; i < n_chans; i++) {
+		channel = &mode->channels[start_chan_idx + i];
+		if (!(channel->flag & HOSTAPD_CHAN_RADAR))
+			continue;
+		if (channel->dfs_cac_ms > cac_time_ms)
+			cac_time_ms = channel->dfs_cac_ms;
+	}
+
+	return cac_time_ms;
+}
+
 /*
  * Main DFS handler
  * 1 - continue channel/ap setup
@@ -548,8 +570,10 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
 	struct hostapd_channel_data *channel;
 	int res, n_chans, start_chan_idx;
 	int skip_radar = 0;
+	unsigned int cac_time_ms = 0;
 
 	iface->cac_started = 0;
+	iface->dfs_cac_ms = 0;
 
 	do {
 		/* Get start (first) channel for current configuration */
@@ -601,12 +625,14 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
 	} while (res);
 
 	/* Finally start CAC */
+	cac_time_ms = dfs_get_cac_time(iface, start_chan_idx, n_chans);
 	hostapd_set_state(iface, HAPD_IFACE_DFS);
 	wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz", iface->freq);
 	wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
-		"freq=%d chan=%d sec_chan=%d",
+		"freq=%d chan=%d sec_chan=%d, cac_time_ms: %d",
 		iface->freq,
-		iface->conf->channel, iface->conf->secondary_channel);
+		iface->conf->channel, iface->conf->secondary_channel,
+		cac_time_ms);
 	if (hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
 				  iface->freq,
 				  iface->conf->channel,
@@ -620,6 +646,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
 		return -1;
 	}
 
+	iface->dfs_cac_ms = cac_time_ms;
+
 	return 0;
 }
 
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 489ab16..e69e1d1 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -345,6 +345,9 @@ struct hostapd_iface {
 	unsigned int cs_c_off_proberesp;
 	int csa_in_progress;
 
+	u32 dfs_cac_ms;
+	struct os_time dfs_cac_start;
+
 #ifdef CONFIG_ACS
 	unsigned int acs_num_completed_scans;
 #endif /* CONFIG_ACS */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index d2aad24..2d84cac 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -93,6 +93,9 @@ struct hostapd_channel_data {
 	 */
 	long double interference_factor;
 #endif /* CONFIG_ACS */
+
+	/* DFS CAC time in milliseconds */
+	u32 dfs_cac_ms;
 };
 
 #define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 42578b6..7e5558d 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6179,6 +6179,9 @@ static void phy_info_freq(struct hostapd_hw_modes *mode,
 			break;
 		}
 	}
+
+	if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_CAC_TIME])
+		chan->dfs_cac_ms = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_CAC_TIME]);
 }
 
 
-- 
1.7.9.5



From eduardo.abinader  Thu Feb 27 07:08:41 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Thu, 27 Feb 2014 11:08:41 -0400
Subject: [PATCH 1/1] Fix current log dir symbolic link
In-Reply-To: <20140224212049.GD21979@w1.fi>
References: <1393256813-6256-1-git-send-email-eduardo.abinader@openbossa.org>
	<20140224212049.GD21979@w1.fi>
Message-ID: <CABEV-366HKy362v4poce+0n6BsZYsVboy_pcfkkyPPJWVxLg1w@mail.gmail.com>

On Mon, Feb 24, 2014 at 5:20 PM, Jouni Malinen <j at w1.fi> wrote:

> On Mon, Feb 24, 2014 at 11:46:53AM -0400, Eduardo Abinader wrote:
> > This patch aims to fix the update of current symbolic link,
> > when LOGDIR is already set. The current symbolic link was only
> > set, if LOGDIR has not been previously defined. If the user
> > had chosen to cancel the running test and run it again, the current
> > symbolic link was not being updated.
>
> What do you mean with canceling a running test? For me, that means
> stopping and restarting run-tests.py, so I'm not completely sure I
> understood what the problem would be since start.sh would not be even
> run again in that case..
>
> I meant: ./run-all.sh --> ctrl+c ---> ./run-all.sh

start.sh is invoked and current is not updated.

You may also try ./run-all.sh --> ctrl+c and then:
 ./start.sh
./run-test.py -f <test>

Current symbolic is not updated also. Thus, this patch fixes this issue.


> > diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
> > @@ -7,13 +7,11 @@ HAPD=$DIR/../../hostapd/hostapd
> > +DATE="$(date +%s)"
> >
> >  if [ -z "$LOGDIR" ] ; then
> > -    DATE="$(date +%s)"
> >      LOGDIR="$DIR/logs/$DATE"
> >      mkdir -p $LOGDIR
> > -    rm -rf $DIR/logs/current
> > -    ln -sf $DATE $DIR/logs/current
> >  else
> >      if [ -e $LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant ];
> then
> >       WPAS=$LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant
> > @@ -29,6 +27,9 @@ else
> > +rm -rf $DIR/logs/current
> > +ln -sf $DATE $DIR/logs/current
>
> This adds an undesired error message for vm-run.sh cases since $DIR/logs
> directory is on a read-only file system within the VM. That's one of the
> main reasons why the existing code is within that if branch.
>
>
Ok, I managed to fix this misbehavior. I'm now sending the the proper patch.



> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> 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/20140227/994579ed/attachment.htm>


From eduardo.abinader  Thu Feb 27 07:18:36 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Thu, 27 Feb 2014 11:18:36 -0400
Subject: [PATCH 1/1] Fix current log dir symbolic link
Message-ID: <1393514316-7665-1-git-send-email-eduardo.abinader@openbossa.org>

This patch aims to fix the update of current symbolic link,
when LOGDIR is already set. The current symbolic link was only
set, if LOGDIR has not been previously defined. If the user
had chosen to cancel the running test and run it again, the current
symbolic link was not being updated.

Signed-off-by: Eduardo Abinader <eduardo.abinader at openbossa.org>
---
 tests/hwsim/start.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh
index f5e8f27..95d1290 100755
--- a/tests/hwsim/start.sh
+++ b/tests/hwsim/start.sh
@@ -7,13 +7,11 @@ HAPD=$DIR/../../hostapd/hostapd
 HAPD_AS=$DIR/../../hostapd/hostapd
 WLANTEST=$DIR/../../wlantest/wlantest
 HLR_AUC_GW=$DIR/../../hostapd/hlr_auc_gw
+DATE="$(date +%s)"
 
 if [ -z "$LOGDIR" ] ; then
-    DATE="$(date +%s)"
     LOGDIR="$DIR/logs/$DATE"
     mkdir -p $LOGDIR
-    rm -rf $DIR/logs/current
-    ln -sf $DATE $DIR/logs/current
 else
     if [ -e $LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant ]; then
 	WPAS=$LOGDIR/alt-wpa_supplicant/wpa_supplicant/wpa_supplicant
@@ -29,6 +27,11 @@ else
     fi
 fi
 
+if test -w "$DIR/logs" ; then
+    rm -rf $DIR/logs/current
+    ln -sf $DATE $DIR/logs/current
+fi
+
 if groups | tr ' ' "\n" | grep -q ^admin$; then
     GROUP=admin
 else
-- 
1.8.3.2



From Arnon.Meydav  Thu Feb 27 07:13:37 2014
From: Arnon.Meydav (Arnon.Meydav at lantiq.com)
Date: Thu, 27 Feb 2014 15:13:37 +0000
Subject: [PATCH]: WPS 2.0: Prevent setting WPA in WPS 2.0 configuration
Message-ID: <10D0CC65D322B8498995F168AE8D89DAFCB00A22@MUCSE039.lantiq.com>

Commit log:
WPS 2.0: Prevent setting WPA in WPS 2.0 configuration, so that legacy WPS 1 STAs can't cause the WPS session to negotiate an illegal WPA-AES configuration.

Signed-off-by: Arnon Meydav <arnon.meydav at lantiq.com>

diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 3a40125..bedcc46 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -1088,7 +1088,7 @@ int hostapd_init_wps(struct hostapd_data *hapd,
                if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
                        wps->encr_types |= WPS_ENCR_TKIP;
        }
-
+#ifndef CONFIG_WPS2
        if (conf->wpa & WPA_PROTO_WPA) {
                if (conf->wpa_key_mgmt & WPA_KEY_MGMT_PSK)
                        wps->auth_types |= WPS_AUTH_WPAPSK;
@@ -1100,7 +1100,7 @@ int hostapd_init_wps(struct hostapd_data *hapd,
                if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
                        wps->encr_types |= WPS_ENCR_TKIP;
        }
-
+#endif
        if (conf->ssid.security_policy == SECURITY_PLAINTEXT) {
                wps->encr_types |= WPS_ENCR_NONE;
                wps->auth_types |= WPS_AUTH_OPEN;



Details:
We found a legacy retail USB stick (supporting WPS 1), which causes hostapd to select an illegal configuration when running a WPS 2.0 session: 
It finishes the WPS session successfully, but selects WPA + AES, instead of WPA2 + AES.
This is in spite of the fact that the AP was configured to support mixed mode: WPA-TKIP and WPA2-AES.
The STA eventually doesn't connect, but due to the STA rejecting the session, not the AP. 
The AP should not allow selecting this security combination when configured for WPS 2.0.

We found that hostapd doesn't handle the WPS config with the same level of detail as the WPA config.
i.e. if you are configured for wpa_pairwise=TKIP and rsn_pairwise=AES, in WPS config both TKIP and AES will be set, with no regard to which cipher should work with WPA, and which with RSN.
In addition, in WPS 2.0, WPA is not a valid authentication type, no matter what cipher is used, but it could be selected in the WPS config.

We prevented this case by ignoring the WPA configuration (and therefore auth_types will not allow WPA) if WPS 2.0 is defined.


Final note:
While writing this email, I think I found that my patch above is incomplete.
We should also prevent the setting of TKIP even if it is defined in rsn_pairwise.
This second patch was not tested by me, so I am not uniting together with the previous.
I would be happy for a review/opinion.

Signed-off-by: Arnon Meydav <arnon.meydav at lantiq.com>

diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index bedcc46..082310d 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -1085,8 +1085,10 @@ int hostapd_init_wps(struct hostapd_data *hapd,

                if (conf->rsn_pairwise & WPA_CIPHER_CCMP)
                        wps->encr_types |= WPS_ENCR_AES;
+#ifndef CONFIG_WPS2
                if (conf->rsn_pairwise & WPA_CIPHER_TKIP)
                        wps->encr_types |= WPS_ENCR_TKIP;
+#endif
        }
 #ifndef CONFIG_WPS2
        if (conf->wpa & WPA_PROTO_WPA) {


From vda.linux  Thu Feb 27 08:28:20 2014
From: vda.linux (Denys Vlasenko)
Date: Thu, 27 Feb 2014 17:28:20 +0100
Subject: How to run a helper script on state changes?
In-Reply-To: <20140225172107.GB16120@w1.fi>
References: <CAK1hOcNJKLdU+kg2byY_HV7_of=EHTC0xtvUqubH2FyECY27WA@mail.gmail.com>
	<20140225172107.GB16120@w1.fi>
Message-ID: <CAK1hOcN+RCLHYiR=2i2GhmYjJMM+rVQE0VV+6LQ2RckUUvmGSQ@mail.gmail.com>

On Tue, Feb 25, 2014 at 6:21 PM, Jouni Malinen <j at w1.fi> wrote:
> On Fri, Feb 07, 2014 at 03:55:12PM +0100, Denys Vlasenko wrote:
>> I read "man wpa_supplicant" and "man wpa_supplicant.conf"
>> and I don't see such functionality mentioned anywhere.
>> Did I miss it?
>
> wpa_supplicant/README and the "Using wpa_cli to run external program on
> connect/disconnect" section.

Thanks, found it.

Looks like a round-about way to achieve it, though:
it needs enabled "ctrl_interface" thing in wpa_supplicant.conf,
it needs a running wpa_cli process all the time,
and since wpa_cli exits if wpa_supplicant is restarted:

  # wpa_cli -a /qwe/rty
  Selected interface 'wlan0'
  wpa_supplicant is terminating - stop monitoring
  # _

it also needs a process to babysit wpa_cli.

Any chances wpa_supplicant can be taught to launch
a script by itself, avoiding the need to have an extra process?
As in: would you accept a patch which implements
such a feature?

-- 
vda


From johannes  Fri Feb 28 00:54:20 2014
From: johannes (Johannes Berg)
Date: Fri, 28 Feb 2014 09:54:20 +0100
Subject: [PATCH] hostapd: for VHT 20/40, allow center segment 0 to be zero
Message-ID: <1393577660-8760-1-git-send-email-johannes@sipsolutions.net>

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

The 802.11ac amendment specifies that that the center segment 0 field
is reserved, so it should be zero. Hostapd previously required it to
be set, which is likely a good idea for interoperability, but allow it
to be unset. However, don't allow it to be set to a random value, only
allow zero and the correct channel.

Add a test case for this. This was found through a mac80211 bug which
didn't correctly accept a center segment 0 value of zero, so the test
will fail until the mac80211 bug is fixed.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 src/ap/ap_drv_ops.c        |  3 ++-
 tests/hwsim/test_ap_vht.py | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 tests/hwsim/test_ap_vht.py

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index e998fc620510..39e122e249e0 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -492,7 +492,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, int mode,
 	case VHT_CHANWIDTH_USE_HT:
 		if (center_segment1)
 			return -1;
-		if (5000 + center_segment0 * 5 != data->center_freq1 &&
+		if (center_segment0 != 0 &&
+		    5000 + center_segment0 * 5 != data->center_freq1 &&
 		    2407 + center_segment0 * 5 != data->center_freq1)
 			return -1;
 		break;
diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py
new file mode 100644
index 000000000000..afad296b0509
--- /dev/null
+++ b/tests/hwsim/test_ap_vht.py
@@ -0,0 +1,37 @@
+# VHT tests
+# Copyright (c) 2013, Intel Corporation
+#
+# Author: Johannes Berg <johannes.berg at intel.com>
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import logging
+logger = logging.getLogger()
+
+import hwsim_utils
+import hostapd
+import subprocess, time
+
+def test_ap_vht_20(devs, apdevs):
+    dev = devs[0]
+    ap = apdevs[0]
+    subprocess.call(['sudo', 'iw', 'reg', 'set', 'DE'])
+    time.sleep(.1)
+    try:
+        params = { "ssid": "test-vht20",
+                   "hw_mode": "a",
+                   "channel": "36",
+                   "ieee80211n": "1",
+                   "ieee80211ac": "1",
+                   "ht_capab": "",
+                   "vht_capab": "",
+                   "vht_oper_chwidth": "0",
+                   "vht_oper_centr_freq_seg0_idx": "0",
+                   "require_vht": "1",
+                 }
+        hostapd.add_ap(ap['ifname'], params)
+        dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
+        hwsim_utils.test_connectivity(dev.ifname, ap['ifname'])
+    finally:
+        subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
-- 
1.8.5.3



From royujjal  Fri Feb 28 05:40:34 2014
From: royujjal (Ujjal Roy)
Date: Fri, 28 Feb 2014 19:10:34 +0530
Subject: status of HS 2.0 in hostapd
In-Reply-To: <20121225095029.GB4811@w1.fi>
References: <CAPxiQ+=wg=EaWCRNap1hz63MSoj6FTNi41r4unXeJbtGTJ-yKg@mail.gmail.com>
	<20121225095029.GB4811@w1.fi>
Message-ID: <CAE2MWk=rAog0qG4PngXnRhp2b0ztsWsgaNLD1ckmvmN6rBOsMg@mail.gmail.com>

On Tue, Dec 25, 2012 at 3:20 PM, Jouni Malinen <j at w1.fi> wrote:

> On Tue, Dec 25, 2012 at 09:45:10AM +0800, Spencer Chang wrote:
> > Would you please kindly tell me what's the current status of HS 2.0 in
> > hostapd?
> > Does it include HS 2.0 release 1 or release 2?
>
> Most of the Hotspot 2.0 Release 1 functionality that is in scope for
> hostapd (i.e., not including things like Proxy ARP support) are
> supported.
>
> > If release 2 is not done yet, what are the lack features?
>
> The is no public specification for release 2 at this point in time and
> as such, it is not supported.


That means HS 2.0 release 1 is now public right?

As I see some HS 2.0 ANQP, OSU and ICON related coding in hostapd git
source, at this point is hostapd growing with HS 2.0 support?

-- 
Thanks,
UjjaL Roy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140228/c8290a09/attachment.htm>


From michal.kazior  Fri Feb 28 06:19:42 2014
From: michal.kazior (Michal Kazior)
Date: Fri, 28 Feb 2014 15:19:42 +0100
Subject: [PATCH] ACS: fix VHT20
Message-ID: <1393597182-27218-1-git-send-email-michal.kazior@tieto.com>

The center segment0 calculation for VHT20 ACS was
incorrect. This caused ACS to fail with:
"Could not set channel for kernel driver".

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 src/ap/acs.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/ap/acs.c b/src/ap/acs.c
index f58b091..acb13b4 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -616,23 +616,26 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
 
 static void acs_adjust_vht_center_freq(struct hostapd_iface *iface)
 {
+	int offset;
+
 	wpa_printf(MSG_DEBUG, "ACS: Adjusting VHT center frequency");
 
 	switch (iface->conf->vht_oper_chwidth) {
 	case VHT_CHANWIDTH_USE_HT:
-		iface->conf->vht_oper_centr_freq_seg0_idx =
-			iface->conf->channel + 2;
+		offset = 2 * iface->conf->secondary_channel;
 		break;
 	case VHT_CHANWIDTH_80MHZ:
-		iface->conf->vht_oper_centr_freq_seg0_idx =
-			iface->conf->channel + 6;
+		offset = 6;
 		break;
 	default:
 		/* TODO: How can this be calculated? Adjust
 		 * acs_find_ideal_chan() */
 		wpa_printf(MSG_INFO, "ACS: Only VHT20/40/80 is supported now");
-		break;
+		return;
 	}
+
+	iface->conf->vht_oper_centr_freq_seg0_idx =
+		iface->conf->channel + offset;
 }
 
 
-- 
1.8.5.3



From nbd  Fri Feb 28 06:41:49 2014
From: nbd (Felix Fietkau)
Date: Fri, 28 Feb 2014 15:41:49 +0100
Subject: [PATCH] driver_nl80211: fix tearing down wds sta interfaces
Message-ID: <1393598509-9576-1-git-send-email-nbd@openwrt.org>

wpa_driver_nl80211_if_remove checks bss->if_added before deleting an
interface, which is 0 for the first BSS.
The only part of wpa_driver_nl80211_if_remove that should get called for
WDS STA interfaces is the call to nl80211_remove_iface, which can be
pulled in here directly

Signed-off-by: Felix Fietkau <nbd at openwrt.org>
---
 src/drivers/driver_nl80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index bf440b9..c2fe6cd 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -9432,8 +9432,8 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val,
 					name);
 
 		i802_set_sta_vlan(priv, addr, bss->ifname, 0);
-		return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN,
-						    name);
+		nl80211_remove_iface(drv, if_nametoindex(name));
+		return 0;
 	}
 }
 
-- 
1.8.3.4 (Apple Git-47)



From johannes  Fri Feb 28 06:43:41 2014
From: johannes (Johannes Berg)
Date: Fri, 28 Feb 2014 15:43:41 +0100
Subject: [PATCH] ACS: fix VHT20
In-Reply-To: <1393597182-27218-1-git-send-email-michal.kazior@tieto.com>
References: <1393597182-27218-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1393598621.4133.7.camel@jlt4.sipsolutions.net>

On Fri, 2014-02-28 at 15:19 +0100, Michal Kazior wrote:
> The center segment0 calculation for VHT20 ACS was
> incorrect. This caused ACS to fail with:
> "Could not set channel for kernel driver".

Interesting.  But see my previous patch - the kernel part obviously
needs to be fixed but maybe in the beacon it should be set to 0?

johannes




From michal.kazior  Fri Feb 28 06:57:24 2014
From: michal.kazior (Michal Kazior)
Date: Fri, 28 Feb 2014 15:57:24 +0100
Subject: [PATCH] ACS: fix VHT20
In-Reply-To: <1393598621.4133.7.camel@jlt4.sipsolutions.net>
References: <1393597182-27218-1-git-send-email-michal.kazior@tieto.com>
	<1393598621.4133.7.camel@jlt4.sipsolutions.net>
Message-ID: <CA+BoTQkk689Ls-kb6vmRxzktUiuwxWJzOw84oNkOYKP3uqcTyg@mail.gmail.com>

On 28 February 2014 15:43, Johannes Berg <johannes at sipsolutions.net> wrote:
> On Fri, 2014-02-28 at 15:19 +0100, Michal Kazior wrote:
>> The center segment0 calculation for VHT20 ACS was
>> incorrect. This caused ACS to fail with:
>> "Could not set channel for kernel driver".
>
> Interesting.  But see my previous patch - the kernel part obviously
> needs to be fixed but maybe in the beacon it should be set to 0?

Won't setting it to 0 break older kernels with hostapd ACS for
VHT20/VHT40? I'm not sure if that's what we want?


Micha?


From johannes  Fri Feb 28 08:11:48 2014
From: johannes (Johannes Berg)
Date: Fri, 28 Feb 2014 17:11:48 +0100
Subject: [PATCH] ACS: fix VHT20
In-Reply-To: <CA+BoTQkk689Ls-kb6vmRxzktUiuwxWJzOw84oNkOYKP3uqcTyg@mail.gmail.com>
	(sfid-20140228_155725_550352_B30BF8FA)
References: <1393597182-27218-1-git-send-email-michal.kazior@tieto.com>
	<1393598621.4133.7.camel@jlt4.sipsolutions.net>
	<CA+BoTQkk689Ls-kb6vmRxzktUiuwxWJzOw84oNkOYKP3uqcTyg@mail.gmail.com>
	(sfid-20140228_155725_550352_B30BF8FA)
Message-ID: <1393603908.4133.8.camel@jlt4.sipsolutions.net>

On Fri, 2014-02-28 at 15:57 +0100, Michal Kazior wrote:
> On 28 February 2014 15:43, Johannes Berg <johannes at sipsolutions.net> wrote:
> > On Fri, 2014-02-28 at 15:19 +0100, Michal Kazior wrote:
> >> The center segment0 calculation for VHT20 ACS was
> >> incorrect. This caused ACS to fail with:
> >> "Could not set channel for kernel driver".
> >
> > Interesting.  But see my previous patch - the kernel part obviously
> > needs to be fixed but maybe in the beacon it should be set to 0?
> 
> Won't setting it to 0 break older kernels with hostapd ACS for
> VHT20/VHT40? I'm not sure if that's what we want?

Well the *kernel* value in the chandef has to be set correctly,
obviously. I'm merely pointing out that since my recent patch it's
possible to (correctly, the spec says it's reserved) set the field to 0
in the VHT operation IE.

johannes



From greearb  Fri Feb 28 11:08:24 2014
From: greearb (Ben Greear)
Date: Fri, 28 Feb 2014 11:08:24 -0800
Subject: What is needed to support EAP-AKA with HS20?
Message-ID: <5310DEA8.3080309@candelatech.com>

One of our users is interested in using EAP-AKA with HS20.

It appears this does not work yet (or did not in a slightly older
version of supplicant).

Any idea what things need to be fixed to make this work?

Thanks,
Ben

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



From j  Fri Feb 28 12:02:05 2014
From: j (Jouni Malinen)
Date: Fri, 28 Feb 2014 22:02:05 +0200
Subject: What is needed to support EAP-AKA with HS20?
In-Reply-To: <5310DEA8.3080309@candelatech.com>
References: <5310DEA8.3080309@candelatech.com>
Message-ID: <20140228200205.GA18176@w1.fi>

On Fri, Feb 28, 2014 at 11:08:24AM -0800, Ben Greear wrote:
> One of our users is interested in using EAP-AKA with HS20.
> 
> It appears this does not work yet (or did not in a slightly older
> version of supplicant).

I'm not aware of any such issue.

-- 
Jouni Malinen                                            PGP id EFC895FA


From greearb  Fri Feb 28 12:17:20 2014
From: greearb (Ben Greear)
Date: Fri, 28 Feb 2014 12:17:20 -0800
Subject: What is needed to support EAP-AKA with HS20?
In-Reply-To: <20140228200205.GA18176@w1.fi>
References: <5310DEA8.3080309@candelatech.com> <20140228200205.GA18176@w1.fi>
Message-ID: <5310EED0.2030706@candelatech.com>

On 02/28/2014 12:02 PM, Jouni Malinen wrote:
> On Fri, Feb 28, 2014 at 11:08:24AM -0800, Ben Greear wrote:
>> One of our users is interested in using EAP-AKA with HS20.
>>
>> It appears this does not work yet (or did not in a slightly older
>> version of supplicant).
> 
> I'm not aware of any such issue.

Ok, I'll look at it closer then..maybe some part of the system
is just mis-configured.

Thanks,
Ben

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



From rahul.jainatsamsung.com  Tue Feb 25 22:18:07 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Wed, 26 Feb 2014 11:48:07 +0530
Subject: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and
  P2P_OUI_TYPE
Message-ID: <mailman.6.1445595434.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/ap/ctrl_iface_ap.c |    5 ++---
 src/ap/p2p_hostapd.c   |    5 ++---
 src/p2p/p2p.c          |   23 ++++++++---------------
 src/p2p/p2p_build.c    |    9 +++------
 src/p2p/p2p_sd.c       |   45 ++++++++++++---------------------------------
 5 files changed, 27 insertions(+), 60 deletions(-)

diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 8c0cbab..c27cf3b 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -250,9 +250,8 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
 
 	*pos++ = WLAN_EID_VENDOR_SPECIFIC;
 	*pos++ = 4 + 3 + 1;
-	WPA_PUT_BE24(pos, OUI_WFA);
-	pos += 3;
-	*pos++ = P2P_OUI_TYPE;
+	WPA_PUT_BE32(pos, P2P_IE_VENDOR_TYPE);
+	pos += 4;
 
 	*pos++ = P2P_ATTR_MINOR_REASON_CODE;
 	WPA_PUT_LE16(pos, 1);
diff --git a/src/ap/p2p_hostapd.c b/src/ap/p2p_hostapd.c
index 795d313..9be640c 100644
--- a/src/ap/p2p_hostapd.c
+++ b/src/ap/p2p_hostapd.c
@@ -96,9 +96,8 @@ u8 * hostapd_eid_p2p_manage(struct hostapd_data *hapd, u8 *eid)
 	u8 bitmap;
 	*eid++ = WLAN_EID_VENDOR_SPECIFIC;
 	*eid++ = 4 + 3 + 1;
-	WPA_PUT_BE24(eid, OUI_WFA);
-	eid += 3;
-	*eid++ = P2P_OUI_TYPE;
+	WPA_PUT_BE32(eid, P2P_IE_VENDOR_TYPE);
+	eid += 4;
 
 	*eid++ = P2P_ATTR_MANAGEABILITY;
 	WPA_PUT_LE16(eid, 1);
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 6f3cd68..e6518ee 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -1662,18 +1662,15 @@ static void p2p_rx_action_public(struct p2p_data *p2p, const u8 *da,
 		len--;
 		if (len < 3)
 			return;
-		if (WPA_GET_BE24(data) != OUI_WFA)
+		if (WPA_GET_BE32(data) != P2P_IE_VENDOR_TYPE)
 			return;
 
-		data += 3;
-		len -= 3;
+		data += 4;
+		len -= 4;
 		if (len < 1)
 			return;
 
-		if (*data != P2P_OUI_TYPE)
-			return;
-
-		p2p_rx_p2p_action(p2p, sa, data + 1, len - 1, freq);
+		p2p_rx_p2p_action(p2p, sa, data, len, freq);
 		break;
 	case WLAN_PA_GAS_INITIAL_REQ:
 		p2p_rx_gas_initial_req(p2p, sa, data + 1, len - 1, freq);
@@ -1706,15 +1703,10 @@ void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
 	if (len < 4)
 		return;
 
-	if (WPA_GET_BE24(data) != OUI_WFA)
+	if (WPA_GET_BE32(data) != P2P_IE_VENDOR_TYPE)
 		return;
-	data += 3;
-	len -= 3;
-
-	if (*data != P2P_OUI_TYPE)
-		return;
-	data++;
-	len--;
+	data += 4;
+	len -= 4;
 
 	/* P2P action frame */
 	p2p_dbg(p2p, "RX P2P Action from " MACSTR, MAC2STR(sa));
@@ -1722,6 +1714,7 @@ void p2p_rx_action(struct p2p_data *p2p, const u8 *da, const u8 *sa,
 
 	if (len < 1)
 		return;
+
 	switch (data[0]) {
 	case P2P_NOA:
 		p2p_dbg(p2p, "Received P2P Action - Notice of Absence");
diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index 664fade..e9b683d 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -17,8 +17,7 @@
 void p2p_buf_add_action_hdr(struct wpabuf *buf, u8 subtype, u8 dialog_token)
 {
 	wpabuf_put_u8(buf, WLAN_ACTION_VENDOR_SPECIFIC);
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 
 	wpabuf_put_u8(buf, subtype); /* OUI Subtype */
 	wpabuf_put_u8(buf, dialog_token);
@@ -31,8 +30,7 @@ void p2p_buf_add_public_action_hdr(struct wpabuf *buf, u8 subtype,
 {
 	wpabuf_put_u8(buf, WLAN_ACTION_PUBLIC);
 	wpabuf_put_u8(buf, WLAN_PA_VENDOR_SPECIFIC);
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 
 	wpabuf_put_u8(buf, subtype); /* OUI Subtype */
 	wpabuf_put_u8(buf, dialog_token);
@@ -47,8 +45,7 @@ u8 * p2p_buf_add_ie_hdr(struct wpabuf *buf)
 	/* P2P IE header */
 	wpabuf_put_u8(buf, WLAN_EID_VENDOR_SPECIFIC);
 	len = wpabuf_put(buf, 1); /* IE length to be filled */
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 	wpa_printf(MSG_DEBUG, "P2P: * P2P IE header");
 	return len;
 }
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c
index 26b9c2d..497a1f3 100644
--- a/src/p2p/p2p_sd.c
+++ b/src/p2p/p2p_sd.c
@@ -171,8 +171,7 @@ static struct wpabuf * p2p_build_sd_query(u16 update_indic,
 
 	/* ANQP Query Request Frame */
 	len_pos = gas_anqp_add_element(buf, ANQP_VENDOR_SPECIFIC);
-	wpabuf_put_be24(buf, OUI_WFA);
-	wpabuf_put_u8(buf, P2P_OUI_TYPE);
+	wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 	wpabuf_put_le16(buf, update_indic); /* Service Update Indicator */
 	wpabuf_put_buf(buf, tlvs);
 	gas_anqp_set_element_len(buf, len_pos);
@@ -218,8 +217,7 @@ static struct wpabuf * p2p_build_sd_response(u8 dialog_token, u16 status_code,
 	if (tlvs) {
 		/* ANQP Query Response Frame */
 		len_pos = gas_anqp_add_element(buf, ANQP_VENDOR_SPECIFIC);
-		wpabuf_put_be24(buf, OUI_WFA);
-		wpabuf_put_u8(buf, P2P_OUI_TYPE);
+		wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 		 /* Service Update Indicator */
 		wpabuf_put_le16(buf, update_indic);
 		wpabuf_put_buf(buf, tlvs);
@@ -250,8 +248,7 @@ static struct wpabuf * p2p_build_gas_comeback_resp(u8 dialog_token,
 		/* ANQP Query Response Frame */
 		wpabuf_put_le16(buf, ANQP_VENDOR_SPECIFIC); /* Info ID */
 		wpabuf_put_le16(buf, 3 + 1 + 2 + total_len);
-		wpabuf_put_be24(buf, OUI_WFA);
-		wpabuf_put_u8(buf, P2P_OUI_TYPE);
+		wpabuf_put_be32(buf, P2P_IE_VENDOR_TYPE);
 		/* Service Update Indicator */
 		wpabuf_put_le16(buf, update_indic);
 	}
@@ -393,17 +390,11 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
 		return;
 	}
 
-	if (WPA_GET_BE24(pos) != OUI_WFA) {
-		p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
+	if (WPA_GET_BE32(pos) != P2P_IE_VENDOR_TYPE) {
+		p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE32(pos));
 		return;
 	}
-	pos += 3;
-
-	if (*pos != P2P_OUI_TYPE) {
-		p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
-		return;
-	}
-	pos++;
+	pos += 4;
 
 	if (pos + 2 > end)
 		return;
@@ -571,17 +562,11 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
 		return;
 	}
 
-	if (WPA_GET_BE24(pos) != OUI_WFA) {
-		p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
-		return;
-	}
-	pos += 3;
-
-	if (*pos != P2P_OUI_TYPE) {
-		p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
+	if (WPA_GET_BE32(pos) != P2P_IE_VENDOR_TYPE) {
+		p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE32(pos));
 		return;
 	}
-	pos++;
+	pos += 4;
 
 	if (pos + 2 > end)
 		return;
@@ -795,17 +780,11 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
 	if (pos + 4 > end)
 		return;
 
-	if (WPA_GET_BE24(pos) != OUI_WFA) {
-		p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
-		return;
-	}
-	pos += 3;
-
-	if (*pos != P2P_OUI_TYPE) {
-		p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
+	if (WPA_GET_BE32(pos) != P2P_IE_VENDOR_TYPE) {
+		p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE32(pos));
 		return;
 	}
-	pos++;
+	pos += 4;
 
 	if (pos + 2 > end)
 		return;
-- 
1.7.9.5


Thanks
-Rahul

------- Original Message -------
Sender : Jouni Malinen
Date : Feb 26, 2014 16:43 (GMT+05:30)
Title : Re: [PATCH] Use P2P_IE_VENDOR_TYPE instead of combination of OUI_WFA and P2P_OUI_TYPE

On Wed, Feb 26, 2014 at 06:22:23AM +0000, Rahul Jain wrote:
> I have modified all files under hostap.git which ever is using OUI_WFA and P2P_OUI_TYPE combination with P2P_IE_VENDOR_TYPE.

Thanks

> I am not able to modify ieee802_11_common.c file as ieee802_11_parse_vendor_specific() will require lot of changes.

OK

> Patch for review

> @@ -250,9 +250,8 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
> - WPA_PUT_BE24(pos, OUI_WFA);
> - pos += 3;
> - *pos++ = P2P_OUI_TYPE;
> + WPA_PUT_BE32(pos, P2P_IE_VENDOR_TYPE);
> + pos += 4;

This is whitespace damaged (tabs converted to a single space). Could
please send a version that could be applied cleanly? If needed, include
a copy of the patch as an attachment, but in general, using a mailer
that is able to sends whitespace cleanly would be most convenient.

-- 
Jouni Malinen                                            PGP id EFC895FA



Thanks
-Rahul Jain


Thanks
-Rahul Jain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-P2P_IE_VENDOR_TYPE-instead-of-combination-of-OUI.patch
Type: application/octet-stream
Size: 7071 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140303/a32d15d5/attachment.obj>


From rahul.jainatsamsung.com  Wed Feb 26 04:09:49 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Wed, 26 Feb 2014 17:39:49 +0530
Subject: [PATCH] Added Support for Registrar Configuration Methods under WFA
 Vendor Extension Subelements
Message-ID: <mailman.7.1445595434.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/wps/wps_attr_parse.c |    8 ++++++++
 src/wps/wps_attr_parse.h |    1 +
 src/wps/wps_defs.h       |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/wps/wps_attr_parse.c b/src/wps/wps_attr_parse.c
index 1ebcfe9..8aefdd6 100644
--- a/src/wps/wps_attr_parse.c
+++ b/src/wps/wps_attr_parse.c
@@ -59,6 +59,14 @@ static int wps_set_vendor_ext_wfa_subelem(struct wps_parse_attr *attr,
 		}
 		attr->settings_delay_time = pos;
 		break;
+	case WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS:
+		if (len != 2) {
+			wpa_printf(MSG_DEBUG, "WPS: Invalid Registrar Configuration Methods "
+				   "length %u", len);
+			return -1;
+		}
+		attr->registrar_configuration_methods= pos;
+		break;
 	default:
 		wpa_printf(MSG_MSGDUMP, "WPS: Skipped unknown WFA Vendor "
 			   "Extension subelement %u", id);
diff --git a/src/wps/wps_attr_parse.h b/src/wps/wps_attr_parse.h
index eeb08d1..82c4739 100644
--- a/src/wps/wps_attr_parse.h
+++ b/src/wps/wps_attr_parse.h
@@ -55,6 +55,7 @@ struct wps_parse_attr {
 	const u8 *network_key_shareable; /* 1 octet (Bool) */
 	const u8 *request_to_enroll; /* 1 octet (Bool) */
 	const u8 *ap_channel; /* 2 octets */
+	const u8 *registrar_configuration_methods; /* 2 octets */
 
 	/* variable length fields */
 	const u8 *manufacturer;
diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h
index 614c398..d3c3209 100644
--- a/src/wps/wps_defs.h
+++ b/src/wps/wps_defs.h
@@ -146,7 +146,8 @@ enum {
 	WFA_ELEM_AUTHORIZEDMACS = 0x01,
 	WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
 	WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
-	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
+	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04,
+	WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS = 0x05
 };
 
 /* Device Password ID */
-- 
1.7.9.5


From rahul.jainatsamsung.com  Wed Feb 26 04:09:49 2014
From: rahul.jainatsamsung.com (Rahul Jain)
Date: Wed, 26 Feb 2014 17:39:49 +0530
Subject: [PATCH] Added Support for Registrar Configuration Methods under WFA
 Vendor Extension Subelements
Message-ID: <mailman.8.1445595434.27496.hostap@lists.infradead.org>


Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 src/wps/wps_attr_parse.c |    8 ++++++++
 src/wps/wps_attr_parse.h |    1 +
 src/wps/wps_defs.h       |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/wps/wps_attr_parse.c b/src/wps/wps_attr_parse.c
index 1ebcfe9..8aefdd6 100644
--- a/src/wps/wps_attr_parse.c
+++ b/src/wps/wps_attr_parse.c
@@ -59,6 +59,14 @@ static int wps_set_vendor_ext_wfa_subelem(struct wps_parse_attr *attr,
 		}
 		attr->settings_delay_time = pos;
 		break;
+	case WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS:
+		if (len != 2) {
+			wpa_printf(MSG_DEBUG, "WPS: Invalid Registrar Configuration Methods "
+				   "length %u", len);
+			return -1;
+		}
+		attr->registrar_configuration_methods= pos;
+		break;
 	default:
 		wpa_printf(MSG_MSGDUMP, "WPS: Skipped unknown WFA Vendor "
 			   "Extension subelement %u", id);
diff --git a/src/wps/wps_attr_parse.h b/src/wps/wps_attr_parse.h
index eeb08d1..82c4739 100644
--- a/src/wps/wps_attr_parse.h
+++ b/src/wps/wps_attr_parse.h
@@ -55,6 +55,7 @@ struct wps_parse_attr {
 	const u8 *network_key_shareable; /* 1 octet (Bool) */
 	const u8 *request_to_enroll; /* 1 octet (Bool) */
 	const u8 *ap_channel; /* 2 octets */
+   const u8 *registrar_configuration_methods; /* 2 octets */
 
 	/* variable length fields */
 	const u8 *manufacturer;
diff --git a/src/wps/wps_defs.h b/src/wps/wps_defs.h
index 614c398..d3c3209 100644
--- a/src/wps/wps_defs.h
+++ b/src/wps/wps_defs.h
@@ -146,7 +146,8 @@ enum {
 	WFA_ELEM_AUTHORIZEDMACS = 0x01,
 	WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
 	WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
-	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04
+	WFA_ELEM_SETTINGS_DELAY_TIME = 0x04,
+	WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS = 0x05
 };
 
 /* Device Password ID */
-- 
1.7.9.5

Thanks
-Rahul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Added-Support-for-Registrar-Configuration-Methods-un.patch
Type: application/octet-stream
Size: 2045 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140305/407ae7a4/attachment-0001.obj>


